changeset 6019:272c761c52e3

[gaim-migrate @ 6469] So Decklin sent me a patch to fix the problem with setting profiles, and then later that day, before I got a shot at it, KingAnt fixed it himself. But Decklin's fix is better, so here it is, hand-merged with love. KingAnt also points out that Decklin Foster is a cool name. Decklin also realized (and fixed) that we were initializing static protocols after importing prefs, causing the import to fail. Thanks, Decklin. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Sat, 05 Jul 2003 01:49:07 +0000
parents d4caf585f6ff
children 3b6f48766acb
files src/away.c src/dialogs.c src/main.c src/protocols/oscar/oscar.c src/server.c
diffstat 5 files changed, 26 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/src/away.c	Fri Jul 04 21:29:55 2003 +0000
+++ b/src/away.c	Sat Jul 05 01:49:07 2003 +0000
@@ -208,7 +208,6 @@
 	GtkWidget *vbox;
 	GtkTreeViewColumn *column;
 	GtkCellRenderer *renderer;
-	char *buf2;
 	char *buf;
 
 	if (!a)
@@ -301,10 +300,7 @@
 	}
 
 	gtk_widget_show(imaway);
-	buf2 = g_malloc(strlen(awaymessage->message) * 4 + 1);
-	strncpy_withhtml(buf2, awaymessage->message, strlen(awaymessage->message) * 4 + 1);
-	serv_set_away_all(buf2);
-	g_free(buf2);
+	serv_set_away_all(awaymessage->message);
 }
 
 void rem_away_mess(GtkWidget *w, struct away_message *a)
--- a/src/dialogs.c	Fri Jul 04 21:29:55 2003 +0000
+++ b/src/dialogs.c	Sat Jul 05 01:49:07 2003 +0000
@@ -1883,9 +1883,7 @@
 	junk = gtk_text_view_get_text(GTK_TEXT_VIEW(b->text), FALSE);
 
 	if (b->account) {
-		gchar *tmp = strdup_withhtml(junk);
-		gaim_account_set_user_info(b->account, tmp);
-		g_free(tmp);
+		gaim_account_set_user_info(b->account, junk);
 		gc = b->account->gc;
 
 		if (gc)
--- a/src/main.c	Fri Jul 04 21:29:55 2003 +0000
+++ b/src/main.c	Sat Jul 05 01:49:07 2003 +0000
@@ -838,6 +838,8 @@
 
 	/* This has to be done before the debug stuff. */
 	gaim_gtk_stock_init();
+	
+	static_proto_init();
 
 	gaim_prefs_init();
 	gaim_gtk_prefs_init();
@@ -921,8 +923,6 @@
 	if (gaim_prefs_get_bool("/gaim/gtk/debug/enabled"))
 		gaim_gtk_debug_window_show();
 
-	static_proto_init();
-
 	/* deal with --login */
 	if (opt_login) {
 		dologin_ret = dologin_named(opt_login_arg);
--- a/src/protocols/oscar/oscar.c	Fri Jul 04 21:29:55 2003 +0000
+++ b/src/protocols/oscar/oscar.c	Sat Jul 05 01:49:07 2003 +0000
@@ -4413,6 +4413,7 @@
 static void oscar_set_info(GaimConnection *gc, const char *text) {
 	struct oscar_data *od = (struct oscar_data *)gc->proto_data;
 	fu32_t flags = 0;
+	char *text_html = NULL;
 	char *msg = NULL;
 	int msglen = 0;
 
@@ -4430,19 +4431,20 @@
 			aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, NULL, NULL, 0, caps_aim);
 			return;
 		}
-
-		flags = oscar_encoding_check(text);
+		
+		text_html = strdup_withhtml(text);
+		flags = oscar_encoding_check(text_html);
 		if (flags & AIM_IMFLAGS_UNICODE) {
-			msg = g_convert(text, strlen(text), "UCS-2BE", "UTF-8", NULL, &msglen, NULL);
+			msg = g_convert(text_html, strlen(text_html), "UCS-2BE", "UTF-8", NULL, &msglen, NULL);
 			aim_bos_setprofile(od->sess, od->conn, "unicode-2-0", msg, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0, caps_aim);
 			g_free(msg);
 		} else if (flags & AIM_IMFLAGS_ISO_8859_1) {
-			msg = g_convert(text, strlen(text), "ISO-8859-1", "UTF-8", NULL, &msglen, NULL);
+			msg = g_convert(text_html, strlen(text_html), "ISO-8859-1", "UTF-8", NULL, &msglen, NULL);
 			aim_bos_setprofile(od->sess, od->conn, "iso-8859-1", msg, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0, caps_aim);
 			g_free(msg);
 		} else {
-			msglen = strlen(text);
-			aim_bos_setprofile(od->sess, od->conn, "us-ascii", text, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0, caps_aim);
+			msglen = strlen(text_html);
+			aim_bos_setprofile(od->sess, od->conn, "us-ascii", text_html, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0, caps_aim);
 		}
 
 		if (msglen > od->rights.maxsiglen) {
@@ -4453,6 +4455,8 @@
 			g_free(errstr);
 		}
 
+		g_free(text_html);
+
 	}
 
 	return;
@@ -4461,6 +4465,7 @@
 static void oscar_set_away_aim(GaimConnection *gc, struct oscar_data *od, const char *text)
 {
 	fu32_t flags = 0;
+	gchar *text_html = NULL;
 	char *msg = NULL;
 	int msglen = 0;
 
@@ -4482,24 +4487,24 @@
 		return;
 	}
 
-	flags = oscar_encoding_check(text);
+	flags = oscar_encoding_check(text_html);
 	if (flags & AIM_IMFLAGS_UNICODE) {
-		msg = g_convert(text, strlen(text), "UCS-2BE", "UTF-8", NULL, &msglen, NULL);
+		msg = g_convert(text_html, strlen(text_html), "UCS-2BE", "UTF-8", NULL, &msglen, NULL);
 		aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, "unicode-2-0", msg, 
 			(msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen), caps_aim);
 		g_free(msg);
 		gc->away = g_strndup(text, od->rights.maxawaymsglen/2);
 	} else if (flags & AIM_IMFLAGS_ISO_8859_1) {
-		msg = g_convert(text, strlen(text), "ISO-8859-1", "UTF-8", NULL, &msglen, NULL);
+		msg = g_convert(text_html, strlen(text_html), "ISO-8859-1", "UTF-8", NULL, &msglen, NULL);
 		aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, "iso-8859-1", msg, 
 			(msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen), caps_aim);
 		g_free(msg);
-		gc->away = g_strndup(text, od->rights.maxawaymsglen);
+		gc->away = g_strndup(text_html, od->rights.maxawaymsglen);
 	} else {
-		msglen = strlen(text);
-		aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, "us-ascii", text, 
+		msglen = strlen(text_html);
+		aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, "us-ascii", text_html, 
 			(msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen), caps_aim);
-		gc->away = g_strndup(text, od->rights.maxawaymsglen);
+		gc->away = g_strndup(text_html, od->rights.maxawaymsglen);
 	}
 
 	if (msglen > od->rights.maxawaymsglen) {
@@ -4510,7 +4515,8 @@
 		gaim_notify_warning(gc, NULL, _("Away message too long."), errstr);
 		g_free(errstr);
 	}
-
+	
+	g_free(text_html);
 	return;
 }
 
--- a/src/server.c	Fri Jul 04 21:29:55 2003 +0000
+++ b/src/server.c	Sat Jul 05 01:49:07 2003 +0000
@@ -315,31 +315,19 @@
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
 
 	if (prpl_info && prpl_info->set_away) {
-		char *buf = NULL;
-
 		if (gc->away_state) {
 			g_free(gc->away_state);
 			gc->away_state = NULL;
 		}
 
-		if (message) {
-			buf = g_malloc(strlen(message) * 4 + 1);
-			if (gc->flags & OPT_CONN_HTML)
-				strncpy_withhtml(buf, message, strlen(message) * 4 + 1);
-			else
-				strncpy_nohtml(buf, message, strlen(message) + 1);
-		}
-
-		prpl_info->set_away(gc, state, buf);
+		prpl_info->set_away(gc, state, message);
 
 		if (gc->away && state) {
 			gc->away_state = g_strdup(state);
 		}
 
-		gaim_event_broadcast(event_away, gc, state, buf);
+		gaim_event_broadcast(event_away, gc, state, message);
 
-		if (buf)
-			g_free(buf);
 	}
 
 	system_log(log_away, gc, NULL, OPT_LOG_BUDDY_AWAY | OPT_LOG_MY_SIGNON);