diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-08-21 23:25:37 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-08-21 23:25:37 +0100 |
commit | 0ebf919dd8b47e50ce060f46f2dc5f10f3867207 (patch) | |
tree | 7a7ab813da9884d037547116c1d9b321f982f5cd /protocols | |
parent | a758ec197f3a01dda26d394c1e5125787e4831b6 (diff) |
Pass "user is mobile" info coming from OSCAR up to BitlBee and show mobile
people as away=Mobile. Bug #462 (and others for other protocols).
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/bee.c | 1 | ||||
-rw-r--r-- | protocols/bee.h | 2 | ||||
-rw-r--r-- | protocols/bee_user.c | 7 | ||||
-rw-r--r-- | protocols/nogaim.h | 1 | ||||
-rw-r--r-- | protocols/oscar/oscar.c | 4 |
5 files changed, 15 insertions, 0 deletions
diff --git a/protocols/bee.c b/protocols/bee.c index c5eeee17..81cb7619 100644 --- a/protocols/bee.c +++ b/protocols/bee.c @@ -39,6 +39,7 @@ bee_t *bee_new() s = set_add( &b->set, "auto_reconnect", "true", set_eval_bool, b ); s = set_add( &b->set, "auto_reconnect_delay", "5*3<900", set_eval_account_reconnect_delay, b ); s = set_add( &b->set, "debug", "false", set_eval_bool, b ); + s = set_add( &b->set, "mobile_is_away", "false", set_eval_bool, b ); s = set_add( &b->set, "save_on_quit", "true", set_eval_bool, b ); s = set_add( &b->set, "status", NULL, set_eval_away_status, b ); s->flags |= SET_NULL_OK; diff --git a/protocols/bee.h b/protocols/bee.h index 5792e988..2fd3562e 100644 --- a/protocols/bee.h +++ b/protocols/bee.h @@ -55,10 +55,12 @@ typedef struct bee bee_t *bee_new(); void bee_free( bee_t *b ); +/* TODO(wilmer): Kill at least the OPT_ flags that have an equivalent here. */ typedef enum { BEE_USER_ONLINE = 1, /* Compatibility with old OPT_LOGGED_IN flag */ BEE_USER_AWAY = 4, /* Compatibility with old OPT_AWAY flag */ + BEE_USER_MOBILE = 8, /* Compatibility with old OPT_MOBILE flag */ BEE_USER_LOCAL = 256, /* Locally-added contacts (not in real contact list) */ } bee_user_flags_t; diff --git a/protocols/bee_user.c b/protocols/bee_user.c index db7842a0..04253c47 100644 --- a/protocols/bee_user.c +++ b/protocols/bee_user.c @@ -189,6 +189,13 @@ void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags, bu->status = g_strdup( ( flags & OPT_AWAY ) && state == NULL ? "Away" : state ); bu->status_msg = g_strdup( message ); + if( bu->status == NULL && ( flags & OPT_MOBILE ) && + set_getbool( &bee->set, "mobile_is_away" ) ) + { + bu->flags |= BEE_USER_AWAY; + bu->status = g_strdup( "Mobile" ); + } + if( bee->ui->user_status ) bee->ui->user_status( bee, bu, old ); diff --git a/protocols/nogaim.h b/protocols/nogaim.h index 3407236f..693b5d16 100644 --- a/protocols/nogaim.h +++ b/protocols/nogaim.h @@ -62,6 +62,7 @@ #define OPT_LOGGED_IN 0x00000001 #define OPT_LOGGING_OUT 0x00000002 #define OPT_AWAY 0x00000004 +#define OPT_MOBILE 0x00000008 #define OPT_DOES_HTML 0x00000010 #define OPT_LOCALBUDDY 0x00000020 /* For nicks local to one groupchat */ #define OPT_TYPING 0x00000100 /* Some pieces of code make assumptions */ diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index 3f5272cd..db6a28f4 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -898,6 +898,10 @@ static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) { flags |= OPT_AWAY; } + /* Maybe this should be done just for AIM contacts, not sure. */ + if (info->flags & AIM_FLAG_WIRELESS) + flags |= OPT_MOBILE; + if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS) { if (!(info->icqinfo.status & AIM_ICQ_STATE_CHAT) && (info->icqinfo.status != AIM_ICQ_STATE_NORMAL)) { |