changeset 30415:985b57c4f55c

Add support for the "nm=" syle of clickable links. This is needed for the newer MXit services (eg, Chess / tiXi) that use the Gaming markup.
author andrew.victor@mxit.com
date Wed, 19 May 2010 19:21:32 +0000
parents be01173f597a
children f5855edbadb2
files libpurple/protocols/mxit/formcmds.c
diffstat 1 files changed, 18 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/mxit/formcmds.c	Wed May 19 17:57:14 2010 +0000
+++ b/libpurple/protocols/mxit/formcmds.c	Wed May 19 19:21:32 2010 +0000
@@ -206,10 +206,11 @@
 
 /*------------------------------------------------------------------------
  * Process a Clear MXit command.
- * [::op=cmd|type=clear|clearmsgscreen=true|auto=true|id=12345:]
+ *  [::op=cmd|type=clear|clearmsgscreen=true|auto=true|id=12345:]
  *
- *  @param session			The MXit session object
- *  @param from				The sender of the message.
+ *  @param session		The MXit session object
+ *  @param from			The sender of the message.
+ *  @param hash			The MXit command <key,value> map
  */
 static void command_clear(struct MXitSession* session, const char* from, GHashTable* hash)
 {
@@ -234,6 +235,8 @@
 
 /*------------------------------------------------------------------------
  * Process a Reply MXit command.
+ *  [::op=cmd|type=reply|replymsg=back|selmsg=b) Back|id=12345:]
+ *  [::op=cmd|nm=rep|type=reply|replymsg=back|selmsg=b) Back|id=12345:]
  *
  *  @param mx			The received message data object
  *  @param hash			The MXit command <key,value> map
@@ -242,10 +245,21 @@
 {
 	char* replymsg;
 	char* selmsg;
+	char* nm;
 
 	selmsg = g_hash_table_lookup(hash, "selmsg");			/* find the selection message */
 	replymsg = g_hash_table_lookup(hash, "replymsg");		/* find the reply message */
-	if ((selmsg) && (replymsg)) {
+	nm = g_hash_table_lookup(hash, "nm");					/* name parameter */
+	if ((selmsg) && (replymsg) && (nm)) {
+		gchar*	seltext = g_markup_escape_text(purple_url_decode(selmsg), -1);
+		gchar*	replycmd = g_strdup_printf("::type=reply|nm=%s|res=%s|err=0:", nm, replymsg);
+
+		mxit_add_html_link( mx, replycmd, seltext );
+
+		g_free(seltext);
+		g_free(replycmd);
+	}
+	else if ((selmsg) && (replymsg)) {
 		gchar*	seltext = g_markup_escape_text(purple_url_decode(selmsg), -1);
 
 		mxit_add_html_link( mx, purple_url_decode(replymsg), seltext );