pidgin: f21537d0: Simplify. This is 6 lines instead of 15...

markdoliner at pidgin.im markdoliner at pidgin.im
Sun Aug 21 14:05:32 EDT 2011


----------------------------------------------------------------------
Revision: f21537d04db182c6400ea3f922a84aa8ca72b77a
Parent:   72ab636d7e3c48e650375f60bfe2ee09de4adedc
Author:   markdoliner at pidgin.im
Date:     08/21/11 14:04:00
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/f21537d04db182c6400ea3f922a84aa8ca72b77a

Changelog: 

Simplify.  This is 6 lines instead of 15.

Changes against parent 72ab636d7e3c48e650375f60bfe2ee09de4adedc

  patched  libpurple/protocols/yahoo/libymsg.c

-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/libymsg.c	55dc81a2a5b2111e04ae87e08a40b2d639463a54
+++ libpurple/protocols/yahoo/libymsg.c	bbb59cc3352da1c83ee25de62267897c134c9f31
@@ -4036,21 +4036,12 @@ void yahoo_tooltip_text(PurpleBuddy *b, 
 
 	if (f && full) {
 		YahooPersonalDetails *ypd = &f->ypd;
-		int i;
-		struct {
-			char *text;
-			char *value;
-		} yfields[] = {
-			{N_("Home Phone Number"), ypd->phone.home},
-			{N_("Work Phone Number"), ypd->phone.work},
-			{N_("Mobile Phone Number"), ypd->phone.mobile},
-			{NULL, NULL}
-		};
-		for (i = 0; yfields[i].text; i++) {
-			if (!yfields[i].value || !*yfields[i].value)
-				continue;
-			purple_notify_user_info_add_pair(user_info, _(yfields[i].text), yfields[i].value);
-		}
+		if (ypd->phone.home && *ypd->phone.home)
+			purple_notify_user_info_add_pair(user_info, _("Home Phone Number"), ypd->phone.home);
+		if (ypd->phone.work && *ypd->phone.work)
+			purple_notify_user_info_add_pair(user_info, _("Work Phone Number"), ypd->phone.work);
+		if (ypd->phone.mobile && *ypd->phone.mobile)
+			purple_notify_user_info_add_pair(user_info, _("Mobile Phone Number"), ypd->phone.mobile);
 	}
 }
 


More information about the Commits mailing list