Mercurial > pidgin
comparison libpurple/protocols/mxit/mxit.c @ 29933:085020c013eb
Add support for the standard Mood API.
author | andrew.victor@mxit.com |
---|---|
date | Tue, 11 May 2010 10:00:30 +0000 |
parents | 2a436e0ce977 |
children | 40a1111c34d3 |
comparison
equal
deleted
inserted
replaced
29932:df44288b44eb | 29933:085020c013eb |
---|---|
89 /* find the account */ | 89 /* find the account */ |
90 account = purple_accounts_find( parts[1], parts[2] ); | 90 account = purple_accounts_find( parts[1], parts[2] ); |
91 if ( !account ) | 91 if ( !account ) |
92 goto skip; | 92 goto skip; |
93 con = purple_account_get_connection( account ); | 93 con = purple_account_get_connection( account ); |
94 | |
95 // /* determine if it's a command-response to send */ | |
96 // is_command = g_str_has_prefix( parts[4], "::type=reply|" ); | |
94 | 97 |
95 /* send click message back to MXit */ | 98 /* send click message back to MXit */ |
96 mxit_send_message( con->proto_data, parts[3], parts[4], FALSE, is_command ); | 99 mxit_send_message( con->proto_data, parts[3], parts[4], FALSE, is_command ); |
97 | 100 |
98 g_free( link ); | 101 g_free( link ); |
415 struct MXitSession* session = purple_account_get_connection( account )->proto_data; | 418 struct MXitSession* session = purple_account_get_connection( account )->proto_data; |
416 const char* statusid; | 419 const char* statusid; |
417 int presence; | 420 int presence; |
418 char* statusmsg1; | 421 char* statusmsg1; |
419 char* statusmsg2; | 422 char* statusmsg2; |
423 | |
424 /* Handle mood changes */ | |
425 if (purple_status_type_get_primitive(purple_status_get_type(status)) == PURPLE_STATUS_MOOD) { | |
426 const char* moodid = purple_status_get_attr_string( status, PURPLE_MOOD_NAME ); | |
427 int mood; | |
428 | |
429 /* convert the purple mood to a mxit mood */ | |
430 mood = mxit_convert_mood( moodid ); | |
431 if ( mood < 0 ) { | |
432 /* error, mood not found */ | |
433 purple_debug_info( MXIT_PLUGIN_ID, "Mood status NOT found! (id = %s)\n", moodid ); | |
434 return; | |
435 } | |
436 | |
437 /* Save the new mood in session */ | |
438 session->mood = mood; | |
439 | |
440 mxit_send_mood( session, mood ); | |
441 return; | |
442 } | |
420 | 443 |
421 /* get the status id (reference: "libpurple/status.h") */ | 444 /* get the status id (reference: "libpurple/status.h") */ |
422 statusid = purple_status_get_id( status ); | 445 statusid = purple_status_get_id( status ); |
423 | 446 |
424 /* convert the purple status to a mxit status */ | 447 /* convert the purple status to a mxit status */ |
633 NULL, /* attention_types */ | 656 NULL, /* attention_types */ |
634 sizeof( PurplePluginProtocolInfo ), /* struct_size */ | 657 sizeof( PurplePluginProtocolInfo ), /* struct_size */ |
635 mxit_get_text_table, /* get_account_text_table */ | 658 mxit_get_text_table, /* get_account_text_table */ |
636 NULL, /* initiate_media */ | 659 NULL, /* initiate_media */ |
637 NULL, /* get_media_caps */ | 660 NULL, /* get_media_caps */ |
638 NULL, /* get_moods */ | 661 mxit_get_moods, /* get_moods */ |
639 NULL, /* set_public_alias */ | 662 NULL, /* set_public_alias */ |
640 NULL /* get_public_alias */ | 663 NULL /* get_public_alias */ |
641 }; | 664 }; |
642 | 665 |
643 | 666 |