Mercurial > pidgin
changeset 29391:4c266d9c17eb
propagate from branch 'im.pidgin.pidgin.mxit' (head ea208658fef692bd065f1fe03963913d86af2e41)
to branch 'im.pidgin.pidgin' (head 4bcf3f0205f9363e2b1f2539d041ede1a6cf15c7)
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 18 Feb 2010 09:20:29 +0000 |
parents | cece09dbb119 (current diff) 1e89206ed1ae (diff) |
children | f549ad844d54 |
files | |
diffstat | 4 files changed, 27 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/mxit/multimx.c Thu Feb 18 08:10:58 2010 +0000 +++ b/libpurple/protocols/mxit/multimx.c Thu Feb 18 09:20:29 2010 +0000 @@ -304,7 +304,7 @@ serv_got_joined_chat(gc, multimx->chatid, multimx->roomname); /* Send ".list" command to GroupChat server to retrieve current member-list */ - mxit_send_message(session, multimx->roomid, ".list", FALSE); + mxit_send_message(session, multimx->roomid, ".list", FALSE, FALSE); } @@ -579,7 +579,7 @@ } /* Send packet to MXit */ - mxit_send_message(session, multimx->roomid, message, TRUE); + mxit_send_message(session, multimx->roomid, message, TRUE, FALSE); /* Determine our nickname to display */ if (session->profile && (session->profile->nickname[0] != '\0')) /* default is profile name (since that's what everybody else sees) */
--- a/libpurple/protocols/mxit/mxit.c Thu Feb 18 08:10:58 2010 +0000 +++ b/libpurple/protocols/mxit/mxit.c Thu Feb 18 09:20:29 2010 +0000 @@ -58,9 +58,10 @@ { PurpleAccount* account; PurpleConnection* con; - gchar** parts = NULL; - gchar* link = NULL; + gchar** parts = NULL; + gchar* link = NULL; gsize len; + gboolean is_command = FALSE; purple_debug_info( MXIT_PLUGIN_ID, "mxit_link_click (%s)\n", link64 ); @@ -92,7 +93,7 @@ con = purple_account_get_connection( account ); /* send click message back to MXit */ - mxit_send_message( con->proto_data, parts[3], parts[4], FALSE ); + mxit_send_message( con->proto_data, parts[3], parts[4], FALSE, is_command ); g_free( link ); link = NULL; @@ -205,7 +206,7 @@ tmp = g_strdup_printf("<font color=\"#999999\">%s</font>\n", _( "Loading menu..." )); serv_got_im( session->con, who, tmp, PURPLE_MESSAGE_NOTIFY, time( NULL ) ); g_free(tmp); - mxit_send_message( session, who, " ", FALSE ); + mxit_send_message( session, who, " ", FALSE, FALSE ); default : break; } @@ -263,6 +264,10 @@ if ( !contact ) return NULL; + /* subscription state is Pending, Rejected or Deleted */ + if ( contact->subtype != MXIT_SUBTYPE_BOTH ) + return "not-authorized"; + switch ( contact-> type ) { case MXIT_TYPE_JABBER : /* external contacts via MXit */ case MXIT_TYPE_MSN : @@ -390,7 +395,7 @@ { purple_debug_info( MXIT_PLUGIN_ID, "Sending message '%s' to buddy '%s'\n", message, who ); - mxit_send_message( gc->proto_data, who, message, TRUE ); + mxit_send_message( gc->proto_data, who, message, TRUE, FALSE ); return 1; /* echo to conversation window */ } @@ -423,6 +428,7 @@ statusmsg1 = purple_markup_strip_html( purple_status_get_attr_string( status, "message" ) ); statusmsg2 = g_strndup( statusmsg1, CP_MAX_STATUS_MSG ); + purple_debug_info( MXIT_PLUGIN_ID, "mxit_set_status: '%s'\n", statusmsg2 ); /* update presence state */
--- a/libpurple/protocols/mxit/protocol.c Thu Feb 18 08:10:58 2010 +0000 +++ b/libpurple/protocols/mxit/protocol.c Thu Feb 18 09:20:29 2010 +0000 @@ -695,12 +695,12 @@ * @param to The username of the recipient * @param msg The message text */ -void mxit_send_message( struct MXitSession* session, const char* to, const char* msg, gboolean parse_markup ) +void mxit_send_message( struct MXitSession* session, const char* to, const char* msg, gboolean parse_markup, gboolean is_command ) { char data[CP_MAX_PACKET]; char* markuped_msg; int datalen; - int msgtype = CP_MSGTYPE_NORMAL; + int msgtype = ( is_command ? CP_MSGTYPE_COMMAND : CP_MSGTYPE_NORMAL ); /* first we need to convert the markup from libPurple to MXit format */ if ( parse_markup ) @@ -1254,6 +1254,7 @@ { PurpleStatus* status; int presence; + const char* statusmsg; const char* profilelist[] = { CP_PROFILE_BIRTHDATE, CP_PROFILE_GENDER, CP_PROFILE_HIDENUMBER, CP_PROFILE_FULLNAME, CP_PROFILE_TITLE, CP_PROFILE_FIRSTNAME, CP_PROFILE_LASTNAME, CP_PROFILE_EMAIL, CP_PROFILE_MOBILENR }; @@ -1272,13 +1273,21 @@ /* update presence status */ status = purple_account_get_active_status( session->acc ); presence = mxit_convert_presence( purple_status_get_id( status ) ); - if ( presence != MXIT_PRESENCE_ONLINE ) { + statusmsg = purple_status_get_attr_string( status, "message" ); + + if ( ( presence != MXIT_PRESENCE_ONLINE ) || ( statusmsg ) ) { /* when logging into MXit, your default presence is online. but with the UI, one can change * the presence to whatever. in the case where its changed to a different presence setting * we need to send an update to the server, otherwise the user's presence will be out of * sync between the UI and MXit. */ - mxit_send_presence( session, presence, purple_status_get_attr_string( status, "message" ) ); + char* statusmsg1 = purple_markup_strip_html( statusmsg ); + char* statusmsg2 = g_strndup( statusmsg1, CP_MAX_STATUS_MSG ); + + mxit_send_presence( session, presence, statusmsg2 ); + + g_free( statusmsg1 ); + g_free( statusmsg2 ); } /* save extra info if this is a HTTP connection */
--- a/libpurple/protocols/mxit/protocol.h Thu Feb 18 08:10:58 2010 +0000 +++ b/libpurple/protocols/mxit/protocol.h Thu Feb 18 09:20:29 2010 +0000 @@ -273,7 +273,7 @@ void mxit_send_presence( struct MXitSession* session, int presence, const char* statusmsg ); void mxit_send_mood( struct MXitSession* session, int mood ); -void mxit_send_message( struct MXitSession* session, const char* to, const char* msg, gboolean parse_markup ); +void mxit_send_message( struct MXitSession* session, const char* to, const char* msg, gboolean parse_markup, gboolean is_command ); void mxit_send_extprofile_update( struct MXitSession* session, const char* password, unsigned int nr_attrib, const char* attributes ); void mxit_send_extprofile_request( struct MXitSession* session, const char* username, unsigned int nr_attrib, const char* attribute[] );