Mercurial > pidgin.yaz
comparison libpurple/protocols/mxit/actions.c @ 30717: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 | d9e94339ca3b |
comparison
equal
deleted
inserted
replaced
30716:8816f2c9ae43 | 30717:08d9cdac2b3c |
---|---|
111 g_free( session->encpwd ); | 111 g_free( session->encpwd ); |
112 session->encpwd = mxit_encrypt_password( session ); | 112 session->encpwd = mxit_encrypt_password( session ); |
113 | 113 |
114 /* update name */ | 114 /* update name */ |
115 g_strlcpy( profile->nickname, name, sizeof( profile->nickname ) ); | 115 g_strlcpy( profile->nickname, name, sizeof( profile->nickname ) ); |
116 g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_FULLNAME, CP_PROF_TYPE_UTF8, profile->nickname ); | 116 g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_FULLNAME, CP_PROFILE_TYPE_UTF8, profile->nickname ); |
117 g_string_append( attributes, attrib ); | 117 g_string_append( attributes, attrib ); |
118 acount++; | 118 acount++; |
119 | 119 |
120 /* update hidden */ | 120 /* update hidden */ |
121 field = purple_request_fields_get_field( fields, "hidden" ); | 121 field = purple_request_fields_get_field( fields, "hidden" ); |
122 profile->hidden = purple_request_field_bool_get_value( field ); | 122 profile->hidden = purple_request_field_bool_get_value( field ); |
123 g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_HIDENUMBER, CP_PROF_TYPE_BOOL, ( profile->hidden ) ? "1" : "0" ); | 123 g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_HIDENUMBER, CP_PROFILE_TYPE_BOOL, ( profile->hidden ) ? "1" : "0" ); |
124 g_string_append( attributes, attrib ); | 124 g_string_append( attributes, attrib ); |
125 acount++; | 125 acount++; |
126 | 126 |
127 /* update birthday */ | 127 /* update birthday */ |
128 strcpy( profile->birthday, bday ); | 128 strcpy( profile->birthday, bday ); |
129 g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_BIRTHDATE, CP_PROF_TYPE_UTF8, profile->birthday ); | 129 g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_BIRTHDATE, CP_PROFILE_TYPE_UTF8, profile->birthday ); |
130 g_string_append( attributes, attrib ); | 130 g_string_append( attributes, attrib ); |
131 acount++; | 131 acount++; |
132 | 132 |
133 /* update gender */ | 133 /* update gender */ |
134 profile->male = ( purple_request_fields_get_choice( fields, "male" ) != 0 ); | 134 profile->male = ( purple_request_fields_get_choice( fields, "male" ) != 0 ); |
135 g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_GENDER, CP_PROF_TYPE_BOOL, ( profile->male ) ? "1" : "0" ); | 135 g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_GENDER, CP_PROFILE_TYPE_BOOL, ( profile->male ) ? "1" : "0" ); |
136 g_string_append( attributes, attrib ); | 136 g_string_append( attributes, attrib ); |
137 acount++; | 137 acount++; |
138 | 138 |
139 /* update title */ | 139 /* update title */ |
140 name = purple_request_fields_get_string( fields, "title" ); | 140 name = purple_request_fields_get_string( fields, "title" ); |
141 if ( !name ) | 141 if ( !name ) |
142 profile->title[0] = '\0'; | 142 profile->title[0] = '\0'; |
143 else | 143 else |
144 strcpy( profile->title, name ); | 144 strcpy( profile->title, name ); |
145 g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_TITLE, CP_PROF_TYPE_UTF8, profile->title ); | 145 g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_TITLE, CP_PROFILE_TYPE_UTF8, profile->title ); |
146 g_string_append( attributes, attrib ); | 146 g_string_append( attributes, attrib ); |
147 acount++; | 147 acount++; |
148 | 148 |
149 /* update firstname */ | 149 /* update firstname */ |
150 name = purple_request_fields_get_string( fields, "firstname" ); | 150 name = purple_request_fields_get_string( fields, "firstname" ); |
151 if ( !name ) | 151 if ( !name ) |
152 profile->firstname[0] = '\0'; | 152 profile->firstname[0] = '\0'; |
153 else | 153 else |
154 strcpy( profile->firstname, name ); | 154 strcpy( profile->firstname, name ); |
155 g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_FIRSTNAME, CP_PROF_TYPE_UTF8, profile->firstname ); | 155 g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_FIRSTNAME, CP_PROFILE_TYPE_UTF8, profile->firstname ); |
156 g_string_append( attributes, attrib ); | 156 g_string_append( attributes, attrib ); |
157 acount++; | 157 acount++; |
158 | 158 |
159 /* update lastname */ | 159 /* update lastname */ |
160 name = purple_request_fields_get_string( fields, "lastname" ); | 160 name = purple_request_fields_get_string( fields, "lastname" ); |
161 if ( !name ) | 161 if ( !name ) |
162 profile->lastname[0] = '\0'; | 162 profile->lastname[0] = '\0'; |
163 else | 163 else |
164 strcpy( profile->lastname, name ); | 164 strcpy( profile->lastname, name ); |
165 g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_LASTNAME, CP_PROF_TYPE_UTF8, profile->lastname ); | 165 g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_LASTNAME, CP_PROFILE_TYPE_UTF8, profile->lastname ); |
166 g_string_append( attributes, attrib ); | 166 g_string_append( attributes, attrib ); |
167 acount++; | 167 acount++; |
168 | 168 |
169 /* update email address */ | 169 /* update email address */ |
170 name = purple_request_fields_get_string( fields, "email" ); | 170 name = purple_request_fields_get_string( fields, "email" ); |
171 if ( !name ) | 171 if ( !name ) |
172 profile->email[0] = '\0'; | 172 profile->email[0] = '\0'; |
173 else | 173 else |
174 strcpy( profile->email, name ); | 174 strcpy( profile->email, name ); |
175 g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_EMAIL, CP_PROF_TYPE_UTF8, profile->email ); | 175 g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_EMAIL, CP_PROFILE_TYPE_UTF8, profile->email ); |
176 g_string_append( attributes, attrib ); | 176 g_string_append( attributes, attrib ); |
177 acount++; | 177 acount++; |
178 | 178 |
179 /* update mobile number */ | 179 /* update mobile number */ |
180 name = purple_request_fields_get_string( fields, "mobilenumber" ); | 180 name = purple_request_fields_get_string( fields, "mobilenumber" ); |
181 if ( !name ) | 181 if ( !name ) |
182 profile->mobilenr[0] = '\0'; | 182 profile->mobilenr[0] = '\0'; |
183 else | 183 else |
184 strcpy( profile->mobilenr, name ); | 184 strcpy( profile->mobilenr, name ); |
185 g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_MOBILENR, CP_PROF_TYPE_UTF8, profile->mobilenr ); | 185 g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_MOBILENR, CP_PROFILE_TYPE_UTF8, profile->mobilenr ); |
186 g_string_append( attributes, attrib ); | 186 g_string_append( attributes, attrib ); |
187 acount++; | 187 acount++; |
188 | 188 |
189 /* send the profile update to MXit */ | 189 /* send the profile update to MXit */ |
190 mxit_send_extprofile_update( session, session->encpwd, acount, attributes->str ); | 190 mxit_send_extprofile_update( session, session->encpwd, acount, attributes->str ); |
247 purple_request_field_group_add_field( group, field ); | 247 purple_request_field_group_add_field( group, field ); |
248 | 248 |
249 /* birthday */ | 249 /* birthday */ |
250 field = purple_request_field_string_new( "bday", _( "Birthday" ), profile->birthday, FALSE ); | 250 field = purple_request_field_string_new( "bday", _( "Birthday" ), profile->birthday, FALSE ); |
251 purple_request_field_group_add_field( group, field ); | 251 purple_request_field_group_add_field( group, field ); |
252 if ( profile->flags & CP_PROF_DOBLOCKED ) | |
253 purple_request_field_string_set_editable( field, FALSE ); | |
252 | 254 |
253 /* gender */ | 255 /* gender */ |
254 field = purple_request_field_choice_new( "male", _( "Gender" ), ( profile->male ) ? 1 : 0 ); | 256 field = purple_request_field_choice_new( "male", _( "Gender" ), ( profile->male ) ? 1 : 0 ); |
255 purple_request_field_choice_add( field, _( "Female" ) ); /* 0 */ | 257 purple_request_field_choice_add( field, _( "Female" ) ); /* 0 */ |
256 purple_request_field_choice_add( field, _( "Male" ) ); /* 1 */ | 258 purple_request_field_choice_add( field, _( "Male" ) ); /* 1 */ |