/pidgin/main: 0f1f0b8c84f8: Fix some debug log warnings, adjust ...

Tomasz Wasilczyk tomkiewicz at cpw.pidgin.im
Fri Aug 16 05:12:34 EDT 2013


Changeset: 0f1f0b8c84f8a3623e8d1365f1c4e19d6ec6a122
Author:	 Tomasz Wasilczyk <tomkiewicz at cpw.pidgin.im>
Date:	 2013-08-16 11:12 +0200
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/0f1f0b8c84f8

Description:

Fix some debug log warnings, adjust verbosity level

diffstat:

 libpurple/core.c                        |  25 +++++++++++++++++++++++++
 libpurple/dbus-server.c                 |   5 +++--
 libpurple/keyring.c                     |   4 ++--
 libpurple/prefs.c                       |   5 +++--
 libpurple/protocols/jabber/data.c       |   6 ++++--
 libpurple/protocols/jabber/jabber.c     |   4 ++--
 libpurple/protocols/mxit/mxit.c         |   4 ----
 libpurple/protocols/myspace/myspace.c   |   2 --
 libpurple/protocols/sametime/sametime.c |  17 +++--------------
 libpurple/util.c                        |   4 ++--
 libpurple/xmlnode.c                     |   2 +-
 pidgin/gtkprefs.c                       |  20 ++++++++++++--------
 pidgin/gtksession.c                     |  24 +++++++++++++++++-------
 13 files changed, 74 insertions(+), 48 deletions(-)

diffs (truncated from 351 to 300 lines):

diff --git a/libpurple/core.c b/libpurple/core.c
--- a/libpurple/core.c
+++ b/libpurple/core.c
@@ -78,6 +78,29 @@ static PurpleCore      *_core = NULL;
 
 STATIC_PROTO_INIT
 
+static void
+purple_core_print_version(void)
+{
+	GHashTable *ui_info = purple_core_get_ui_info();
+	const gchar *ui_name;
+	const gchar *ui_version;
+	gchar *ui_full_name = NULL;
+
+	ui_name = ui_info ? g_hash_table_lookup(ui_info, "name") : NULL;
+	ui_version = ui_info ? g_hash_table_lookup(ui_info, "version") : NULL;
+
+	if (ui_name) {
+		ui_full_name = g_strdup_printf("%s%s%s", ui_name,
+			ui_version ? " " : "", ui_version);
+	}
+
+	purple_debug_info("main", "Launching %s%slibpurple %s",
+		ui_full_name ? ui_full_name : "",
+		ui_full_name ? " with " : "",
+		purple_core_get_version());
+
+}
+
 gboolean
 purple_core_init(const char *ui)
 {
@@ -120,6 +143,8 @@ purple_core_init(const char *ui)
 	purple_signal_register(core, "quitting", purple_marshal_VOID, NULL, 0);
 	purple_signal_register(core, "core-initialized", purple_marshal_VOID, NULL, 0);
 
+	purple_core_print_version();
+
 	/* The prefs subsystem needs to be initialized before static protocols
 	 * for protocol prefs to work. */
 	purple_prefs_init();
diff --git a/libpurple/dbus-server.c b/libpurple/dbus-server.c
--- a/libpurple/dbus-server.c
+++ b/libpurple/dbus-server.c
@@ -626,8 +626,6 @@ purple_dbus_dispatch_init(void)
 
 	dbus_connection_setup_with_g_main(purple_dbus_connection, NULL);
 
-	purple_debug_misc("dbus", "okkk\n");
-
 	purple_signal_register(purple_dbus_get_handle(), "dbus-method-called",
 			 purple_marshal_BOOLEAN__POINTER_POINTER,
 			 purple_value_new(PURPLE_TYPE_BOOLEAN), 2,
@@ -639,6 +637,9 @@ purple_dbus_dispatch_init(void)
 			 purple_value_new_outgoing(PURPLE_TYPE_POINTER));
 
 	PURPLE_DBUS_REGISTER_BINDINGS(purple_dbus_get_handle());
+
+	if (purple_debug_is_verbose())
+		purple_debug_misc("dbus", "initialized");
 }
 
 
diff --git a/libpurple/keyring.c b/libpurple/keyring.c
--- a/libpurple/keyring.c
+++ b/libpurple/keyring.c
@@ -478,8 +478,8 @@ purple_keyring_register(PurpleKeyring *k
 	/* If this is the configured keyring, use it. */
 	if (purple_keyring_inuse == NULL &&
 		g_strcmp0(keyring_id, purple_keyring_to_use) == 0) {
-		purple_debug_info("keyring", "Keyring %s matches keyring to "
-			"use, using it.\n", keyring_id);
+		purple_debug_misc("keyring", "Keyring %s matches keyring to "
+			"use, using it.", keyring_id);
 		purple_keyring_set_inuse(keyring, TRUE, NULL, NULL);
 	}
 
diff --git a/libpurple/prefs.c b/libpurple/prefs.c
--- a/libpurple/prefs.c
+++ b/libpurple/prefs.c
@@ -386,7 +386,7 @@ purple_prefs_load()
 		return FALSE;
 	}
 
-	purple_debug_info("prefs", "Reading %s\n", filename);
+	purple_debug_misc("prefs", "Reading %s", filename);
 
 	if(!g_file_get_contents(filename, &contents, &length, &error)) {
 #ifdef _WIN32
@@ -438,7 +438,8 @@ purple_prefs_load()
 		return FALSE;
 	}
 
-	purple_debug_info("prefs", "Finished reading %s\n", filename);
+	if (purple_debug_is_verbose())
+		purple_debug_misc("prefs", "Finished reading %s", filename);
 	g_markup_parse_context_free(context);
 	g_free(contents);
 	g_free(filename);
diff --git a/libpurple/protocols/jabber/data.c b/libpurple/protocols/jabber/data.c
--- a/libpurple/protocols/jabber/data.c
+++ b/libpurple/protocols/jabber/data.c
@@ -437,7 +437,8 @@ jabber_data_parse(JabberStream *js, cons
 void
 jabber_data_init(void)
 {
-	purple_debug_info("jabber", "creating hash tables for data objects\n");
+	if (purple_debug_is_verbose())
+		purple_debug_misc("jabber", "creating hash tables for data objects");
 	local_data_by_alt = g_hash_table_new_full(g_str_hash, g_str_equal,
 		g_free, NULL);
 	local_data_by_cid = g_hash_table_new_full(g_str_hash, g_str_equal,
@@ -451,7 +452,8 @@ jabber_data_init(void)
 void
 jabber_data_uninit(void)
 {
-	purple_debug_info("jabber", "destroying hash tables for data objects\n");
+	if (purple_debug_is_verbose())
+		purple_debug_info("jabber", "destroying hash tables for data objects");
 	g_hash_table_destroy(local_data_by_alt);
 	g_hash_table_destroy(local_data_by_cid);
 	g_hash_table_destroy(remote_data_by_cid);
diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c
--- a/libpurple/protocols/jabber/jabber.c
+++ b/libpurple/protocols/jabber/jabber.c
@@ -656,7 +656,7 @@ jabber_recv_cb_ssl(gpointer data, Purple
 	while((len = purple_ssl_read(gsc, buf, sizeof(buf) - 1)) > 0) {
 		purple_connection_update_last_received(gc);
 		buf[len] = '\0';
-		purple_debug_info("jabber", "Recv (ssl)(%d): %s\n", len, buf);
+		purple_debug_misc("jabber", "Recv (ssl)(%d): %s", len, buf);
 		jabber_parser_process(js, buf, len);
 		if(js->reinit)
 			jabber_stream_init(js);
@@ -716,7 +716,7 @@ jabber_recv_cb(gpointer data, gint sourc
 		}
 #endif
 		buf[len] = '\0';
-		purple_debug_info("jabber", "Recv (%d): %s\n", len, buf);
+		purple_debug_misc("jabber", "Recv (%d): %s", len, buf);
 		jabber_parser_process(js, buf, len);
 		if(js->reinit)
 			jabber_stream_init(js);
diff --git a/libpurple/protocols/mxit/mxit.c b/libpurple/protocols/mxit/mxit.c
--- a/libpurple/protocols/mxit/mxit.c
+++ b/libpurple/protocols/mxit/mxit.c
@@ -487,8 +487,6 @@ static void mxit_free_buddy( PurpleBuddy
 {
 	struct contact*		contact;
 
-	purple_debug_info( MXIT_PLUGIN_ID, "mxit_free_buddy\n" );
-
 	contact = purple_buddy_get_protocol_data( buddy );
 	if ( contact ) {
 		if ( contact->statusMsg )
@@ -844,8 +842,6 @@ static void init_plugin( PurplePlugin* p
 {
 	PurpleAccountOption*	option;
 
-	purple_debug_info( MXIT_PLUGIN_ID, "Loading MXit libPurple plugin...\n" );
-
 	/* Configuration options */
 
 	/* WAP server (reference: "libpurple/accountopt.h") */
diff --git a/libpurple/protocols/myspace/myspace.c b/libpurple/protocols/myspace/myspace.c
--- a/libpurple/protocols/myspace/myspace.c
+++ b/libpurple/protocols/myspace/myspace.c
@@ -458,8 +458,6 @@ msim_status_types(PurpleAccount *acct)
 	GList *types;
 	PurpleStatusType *status;
 
-	purple_debug_info("myspace", "returning status types\n");
-
 	types = NULL;
 
 	/* Statuses are almost all the same. Define a macro to reduce code repetition. */
diff --git a/libpurple/protocols/sametime/sametime.c b/libpurple/protocols/sametime/sametime.c
--- a/libpurple/protocols/sametime/sametime.c
+++ b/libpurple/protocols/sametime/sametime.c
@@ -5163,7 +5163,7 @@ static PurplePluginProtocolInfo mw_prpl_
   NULL
 };
 
-
+#if 0
 static PurplePluginPrefFrame *
 mw_plugin_get_plugin_pref_frame(PurplePlugin *plugin) {
   PurplePluginPrefFrame *frame;
@@ -5192,18 +5192,7 @@ mw_plugin_get_plugin_pref_frame(PurplePl
 
   return frame;
 }
-
-
-static PurplePluginUiInfo mw_plugin_ui_info = {
-  mw_plugin_get_plugin_pref_frame,
-  0,    /* page_num */
-  NULL, /* frame */
-  NULL,
-  NULL,
-  NULL,
-  NULL
-};
-
+#endif
 
 static void st_import_action_cb(PurpleConnection *gc, char *filename) {
   struct mwSametimeList *l;
@@ -5707,7 +5696,7 @@ static PurplePluginInfo mw_plugin_info =
 
 	NULL,                                             /**< ui_info        */
 	&mw_prpl_info,                                    /**< extra_info     */
-	&mw_plugin_ui_info,                               /**< prefs_info     */
+	NULL,                                             /**< prefs_info     */
 	mw_plugin_actions,
 
 	/* padding */
diff --git a/libpurple/util.c b/libpurple/util.c
--- a/libpurple/util.c
+++ b/libpurple/util.c
@@ -2942,7 +2942,7 @@ purple_util_write_data_to_file(const cha
 
 	g_return_val_if_fail(user_dir != NULL, FALSE);
 
-	purple_debug_info("util", "Writing file %s to directory %s\n",
+	purple_debug_misc("util", "Writing file %s to directory %s",
 					filename, user_dir);
 
 	/* Ensure the user directory exists */
@@ -2975,7 +2975,7 @@ purple_util_write_data_to_file_absolute(
 	int fd;
 #endif
 
-	purple_debug_info("util", "Writing file %s\n",
+	purple_debug_misc("util", "Writing file %s",
 					filename_full);
 
 	g_return_val_if_fail((size >= -1), FALSE);
diff --git a/libpurple/xmlnode.c b/libpurple/xmlnode.c
--- a/libpurple/xmlnode.c
+++ b/libpurple/xmlnode.c
@@ -835,7 +835,7 @@ xmlnode_from_file(const char *dir,const 
 
 	g_return_val_if_fail(dir != NULL, NULL);
 
-	purple_debug_info(process, "Reading file %s from directory %s\n",
+	purple_debug_misc(process, "Reading file %s from directory %s\n",
 					filename, dir);
 
 	filename_full = g_build_filename(dir, filename, NULL);
diff --git a/pidgin/gtkprefs.c b/pidgin/gtkprefs.c
--- a/pidgin/gtkprefs.c
+++ b/pidgin/gtkprefs.c
@@ -4285,8 +4285,6 @@ pidgin_prefs_init(void)
 void
 pidgin_prefs_update_old(void)
 {
-	const char *str = NULL;
-
 	/* Rename some old prefs */
 	purple_prefs_rename(PIDGIN_PREFS_ROOT "/logging/log_ims", "/purple/logging/log_ims");
 	purple_prefs_rename(PIDGIN_PREFS_ROOT "/logging/log_chats", "/purple/logging/log_chats");
@@ -4299,13 +4297,19 @@ pidgin_prefs_update_old(void)
 									 PIDGIN_PREFS_ROOT "/conversations/show_incoming_formatting");
 
 	/*
-	 * this path pref changed to a string, so migrate.  I know this will break
-	 * things for and confuse users that use multiple versions with the same
-	 * config directory, but I'm not inclined to want to deal with that at the
-	 * moment. -- rekkanoryo
+	 * This path pref changed to a string, so migrate. I know this will
+	 * break things for and confuse users that use multiple versions with
+	 * the same config directory, but I'm not inclined to want to deal with
+	 * that at the moment. -- rekkanoryo
 	 */
-	if((str = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/browsers/command")) != NULL) {
-		purple_prefs_set_string(PIDGIN_PREFS_ROOT "/browsers/manual_command", str);
+	if (purple_prefs_exists(PIDGIN_PREFS_ROOT "/browsers/command") &&
+		purple_prefs_get_type(PIDGIN_PREFS_ROOT "/browsers/command") ==
+			PURPLE_PREF_PATH)
+	{
+		const char *str = purple_prefs_get_path(
+			PIDGIN_PREFS_ROOT "/browsers/command");
+		purple_prefs_set_string(
+			PIDGIN_PREFS_ROOT "/browsers/manual_command", str);
 		purple_prefs_remove(PIDGIN_PREFS_ROOT "/browsers/command");
 	}
 
diff --git a/pidgin/gtksession.c b/pidgin/gtksession.c
--- a/pidgin/gtksession.c
+++ b/pidgin/gtksession.c
@@ -72,7 +72,10 @@ static void ice_process_messages(gpointe
 		IceSetShutdownNegotiation(conninfo->connection, False);
 		IceCloseConnection(conninfo->connection);
 
-		purple_debug(PURPLE_DEBUG_INFO, NULL, "done.\n");
+		if (purple_debug_is_verbose()) {
+			purple_debug_misc("Session Management",
+				"Connection closed.");



More information about the Commits mailing list