diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-10-01 22:34:53 -0700 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-10-01 22:34:53 -0700 |
commit | 62f53b508742804d5df6533150f17d41e6afcbb2 (patch) | |
tree | e01a02a2a730110dde6ded977458090859fe2115 /protocols/bee_user.c | |
parent | 05bf2a0d55999c944ac6cf03ad85270cb2165923 (diff) | |
parent | 04cd284bce74c114fde3043c951a5c8ef9eb79ae (diff) |
Merging msnp13 branch which, confusingly, upgrades the msn module to use
MSNP15. (The reason for this is that A) IMHO MSNP13 is what causes most of
the pain in this upgade and B) I initially intended to only implement MSNP13
but then discovered MS doesn't support it anymore.)
This fixes issues with display names being forgotten, adding contacts (and
them automatically getting blocked sometimes!!), and adds support for
away/status messages and some support for sending offline messages.
Diffstat (limited to 'protocols/bee_user.c')
-rw-r--r-- | protocols/bee_user.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/protocols/bee_user.c b/protocols/bee_user.c index 04253c47..1f9b1b47 100644 --- a/protocols/bee_user.c +++ b/protocols/bee_user.c @@ -186,8 +186,13 @@ void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags, /* TODO(wilmer): OPT_AWAY, or just state == NULL ? */ bu->flags = flags; - bu->status = g_strdup( ( flags & OPT_AWAY ) && state == NULL ? "Away" : state ); bu->status_msg = g_strdup( message ); + if( state && *state ) + bu->status = g_strdup( state ); + else if( flags & OPT_AWAY ) + bu->status = g_strdup( "Away" ); + else + bu->status = NULL; if( bu->status == NULL && ( flags & OPT_MOBILE ) && set_getbool( &bee->set, "mobile_is_away" ) ) @@ -204,6 +209,28 @@ void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags, g_free( old ); } +/* Same, but only change the away/status message, not any away/online state info. */ +void imcb_buddy_status_msg( struct im_connection *ic, const char *handle, const char *message ) +{ + bee_t *bee = ic->bee; + bee_user_t *bu, *old; + + if( !( bu = bee_user_by_handle( bee, ic, handle ) ) ) + { + return; + } + + old = g_memdup( bu, sizeof( bee_user_t ) ); + + bu->status_msg = message && *message ? g_strdup( message ) : NULL; + + if( bee->ui->user_status ) + bee->ui->user_status( bee, bu, old ); + + g_free( old->status_msg ); + g_free( old ); +} + void imcb_buddy_times( struct im_connection *ic, const char *handle, time_t login, time_t idle ) { bee_t *bee = ic->bee; |