Ignore:
Timestamp:
2006-10-10T12:05:42Z (16 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/presence.c

    r6a1128d ra21a8ac  
    3030        char *type = xt_find_attr( node, "type" );      /* NULL should mean the person is online. */
    3131        struct xt_node *c;
     32        struct jabber_buddy *bud;
    3233       
    3334        if( !from )
     
    3637        if( type == NULL )
    3738        {
    38                 struct jabber_buddy *bud;
     39                if( strchr( from, '/' ) == NULL )
     40                {
     41                        char *s = xt_to_string( node );
     42                        serv_got_crap( gc, "WARNING: Ignoring presence tag with bare JID: %s\n", s );
     43                        g_free( s );
     44                }
    3945               
    4046                if( !( bud = jabber_buddy_by_jid( gc, from ) ) )
     
    5258                        bud->away_state = (void*) jabber_away_state_by_code( c->text );
    5359                else
     60                {
    5461                        bud->away_state = NULL;
     62                        /* Let's only set last_act if there's *no* away state,
     63                           since it could be some auto-away thingy. */
     64                        bud->last_act = time( NULL );
     65                }
    5566               
    5667                if( ( c = xt_find_node( node->children, "priority" ) ) && c->text_len > 0 )
     
    5970                        bud->priority = 0;
    6071               
    61                 serv_got_update( gc, bud->handle, 1, 0, 0, 0, 0, 0 );
     72                serv_got_update( gc, bud->handle, 1, 0, 0, 0,
     73                                 bud->away_state ? UC_UNAVAILABLE : 0, 0 );
    6274        }
    6375        else if( strcmp( type, "unavailable" ) == 0 )
     
    6577                char *s;
    6678               
     79                if( ( s = strchr( from, '/' ) ) == NULL )
     80                {
     81                        char *s = xt_to_string( node );
     82                        serv_got_crap( gc, "WARNING: Ignoring presence tag with bare JID: %s\n", s );
     83                        g_free( s );
     84                }
     85               
    6786                jabber_buddy_remove( gc, from );
    68                
    69                 if( ( s = strchr( from, '/' ) ) )
    70                         *s = 0;
     87                *s = 0;
    7188               
    7289                /* Only count this as offline if there's no other resource
Note: See TracChangeset for help on using the changeset viewer.