/pidgin/main: d6b2b231d0cf: MXit does support including a messag...

Andrew Victor andrew.victor at mxit.com
Sun Jan 27 11:13:43 EST 2013


Changeset: d6b2b231d0cffb6c1bea56494eb8144691e2bc79
Author:	 Andrew Victor <andrew.victor at mxit.com>
Date:	 2013-01-27 18:13 +0200
Branch:	 release-2.x.y
URL: http://hg.pidgin.im/pidgin/main/rev/d6b2b231d0cf

Description:

MXit does support including a message when rejecting a subscription request.
Add the necessary protocol plumbing to support it.

diffstat:

 libpurple/protocols/mxit/multimx.c  |  2 +-
 libpurple/protocols/mxit/protocol.c |  7 ++++++-
 libpurple/protocols/mxit/protocol.h |  2 +-
 libpurple/protocols/mxit/roster.c   |  2 +-
 4 files changed, 9 insertions(+), 4 deletions(-)

diffs (61 lines):

diff --git a/libpurple/protocols/mxit/multimx.c b/libpurple/protocols/mxit/multimx.c
--- a/libpurple/protocols/mxit/multimx.c
+++ b/libpurple/protocols/mxit/multimx.c
@@ -514,7 +514,7 @@ void mxit_chat_reject(PurpleConnection *
 	}
 
 	/* Send Subscription Reject to MXit */
-	mxit_send_deny_sub(session, multimx->roomid);
+	mxit_send_deny_sub(session, multimx->roomid, NULL);
 
 	/* Remove from our list of rooms */
 	room_remove(session, multimx);
diff --git a/libpurple/protocols/mxit/protocol.c b/libpurple/protocols/mxit/protocol.c
--- a/libpurple/protocols/mxit/protocol.c
+++ b/libpurple/protocols/mxit/protocol.c
@@ -1064,8 +1064,9 @@ void mxit_send_allow_sub( struct MXitSes
  *
  *  @param session		The MXit session object
  *  @param username		The username of the contact being denied
+ *  @param reason		The message describing the reason for the rejection (can be NULL).
  */
-void mxit_send_deny_sub( struct MXitSession* session, const char* username )
+void mxit_send_deny_sub( struct MXitSession* session, const char* username, const char* reason )
 {
 	char		data[CP_MAX_PACKET];
 	int			datalen;
@@ -1076,6 +1077,10 @@ void mxit_send_deny_sub( struct MXitSess
 								username
 	);
 
+	/* append reason (if one is set) */
+	if ( reason )
+		datalen += sprintf( data + datalen, "%c%s", CP_FLD_TERM, reason );
+
 	/* queue packet for transmission */
 	mxit_queue_packet( session, data, datalen, CP_CMD_DENY );
 }
diff --git a/libpurple/protocols/mxit/protocol.h b/libpurple/protocols/mxit/protocol.h
--- a/libpurple/protocols/mxit/protocol.h
+++ b/libpurple/protocols/mxit/protocol.h
@@ -327,7 +327,7 @@ void mxit_send_suggest_search( struct MX
 void mxit_send_invite( struct MXitSession* session, const char* username, gboolean mxitid, const char* alias, const char* groupname, const char* message );
 void mxit_send_remove( struct MXitSession* session, const char* username );
 void mxit_send_allow_sub( struct MXitSession* session, const char* username, const char* alias );
-void mxit_send_deny_sub( struct MXitSession* session, const char* username );
+void mxit_send_deny_sub( struct MXitSession* session, const char* username, const char* reason );
 void mxit_send_update_contact( struct MXitSession* session, const char* username, const char* alias, const char* groupname );
 void mxit_send_splashclick( struct MXitSession* session, const char* splashid );
 void mxit_send_msgevent( struct MXitSession* session, const char* to, const char* id, int event);
diff --git a/libpurple/protocols/mxit/roster.c b/libpurple/protocols/mxit/roster.c
--- a/libpurple/protocols/mxit/roster.c
+++ b/libpurple/protocols/mxit/roster.c
@@ -619,7 +619,7 @@ static void mxit_cb_buddy_deny( gpointer
 	purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_buddy_deny '%s'\n", invite->contact->username );
 
 	/* send a deny subscription packet to MXit */
-	mxit_send_deny_sub( invite->session, invite->contact->username );
+	mxit_send_deny_sub( invite->session, invite->contact->username, NULL );
 
 	/* remove the invite from our internal invites list */
 	invite->session->invites = g_list_remove( invite->session->invites, invite->contact );



More information about the Commits mailing list