changeset 8591:f96795b786d2

[gaim-migrate @ 9342] Alright, I had to get my tooltip construction deuglification on. I removed the \n between the core's tooltip and the prpl's tooltip. prpl's should PREpend a \n to each line they add to the tooltip instead of APpending. This way you don't have to worry about removing trailing newline... it makes a lot more sense to me. I also changed oscar and trepia to use g_strings instead of g_strdup_printf and g_strconcat. G strings are sexy. And I apologize to the translators for changing some strings (separated some html and some text). committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Tue, 06 Apr 2004 02:28:01 +0000
parents de3d7eb3fc86
children 1dde34c45c5b
files src/gtkblist.c src/protocols/jabber/jabber.c src/protocols/msn/msn.c src/protocols/oscar/oscar.c src/protocols/rendezvous/rendezvous.c src/protocols/trepia/trepia.c src/protocols/yahoo/yahoo.c
diffstat 7 files changed, 46 insertions(+), 140 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkblist.c	Tue Apr 06 01:19:51 2004 +0000
+++ b/src/gtkblist.c	Tue Apr 06 02:28:01 2004 +0000
@@ -2442,7 +2442,7 @@
 				       loggedin ? _("\n<b>Logged In:</b>") : "", loggedin ? loggedin : "",
 				       idletime ? _("\n<b>Idle:</b>") : "", idletime ? idletime : "",
 				       b->evil ? _("\n<b>Warned:</b>") : "", b->evil ? warning : "",
-				       statustext ? "\n" : "", statustext ? statustext : "",
+				       statustext ? "" : "", statustext ? statustext : "",
 				       !g_ascii_strcasecmp(b->name, "robflynn") ? _("\n<b>Description:</b> Spooky") :
 				       !g_ascii_strcasecmp(b->name, "seanegn") ? _("\n<b>Status</b>: Awesome") :
 				       !g_ascii_strcasecmp(b->name, "chipx86") ? _("\n<b>Status</b>: Rockin'") : "");
--- a/src/protocols/jabber/jabber.c	Tue Apr 06 01:19:51 2004 +0000
+++ b/src/protocols/jabber/jabber.c	Tue Apr 06 02:28:01 2004 +0000
@@ -895,7 +895,6 @@
 	JabberBuddy *jb = jabber_buddy_find(b->account->gc->proto_data, b->name,
 			FALSE);
 	GString *ret = g_string_new("");
-	char *r = NULL;
 
 	if(jb) {
 		JabberBuddyResource *jbr = jabber_buddy_find_resource(jb, NULL);
@@ -915,7 +914,7 @@
 			else
 				sub = _("None");
 		}
-		g_string_append_printf(ret, "<b>%s:</b> %s\n", _("Subscription"), sub);
+		g_string_append_printf(ret, "\n<b>%s:</b> %s", _("Subscription"), sub);
 
 		if(jbr) {
 			char *text = NULL;
@@ -926,7 +925,7 @@
 				g_free(stripped);
 			}
 
-			g_string_append_printf(ret, "<b>%s:</b> %s%s%s\n",
+			g_string_append_printf(ret, "\n<b>%s:</b> %s%s%s",
 					_("Status"),
 					jabber_get_state_string(jbr->state),
 					text ? ": " : "",
@@ -934,20 +933,12 @@
 			if(text)
 				g_free(text);
 		} else if(!GAIM_BUDDY_IS_ONLINE(b) && jb->error_msg) {
-			g_string_append_printf(ret, "<b>%s:</b> %s\n",
+			g_string_append_printf(ret, "\n<b>%s:</b> %s",
 					_("Error"), jb->error_msg);
 		}
 	}
 
-	if(ret->len > 0) {
-		g_string_truncate(ret, ret->len-1);
-		r = ret->str;
-		g_string_free(ret, FALSE);
-	} else {
-		g_string_free(ret, TRUE);
-	}
-
-	return r;
+	return g_string_free(ret, FALSE);
 }
 
 static GList *jabber_away_states(GaimConnection *gc)
--- a/src/protocols/msn/msn.c	Tue Apr 06 01:19:51 2004 +0000
+++ b/src/protocols/msn/msn.c	Tue Apr 06 02:28:01 2004 +0000
@@ -332,7 +332,7 @@
 	char *text = NULL;
 
 	if (GAIM_BUDDY_IS_ONLINE(b)) {
-		text = g_strdup_printf(_("<b>Status:</b> %s"),
+		text = g_strdup_printf("\n<b>%s:</b> %s", _("Status"),
 							   msn_away_get_text(MSN_AWAY_TYPE(b->uc)));
 	}
 
--- a/src/protocols/oscar/oscar.c	Tue Apr 06 01:19:51 2004 +0000
+++ b/src/protocols/oscar/oscar.c	Tue Apr 06 02:28:01 2004 +0000
@@ -3156,21 +3156,6 @@
 	return 1;
 }
 
-#if 0
-static char *images(int flags) {
-	static char buf[1024];
-	g_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s",
-			(flags & AIM_FLAG_ACTIVEBUDDY) ? "<IMG SRC=\"ab_icon.gif\">" : "",
-			(flags & AIM_FLAG_UNCONFIRMED) ? "<IMG SRC=\"dt_icon.gif\">" : "",
-			(flags & AIM_FLAG_AOL) ? "<IMG SRC=\"aol_icon.gif\">" : "",
-			(flags & AIM_FLAG_ICQ) ? "<IMG SRC=\"icq_icon.gif\">" : "",
-			(flags & AIM_FLAG_ADMINISTRATOR) ? "<IMG SRC=\"admin_icon.gif\">" : "",
-			(flags & AIM_FLAG_FREE) ? "<IMG SRC=\"free_icon.gif\">" : "",
-			(flags & AIM_FLAG_WIRELESS) ? "<IMG SRC=\"wireless_icon.gif\">" : "");
-	return buf;
-}
-#endif
-
 static char *caps_string(guint caps)
 {
 	static char buf[512], *tmp;
@@ -5695,15 +5680,13 @@
 	GaimGroup *g = gaim_find_buddys_group(b);
 	struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(b->account, b->name));
 	aim_userinfo_t *userinfo = aim_locate_finduserinfo(od->sess, b->name);
-	gchar *tmp = NULL, *ret = g_strdup("");
+	GString *ret = g_string_new("");
 
 	if (GAIM_BUDDY_IS_ONLINE(b)) {
 		if (isdigit(b->name[0])) {
 			char *status;
 			status = gaim_icq_status((b->uc & 0xffff0000) >> 16);
-			tmp = ret;
-			ret = g_strconcat(tmp, _("<b>Status:</b> "), status, "\n", NULL);
-			g_free(tmp);
+			g_string_append_printf(ret, "\n<b>%s:</b> %s", _("Status"), status);
 			g_free(status);
 		}
 
@@ -5713,35 +5696,26 @@
 							(bi->ipaddr & 0x00ff0000) >> 16,
 							(bi->ipaddr & 0x0000ff00) >> 8,
 							(bi->ipaddr & 0x000000ff));
-			tmp = ret;
-			ret = g_strconcat(tmp, _("<b>IP Address:</b> "), tstr, "\n", NULL);
-			g_free(tmp);
+			g_string_append_printf(ret, "\n<b>%s:</b> %s", _("IP Address"), tstr);
 			g_free(tstr);
 		}
 
 		if ((userinfo != NULL) && (userinfo->capabilities)) {
 			char *caps = caps_string(userinfo->capabilities);
-			tmp = ret;
-			ret = g_strconcat(tmp, _("<b>Capabilities:</b> "), caps, "\n", NULL);
-			g_free(tmp);
+			g_string_append_printf(ret, "\n<b>%s:</b> %s", _("Capabilities"), caps);
 		}
 
 		if (g && g->name) {
-			char *comment = NULL;
-			comment = aim_ssi_getcomment(od->sess->ssi.local, g->name, b->name);
+			char *comment = aim_ssi_getcomment(od->sess->ssi.local, g->name, b->name);
 			if (comment != NULL) {
-				tmp = ret;
-				ret = g_strconcat(tmp, _("<b>Buddy Comment:</b> "), comment, "\n", NULL);
-				free(tmp);
+				g_string_append_printf(ret, "\n<b>%s:</b> %s", _("Buddy Comment"), comment);
 				free(comment);
 			}
 		}
 
 		if ((bi != NULL) && (bi->availmsg != NULL) && !(b->uc & UC_UNAVAILABLE)) {
 			gchar *escaped = g_markup_escape_text(bi->availmsg, strlen(bi->availmsg));
-			tmp = ret;
-			ret = g_strconcat(tmp, _("<b>Available:</b> "), escaped, "\n", NULL);
-			g_free(tmp);
+			g_string_append_printf(ret, "\n<b>%s:</b> %s", _("Available"), escaped);
 			g_free(escaped);
 		}
 
@@ -5760,28 +5734,18 @@
 				g_free(tmp2);
 				tmp3 = gaim_str_sub_away_formatters(tmp1, gaim_account_get_username(gaim_connection_get_account(gc)));
 				g_free(tmp1);
-				tmp = ret;
-				ret = g_strconcat(tmp, _("<b>Away Message:</b> "), tmp3, "\n", NULL);
-				g_free(tmp);
+				g_string_append_printf(ret, "\n<b>%s:</b> %s", _("Away Message"), tmp3);
 			}
 		}
 	} else {
 		char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name);
-		if (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name)) {
-			tmp = ret;
-			ret = g_strconcat(tmp, _("<b>Status:</b> Not Authorized"), "\n", NULL);
-			g_free(tmp);
-		} else {
-			tmp = ret;
-			ret = g_strconcat(tmp, _("<b>Status:</b> Offline"), "\n", NULL);
-			g_free(tmp);
-		}
-	}
-
-	/* remove the trailing newline character */
-	if (ret && (strlen(ret) > 0))
-		ret[strlen(ret)-1] = '\0';
-	return ret;
+		if (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name))
+			g_string_append_printf(ret, "\n<b>%s:</b> %s", _("Status"), _("Not Authorized"));
+		else
+			g_string_append_printf(ret, "\n<b>%s:</b> %s", _("Status"), _("Offline"));
+	}
+
+	return g_string_free(ret, FALSE);;
 }
 
 static char *oscar_status_text(GaimBuddy *b) {
@@ -6861,11 +6825,13 @@
 	pam->gc = gc;
 	m = g_list_append(m, pam);
 
-/*	pam = g_new0(struct proto_actions_menu, 1);
+#if 0
+	pam = g_new0(struct proto_actions_menu, 1);
 	pam->label = _("Search for Buddy by Information");
 	pam->callback = show_find_info;
 	pam->gc = gc;
-	m = g_list_append(m, pam); */
+	m = g_list_append(m, pam);
+#endif
 
 	return m;
 }
--- a/src/protocols/rendezvous/rendezvous.c	Tue Apr 06 01:19:51 2004 +0000
+++ b/src/protocols/rendezvous/rendezvous.c	Tue Apr 06 02:28:01 2004 +0000
@@ -306,13 +306,13 @@
 	ret = g_string_new("");
 
 	if (rb->aim != NULL)
-		g_string_append_printf(ret, _("<b>AIM Screen name</b>: %s\n"), rb->aim);
+		g_string_append_printf(ret, "\n<b>%s</b>: %s", _("AIM Screen name"), rb->aim);
 
 	if (rb->msg != NULL) {
 		if (rb->status == UC_UNAVAILABLE)
-			g_string_append_printf(ret, _("<b>Away</b>: %s\n"), rb->msg);
+			g_string_append_printf(ret, "\n<b>%s</b>: %s", _("Away"), rb->msg);
 		else
-			g_string_append_printf(ret, _("<b>Available</b>: %s\n"), rb->msg);
+			g_string_append_printf(ret, "\n<b>%s</b>: %s", _("Available"), rb->msg);
 	}
 
 	/* XXX - Fix blist.c so we can prepend the \n's rather than appending them */
--- a/src/protocols/trepia/trepia.c	Tue Apr 06 01:19:51 2004 +0000
+++ b/src/protocols/trepia/trepia.c	Tue Apr 06 02:28:01 2004 +0000
@@ -389,95 +389,44 @@
 	const char *value;
 	const char *first_name, *last_name;
 	int int_value;
-	char *text = NULL;
-	char *tmp, *tmp2;
-
-	text = g_strdup("");
+	GString *ret = g_string_new("");
 
 	first_name = trepia_profile_get_first_name(profile);
 	last_name  = trepia_profile_get_last_name(profile);
 
-	if (first_name != NULL || last_name != NULL) {
-	    tmp = g_strdup_printf("<b>%s:</b> %s%s%s\n",_("Name"),
+	if (first_name != NULL || last_name != NULL)
+		g_string_append_printf(ret, "\n<b>%s:</b> %s%s%s", _("Name"),
 							  (first_name == NULL ? "" : first_name),
 							  (first_name == NULL ? "" : " "),
 							  (last_name == NULL ? "" : last_name));
 
-		tmp2 = g_strconcat(text, tmp, NULL);
-		g_free(tmp);
-		g_free(text);
-		text = tmp2;
-	}
+	if ((int_value = trepia_profile_get_age(profile)) != 0)
+		g_string_append_printf(ret, "\n<b>%s:</b> %d", _("Age"), int_value);
 
-	if ((int_value = trepia_profile_get_age(profile)) != 0) {
-		tmp = g_strdup_printf("<b>%s:</b> %d\n", _("Age"),int_value);
-
-		tmp2 = g_strconcat(text, tmp, NULL);
-		g_free(tmp);
-		g_free(text);
-		text = tmp2;
-	}
-
-	tmp = g_strdup_printf("<b>%s:</b> %s\n",_("Gender"),
+	g_string_append_printf(ret, "\n<b>%s:</b> %s", _("Gender"),
 			(trepia_profile_get_sex(profile) == 'F' ? _("Female") : _("Male")));
 
-	tmp2 = g_strconcat(text, tmp, NULL);
-	g_free(tmp);
-	g_free(text);
-	text = tmp2;
-
-	if ((value = trepia_profile_get_city(profile)) != NULL) {
-		tmp = g_strdup_printf("<b>%s:</b> %s\n", _("City"), value);
+	if ((value = trepia_profile_get_city(profile)) != NULL)
+		g_string_append_printf(ret, "\n<b>%s:</b> %s", _("City"), value);
 
-		tmp2 = g_strconcat(text, tmp, NULL);
-		g_free(tmp);
-		g_free(text);
-		text = tmp2;
-	}
-
-	if ((value = trepia_profile_get_state(profile)) != NULL) {
-		tmp = g_strdup_printf("<b>%s:</b> %s\n", _("State"), value);
+	if ((value = trepia_profile_get_state(profile)) != NULL)
+		g_string_append_printf(ret, "\n<b>%s:</b> %s", _("State"), value);
 
-		tmp2 = g_strconcat(text, tmp, NULL);
-		g_free(tmp);
-		g_free(text);
-		text = tmp2;
-	}
-
-	if ((value = trepia_profile_get_country(profile)) != NULL) {
-		tmp = g_strdup_printf("<b>%s:</b> %s\n", _("Country"), value);
+	if ((value = trepia_profile_get_country(profile)) != NULL)
+		g_string_append_printf(ret, "\n<b>%s:</b> %s", _("Country"), value);
 
-		tmp2 = g_strconcat(text, tmp, NULL);
-		g_free(tmp);
-		g_free(text);
-		text = tmp2;
-	}
-
-	if ((value = trepia_profile_get_homepage(profile)) != NULL) {
-		tmp = g_strdup_printf("<b>%s:</b> %s\n", _("Homepage"), value);
-
-		tmp2 = g_strconcat(text, tmp, NULL);
-		g_free(tmp);
-		g_free(text);
-		text = tmp2;
-	}
+	if ((value = trepia_profile_get_homepage(profile)) != NULL)
+		g_string_append_printf(ret, "\n<b>%s:</b> %s", _("Homepage"), value);
 
 	if ((value = trepia_profile_get_profile(profile)) != NULL) {
 		char *escaped_val = g_markup_escape_text(value, -1);
 
-		tmp = g_strdup_printf("<b>%s:</b> %s\n", _("Profile"), escaped_val);
+		g_string_append_printf(ret, "\n<b>%s:</b> %s", _("Profile"), escaped_val);
 
 		g_free(escaped_val);
-
-		tmp2 = g_strconcat(text, tmp, NULL);
-		g_free(tmp);
-		g_free(text);
-		text = tmp2;
 	}
 
-	text[strlen(text) - 1] = '\0';
-
-	return text;
+	return g_string_free(ret, FALSE);
 }
 
 static GList *
--- a/src/protocols/yahoo/yahoo.c	Tue Apr 06 01:19:51 2004 +0000
+++ b/src/protocols/yahoo/yahoo.c	Tue Apr 06 02:28:01 2004 +0000
@@ -2383,7 +2383,7 @@
 
 	f = g_hash_table_lookup(yd->friends, b->name);
 	if (!f)
-		status = g_strdup(_("Not on server list"));
+		status = g_strdup_printf("\n%s", _("Not on server list"));
 	else
 		switch (f->status) {
 		case YAHOO_STATUS_IDLE:
@@ -2403,7 +2403,7 @@
 		}
 
 	escaped = g_markup_escape_text(status, strlen(status));
-	ret = g_strdup_printf(_("<b>Status:</b> %s"), escaped);
+	ret = g_strdup_printf(_("\n<b>%s:</b> %s"), _("Status"), escaped);
 	g_free(status);
 	g_free(escaped);