l10n: sync translations with transifex.com
[siplcs.git] / src / purple / purple-debug.c
blob4a0075d4b2a6fb7fd793c53346ec21990f960894
1 /**
2 * @file purple-debug.c
4 * pidgin-sipe
6 * Copyright (C) 2010-2015 SIPE Project <http://sipe.sourceforge.net/>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include <stdarg.h>
25 #include "glib.h"
26 #include "debug.h"
28 #include "sipe-backend.h"
30 #ifdef ADIUM
32 * libpurple uses g_print() and PurpleDebugUiOps->debug() when
33 * purple_debug_is_enabled() returns TRUE. Both are redirected
34 * by Adium to AILog(). To avoid duplicated log lines Adium
35 * therefore never calls purple_debug_set_enabled(TRUE).
37 gboolean AIDebugLoggingIsEnabled(void);
38 #define SIPE_PURPLE_DEBUG_IS_ENABLED AIDebugLoggingIsEnabled()
39 #else
40 #define SIPE_PURPLE_DEBUG_IS_ENABLED purple_debug_is_enabled()
41 #endif
43 void sipe_backend_debug_literal(sipe_debug_level level,
44 const gchar *msg)
46 if (SIPE_PURPLE_DEBUG_IS_ENABLED) {
48 /* purple_debug doesn't have a vprintf-like API call :-( */
49 switch (level) {
50 case SIPE_DEBUG_LEVEL_INFO:
51 purple_debug_info("sipe", "%s\n", msg);
52 break;
53 case SIPE_DEBUG_LEVEL_WARNING:
54 purple_debug_warning("sipe", "%s\n", msg);
55 break;
56 case SIPE_DEBUG_LEVEL_ERROR:
57 purple_debug_error("sipe", "%s\n", msg);
58 break;
63 void sipe_backend_debug(sipe_debug_level level,
64 const gchar *format,
65 ...)
67 va_list ap;
69 va_start(ap, format);
71 if (SIPE_PURPLE_DEBUG_IS_ENABLED) {
73 /* purple_debug doesn't have a vprintf-like API call :-( */
74 gchar *msg = g_strdup_vprintf(format, ap);
75 sipe_backend_debug_literal(level, msg);
76 g_free(msg);
79 va_end(ap);
82 gboolean sipe_backend_debug_enabled(void)
84 return SIPE_PURPLE_DEBUG_IS_ENABLED;
88 Local Variables:
89 mode: c
90 c-file-style: "bsd"
91 indent-tabs-mode: t
92 tab-width: 8
93 End: