summaryrefslogtreecommitdiff
path: root/libpurple/debug.c
diff options
context:
space:
mode:
authorJohn Bailey <rekkanoryo@rekkanoryo.org>2009-07-04 19:01:16 +0000
committerJohn Bailey <rekkanoryo@rekkanoryo.org>2009-07-04 19:01:16 +0000
commitcb281bb3ac8c3a12b7f0dc6787f3e37968ceccda (patch)
tree23a8880b85ec413454bd43d8367c6f823603d05b /libpurple/debug.c
parent4c65d8ebbd43fe6493d0e998a1ac64485c2a3c71 (diff)
downloadpidgin-cb281bb3ac8c3a12b7f0dc6787f3e37968ceccda.tar.gz
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.
Diffstat (limited to 'libpurple/debug.c')
-rw-r--r--libpurple/debug.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/libpurple/debug.c b/libpurple/debug.c
index 3682c9e708..30b12fdb55 100644
--- a/libpurple/debug.c
+++ b/libpurple/debug.c
@@ -36,12 +36,20 @@ static PurpleDebugUiOps *debug_ui_ops = NULL;
*
* 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 *ops)
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_get_ui_ops(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);
}
+