# HG changeset patch # User andrew.victor@mxit.com # Date 1280209796 0 # Node ID d3e13deb64a565645404795ab4c2601eeeb7b83e # Parent b6c3000eec60f845f83a210b7de05acf59256e96# Parent fe072dddc42cbd468ec227cfc4399e3da97144f4 propagate from branch 'im.pidgin.pidgin' (head d198e35f28e8800ec2979cfb22965fbe0a31e10d) to branch 'im.pidgin.pidgin.mxit' (head f076179c710fd4a5ce523d997c91996222fda668) diff -r b6c3000eec60 -r d3e13deb64a5 libpurple/protocols/mxit/markup.c --- a/libpurple/protocols/mxit/markup.c Mon Jul 26 04:21:47 2010 +0000 +++ b/libpurple/protocols/mxit/markup.c Tue Jul 27 05:49:56 2010 +0000 @@ -662,7 +662,7 @@ * @param message The message text * @return The length of the message to skip */ -static int mxit_extract_chatroom_nick( struct RXMsgData* mx, char* message, int len ) +static int mxit_extract_chatroom_nick( struct RXMsgData* mx, char* message, int len, int msgflags ) { int i; @@ -673,7 +673,6 @@ * Search for it.... */ gboolean found = FALSE; - gchar* nickname; for ( i = 1; i < len; i++ ) { if ( ( message[i] == '\n' ) && ( message[i-1] == '>' ) ) { @@ -685,12 +684,30 @@ } if ( found ) { + gchar* nickname; + /* * The message definitely had an embedded nickname - generate a marked-up * message to be displayed. */ nickname = g_markup_escape_text( &message[1], -1 ); + /* Remove any MXit escaping from nickname ("\X" --> "X") */ + if ( msgflags & CP_MSG_MARKUP ) { + int nicklen = strlen( nickname ); + int j, k; + + for ( j = 0, k = 0; j < nicklen; j++ ) { + if ( nickname[j] == '\\' ) + j++; + + nickname[k] = nickname[j]; + k++; + } + + nickname[k] = '\0'; /* terminate string */ + } + /* add nickname within some BOLD markup to the new converted message */ g_string_append_printf( mx->msg, "%s: ", nickname ); @@ -747,7 +764,7 @@ if ( is_mxit_chatroom_contact( mx->session, mx->from ) ) { /* chatroom message, so we need to extract and skip the sender's nickname * which is embedded inside the message */ - i = mxit_extract_chatroom_nick( mx, message, len ); + i = mxit_extract_chatroom_nick( mx, message, len, msgflags ); } /* run through the message and check for custom emoticons and markup */