changeset 5221:abe4d103e300

[gaim-migrate @ 5591] debug_printf -> gaim_debug committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sat, 26 Apr 2003 08:58:31 +0000
parents 7b9d78fa051e
children 03bbfe329223
files src/protocols/irc/irc.c src/protocols/msn/ft.c src/protocols/msn/msg.c src/protocols/msn/msn.c src/protocols/msn/switchboard.c
diffstat 5 files changed, 41 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/irc/irc.c	Sat Apr 26 08:50:50 2003 +0000
+++ b/src/protocols/irc/irc.c	Sat Apr 26 08:58:31 2003 +0000
@@ -161,7 +161,7 @@
 static int 
 irc_write(int fd, char *data, int len)
 {
-	debug_printf("IRC C: %s", data);
+	gaim_debug(GAIM_DEBUG_MISC, "irc", "C: %s", data);
 	return write(fd, data, len);
 }
 
@@ -175,8 +175,9 @@
 	
 	conv = g_iconv_open(gc->account->proto_opt[USEROPT_CHARSET], "UTF-8");
 	if (g_iconv(conv, &inptr, &inleft, &outptr, &outleft) == -1) {
-		debug_printf("IRC charset conversion error\n");
-		debug_printf("Sending as UTF-8 (this is a hack!)\n");
+		gaim_debug(GAIM_DEBUG_ERROR, "irc", "Charset conversion error\n");
+		gaim_debug(GAIM_DEBUG_ERROR, "irc",
+				   "Sending as UTF-8 (this is a hack!)\n");
 		g_free(converted);
 		*done = maxlen;
 		return(g_strndup(string, maxlen));
@@ -196,7 +197,8 @@
 	utf8 = g_convert(string, strlen(string), "UTF-8",
 			 gc->account->proto_opt[USEROPT_CHARSET], NULL, NULL, &err);
 	if (err) {
-		debug_printf("IRC recv conversion error: %s\n", err->message);
+		gaim_debug(GAIM_DEBUG_ERROR, "irc",
+				   "recv conversion error: %s\n", err->message);
 		utf8 = g_strdup(_("(There was an error converting this message.  Check the 'Encoding' option in the Account Editor)"));
 	}
 	
@@ -482,7 +484,7 @@
 	gchar buf[128];
 	int n = 0;
 	struct gaim_conversation *convo;
-	debug_printf("THIS IS TOO MUCH EFFORT\n");
+	gaim_debug(GAIM_DEBUG_MISC, "irc", "THIS IS TOO MUCH EFFORT\n");
 	n = read (chat->fd, buffer, IRC_BUF_LEN);
 	if (n > 0) {
 
@@ -491,7 +493,8 @@
 
 		/* Convert to HTML */
 		if (strlen(buffer)) {
-			debug_printf ("DCC Message from: %s\n", chat->nick);
+			gaim_debug(GAIM_DEBUG_INFO, "irc",
+					   "DCC Message from: %s\n", chat->nick);
 			irc_got_im(chat->gc, chat->nick, buffer, 0, 
 				   time(NULL));
 		}
@@ -553,7 +556,8 @@
 		    _("DCC Chat with %s established"),
 		    chat->nick);
 	gaim_conversation_write(convo, NULL, buf, -1, WFLAG_SYSTEM, time(NULL));
-	debug_printf ("Chat with %s established\n", chat->nick);
+	gaim_debug(GAIM_DEBUG_INFO, "irc",
+			   "Chat with %s established\n", chat->nick);
 	dcc_chat_list =  g_slist_append (dcc_chat_list, chat);
 	gaim_input_remove(chat->inpa);
 	chat->inpa = gaim_input_add(source, GAIM_INPUT_READ, dcc_chat_in, chat);
@@ -1818,7 +1822,7 @@
 		len = e - idata->rxqueue + 1;
 		d = g_strndup(idata->rxqueue, len);
 		g_strchomp(d);
-		debug_printf("IRC S: %s\n", d);
+		gaim_debug(GAIM_DEBUG_MISC, "irc", "S: %s\n", d);
 
 		/* REMOVE ME BEFORE SUBMIT! */
 		/*fprintf(stderr, "IRC S: %s\n", d);*/
@@ -1870,7 +1874,8 @@
 	test = g_convert("test", strlen("test"), gc->account->proto_opt[USEROPT_CHARSET],
 			 "UTF-8", NULL, NULL, &err);
 	if (err) {
-		debug_printf("Couldn't initialize %s for IRC charset conversion, using ISO-8859-1\n",
+		gaim_debug(GAIM_DEBUG_ERROR, "irc",
+				   "Couldn't initialize %s for IRC charset conversion, using ISO-8859-1\n",
 			     gc->account->proto_opt[USEROPT_CHARSET]);
 		strcpy(gc->account->proto_opt[USEROPT_CHARSET], "ISO-8859-1");
 	}
@@ -2607,7 +2612,8 @@
 	g_snprintf (buf, sizeof buf, _("DCC Chat with %s established"),
 				chat->nick);
 	gaim_conversation_write(convo, NULL, buf, -1, WFLAG_SYSTEM, time(NULL));
-	debug_printf ("Chat with %s established\n", chat->nick);
+	gaim_debug(GAIM_DEBUG_INFO, "irc",
+			   "Chat with %s established\n", chat->nick);
 	dcc_chat_list = g_slist_append (dcc_chat_list, chat);
 }
 #if 0
--- a/src/protocols/msn/ft.c	Sat Apr 26 08:50:50 2003 +0000
+++ b/src/protocols/msn/ft.c	Sat Apr 26 08:58:31 2003 +0000
@@ -198,8 +198,9 @@
 	}
 
 	if (header[0] != 0) {
-		debug_printf("MSNFTP: Invalid header[0]: %d. Aborting.\n",
-					 header[0]);
+		gaim_debug(GAIM_DEBUG_ERROR, "msn",
+				   "MSNFTP: Invalid header[0]: %d. Aborting.\n",
+				   header[0]);
 		return 0;
 	}
 
@@ -376,7 +377,8 @@
 	xfer_data = (struct msn_xfer_data *)xfer->data;
 
 	if (source == -1 || !g_slist_find(connections, account->gc)) {
-		debug_printf("MSNFTP: Error establishing connection\n");
+		gaim_debug(GAIM_DEBUG_ERROR, "msn",
+				   "MSNFTP: Error establishing connection\n");
 		close(source);
 
 		gaim_xfer_cancel_remote(xfer);
@@ -493,8 +495,9 @@
 
 			if (xfer == NULL)
 			{
-				debug_printf("MSNFTP : Cookie not found. "
-							 "File transfer aborted.\n");
+				gaim_debug(GAIM_DEBUG_ERROR, "msn",
+						   "MSNFTP : Cookie not found. "
+						   "File transfer aborted.\n");
 				return;
 			}
 
--- a/src/protocols/msn/msg.c	Sat Apr 26 08:50:50 2003 +0000
+++ b/src/protocols/msn/msg.c	Sat Apr 26 08:58:31 2003 +0000
@@ -25,7 +25,7 @@
 int
 msn_write(int fd, void *data, int len)
 {
-	debug_printf("MSN C: %s", (char *)data);
+	gaim_debug(GAIM_DEBUG_MISC, "msn", "C: %s", (char *)data);
 
 	return write(fd, data, len);
 }
--- a/src/protocols/msn/msn.c	Sat Apr 26 08:50:50 2003 +0000
+++ b/src/protocols/msn/msn.c	Sat Apr 26 08:58:31 2003 +0000
@@ -412,7 +412,6 @@
 			signoff(gc);
 		}
 
-		debug_printf("\n");
 	} else if (!g_ascii_strncasecmp(buf, "FLN", 3)) {
 		char *usr = buf;
 
@@ -484,7 +483,8 @@
 		} else if (!g_ascii_strcasecmp(which, "AL") && pos) {
 			if (g_slist_find_custom(gc->account->deny, who,
 							(GCompareFunc)strcmp)) {
-				debug_printf("moving from deny to permit: %s", who);
+				gaim_debug(GAIM_DEBUG_INFO, "msn",
+						   "moving from deny to permit: %s", who);
 				gaim_privacy_deny_remove(gc->account, who);
 			}
 			gaim_privacy_permit_add(gc->account, who);
@@ -503,7 +503,8 @@
 			  denyl = denyl->next;
 			}
 			if(new) {
-				debug_printf("Unresolved MSN RL entry\n");
+				gaim_debug(GAIM_DEBUG_INFO, "msn",
+						   "Unresolved MSN RL entry\n");
 				ap = g_new0(struct msn_add_permit, 1);
 				ap->user = g_strdup(who);
 				ap->friend = g_strdup(friend);
@@ -695,7 +696,8 @@
 		}
 
 		if( (fd = gaim_mkstemp(&(md->passport))) == NULL ) {
-		  debug_printf("Error opening temp file: %s\n", strerror(errno)); 
+		  gaim_debug(GAIM_DEBUG_ERROR, "msn",
+					 "Error opening temp file: %s\n", strerror(errno)); 
 		}
 		else {
 			fputs("<html>\n"
@@ -722,7 +724,8 @@
 			fprintf(fd, "</form></body>\n");
 			fprintf(fd, "</html>\n");
 			if (fclose(fd)) {
-				debug_printf("Error closing temp file: %s\n", strerror(errno)); 
+				gaim_debug(GAIM_DEBUG_ERROR, "msn",
+						   "Error closing temp file: %s\n", strerror(errno)); 
 				unlink(md->passport);
 				g_free(md->passport);
 			}
@@ -798,7 +801,7 @@
 	} else if (isdigit(*buf)) {
 		handle_errcode(buf, TRUE);
 	} else {
-		debug_printf("Unhandled message!\n");
+		gaim_debug(GAIM_DEBUG_WARNING, "msn", "Unhandled message!\n");
 	}
 
 	return 1;
@@ -932,7 +935,7 @@
 			}
 			cmd[cmdlen] = 0;
 
-			debug_printf("MSN S: %s", cmd);
+			gaim_debug(GAIM_DEBUG_MISC, "msn", "S: %s", cmd);
 			g_strchomp(cmd);
 			cont = msn_process_main(gc, cmd);
 
@@ -1149,7 +1152,7 @@
 		}
 		cmd[cmdlen] = 0;
 
-		debug_printf("MSN S: %s", cmd);
+		gaim_debug(GAIM_DEBUG_MISC, "msn", "S: %s", cmd);
 		g_strchomp(cmd);
 		cont = msn_process_login(gc, cmd);
 
@@ -1263,7 +1266,7 @@
 		char *send;
 
 		if (ms->txqueue) {
-			debug_printf("appending to queue\n");
+			gaim_debug(GAIM_DEBUG_INFO, "msn", "appending to queue\n");
 			ms->txqueue = g_slist_append(ms->txqueue, g_strdup(message));
 			return 1;
 		}
@@ -1275,7 +1278,6 @@
 		g_free(send);
 		if (msn_write(ms->fd, buf, strlen(buf)) < 0)
 			msn_kill_switch(ms);
-		debug_printf("\n");
 	} else if (strcmp(who, gc->username)) {
 		g_snprintf(buf, MSN_BUF_LEN, "XFR %u SB\r\n", ++md->trId);
 		if (msn_write(md->fd, buf, strlen(buf)) < 0) {
@@ -1314,7 +1316,6 @@
 		msn_kill_switch(ms);
 		return 0;
 	}
-	debug_printf("\n");
 	serv_got_chat_in(gc, id, gc->username, 0, message, time(NULL));
 	return 0;
 }
@@ -1705,7 +1706,7 @@
 	}
 
 	if (g_slist_find_custom(gc->account->deny, who, (GCompareFunc)strcmp)) {
-		debug_printf("MSN: Moving %s from BL to AL\n", who);
+		gaim_debug(GAIM_DEBUG_INFO, "msn", "Moving %s from BL to AL\n", who);
 		gaim_privacy_deny_remove(gc->account, who);
 		g_snprintf(buf, sizeof(buf), "REM %u BL %s\r\n", ++md->trId, who);
 			if (msn_write(md->fd, buf, strlen(buf)) < 0) {
@@ -1759,7 +1760,7 @@
 	}
 
 	if (g_slist_find_custom(gc->account->permit, who, (GCompareFunc)strcmp)) {
-		debug_printf("MSN: Moving %s from AL to BL\n", who);
+		gaim_debug(GAIM_DEBUG_INFO, "msn", "Moving %s from AL to BL\n", who);
 		gaim_privacy_permit_remove(gc->account, who);
 		g_snprintf(buf, sizeof(buf), "REM %u AL %s\r\n", ++md->trId, who);
 		if (msn_write(md->fd, buf, strlen(buf)) < 0) {
--- a/src/protocols/msn/switchboard.c	Sat Apr 26 08:50:50 2003 +0000
+++ b/src/protocols/msn/switchboard.c	Sat Apr 26 08:58:31 2003 +0000
@@ -159,8 +159,6 @@
 				msn_kill_switch(ms);
 				return 0;
 			}
-
-			debug_printf("\n");
 		}
 	} else if (!g_ascii_strncasecmp(buf, "MSG", 3)) {
 		char *user, *tmp = buf;
@@ -206,7 +204,7 @@
 			msn_kill_switch(ms);
 
 	} else {
-		debug_printf("Unhandled message!\n");
+		gaim_debug(GAIM_DEBUG_WARNING, "msn", "Unhandled message!\n");
 	}
 
 	return 1;
@@ -353,7 +351,7 @@
 			}
 			cmd[cmdlen] = 0;
 
-			debug_printf("MSN S: %s", cmd);
+			gaim_debug(GAIM_DEBUG_MISC, "msn", "S: %s", cmd);
 			g_strchomp(cmd);
 			cont = msn_process_switch(ms, cmd);