diff libpurple/protocols/msn/slp.c @ 27967:e1cd44c7c7af

explicit merge of 'd957c051e839d63bfc0ef71320934890e7ae63c4' and '7fbd51e5a790f5cf3275a0bb8a8198acd078b4ec'
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Sat, 25 Jul 2009 04:54:36 +0000
parents 35b6fd563056
children 6c9c6123b942
line wrap: on
line diff
--- a/libpurple/protocols/msn/slp.c	Fri Jul 24 01:42:13 2009 +0000
+++ b/libpurple/protocols/msn/slp.c	Sat Jul 25 04:54:36 2009 +0000
@@ -34,8 +34,6 @@
 
 /* ms to delay between sending buddy icon requests to the server. */
 #define BUDDY_ICON_DELAY 20
-/*debug SLP*/
-#define MSN_DEBUG_UD
 
 static void send_ok(MsnSlpCall *slpcall, const char *branch,
 					const char *type, const char *content);
@@ -212,10 +210,8 @@
 								"MSNSLP/1.0 200 OK",
 								branch, type, content);
 
-#ifdef MSN_DEBUG_SLP
 	slpmsg->info = "SLP 200 OK";
 	slpmsg->text_body = TRUE;
-#endif
 
 	msn_slplink_queue_slpmsg(slplink, slpmsg);
 
@@ -236,10 +232,8 @@
 								"MSNSLP/1.0 603 Decline",
 								branch, type, content);
 
-#ifdef MSN_DEBUG_SLP
 	slpmsg->info = "SLP 603 Decline";
 	slpmsg->text_body = TRUE;
-#endif
 
 	msn_slplink_queue_slpmsg(slplink, slpmsg);
 }
@@ -309,18 +303,14 @@
 		slpmsg->slpcall = slpcall;
 		slpmsg->session_id = slpcall->session_id;
 		msn_slpmsg_set_body(slpmsg, NULL, 4);
-#ifdef MSN_DEBUG_SLP
 		slpmsg->info = "SLP DATA PREP";
-#endif
 		msn_slplink_queue_slpmsg(slplink, slpmsg);
 
 		/* DATA */
 		slpmsg = msn_slpmsg_new(slplink);
 		slpmsg->slpcall = slpcall;
 		slpmsg->flags = 0x20;
-#ifdef MSN_DEBUG_SLP
 		slpmsg->info = "SLP DATA";
-#endif
 		msn_slpmsg_set_image(slpmsg, img);
 		msn_slplink_queue_slpmsg(slplink, slpmsg);
 		purple_imgstore_unref(img);
@@ -448,10 +438,8 @@
 								"\r\n");
 	g_free(header);
 
-#ifdef MSN_DEBUG_SLP
 	slpmsg->info = "SLP BYE";
 	slpmsg->text_body = TRUE;
-#endif
 
 	msn_slplink_queue_slpmsg(slplink, slpmsg);
 }
@@ -619,10 +607,8 @@
 										"application/x-msnmsgr-transreqbody",
 										content);
 
-#ifdef MSN_DEBUG_SLP
 			slpmsg->info = "SLP INVITE";
 			slpmsg->text_body = TRUE;
-#endif
 			msn_slplink_send_slpmsg(slplink, slpmsg);
 
 			g_free(header);
@@ -839,9 +825,8 @@
 		purple_conv_custom_smiley_write(conv, slpcall->data_info, data, size);
 		purple_conv_custom_smiley_close(conv, slpcall->data_info );
 	}
-#ifdef MSN_DEBUG_UD
-	purple_debug_info("msn", "Got smiley: %s\n", slpcall->data_info);
-#endif
+	if (purple_debug_is_verbose())
+		purple_debug_info("msn", "Got smiley: %s\n", slpcall->data_info);
 }
 
 void
@@ -963,9 +948,8 @@
 
 	g_return_if_fail(userlist != NULL);
 
-#ifdef MSN_DEBUG_UD
-	purple_debug_info("msn", "Releasing buddy icon request\n");
-#endif
+	if (purple_debug_is_verbose())
+		purple_debug_info("msn", "Releasing buddy icon request\n");
 
 	if (userlist->buddy_icon_window > 0)
 	{
@@ -986,10 +970,10 @@
 		userlist->buddy_icon_window--;
 		request_user_display(user);
 
-#ifdef MSN_DEBUG_UD
-		purple_debug_info("msn", "msn_release_buddy_icon_request(): buddy_icon_window-- yields =%d\n",
-						userlist->buddy_icon_window);
-#endif
+		if (purple_debug_is_verbose())
+			purple_debug_info("msn",
+			                  "msn_release_buddy_icon_request(): buddy_icon_window-- yields =%d\n",
+			                  userlist->buddy_icon_window);
 	}
 }
 
@@ -1039,10 +1023,9 @@
 		userlist = user->userlist;
 		queue = userlist->buddy_icon_requests;
 
-#ifdef MSN_DEBUG_UD
-		purple_debug_info("msn", "Queueing buddy icon request for %s (buddy_icon_window = %i)\n",
-						user->passport, userlist->buddy_icon_window);
-#endif
+		if (purple_debug_is_verbose())
+			purple_debug_info("msn", "Queueing buddy icon request for %s (buddy_icon_window = %i)\n",
+			                  user->passport, userlist->buddy_icon_window);
 
 		g_queue_push_tail(queue, user);
 
@@ -1062,9 +1045,8 @@
 	g_return_if_fail(slpcall != NULL);
 
 	info = slpcall->data_info;
-#ifdef MSN_DEBUG_UD
-	purple_debug_info("msn", "Got User Display: %s\n", slpcall->slplink->remote_user);
-#endif
+	if (purple_debug_is_verbose())
+		purple_debug_info("msn", "Got User Display: %s\n", slpcall->slplink->remote_user);
 
 	userlist = slpcall->slplink->session->userlist;
 	account = slpcall->slplink->session->account;
@@ -1090,9 +1072,8 @@
 
 	g_return_if_fail(session != NULL);
 
-#ifdef MSN_DEBUG_UD
-	purple_debug_info("msn", "End User Display\n");
-#endif
+	if (purple_debug_is_verbose())
+		purple_debug_info("msn", "End User Display\n");
 
 	userlist = session->userlist;
 
@@ -1150,9 +1131,8 @@
 		gconstpointer data = NULL;
 		size_t len = 0;
 
-#ifdef MSN_DEBUG_UD
-		purple_debug_info("msn", "Requesting our own user display\n");
-#endif
+		if (purple_debug_is_verbose())
+			purple_debug_info("msn", "Requesting our own user display\n");
 
 		my_obj = msn_user_get_object(session->user);
 
@@ -1168,10 +1148,9 @@
 		/* Free one window slot */
 		session->userlist->buddy_icon_window++;
 
-#ifdef MSN_DEBUG_UD
-		purple_debug_info("msn", "request_user_display(): buddy_icon_window++ yields =%d\n",
-						session->userlist->buddy_icon_window);
-#endif
+		if (purple_debug_is_verbose())
+			purple_debug_info("msn", "request_user_display(): buddy_icon_window++ yields =%d\n",
+			                  session->userlist->buddy_icon_window);
 
 		msn_release_buddy_icon_request(session->userlist);
 	}