comparison libpurple/protocols/mxit/profile.c @ 30286:08d9cdac2b3c

A few changes to the Profile. For the user's profile we now also request the 'flags' attribute. The DoB-Locked flag indicates if the user is allowed to change their date-of-birth. If it it locked, make the DoB field read-only. For your buddies profile, request the 'lastseen' attribute. For offline contacts we now show on the profile page when last they were online.
author andrew.victor@mxit.com
date Mon, 19 Jul 2010 08:39:45 +0000
parents b6b0c80f9dde
children 8c586dbcae2d
comparison
equal deleted inserted replaced
30285:8816f2c9ae43 30286:08d9cdac2b3c
99 return TRUE; 99 return TRUE;
100 } 100 }
101 101
102 102
103 /*------------------------------------------------------------------------ 103 /*------------------------------------------------------------------------
104 * Returns timestamp field in date & time format (DD-MM-YYYY HH:MM:SS)
105 *
106 * @param msecs The timestamps (milliseconds since epoch)
107 * @return Date & Time in a display'able format.
108 */
109 static const char* datetime( int64_t msecs )
110 {
111 time_t secs = msecs / 1000;
112
113 struct tm t;
114 localtime_r( &secs, &t );
115
116 return purple_utf8_strftime( "%d-%m-%Y %H:%M:%S", &t );
117 }
118
119
120 /*------------------------------------------------------------------------
104 * Display the profile information. 121 * Display the profile information.
105 * 122 *
106 * @param session The MXit session object 123 * @param session The MXit session object
107 * @param username The username who's profile information this is 124 * @param username The username who's profile information this is
108 * @param profile The profile 125 * @param profile The profile
136 153
137 if ( contact ) { 154 if ( contact ) {
138 /* presence */ 155 /* presence */
139 purple_notify_user_info_add_pair( info, _( "Status" ), mxit_convert_presence_to_name( contact->presence ) ); 156 purple_notify_user_info_add_pair( info, _( "Status" ), mxit_convert_presence_to_name( contact->presence ) );
140 157
158 /* last online */
159 if ( contact->presence == MXIT_PRESENCE_OFFLINE )
160 purple_notify_user_info_add_pair( info, _( "Last Online" ), ( profile->lastonline == 0 ) ? _( "Unknown" ) : datetime( profile->lastonline ) );
161
141 /* mood */ 162 /* mood */
142 if ( contact->mood != MXIT_MOOD_NONE ) 163 if ( contact->mood != MXIT_MOOD_NONE )
143 purple_notify_user_info_add_pair( info, _( "Mood" ), mxit_convert_mood_to_name( contact->mood ) ); 164 purple_notify_user_info_add_pair( info, _( "Mood" ), mxit_convert_mood_to_name( contact->mood ) );
144 else 165 else
145 purple_notify_user_info_add_pair( info, _( "Mood" ), _( "None" ) ); 166 purple_notify_user_info_add_pair( info, _( "Mood" ), _( "None" ) );