pidgin.mxit: 946c4722: Escape the font-size-change character se...

andrew.victor at mxit.com andrew.victor at mxit.com
Mon Apr 11 18:20:58 EDT 2011


----------------------------------------------------------------------
Revision: 946c4722745ca6dc861790fe1dd31ba783aa4322
Parent:   e360afb67091b84239b1d76e9d5cb5c10032277a
Author:   andrew.victor at mxit.com
Date:     04/11/11 16:37:42
Branch:   im.pidgin.pidgin.mxit
URL: http://d.pidgin.im/viewmtn/revision/info/946c4722745ca6dc861790fe1dd31ba783aa4322

Changelog: 

Escape the font-size-change character sequences when sending to MXit.


Changes against parent e360afb67091b84239b1d76e9d5cb5c10032277a

  patched  libpurple/protocols/mxit/markup.c

-------------- next part --------------
============================================================
--- libpurple/protocols/mxit/markup.c	1494d9bde0b5ad7028b8171d08352176b740967e
+++ libpurple/protocols/mxit/markup.c	5724b2f1ab82f5d817fc38fc54a2773692bfe733
@@ -1090,10 +1090,15 @@ char* mxit_convert_markup_tx( const char
 				}
 				else if ( purple_str_has_prefix( &message[i], "<font size=" ) ) {
 					/* font size */
+					int fontsize;
+
 					tag = g_new0( struct tag, 1 );
 					tag->type = MXIT_TAG_SIZE;
 					tagstack = g_list_prepend( tagstack, tag );
 					// TODO: implement size control
+					if ( sscanf( &message[i+12], "%i", &fontsize ) ) {
+						purple_debug_info( MXIT_PLUGIN_ID, "Font size set to %i\n", fontsize );
+					}
 				}
 				else if ( purple_str_has_prefix( &message[i], "<font color=" ) ) {
 					/* font colour */
@@ -1146,6 +1151,17 @@ char* mxit_convert_markup_tx( const char
 				g_string_append_c( mx, message[i] );		/* character to escape */
 				break;
 
+			case '.' : /* might be a MXit font size change, or custom emoticon */
+				if ( i + 1 < len ) {
+					if ( ( message[i+1] == '+' ) || ( message[i+1] == '-' ) )
+						g_string_append( mx, "\\." );		/* escape "." */
+					else
+						g_string_append_c( mx, '.' );
+				}
+				else
+					g_string_append_c( mx, '.' );
+				break;
+
 			default:
 				g_string_append_c( mx, message[i] );
 				break;


More information about the Commits mailing list