# HG changeset patch
# Node ID 8b74016a936f
# Parent  a7aca87d5ceb
diff --git a/finch/gntdebug.c b/finch/gntdebug.c
--- a/finch/gntdebug.c
+++ b/finch/gntdebug.c
@@ -231,8 +231,7 @@
 
 	if (new_msg != NULL)
 	{
-		purple_debug(level, (new_domain != NULL ? new_domain : "g_log"),
-				   "%s\n", new_msg);
+		purple_debug(level, (new_domain != NULL) ? new_domain : "g_log", "%s", new_msg);
 
 		g_free(new_msg);
 	}
diff --git a/libpurple/buddylist.c b/libpurple/buddylist.c
--- a/libpurple/buddylist.c
+++ b/libpurple/buddylist.c
@@ -2225,7 +2225,7 @@
 		purple_blist_sync();
 	}
 
-	purple_debug(PURPLE_DEBUG_INFO, "buddylist", "Destroying\n");
+	purple_debug_info("buddylist", "Destroying");
 
 	g_hash_table_destroy(buddies_cache);
 	g_hash_table_destroy(groups_cache);
diff --git a/libpurple/conversation.c b/libpurple/conversation.c
--- a/libpurple/conversation.c
+++ b/libpurple/conversation.c
@@ -180,8 +180,7 @@
 			}
 		}
 		else if (err == -ENOTCONN) {
-			purple_debug(PURPLE_DEBUG_ERROR, "conversation",
-					   "Not yet connected.\n");
+			purple_debug_error("conversation", "Not yet connected.");
 		}
 		else {
 			msg = _("Unable to send message.");
diff --git a/libpurple/group.c b/libpurple/group.c
--- a/libpurple/group.c
+++ b/libpurple/group.c
@@ -149,8 +149,7 @@
 				purple_blist_add_chat((PurpleChat *)child, dest, prev);
 				prev = child;
 			} else {
-				purple_debug(PURPLE_DEBUG_ERROR, "blistnodetypes",
-						"Unknown child type in group %s\n", priv->name);
+				purple_debug_error("blistnodetypes", "Unknown child type in group %s", priv->name);
 			}
 			child = next;
 		}
diff --git a/libpurple/log.c b/libpurple/log.c
--- a/libpurple/log.c
+++ b/libpurple/log.c
@@ -872,8 +872,7 @@
 		data->file = g_fopen(path, "a");
 		if (data->file == NULL)
 		{
-			purple_debug(PURPLE_DEBUG_ERROR, "log",
-					"Could not create log file %s\n", path);
+			purple_debug_error("log", "Could not create log file %s", path);
 
 			if (log->conv != NULL)
 				purple_conversation_write_system_message(log->conv,
diff --git a/libpurple/protocols/facebook/util.c b/libpurple/protocols/facebook/util.c
--- a/libpurple/protocols/facebook/util.c
+++ b/libpurple/protocols/facebook/util.c
@@ -124,7 +124,7 @@
 	level &= ~FB_UTIL_DEBUG_FLAG_ALL;
 
 	str = g_strdup_vprintf(format, ap);
-	purple_debug(level, "facebook", "%s\n", str);
+	purple_debug(level, "facebook", "%s", str);
 	g_free(str);
 }
 
diff --git a/libpurple/protocols/irc/cmds.c b/libpurple/protocols/irc/cmds.c
--- a/libpurple/protocols/irc/cmds.c
+++ b/libpurple/protocols/irc/cmds.c
@@ -366,7 +366,7 @@
 		sign = "-";
 		mode = "v";
 	} else {
-		purple_debug(PURPLE_DEBUG_ERROR, "irc", "invalid 'op' command '%s'\n", cmd);
+		purple_debug_error("irc", "invalid 'op' command '%s'", cmd);
 		return 0;
 	}
 
diff --git a/libpurple/protocols/irc/dcc_send.c b/libpurple/protocols/irc/dcc_send.c
--- a/libpurple/protocols/irc/dcc_send.c
+++ b/libpurple/protocols/irc/dcc_send.c
@@ -141,8 +141,7 @@
 		xfer->ip = g_strdup(token[i]);
 	}
 
-	purple_debug(PURPLE_DEBUG_INFO, "irc", "Receiving file (%s) from %s\n",
-		     filename->str, xfer->ip);
+	purple_debug_info("irc", "Receiving file (%s) from %s", filename->str, xfer->ip);
 	purple_xfer_set_size(PURPLE_XFER(xfer), token[i+2] ? atoi(token[i+2]) : 0);
 
 	purple_xfer_request(PURPLE_XFER(xfer));
diff --git a/libpurple/protocols/irc/irc.c b/libpurple/protocols/irc/irc.c
--- a/libpurple/protocols/irc/irc.c
+++ b/libpurple/protocols/irc/irc.c
@@ -203,7 +203,7 @@
 	char *title, *body;
 
 	if (gc == NULL || purple_connection_get_protocol_data(gc) == NULL) {
-		purple_debug(PURPLE_DEBUG_ERROR, "irc", "got MOTD request for NULL gc\n");
+		purple_debug_error("irc", "got MOTD request for NULL gc");
 		return;
 	}
 	irc = purple_connection_get_protocol_data(gc);
@@ -799,7 +799,7 @@
 	const char *args[2];
 
 	if (!convo) {
-		purple_debug(PURPLE_DEBUG_ERROR, "irc", "Got chat invite request for bogus chat\n");
+		purple_debug_error("irc", "Got chat invite request for bogus chat");
 		return;
 	}
 	args[0] = name;
@@ -835,7 +835,7 @@
 	char *tmp;
 
 	if (!convo) {
-		purple_debug(PURPLE_DEBUG_ERROR, "irc", "chat send on nonexistent chat\n");
+		purple_debug_error("irc", "chat send on nonexistent chat");
 		return -EINVAL;
 	}
 	purple_markup_html_to_xhtml(purple_message_get_contents(msg), NULL, &tmp);
diff --git a/libpurple/protocols/irc/msgs.c b/libpurple/protocols/irc/msgs.c
--- a/libpurple/protocols/irc/msgs.c
+++ b/libpurple/protocols/irc/msgs.c
@@ -194,7 +194,7 @@
   undirected:
 	/* This, too, should be escaped somehow (smarter) */
 	clean = g_utf8_make_valid(args[0], -1);
-	purple_debug(PURPLE_DEBUG_INFO, "irc", "Unrecognized message: %s\n", clean);
+	purple_debug_info("irc", "Unrecognized message: %s", clean);
 	g_free(clean);
 }
 
@@ -341,14 +341,14 @@
 void irc_msg_whois(struct irc_conn *irc, const char *name, const char *from, char **args)
 {
 	if (!irc->whois.nick) {
-		purple_debug(PURPLE_DEBUG_WARNING, "irc", "Unexpected %s reply for %s\n", purple_strequal(name, "314") ? "WHOWAS" : "WHOIS"
-											   , args[1]);
+		purple_debug_warning("irc", "Unexpected %s reply for %s",
+		                     purple_strequal(name, "314") ? "WHOWAS" : "WHOIS", args[1]);
 		return;
 	}
 
 	if (purple_utf8_strcasecmp(irc->whois.nick, args[1])) {
-		purple_debug(PURPLE_DEBUG_WARNING, "irc", "Got %s reply for %s while waiting for %s\n", purple_strequal(name, "314") ? "WHOWAS" : "WHOIS"
-												      , args[1], irc->whois.nick);
+		purple_debug_warning("irc", "Got %s reply for %s while waiting for %s",
+		                     purple_strequal(name, "314") ? "WHOWAS" : "WHOIS", args[1], irc->whois.nick);
 		return;
 	}
 
@@ -376,8 +376,8 @@
 	} else if (purple_strequal(name, "320")) {
 		irc->whois.identified = 1;
 	} else if (purple_strequal(name, "330")) {
-		purple_debug(PURPLE_DEBUG_INFO, "irc", "330 %s: 1=[%s] 2=[%s] 3=[%s]",
-				name, args[1], args[2], args[3]);
+		purple_debug_info("irc", "330 %s: 1=[%s] 2=[%s] 3=[%s]",
+		                  name, args[1], args[2], args[3]);
 		if (purple_strequal(args[3], "is logged in as"))
 			irc->whois.login = g_strdup(args[2]);
 	}
@@ -390,13 +390,13 @@
 	PurpleNotifyUserInfo *user_info;
 
 	if (!irc->whois.nick) {
-		purple_debug(PURPLE_DEBUG_WARNING, "irc", "Unexpected End of %s for %s\n", purple_strequal(name, "369") ? "WHOWAS" : "WHOIS"
-											     , args[1]);
+		purple_debug_warning("irc", "Unexpected End of %s for %s",
+		                     purple_strequal(name, "369") ? "WHOWAS" : "WHOIS", args[1]);
 		return;
 	}
 	if (purple_utf8_strcasecmp(irc->whois.nick, args[1])) {
-		purple_debug(PURPLE_DEBUG_WARNING, "irc", "Received end of %s for %s, expecting %s\n", purple_strequal(name, "369") ? "WHOWAS" : "WHOIS"
-													 , args[1], irc->whois.nick);
+		purple_debug_warning("irc", "Received end of %s for %s, expecting %s",
+		                     purple_strequal(name, "369") ? "WHOWAS" : "WHOIS", args[1], irc->whois.nick);
 		return;
 	}
 
@@ -474,13 +474,13 @@
 
 		chat = purple_conversations_find_chat_with_account(args[1], irc->account);
 		if (!chat) {
-			purple_debug(PURPLE_DEBUG_ERROR, "irc","Got a WHO response for %s, which doesn't exist\n", args[1]);
+			purple_debug_error("irc", "Got a WHO response for %s, which doesn't exist", args[1]);
 			return;
 		}
 
 		cb = purple_chat_conversation_find_user(chat, args[5]);
 		if (!cb) {
-			purple_debug(PURPLE_DEBUG_ERROR, "irc", "Got a WHO response for %s who isn't a buddy.\n", args[5]);
+			purple_debug_error("irc", "Got a WHO response for %s who isn't a buddy.", args[5]);
 			return;
 		}
 		
@@ -564,7 +564,7 @@
 
 	chat = purple_conversations_find_chat_with_account(chan, irc->account);
 	if (!chat) {
-		purple_debug(PURPLE_DEBUG_ERROR, "irc", "Got a topic for %s, which doesn't exist\n", chan);
+		purple_debug_error("irc", "Got a topic for %s, which doesn't exist", chan);
 		g_free(topic);
 		return;
 	}
@@ -612,19 +612,19 @@
 
 	chat = purple_conversations_find_chat_with_account(args[1], irc->account);
 	if (!chat) {
-		purple_debug(PURPLE_DEBUG_ERROR, "irc", "Got topic info for %s, which doesn't exist\n", args[1]);
+		purple_debug_error("irc", "Got topic info for %s, which doesn't exist", args[1]);
 		return;
 	}
 
 	mtime = g_ascii_strtoll(args[3], NULL, 10);
 	if(mtime == 0 || mtime == G_MININT64 || mtime == G_MAXINT64) {
-		purple_debug(PURPLE_DEBUG_ERROR, "irc", "Got apparently nonsensical topic timestamp %s\n", args[3]);
+		purple_debug_error("irc", "Got apparently nonsensical topic timestamp %s", args[3]);
 		return;
 	}
 
 	dt = g_date_time_new_from_unix_utc(mtime);
 	if(dt == NULL) {
-		purple_debug(PURPLE_DEBUG_ERROR, "irc", "Failed to turn %" G_GINT64_FORMAT " into a GDateTime\n", mtime);
+		purple_debug_error("irc", "Failed to turn %" G_GINT64_FORMAT " into a GDateTime", mtime);
 		return;
 	}
 
@@ -664,7 +664,7 @@
 	if (purple_strequal(name, "366")) {
 		convo = purple_conversations_find_with_account(args[1], irc->account);
 		if (!convo) {
-			purple_debug(PURPLE_DEBUG_ERROR, "irc", "Got a NAMES list for %s, which doesn't exist\n", args[1]);
+			purple_debug_error("irc", "Got a NAMES list for %s, which doesn't exist", args[1]);
 			g_string_free(irc->names, TRUE);
 			irc->names = NULL;
 			return;
@@ -839,7 +839,7 @@
 {
 	PurpleChatConversation *chat = purple_conversations_find_chat_with_account(args[1], irc->account);
 
-	purple_debug(PURPLE_DEBUG_INFO, "irc", "We're apparently not in %s, but tried to use it\n", args[1]);
+	purple_debug_info("irc", "We're apparently not in %s, but tried to use it", args[1]);
 	if (chat) {
 		/*g_slist_remove(irc->gc->buddy_chats, chat);
 		  purple_conversation_set_account(chat, NULL);*/
@@ -969,7 +969,7 @@
 
 	chat = purple_conversations_find_chat_with_account(args[0], irc->account);
 	if (chat == NULL) {
-		purple_debug(PURPLE_DEBUG_ERROR, "irc", "JOIN for %s failed\n", args[0]);
+		purple_debug_error("irc", "JOIN for %s failed", args[0]);
 		g_free(nick);
 		return;
 	}
@@ -1003,7 +1003,7 @@
 	nick = irc_mask_nick(from);
 
 	if (!chat) {
-		purple_debug(PURPLE_DEBUG_ERROR, "irc", "Received a KICK for unknown channel %s\n", args[0]);
+		purple_debug_error("irc", "Received a KICK for unknown channel %s", args[0]);
 		g_free(nick);
 		return;
 	}
@@ -1031,7 +1031,7 @@
 		char *escaped;
 		chat = purple_conversations_find_chat_with_account(args[0], irc->account);
 		if (!chat) {
-			purple_debug(PURPLE_DEBUG_ERROR, "irc", "MODE received for %s, which we are not in\n", args[0]);
+			purple_debug_error("irc", "MODE received for %s, which we are not in", args[0]);
 			g_free(nick);
 			return;
 		}
@@ -1212,7 +1212,7 @@
 
 	chat = purple_conversations_find_chat_with_account(channel, irc->account);
 	if (!chat) {
-		purple_debug(PURPLE_DEBUG_INFO, "irc", "Got a PART on %s, which doesn't exist -- probably closed\n", channel);
+		purple_debug_info("irc", "Got a PART on %s, which doesn't exist -- probably closed", channel);
 		return;
 	}
 
diff --git a/libpurple/protocols/irc/parse.c b/libpurple/protocols/irc/parse.c
--- a/libpurple/protocols/irc/parse.c
+++ b/libpurple/protocols/irc/parse.c
@@ -260,8 +260,8 @@
 
 	utf8 = g_convert(string, strlen(string), encodings[0], "UTF-8", NULL, NULL, &err);
 	if (err) {
-		purple_debug(PURPLE_DEBUG_ERROR, "irc", "Send conversion error: %s\n", err->message);
-		purple_debug(PURPLE_DEBUG_ERROR, "irc", "Sending as UTF-8 instead of %s\n", encodings[0]);
+		purple_debug_error("irc", "Send conversion error: %s", err->message);
+		purple_debug_error("irc", "Sending as UTF-8 instead of %s", encodings[0]);
 		utf8 = g_strdup(string);
 		g_error_free(err);
 	}
@@ -480,7 +480,7 @@
 			bold = italic = underline = font = FALSE;
 			break;
 		default:
-			purple_debug(PURPLE_DEBUG_ERROR, "irc", "Unexpected mIRC formatting character %d\n", *cur);
+			purple_debug_error("irc", "Unexpected mIRC formatting character %d", *cur);
 		}
 	} while (*cur);
 
@@ -580,8 +580,9 @@
 					_("CTCP PING reply"), buf,
 					purple_request_cpar_from_connection(gc));
 				g_free(buf);
-			} else
-				purple_debug(PURPLE_DEBUG_ERROR, "irc", "Unable to parse PING timestamp");
+			} else {
+				purple_debug_error("irc", "Unable to parse PING timestamp");
+			}
 			return NULL;
 		} else {
 			buf = irc_format(irc, "vt:", "NOTICE", from, msg);
@@ -609,7 +610,7 @@
 	int i;
 
 	if (!irc || !irc->msgs) {
-		purple_debug(PURPLE_DEBUG_ERROR, "irc", "Attempt to build a message table on a bogus structure\n");
+		purple_debug_error("irc", "Attempt to build a message table on a bogus structure");
 		return;
 	}
 
@@ -623,7 +624,7 @@
 	int i;
 
 	if (!irc || !irc->cmds) {
-		purple_debug(PURPLE_DEBUG_ERROR, "irc", "Attempt to build a command table on a bogus structure\n");
+		purple_debug_error("irc", "Attempt to build a command table on a bogus structure");
 		return;
 	}
 
@@ -660,7 +661,7 @@
 			g_free(tmp);
 			break;
 		default:
-			purple_debug(PURPLE_DEBUG_ERROR, "irc", "Invalid format character '%c'\n", *cur);
+			purple_debug_error("irc", "Invalid format character '%c'", *cur);
 			break;
 		}
 	}
@@ -782,7 +783,7 @@
 			cur = cur + strlen(cur);
 			break;
 		default:
-			purple_debug(PURPLE_DEBUG_ERROR, "irc", "invalid message format character '%c'\n", fmt[i]);
+			purple_debug_error("irc", "invalid message format character '%c'", fmt[i]);
 			fmt_valid = FALSE;
 			break;
 		}
@@ -813,6 +814,6 @@
 	/* This really should be escaped somehow that you can tell what
 	 * the junk was -- but as it is, it can crash glib. */
 	clean = g_utf8_make_valid(input, -1);
-	purple_debug(PURPLE_DEBUG_WARNING, "irc", "Unrecognized string: %s\n", clean);
+	purple_debug_warning("irc", "Unrecognized string: %s", clean);
 	g_free(clean);
 }
diff --git a/libpurple/protocols/novell/nmconference.c b/libpurple/protocols/novell/nmconference.c
--- a/libpurple/protocols/novell/nmconference.c
+++ b/libpurple/protocols/novell/nmconference.c
@@ -60,9 +60,8 @@
 	}
 	conf->ref_count = 1;
 
-	purple_debug(PURPLE_DEBUG_INFO, "novell",
-			   "Creating a conference %p, total=%d\n",
-			   conf, conf_count++);
+	purple_debug_info("novell", "Creating a conference %p, total=%d",
+	                  conf, conf_count++);
 
 	return conf;
 }
@@ -74,14 +73,11 @@
 
 	g_return_if_fail(conference != NULL);
 
-	purple_debug(PURPLE_DEBUG_INFO, "novell",
-			   "In release conference %p, refs=%d\n",
-			   conference, conference->ref_count);
+	purple_debug_info("novell", "In release conference %p, refs=%d",
+	                  conference, conference->ref_count);
 	if (--conference->ref_count == 0) {
-
-		purple_debug(PURPLE_DEBUG_INFO, "novell",
-				   "Releasing conference %p, total=%d\n",
-				   conference, --conf_count);
+		purple_debug_info("novell", "Releasing conference %p, total=%d",
+		                  conference, --conf_count);
 
 		g_free(conference->guid);
 
diff --git a/libpurple/protocols/novell/nmcontact.c b/libpurple/protocols/novell/nmcontact.c
--- a/libpurple/protocols/novell/nmcontact.c
+++ b/libpurple/protocols/novell/nmcontact.c
@@ -65,8 +65,7 @@
 
 	contact->ref_count = 1;
 
-	purple_debug(PURPLE_DEBUG_INFO, "novell", "Creating contact, total=%d\n",
-			   count++);
+	purple_debug_info("novell", "Creating contact, total=%d", count++);
 
 	return contact;
 }
@@ -227,9 +226,7 @@
 		return;
 
 	if (--(contact->ref_count) == 0) {
-
-		purple_debug(PURPLE_DEBUG_INFO, "novell",
-				   "Releasing contact, total=%d\n", --count);
+		purple_debug_info("novell", "Releasing contact, total=%d", --count);
 
 		g_free(contact->display_name);
 		g_free(contact->dn);
diff --git a/libpurple/protocols/novell/nmevent.c b/libpurple/protocols/novell/nmevent.c
--- a/libpurple/protocols/novell/nmevent.c
+++ b/libpurple/protocols/novell/nmevent.c
@@ -182,7 +182,7 @@
 			g_input_stream_read_all(G_INPUT_STREAM(conn->input), msg, size,
 			                        NULL, user->cancellable, &error);
 
-			purple_debug(PURPLE_DEBUG_INFO, "novell", "Message is %s\n", msg);
+			purple_debug_info("novell", "Message is %s", msg);
 
 			/* Auto replies are not in RTF format! */
 			if (!autoreply) {
@@ -192,8 +192,7 @@
 				nortf = nm_rtf_strip_formatting(ctx, msg);
 				nm_rtf_deinit(ctx);
 
-				purple_debug(PURPLE_DEBUG_INFO, "novell",
-						   "Message without RTF is %s\n", nortf);
+				purple_debug_info("novell", "Message without RTF is %s", nortf);
 
 				/* Store the event data */
 				nm_event_set_text(event, nortf);
@@ -1032,8 +1031,7 @@
 				break;
 
 			default:
-				purple_debug(PURPLE_DEBUG_INFO, "novell",
-						   "Unknown event %d received.\n", type);
+				purple_debug_info("novell", "Unknown event %d received.", type);
 				rc = NMERR_PROTOCOL;
 				break;
 			}
diff --git a/libpurple/protocols/novell/nmuser.c b/libpurple/protocols/novell/nmuser.c
--- a/libpurple/protocols/novell/nmuser.c
+++ b/libpurple/protocols/novell/nmuser.c
@@ -1741,8 +1741,7 @@
 		} else {
 
 			/* Nothing to do, just print debug message  */
-			purple_debug(PURPLE_DEBUG_INFO, "novell",
-					   "nm_call_handler(): Unknown request command, %s\n", cmd);
+			purple_debug_info("novell", "nm_call_handler(): Unknown request command, %s", cmd);
 
 		}
 	}
diff --git a/libpurple/protocols/novell/nmuserrecord.c b/libpurple/protocols/novell/nmuserrecord.c
--- a/libpurple/protocols/novell/nmuserrecord.c
+++ b/libpurple/protocols/novell/nmuserrecord.c
@@ -57,8 +57,7 @@
 
 	user_record->ref_count = 1;
 
-	purple_debug(PURPLE_DEBUG_INFO, "novell", "Creating user_record, total=%d\n",
-			   count++);
+	purple_debug_info("novell", "Creating user_record, total=%d", count++);
 
 	return user_record;
 }
@@ -260,9 +259,7 @@
 nm_release_user_record(NMUserRecord * user_record)
 {
 	if (--(user_record->ref_count) == 0) {
-
-		purple_debug(PURPLE_DEBUG_INFO, "novell",
-				   "Releasing user_record, total=%d\n", --count);
+		purple_debug_info("novell", "Releasing user_record, total=%d", --count);
 
 		g_free(user_record->dn);
 		g_free(user_record->cn);
diff --git a/libpurple/protocols/novell/novell.c b/libpurple/protocols/novell/novell.c
--- a/libpurple/protocols/novell/novell.c
+++ b/libpurple/protocols/novell/novell.c
@@ -183,10 +183,7 @@
 		}
 
 	} else {
-
-		purple_debug(PURPLE_DEBUG_INFO, "novell",
-				   "_get_status_resp_cb(): rc = 0x%X\n", ret_code);
-
+		purple_debug_info("novell", "_get_status_resp_cb(): rc = 0x%X", ret_code);
 	}
 }
 
@@ -196,8 +193,7 @@
 						gpointer resp_data, gpointer user_data)
 {
 	if (ret_code != NM_OK) {
-		purple_debug(PURPLE_DEBUG_INFO, "novell",
-				   "_rename_contact_resp_cb(): rc = 0x%X\n", ret_code);
+		purple_debug_info("novell", "_rename_contact_resp_cb(): rc = 0x%X", ret_code);
 	}
 }
 
@@ -447,8 +443,7 @@
 	if (ret_code != NM_OK) {
 		/* TODO: Display an error? */
 
-		purple_debug(PURPLE_DEBUG_INFO, "novell",
-				   "_remove_contact_resp_cb(): rc = 0x%x\n", ret_code);
+		purple_debug_info("novell", "_remove_contact_resp_cb(): rc = 0x%x", ret_code);
 	}
 }
 
@@ -460,8 +455,7 @@
 	if (ret_code != NM_OK) {
 		/* TODO: Display an error? */
 
-		purple_debug(PURPLE_DEBUG_INFO, "novell",
-				   "_remove_folder_resp_cb(): rc = 0x%x\n", ret_code);
+		purple_debug_info("novell", "_remove_folder_resp_cb(): rc = 0x%x", ret_code);
 	}
 }
 
@@ -473,8 +467,7 @@
 	if (ret_code != NM_OK) {
 		/* TODO: Display an error? */
 
-		purple_debug(PURPLE_DEBUG_INFO, "novell",
-				   "_move_contact_resp_cb(): rc = 0x%x\n", ret_code);
+		purple_debug_info("novell", "_move_contact_resp_cb(): rc = 0x%x", ret_code);
 	}
 }
 
@@ -486,8 +479,7 @@
 	if (ret_code != NM_OK) {
 		/* TODO: Display an error? */
 
-		purple_debug(PURPLE_DEBUG_INFO, "novell",
-				   "_rename_folder_resp_cb(): rc = 0x%x\n", ret_code);
+		purple_debug_info("novell", "_rename_folder_resp_cb(): rc = 0x%x", ret_code);
 	}
 }
 
@@ -508,8 +500,7 @@
 			purple_request_cpar_from_connection(gc));
 		g_free(err);
 
-		purple_debug(PURPLE_DEBUG_INFO, "novell",
-				   "_sendinvite_resp_cb(): rc = 0x%x\n", ret_code);
+		purple_debug_info("novell", "_sendinvite_resp_cb(): rc = 0x%x", ret_code);
 	}
 
 }
@@ -1698,8 +1689,7 @@
 				PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 				_("Error communicating with server. Closing connection."));
 		} else {
-			purple_debug(PURPLE_DEBUG_INFO, "novell",
-					   "Error processing event or response (%d).\n", rc);
+			purple_debug_info("novell", "Error processing event or response (%d).", rc);
 		}
 	}
 }
@@ -2167,9 +2157,8 @@
 			_evt_conference_left(user, event);
 			break;
 		default:
-			purple_debug(PURPLE_DEBUG_INFO, "novell",
-					   "_event_callback(): unhandled event, %d\n",
-					   nm_event_get_type(event));
+			purple_debug_info("novell", "_event_callback(): unhandled event, %d",
+			                  nm_event_get_type(event));
 			break;
 	}
 }
diff --git a/libpurple/purpleimconversation.c b/libpurple/purpleimconversation.c
--- a/libpurple/purpleimconversation.c
+++ b/libpurple/purpleimconversation.c
@@ -80,7 +80,7 @@
 
 		purple_serv_send_typing(pc, name, PURPLE_IM_TYPED);
 
-		purple_debug(PURPLE_DEBUG_MISC, "purple-im-conversation", "typed...\n");
+		purple_debug_misc("purple-im-conversation", "typed...");
 	}
 
 	return FALSE;
diff --git a/libpurple/server.c b/libpurple/server.c
--- a/libpurple/server.c
+++ b/libpurple/server.c
@@ -827,8 +827,8 @@
 	if (!chat)
 		return;
 
-	purple_debug(PURPLE_DEBUG_INFO, "server", "Leaving room: %s\n",
-			   purple_conversation_get_name(PURPLE_CONVERSATION(chat)));
+	purple_debug_info("server", "Leaving room: %s",
+	                  purple_conversation_get_name(PURPLE_CONVERSATION(chat)));
 
 	_purple_connection_remove_active_chat(g, chat);
 
diff --git a/libpurple/signals.c b/libpurple/signals.c
--- a/libpurple/signals.c
+++ b/libpurple/signals.c
@@ -249,10 +249,8 @@
 	signal_data =
 		(PurpleSignalData *)g_hash_table_lookup(instance_data->signals, signal);
 
-	if (signal_data == NULL)
-	{
-		purple_debug(PURPLE_DEBUG_ERROR, "signals",
-				   "Signal data for %s not found!\n", signal);
+	if (signal_data == NULL) {
+		purple_debug_error("signals", "Signal data for %s not found!", signal);
 		return 0;
 	}
 
@@ -325,10 +323,8 @@
 	signal_data =
 		(PurpleSignalData *)g_hash_table_lookup(instance_data->signals, signal);
 
-	if (signal_data == NULL)
-	{
-		purple_debug(PURPLE_DEBUG_ERROR, "signals",
-				   "Signal data for %s not found!\n", signal);
+	if (signal_data == NULL) {
+		purple_debug_error("signals", "Signal data for %s not found!", signal);
 		return;
 	}
 
@@ -433,10 +429,8 @@
 	signal_data =
 		(PurpleSignalData *)g_hash_table_lookup(instance_data->signals, signal);
 
-	if (signal_data == NULL)
-	{
-		purple_debug(PURPLE_DEBUG_ERROR, "signals",
-				   "Signal data for %s not found!\n", signal);
+	if (signal_data == NULL) {
+		purple_debug_error("signals", "Signal data for %s not found!", signal);
 		return;
 	}
 
@@ -502,10 +496,8 @@
 	signal_data =
 		(PurpleSignalData *)g_hash_table_lookup(instance_data->signals, signal);
 
-	if (signal_data == NULL)
-	{
-		purple_debug(PURPLE_DEBUG_ERROR, "signals",
-				   "Signal data for %s not found!\n", signal);
+	if (signal_data == NULL) {
+		purple_debug_error("signals", "Signal data for %s not found!", signal);
 		return 0;
 	}
 
diff --git a/libpurple/util.c b/libpurple/util.c
--- a/libpurple/util.c
+++ b/libpurple/util.c
@@ -708,14 +708,12 @@
 		if((*fpath = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", tmpdir, purple_mkstemp_templ)) != NULL) {
 			fd = g_mkstemp(*fpath);
 			if(fd == -1) {
-				purple_debug(PURPLE_DEBUG_ERROR, "purple_mkstemp",
-						   "Couldn't make \"%s\", error: %d\n",
-						   *fpath, errno);
+				purple_debug_error("purple_mkstemp", "Couldn't make \"%s\", error: %d",
+				                   *fpath, errno);
 			} else {
 				if((fp = fdopen(fd, "r+")) == NULL) {
 					close(fd);
-					purple_debug(PURPLE_DEBUG_ERROR, "purple_mkstemp",
-							   "Couldn't fdopen(), error: %d\n", errno);
+					purple_debug_error("purple_mkstemp", "Couldn't fdopen(), error: %d", errno);
 				}
 			}
 
@@ -725,8 +723,7 @@
 			}
 		}
 	} else {
-		purple_debug(PURPLE_DEBUG_ERROR, "purple_mkstemp",
-				   "g_get_tmp_dir() failed!\n");
+		purple_debug_error("purple_mkstemp", "g_get_tmp_dir() failed!");
 	}
 
 	return fp;
@@ -744,9 +741,8 @@
 	g_return_val_if_fail(*program != '\0', FALSE);
 
 	if (!g_shell_parse_argv(program, NULL, &argv, &error)) {
-		purple_debug(PURPLE_DEBUG_ERROR, "program_is_valid",
-				   "Could not parse program '%s': %s\n",
-				   program, error->message);
+		purple_debug_error("program_is_valid", "Could not parse program '%s': %s",
+		                   program, error->message);
 		g_error_free(error);
 		return FALSE;
 	}
diff --git a/libpurple/win32/libc_interface.c b/libpurple/win32/libc_interface.c
--- a/libpurple/win32/libc_interface.c
+++ b/libpurple/win32/libc_interface.c
@@ -93,7 +93,7 @@
 		return 0;
 	}
 	default:
-                purple_debug(PURPLE_DEBUG_WARNING, "wpurple", "wpurple_fcntl: Unsupported command\n");
+		purple_debug_warning("wpurple", "wpurple_fcntl: Unsupported command");
 		return -1;
 	}/*end switch*/
 }
diff --git a/pidgin/gtkaccount.c b/pidgin/gtkaccount.c
--- a/pidgin/gtkaccount.c
+++ b/pidgin/gtkaccount.c
@@ -366,9 +366,9 @@
 
 			/* It looks like we're dealing with a local file. */
 			if(!(tmp = g_filename_from_uri(name, NULL, &converr))) {
-				purple_debug(PURPLE_DEBUG_ERROR, "buddyicon", "%s\n",
-					   (converr ? converr->message :
-					    "g_filename_from_uri error"));
+				purple_debug_error("buddyicon", "%s",
+				                   converr ? converr->message :
+				                   "g_filename_from_uri error");
 				return;
 			}
 			if ((rtmp = strchr(tmp, '\r')) || (rtmp = strchr(tmp, '\n')))
diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c
--- a/pidgin/gtkconv.c
+++ b/pidgin/gtkconv.c
@@ -6707,8 +6707,8 @@
 
 
 	if (win->in_drag) {
-		purple_debug(PURPLE_DEBUG_WARNING, "gtkconv",
-		           "Already in the middle of a window drag at tab_press_cb\n");
+		purple_debug_warning("gtkconv",
+		                     "Already in the middle of a window drag at tab_press_cb");
 		return TRUE;
 	}
 
diff --git a/pidgin/gtkprefs.c b/pidgin/gtkprefs.c
--- a/pidgin/gtkprefs.c
+++ b/pidgin/gtkprefs.c
@@ -1305,9 +1305,9 @@
 			/* It looks like we're dealing with a local file. Let's
 			 * just untar it in the right place */
 			if(!(tmp = g_filename_from_uri(name, NULL, &converr))) {
-				purple_debug(PURPLE_DEBUG_ERROR, "theme dnd", "%s\n",
-						   (converr ? converr->message :
-							"g_filename_from_uri error"));
+				purple_debug_error("theme dnd", "%s",
+				                   converr ? converr->message :
+				                   "g_filename_from_uri error");
 				free_theme_info(info);
 				return;
 			}
diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c
--- a/pidgin/gtkutils.c
+++ b/pidgin/gtkutils.c
@@ -316,8 +316,7 @@
                          GdkModifierType arg2, GClosure *arg3,
                          gpointer data)
 {
-	purple_debug(PURPLE_DEBUG_MISC, "accels",
-	           "accel changed, scheduling save.\n");
+	purple_debug_misc("accels", "accel changed, scheduling save.");
 
 	if (!accels_save_timer)
 		accels_save_timer = g_timeout_add_seconds(5, pidgin_save_accels,
@@ -330,7 +329,7 @@
 	char *filename = NULL;
 
 	filename = g_build_filename(purple_config_dir(), "accels", NULL);
-	purple_debug(PURPLE_DEBUG_MISC, "accels", "saving accels to %s\n", filename);
+	purple_debug_misc("accels", "saving accels to %s", filename);
 	gtk_accel_map_save(filename);
 	g_free(filename);
 
diff --git a/pidgin/pidgindebug.c b/pidgin/pidgindebug.c
--- a/pidgin/pidgindebug.c
+++ b/pidgin/pidgindebug.c
@@ -739,7 +739,7 @@
 		level = PURPLE_DEBUG_MISC;
 	}
 
-	purple_debug(level, category->str, "%s\n", msg);
+	purple_debug(level, category->str, "%s", msg);
 	g_string_free(category, TRUE);
 }
 
diff --git a/pidgin/plugins/gestures/stroke-draw.c b/pidgin/plugins/gestures/stroke-draw.c
--- a/pidgin/plugins/gestures/stroke-draw.c
+++ b/pidgin/plugins/gestures/stroke-draw.c
@@ -301,7 +301,7 @@
     (GHashTable*)g_object_get_data(G_OBJECT(widget), GSTROKE_SIGNALS);
 
 #if 0
-  purple_debug(PURPLE_DEBUG_MISC, "gestures", "gstroke %s\n", name);
+  purple_debug_misc("gestures", "gstroke %s", name);
 #endif
 
   if (hash_table)
diff --git a/pidgin/win32/untar.c b/pidgin/win32/untar.c
--- a/pidgin/win32/untar.c
+++ b/pidgin/win32/untar.c
@@ -83,10 +83,6 @@
 
 #include "untar.h"
 
-#define untar_error( error, args... )      purple_debug(PURPLE_DEBUG_ERROR, "untar", error, ## args )
-#define untar_warning( warning, args... )  purple_debug(PURPLE_DEBUG_WARNING, "untar", warning, ## args )
-#define untar_verbose( args... )           purple_debug(PURPLE_DEBUG_INFO, "untar", ## args )
-
 #define WSIZE	32768	/* size of decompression buffer */
 #define TSIZE	512	/* size of a "tape" block */
 #define CR	13	/* carriage-return character */
@@ -149,7 +145,7 @@
 	/* if we aren't allowed to overwrite and this file exists, return NULL */
 	if (!FORCE && access(name, 0) == 0)
 	{
-		untar_warning("%s: exists, will not overwrite without \"FORCE option\"\n", name);
+		purple_debug_warning("untar", "%s: exists, will not overwrite without \"FORCE option\"", name);
 		return NULL;
 	}
 
@@ -176,7 +172,7 @@
 	}
 	fp = g_fopen(name, CONVERT ? "w" : "wb");
 	if (!fp)
-		untar_error("Error opening: %s\n", name);
+		purple_debug_error("untar", "Error opening: %s", name);
 	return fp;
 }
 
@@ -196,7 +192,7 @@
 	fpsrc = g_fopen(src, "rb");
 	if (!fpsrc)
 	{
-		untar_error("Error opening: %s\n", src);
+		purple_debug_error("untar", "Error opening: %s", src);
 		return;
 	}
 
@@ -247,7 +243,7 @@
 	fclose(fpdst);
 
 	/* Give a warning */
-	untar_warning("%s: copy instead of link\n", dst);
+	purple_debug_warning("untar", "%s: copy instead of link", dst);
 }
 
 /* This calls fwrite(), possibly after converting CR-LF to LF */
@@ -364,7 +360,7 @@
 	{
 		/* end-of-archive marker */
 		if (didabs)
-			untar_warning("Removed leading slashes because \"ABSPATH option\" wasn't given.\n");
+			purple_debug_warning("untar", "Removed leading slashes because \"ABSPATH option\" wasn't given.");
 		return 1;
 	}
 	else
@@ -379,12 +375,12 @@
 		{
 			if (first)
 			{
-				untar_error("%s: not a valid tar file\n", inname);
+				purple_debug_error("untar", "%s: not a valid tar file", inname);
 				return 0;
 			}
 			else
 			{
-				untar_error("Garbage detected; preceding file may be damaged\n");
+				purple_debug_error("untar", "Garbage detected; preceding file may be damaged");
 				return 0;
 			}
 		}
@@ -444,9 +440,10 @@
 		}
 		if (sum != checksum(tblk, 0) && sum != checksum(tblk, 1))
 		{
-			if (!first)
-				untar_error("Garbage detected; preceding file may be damaged\n");
-			untar_error("%s: header has bad checksum for %s\n", inname, nbuf);
+			if (!first) {
+				purple_debug_error("untar", "Garbage detected; preceding file may be damaged");
+			}
+			purple_debug_error("untar", "%s: header has bad checksum for %s", inname, nbuf);
 			return 0;
 		}
 
@@ -486,17 +483,17 @@
 
 		/* list the file */
 		if (VERBOSE)
-			untar_verbose("%c %s",
+			purple_debug_info("untar", "%c %s",
 				ISREGULAR(*tblk) ? '-' : ("hlcbdp"[(tblk)->type - '1']),
 				nbuf);
 		else if (!QUIET)
-			untar_verbose("%s\n", nbuf);
+			purple_debug_info("untar", "%s", nbuf);
 
 		/* if link, then do the link-or-copy thing */
 		if (tblk->type == '1' || tblk->type == '2')
 		{
 			if (VERBOSE)
-				untar_verbose(" -> %s\n", tblk->linkto);
+				purple_debug_info("untar", " -> %s", tblk->linkto);
 			if (!LISTING)
 				linkorcopy(tblk->linkto, nbuf, tblk->type == '2');
 			outsize = 0L;
@@ -522,7 +519,7 @@
 			else
 				tmp = " ignored";
 			if (VERBOSE)
-				untar_verbose("%s\n", tmp);
+				purple_debug_info("untar", "%s", tmp);
 			return 1;
 		}
 
@@ -530,7 +527,7 @@
 		if (!ISREGULAR(*tblk))
 		{
 			if (VERBOSE)
-				untar_verbose(" ignored\n");
+				purple_debug_info("untar", " ignored");
 			outsize = 0L;
 			return 1;
 		}
@@ -538,7 +535,7 @@
 		/* print file statistics */
 		if (VERBOSE)
 		{
-			untar_verbose(" (%ld byte%s, %ld tape block%s)\n",
+			purple_debug_info("untar", " (%ld byte%s, %ld tape block%s)",
 				outsize,
 				outsize == 1 ? "" : "s",
 				(outsize + TSIZE - 1) / TSIZE,
@@ -577,7 +574,7 @@
 	infp = g_fopen(filename, "rb");
 	if (!infp)
 	{
-		untar_error("Error opening: %s\n", filename);
+		purple_debug_error("untar", "Error opening: %s", filename);
 		return 0;
 	}
 
@@ -585,12 +582,12 @@
 
 	/* Set current directory */
 	if(!GetCurrentDirectoryW(_MAX_PATH, curdir)) {
-		untar_error("Could not get current directory (error %lu).\n", GetLastError());
+		purple_debug_error("untar", "Could not get current directory (error %lu).", GetLastError());
 		fclose(infp);
 		return 0;
 	}
 	if(!SetCurrentDirectoryW(w_destdir)) {
-		untar_error("Could not set current directory to (error %lu): %s\n", GetLastError(), destdir);
+		purple_debug_error("untar", "Could not set current directory to (error %lu): %s", GetLastError(), destdir);
 		fclose(infp);
 		return 0;
 	} else {
@@ -598,18 +595,18 @@
 		/* send each block to the untar_block() function */
 		while (fread(slide, 1, TSIZE, infp) == TSIZE) {
 			if(!untar_block(slide)) {
-				untar_error("untar failure: %s\n", filename);
+				purple_debug_error("untar", "untar failure: %s", filename);
 				fclose(infp);
 				ret=0;
 			}
 		}
 		if (outsize > 0 && ret) {
-			untar_warning("Last file might be truncated!\n");
+			purple_debug_warning("untar", "Last file might be truncated!");
 			fclose(outfp);
 			outfp = NULL;
 		}
 		if(!SetCurrentDirectoryW(curdir)) {
-			untar_error("Could not set current dir back to original (error %lu).\n", GetLastError());
+			purple_debug_error("untar", "Could not set current dir back to original (error %lu).", GetLastError());
 			ret=0;
 		}
 	}
