Mercurial > pidgin
diff libpurple/protocols/mxit/protocol.c @ 30289:8c586dbcae2d
Since a buddy's avatar information is distributed as part of their online
presence information, if they have changed their avatar while we were
offline (and they're now offline) we won't see the change until we're both
online at the same time.
So when the user requests to view a buddy's profile, we now also request
their current AvatarId - if it is different to what Pidgin has cached, we
request the new image.
Move buddy's avatar processing out of mxit_update_buddy_presence() and into
new function mxit_update_buddy_avatar(). The buddy avatar updating is
called when we receive a buddy's presence update or when we request the
buddies profile.
| author | andrew.victor@mxit.com |
|---|---|
| date | Tue, 20 Jul 2010 09:46:28 +0000 |
| parents | d9e94339ca3b |
| children | a8cc50c2279f 754459ff7b23 |
line wrap: on
line diff
--- a/libpurple/protocols/mxit/protocol.c Mon Jul 19 09:52:08 2010 +0000 +++ b/libpurple/protocols/mxit/protocol.c Tue Jul 20 09:46:28 2010 +0000 @@ -1582,12 +1582,13 @@ /* * The format of the record is: - * contactAddressN\1presenceN\1\moodN\1customMoodN\1statusMsgN\1avatarIdN + * contactAddressN\1presenceN\1moodN\1customMoodN\1statusMsgN\1avatarIdN */ mxit_strip_domain( rec->fields[0]->data ); /* contactAddress */ mxit_update_buddy_presence( session, rec->fields[0]->data, atoi( rec->fields[1]->data ), atoi( rec->fields[2]->data ), - rec->fields[3]->data, rec->fields[4]->data, rec->fields[5]->data ); + rec->fields[3]->data, rec->fields[4]->data ); + mxit_update_buddy_avatar( session, rec->fields[0]->data, rec->fields[5]->data ); } } @@ -1605,6 +1606,8 @@ struct MXitProfile* profile = NULL; int count; int i; + const char* avatarId = NULL; + const char* statusMsg = NULL; purple_debug_info( MXIT_PLUGIN_ID, "mxit_parse_cmd_extprofile: profile for '%s'\n", mxitId ); @@ -1659,8 +1662,13 @@ /* nickname */ g_strlcpy( profile->nickname, fvalue, sizeof( profile->nickname ) ); } + else if ( strcmp( CP_PROFILE_STATUS, fname ) == 0 ) { + /* status message - just keep a reference to the value */ + statusMsg = fvalue; + } else if ( strcmp( CP_PROFILE_AVATAR, fname ) == 0 ) { - /* avatar id, we just ingore it cause we dont need it */ + /* avatar id - just keep a reference to the value */ + avatarId = fvalue; } else if ( strcmp( CP_PROFILE_TITLE, fname ) == 0 ) { /* title */ @@ -1700,8 +1708,12 @@ } } - /* if this is not our profile, just display it */ if ( profile != session->profile ) { + /* update avatar (if necessary) */ + if ( avatarId ) + mxit_update_buddy_avatar( session, mxitId, avatarId ); + + /* if this is not our profile, just display it */ mxit_show_profile( session, mxitId, profile ); g_free( profile ); }
