diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-10-02 19:45:26 -0700 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-10-02 19:45:26 -0700 |
commit | 8e9e2b7d9e54744cee32b3724391bf0ad04e8aff (patch) | |
tree | 6cafdc57bb8143306daf8ef8288d09754f39b451 /protocols/bee_user.c | |
parent | 88de0c96136313e553113f69cfc6ae544a5f5954 (diff) | |
parent | 2af3e232ff468b288dd4e0dbdab1a17312d801c5 (diff) |
Merging mainline, which includes a huge msnp13 merge.
Not 100% sure about the OpenSSL merge, should double check that but I'm
currently offline.
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 33853a1e..4ea538a9 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; |