Ignore:
Timestamp:
2006-10-15T20:24:01Z (18 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
d74c644
Parents:
e617b35
Message:

Proper cleanup of jabber buddy structures when removing a buddy from the
list, proper checking (and handling) of events related to buddies that
aren't "hashed" yet, limit checks on priorityto setting, renamed JEP85
to XEP85, support for more XEP85 states.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/message.c

    re617b35 r788a1af  
    3030        char *type = xt_find_attr( node, "type" );
    3131        struct xt_node *body = xt_find_node( node->children, "body" );
     32        char *s;
    3233       
    3334        if( !type )
     
    3839                struct jabber_buddy *bud = NULL;
    3940               
    40                 if( strchr( from, '/' ) == NULL )
     41                if( ( s = strchr( from, '/' ) ) == NULL )
    4142                {
    4243                        /* It just shouldn't happen. */
     
    4647                }
    4748               
    48                 bud = jabber_buddy_by_jid( gc, from );
    49                 bud->last_act = time( NULL );
     49                if( ( bud = jabber_buddy_by_jid( gc, from ) ) )
     50                        bud->last_act = time( NULL );
     51                else
     52                        *s = 0; /* We need to generate a bare JID now. */
    5053               
    5154                if( body ) /* Could be just a typing notification. */
    52                         serv_got_im( gc, bud->handle, body->text, 0, 0, 0 );
     55                        serv_got_im( gc, bud ? bud->handle : from, body->text, 0, 0, 0 );
    5356               
     57                /* Handling of incoming typing notifications. */
    5458                if( xt_find_node( node->children, "composing" ) )
    5559                {
    56                         bud->flags |= JBFLAG_DOES_JEP85;
    57                         serv_got_typing( gc, bud->handle, 0, 1 );
     60                        bud->flags |= JBFLAG_DOES_XEP85;
     61                        serv_got_typing( gc, bud ? bud->handle : from, 0, 1 );
    5862                }
    59                 else if( xt_find_node( node->children, "active" ) )
     63                /* No need to send a "stopped typing" signal when there's a message. */
     64                else if( xt_find_node( node->children, "active" ) && ( body == NULL ) )
    6065                {
    61                         bud->flags |= JBFLAG_DOES_JEP85;
     66                        bud->flags |= JBFLAG_DOES_XEP85;
     67                        serv_got_typing( gc, bud ? bud->handle : from, 0, 0 );
    6268                }
     69                else if( xt_find_node( node->children, "paused" ) )
     70                {
     71                        bud->flags |= JBFLAG_DOES_XEP85;
     72                        serv_got_typing( gc, bud ? bud->handle : from, 0, 2 );
     73                }
     74               
     75                if( s )
     76                        *s = '/'; /* And convert it back to a full JID. */
    6377        }
    6478        else
     
    7084        return XT_HANDLED;
    7185}
    72 
Note: See TracChangeset for help on using the changeset viewer.