changeset 5435:a2f26666de42

[gaim-migrate @ 5817] Phroggie says windows doesn't have a z modifier, so I'm just going to change size_t to an int, since it really doesn't matter. I also changed some sprintf's to snprintf's, I'm not really sure why. Changed a printf to gaim_debug in oscar.c, I don't know how that got in there. And I applied a patch that adds an optional callback thing for when a connection is closed. Gaim doesn't use it, but the guy that submitted the patch said it was useful to him. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 18 May 2003 19:13:21 +0000
parents 3034e83c1a49
children ad445074d239
files src/blist.c src/browser.c src/core.c src/main.c src/protocols/jabber/jabber.c src/protocols/oscar/aim_cbtypes.h src/protocols/oscar/conn.c src/protocols/oscar/oscar.c src/proxy.c src/util.c
diffstat 10 files changed, 27 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/src/blist.c	Sun May 18 18:34:01 2003 +0000
+++ b/src/blist.c	Sun May 18 19:13:21 2003 +0000
@@ -1113,7 +1113,7 @@
 		int protocol = (account->protocol == GAIM_PROTO_OSCAR) ? (isalpha(account->username[0]) ? GAIM_PROTO_TOC : GAIM_PROTO_ICQ): account->protocol;
 
 		if (file != (char *)NULL) {
-			sprintf(path, "%s" G_DIR_SEPARATOR_S "%s.%d.blist", file, g_screenname, protocol);
+			snprintf(path, PATHSIZE, "%s" G_DIR_SEPARATOR_S "%s.%d.blist", file, g_screenname, protocol);
 			g_free(g_screenname);
 		} else {
 			g_free(g_screenname);
--- a/src/browser.c	Sun May 18 18:34:01 2003 +0000
+++ b/src/browser.c	Sun May 18 19:13:21 2003 +0000
@@ -342,6 +342,7 @@
 	return lock_data;
 }
 
+#if 0
 static void mozilla_remote_obtain_lock(GdkWindow * window)
 {
 	gboolean locked = False;
@@ -374,7 +375,7 @@
 
 	gdk_x11_ungrab_server();
 }
-
+#endif
 
 static void mozilla_remote_free_lock(GdkWindow * window)
 {
--- a/src/core.c	Sun May 18 18:34:01 2003 +0000
+++ b/src/core.c	Sun May 18 19:13:21 2003 +0000
@@ -538,7 +538,7 @@
 #ifndef _WIN32
 	char buf[1024];
 	close(UI_fd);
-	sprintf(buf, "%s" G_DIR_SEPARATOR_S "gaim_%s.%d",
+	snprintf(buf, 1024, "%s" G_DIR_SEPARATOR_S "gaim_%s.%d",
 			g_get_tmp_dir(), g_get_user_name(), gaim_session);
 
 	unlink(buf);
--- a/src/main.c	Sun May 18 18:34:01 2003 +0000
+++ b/src/main.c	Sun May 18 19:13:21 2003 +0000
@@ -663,19 +663,19 @@
 	 * declare a handler for. thanks JSeymour and Vann.            */
 	if (sigemptyset(&sigset)) {
 		char errmsg[BUFSIZ];
-		sprintf(errmsg, "Warning: couldn't initialise empty signal set");
+		snprintf(errmsg, BUFSIZ, "Warning: couldn't initialise empty signal set");
 		perror(errmsg);
 	}
 	for(sig_indx = 0; catch_sig_list[sig_indx] != -1; ++sig_indx) {
 		if((prev_sig_disp = signal(catch_sig_list[sig_indx], sighandler)) == SIG_ERR) {
 			char errmsg[BUFSIZ];
-			sprintf(errmsg, "Warning: couldn't set signal %d for catching",
+			snprintf(errmsg, BUFSIZ, "Warning: couldn't set signal %d for catching",
 				catch_sig_list[sig_indx]);
 			perror(errmsg);
 		}
 		if(sigaddset(&sigset, catch_sig_list[sig_indx])) {
 			char errmsg[BUFSIZ];
-			sprintf(errmsg, "Warning: couldn't include signal %d for unblocking",
+			snprintf(errmsg, BUFSIZ, "Warning: couldn't include signal %d for unblocking",
 				catch_sig_list[sig_indx]);
 			perror(errmsg);
 		}
@@ -683,7 +683,7 @@
 	for(sig_indx = 0; ignore_sig_list[sig_indx] != -1; ++sig_indx) {
 		if((prev_sig_disp = signal(ignore_sig_list[sig_indx], SIG_IGN)) == SIG_ERR) {
 			char errmsg[BUFSIZ];
-			sprintf(errmsg, "Warning: couldn't set signal %d to ignore",
+			snprintf(errmsg, BUFSIZ, "Warning: couldn't set signal %d to ignore",
 				ignore_sig_list[sig_indx]);
 			perror(errmsg);
 		}
@@ -691,7 +691,7 @@
 
 	if (sigprocmask(SIG_UNBLOCK, &sigset, NULL)) {
 		char errmsg[BUFSIZ];
-		sprintf(errmsg, "Warning: couldn't unblock signals");
+		snprintf(errmsg, BUFSIZ, "Warning: couldn't unblock signals");
 		perror(errmsg);
 	}		
 #endif
--- a/src/protocols/jabber/jabber.c	Sun May 18 18:34:01 2003 +0000
+++ b/src/protocols/jabber/jabber.c	Sun May 18 19:13:21 2003 +0000
@@ -2055,7 +2055,7 @@
 static size_t jabber_xfer_read(char **buffer, struct gaim_xfer *xfer) {
 	struct jabber_xfer_data *data = xfer->data;
 	char test;
-	size_t size;
+	int size;
 
 	if(read(xfer->fd, &test, sizeof(test)) > 0) {
 		data->headers = g_string_append_c(data->headers, test);
@@ -2065,7 +2065,7 @@
 			if(data->newline) {
 				gchar *lenstr = strstr(data->headers->str, "Content-Length: ");
 				if(lenstr) {
-					sscanf(lenstr, "Content-Length: %zd", &size);
+					sscanf(lenstr, "Content-Length: %d", &size);
 					gaim_xfer_set_size(xfer, size);
 				}
 				gaim_xfer_set_read_fnc(xfer, NULL);
--- a/src/protocols/oscar/aim_cbtypes.h	Sun May 18 18:34:01 2003 +0000
+++ b/src/protocols/oscar/aim_cbtypes.h	Sun May 18 19:13:21 2003 +0000
@@ -297,8 +297,9 @@
 #define AIM_CB_SPECIAL_CONNCOMPLETE 0x0004
 #define AIM_CB_SPECIAL_FLAPVER 0x0005
 #define AIM_CB_SPECIAL_CONNINITDONE 0x0006
-#define AIM_CB_SPECIAL_IMAGETRANSFER 0x007
-#define AIM_CB_SPECIAL_MSGTIMEOUT 0x008
+#define AIM_CB_SPECIAL_IMAGETRANSFER 0x0007
+#define AIM_CB_SPECIAL_MSGTIMEOUT 0x0008
+#define AIM_CB_SPECIAL_CONNDEAD 0x0009
 #define AIM_CB_SPECIAL_UNKNOWN 0xffff
 #define AIM_CB_SPECIAL_DEFAULT AIM_CB_SPECIAL_UNKNOWN
 
--- a/src/protocols/oscar/conn.c	Sun May 18 18:34:01 2003 +0000
+++ b/src/protocols/oscar/conn.c	Sun May 18 19:13:21 2003 +0000
@@ -316,10 +316,16 @@
  */
 faim_export void aim_conn_close(aim_conn_t *deadconn)
 {
+	aim_rxcallback_t userfunc;
 
 	if (deadconn->fd >= 3)
 		close(deadconn->fd);
+
 	deadconn->fd = -1;
+
+	if ((userfunc = aim_callhandler(deadconn->sessv, deadconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNDEAD)))
+		userfunc(deadconn->sessv, NULL, deadconn);
+
 	if (deadconn->handlerlist)
 		aim_clearhandlers(deadconn);
 
--- a/src/protocols/oscar/oscar.c	Sun May 18 18:34:01 2003 +0000
+++ b/src/protocols/oscar/oscar.c	Sun May 18 19:13:21 2003 +0000
@@ -2969,7 +2969,7 @@
 		} break;
 
 		default: {
-			printf("Received unknown typing notification message from %s.  Type1 is 0x%04x and type2 is 0x%04hx.\n", sn, type1, type2);
+			gaim_debug(GAIM_DEBUG_ERROR, "oscar", "Received unknown typing notification message from %s.  Type1 is 0x%04x and type2 is 0x%04hx.\n", sn, type1, type2);
 		} break;
 	}
 
--- a/src/proxy.c	Sun May 18 18:34:01 2003 +0000
+++ b/src/proxy.c	Sun May 18 19:13:21 2003 +0000
@@ -333,11 +333,11 @@
 {
 	const char *message =
 		"Gaim's DNS child got a SIGTRAP signal. \n"
-		"This can be caused by trying to run gaim into gdb.\n"
-		"There's a known gdb bug which prevent this, supposedly gaim\n"
-		"should have detected you were using gdb and use an ugly hack,\n"
+		"This can be caused by trying to run gaim inside gdb.\n"
+		"There is a known gdb bug which prevents this.  Supposedly gaim\n"
+		"should have detected you were using gdb and used an ugly hack,\n"
 		"check cope_with_gdb_brokenness() in proxy.c.\n\n"
-		"For more info about the bug check http://sources.redhat.com/ml/gdb/2001-07/msg00349.html\n";
+		"For more info about this bug, see http://sources.redhat.com/ml/gdb/2001-07/msg00349.html\n";
 	fputs("\n* * *\n",stderr);
 	fputs(message,stderr);
 	fputs("* * *\n\n",stderr);
@@ -357,7 +357,7 @@
 		return;
 	already_done = TRUE;
 	ppid = getppid();
-	sprintf(s,"/proc/%d/exe", ppid);
+	snprintf(s, 300, "/proc/%d/exe", ppid);
 	n = readlink(s, e, sizeof(e));
 	e[MAX(n,sizeof(e)-1)] = '\0';
 	
--- a/src/util.c	Sun May 18 18:34:01 2003 +0000
+++ b/src/util.c	Sun May 18 19:13:21 2003 +0000
@@ -564,7 +564,7 @@
 	} while (pid != 0 && pid != (pid_t)-1);
 	if(pid == (pid_t)-1 && errno != ECHILD) {
 		char errmsg[BUFSIZ];
-		sprintf(errmsg, "Warning: waitpid() returned %d", pid);
+		snprintf(errmsg, BUFSIZ, "Warning: waitpid() returned %d", pid);
 		perror(errmsg);
 	}
 #endif