From 0171ce68e51e1e7836d3b6acf1f8d53d3b3c4ff2 Mon Sep 17 00:00:00 2001 From: Stefan Becker Date: Wed, 24 Mar 2010 23:35:56 +0200 Subject: [PATCH] core cleanup: debug replacement Only sipe.c to left to go... --- src/core/http-conn.c | 36 ++++++++++++++++++------------------ src/core/sip-sec-ntlm.c | 38 +++++++++++++++++++------------------- src/core/sip-sec-sspi.c | 7 +++---- src/core/sipe-ews.c | 35 +++++++++++++++++------------------ src/core/sipe-ft.c | 26 +++++++++++++------------- src/purple/tests.c | 5 +++-- 6 files changed, 73 insertions(+), 74 deletions(-) diff --git a/src/core/http-conn.c b/src/core/http-conn.c index 62fe96eb..c18f980d 100644 --- a/src/core/http-conn.c +++ b/src/core/http-conn.c @@ -37,7 +37,6 @@ #include #include "account.h" -#include "debug.h" #include "eventloop.h" #include "network.h" #include "sslconn.h" @@ -45,6 +44,7 @@ #include "sipe-common.h" #include "sipmsg.h" #include "sip-sec.h" +#include "sipe-backend.h" #include "sipe-utils.h" #include "http-conn.h" #include "sipe.h" @@ -157,7 +157,7 @@ http_conn_invalidate_ssl_connection(HttpConn *http_conn); static void http_conn_close(HttpConn *http_conn, const char *message) { - purple_debug_info("sipe-http", "http_conn_close: closing http connection: %s\n", message ? message : ""); + SIPE_DEBUG_INFO("http_conn_close: closing http connection: %s", message ? message : ""); http_conn_invalidate_ssl_connection(http_conn); http_conn_free(http_conn); @@ -266,7 +266,7 @@ http_conn_input_cb_ssl(gpointer data, gboolean firstread = TRUE; if (conn == NULL) { - purple_debug_error("sipe-http", "Connection not found; Please try to connect again.\n"); + SIPE_DEBUG_ERROR_NOFORMAT("Connection not found; Please try to connect again."); return; } @@ -276,7 +276,7 @@ http_conn_input_cb_ssl(gpointer data, if (conn->inbuflen < conn->inbufused + SIMPLE_BUF_INC) { conn->inbuflen += SIMPLE_BUF_INC; conn->inbuf = g_realloc(conn->inbuf, conn->inbuflen); - purple_debug_info("sipe-http", "http_conn_input_cb_ssl: new input buffer length %d\n", conn->inbuflen); + SIPE_DEBUG_INFO("http_conn_input_cb_ssl: new input buffer length %d", conn->inbuflen); } /* Try to read as much as there is space left in the buffer */ @@ -346,13 +346,13 @@ http_conn_create(PurpleAccount *account, HttpConn *http_conn; if (!full_url || (strlen(full_url) == 0)) { - purple_debug_info("sipe-http", "no URL supplied!\n"); + SIPE_DEBUG_INFO_NOFORMAT("no URL supplied!"); return NULL; } if (sipe_strequal(conn_type, HTTP_CONN_SSL) && !purple_ssl_is_supported()) { - purple_debug_info("sipe-http", "SSL support is not installed. Either install SSL support or configure a different connection type in the account editor\n"); + SIPE_DEBUG_INFO_NOFORMAT("SSL support is not installed. Either install SSL support or configure a different connection type in the account editor."); return NULL; } @@ -407,7 +407,7 @@ http_conn_process_input(HttpConn *http_conn) time_t currtime = time(NULL); cur += 2; cur[0] = '\0'; - purple_debug_info("sipe-http", "received - %s******\n%s\n******\n", ctime(&currtime), tmp = fix_newlines(conn->inbuf)); + SIPE_DEBUG_INFO("received - %s******\n%s\n******", ctime(&currtime), tmp = fix_newlines(conn->inbuf)); g_free(tmp); msg = sipmsg_parse_header(conn->inbuf); @@ -424,14 +424,14 @@ http_conn_process_input(HttpConn *http_conn) conn->inbufused = strlen(conn->inbuf); } else { if (msg){ - purple_debug_info("sipe-http", "process_input: body too short (%d < %d, strlen %d) - ignoring message\n", restlen, msg->bodylen, (int)strlen(conn->inbuf)); + SIPE_DEBUG_INFO("process_input: body too short (%d < %d, strlen %d) - ignoring message", restlen, msg->bodylen, (int)strlen(conn->inbuf)); sipmsg_free(msg); } return; } if (msg->body) { - purple_debug_info("sipe-http", "body:\n%s\n", msg->body); + SIPE_DEBUG_INFO("body:\n%s", msg->body); } http_conn_process_input_message(http_conn, msg); @@ -453,11 +453,11 @@ http_conn_sendout_pkt(HttpConn *http_conn, char *tmp; int ret = 0; - purple_debug(PURPLE_DEBUG_MISC, "sipe-http", "sending - %s******\n%s\n******\n", ctime(&currtime), tmp = fix_newlines(buf)); + SIPE_DEBUG_INFO("sending - %s******\n%s\n******", ctime(&currtime), tmp = fix_newlines(buf)); g_free(tmp); if (http_conn->fd < 0) { - purple_debug_info("sipe-http", "http_conn_sendout_pkt: http_conn->fd < 0, exiting\n"); + SIPE_DEBUG_INFO_NOFORMAT("http_conn_sendout_pkt: http_conn->fd < 0, exiting"); return; } @@ -468,12 +468,12 @@ http_conn_sendout_pkt(HttpConn *http_conn, if (ret < 0 && errno == EAGAIN) ret = 0; else if (ret <= 0) { /* XXX: When does this happen legitimately? */ - purple_debug_info("sipe-http", "http_conn_sendout_pkt: ret <= 0, exiting\n"); + SIPE_DEBUG_INFO_NOFORMAT("http_conn_sendout_pkt: ret <= 0, exiting"); return; } if (ret < writelen) { - purple_debug_info("sipe-http", "http_conn_sendout_pkt: ret < writelen, exiting\n"); + SIPE_DEBUG_INFO_NOFORMAT("http_conn_sendout_pkt: ret < writelen, exiting"); } } @@ -506,7 +506,7 @@ http_conn_post( HttpConn *http_conn, void *data) { if (!http_conn) { - purple_debug_info("sipe-http", "http_conn_post: NULL http_conn, exiting.\n"); + SIPE_DEBUG_INFO_NOFORMAT("http_conn_post: NULL http_conn, exiting."); return; } @@ -534,7 +534,7 @@ http_conn_process_input_message(HttpConn *http_conn, { const char *location = sipmsg_find_header(msg, "Location"); - purple_debug_info("sipe-http", "http_conn_process_input_message: Redirect to: %s\n", location ? location : ""); + SIPE_DEBUG_INFO("http_conn_process_input_message: Redirect to: %s", location ? location : ""); http_conn->do_close = http_conn_clone(http_conn); http_conn->sec_ctx = NULL; @@ -571,7 +571,7 @@ http_conn_process_input_message(HttpConn *http_conn, if (http_conn->callback) { (*http_conn->callback)(HTTP_CONN_ERROR_FATAL, NULL, http_conn, http_conn->data); } - purple_debug_info("sipe-http", "http_conn_process_input_message: Authentication failed\n"); + SIPE_DEBUG_INFO_NOFORMAT("http_conn_process_input_message: Authentication failed"); http_conn_set_close(http_conn); return; } @@ -590,7 +590,7 @@ http_conn_process_input_message(HttpConn *http_conn, #endif #endif if (!ptmp) { - purple_debug_info("sipe-http", "http_conn_process_input_message: Only %s supported in the moment, exiting\n", + SIPE_DEBUG_INFO("http_conn_process_input_message: Only %s supported in the moment, exiting", #ifdef _WIN32 #ifdef HAVE_KERBEROS "NTLM and Negotiate authentications are" @@ -630,7 +630,7 @@ http_conn_process_input_message(HttpConn *http_conn, if (http_conn->callback) { (*http_conn->callback)(HTTP_CONN_ERROR_FATAL, NULL, http_conn, http_conn->data); } - purple_debug_info("sipe-http", "http_conn_process_input_message: Failed to initialize security context\n"); + SIPE_DEBUG_INFO_NOFORMAT("http_conn_process_input_message: Failed to initialize security context"); http_conn_set_close(http_conn); return; } diff --git a/src/core/sip-sec-ntlm.c b/src/core/sip-sec-ntlm.c index 7f539eaa..ed2ba4f6 100644 --- a/src/core/sip-sec-ntlm.c +++ b/src/core/sip-sec-ntlm.c @@ -56,12 +56,12 @@ #endif /* HAVE_LANGINFO_CODESET */ #include "cipher.h" -#include "debug.h" #include "sipe-common.h" #include "sip-sec.h" #include "sip-sec-mech.h" #include "sip-sec-ntlm.h" +#include "sipe-backend.h" #include "sipe-utils.h" /* [MS-NLMP] */ @@ -797,13 +797,13 @@ SEALKEY (guint32 flags, const unsigned char * random_session_key, gboolean clien int key_len; if (IS_FLAG(flags, NTLMSSP_NEGOTIATE_128)) { - purple_debug_info("sipe", "NTLM SEALKEY(): 128-bit key (Extended session security)\n"); + SIPE_DEBUG_INFO_NOFORMAT("NTLM SEALKEY(): 128-bit key (Extended session security)"); key_len = 16; } else if (IS_FLAG(flags, NTLMSSP_NEGOTIATE_56)) { - purple_debug_info("sipe", "NTLM SEALKEY(): 56-bit key (Extended session security)\n"); + SIPE_DEBUG_INFO_NOFORMAT("NTLM SEALKEY(): 56-bit key (Extended session security)"); key_len = 7; } else { - purple_debug_info("sipe", "NTLM SEALKEY(): 40-bit key (Extended session security)\n"); + SIPE_DEBUG_INFO_NOFORMAT("NTLM SEALKEY(): 40-bit key (Extended session security)"); key_len = 5; } @@ -815,11 +815,11 @@ SEALKEY (guint32 flags, const unsigned char * random_session_key, gboolean clien else if (IS_FLAG(flags, NTLMSSP_NEGOTIATE_LM_KEY)) /* http://davenport.sourceforge.net/ntlm.html#ntlm1KeyWeakening */ { if (IS_FLAG(flags, NTLMSSP_NEGOTIATE_56)) { - purple_debug_info("sipe", "NTLM SEALKEY(): 56-bit key\n"); + SIPE_DEBUG_INFO_NOFORMAT("NTLM SEALKEY(): 56-bit key"); memcpy(result, random_session_key, 7); result[7] = 0xA0; } else { - purple_debug_info("sipe", "NTLM SEALKEY(): 40-bit key\n"); + SIPE_DEBUG_INFO_NOFORMAT("NTLM SEALKEY(): 40-bit key"); memcpy(result, random_session_key, 5); result[5] = 0xE5; result[6] = 0x38; @@ -828,7 +828,7 @@ SEALKEY (guint32 flags, const unsigned char * random_session_key, gboolean clien } else { - purple_debug_info("sipe", "NTLM SEALKEY(): 128-bit key\n"); + SIPE_DEBUG_INFO_NOFORMAT("NTLM SEALKEY(): 128-bit key"); memcpy(result, random_session_key, 16); } } @@ -903,7 +903,7 @@ MAC (guint32 flags, memcpy(seal_key_, seal_key, seal_key_len); } - purple_debug_info("sipe", "NTLM MAC(): Extented Session Security\n"); + SIPE_DEBUG_INFO_NOFORMAT("NTLM MAC(): Extented Session Security"); res_ptr = (guint32 *)result; res_ptr[0] = GUINT32_TO_LE(1); // 4 bytes @@ -916,10 +916,10 @@ MAC (guint32 flags, HMAC_MD5(sign_key, sign_key_len, tmp, 4 + buf_len, hmac); if (IS_FLAG(flags, NTLMSSP_NEGOTIATE_KEY_EXCH)) { - purple_debug_info("sipe", "NTLM MAC(): Key Exchange\n"); + SIPE_DEBUG_INFO_NOFORMAT("NTLM MAC(): Key Exchange"); RC4K(seal_key_, seal_key_len, hmac, 8, result+4); } else { - purple_debug_info("sipe", "NTLM MAC(): *NO* Key Exchange\n"); + SIPE_DEBUG_INFO_NOFORMAT("NTLM MAC(): *NO* Key Exchange"); memcpy(result+4, hmac, 8); } } else { @@ -931,7 +931,7 @@ MAC (guint32 flags, GUINT32_TO_LE(sequence) }; // 4, 4, 4 bytes - purple_debug_info("sipe", "NTLM MAC(): *NO* Extented Session Security\n"); + SIPE_DEBUG_INFO_NOFORMAT("NTLM MAC(): *NO* Extented Session Security"); RC4K(seal_key, seal_key_len, (const guchar *)plaintext, 12, result+4); @@ -1060,7 +1060,7 @@ sip_sec_ntlm_gen_authenticate(guchar **client_sign_key, if (!IS_FLAG(*flags, NEGOTIATE_FLAGS_COMMON_MIN) || !(is_connection_based || IS_FLAG(*flags, NEGOTIATE_FLAGS_CONNLESS_EXTRA))) { - purple_debug_info("sipe", "sip_sec_ntlm_gen_authenticate: received incompatible NTLM NegotiateFlags, exiting."); + SIPE_DEBUG_INFO_NOFORMAT("sip_sec_ntlm_gen_authenticate: received incompatible NTLM NegotiateFlags, exiting."); return SIP_SEC_E_INTERNAL_ERROR; } @@ -1117,7 +1117,7 @@ sip_sec_ntlm_gen_authenticate(guchar **client_sign_key, } tmp = buff_to_hex_str(exported_session_key, 16); - purple_debug_info("sipe", "NTLM AUTHENTICATE: exported session key (not encrypted): %s\n", tmp); + SIPE_DEBUG_INFO("NTLM AUTHENTICATE: exported session key (not encrypted): %s", tmp); g_free(tmp); if (IS_FLAG(neg_flags, NTLMSSP_NEGOTIATE_SIGN) || @@ -1309,7 +1309,7 @@ sip_sec_ntlm_sipe_signature_make(guint32 flags, MAC(flags, msg,strlen(msg), sign_key,16, seal_key,16, random_pad, 100, result); res = buff_to_hex_str(result, 16); - purple_debug_info("sipe", "NTLM calculated MAC: %s\n", res); + SIPE_DEBUG_INFO("NTLM calculated MAC: %s", res); g_free(res); } @@ -1736,7 +1736,7 @@ sip_sec_init_sec_context__ntlm(SipSecContext context, { context_ntlm ctx = (context_ntlm) context; - purple_debug_info("sipe", "sip_sec_init_sec_context__ntlm: in use\n"); + SIPE_DEBUG_INFO_NOFORMAT("sip_sec_init_sec_context__ntlm: in use"); ctx->step++; if (ctx->step == 1) { @@ -1905,14 +1905,14 @@ void sip_sec_init__ntlm(void) convert_from_utf16le = g_iconv_open(sys_cp, "UTF-16LE"); if (convert_from_utf16le == (GIConv)-1) { - purple_debug_error("sipe", "g_iconv_open from UTF-16LE to %s failed\n", - sys_cp); + SIPE_DEBUG_ERROR("g_iconv_open from UTF-16LE to %s failed", + sys_cp); } convert_to_utf16le = g_iconv_open("UTF-16LE", sys_cp); if (convert_from_utf16le == (GIConv)-1) { - purple_debug_error("sipe", "g_iconv_open from %s to UTF-16LE failed\n", - sys_cp); + SIPE_DEBUG_ERROR("g_iconv_open from %s to UTF-16LE failed", + sys_cp); } } diff --git a/src/core/sip-sec-sspi.c b/src/core/sip-sec-sspi.c index fb5a4991..fc0f70bd 100644 --- a/src/core/sip-sec-sspi.c +++ b/src/core/sip-sec-sspi.c @@ -21,18 +21,17 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include #include #include #include -#include - -#include "debug.h" #include "sip-sec.h" #include "sip-sec-mech.h" #include "sip-sec-sspi.h" +#include "sipe-backend.h" /* Mechanism names */ #define SSPI_MECH_NTLM "NTLM" @@ -138,7 +137,7 @@ sip_sec_init_sec_context__sspi(SipSecContext context, context_sspi ctx = (context_sspi)context; CtxtHandle* out_context = g_malloc0(sizeof(CtxtHandle)); - purple_debug_info("sipe", "sip_sec_init_sec_context__sspi: in use\n"); + SIPE_DEBUG_INFO_NOFORMAT("sip_sec_init_sec_context__sspi: in use"); input_desc.cBuffers = 1; input_desc.pBuffers = &in_token; diff --git a/src/core/sipe-ews.c b/src/core/sipe-ews.c index fe178c19..ebc40a4e 100644 --- a/src/core/sipe-ews.c +++ b/src/core/sipe-ews.c @@ -49,7 +49,6 @@ be great to implement too. #include #include "account.h" -#include "debug.h" #include "sipe-common.h" #include "sip-sec.h" @@ -224,7 +223,7 @@ sipe_ews_process_avail_response(int return_code, { struct sipe_ews *ews = data; - purple_debug_info("sipe", "sipe_ews_process_avail_response: cb started.\n"); + SIPE_DEBUG_INFO_NOFORMAT("sipe_ews_process_avail_response: cb started."); if(!sipe_strequal(ews->as_url, ews->oof_url)) { /* whether reuse conn */ http_conn_set_close(conn); @@ -256,8 +255,8 @@ Envelope/Body/GetUserAvailabilityResponse/FreeBusyResponseArray/FreeBusyResponse node = sipe_xml_child(resp, "FreeBusyView/WorkingHours"); g_free(ews->working_hours_xml_str); ews->working_hours_xml_str = sipe_xml_stringify(node); - purple_debug_info("sipe", "sipe_ews_process_avail_response: ews->working_hours_xml_str:\n%s\n", - ews->working_hours_xml_str ? ews->working_hours_xml_str : ""); + SIPE_DEBUG_INFO("sipe_ews_process_avail_response: ews->working_hours_xml_str:\n%s", + ews->working_hours_xml_str ? ews->working_hours_xml_str : ""); sipe_ews_cal_events_free(ews->cal_events); ews->cal_events = NULL; @@ -335,7 +334,7 @@ sipe_ews_process_oof_response(int return_code, { struct sipe_ews *ews = data; - purple_debug_info("sipe", "sipe_ews_process_oof_response: cb started.\n"); + SIPE_DEBUG_INFO_NOFORMAT("sipe_ews_process_oof_response: cb started."); http_conn_set_close(conn); ews->http_conn = NULL; @@ -417,7 +416,7 @@ sipe_ews_process_autodiscover(int return_code, { struct sipe_ews *ews = data; - purple_debug_info("sipe", "sipe_ews_process_autodiscover: cb started.\n"); + SIPE_DEBUG_INFO_NOFORMAT("sipe_ews_process_autodiscover: cb started."); http_conn_set_close(conn); ews->http_conn = NULL; @@ -442,12 +441,12 @@ sipe_ews_process_autodiscover(int return_code, ews->oof_url = sipe_xml_data(sipe_xml_child(node, "OOFUrl")); ews->oab_url = sipe_xml_data(sipe_xml_child(node, "OABUrl")); - purple_debug_info("sipe", "sipe_ews_process_autodiscover:as_url %s\n", - ews->as_url ? ews->as_url : ""); - purple_debug_info("sipe", "sipe_ews_process_autodiscover:oof_url %s\n", - ews->oof_url ? ews->oof_url : ""); - purple_debug_info("sipe", "sipe_ews_process_autodiscover:oab_url %s\n", - ews->oab_url ? ews->oab_url : ""); + SIPE_DEBUG_INFO("sipe_ews_process_autodiscover:as_url %s", + ews->as_url ? ews->as_url : ""); + SIPE_DEBUG_INFO("sipe_ews_process_autodiscover:oof_url %s", + ews->oof_url ? ews->oof_url : ""); + SIPE_DEBUG_INFO("sipe_ews_process_autodiscover:oab_url %s", + ews->oab_url ? ews->oab_url : ""); g_free(type); break; @@ -482,7 +481,7 @@ sipe_ews_do_autodiscover(struct sipe_ews *ews, { char *body; - purple_debug_info("sipe", "sipe_ews_do_autodiscover: going autodiscover url=%s\n", autodiscover_url ? autodiscover_url : ""); + SIPE_DEBUG_INFO("sipe_ews_do_autodiscover: going autodiscover url=%s", autodiscover_url ? autodiscover_url : ""); body = g_strdup_printf(SIPE_EWS_AUTODISCOVER_REQUEST, ews->email); ews->http_conn = http_conn_create( @@ -508,7 +507,7 @@ sipe_ews_do_avail_request(struct sipe_ews *ews) char *end_str; struct tm *now_tm; - purple_debug_info("sipe", "sipe_ews_do_avail_request: going Availability req.\n"); + SIPE_DEBUG_INFO_NOFORMAT("sipe_ews_do_avail_request: going Availability req."); now_tm = gmtime(&now); /* start -1 day, 00:00:00 */ @@ -546,7 +545,7 @@ sipe_ews_do_oof_request(struct sipe_ews *ews) char *body; const char *content_type = "text/xml; charset=UTF-8"; - purple_debug_info("sipe", "sipe_ews_do_oof_request: going OOF req.\n"); + SIPE_DEBUG_INFO_NOFORMAT("sipe_ews_do_oof_request: going OOF req."); body = g_strdup_printf(SIPE_EWS_USER_OOF_SETTINGS_REQUEST, ews->email); if (!ews->http_conn) { @@ -626,7 +625,7 @@ sipe_ews_update_calendar(struct sipe_account_data *sip) { //char *autodisc_srv = g_strdup_printf("_autodiscover._tcp.%s", maildomain); - purple_debug_info("sipe", "sipe_ews_update_calendar: started.\n"); + SIPE_DEBUG_INFO_NOFORMAT("sipe_ews_update_calendar: started."); if (!sip->ews) { const char *value; @@ -671,13 +670,13 @@ sipe_ews_update_calendar(struct sipe_account_data *sip) } if(sip->ews->is_disabled) { - purple_debug_info("sipe", "sipe_ews_update_calendar: disabled, exiting.\n"); + SIPE_DEBUG_INFO_NOFORMAT("sipe_ews_update_calendar: disabled, exiting."); return; } sipe_ews_run_state_machine(sip->ews); - purple_debug_info("sipe", "sipe_ews_update_calendar: finished.\n"); + SIPE_DEBUG_INFO_NOFORMAT("sipe_ews_update_calendar: finished."); } diff --git a/src/core/sipe-ft.c b/src/core/sipe-ft.c index 4d6778eb..413a23bd 100644 --- a/src/core/sipe-ft.c +++ b/src/core/sipe-ft.c @@ -35,7 +35,6 @@ #include "cipher.h" #include "connection.h" -#include "debug.h" #include "eventloop.h" #include "ft.h" #include "network.h" @@ -59,6 +58,7 @@ #include "sipe-common.h" #include "sipmsg.h" #include "sip-sec.h" +#include "sipe-backend.h" #include "sipe-dialog.h" #include "sipe-nls.h" #include "sipe-ft.h" @@ -139,7 +139,7 @@ sipe_ft_free_xfer_struct(PurpleXfer *xfer) xfer->watcher = 0; } if (ft->listenfd >= 0) { - purple_debug_info("sipe", "sipe_ft_free_xfer_struct: closing listening socket %d\n", ft->listenfd); + SIPE_DEBUG_INFO("sipe_ft_free_xfer_struct: closing listening socket %d", ft->listenfd); close(ft->listenfd); } if (ft->listener) @@ -335,8 +335,8 @@ sipe_ft_read(guchar **buffer, PurpleXfer *xfer) *buffer = g_malloc(bytes_to_read); if (!*buffer) { raise_ft_error(xfer, _("Out of memory")); - purple_debug_error("sipe", "sipe_ft_read: can't allocate %" G_GSIZE_FORMAT " bytes for receive buffer\n", - bytes_to_read); + SIPE_DEBUG_ERROR("sipe_ft_read: can't allocate %" G_GSIZE_FORMAT " bytes for receive buffer", + bytes_to_read); return -1; } @@ -351,8 +351,8 @@ sipe_ft_read(guchar **buffer, PurpleXfer *xfer) if (!decrypted) { raise_ft_error(xfer, _("Out of memory")); - purple_debug_error("sipe", "sipe_ft_read: can't allocate %" G_GSIZE_FORMAT " bytes for decryption buffer\n", - (gsize)bytes_read); + SIPE_DEBUG_ERROR("sipe_ft_read: can't allocate %" G_GSIZE_FORMAT " bytes for decryption buffer", + (gsize)bytes_read); g_free(*buffer); *buffer = NULL; return -1; @@ -406,8 +406,8 @@ sipe_ft_write(const guchar *buffer, size_t size, PurpleXfer *xfer) ft->encrypted_outbuf = g_malloc(ft->outbuf_size); if (!ft->encrypted_outbuf) { raise_ft_error(xfer, _("Out of memory")); - purple_debug_error("sipe", "sipe_ft_write: can't allocate %" G_GSIZE_FORMAT " bytes for send buffer\n", - ft->outbuf_size); + SIPE_DEBUG_ERROR("sipe_ft_write: can't allocate %" G_GSIZE_FORMAT " bytes for send buffer", + ft->outbuf_size); return -1; } } @@ -519,8 +519,8 @@ sipe_ft_outgoing_start(PurpleXfer *xfer) if (!sipe_strequal(buf,VER)) { raise_ft_error_and_cancel(xfer,_("File transfer initialization failed.")); - purple_debug_info("sipe","File transfer VER string incorrect, received: %s expected: %s", - buf, VER); + SIPE_DEBUG_INFO("File transfer VER string incorrect, received: %s expected: %s", + buf, VER); return; } @@ -542,8 +542,8 @@ sipe_ft_outgoing_start(PurpleXfer *xfer) users_match = sipe_strcase_equal(parts[1], (xfer->who + 4)); g_strfreev(parts); - purple_debug_info("sipe","File transfer authentication: %s Expected: USR %s %u\n", - buf, xfer->who + 4, ft->auth_cookie); + SIPE_DEBUG_INFO("File transfer authentication: %s Expected: USR %s %u", + buf, xfer->who + 4, ft->auth_cookie); if (!users_match || (ft->auth_cookie != auth_cookie_received)) { raise_ft_error_and_cancel(xfer, @@ -618,7 +618,7 @@ void sipe_ft_incoming_transfer(PurpleAccount *account, struct sipmsg *msg, const } if (!session) { - purple_debug_error("sipe", "sipe_ft_incoming_transfer: can't find session for remote party\n"); + SIPE_DEBUG_ERROR_NOFORMAT("sipe_ft_incoming_transfer: can't find session for remote party"); return; } diff --git a/src/purple/tests.c b/src/purple/tests.c index 67a70aac..1b413083 100644 --- a/src/purple/tests.c +++ b/src/purple/tests.c @@ -33,8 +33,6 @@ #include #include -#include "signals.h" - #include "sipmsg.h" #include "sipe-sign.h" #define _SIPE_COMPILING_TESTS @@ -42,6 +40,9 @@ #include "uuid.h" +#include "debug.h" +#include "signals.h" + static int successes = 0; static int failures = 0; -- 2.11.4.GIT