| 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 = (struct MXitSession*) gc->proto_data; |
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 GList* entry = NULL; |
| 207 * @param action The action object |
207 * @param action The action object |
| 208 */ |
208 */ |
| 209 static void mxit_profile_action( PurplePluginAction* action ) |
209 static void mxit_profile_action( PurplePluginAction* action ) |
| 210 { |
210 { |
| 211 PurpleConnection* gc = (PurpleConnection*) action->context; |
211 PurpleConnection* gc = (PurpleConnection*) action->context; |
| 212 struct MXitSession* session = (struct MXitSession*) gc->proto_data; |
212 struct MXitSession* session = purple_connection_get_protocol_data( gc ); |
| 213 struct MXitProfile* profile = session->profile; |
213 struct MXitProfile* profile = session->profile; |
| 214 |
214 |
| 215 PurpleRequestFields* fields = NULL; |
215 PurpleRequestFields* fields = NULL; |
| 216 PurpleRequestField* field = NULL; |
216 PurpleRequestField* field = NULL; |
| 217 |
217 |
| 320 * @param gc The connection object |
320 * @param gc The connection object |
| 321 * @param fields The fields from the request pop-up |
321 * @param fields The fields from the request pop-up |
| 322 */ |
322 */ |
| 323 static void mxit_change_pin_cb( PurpleConnection* gc, PurpleRequestFields* fields ) |
323 static void mxit_change_pin_cb( PurpleConnection* gc, PurpleRequestFields* fields ) |
| 324 { |
324 { |
| 325 struct MXitSession* session = (struct MXitSession*) gc->proto_data; |
325 struct MXitSession* session = purple_connection_get_protocol_data( gc ); |
| 326 const char* pin = NULL; |
326 const char* pin = NULL; |
| 327 const char* pin2 = NULL; |
327 const char* pin2 = NULL; |
| 328 const char* err = NULL; |
328 const char* err = NULL; |
| 329 int len; |
329 int len; |
| 330 int i; |
330 int i; |
| 382 * @param action The action object |
382 * @param action The action object |
| 383 */ |
383 */ |
| 384 static void mxit_change_pin_action( PurplePluginAction* action ) |
384 static void mxit_change_pin_action( PurplePluginAction* action ) |
| 385 { |
385 { |
| 386 PurpleConnection* gc = (PurpleConnection*) action->context; |
386 PurpleConnection* gc = (PurpleConnection*) action->context; |
| 387 struct MXitSession* session = (struct MXitSession*) gc->proto_data; |
387 struct MXitSession* session = purple_connection_get_protocol_data( gc ); |
| 388 |
388 |
| 389 PurpleRequestFields* fields = NULL; |
389 PurpleRequestFields* fields = NULL; |
| 390 PurpleRequestFieldGroup* group = NULL; |
390 PurpleRequestFieldGroup* group = NULL; |
| 391 PurpleRequestField* field = NULL; |
391 PurpleRequestField* field = NULL; |
| 392 |
392 |
| 395 fields = purple_request_fields_new(); |
395 fields = purple_request_fields_new(); |
| 396 group = purple_request_field_group_new(NULL); |
396 group = purple_request_field_group_new(NULL); |
| 397 purple_request_fields_add_group(fields, group); |
397 purple_request_fields_add_group(fields, group); |
| 398 |
398 |
| 399 /* pin */ |
399 /* pin */ |
| 400 field = purple_request_field_string_new( "pin", _( "PIN" ), session->acc->password, FALSE ); |
400 field = purple_request_field_string_new( "pin", _( "PIN" ), purple_account_get_password( session->acc ), FALSE ); |
| 401 purple_request_field_string_set_masked( field, TRUE ); |
401 purple_request_field_string_set_masked( field, TRUE ); |
| 402 purple_request_field_group_add_field( group, field ); |
402 purple_request_field_group_add_field( group, field ); |
| 403 |
403 |
| 404 /* verify pin */ |
404 /* verify pin */ |
| 405 field = purple_request_field_string_new( "pin2", _( "Verify PIN" ), session->acc->password, FALSE ); |
405 field = purple_request_field_string_new( "pin2", _( "Verify PIN" ), purple_account_get_password( session->acc ), FALSE ); |
| 406 purple_request_field_string_set_masked( field, TRUE ); |
406 purple_request_field_string_set_masked( field, TRUE ); |
| 407 purple_request_field_group_add_field( group, field ); |
407 purple_request_field_group_add_field( group, field ); |
| 408 |
408 |
| 409 /* (reference: "libpurple/request.h") */ |
409 /* (reference: "libpurple/request.h") */ |
| 410 purple_request_fields( gc, _( "Change PIN" ), _( "Change MXit PIN" ), NULL, fields, _( "Set" ), |
410 purple_request_fields( gc, _( "Change PIN" ), _( "Change MXit PIN" ), NULL, fields, _( "Set" ), |
| 418 * @param action The action object |
418 * @param action The action object |
| 419 */ |
419 */ |
| 420 static void mxit_splash_action( PurplePluginAction* action ) |
420 static void mxit_splash_action( PurplePluginAction* action ) |
| 421 { |
421 { |
| 422 PurpleConnection* gc = (PurpleConnection*) action->context; |
422 PurpleConnection* gc = (PurpleConnection*) action->context; |
| 423 struct MXitSession* session = (struct MXitSession*) gc->proto_data; |
423 struct MXitSession* session = purple_connection_get_protocol_data( gc ); |
| 424 |
424 |
| 425 if ( splash_current( session ) != NULL ) |
425 if ( splash_current( session ) != NULL ) |
| 426 splash_display( session ); |
426 splash_display( session ); |
| 427 else |
427 else |
| 428 mxit_popup( PURPLE_NOTIFY_MSG_INFO, _( "View Splash" ), _( "There is no splash-screen currently available" ) ); |
428 mxit_popup( PURPLE_NOTIFY_MSG_INFO, _( "View Splash" ), _( "There is no splash-screen currently available" ) ); |
| 455 * @param action The action object |
455 * @param action The action object |
| 456 */ |
456 */ |
| 457 static void mxit_suggested_friends_action( PurplePluginAction* action ) |
457 static void mxit_suggested_friends_action( PurplePluginAction* action ) |
| 458 { |
458 { |
| 459 PurpleConnection* gc = (PurpleConnection*) action->context; |
459 PurpleConnection* gc = (PurpleConnection*) action->context; |
| 460 struct MXitSession* session = (struct MXitSession*) gc->proto_data; |
460 struct MXitSession* session = purple_connection_get_protocol_data( gc ); |
| 461 const char* profilelist[] = { |
461 const char* profilelist[] = { |
| 462 CP_PROFILE_BIRTHDATE, CP_PROFILE_GENDER, CP_PROFILE_FULLNAME, CP_PROFILE_FIRSTNAME, |
462 CP_PROFILE_BIRTHDATE, CP_PROFILE_GENDER, CP_PROFILE_FULLNAME, CP_PROFILE_FIRSTNAME, |
| 463 CP_PROFILE_LASTNAME, CP_PROFILE_REGCOUNTRY, CP_PROFILE_STATUS, CP_PROFILE_AVATAR, |
463 CP_PROFILE_LASTNAME, CP_PROFILE_REGCOUNTRY, CP_PROFILE_STATUS, CP_PROFILE_AVATAR, |
| 464 CP_PROFILE_WHEREAMI, CP_PROFILE_ABOUTME }; |
464 CP_PROFILE_WHEREAMI, CP_PROFILE_ABOUTME }; |
| 465 |
465 |
| 472 * |
472 * |
| 473 * @param action The action object |
473 * @param action The action object |
| 474 */ |
474 */ |
| 475 static void mxit_user_search_cb( PurpleConnection *gc, const char *input ) |
475 static void mxit_user_search_cb( PurpleConnection *gc, const char *input ) |
| 476 { |
476 { |
| 477 struct MXitSession* session = (struct MXitSession*) gc->proto_data; |
477 struct MXitSession* session = purple_connection_get_protocol_data( gc ); |
| 478 const char* profilelist[] = { |
478 const char* profilelist[] = { |
| 479 CP_PROFILE_BIRTHDATE, CP_PROFILE_GENDER, CP_PROFILE_FULLNAME, CP_PROFILE_FIRSTNAME, |
479 CP_PROFILE_BIRTHDATE, CP_PROFILE_GENDER, CP_PROFILE_FULLNAME, CP_PROFILE_FIRSTNAME, |
| 480 CP_PROFILE_LASTNAME, CP_PROFILE_REGCOUNTRY, CP_PROFILE_STATUS, CP_PROFILE_AVATAR, |
480 CP_PROFILE_LASTNAME, CP_PROFILE_REGCOUNTRY, CP_PROFILE_STATUS, CP_PROFILE_AVATAR, |
| 481 CP_PROFILE_WHEREAMI, CP_PROFILE_ABOUTME }; |
481 CP_PROFILE_WHEREAMI, CP_PROFILE_ABOUTME }; |
| 482 |
482 |