diff options
Diffstat (limited to 'protocols/jabber/jabber.c')
-rw-r--r-- | protocols/jabber/jabber.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index b8e88c26..86320ada 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -57,6 +57,8 @@ static void jabber_init( account_t *acc ) set_t *s; char str[16]; + s = set_add( &acc->set, "activity_timeout", "600", set_eval_int, acc ); + g_snprintf( str, sizeof( str ), "%d", jabber_port_list[0] ); s = set_add( &acc->set, "port", str, set_eval_int, acc ); s->flags |= ACC_SET_OFFLINE_ONLY; @@ -66,7 +68,7 @@ static void jabber_init( account_t *acc ) s = set_add( &acc->set, "resource", "BitlBee", NULL, acc ); s->flags |= ACC_SET_OFFLINE_ONLY; - s = set_add( &acc->set, "resource_select", "priority", NULL, acc ); + s = set_add( &acc->set, "resource_select", "activity", NULL, acc ); s = set_add( &acc->set, "server", NULL, set_eval_account, acc ); s->flags |= ACC_SET_NOSAVE | ACC_SET_OFFLINE_ONLY | SET_NULL_OK; @@ -79,6 +81,8 @@ static void jabber_init( account_t *acc ) s = set_add( &acc->set, "xmlconsole", "false", set_eval_bool, acc ); s->flags |= ACC_SET_OFFLINE_ONLY; + + acc->flags |= ACC_FLAG_AWAY_MESSAGE | ACC_FLAG_STATUS_MESSAGE; } static void jabber_generate_id_hash( struct jabber_data *jd ); @@ -304,7 +308,7 @@ static int jabber_buddy_msg( struct im_connection *ic, char *who, char *message, if( ( s = strchr( who, '=' ) ) && jabber_chat_by_jid( ic, s + 1 ) ) bud = jabber_buddy_by_ext_jid( ic, who, 0 ); else - bud = jabber_buddy_by_jid( ic, who, 0 ); + bud = jabber_buddy_by_jid( ic, who, GET_BUDDY_BARE_OK ); node = xt_new_node( "body", message, NULL ); node = jabber_make_packet( "message", "chat", bud ? bud->full_jid : who, node ); @@ -349,24 +353,17 @@ static GList *jabber_away_states( struct im_connection *ic ) static void jabber_get_info( struct im_connection *ic, char *who ) { - struct jabber_data *jd = ic->proto_data; struct jabber_buddy *bud; - if( strchr( who, '/' ) ) - bud = jabber_buddy_by_jid( ic, who, 0 ); - else - { - char *s = jabber_normalize( who ); - bud = g_hash_table_lookup( jd->buddies, s ); - g_free( s ); - } + bud = jabber_buddy_by_jid( ic, who, GET_BUDDY_FIRST ); while( bud ) { - imcb_log( ic, "Buddy %s (%d) information:\nAway state: %s\nAway message: %s", - bud->full_jid, bud->priority, - bud->away_state ? bud->away_state->full_name : "(none)", - bud->away_message ? : "(none)" ); + imcb_log( ic, "Buddy %s (%d) information:", bud->full_jid, bud->priority ); + if( bud->away_state ) + imcb_log( ic, "Away state: %s", bud->away_state->full_name ); + imcb_log( ic, "Status message: %s", bud->away_message ? : "(none)" ); + bud = bud->next; } @@ -376,11 +373,12 @@ static void jabber_get_info( struct im_connection *ic, char *who ) static void jabber_set_away( struct im_connection *ic, char *state_txt, char *message ) { struct jabber_data *jd = ic->proto_data; - struct jabber_away_state *state; - /* Save all this info. We need it, for example, when changing the priority setting. */ - state = (void *) jabber_away_state_by_name( state_txt ); - jd->away_state = state ? state : (void *) jabber_away_state_list; /* Fall back to "Away" if necessary. */ + /* state_txt == NULL -> Not away. + Unknown state -> fall back to the first defined away state. */ + jd->away_state = state_txt ? jabber_away_state_by_name( state_txt ) + ? : jabber_away_state_list : NULL; + g_free( jd->away_message ); jd->away_message = ( message && *message ) ? g_strdup( message ) : NULL; |