ucs: fix Persona key extraction
[siplcs.git] / src / miranda / miranda-debug.c
blobd043f402527889489f64381bf0cf16563b6d1803
1 /**
2 * @file miranda-debug.c
4 * pidgin-sipe
6 * Copyright (C) 2010-11 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 <windows.h>
24 #include <process.h>
25 #include <stdio.h>
27 #include <glib.h>
29 #include "newpluginapi.h"
30 #include "m_protosvc.h"
31 #include "m_protoint.h"
32 #include "m_netlib.h"
34 #include "sipe-backend.h"
35 #include "miranda-private.h"
37 extern HANDLE sipe_miranda_incoming_netlibuser;
38 extern CRITICAL_SECTION sipe_miranda_debug_CriticalSection;
40 void sipe_backend_debug_literal(sipe_debug_level level,
41 const gchar *message)
43 if (sipe_miranda_incoming_netlibuser)
45 gchar *msg = g_strdup_printf("[%5d] %s", GetCurrentThreadId(), message);
46 EnterCriticalSection(&sipe_miranda_debug_CriticalSection);
47 CallService(MS_NETLIB_LOG, (WPARAM)sipe_miranda_incoming_netlibuser, (LPARAM)msg);
48 LeaveCriticalSection(&sipe_miranda_debug_CriticalSection);
49 g_free(msg);
53 void sipe_backend_debug(sipe_debug_level level,
54 const gchar *format,
55 ...) G_GNUC_PRINTF(2, 3)
57 va_list ap;
59 va_start(ap,format);
61 if (sipe_backend_debug_enabled()) {
62 gchar *msg = g_strdup_vprintf(format, ap);
63 sipe_backend_debug_literal(level, msg);
64 g_free(msg);
67 va_end(ap);
70 gboolean sipe_backend_debug_enabled(void)
72 return TRUE;
76 Local Variables:
77 mode: c
78 c-file-style: "bsd"
79 indent-tabs-mode: t
80 tab-width: 8
81 End: