summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorTingPing <tingping@tingping.se>2013-09-25 17:16:47 -0400
committerTingPing <tingping@tingping.se>2013-09-25 17:16:47 -0400
commitc7a00a4aba32984b4d3cc8fc5bb1039f4f6cc224 (patch)
tree76946ed2e9d314643fac98ee01add0f3579fada0 /src
parent7bc3317eeb2f91a4cd14c4429dcf2aaf7cb3829c (diff)
Only show users country if its not unknown
Diffstat (limited to 'src')
-rw-r--r--src/common/util.c4
-rw-r--r--src/fe-gtk/menu.c16
2 files changed, 11 insertions, 9 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 9771b1f6..cb6181c4 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -1253,7 +1253,7 @@ country (char *hostname)
 	domain_t *dom;
 
 	if (!hostname || !*hostname || isdigit ((unsigned char) hostname[strlen (hostname) - 1]))
-		return _("Unknown");
+		return NULL;
 	if ((p = strrchr (hostname, '.')))
 		p++;
 	else
@@ -1263,7 +1263,7 @@ country (char *hostname)
 						sizeof (domain_t), country_compare);
 
 	if (!dom)
-		return _("Unknown");
+		return NULL;
 
 	return _(dom->country);
 }
diff --git a/src/fe-gtk/menu.c b/src/fe-gtk/menu.c
index 20daa398..feb80157 100644
--- a/src/fe-gtk/menu.c
+++ b/src/fe-gtk/menu.c
@@ -600,7 +600,7 @@ menu_create_nickinfo_menu (struct User *user, GtkWidget *submenu)
 {
 	char buf[512];
 	char unknown[96];
-	char *real, *fmt;
+	char *real, *fmt, *users_country;
 	struct away_msg *away;
 	gboolean missing = FALSE;
 	GtkWidget *item;
@@ -637,12 +637,14 @@ menu_create_nickinfo_menu (struct User *user, GtkWidget *submenu)
 							G_CALLBACK (copy_to_clipboard_cb), 
 							user->account ? user->account : unknown);
 
-	snprintf (buf, sizeof (buf), fmt, _("Country:"),
-				 user->hostname ? country(user->hostname) : unknown);
-	item = menu_quick_item (0, buf, submenu, XCMENU_MARKUP, 0, 0);
-	g_signal_connect (G_OBJECT (item), "activate",
-							G_CALLBACK (copy_to_clipboard_cb), 
-							user->hostname ? country(user->hostname) : unknown);
+	users_country = country (user->hostname);
+	if (users_country)
+	{
+		snprintf (buf, sizeof (buf), fmt, _ ("Country:"), users_country);
+		item = menu_quick_item (0, buf, submenu, XCMENU_MARKUP, 0, 0);
+		g_signal_connect (G_OBJECT (item), "activate",
+			G_CALLBACK (copy_to_clipboard_cb), users_country);
+	}
 
 	snprintf (buf, sizeof (buf), fmt, _("Server:"),
 				 user->servername ? user->servername : unknown);