changeset 6039:0c4d0c93c8c5

[gaim-migrate @ 6489] Er, nothing really. Fix an incorrect pref title. Fix a crash on windows when an icon is set to 0. Reorder lots of icon uploading stuff, hopefully it will fix the icon deletion problem. It probably won't. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 06 Jul 2003 05:07:11 +0000
parents 78c8b0f636f4
children 80e3641ee9eb
files src/gtkconv.c src/gtkprefs.c src/protocols/oscar/oscar.c
diffstat 3 files changed, 44 insertions(+), 44 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkconv.c	Sun Jul 06 03:26:20 2003 +0000
+++ b/src/gtkconv.c	Sun Jul 06 05:07:11 2003 +0000
@@ -144,7 +144,7 @@
 static void
 do_save_convo(GtkWidget *wid)
 {
-	GaimConversation *c = g_object_get_data(GTK_FILE_SELECTION(wid)->ok_button,
+	GaimConversation *c = g_object_get_data(G_OBJECT(GTK_FILE_SELECTION(wid)->ok_button),
 											"gaim_conversation");
 	const char *filename;
 	FILE *fp;
--- a/src/gtkprefs.c	Sun Jul 06 03:26:20 2003 +0000
+++ b/src/gtkprefs.c	Sun Jul 06 05:07:11 2003 +0000
@@ -800,7 +800,7 @@
 				  "/gaim/gtk/conversations/escape_closes", vbox);
 
 	vbox = gaim_gtk_make_frame(ret, _("Insertions"));
-	prefs_checkbox(_("Control-{B/I/U/S} inserts _HTML tags"),
+	prefs_checkbox(_("Control-{B/I/U} inserts _HTML tags"),
 				  "/gaim/gtk/conversations/html_shortcuts", vbox);
 	prefs_checkbox(_("Control-(number) _inserts smileys"),
 				  "/gaim/gtk/conversations/smiley_shortcuts", vbox);
--- a/src/protocols/oscar/oscar.c	Sun Jul 06 03:26:20 2003 +0000
+++ b/src/protocols/oscar/oscar.c	Sun Jul 06 05:07:11 2003 +0000
@@ -3534,27 +3534,26 @@
 	}
 
 	if (od->set_icon) {
-		const char *iconfile;
-		if ((iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc)))) {
-			FILE *file;
-			struct stat st;
-			gaim_debug(GAIM_DEBUG_INFO, "Uploading icon: %s\n", iconfile);
-			if (!stat(iconfile, &st)) {
-				char *buf = g_malloc(st.st_size);
-				file = fopen(iconfile, "rb");
-				if (file) {
-					fread(buf, 1, st.st_size, file);
-					gaim_debug(GAIM_DEBUG_INFO, "oscar",
-						   "Uploading icon to icon server\n");
-					aim_icon_upload(od->sess, buf, st.st_size);
-					fclose(file);
-				} else
-					gaim_debug(GAIM_DEBUG_ERROR, "oscar",
-						   "Can't open buddy icon file!\n");
-				g_free(buf);
+		struct stat st;
+		const char *iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc));
+		if (iconfile == NULL) {
+			/* Set an empty icon, or something */
+		} else if (!stat(iconfile, &st)) {
+			char *buf = g_malloc(st.st_size);
+			FILE *file = fopen(iconfile, "rb");
+			if (file) {
+				fread(buf, 1, st.st_size, file);
+				fclose(file);
+				gaim_debug(GAIM_DEBUG_INFO, "oscar",
+					   "Uploading icon to icon server\n");
+				aim_icon_upload(od->sess, buf, st.st_size);
 			} else
 				gaim_debug(GAIM_DEBUG_ERROR, "oscar",
-					   "Can't stat buddy icon file!\n");
+					   "Can't open buddy icon file!\n");
+			g_free(buf);
+		} else {
+			gaim_debug(GAIM_DEBUG_ERROR, "oscar",
+				   "Can't stat buddy icon file!\n");
 		}
 		od->set_icon = FALSE;
 	}
@@ -4293,6 +4292,7 @@
 			if (file) {
 				char *buf = g_malloc(st.st_size);
 				fread(buf, 1, st.st_size, file);
+				fclose(file);
 
 				args.iconlen   = st.st_size;
 				args.iconsum   = aimutil_iconsum(buf, st.st_size);
@@ -4311,7 +4311,6 @@
 					bi->ico_informed = TRUE;
 				}
 
-				fclose(file);
 				g_free(buf);
 			}
 		}
@@ -5482,27 +5481,26 @@
 					od->set_icon = TRUE;
 					aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_ICON);
 				} else {
-					const char *iconfile;
-					if ((iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc)))) {
-						FILE *file;
-						struct stat st;
-
-						if (!stat(iconfile, &st)) {
-							char *buf = g_malloc(st.st_size);
-							file = fopen(iconfile, "rb");
-							if (file) {
-								fread(buf, 1, st.st_size, file);
-								gaim_debug(GAIM_DEBUG_INFO, "oscar",
-									   "Uploading icon to icon server\n");
-								aim_icon_upload(od->sess, buf, st.st_size);
-								fclose(file);
-							} else
-								gaim_debug(GAIM_DEBUG_ERROR, "oscar",
-									   "Can't open buddy icon file!\n");
-							g_free(buf);
+					struct stat st;
+					const char *iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc));
+					if (iconfile == NULL) {
+						/* Set an empty icon, or something */
+					} else if (!stat(iconfile, &st)) {
+						char *buf = g_malloc(st.st_size);
+						FILE *file = fopen(iconfile, "rb");
+						if (file) {
+							fread(buf, 1, st.st_size, file);
+							fclose(file);
+							gaim_debug(GAIM_DEBUG_INFO, "oscar",
+								   "Uploading icon to icon server\n");
+							aim_icon_upload(od->sess, buf, st.st_size);
 						} else
 							gaim_debug(GAIM_DEBUG_ERROR, "oscar",
-								   "Can't stat buddy icon file!\n");
+								   "Can't open buddy icon file!\n");
+						g_free(buf);
+					} else {
+						gaim_debug(GAIM_DEBUG_ERROR, "oscar",
+							   "Can't stat buddy icon file!\n");
 					}
 				}
 			} else if (flags == 0x81)
@@ -6058,17 +6056,19 @@
 	FILE *file;
 	struct stat st;
 
-	if (!stat(iconfile, &st)) {
+	if (iconfile == NULL) {
+		/* Set an empty icon, or something */
+	} else if (!stat(iconfile, &st)) {
 		char *buf = g_malloc(st.st_size);
 		file = fopen(iconfile, "rb");
 		if (file) {
+			char md5[16];
 			int len = fread(buf, 1, st.st_size, file);
-			char md5[16];
+			fclose(file);
 			md5_state_t *state = g_malloc(sizeof(md5_state_t));
 			md5_init(state);
 			md5_append(state, buf, len);
 			md5_finish(state, md5);
-			fclose(file);
 			g_free(state);
 			aim_ssi_seticon(sess, md5, 16);
 		} else