changeset 31954:516435ac46a7

Escape the font-size-change character sequences when sending to MXit.
author andrew.victor@mxit.com
date Mon, 11 Apr 2011 20:37:42 +0000
parents 12676cfd4a1e
children 17875962a0a0
files libpurple/protocols/mxit/markup.c
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/mxit/markup.c	Mon Apr 11 18:27:03 2011 +0000
+++ b/libpurple/protocols/mxit/markup.c	Mon Apr 11 20:37:42 2011 +0000
@@ -1090,10 +1090,15 @@
 				}
 				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 @@
 				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;