changeset 3493:4b204c262376

[gaim-migrate @ 3553] Rob committed some bug fixes to gtk1-stable, but not to HEAD. now his computer is acting up again, so i'm making the corresponding commits to HEAD. this should help with yahoo i18n, segfaults on jabber, a problem in gaimrc, and word wrapping on new mail notification. Modified Files: ChangeLog src/gaim.h src/gaimrc.c src/prpl.c src/protocols/msn/msn.c src/protocols/yahoo/yahoo.c ---------------------------------------------------------------------- committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Tue, 10 Sep 2002 15:31:34 +0000
parents 3b9b5e06c2e0
children 8de976fe3ed8
files ChangeLog src/gaim.h src/gaimrc.c src/protocols/msn/msn.c src/protocols/yahoo/yahoo.c src/prpl.c
diffstat 6 files changed, 48 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Sep 08 15:22:48 2002 +0000
+++ b/ChangeLog	Tue Sep 10 15:31:34 2002 +0000
@@ -64,6 +64,11 @@
 	* Login all auto-login accounts from login window (Thanks
 	  Etan Reisner)
 	* View log button in conversation toolbar (Thanks Etan Reisner)
+	* Fixed a possible segfault when signing off Jabber (Thanks
+	  Craig Boston)
+	* Word-wrapping on mail notification text (Thanks, Andrew Molloy)
+	* Strip trailing and leading spaces from MSN/Yahoo names (Thanks,
+	  Arun Tharuvai)
 
 version 0.59 (06/24/2002):
 	* Hungarian translation added (Thanks, Sutto Zoltan)
--- a/src/gaim.h	Sun Sep 08 15:22:48 2002 +0000
+++ b/src/gaim.h	Tue Sep 10 15:31:34 2002 +0000
@@ -455,11 +455,11 @@
 extern const char *handle_uri(char *);
 
 #ifdef HAVE_LANGINFO_CODESET
-#define utf8_to_str(in) convert_string(in, nl_langinfo(CODESET), "UTF-8");
-#define str_to_utf8(in) convert_string(in, "UTF-8", nl_langinfo(CODESET));
+#define utf8_to_str(in) convert_string(in, nl_langinfo(CODESET), "UTF-8")
+#define str_to_utf8(in) convert_string(in, "UTF-8", nl_langinfo(CODESET))
 #else
-#define utf8_to_str(in) convert_string(in, "ISO-8859-1", "UTF-8");
-#define str_to_utf8(in) convert_string(in, "UTF-8", "ISO-8859-1");
+#define utf8_to_str(in) convert_string(in, "ISO-8859-1", "UTF-8")
+#define str_to_utf8(in) convert_string(in, "UTF-8", "ISO-8859-1")
 #endif
 
 /*------------------------------------------------------------------------*/
--- a/src/gaimrc.c	Sun Sep 08 15:22:48 2002 +0000
+++ b/src/gaimrc.c	Tue Sep 10 15:31:34 2002 +0000
@@ -63,16 +63,15 @@
 	char value[MAX_VALUES][4096];
 };
 
-static struct parse *parse_line(char *line)
+static struct parse *parse_line(char *line, struct parse *p)
 {
 	char *c = line;
 	int inopt = 1, inval = 0, curval = -1;
 	int optlen = 0, vallen = 0;
-	static struct parse p;
 	int x;
 
 	for (x = 0; x < MAX_VALUES; x++) {
-		p.value[x][0] = 0;
+		p->value[x][0] = 0;
 	}
 
 
@@ -85,36 +84,36 @@
 			/*   if ((*c < 'a' || *c > 'z') && *c != '_') { */
 			if ((*c < 'a' || *c > 'z') && *c != '_' && (*c < 'A' || *c > 'Z')) {
 				inopt = 0;
-				p.option[optlen] = 0;
+				p->option[optlen] = 0;
 				c++;
 				continue;
 			}
 
-			p.option[optlen] = *c;
+			p->option[optlen] = *c;
 			optlen++;
 			c++;
 			continue;
 		} else if (inval) {
 			if ((*c == '}')) {
 				if (*(c - 1) == '\\') {
-					p.value[curval][vallen - 1] = *c;
+					p->value[curval][vallen - 1] = *c;
 					c++;
 					continue;
 				} else {
-					p.value[curval][vallen - 1] = 0;
+					p->value[curval][vallen - 1] = 0;
 					inval = 0;
 					c++;
 					continue;
 				}
 			} else {
-				p.value[curval][vallen] = *c;
+				p->value[curval][vallen] = *c;
 				vallen++;
 				c++;
 				continue;
 			}
 		} else if (*c == '{') {
 			if (*(c - 1) == '\\') {
-				p.value[curval][vallen - 1] = *c;
+				p->value[curval][vallen - 1] = *c;
 				c++;
 				continue;
 			} else {
@@ -129,7 +128,7 @@
 		c++;
 	}
 
-	return &p;
+	return p;
 }
 
 
@@ -228,6 +227,7 @@
 
 static void gaimrc_read_away(FILE *f)
 {
+	struct parse parse_buffer;
 	struct parse *p;
 	char buf[4096];
 	struct away_message *a;
@@ -241,7 +241,7 @@
 		if (buf[0] == '}')
 			return;
 
-		p = parse_line(buf);
+		p = parse_line(buf, &parse_buffer);
 		if (!strcmp(p->option, "message")) {
 			a = g_new0(struct away_message, 1);
 
@@ -301,6 +301,7 @@
 
 static void gaimrc_read_pounce(FILE *f)
 {
+	struct parse parse_buffer;
 	struct parse *p;
 	char buf[4096];
 	struct buddy_pounce *b;
@@ -314,7 +315,7 @@
 		if (buf[0] == '}')
 			return;
 
-		p = parse_line(buf);
+		p = parse_line(buf, &parse_buffer);
 		if (!strcmp(p->option, "entry")) {
 			b = g_new0(struct buddy_pounce, 1);
 
@@ -413,6 +414,7 @@
 
 static void gaimrc_read_plugins(FILE *f)
 {
+	struct parse parse_buffer;
 	struct parse *p;
 	char buf[4096];
 	GSList *load = NULL;
@@ -426,7 +428,7 @@
 		if (buf[0] == '}')
 			break;
 
-		p = parse_line(buf);
+		p = parse_line(buf, &parse_buffer);
 		if (!strcmp(p->option, "plugin")) {
 			filter_break(p->value[0]);
 			load = g_slist_append(load, g_strdup(p->value[0]));
@@ -446,6 +448,7 @@
 
 static struct aim_user *gaimrc_read_user(FILE *f)
 {
+	struct parse parse_buffer;
 	struct parse *p;
 	struct aim_user *u;
 	int i;
@@ -454,7 +457,7 @@
 	if (!fgets(buf, sizeof(buf), f))
 		return NULL;
 
-	p = parse_line(buf);
+	p = parse_line(buf, &parse_buffer);
 
 	if (strcmp(p->option, "ident"))
 		return NULL;
@@ -499,7 +502,7 @@
 		return u;
 	}
 
-	p = parse_line(buf);
+	p = parse_line(buf, &parse_buffer);
 
 	if (strcmp(p->option, "user_opts"))
 		return u;
@@ -513,7 +516,7 @@
 	if (!strcmp(buf, "\t}"))
 		return u;
 
-	p = parse_line(buf);
+	p = parse_line(buf, &parse_buffer);
 
 	if (strcmp(p->option, "proto_opts"))
 		return u;
@@ -527,7 +530,7 @@
 	if (!strcmp(buf, "\t}"))
 		return u;
 
-	p = parse_line(buf);
+	p = parse_line(buf, &parse_buffer);
 
 	if (strcmp(p->option, "iconfile"))
 		return u;
@@ -540,7 +543,7 @@
 	if (!strcmp(buf, "\t}"))
 		return u;
 
-	p = parse_line(buf);
+	p = parse_line(buf, &parse_buffer);
 
 	if (strcmp(p->option, "alias"))
 		return u;
@@ -593,6 +596,7 @@
 {
 	char buf[2048];
 	struct aim_user *u;
+	struct parse parse_buffer;
 	struct parse *p;
 
 	buf[0] = 0;
@@ -606,7 +610,7 @@
 
 
 
-		p = parse_line(buf);
+		p = parse_line(buf, &parse_buffer);
 
 		if (!strcmp(p->option, "current_user")) {
 		} else if (strcmp(p->option, "user")) {
@@ -706,6 +710,7 @@
 static void gaimrc_read_options(FILE *f)
 {
 	char buf[2048];
+	struct parse parse_buffer;
 	struct parse *p;
 	gboolean read_logging = FALSE, read_general = FALSE, read_display = FALSE;
 	int general_options = 0, display_options = 0;
@@ -720,7 +725,7 @@
 		if (!fgets(buf, sizeof(buf), f))
 			return;
 
-		p = parse_line(buf);
+		p = parse_line(buf, &parse_buffer);
 
 		if (!strcmp(p->option, "general_options")) {
 			general_options = atoi(p->value[0]);
@@ -872,6 +877,7 @@
 {
 	int i;
 	char buf[2048];
+	struct parse parse_buffer;
 	struct parse *p;
 
 	buf[0] = 0;
@@ -887,7 +893,7 @@
 		if (!fgets(buf, sizeof(buf), f))
 			return;
 
-		p = parse_line(buf);
+		p = parse_line(buf, &parse_buffer);
 
 		if (!strcmp(p->option, "sound_cmd")) {
 			g_snprintf(sound_cmd, sizeof(sound_cmd), "%s", p->value[0]);
@@ -1006,6 +1012,7 @@
 static void gaimrc_read_proxy(FILE *f)
 {
 	char buf[2048];
+	struct parse parse_buffer;
 	struct parse *p;
 
 	buf[0] = 0;
@@ -1018,7 +1025,7 @@
 		if (!fgets(buf, sizeof(buf), f))
 			return;
 
-		p = parse_line(buf);
+		p = parse_line(buf, &parse_buffer);
 
 		if (!strcmp(p->option, "host")) {
 			g_snprintf(proxyhost, sizeof(proxyhost), "%s", p->value[0]);
@@ -1135,7 +1142,7 @@
 	away_options =
 		OPT_AWAY_BACK_ON_IM;
 
-	for (i = 0; i < 7; i++)
+	for (i = 0; i < NUM_SOUNDS; i++)
 		sound_file[i] = NULL;
 	font_options = 0;
 	/* Enable all of the sound players that might be available.  The first
--- a/src/protocols/msn/msn.c	Sun Sep 08 15:22:48 2002 +0000
+++ b/src/protocols/msn/msn.c	Tue Sep 10 15:31:34 2002 +0000
@@ -162,9 +162,10 @@
 {
 	static char buf[BUF_LEN];
 
+	gchar * ss = g_strstrip(s);
 	g_return_val_if_fail(s != NULL, NULL);
 
-	g_snprintf(buf, sizeof(buf), "%s%s", s, strchr(s, '@') ? "" : "@hotmail.com");
+	g_snprintf(buf, sizeof(buf), "%s%s", ss, strchr(ss, '@') ? "" : "@hotmail.com");
 
 	return buf;
 }
--- a/src/protocols/yahoo/yahoo.c	Sun Sep 08 15:22:48 2002 +0000
+++ b/src/protocols/yahoo/yahoo.c	Tue Sep 10 15:31:34 2002 +0000
@@ -591,7 +591,7 @@
 			msg[j++] = m[i];
 		}
 		msg[j] = 0;
-		serv_got_im(gc, from, msg, 0, tm, -1);
+		serv_got_im(gc, from, utf8_to_str(msg), 0, tm, -1);
 	} else if (pkt->status == 2) {
 		do_error_dialog(_("Your Yahoo! message did not get sent."), NULL, GAIM_ERROR);
 	}
@@ -970,6 +970,7 @@
 	struct gaim_connection *gc = new_gaim_conn(user);
 	struct yahoo_data *yd = gc->proto_data = g_new0(struct yahoo_data, 1);
 
+	g_snprintf(gc->username, sizeof(gc->username), "%s", g_strstrip(gc->username));
 	set_login_progress(gc, 1, "Connecting");
 
 	yd->fd = -1;
@@ -1178,15 +1179,16 @@
 {
 	struct yahoo_data *yd = gc->proto_data;
 	struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_MESSAGE, YAHOO_STATUS_OFFLINE, 0);
+	char *msg = str_to_utf8(what);
 
 	yahoo_packet_hash(pkt, 1, gc->displayname);
 	yahoo_packet_hash(pkt, 5, who);
-	yahoo_packet_hash(pkt, 14, what);
+	yahoo_packet_hash(pkt, 14, msg);
 
 	yahoo_send_packet(yd, pkt);
 
 	yahoo_packet_free(pkt);
-
+	
 	return 1;
 }
 
--- a/src/prpl.c	Sun Sep 08 15:22:48 2002 +0000
+++ b/src/prpl.c	Tue Sep 10 15:31:34 2002 +0000
@@ -437,7 +437,8 @@
 
 	mn->email_label = gtk_label_new(buf);
 	gtk_label_set_text(GTK_LABEL(mn->email_label), buf);
-	gtk_box_pack_start(GTK_BOX(vbox), mn->email_label, 0, 0, 5);
+	gtk_label_set_line_wrap(GTK_LABEL(mn->email_label), TRUE);
+	gtk_box_pack_start(GTK_BOX(vbox), mn->email_label, FALSE, TRUE, 5);
 	gtk_widget_show(mn->email_label);
 
 	hbox = gtk_hbox_new(FALSE, 5);