From 97fd6e869f57e4276402f128230ad4e7f7e5ec81 Mon Sep 17 00:00:00 2001 From: Stefan Becker Date: Sat, 20 Mar 2010 22:58:11 +0200 Subject: [PATCH] core cleanup: 6 more modules are purple free --- src/core/Makefile.am | 32 +++++++++++++-------------- src/core/sip-sec.c | 17 +++++++------- src/core/sipe-cal.c | 59 ++++++++++++++++++++++++------------------------- src/core/sipe-dialog.c | 17 +++++++------- src/core/sipe-session.c | 7 +++--- src/core/sipe-sign.c | 7 +++--- src/purple/Makefile.am | 4 ++-- 7 files changed, 69 insertions(+), 74 deletions(-) diff --git a/src/core/Makefile.am b/src/core/Makefile.am index 9f9e6906..24b4e77f 100644 --- a/src/core/Makefile.am +++ b/src/core/Makefile.am @@ -4,6 +4,17 @@ MAINTAINERCLEANFILES = \ Makefile.in libsipe_core_la_SOURCES = \ + sip-sec.h \ + sip-sec.c \ + sip-sec-mech.h \ + sipe-cal.h \ + sipe-cal.c \ + sipe-dialog.h \ + sipe-dialog.c \ + sipe-session.h \ + sipe-session.c \ + sipe-sign.h \ + sipe-sign.c \ sipe-xml.h \ sipe-xml.c @@ -17,27 +28,16 @@ libsipe_core_purple_la_SOURCES = \ sipe-chat.c \ sipe-conf.h \ sipe-conf.c \ - sipe-dialog.h \ - sipe-dialog.c \ - sipe-session.h \ - sipe-session.c \ sipe-utils.h \ sipe-utils.c \ - sipe-cal.h \ - sipe-cal.c \ http-conn.h \ http-conn.c \ sipe-ews.h \ sipe-ews.c \ sip-csta.c \ sip-csta.h \ - sip-sec.h \ - sip-sec.c \ - sip-sec-mech.h \ sip-sec-ntlm.h \ sip-sec-ntlm.c \ - sipe-sign.h \ - sipe-sign.c \ sipe-ft.h \ sipe-ft.c \ uuid.h \ @@ -53,16 +53,16 @@ libsipe_core_la_CFLAGS = \ $(LOCALE_CPPFLAGS) \ -I$(srcdir)/../api +if SIP_SEC_KRB5 +libsipe_core_la_SOURCES += sip-sec-krb5.h sip-sec-krb5.c +libsipe_core_la_CFLAGS += $(KRB5_CFLAGS) +endif + if SIPE_INCLUDE_PURPLE libsipe_core_purple_la_CFLAGS = \ $(libsipe_core_la_CFLAGS) \ $(PURPLE_CFLAGS) \ -I$(srcdir)/../purple - -if SIP_SEC_KRB5 -libsipe_core_purple_la_SOURCES += sip-sec-krb5.h sip-sec-krb5.c -libsipe_core_purple_la_CFLAGS += $(KRB5_CFLAGS) -endif endif check_PROGRAMS = sipe_xml_tests diff --git a/src/core/sip-sec.c b/src/core/sip-sec.c index 25a91e48..5c930742 100644 --- a/src/core/sip-sec.c +++ b/src/core/sip-sec.c @@ -32,9 +32,8 @@ #include -#include "debug.h" - #include "sip-sec.h" +#include "sipe-backend-debug.h" #include "sipe-core-api.h" #include "sipe-utils.h" @@ -101,7 +100,7 @@ sip_sec_create_context(SipSecAuthType type, ret = (*context->acquire_cred_func)(context, domain, username, password); if (ret != SIP_SEC_E_OK) { - purple_debug_info("sipe", "ERROR: sip_sec_init_context failed to acquire credentials.\n"); + SIPE_DEBUG_INFO("ERROR: sip_sec_init_context failed to acquire credentials.%s", ""); (*context->destroy_context_func)(context); context = NULL; } @@ -130,7 +129,7 @@ sip_sec_init_context_step(SipSecContext context, tmp = sip_sec_ntlm_message_describe(in_buff); if (tmp) { - purple_debug_info("sipe", "sip_sec_init_context_step: Challenge message is:\n%s", tmp); + SIPE_DEBUG_INFO("sip_sec_init_context_step: Challenge message is:\n%s", tmp); } g_free(tmp); } @@ -146,7 +145,7 @@ sip_sec_init_context_step(SipSecContext context, if (out_buff.length > 0 && out_buff.value) { tmp = sip_sec_ntlm_message_describe(out_buff); if (tmp) { - purple_debug_info("sipe", "sip_sec_init_context_step: Negotiate or Authenticate message is:\n%s", tmp); + SIPE_DEBUG_INFO("sip_sec_init_context_step: Negotiate or Authenticate message is:\n%s", tmp); } g_free(tmp); } @@ -184,7 +183,7 @@ sip_sec_init_context(SipSecContext *context, username, password); if (!*context) { - purple_debug_info("sipe", "ERROR: sip_sec_init_context: failed sip_sec_create_context()\n"); + SIPE_DEBUG_INFO("ERROR: sip_sec_init_context: failed sip_sec_create_context()%s", ""); return NULL; } @@ -223,7 +222,7 @@ char * sip_sec_make_signature(SipSecContext context, const char *message) char *signature_hex; if(((*context->make_signature_func)(context, message, &signature)) != SIP_SEC_E_OK) { - purple_debug_info("sipe", "ERROR: sip_sec_make_signature failed. Unable to sign message!\n"); + SIPE_DEBUG_INFO("ERROR: sip_sec_make_signature failed. Unable to sign message!%s", ""); return NULL; } signature_hex = buff_to_hex_str(signature.value, signature.length); @@ -236,8 +235,8 @@ int sip_sec_verify_signature(SipSecContext context, const char *message, const c SipSecBuffer signature; sip_uint32 res; - purple_debug_info("sipe", "sip_sec_verify_signature: message is:%s signature to verify is:%s\n", - message ? message : "", signature_hex ? signature_hex : ""); + SIPE_DEBUG_INFO("sip_sec_verify_signature: message is:%s signature to verify is:%s", + message ? message : "", signature_hex ? signature_hex : ""); if (!message || !signature_hex) return SIP_SEC_E_INTERNAL_ERROR; diff --git a/src/core/sipe-cal.c b/src/core/sipe-cal.c index d9d13247..ce64f163 100644 --- a/src/core/sipe-cal.c +++ b/src/core/sipe-cal.c @@ -31,9 +31,8 @@ #include -#include "debug.h" - #include "sip-sec.h" +#include "sipe-backend-debug.h" #include "sipe-cal.h" #include "sipe-nls.h" #include "sipe-utils.h" @@ -583,16 +582,16 @@ sipe_cal_get_status(struct sipe_buddy *buddy, int index; if (!buddy || !buddy->cal_start_time || !buddy->cal_granularity) { - purple_debug_info("sipe", "sipe_cal_get_status: no calendar data1 for %s, exiting\n", + SIPE_DEBUG_INFO("sipe_cal_get_status: no calendar data1 for %s, exiting", buddy ? (buddy->name ? buddy->name : "") : ""); return SIPE_CAL_NO_DATA; } if (!(free_busy = sipe_cal_get_free_busy(buddy))) { - purple_debug_info("sipe", "sipe_cal_get_status: no calendar data2 for %s, exiting\n", buddy->name); + SIPE_DEBUG_INFO("sipe_cal_get_status: no calendar data2 for %s, exiting", buddy->name); return SIPE_CAL_NO_DATA; } - purple_debug_info("sipe", "sipe_cal_get_description: buddy->cal_free_busy=\n%s\n", free_busy); + SIPE_DEBUG_INFO("sipe_cal_get_description: buddy->cal_free_busy=\n%s", free_busy); cal_start = sipe_utils_str_to_time(buddy->cal_start_time); @@ -856,16 +855,16 @@ sipe_cal_get_description(struct sipe_buddy *buddy) _("No data")}; if (buddy->cal_granularity != 15) { - purple_debug_info("sipe", "sipe_cal_get_description: granularity %d is unsupported, exiting.\n", buddy->cal_granularity); + SIPE_DEBUG_INFO("sipe_cal_get_description: granularity %d is unsupported, exiting.", buddy->cal_granularity); return NULL; } /* to lazy load if needed */ free_busy = sipe_cal_get_free_busy(buddy); - purple_debug_info("sipe", "sipe_cal_get_description: buddy->cal_free_busy=\n%s\n", free_busy ? free_busy : ""); + SIPE_DEBUG_INFO("sipe_cal_get_description: buddy->cal_free_busy=\n%s", free_busy ? free_busy : ""); if (!buddy->cal_free_busy || !buddy->cal_granularity || !buddy->cal_start_time) { - purple_debug_info("sipe", "sipe_cal_get_description: no calendar data, exiting"); + SIPE_DEBUG_INFO("sipe_cal_get_description: no calendar data, exiting%s", ""); return NULL; } @@ -874,40 +873,40 @@ sipe_cal_get_description(struct sipe_buddy *buddy) current_cal_state = sipe_cal_get_status0(free_busy, cal_start, buddy->cal_granularity, time(NULL), &index); if (current_cal_state == SIPE_CAL_NO_DATA) { - purple_debug_info("sipe", "sipe_cal_get_description: calendar is undefined for present moment, exiting.\n"); + SIPE_DEBUG_INFO("sipe_cal_get_description: calendar is undefined for present moment, exiting.%s", ""); return NULL; } switch_time = sipe_cal_get_switch_time(free_busy, cal_start, buddy->cal_granularity, index, current_cal_state, &to_state); - purple_debug_info("sipe", "\n* Calendar *\n"); + SIPE_DEBUG_INFO("\n* Calendar *%s", ""); if (buddy->cal_working_hours) { sipe_cal_get_today_work_hours(buddy->cal_working_hours, &start, &end, &next_start); - purple_debug_info("sipe", "Remote now timezone : %s\n", sipe_cal_get_tz(buddy->cal_working_hours, now)); - purple_debug_info("sipe", "std.switch_time(GMT): %s", - IS((*buddy->cal_working_hours).std.switch_time) ? asctime(gmtime(&((*buddy->cal_working_hours).std.switch_time))) : "\n"); - purple_debug_info("sipe", "dst.switch_time(GMT): %s", - IS((*buddy->cal_working_hours).dst.switch_time) ? asctime(gmtime(&((*buddy->cal_working_hours).dst.switch_time))) : "\n"); - purple_debug_info("sipe", "Remote now time : %s", + SIPE_DEBUG_INFO("Remote now timezone : %s", sipe_cal_get_tz(buddy->cal_working_hours, now)); + SIPE_DEBUG_INFO("std.switch_time(GMT): %s", + IS((*buddy->cal_working_hours).std.switch_time) ? asctime(gmtime(&((*buddy->cal_working_hours).std.switch_time))) : ""); + SIPE_DEBUG_INFO("dst.switch_time(GMT): %s", + IS((*buddy->cal_working_hours).dst.switch_time) ? asctime(gmtime(&((*buddy->cal_working_hours).dst.switch_time))) : ""); + SIPE_DEBUG_INFO("Remote now time : %s", asctime(sipe_localtime_tz(&now, sipe_cal_get_tz(buddy->cal_working_hours, now)))); - purple_debug_info("sipe", "Remote start time : %s", - IS(start) ? asctime(sipe_localtime_tz(&start, sipe_cal_get_tz(buddy->cal_working_hours, start))) : "\n"); - purple_debug_info("sipe", "Remote end time : %s", - IS(end) ? asctime(sipe_localtime_tz(&end, sipe_cal_get_tz(buddy->cal_working_hours, end))) : "\n"); - purple_debug_info("sipe", "Rem. next_start time: %s", - IS(next_start) ? asctime(sipe_localtime_tz(&next_start, sipe_cal_get_tz(buddy->cal_working_hours, next_start))) : "\n"); - purple_debug_info("sipe", "Remote switch time : %s", - IS(switch_time) ? asctime(sipe_localtime_tz(&switch_time, sipe_cal_get_tz(buddy->cal_working_hours, switch_time))) : "\n"); + SIPE_DEBUG_INFO("Remote start time : %s", + IS(start) ? asctime(sipe_localtime_tz(&start, sipe_cal_get_tz(buddy->cal_working_hours, start))) : ""); + SIPE_DEBUG_INFO("Remote end time : %s", + IS(end) ? asctime(sipe_localtime_tz(&end, sipe_cal_get_tz(buddy->cal_working_hours, end))) : ""); + SIPE_DEBUG_INFO("Rem. next_start time: %s", + IS(next_start) ? asctime(sipe_localtime_tz(&next_start, sipe_cal_get_tz(buddy->cal_working_hours, next_start))) : ""); + SIPE_DEBUG_INFO("Remote switch time : %s", + IS(switch_time) ? asctime(sipe_localtime_tz(&switch_time, sipe_cal_get_tz(buddy->cal_working_hours, switch_time))) : ""); } else { - purple_debug_info("sipe", "Local now time : %s", + SIPE_DEBUG_INFO("Local now time : %s", asctime(localtime(&now))); - purple_debug_info("sipe", "Local switch time : %s", - IS(switch_time) ? asctime(localtime(&switch_time)) : "\n"); + SIPE_DEBUG_INFO("Local switch time : %s", + IS(switch_time) ? asctime(localtime(&switch_time)) : ""); } - purple_debug_info("sipe", "Calendar End (GMT) : %s", asctime(gmtime(&cal_end))); - purple_debug_info("sipe", "current cal state : %s\n", cal_states[current_cal_state]); - purple_debug_info("sipe", "switch cal state : %s\n", cal_states[to_state] ); + SIPE_DEBUG_INFO("Calendar End (GMT) : %s", asctime(gmtime(&cal_end))); + SIPE_DEBUG_INFO("current cal state : %s", cal_states[current_cal_state]); + SIPE_DEBUG_INFO("switch cal state : %s", cal_states[to_state] ); /* Calendar: string calculations */ diff --git a/src/core/sipe-dialog.c b/src/core/sipe-dialog.c index d1c5fccd..ad2f3d44 100644 --- a/src/core/sipe-dialog.c +++ b/src/core/sipe-dialog.c @@ -26,10 +26,9 @@ #include -#include "debug.h" - #include "sipe-common.h" #include "sipmsg.h" +#include "sipe-backend-debug.h" #include "sipe-dialog.h" #include "sipe-session.h" #include "sipe-utils.h" @@ -99,8 +98,8 @@ sipe_dialog_find_3(struct sip_session *session, sipe_strcase_equal(dialog_in->ourtag, dialog->ourtag) && sipe_strcase_equal(dialog_in->theirtag, dialog->theirtag)) { - purple_debug_info("sipe", "sipe_dialog_find_3 who='%s'\n", - dialog->with ? dialog->with : ""); + SIPE_DEBUG_INFO("sipe_dialog_find_3 who='%s'", + dialog->with ? dialog->with : ""); return dialog; } } SIPE_DIALOG_FOREACH_END; @@ -114,7 +113,7 @@ struct sip_dialog *sipe_dialog_find(struct sip_session *session, if (session && who) { SIPE_DIALOG_FOREACH { if (dialog->with && sipe_strcase_equal(who, dialog->with)) { - purple_debug_info("sipe", "sipe_dialog_find who='%s'\n", who); + SIPE_DEBUG_INFO("sipe_dialog_find who='%s'", who); return dialog; } } SIPE_DIALOG_FOREACH_END; @@ -126,7 +125,7 @@ void sipe_dialog_remove(struct sip_session *session, const gchar *who) { struct sip_dialog *dialog = sipe_dialog_find(session, who); if (dialog) { - purple_debug_info("sipe", "sipe_dialog_remove who='%s' with='%s'\n", who, dialog->with ? dialog->with : ""); + SIPE_DEBUG_INFO("sipe_dialog_remove who='%s' with='%s'", who, dialog->with ? dialog->with : ""); session->dialogs = g_slist_remove(session->dialogs, dialog); sipe_dialog_free(dialog); } @@ -138,8 +137,8 @@ sipe_dialog_remove_3(struct sip_session *session, { struct sip_dialog *dialog = sipe_dialog_find_3(session, dialog_in); if (dialog) { - purple_debug_info("sipe", "sipe_dialog_remove_3 with='%s'\n", - dialog->with ? dialog->with : ""); + SIPE_DEBUG_INFO("sipe_dialog_remove_3 with='%s'", + dialog->with ? dialog->with : ""); session->dialogs = g_slist_remove(session->dialogs, dialog); sipe_dialog_free(dialog); } @@ -179,7 +178,7 @@ void sipe_dialog_parse_routes(struct sip_dialog *dialog, while (*part) { gchar *route = sipmsg_find_part_of_header(*part, "<", ">", NULL); - purple_debug_info("sipe", "sipe_dialog_parse_routes: route %s \n", route); + SIPE_DEBUG_INFO("sipe_dialog_parse_routes: route %s", route); dialog->routes = g_slist_append(dialog->routes, route); part++; } diff --git a/src/core/sipe-session.c b/src/core/sipe-session.c index dda780eb..2115f804 100644 --- a/src/core/sipe-session.c +++ b/src/core/sipe-session.c @@ -26,9 +26,8 @@ #include -#include "debug.h" - #include "sip-sec.h" +#include "sipe-backend-debug.h" #include "sipe-dialog.h" #include "sipe-session.h" #include "sipe-utils.h" @@ -62,7 +61,7 @@ sipe_session_find_or_add_chat_by_callid(struct sipe_account_data *sip, { struct sip_session *session = sipe_session_find_chat_by_callid(sip, callid); if (!session) { - purple_debug_info("sipe", "sipe_session_find_or_add_chat_by_callid: new session for %s\n", callid); + SIPE_DEBUG_INFO("sipe_session_find_or_add_chat_by_callid: new session for %s", callid); session = sipe_session_add_chat(sip); session->callid = g_strdup(callid); } @@ -157,7 +156,7 @@ sipe_session_find_or_add_im(struct sipe_account_data *sip, { struct sip_session *session = sipe_session_find_im(sip, who); if (!session) { - purple_debug_info("sipe", "sipe_session_find_or_add_im: new session for %s\n", who); + SIPE_DEBUG_INFO("sipe_session_find_or_add_im: new session for %s", who); session = g_new0(struct sip_session, 1); session->is_multiparty = FALSE; session->with = g_strdup(who); diff --git a/src/core/sipe-sign.c b/src/core/sipe-sign.c index 9a96051f..25bd2008 100644 --- a/src/core/sipe-sign.c +++ b/src/core/sipe-sign.c @@ -24,9 +24,8 @@ #include -#include "debug.h" - #include "sipmsg.h" +#include "sipe-backend-debug.h" #include "sipe-sign.h" static gchar * const empty_string = ""; @@ -35,7 +34,7 @@ void sipmsg_breakdown_parse(struct sipmsg_breakdown * msg, gchar * realm, gchar { const gchar * hdr; if (msg == NULL || msg->msg == NULL) { - purple_debug(PURPLE_DEBUG_MISC, "sipmsg_breakdown_parse msg or msg->msg is NULL", "\n"); + SIPE_DEBUG_INFO("sipmsg_breakdown_parse msg or msg->msg is NULL%s", ""); return; } @@ -143,7 +142,7 @@ sipmsg_breakdown_get_string(int version, gchar *response_str; gchar *msg; if (msgbd->realm == empty_string || msgbd->realm == NULL) { - purple_debug(PURPLE_DEBUG_MISC, "sipe", "realm NULL, so returning NULL signature string\n"); + SIPE_DEBUG_INFO("realm NULL, so returning NULL signature string%s", ""); return NULL; } diff --git a/src/purple/Makefile.am b/src/purple/Makefile.am index f694c7dc..c7f830b2 100644 --- a/src/purple/Makefile.am +++ b/src/purple/Makefile.am @@ -41,8 +41,8 @@ endif check_PROGRAMS = tests tests_SOURCES = tests.c tests_CFLAGS = $(libsipe_la_CFLAGS) -tests_LDADD = ../core/libsipe_core_purple.la -tests_LDFLAGS = $(PURPLE_LIBS) +tests_LDADD = ../core/libsipe_core.la ../core/libsipe_core_purple.la +tests_LDFLAGS = libsipe.la $(PURPLE_LIBS) TESTS = $(check_PROGRAMS) -- 2.11.4.GIT