diff libpurple/protocols/mxit/profile.c @ 32363:3322201b446f

I went through all our calls to purple_notify_user_info_add_pair() and checked whether they should be purple_notify_user_info_add_pair_plaintext(), instead. If it wasn't immediately obvious one way or the other then I left a comment to investigate. I suspect there are still a lot of places where we should use the _plaintext function to escape the value.
author Mark Doliner <mark@kingant.net>
date Mon, 22 Aug 2011 01:53:37 +0000
parents 93cb9f408df4
children 323876c34a96
line wrap: on
line diff
--- a/libpurple/protocols/mxit/profile.c	Sun Aug 21 21:27:17 2011 +0000
+++ b/libpurple/protocols/mxit/profile.c	Mon Aug 22 01:53:37 2011 +0000
@@ -170,51 +170,70 @@
 
 	buddy = purple_find_buddy( session->acc, username );
 	if ( buddy ) {
-		purple_notify_user_info_add_pair( info, _( "Alias" ), purple_buddy_get_alias( buddy ) );
+		purple_notify_user_info_add_pair_plaintext( info, _( "Alias" ), purple_buddy_get_alias( buddy ) );
 		purple_notify_user_info_add_section_break( info );
 		contact = purple_buddy_get_protocol_data( buddy );
 	}
 
+	/* TODO: Check whether it's correct to call add_pair_html,
+	         or if we should be using add_pair_plaintext */
 	purple_notify_user_info_add_pair( info, _( "Display Name" ), profile->nickname );
 
 	tmp = g_strdup_printf("%s (%i)", profile->birthday, calculateAge( profile->birthday ) );
+	/* TODO: Check whether it's correct to call add_pair_html,
+	         or if we should be using add_pair_plaintext */
 	purple_notify_user_info_add_pair( info, _( "Birthday" ), tmp );
 	g_free( tmp );
 
-	purple_notify_user_info_add_pair( info, _( "Gender" ), profile->male ? _( "Male" ) : _( "Female" ) );
+	purple_notify_user_info_add_pair_plaintext( info, _( "Gender" ), profile->male ? _( "Male" ) : _( "Female" ) );
 
 	/* optional information */
+	/* TODO: Check whether it's correct to call add_pair_html,
+	         or if we should be using add_pair_plaintext */
 	purple_notify_user_info_add_pair( info, _( "First Name" ), profile->firstname );
+	/* TODO: Check whether it's correct to call add_pair_html,
+	         or if we should be using add_pair_plaintext */
 	purple_notify_user_info_add_pair( info, _( "Last Name" ), profile->lastname );
+	/* TODO: Check whether it's correct to call add_pair_html,
+	         or if we should be using add_pair_plaintext */
 	purple_notify_user_info_add_pair( info, _( "Country" ), profile->regcountry );
 
-	if ( strlen( profile->aboutme ) > 0 )
+	if ( strlen( profile->aboutme ) > 0 ) {
+		/* TODO: Check whether it's correct to call add_pair_html,
+		         or if we should be using add_pair_plaintext */
 		purple_notify_user_info_add_pair( info, _( "About Me" ), profile->aboutme );
-	if ( strlen( profile->whereami ) > 0 )
+	}
+	if ( strlen( profile->whereami ) > 0 ) {
+		/* TODO: Check whether it's correct to call add_pair_html,
+		         or if we should be using add_pair_plaintext */
 		purple_notify_user_info_add_pair( info, _( "Where I Live" ), profile->whereami );
+	}
 
 	purple_notify_user_info_add_section_break( info );
 
 	if ( contact ) {
 		/* presence */
-		purple_notify_user_info_add_pair( info, _( "Status" ), mxit_convert_presence_to_name( contact->presence ) );
+		purple_notify_user_info_add_pair_plaintext( info, _( "Status" ), mxit_convert_presence_to_name( contact->presence ) );
 
 		/* last online */
 		if ( contact->presence == MXIT_PRESENCE_OFFLINE )
-			purple_notify_user_info_add_pair( info, _( "Last Online" ), ( profile->lastonline == 0 ) ? _( "Unknown" ) : datetime( profile->lastonline ) );
+			purple_notify_user_info_add_pair_plaintext( info, _( "Last Online" ), ( profile->lastonline == 0 ) ? _( "Unknown" ) : datetime( profile->lastonline ) );
 
 		/* mood */
 		if ( contact->mood != MXIT_MOOD_NONE )
-			purple_notify_user_info_add_pair( info, _( "Mood" ), mxit_convert_mood_to_name( contact->mood ) );
+			purple_notify_user_info_add_pair_plaintext( info, _( "Mood" ), mxit_convert_mood_to_name( contact->mood ) );
 		else
-			purple_notify_user_info_add_pair( info, _( "Mood" ), _( "None" ) );
+			purple_notify_user_info_add_pair_plaintext( info, _( "Mood" ), _( "None" ) );
 
 		/* status message */
-		if ( contact->statusMsg )
+		if ( contact->statusMsg ) {
+			/* TODO: Check whether it's correct to call add_pair_html,
+			         or if we should be using add_pair_plaintext */
 			purple_notify_user_info_add_pair( info, _( "Status Message" ), contact->statusMsg );
+		}
 
 		/* subscription type */
-		purple_notify_user_info_add_pair( info, _( "Subscription" ), mxit_convert_subtype_to_name( contact->subtype ) );
+		purple_notify_user_info_add_pair_plaintext( info, _( "Subscription" ), mxit_convert_subtype_to_name( contact->subtype ) );
 	}
 	else {
 		/* this is an invite */
@@ -222,18 +241,25 @@
 		if ( contact ) {
 			/* invite found */
 
-			if ( contact->msg )
+			if ( contact->msg ) {
+				/* TODO: Check whether it's correct to call add_pair_html,
+				         or if we should be using add_pair_plaintext */
 				purple_notify_user_info_add_pair( info, _( "Invite Message" ), contact->msg );
+			}
 
 			if ( contact->imgid ) {
 				/* this invite has a avatar */
 				char* img_text;
 				img_text = g_strdup_printf( "<img id='%d'>", contact->imgid );
 				purple_notify_user_info_add_pair( info, _( "Photo" ), img_text );
+				g_free(img_text);
 			}
 
-			if ( contact->statusMsg )
+			if ( contact->statusMsg ) {
+				/* TODO: Check whether it's correct to call add_pair_html,
+				         or if we should be using add_pair_plaintext */
 				purple_notify_user_info_add_pair( info, _( "Status Message" ), contact->statusMsg );
+			}
 		}
 	}