Simplify. This is 6 lines instead of 15.

Sun, 21 Aug 2011 18:04:00 +0000

author
Mark Doliner <markdoliner@pidgin.im>
date
Sun, 21 Aug 2011 18:04:00 +0000
changeset 32161
7a995ee6298a
parent 32160
bef9224f485f
child 32162
cf848cd25330

Simplify. This is 6 lines instead of 15.

libpurple/protocols/yahoo/libymsg.c file | annotate | diff | comparison | revisions
--- a/libpurple/protocols/yahoo/libymsg.c	Sun Aug 21 18:00:53 2011 +0000
+++ b/libpurple/protocols/yahoo/libymsg.c	Sun Aug 21 18:04:00 2011 +0000
@@ -4036,21 +4036,12 @@
 
 	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);
 	}
 }
 

mercurial