Changeset be609ff for protocols/jabber


Ignore:
Timestamp:
2010-03-12T19:10:16Z (15 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
dde9d571
Parents:
08e5bb2 (diff), 8b6b740 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merging mainline.

Location:
protocols/jabber
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/jabber.c

    r08e5bb2 rbe609ff  
    8282        s = set_add( &acc->set, "xmlconsole", "false", set_eval_bool, acc );
    8383        s->flags |= ACC_SET_OFFLINE_ONLY;
     84       
     85        acc->flags |= ACC_FLAG_AWAY_MESSAGE | ACC_FLAG_STATUS_MESSAGE;
    8486}
    8587
     
    358360        while( bud )
    359361        {
    360                 imcb_log( ic, "Buddy %s (%d) information:\nAway state: %s\nAway message: %s",
    361                                    bud->full_jid, bud->priority,
    362                                    bud->away_state ? bud->away_state->full_name : "(none)",
    363                                    bud->away_message ? : "(none)" );
     362                imcb_log( ic, "Buddy %s (%d) information:", bud->full_jid, bud->priority );
     363                if( bud->away_state )
     364                        imcb_log( ic, "Away state: %s", bud->away_state->full_name );
     365                imcb_log( ic, "Status message: %s", bud->away_message ? : "(none)" );
     366               
    364367                bud = bud->next;
    365368        }
     
    371374{
    372375        struct jabber_data *jd = ic->proto_data;
    373         struct jabber_away_state *state;
    374        
    375         /* Save all this info. We need it, for example, when changing the priority setting. */
    376         state = (void *) jabber_away_state_by_name( state_txt );
    377         jd->away_state = state ? state : (void *) jabber_away_state_list; /* Fall back to "Away" if necessary. */
     376       
     377        /* state_txt == NULL -> Not away.
     378           Unknown state -> fall back to the first defined away state. */
     379        jd->away_state = state_txt ? jabber_away_state_by_name( state_txt )
     380                         ? : jabber_away_state_list : NULL;
     381       
    378382        g_free( jd->away_message );
    379383        jd->away_message = ( message && *message ) ? g_strdup( message ) : NULL;
  • protocols/jabber/jabber.h

    r08e5bb2 rbe609ff  
    8484        /* After changing one of these two (or the priority setting), call
    8585           presence_send_update() to inform the server about the changes. */
    86         struct jabber_away_state *away_state;
     86        const struct jabber_away_state *away_state;
    8787        char *away_message;
    8888       
  • protocols/jabber/jabber_util.c

    r08e5bb2 rbe609ff  
    228228{
    229229        { "away",  "Away" },
    230         { "chat",  "Free for Chat" },
     230        { "chat",  "Free for Chat" },   /* WTF actually uses this? */
    231231        { "dnd",   "Do not Disturb" },
    232232        { "xa",    "Extended Away" },
    233         { "",      "Online" },
    234233        { "",      NULL }
    235234};
     
    238237{
    239238        int i;
     239       
     240        if( code == NULL )
     241                return NULL;
    240242       
    241243        for( i = 0; jabber_away_state_list[i].full_name; i ++ )
     
    249251{
    250252        int i;
     253       
     254        if( name == NULL )
     255                return NULL;
    251256       
    252257        for( i = 0; jabber_away_state_list[i].full_name; i ++ )
  • protocols/jabber/presence.c

    r08e5bb2 rbe609ff  
    187187                int is_away = 0;
    188188
    189                 if( send_presence->away_state && !( *send_presence->away_state->code == 0 ||
    190                     strcmp( send_presence->away_state->code, "chat" ) == 0 ) )
     189                if( send_presence->away_state &&
     190                    strcmp( send_presence->away_state->code, "chat" ) != 0 )
    191191                        is_away = OPT_AWAY;
    192192
    193193                imcb_buddy_status( ic, send_presence->bare_jid, OPT_LOGGED_IN | is_away,
    194                                    ( is_away && send_presence->away_state ) ?
    195                                    send_presence->away_state->full_name : NULL,
     194                                   is_away ? send_presence->away_state->full_name : NULL,
    196195                                   send_presence->away_message );
    197196        }
     
    206205        struct jabber_data *jd = ic->proto_data;
    207206        struct xt_node *node, *cap;
    208         char *show = jd->away_state->code;
    209         char *status = jd->away_message;
    210207        struct groupchat *c;
    211208        int st;
     
    213210        node = jabber_make_packet( "presence", NULL, NULL, NULL );
    214211        xt_add_child( node, xt_new_node( "priority", set_getstr( &ic->acc->set, "priority" ), NULL ) );
    215         if( show && *show )
    216                 xt_add_child( node, xt_new_node( "show", show, NULL ) );
    217         if( status )
    218                 xt_add_child( node, xt_new_node( "status", status, NULL ) );
     212        if( jd->away_state )
     213                xt_add_child( node, xt_new_node( "show", jd->away_state->code, NULL ) );
     214        if( jd->away_message )
     215                xt_add_child( node, xt_new_node( "status", jd->away_message, NULL ) );
    219216       
    220217        /* This makes the packet slightly bigger, but clients interested in
Note: See TracChangeset for help on using the changeset viewer.