aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/jabber/jabber.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2009-11-19 13:11:38 +0000
committerWilmer van der Gaast <wilmer@gaast.net>2009-11-19 13:11:38 +0000
commit76c85b4c79d533ca7a780df381ccda5b9ab2934c (patch)
treea083be5e58f87ee34f3ee74466d9c974f6e0ac9f /protocols/jabber/jabber.c
parent36cf9fda6a5cc4bcbfe98319b48af636fa142590 (diff)
resource_select now defaults to activity instead of priority. Also, adding
a activity_timeout setting. Now, messages to someone who hasn't spoken for a while will be sent to his/her bare JID, usually resulting in a broadcast. This should fix issues with messages sometimes arriving on someone's Crackberry/Android/etc instead of some place s/he's paying attention to. Last, the activity timer is only reset on incoming messages.
Diffstat (limited to 'protocols/jabber/jabber.c')
-rw-r--r--protocols/jabber/jabber.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c
index b8e88c26..6d63f354 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;
@@ -304,7 +306,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,17 +351,9 @@ 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 )
{