changeset 5223:e2e5bc3ca705

[gaim-migrate @ 5593] debug_printf -> gaim_debug My last one for the night. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sat, 26 Apr 2003 09:05:51 +0000
parents 03bbfe329223
children 5160333a80df
files src/protocols/jabber/jabber.c
diffstat 1 files changed, 54 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/jabber/jabber.c	Sat Apr 26 08:59:36 2003 +0000
+++ b/src/protocols/jabber/jabber.c	Sat Apr 26 09:05:51 2003 +0000
@@ -569,7 +569,7 @@
 #else
 			send(gjc->fd, buf, strlen(buf), 0);
 #endif
-		debug_printf("gjab_send: %s\n", buf);
+		gaim_debug(GAIM_DEBUG_MISC, "jabber", "gjab_send: %s\n", buf);
 	}
 }
 
@@ -589,7 +589,7 @@
 		}
 		/* printing keepalives to the debug window is really annoying */
 		if(strcmp(str, JABBER_KEEPALIVE_STRING))
-			debug_printf("gjab_send_raw: %s\n", str);
+			gaim_debug(GAIM_DEBUG_MISC, "jabber", "gjab_send_raw: %s\n", str);
 	}
 }
 
@@ -650,7 +650,8 @@
 	xmlnode_insert_cdata(z, gjc->user->resource, -1);
 
 	if (gjc->sid) {
-		debug_printf("digest authentication (sid %s)\n", gjc->sid);
+		gaim_debug(GAIM_DEBUG_MISC, "jabber",
+				   "digest authentication (sid %s)\n", gjc->sid);
 		z = xmlnode_insert_tag(y, "digest");
 		hash = pmalloc(x->p, strlen(gjc->sid) + strlen(gjc->pass) + 1);
 		strcpy(hash, gjc->sid);
@@ -682,7 +683,8 @@
 #endif
 		struct jabber_data *jd = GJ_GC(gjc)->proto_data;
 		buf[len] = '\0';
-		debug_printf("input (len %d): %s\n", len, buf);
+		gaim_debug(GAIM_DEBUG_MISC, "jabber",
+				   "input (len %d): %s\n", len, buf);
 		XML_Parse(gjc->parser, buf, len, 0);
 		if (jd->die)
 			signoff(GJ_GC(gjc));
@@ -971,7 +973,8 @@
 	struct buddy *b;
 
 	if ((b = gaim_find_buddy(gc->account, buddyname)) != NULL) {
-		debug_printf("removing buddy [1]: %s\n", buddyname);
+		gaim_debug(GAIM_DEBUG_INFO, "jabber",
+				   "removing buddy [1]: %s\n", buddyname);
 		gaim_blist_remove_buddy(b);
 		gaim_blist_save();
 	}
@@ -1421,7 +1424,8 @@
 		}
 
 	} else {
-		debug_printf("unhandled message %s\n", type);
+		gaim_debug(GAIM_DEBUG_WARNING, "jabber",
+				   "unhandled message %s\n", type);
 	}
 }
 
@@ -1765,7 +1769,8 @@
 				g = gaim_group_new(_("Buddies"));
 				gaim_blist_add_group(g, NULL);
 			}
-			debug_printf("adding buddy [4]: %s\n", buddyname);
+			gaim_debug(GAIM_DEBUG_INFO, "jabber",
+					   "adding buddy [4]: %s\n", buddyname);
 			gaim_blist_add_buddy(b, g, NULL);
 			gaim_blist_save();
 		} else {
@@ -1846,7 +1851,7 @@
 			}
 			gjab_auth(gjc);
 		} else {
-			debug_printf("auth success\n");
+			gaim_debug(GAIM_DEBUG_INFO, "jabber", "auth success\n");
 
 			account_online(GJ_GC(gjc));
 			serv_finish_login(GJ_GC(gjc));
@@ -1861,7 +1866,7 @@
 		int errcode = 0;
 		struct jabber_data *jd = GJ_GC(gjc)->proto_data;
 
-		debug_printf("auth failed\n");
+		gaim_debug(GAIM_DEBUG_ERROR, "jabber", "auth failed\n");
 		xerr = xmlnode_get_tag(p->x, "error");
 		if (xerr) {
 			char msg[BUF_LONG];
@@ -2156,7 +2161,8 @@
 		jabber_handlepresence(gjc, p);
 		break;
 	case JPACKET_IQ:
-		debug_printf("jpacket_subtype: %d\n", jpacket_subtype(p));
+		gaim_debug(GAIM_DEBUG_MISC, "jabber",
+				   "jpacket_subtype: %d\n", jpacket_subtype(p));
 
 		id = xmlnode_get_attrib(p->x, "id");
 		if (id != NULL && !strcmp(id, IQID_AUTH)) {
@@ -2204,11 +2210,13 @@
 				jabber_track_queries(gjc->queries, id, TRUE);	/* delete query track */
 				jabber_handlevcard(gjc, vcard, from);
 			} else if((xmlns = xmlnode_get_attrib(querynode, "xmlns")) != NULL) {
-				debug_printf("jabber:iq:query: %s\n", xmlns);
+				gaim_debug(GAIM_DEBUG_MISC, "jabber",
+						   "jabber:iq:query: %s\n", xmlns);
 			} else {
 				char *val;
 
-				debug_printf("jabber:iq: %s\n", xmlnode2str(p->x));
+				gaim_debug(GAIM_DEBUG_MISC, "jabber",
+						   "jabber:iq: %s\n", xmlnode2str(p->x));
 
 				/* handle "null" query results */
 				if((val = jabber_track_queries(gjc->queries, id, TRUE)) != NULL) {
@@ -2251,7 +2259,8 @@
 		jabber_handles10n(gjc, p);
 		break;
 	default:
-		debug_printf("jabber: packet type %d (%s)\n", p->type, xmlnode2str(p->x));
+		gaim_debug(GAIM_DEBUG_MISC, "jabber",
+				   "jabber: packet type %d (%s)\n", p->type, xmlnode2str(p->x));
 	}
 
 	xmlnode_free(p->x);
@@ -2279,7 +2288,7 @@
 		gjab_reqauth(gjc);
 		break;
 	default:
-		debug_printf("state change: %d\n", state);
+		gaim_debug(GAIM_DEBUG_MISC, "jabber", "state change: %d\n", state);
 	}
 	return;
 }
@@ -2299,7 +2308,8 @@
 
 	if (!(jd->gjc = gjab_new(loginname, account->password, gc))) {
 		g_free(loginname);
-		debug_printf("jabber: unable to connect (jab_new failed)\n");
+		gaim_debug(GAIM_DEBUG_ERROR, "jabber",
+				   "unable to connect (jab_new failed)\n");
 		hide_login_progress(gc, _("Unable to connect"));
 		signoff(gc);
 		return;
@@ -2438,8 +2448,10 @@
 			xmlnode_insert_tag_node(x, y);
 			xmlnode_free(y);
 		} else {
-			debug_printf("holy cow, html_to_xhtml didn't work right!\n");
-			debug_printf("the invalid XML: %s\n", xhtml);
+			gaim_debug(GAIM_DEBUG_ERROR, "jabber",
+					   "holy cow, html_to_xhtml didn't work right!\n");
+			gaim_debug(GAIM_DEBUG_ERROR, "jabber",
+					   "the invalid XML: %s\n", xhtml);
 		}
 	}
 	g_free(xhtml);
@@ -2910,7 +2922,7 @@
 		return;
 
 	realwho = create_valid_jid(data->data, data->next->data, data->next->next->data);
-	debug_printf("%s\n", realwho);
+	gaim_debug(GAIM_DEBUG_INFO, "%s\n", realwho);
 
 	if((gjid = gaim_jid_new(realwho)) == NULL) {
 		char *msg = g_strdup_printf("The Jabber I.D. %s is invalid.", realwho);
@@ -2923,26 +2935,31 @@
 	if((jc = find_any_chat(gc, gjid)) != NULL) {
 		switch(jc->state) {
 			case JCS_PENDING:
-				debug_printf("attempt to re-join already pending Jabber chat! (ignoring)\n");
+				gaim_debug(GAIM_DEBUG_INFO, "jabber",
+						   "attempt to re-join already pending Jabber chat! (ignoring)\n");
 				g_free(realwho);	/* yuck! */
 				gaim_jid_free(gjid);
 				return;
 			case JCS_ACTIVE:
-				debug_printf("attempt to re-join already active Jabber chat! (ignoring)\n");
+				gaim_debug(GAIM_DEBUG_INFO, "jabber",
+						   "attempt to re-join already active Jabber chat! (ignoring)\n");
 				g_free(realwho);	/* yuck! */
 				gaim_jid_free(gjid);
 				return;
 			case JCS_CLOSED:
-				debug_printf("rejoining previously closed Jabber chat\n");
+				gaim_debug(GAIM_DEBUG_INFO, "jabber",
+						   "rejoining previously closed Jabber chat\n");
 				break;
 			default:
-				debug_printf("found Jabber chat in unknown state! (ignoring)\n");
+				gaim_debug(GAIM_DEBUG_INFO, "jabber",
+						   "found Jabber chat in unknown state! (ignoring)\n");
 				g_free(realwho);	/* yuck! */
 				gaim_jid_free(gjid);
 				return;
 		}
 	} else {
-		debug_printf("joining completely new Jabber chat\n");
+		gaim_debug(GAIM_DEBUG_INFO, "jabber",
+				   "joining completely new Jabber chat\n");
 		jc = g_new0(struct jabber_chat, 1);
 		jc->gjid = gjid;
 		jc->gc = gc;
@@ -3451,7 +3468,8 @@
 
 static void jabber_set_idle(struct gaim_connection *gc, int idle) {
 	struct jabber_data *jd = (struct jabber_data *)gc->proto_data;
-	debug_printf("jabber_set_idle: setting idle %i\n", idle);
+	gaim_debug(GAIM_DEBUG_INFO, "jabber",
+			   "jabber_set_idle: setting idle %i\n", idle);
 	jd->idle = idle ? time(NULL) - idle : idle;
 }
 
@@ -3854,7 +3872,8 @@
 		if (xmlnode_get_name(vc_node) &&
 				!g_ascii_strncasecmp(xmlnode_get_name(vc_node), "vcard", 5)) {
 			xmlnode_insert_tag_node(x, vc_node);
-			debug_printf("jabber: vCard packet: %s\n", xmlnode2str(x));
+			gaim_debug(GAIM_DEBUG_MISC, "jabber",
+					   "jabber: vCard packet: %s\n", xmlnode2str(x));
 			gjab_send(gjc, x);
 		}
 		xmlnode_free(vc_node);
@@ -4061,7 +4080,8 @@
 				char *tag;
 				xmlnode child = xmlnode_get_firstchild(querynode);
 
-				debug_printf("got registration requirments response!\n");
+				gaim_debug(GAIM_DEBUG_INFO, "jabber",
+						   "got registration requirments response!\n");
 
 				while(child != NULL) {
 					if((tag = xmlnode_get_name(child)) != NULL) {
@@ -4079,7 +4099,8 @@
 				}
 			}
 		} else {
-			debug_printf("registration successful!\n");
+			gaim_debug(GAIM_DEBUG_INFO, "jabber",
+					   "registration successful!\n");
 
 			hide_login_progress_notice(GJ_GC(gjc), _("Server Registration successful!"));
 			/*
@@ -4096,7 +4117,7 @@
 		int errcode = 0;
 		struct jabber_data *jd = GJ_GC(gjc)->proto_data;
 
-		debug_printf("registration failed\n");
+		gaim_debug(GAIM_DEBUG_ERROR, "jabber", "registration failed\n");
 		xerr = xmlnode_get_tag(p->x, "error");
 		if (xerr) {
 			char msg[BUF_LONG];
@@ -4138,7 +4159,8 @@
 	z = xmlnode_insert_tag(y, "password");
 	xmlnode_insert_cdata(z, gjc->pass, -1);
 
-	debug_printf("jabber: registration packet: %s\n", xmlnode2str(x));
+	gaim_debug(GAIM_DEBUG_MISC, "jabber",
+			   "jabber: registration packet: %s\n", xmlnode2str(x));
 	gjab_send(gjc, x);
 	xmlnode_free(x);
 }
@@ -4176,7 +4198,7 @@
 		 */
 		break;
 	default:
-		debug_printf("state change: %d\n", state);
+		gaim_debug(GAIM_DEBUG_MISC, "jabber", "state change: %d\n", state);
 	}
 	return;
 }
@@ -4198,7 +4220,8 @@
 
 	if ((jd->gjc = gjab_new(loginname, account->password, gc)) == NULL) {
 		g_free(loginname);
-		debug_printf("jabber: unable to connect (jab_new failed)\n");
+		gaim_debug(GAIM_DEBUG_ERROR, "jabber",
+				   "unable to connect (jab_new failed)\n");
 		hide_login_progress(gc, _("Unable to connect"));
 		signoff(gc);
 	} else {