Mercurial > pidgin.yaz
diff libpurple/debug.c @ 27379:a22ef93d6aec
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.
author | John Bailey <rekkanoryo@rekkanoryo.org> |
---|---|
date | Sat, 04 Jul 2009 19:01:16 +0000 |
parents | 6bf32c9e15a7 |
children | f1437342cc0e |
line wrap: on
line diff
--- a/libpurple/debug.c Sat Jul 04 17:19:00 2009 +0000 +++ b/libpurple/debug.c Sat Jul 04 19:01:16 2009 +0000 @@ -36,12 +36,20 @@ * * 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 @@ 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 @@ 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_prefs_add_bool("/purple/debug/timestamps", TRUE); } +