libpurple/protocols/mxit/actions.c

branch
soc.2008.masterpassword
changeset 34108
7a07b6857540
parent 34029
059c1270db1f
parent 33648
3fd636f586dc
child 34145
fa72f1e5cd77
equal deleted inserted replaced
34107:efe6019c9e91 34108:7a07b6857540
41 * @param gc The connection object 41 * @param gc The connection object
42 * @param fields The fields from the request pop-up 42 * @param fields The fields from the request pop-up
43 */ 43 */
44 static void mxit_profile_cb( PurpleConnection* gc, PurpleRequestFields* fields ) 44 static void mxit_profile_cb( PurpleConnection* gc, PurpleRequestFields* fields )
45 { 45 {
46 struct MXitSession* session = purple_connection_get_protocol_data( gc ) ; 46 struct MXitSession* session = purple_connection_get_protocol_data( gc );
47 PurpleRequestField* field = NULL; 47 PurpleRequestField* field = NULL;
48 const char* name = NULL; 48 const char* name = NULL;
49 const char* bday = NULL; 49 const char* bday = NULL;
50 const char* err = NULL; 50 const char* err = NULL;
51 GList* entry = NULL;
51 52
52 purple_debug_info( MXIT_PLUGIN_ID, "mxit_profile_cb\n" ); 53 purple_debug_info( MXIT_PLUGIN_ID, "mxit_profile_cb\n" );
53 54
54 if ( !PURPLE_CONNECTION_IS_VALID( gc ) ) { 55 if ( !PURPLE_CONNECTION_IS_VALID( gc ) ) {
55 purple_debug_error( MXIT_PLUGIN_ID, "Unable to update profile; account offline.\n" ); 56 purple_debug_error( MXIT_PLUGIN_ID, "Unable to update profile; account offline.\n" );
164 g_strlcpy( profile->whereami, name, sizeof( profile->whereami ) ); 165 g_strlcpy( profile->whereami, name, sizeof( profile->whereami ) );
165 g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_WHEREAMI, CP_PROFILE_TYPE_UTF8, profile->whereami ); 166 g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_WHEREAMI, CP_PROFILE_TYPE_UTF8, profile->whereami );
166 g_string_append( attributes, attrib ); 167 g_string_append( attributes, attrib );
167 acount++; 168 acount++;
168 169
170 /* relationship status */
171 field = purple_request_fields_get_field( fields, "relationship" );
172 entry = g_list_first( purple_request_field_list_get_selected( field ) );
173 profile->relationship = atoi( purple_request_field_list_get_data( field, entry->data ) );
174 g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%i", CP_PROFILE_RELATIONSHIP, CP_PROFILE_TYPE_SHORT, profile->relationship );
175 g_string_append( attributes, attrib );
176 acount++;
177
169 /* update flags */ 178 /* update flags */
170 field = purple_request_fields_get_field( fields, "searchable" ); 179 field = purple_request_fields_get_field( fields, "searchable" );
171 if ( purple_request_field_bool_get_value( field ) ) /* is searchable -> clear not-searchable flag */ 180 if ( purple_request_field_bool_get_value( field ) ) /* is searchable -> clear not-searchable flag */
172 profile->flags &= ~CP_PROF_NOT_SEARCHABLE; 181 profile->flags &= ~CP_PROF_NOT_SEARCHABLE;
173 else 182 else
249 field = purple_request_field_string_new( "aboutme", _( "About Me" ), profile->aboutme, FALSE); 258 field = purple_request_field_string_new( "aboutme", _( "About Me" ), profile->aboutme, FALSE);
250 purple_request_field_group_add_field( public_group, field ); 259 purple_request_field_group_add_field( public_group, field );
251 260
252 /* where I live */ 261 /* where I live */
253 field = purple_request_field_string_new( "whereami", _( "Where I Live" ), profile->whereami, FALSE); 262 field = purple_request_field_string_new( "whereami", _( "Where I Live" ), profile->whereami, FALSE);
263 purple_request_field_group_add_field( public_group, field );
264
265 /* relationship status */
266 field = purple_request_field_list_new( "relationship", _( "Relationship Status" ) );
267 purple_request_field_list_set_multi_select( field, FALSE );
268 purple_request_field_list_add_icon( field, mxit_relationship_to_name( MXIT_RELATIONSHIP_UNKNOWN ), NULL, g_strdup_printf( "%i", MXIT_RELATIONSHIP_UNKNOWN ) );
269 purple_request_field_list_add_icon( field, mxit_relationship_to_name( MXIT_RELATIONSHIP_DONTSAY ), NULL, g_strdup_printf( "%i", MXIT_RELATIONSHIP_DONTSAY ) );
270 purple_request_field_list_add_icon( field, mxit_relationship_to_name( MXIT_RELATIONSHIP_SINGLE ), NULL, g_strdup_printf( "%i", MXIT_RELATIONSHIP_SINGLE ) );
271 purple_request_field_list_add_icon( field, mxit_relationship_to_name( MXIT_RELATIONSHIP_INVOLVED ), NULL, g_strdup_printf( "%i", MXIT_RELATIONSHIP_INVOLVED ) );
272 purple_request_field_list_add_icon( field, mxit_relationship_to_name( MXIT_RELATIONSHIP_ENGAGED ), NULL, g_strdup_printf( "%i", MXIT_RELATIONSHIP_ENGAGED ) );
273 purple_request_field_list_add_icon( field, mxit_relationship_to_name( MXIT_RELATIONSHIP_MARRIED ), NULL, g_strdup_printf( "%i", MXIT_RELATIONSHIP_MARRIED ) );
274 purple_request_field_list_add_icon( field, mxit_relationship_to_name( MXIT_RELATIONSHIP_COMPLICATED ), NULL, g_strdup_printf( "%i", MXIT_RELATIONSHIP_COMPLICATED ) );
275 purple_request_field_list_add_icon( field, mxit_relationship_to_name( MXIT_RELATIONSHIP_WIDOWED ), NULL, g_strdup_printf( "%i", MXIT_RELATIONSHIP_WIDOWED ) );
276 purple_request_field_list_add_icon( field, mxit_relationship_to_name( MXIT_RELATIONSHIP_SEPARATED ), NULL, g_strdup_printf( "%i", MXIT_RELATIONSHIP_SEPARATED ) );
277 purple_request_field_list_add_icon( field, mxit_relationship_to_name( MXIT_RELATIONSHIP_DIVORCED ), NULL, g_strdup_printf( "%i", MXIT_RELATIONSHIP_DIVORCED ) );
278 purple_request_field_list_add_selected( field, mxit_relationship_to_name( profile->relationship ) );
254 purple_request_field_group_add_field( public_group, field ); 279 purple_request_field_group_add_field( public_group, field );
255 280
256 purple_request_fields_add_group( fields, public_group ); 281 purple_request_fields_add_group( fields, public_group );
257 } 282 }
258 283

mercurial