pidgin: fd042fd7: Move the handling of PURPLE_UNSAFE_DEBUG...
rekkanoryo at pidgin.im
rekkanoryo at pidgin.im
Sat Jul 4 22:31:15 EDT 2009
-----------------------------------------------------------------
Revision: fd042fd7c9690d11988649389cdf668c9405959a
Ancestor: a13d4cf459814135e90c2742ee21f605404005e3
Author: rekkanoryo at pidgin.im
Date: 2009-07-04T19:01:16
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/fd042fd7c9690d11988649389cdf668c9405959a
Modified files:
libpurple/debug.c libpurple/debug.h
ChangeLog:
Move the handling of PURPLE_UNSAFE_DEBUG to purple_debug_init(). Also add
handling for PURPLE_VERBOSE_DEBUG, as Sadrul and I briefly discussed, which
we should use instead of requiring building with the --enable-debug configure
argument just to get extra output.
-------------- next part --------------
============================================================
--- libpurple/debug.c ce215f5ef4e64c3f7157fc4eb3b567f8693cbe35
+++ libpurple/debug.c 5b5d446387f516746ddb8aae9bffbf6e52da1e57
@@ -36,12 +36,20 @@ static PurpleDebugUiOps *debug_ui_ops =
*
* It doesn't make sense to make this a normal Purple preference
* because it's a command line option. This will always be FALSE,
- * unless the user explicitly started Purple with the -d flag.
+ * unless the user explicitly started the UI with the -d flag.
* It doesn't matter what this value was the last time Purple was
* started, so it doesn't make sense to save it in prefs.
*/
static gboolean debug_enabled = FALSE;
+/*
+ * These determine whether verbose or unsafe debugging are desired. I
+ * don't want to make these purple preferences because their values should
+ * not be remembered across instances of the UI.
+ */
+static gboolean debug_verbose = FALSE;
+static gboolean debug_unsafe = FALSE;
+
static void
purple_debug_vargs(PurpleDebugLevel level, const char *category,
const char *format, va_list args)
@@ -175,6 +183,30 @@ purple_debug_set_ui_ops(PurpleDebugUiOps
debug_ui_ops = ops;
}
+gboolean
+purple_debug_is_verbose()
+{
+ return debug_verbose;
+}
+
+void
+purple_debug_set_verbose(gboolean verbose)
+{
+ debug_verbose = verbose;
+}
+
+gboolean
+purple_debug_is_unsafe()
+{
+ return debug_unsafe;
+}
+
+void
+purple_debug_set_unsafe(gboolean unsafe)
+{
+ debug_unsafe = unsafe;
+}
+
PurpleDebugUiOps *
purple_debug_get_ui_ops(void)
{
@@ -184,6 +216,13 @@ purple_debug_init(void)
void
purple_debug_init(void)
{
+ /* Read environment variables once per init */
+ if(g_getenv("PURPLE_UNSAFE_DEBUG"))
+ purple_debug_set_unsafe(TRUE);
+
+ if(g_getenv("PURPLE_VERBOSE_DEBUG"))
+ purple_debug_set_verbose(TRUE);
+
purple_prefs_add_none("/purple/debug");
/*
@@ -193,3 +232,4 @@ purple_debug_init(void)
*/
purple_prefs_add_bool("/purple/debug/timestamps", TRUE);
}
+
============================================================
--- libpurple/debug.h 29b9035be2581e217342ad2b54a7afd3d0463d56
+++ libpurple/debug.h 17925ca43f7aa7b19914be5b1093f97ff3d99ac2
@@ -151,10 +151,50 @@ void purple_debug_set_enabled(gboolean e
/**
* Check if console debug output is enabled.
*
- * @return TRUE if debuggin is enabled, FALSE if it is not.
+ * @return TRUE if debugging is enabled, FALSE if it is not.
*/
gboolean purple_debug_is_enabled(void);
+/**
+ * Enable or disable verbose debugging. This ordinarily should only be called
+ * by #purple_debug_init, but there are cases where this can be useful for
+ * plugins.
+ *
+ * @param verbose TRUE to enable verbose debugging or FALSE to disable it.
+ *
+ * @since 2.6.0
+ */
+void purple_debug_set_verbose(gboolean verbose);
+
+/**
+ * Check if verbose logging is enabled.
+ *
+ * @return TRUE if verbose debugging is enabled, FALSE if it is not.
+ *
+ * @since 2.6.0
+ */
+gboolean purple_debug_is_verbose(void);
+
+/**
+ * Enable or disable verbose debugging. This ordinarily should only be called
+ * by #purple_debug_init, but there are cases where this can be useful for
+ * plugins.
+ *
+ * @param unsafe TRUE to enable verbose debugging or FALSE to disable it.
+ *
+ * @since 2.6.0
+ */
+void purple_debug_set_unsafe(gboolean unsafe);
+
+/**
+ * Check if unsafe debugging is enabled.
+ *
+ * @return TRUE if verbose debugging is enabled, FALSE if it is not.
+ *
+ * @since 2.6.0
+ */
+gboolean purple_debug_is_unsafe(void);
+
/*@}*/
/**************************************************************************/
More information about the Commits
mailing list