changeset 11253:7d31d61e6438

[gaim-migrate @ 13422] Get rid of faimdprintf and use gaim_debug functions instead committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 13 Aug 2005 06:43:45 +0000
parents 55356a29cdd1
children ce3b9969b399
files src/protocols/oscar/aim.h src/protocols/oscar/aim_internal.h src/protocols/oscar/buddylist.c src/protocols/oscar/chat.c src/protocols/oscar/chatnav.c src/protocols/oscar/conn.c src/protocols/oscar/ft.c src/protocols/oscar/icq.c src/protocols/oscar/im.c src/protocols/oscar/locate.c src/protocols/oscar/msgcookie.c src/protocols/oscar/oscar.c src/protocols/oscar/rxhandlers.c src/protocols/oscar/rxqueue.c src/protocols/oscar/search.c src/protocols/oscar/service.c src/protocols/oscar/txqueue.c src/protocols/oscar/util.c
diffstat 18 files changed, 100 insertions(+), 208 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/oscar/aim.h	Sat Aug 13 06:04:30 2005 +0000
+++ b/src/protocols/oscar/aim.h	Sat Aug 13 06:43:45 2005 +0000
@@ -12,6 +12,7 @@
 #include "faimconfig.h"
 #include "aim_cbtypes.h"
 
+#include "debug.h"
 #include "internal.h"
 
 #include <stdio.h>
@@ -434,9 +435,6 @@
 
 	fu8_t nonblocking;
 
-	int debug;
-	void (*debugcb)(struct aim_session_s *sess, int level, const char *format, va_list va); /* same as faim_debugging_callback_t */
-
 	/*
 	 * Outstanding snac handling
 	 *
@@ -581,9 +579,7 @@
 faim_export int aim_conn_completeconnect(aim_session_t *sess, aim_conn_t *conn);
 faim_export int aim_conn_isconnecting(aim_conn_t *conn);
 
-typedef void (*faim_debugging_callback_t)(aim_session_t *sess, int level, const char *format, va_list va);
-faim_export int aim_setdebuggingcb(aim_session_t *sess, faim_debugging_callback_t);
-faim_export void aim_session_init(aim_session_t *, fu8_t nonblocking, int debuglevel);
+faim_export void aim_session_init(aim_session_t *, fu8_t nonblocking);
 faim_export void aim_session_kill(aim_session_t *);
 faim_export aim_conn_t *aim_getconn_type(aim_session_t *, int type);
 faim_export aim_conn_t *aim_getconn_type_all(aim_session_t *, int type);
--- a/src/protocols/oscar/aim_internal.h	Sat Aug 13 06:04:30 2005 +0000
+++ b/src/protocols/oscar/aim_internal.h	Sat Aug 13 06:43:45 2005 +0000
@@ -175,9 +175,9 @@
 /*
  * This is inside every connection.  But it is a void * to anything
  * outside of libfaim.  It should remain that way.  It's called data
- * abstraction.  Maybe you've heard of it.  (Probably not if you're a 
+ * abstraction.  Maybe you've heard of it.  (Probably not if you're a
  * libfaim user.)
- * 
+ *
  */
 typedef struct aim_conn_inside_s {
 	struct snacgroup *groups;
@@ -213,7 +213,5 @@
 faim_internal int aim_rates_addparam(aim_session_t *, aim_conn_t *);
 faim_internal int aim_rates_delparam(aim_session_t *, aim_conn_t *);
 
-faim_internal void faimdprintf(aim_session_t *sess, int dlevel, const char *format, ...);
-
 #endif /* __AIM_INTERNAL_H__ */
 #endif /* FAIM_INTERNAL */
--- a/src/protocols/oscar/buddylist.c	Sat Aug 13 06:04:30 2005 +0000
+++ b/src/protocols/oscar/buddylist.c	Sat Aug 13 06:43:45 2005 +0000
@@ -117,7 +117,7 @@
 		return -EINVAL;
 
 	for (tmpptr = strtok(localcpy, "&"); tmpptr; ) {
-		faimdprintf(sess, 2, "---adding: %s (%d)\n", tmpptr, strlen(tmpptr));
+		gaim_debug_misc("oscar", "---adding: %s (%d)\n", tmpptr, strlen(tmpptr));
 		len += 1 + strlen(tmpptr);
 		tmpptr = strtok(NULL, "&");
 	}
@@ -132,7 +132,7 @@
 
 	for (tmpptr = strtok(localcpy, "&"); tmpptr; ) {
 
-		faimdprintf(sess, 2, "---adding: %s (%d)\n", tmpptr, strlen(tmpptr));
+		gaim_debug_misc("oscar", "---adding: %s (%d)\n", tmpptr, strlen(tmpptr));
 
 		aimbs_put8(&fr->data, strlen(tmpptr));
 		aimbs_putstr(&fr->data, tmpptr);
--- a/src/protocols/oscar/chat.c	Sat Aug 13 06:04:30 2005 +0000
+++ b/src/protocols/oscar/chat.c	Sat Aug 13 06:43:45 2005 +0000
@@ -52,7 +52,7 @@
 		if (cur->type != AIM_CONN_TYPE_CHAT)
 			continue;
 		if (!cur->internal) {
-			faimdprintf(sess, 0, "faim: chat: chat connection with no name! (fd = %d)\n", cur->fd);
+			gaim_debug_misc("oscar", "faim: chat: chat connection with no name! (fd = %d)\n", cur->fd);
 			continue;
 		}
 
@@ -142,7 +142,7 @@
 	detaillevel = aimbs_get8(bs);
 
 	if (detaillevel != 0x02) {
-		faimdprintf(sess, 0, "faim: chat_roomupdateinfo: detail level %d not supported\n", detaillevel);
+		gaim_debug_misc("oscar", "faim: chat_roomupdateinfo: detail level %d not supported\n", detaillevel);
 		return 1;
 	}
 
@@ -469,7 +469,7 @@
 	channel = aimbs_get16(bs);
 
 	if (channel != 0x0003) {
-		faimdprintf(sess, 0, "faim: chat_incoming: unknown channel! (0x%04x)\n", channel);
+		gaim_debug_misc("oscar", "faim: chat_incoming: unknown channel! (0x%04x)\n", channel);
 		return 0;
 	}
 
--- a/src/protocols/oscar/chatnav.c	Sat Aug 13 06:04:30 2005 +0000
+++ b/src/protocols/oscar/chatnav.c	Sat Aug 13 06:43:45 2005 +0000
@@ -120,7 +120,7 @@
 		exchanges[curexchange-1].number = aimbs_get16(&tbs);
 		innerlist = aim_tlvlist_read(&tbs);
 
-		/* 
+		/*
 		 * Type 0x000a: Unknown.
 		 *
 		 * Usually three bytes: 0x0114 (exchange 1) or 0x010f (others).
@@ -129,27 +129,27 @@
 		if (aim_tlv_gettlv(innerlist, 0x000a, 1))
 			;
 
-		/* 
+		/*
 		 * Type 0x000d: Unknown.
 		 */
 		if (aim_tlv_gettlv(innerlist, 0x000d, 1))
 			;
 
-		/* 
+		/*
 		 * Type 0x0004: Unknown
 		 */
 		if (aim_tlv_gettlv(innerlist, 0x0004, 1))
 			;
 
-		/* 
+		/*
 		 * Type 0x0002: Unknown
 		 */
 		if (aim_tlv_gettlv(innerlist, 0x0002, 1)) {
 			fu16_t classperms;
 
 			classperms = aim_tlv_get16(innerlist, 0x0002, 1);
-			
-			faimdprintf(sess, 1, "faim: class permissions %x\n", classperms);
+
+			gaim_debug_misc("oscar", "faim: class permissions %x\n", classperms);
 		}
 
 		/*
@@ -160,16 +160,16 @@
 		 * 4 Instancing Allowed
 		 * 8 Occupant Peek Allowed
 		 *
-		 */ 
+		 */
 		if (aim_tlv_gettlv(innerlist, 0x00c9, 1))
 			exchanges[curexchange-1].flags = aim_tlv_get16(innerlist, 0x00c9, 1);
-		      
+
 		/*
-		 * Type 0x00ca: Creation Date 
+		 * Type 0x00ca: Creation Date
 		 */
 		if (aim_tlv_gettlv(innerlist, 0x00ca, 1))
 			;
-		      
+
 		/*
 		 * Type 0x00d0: Mandatory Channels?
 		 */
@@ -292,7 +292,7 @@
 	tlvlist = aim_tlvlist_read(bs);
 
 	if (!(bigblock = aim_tlv_gettlv(tlvlist, 0x0004, 1))) {
-		faimdprintf(sess, 0, "no bigblock in top tlv in create room response\n");
+		gaim_debug_misc("oscar", "no bigblock in top tlv in create room response\n");
 		aim_tlvlist_free(&tlvlist);
 		return 0;
 	}
@@ -306,7 +306,7 @@
 	detaillevel = aimbs_get8(&bbbs);
 
 	if (detaillevel != 0x02) {
-		faimdprintf(sess, 0, "unknown detaillevel in create room response (0x%02x)\n", detaillevel);
+		gaim_debug_misc("oscar", "unknown detaillevel in create room response (0x%02x)\n", detaillevel);
 		aim_tlvlist_free(&tlvlist);
 		free(ck);
 		return 0;
@@ -374,12 +374,12 @@
 	int ret = 0;
 
 	if (!(snac2 = aim_remsnac(sess, snac->id))) {
-		faimdprintf(sess, 0, "faim: chatnav_parse_info: received response to unknown request! (%08lx)\n", snac->id);
+		gaim_debug_misc("oscar", "faim: chatnav_parse_info: received response to unknown request! (%08lx)\n", snac->id);
 		return 0;
 	}
 
 	if (snac2->family != 0x000d) {
-		faimdprintf(sess, 0, "faim: chatnav_parse_info: recieved response that maps to corrupt request! (fam=%04x)\n", snac2->family);
+		gaim_debug_misc("oscar", "faim: chatnav_parse_info: recieved response that maps to corrupt request! (fam=%04x)\n", snac2->family);
 		return 0;
 	}
 
@@ -389,19 +389,19 @@
 	if (snac2->type == 0x0002) /* request chat rights */
 		ret = parseinfo_perms(sess, mod, rx, snac, bs, snac2);
 	else if (snac2->type == 0x0003) /* request exchange info */
-		faimdprintf(sess, 0, "chatnav_parse_info: resposne to exchange info\n");
+		gaim_debug_misc("oscar", "chatnav_parse_info: resposne to exchange info\n");
 	else if (snac2->type == 0x0004) /* request room info */
-		faimdprintf(sess, 0, "chatnav_parse_info: response to room info\n");
+		gaim_debug_misc("oscar", "chatnav_parse_info: response to room info\n");
 	else if (snac2->type == 0x0005) /* request more room info */
-		faimdprintf(sess, 0, "chatnav_parse_info: response to more room info\n");
+		gaim_debug_misc("oscar", "chatnav_parse_info: response to more room info\n");
 	else if (snac2->type == 0x0006) /* request occupant list */
-		faimdprintf(sess, 0, "chatnav_parse_info: response to occupant info\n");
+		gaim_debug_misc("oscar", "chatnav_parse_info: response to occupant info\n");
 	else if (snac2->type == 0x0007) /* search for a room */
-		faimdprintf(sess, 0, "chatnav_parse_info: search results\n");
+		gaim_debug_misc("oscar", "chatnav_parse_info: search results\n");
 	else if (snac2->type == 0x0008) /* create room */
 		ret = parseinfo_create(sess, mod, rx, snac, bs, snac2);
 	else
-		faimdprintf(sess, 0, "chatnav_parse_info: unknown request subtype (%04x)\n", snac2->type);
+		gaim_debug_misc("oscar", "chatnav_parse_info: unknown request subtype (%04x)\n", snac2->type);
 
 	if (snac2)
 		free(snac2->data);
--- a/src/protocols/oscar/conn.c	Sat Aug 13 06:04:30 2005 +0000
+++ b/src/protocols/oscar/conn.c	Sat Aug 13 06:43:45 2005 +0000
@@ -82,7 +82,7 @@
 	if (!(sg = malloc(sizeof(struct snacgroup))))
 		return;
 
-	faimdprintf(aim_conn_getsess(conn), 1, "adding group 0x%04x\n", group);
+	gaim_debug_misc("oscar", "adding group 0x%04x\n", group);
 	sg->group = group;
 
 	sg->next = ins->groups;
@@ -508,23 +508,14 @@
 	return 0;
 }
 
-static void defaultdebugcb(aim_session_t *sess, int level, const char *format, va_list va)
-{
-
-	vfprintf(stderr, format, va);
-
-	return;
-}
-
 /**
- * Initializes a session structure by setting the initial values 
+ * Initializes a session structure by setting the initial values
  * stuff in the aim_session_t struct.
  *
  * @param sess Session to initialize.
  * @param nonblocking Set to true if you want connections to be non-blocking.
- * @param debuglevel Level of debugging output (zero is least).
  */
-faim_export void aim_session_init(aim_session_t *sess, fu8_t nonblocking, int debuglevel)
+faim_export void aim_session_init(aim_session_t *sess, fu8_t nonblocking)
 {
 
 	if (!sess)
@@ -537,8 +528,6 @@
 	aim_initsnachash(sess);
 	sess->msgcookies = NULL;
 	sess->nonblocking = nonblocking;
-	sess->debug = debuglevel;
-	sess->debugcb = defaultdebugcb;
 	sess->modlistv = NULL;
 	sess->snacid_next = 0x00000001;
 
@@ -612,28 +601,6 @@
 }
 
 /**
- * Set the function to call when outputting debugging info.
- *
- * The function specified is called whenever faimdprintf() is used within
- * libfaim, and the session's debugging level is greater tha nor equal to
- * the value faimdprintf was called with.
- *
- * @param sess Session to change.
- * @param cb Function to call.
- * @return Returns -1 if the session does not exist, zero otherwise.
- */
-faim_export int aim_setdebuggingcb(aim_session_t *sess, faim_debugging_callback_t cb)
-{
-
-	if (!sess)
-		return -1;
-
-	sess->debugcb = cb;
-
-	return 0;
-}
-
-/**
  * Determine if a connection is connecting.
  *
  * @param conn Connection to examine.
--- a/src/protocols/oscar/ft.c	Sat Aug 13 06:04:30 2005 +0000
+++ b/src/protocols/oscar/ft.c	Sat Aug 13 06:43:45 2005 +0000
@@ -231,7 +231,7 @@
 			ret = userfunc(sess, NULL, newconn, cur);
 
 	} else {
-		faimdprintf(sess, 1,"Got a connection on a listener that's not rendezvous.  Closing connection.\n");
+		gaim_debug_warning("oscar", "Got a connection on a listener that's not rendezvous.  Closing connection.\n");
 		aim_conn_close(newconn);
 		ret = -1;
 	}
@@ -603,7 +603,7 @@
 	/* XXX - create an aimbs_getnullstr function? */
 	snptr = aimbs_getstr(bs, 32); /* Next 32 bytes contain the sn, padded with null chars */
 
-	faimdprintf(sess, 2, "faim: OFT frame: handlehdr_odc: %04x / %04x / %s\n", payloadlength, flags, snptr);
+	gaim_debug_misc("oscar", "faim: OFT frame: handlehdr_odc: %04x / %04x / %s\n", payloadlength, flags, snptr);
 
 	if (flags & 0x0008) {
 		if ((userfunc = aim_callhandler(sess, conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING)))
@@ -919,7 +919,7 @@
 		if (fr->hdr.rend.type == 0x0001)
 			ret = handlehdr_odc(sess, conn, fr, &fr->data);
 		else
-			faimdprintf(sess, 0, "faim: ODC directim frame unknown, type is %04x\n", fr->hdr.rend.type);
+			gaim_debug_info("oscar", "ODC directim frame unknown, type is %04x\n", fr->hdr.rend.type);
 
 	} else {
 		aim_rxcallback_t userfunc;
--- a/src/protocols/oscar/icq.c	Sat Aug 13 06:04:30 2005 +0000
+++ b/src/protocols/oscar/icq.c	Sat Aug 13 06:43:45 2005 +0000
@@ -516,7 +516,7 @@
 
 	if (!(tl = aim_tlvlist_read(bs)) || !(datatlv = aim_tlv_gettlv(tl, 0x0001, 1))) {
 		aim_tlvlist_free(&tl);
-		faimdprintf(sess, 0, "corrupt ICQ response\n");
+		gaim_debug_misc("oscar", "corrupt ICQ response\n");
 		return 0;
 	}
 
@@ -527,7 +527,7 @@
 	cmd = aimbs_getle16(&qbs);
 	reqid = aimbs_getle16(&qbs);
 
-	faimdprintf(sess, 1, "icq response: %d bytes, %ld, 0x%04x, 0x%04x\n", cmdlen, ouruin, cmd, reqid);
+	gaim_debug_misc("oscar", "icq response: %d bytes, %ld, 0x%04x, 0x%04x\n", cmdlen, ouruin, cmd, reqid);
 
 	if (cmd == 0x0041) { /* offline message */
 		struct aim_icq_offlinemsg msg;
--- a/src/protocols/oscar/im.c	Sat Aug 13 06:04:30 2005 +0000
+++ b/src/protocols/oscar/im.c	Sat Aug 13 06:43:45 2005 +0000
@@ -1111,7 +1111,7 @@
 	channel = aimbs_get16(bs);
 
 	if (channel != 0x01) {
-		faimdprintf(sess, 0, "icbm: ICBM recieved on unsupported channel.  Ignoring. (chan = %04x)\n", channel);
+		gaim_debug_misc("oscar", "icbm: ICBM recieved on unsupported channel.  Ignoring. (chan = %04x)\n", channel);
 		return 0;
 	}
 
@@ -1334,7 +1334,7 @@
 		msglen = aimbs_get16(&mbs);
 		if (msglen > aim_bstream_empty(&mbs))
 		{
-			faimdprintf(sess, 0, "Received an IM containing an invalid message part from %s.  They are probably trying to do something malicious.", userinfo->sn);
+			gaim_debug_misc("oscar", "Received an IM containing an invalid message part from %s.  They are probably trying to do something malicious.", userinfo->sn);
 			break;
 		}
 
@@ -1434,7 +1434,7 @@
 
 		if (length > aim_bstream_empty(bs))
 		{
-			faimdprintf(sess, 0, "Received an IM containing an invalid message part from %s.  They are probably trying to do something malicious.\n", userinfo->sn);
+			gaim_debug_misc("oscar", "Received an IM containing an invalid message part from %s.  They are probably trying to do something malicious.\n", userinfo->sn);
 			break;
 		}
 
@@ -1457,7 +1457,7 @@
 			args.featureslen = aimbs_get16(bs);
 			if (args.featureslen > aim_bstream_empty(bs))
 			{
-				faimdprintf(sess, 0, "Received an IM containing an invalid message part from %s.  They are probably trying to do something malicious.\n", userinfo->sn);
+				gaim_debug_misc("oscar", "Received an IM containing an invalid message part from %s.  They are probably trying to do something malicious.\n", userinfo->sn);
 				break;
 			}
 			if (args.featureslen == 0)
@@ -1523,7 +1523,7 @@
 			args.extdatalen = length;
 			if (args.extdatalen > aim_bstream_empty(bs))
 			{
-				faimdprintf(sess, 0, "Received an IM containing an invalid message part from %s.  They are probably trying to do something malicious.\n", userinfo->sn);
+				gaim_debug_misc("oscar", "Received an IM containing an invalid message part from %s.  They are probably trying to do something malicious.\n", userinfo->sn);
 				break;
 			}
 			if (args.extdatalen == 0)
@@ -1532,7 +1532,7 @@
 				args.extdata = aimbs_getraw(bs, args.extdatalen);
 
 		} else {
-			faimdprintf(sess, 0, "incomingim_ch1: unknown TLV 0x%04x (len %d)\n", type, length);
+			gaim_debug_misc("oscar", "incomingim_ch1: unknown TLV 0x%04x (len %d)\n", type, length);
 		}
 
 		/*
@@ -1595,7 +1595,7 @@
 			bnlen = aimbs_get16(servdata);
 			bn = aimbs_getstr(servdata, bnlen);
 
-			faimdprintf(sess, 0, "got a buddy list from %s: group %s, buddy %s\n", userinfo->sn, gn, bn);
+			gaim_debug_misc("oscar", "got a buddy list from %s: group %s, buddy %s\n", userinfo->sn, gn, bn);
 
 			free(bn);
 		}
@@ -1774,7 +1774,7 @@
 	 */
 	cookie2 = aimbs_getraw(&bbs, 8);
 	if (memcmp(cookie, cookie2, 8) != 0)
-		faimdprintf(sess, 0, "rend: warning cookies don't match!\n");
+		gaim_debug_misc("oscar", "rend: warning cookies don't match!\n");
 	memcpy(args.cookie, cookie2, 8);
 	free(cookie2);
 
@@ -2069,7 +2069,7 @@
 		aim_tlvlist_free(&tlvlist);
 
 	} else {
-		faimdprintf(sess, 0, "icbm: ICBM received on an unsupported channel.  Ignoring.  (chan = %04x)\n", channel);
+		gaim_debug_misc("oscar", "icbm: ICBM received on an unsupported channel.  Ignoring.  (chan = %04x)\n", channel);
 	}
 
 	aim_info_free(&userinfo);
--- a/src/protocols/oscar/locate.c	Sat Aug 13 06:04:30 2005 +0000
+++ b/src/protocols/oscar/locate.c	Sat Aug 13 06:43:45 2005 +0000
@@ -2,7 +2,7 @@
  * Family 0x0002 - Locate.
  *
  * The functions here are responsible for requesting and parsing information-
- * gathering SNACs.  Or something like that.  This family contains the SNACs 
+ * gathering SNACs.  Or something like that.  This family contains the SNACs
  * for getting and setting info, away messages, directory profile thingy, etc.
  */
 
@@ -13,7 +13,7 @@
 #endif
 
 /*
- * Capability blocks. 
+ * Capability blocks.
  *
  * These are CLSIDs. They should actually be of the form:
  *
@@ -400,7 +400,7 @@
 		}
 
 		if (!identified)
-			faimdprintf(sess, 0, "unknown capability: {%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
+			gaim_debug_misc("oscar", "unknown capability: {%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
 					cap[0], cap[1], cap[2], cap[3],
 					cap[4], cap[5],
 					cap[6], cap[7],
@@ -434,7 +434,7 @@
 		}
 
 		if (!identified)
-			faimdprintf(sess, 0, "unknown short capability: {%02x%02x}\n", cap[0], cap[1]);
+			gaim_debug_misc("oscar", "unknown short capability: {%02x%02x}\n", cap[0], cap[1]);
 
 		free(cap);
 	}
@@ -469,17 +469,17 @@
 	if (!sess || !bs || !len)
 		return;
 
-	faimdprintf(sess, 0, "userinfo:   type  =0x%04x\n", type);
-	faimdprintf(sess, 0, "userinfo:   length=0x%04x\n", len);
-	faimdprintf(sess, 0, "userinfo:   value:\n");
+	gaim_debug_misc("oscar", "userinfo:   type  =0x%04x\n", type);
+	gaim_debug_misc("oscar", "userinfo:   length=0x%04x\n", len);
+	gaim_debug_misc("oscar", "userinfo:   value:\n");
 
 	for (i = 0; i < len; i++) {
 		if ((i % 8) == 0)
-			faimdprintf(sess, 0, "\nuserinfo:        ");
-		faimdprintf(sess, 0, "0x%2x ", aimbs_get8(bs));
+			gaim_debug_misc("oscar", "\nuserinfo:        ");
+		gaim_debug_misc("oscar", "0x%2x ", aimbs_get8(bs));
 	}
 
-	faimdprintf(sess, 0, "\n");
+	gaim_debug_misc("oscar", "\n");
 
 	return;
 }
@@ -803,8 +803,8 @@
 			 * recovery.
 			 *
 			 */
-			faimdprintf(sess, 0, "userinfo: **warning: unexpected TLV:\n");
-			faimdprintf(sess, 0, "userinfo:   sn    =%s\n", outinfo->sn);
+			gaim_debug_misc("oscar", "userinfo: **warning: unexpected TLV:\n");
+			gaim_debug_misc("oscar", "userinfo:   sn    =%s\n", outinfo->sn);
 			dumptlv(sess, type, bs, length);
 		}
 
@@ -877,17 +877,17 @@
 	int was_explicit;
 
 	if (!(snac2 = aim_remsnac(sess, snac->id))) {
-		faimdprintf(sess, 0, "faim: locate.c, error(): received response from unknown request!\n");
+		gaim_debug_misc("oscar", "faim: locate.c, error(): received response from unknown request!\n");
 		return 0;
 	}
 
 	if ((snac2->family != 0x0002) && (snac2->type != 0x0015)) {
-		faimdprintf(sess, 0, "faim: locate.c, error(): received response from invalid request! %d\n", snac2->family);
+		gaim_debug_misc("oscar", "faim: locate.c, error(): received response from invalid request! %d\n", snac2->family);
 		return 0;
 	}
 
 	if (!(sn = snac2->data)) {
-		faimdprintf(sess, 0, "faim: locate.c, error(): received response from request without a screen name!\n");
+		gaim_debug_misc("oscar", "faim: locate.c, error(): received response from request without a screen name!\n");
 		return 0;
 	}
 
--- a/src/protocols/oscar/msgcookie.c	Sat Aug 13 06:04:30 2005 +0000
+++ b/src/protocols/oscar/msgcookie.c	Sat Aug 13 06:43:45 2005 +0000
@@ -127,20 +127,6 @@
 	return NULL;
 }
 
-#if 0 /* debugging feature */
-faim_internal int aim_dumpcookie(aim_session_t *sess, aim_msgcookie_t *cookie) 
-{
-
-	if (!cookie)
-		return -EINVAL;
-
-	faimdprintf(sess, 0, "\tCookie at %p: %d/%s with %p, next %p\n", cookie, 
-			cookie->type, cookie->cookie, cookie->data, cookie->next);
-
-	return 0;
-}
-#endif
-
 /**
  * aim_cookie_free - free an aim_msgcookie_t struct
  *
--- a/src/protocols/oscar/oscar.c	Sat Aug 13 06:04:30 2005 +0000
+++ b/src/protocols/oscar/oscar.c	Sat Aug 13 06:43:45 2005 +0000
@@ -69,8 +69,6 @@
 /* Seconds each file transfer ip address will be given to make a connection */
 #define FT_IP_TIMEOUT	15
 
-#define FAIM_DEBUG_LEVEL 0
-
 static int caps_aim = AIM_CAPS_CHAT | AIM_CAPS_BUDDYICON | AIM_CAPS_DIRECTIM | AIM_CAPS_SENDFILE | AIM_CAPS_INTEROPERATE | AIM_CAPS_ICHAT;
 static int caps_icq = AIM_CAPS_BUDDYICON | AIM_CAPS_DIRECTIM | AIM_CAPS_SENDFILE | AIM_CAPS_ICQUTF8 | AIM_CAPS_INTEROPERATE | AIM_CAPS_ICHAT;
 
@@ -1713,19 +1711,6 @@
 	}
 }
 
-static void oscar_debug(aim_session_t *sess, int level, const char *format, va_list va) {
-	GaimConnection *gc = sess->aux_data;
-	gchar *s = g_strdup_vprintf(format, va);
-	gchar *buf;
-
-	buf = g_strdup_printf("%s %d: %s", gaim_account_get_username(gaim_connection_get_account(gc)), level, s);
-	gaim_debug_info("oscar", buf);
-	if (buf[strlen(buf)-1] != '\n')
-		gaim_debug_info(NULL, "\n");
-	g_free(buf);
-	g_free(s);
-}
-
 static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond)
 {
 	GaimConnection *gc = data;
@@ -1792,8 +1777,7 @@
 	od->buddyinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, oscar_free_buddyinfo);
 
 	sess = g_new0(aim_session_t, 1);
-	aim_session_init(sess, TRUE, FAIM_DEBUG_LEVEL);
-	aim_setdebuggingcb(sess, oscar_debug);
+	aim_session_init(sess, TRUE);
 	/*
 	 * We need an immediate queue because we don't use a while-loop
 	 * to see if things need to be sent.
--- a/src/protocols/oscar/rxhandlers.c	Sat Aug 13 06:04:30 2005 +0000
+++ b/src/protocols/oscar/rxhandlers.c	Sat Aug 13 06:43:45 2005 +0000
@@ -68,7 +68,7 @@
 	mod->next = (aim_module_t *)sess->modlistv;
 	sess->modlistv = mod;
 
-	faimdprintf(sess, 1, "registered module %s (family 0x%04x, version = 0x%04x, tool 0x%04x, tool version 0x%04x)\n", mod->name, mod->family, mod->version, mod->toolid, mod->toolversion);
+	gaim_debug_misc("oscar", "registered module %s (family 0x%04x, version = 0x%04x, tool 0x%04x, tool version 0x%04x)\n", mod->name, mod->family, mod->version, mod->toolid, mod->toolversion);
 
 	return 0;
 }
@@ -376,15 +376,15 @@
 		subtype = aimbs_get16(&frame->data);
 		
 		if ((family < maxf) && (subtype+1 < maxs) && (literals[family][subtype] != NULL))
-			faimdprintf(sess, 0, "bleck: channel %s: null handler for %04x/%04x (%s)\n", channels[frame->hdr.flap.channel], family, subtype, literals[family][subtype+1]);
+			gaim_debug_misc("oscar", "bleck: channel %s: null handler for %04x/%04x (%s)\n", channels[frame->hdr.flap.channel], family, subtype, literals[family][subtype+1]);
 		else
-			faimdprintf(sess, 0, "bleck: channel %s: null handler for %04x/%04x (no literal)\n", channels[frame->hdr.flap.channel], family, subtype);
+			gaim_debug_misc("oscar", "bleck: channel %s: null handler for %04x/%04x (no literal)\n", channels[frame->hdr.flap.channel], family, subtype);
 	} else {
 
 		if (frame->hdr.flap.channel <= maxchannels)
-			faimdprintf(sess, 0, "bleck: channel %s (0x%02x)\n", channels[frame->hdr.flap.channel], frame->hdr.flap.channel);
+			gaim_debug_misc("oscar", "bleck: channel %s (0x%02x)\n", channels[frame->hdr.flap.channel], frame->hdr.flap.channel);
 		else
-			faimdprintf(sess, 0, "bleck: unknown channel 0x%02x\n", frame->hdr.flap.channel);
+			gaim_debug_misc("oscar", "bleck: unknown channel 0x%02x\n", frame->hdr.flap.channel);
 
 	}
 		
@@ -398,7 +398,7 @@
 	if (!conn)
 		return -1;
 
-	faimdprintf(sess, 1, "aim_conn_addhandler: adding for %04x/%04x\n", family, type);
+	gaim_debug_misc("oscar", "aim_conn_addhandler: adding for %04x/%04x\n", family, type);
 
 	if (!(newcb = (struct aim_rxcblist_s *)calloc(1, sizeof(struct aim_rxcblist_s))))
 		return -1;
@@ -448,7 +448,7 @@
 	if (!conn)
 		return NULL;
 
-	faimdprintf(sess, 1, "aim_callhandler: calling for %04x/%04x\n", family, type);
+	/* gaim_debug_misc("oscar", "aim_callhandler: calling for %04x/%04x\n", family, type); */
 
 	for (cur = (struct aim_rxcblist_s *)conn->handlerlist; cur; cur = cur->next) {
 		if ((cur->family == family) && (cur->type == type))
@@ -456,11 +456,11 @@
 	}
 
 	if (type == AIM_CB_SPECIAL_DEFAULT) {
-		faimdprintf(sess, 1, "aim_callhandler: no default handler for family 0x%04x\n", family);
+		/* gaim_debug_misc("oscar", "aim_callhandler: no default handler for family 0x%04x\n", family); */
 		return NULL; /* prevent infinite recursion */
 	}
 
-	faimdprintf(sess, 1, "aim_callhandler: no handler for  0x%04x/0x%04x\n", family, type);
+	/* gaim_debug_misc("oscar", "aim_callhandler: no handler for  0x%04x/0x%04x\n", family, type); */
 
 	return aim_callhandler(sess, conn, family, AIM_CB_SPECIAL_DEFAULT);
 }
@@ -541,7 +541,7 @@
 
 			} else if (cur->conn->type == AIM_CONN_TYPE_LISTENER) {
 				/* not possible */
-				faimdprintf(sess, 0, "rxdispatch called on LISTENER connection!\n");
+				gaim_debug_misc("oscar", "rxdispatch called on LISTENER connection!\n");
 				cur->handled = 1;
 				continue;
 			}
@@ -553,7 +553,7 @@
 		}
 	}
 
-	/* 
+	/*
 	 * This doesn't have to be called here.  It could easily be done
 	 * by a separate thread or something. It's an administrative operation,
 	 * and can take a while. Though the less you call it the less memory
@@ -568,16 +568,16 @@
 {
 	int i;
 
-	faimdprintf(sess, 1, "\nRecieved unknown packet:");
+	gaim_debug_misc("oscar", "\nRecieved unknown packet:");
 
 	for (i = 0; aim_bstream_empty(&frame->data); i++) {
 		if ((i % 8) == 0)
-			faimdprintf(sess, 1, "\n\t");
+			gaim_debug_misc("oscar", "\n\t");
 
-		faimdprintf(sess, 1, "0x%2x ", aimbs_get8(&frame->data));
+		gaim_debug_misc("oscar", "0x%2x ", aimbs_get8(&frame->data));
 	}
 
-	faimdprintf(sess, 1, "\n\n");
+	gaim_debug_misc("oscar", "\n\n");
 
 	return 1;
 }
--- a/src/protocols/oscar/rxqueue.c	Sat Aug 13 06:04:30 2005 +0000
+++ b/src/protocols/oscar/rxqueue.c	Sat Aug 13 06:43:45 2005 +0000
@@ -113,7 +113,7 @@
 	 * or we break.  We must handle it just in case.
 	 */
 	if (aimbs_get8(&hdr) != 0x2a) {
-		faimdprintf(sess, 0, "Invalid FLAP frame received on FLAP connection!");
+		gaim_debug_misc("oscar", "Invalid FLAP frame received on FLAP connection!");
 		aim_conn_close(conn);
 		return -1;
 	}
@@ -190,7 +190,7 @@
 	if (conn->type == AIM_CONN_TYPE_RENDEZVOUS)
 		payloadlen = aim_get_command_rendezvous(sess, conn, fr);
 	else if (conn->type == AIM_CONN_TYPE_LISTENER) {
-		faimdprintf(sess, 0, "AIM_CONN_TYPE_LISTENER on fd %d\n", conn->fd);
+		gaim_debug_misc("oscar", "AIM_CONN_TYPE_LISTENER on fd %d\n", conn->fd);
 		free(fr);
 		return -1;
 	} else
--- a/src/protocols/oscar/search.c	Sat Aug 13 06:04:30 2005 +0000
+++ b/src/protocols/oscar/search.c	Sat Aug 13 06:43:45 2005 +0000
@@ -21,7 +21,7 @@
 
 	/* XXX the modules interface should have already retrieved this for us */
 	if (!(snac2 = aim_remsnac(sess, snac->id))) {
-		faimdprintf(sess, 2, "search error: couldn't get a snac for 0x%08lx\n", snac->id);
+		gaim_debug_misc("oscar", "search error: couldn't get a snac for 0x%08lx\n", snac->id);
 		return 0;
 	}
 
--- a/src/protocols/oscar/service.c	Sat Aug 13 06:04:30 2005 +0000
+++ b/src/protocols/oscar/service.c	Sat Aug 13 06:43:45 2005 +0000
@@ -28,7 +28,7 @@
 
 	/*
 	 * Send only the tool versions that the server cares about (that it
-	 * marked as supporting in the server ready SNAC).  
+	 * marked as supporting in the server ready SNAC).
 	 */
 	for (sg = ins->groups; sg; sg = sg->next) {
 		aim_module_t *mod;
@@ -39,7 +39,7 @@
 			aimbs_put16(&fr->data, mod->toolid);
 			aimbs_put16(&fr->data, mod->toolversion);
 		} else
-			faimdprintf(sess, 1, "aim_clientready: server supports group 0x%04x but we don't!\n", sg->group);
+			gaim_debug_misc("oscar", "aim_clientready: server supports group 0x%04x but we don't!\n", sg->group);
 	}
 
 	aim_tx_enqueue(sess, fr);
@@ -49,7 +49,7 @@
 
 /*
  * Subtype 0x0003 - Host Online
- * 
+ *
  * See comments in conn.c about how the group associations are supposed
  * to work, and how they really work.
  *
@@ -57,9 +57,9 @@
  *
  * We don't actually call the client here.  This starts off the connection
  * initialization routine required by all AIM connections.  The next time
- * the client is called is the CONNINITDONE callback, which should be 
+ * the client is called is the CONNINITDONE callback, which should be
  * shortly after the rate information is acknowledged.
- * 
+ *
  */
 static int hostonline(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
 {
@@ -335,7 +335,7 @@
 		if (mod->version >= 3)
 			aimbs_getrawbuf(bs, rc.unknown, sizeof(rc.unknown));
 
-		faimdprintf(sess, 1, "--- Adding rate class %d to connection type %d: window size = %ld, clear = %ld, alert = %ld, limit = %ld, disconnect = %ld, current = %ld, max = %ld\n", rx->conn->type, rc.classid, rc.windowsize, rc.clear, rc.alert, rc.limit, rc.disconnect, rc.current, rc.max);
+		gaim_debug_misc("oscar", "--- Adding rate class %d to connection type %d: window size = %ld, clear = %ld, alert = %ld, limit = %ld, disconnect = %ld, current = %ld, max = %ld\n", rx->conn->type, rc.classid, rc.windowsize, rc.clear, rc.alert, rc.limit, rc.disconnect, rc.current, rc.max);
 
 		rc_addclass(&ins->rates, &rc);
 	}
@@ -628,7 +628,7 @@
 
 		group = aimbs_get16(bs);
 
-		faimdprintf(sess, 0, "bifurcated migration unsupported -- group 0x%04x\n", group);
+		gaim_debug_misc("oscar", "bifurcated migration unsupported -- group 0x%04x\n", group);
 	}
 
 	tl = aim_tlvlist_read(bs);
@@ -754,7 +754,7 @@
 			aimbs_put16(&fr->data, mod->family);
 			aimbs_put16(&fr->data, mod->version);
 		} else
-			faimdprintf(sess, 1, "aim_setversions: server supports group 0x%04x but we don't!\n", sg->group);
+			gaim_debug_misc("oscar", "aim_setversions: server supports group 0x%04x but we don't!\n", sg->group);
 	}
 
 	aim_tx_enqueue(sess, fr);
@@ -934,7 +934,7 @@
 
 	modname = aim_tlv_getstr(list, 0x0001, 1);
 
-	faimdprintf(sess, 1, "data at 0x%08lx (%d bytes) of requested %s\n", offset, len, modname ? modname : "aim.exe");
+	gaim_debug_info("oscar", "Got memory request for data at 0x%08lx (%d bytes) of requested %s\n", offset, len, modname ? modname : "aim.exe");
 
 	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
 		ret = userfunc(sess, rx, offset, len, modname);
@@ -945,29 +945,6 @@
 	return ret;
 }
 
-#if 0
-static void dumpbox(aim_session_t *sess, unsigned char *buf, int len)
-{
-	int i;
-
-	if (!sess || !buf || !len)
-		return;
-
-	faimdprintf(sess, 1, "\nDump of %d bytes at %p:", len, buf);
-
-	for (i = 0; i < len; i++) {
-		if ((i % 8) == 0)
-			faimdprintf(sess, 1, "\n\t");
-
-		faimdprintf(sess, 1, "0x%2x ", buf[i]);
-	}
-
-	faimdprintf(sess, 1, "\n\n");
-
-	return;
-}
-#endif
-
 /* Subtype 0x0020 - Client verification reply */
 faim_export int aim_sendmemblock(aim_session_t *sess, aim_conn_t *conn, fu32_t offset, fu32_t len, const fu8_t *buf, fu8_t flag)
 {
@@ -1046,7 +1023,7 @@
 			aimbs_put32(&fr->data, 0xecf8427e);
 
 		} else
-			faimdprintf(sess, 0, "sendmemblock: WARNING: unknown hash request\n");
+			gaim_debug_warning("oscar", "sendmemblock: unknown hash request\n");
 
 	}
 
@@ -1058,8 +1035,8 @@
 /*
  * Subtype 0x0021 - Receive our extended status
  *
- * This is used for iChat's "available" messages, and maybe ICQ extended 
- * status messages?  It's also used to tell the client whether or not it 
+ * This is used for iChat's "available" messages, and maybe ICQ extended
+ * status messages?  It's also used to tell the client whether or not it
  * needs to upload an SSI buddy icon... who engineers this stuff, anyway?
  */
 static int aim_parse_extstatus(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
--- a/src/protocols/oscar/txqueue.c	Sat Aug 13 06:04:30 2005 +0000
+++ b/src/protocols/oscar/txqueue.c	Sat Aug 13 06:43:45 2005 +0000
@@ -31,19 +31,19 @@
 	aim_frame_t *fr;
 
 	if (!sess || !conn) {
-		faimdprintf(sess, 0, "aim_tx_new: No session or no connection specified!\n");
+		gaim_debug_misc("oscar", "aim_tx_new: No session or no connection specified!\n");
 		return NULL;
 	}
 
 	/* For sanity... */
 	if ((conn->type == AIM_CONN_TYPE_RENDEZVOUS) || (conn->type == AIM_CONN_TYPE_LISTENER)) {
 		if (framing != AIM_FRAMETYPE_OFT) {
-			faimdprintf(sess, 0, "aim_tx_new: attempted to allocate inappropriate frame type for rendezvous connection\n");
+			gaim_debug_misc("oscar", "aim_tx_new: attempted to allocate inappropriate frame type for rendezvous connection\n");
 			return NULL;
 		}
 	} else {
 		if (framing != AIM_FRAMETYPE_FLAP) {
-			faimdprintf(sess, 0, "aim_tx_new: attempted to allocate inappropriate frame type for FLAP connection\n");
+			gaim_debug_misc("oscar", "aim_tx_new: attempted to allocate inappropriate frame type for FLAP connection\n");
 			return NULL;
 		}
 	}
@@ -58,7 +58,7 @@
 	else if (fr->hdrtype == AIM_FRAMETYPE_OFT)
 		fr->hdr.rend.type = chan;
 	else
-		faimdprintf(sess, 0, "tx_new: unknown framing\n");
+		gaim_debug_misc("oscar", "tx_new: unknown framing\n");
 
 	if (datalen > 0) {
 		fu8_t *data;
@@ -105,7 +105,7 @@
 {
 
 	if (!fr->conn) {
-		faimdprintf(sess, 1, "aim_tx_enqueue: WARNING: enqueueing packet with no connecetion\n");
+		gaim_debug_warning("oscar", "aim_tx_enqueue: enqueueing packet with no connecetion\n");
 		fr->conn = aim_getconn_type(sess, AIM_CONN_TYPE_BOS);
 	}
 
@@ -134,15 +134,15 @@
  *
  * Basically the same as its __queuebased couterpart, however
  * instead of doing a list append, it just calls aim_tx_sendframe()
- * right here. 
- * 
+ * right here.
+ *
  */
 static int aim_tx_enqueue__immediate(aim_session_t *sess, aim_frame_t *fr)
 {
 	int ret;
 
 	if (!fr->conn) {
-		faimdprintf(sess, 1, "aim_tx_enqueue: ERROR: packet has no connection\n");
+		gaim_debug_error("oscar", "aim_tx_enqueue: packet has no connection\n");
 		aim_frame_destroy(fr);
 		return 0;
 	}
--- a/src/protocols/oscar/util.c	Sat Aug 13 06:04:30 2005 +0000
+++ b/src/protocols/oscar/util.c	Sat Aug 13 06:43:45 2005 +0000
@@ -13,22 +13,6 @@
 #include "win32dep.h"
 #endif
 
-faim_internal void faimdprintf(aim_session_t *sess, int dlevel, const char *format, ...)
-{
-	if (!sess) {
-		fprintf(stderr, "faimdprintf: no session! boo! (%d, %s)\n", dlevel, format);
-		return;
-	}
-	if ((dlevel <= sess->debug) && sess->debugcb) {
-		va_list ap;
-		va_start(ap, format);
-		sess->debugcb(sess, dlevel, format, ap);
-		va_end(ap);
-	}
-
-	return;
-}
-
 faim_export int aimutil_putstr(char *dest, const char *src, int len)
 {
 	memcpy(dest, src, len);