Ignore:
Timestamp:
2006-10-10T12:05:42Z (15 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
8eb10c9
Parents:
6a1128d
Message:

Added resource selection (based on priority or time of last message) to
budd_by_jid(), added a full_jid property to easily address that resource
without having to rebuild the full JID every time and implemented typing
notification shite.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/message.c

    r6a1128d ra21a8ac  
    2929        char *from = xt_find_attr( node, "from" );
    3030        char *type = xt_find_attr( node, "type" );
    31         struct xt_node *msg = xt_find_node( node->children, "body" );
     31        struct xt_node *body = xt_find_node( node->children, "body" );
    3232       
    33         if( !type || !msg )
     33        if( !type )
    3434                return XT_HANDLED;      /* Grmbl... FIXME */
    3535       
    3636        if( strcmp( type, "chat" ) == 0 )
    3737        {
    38                 char *s;
     38                struct jabber_buddy *bud = NULL;
    3939               
    40                 s = strchr( from, '/' );
    41                 if( s )
    42                         *s = 0;
     40                if( strchr( from, '/' ) == NULL )
     41                {
     42                        /* It just shouldn't happen. */
     43                        hide_login_progress( gc, "Received message packet from bare JID" );
     44                        signoff( gc );
     45                        return XT_ABORT;
     46                }
    4347               
    44                 serv_got_im( gc, from, msg->text, 0, 0, 0 );
     48                bud = jabber_buddy_by_jid( gc, from );
     49                bud->last_act = time( NULL );
    4550               
    46                 if( s )
    47                         *s = '/';
     51                if( body ) /* Could be just a typing notification. */
     52                        serv_got_im( gc, bud->handle, body->text, 0, 0, 0 );
     53               
     54                if( xt_find_node( node->children, "composing" ) )
     55                {
     56                        bud->flags |= JBFLAG_DOES_JEP85;
     57                        serv_got_typing( gc, bud->handle, 0, 1 );
     58                }
     59                else if( xt_find_node( node->children, "active" ) )
     60                {
     61                        bud->flags |= JBFLAG_DOES_JEP85;
     62                }
    4863        }
    4964        else
    5065        {
    51                 printf( "Received MSG from %s: %s\n", from, msg ? msg->text : "<null>" );
     66                printf( "Received MSG from %s:\n", from );
    5267                xt_print( node );
    5368        }
Note: See TracChangeset for help on using the changeset viewer.