From 9082768e79afbdf5fdee76774c6506f55850bb09 Mon Sep 17 00:00:00 2001 From: Jakub Adam Date: Fri, 28 Aug 2015 10:00:59 +0200 Subject: [PATCH] purple: fix compatibility with libpurple 3.x Changed names: purple_prpl_got_user_status() -> purple_protocol_got_user_status() struct proto_chat_entry -> PurpleProtocolChatEntry PurplePluginAction -> PurpleProtocolAction --- src/purple/purple-buddy.c | 27 ++++++++++++------------ src/purple/purple-ft.c | 8 ++++++-- src/purple/purple-groupchat.c | 9 +++++--- src/purple/purple-plugin-common.c | 43 +++++++++++++++++++++------------------ src/purple/purple-private.h | 3 ++- src/purple/purple-search.c | 8 +++++++- 6 files changed, 58 insertions(+), 40 deletions(-) diff --git a/src/purple/purple-buddy.c b/src/purple/purple-buddy.c index 9159c506..8c92c208 100644 --- a/src/purple/purple-buddy.c +++ b/src/purple/purple-buddy.c @@ -3,7 +3,7 @@ * * pidgin-sipe * - * Copyright (C) 2010-2014 SIPE Project + * Copyright (C) 2010-2015 SIPE Project * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -48,6 +48,7 @@ #define purple_buddy_set_name(b, n) purple_blist_rename_buddy(b, n) #define purple_group_set_name(g, n) purple_blist_rename_group(g, n) #define purple_notify_user_info_add_pair_html(i, k, v) purple_notify_user_info_add_pair(i, k, v) +#define purple_protocol_got_user_status purple_prpl_got_user_status #define PURPLE_IS_BUDDY(b) PURPLE_BLIST_NODE_IS_BUDDY(b) #define PURPLE_IS_GROUP(b) PURPLE_BLIST_NODE_IS_GROUP(b) #endif @@ -328,15 +329,15 @@ void sipe_backend_buddy_set_status(struct sipe_core_public *sipe_public, purple_status_get_name(status)); if (tmp) { - purple_prpl_got_user_status(purple_private->account, who, - sipe_purple_activity_to_token(activity), - SIPE_PURPLE_STATUS_ATTR_ID_MESSAGE, tmp, - NULL); + purple_protocol_got_user_status(purple_private->account, who, + sipe_purple_activity_to_token(activity), + SIPE_PURPLE_STATUS_ATTR_ID_MESSAGE, tmp, + NULL); g_free(tmp); } else - purple_prpl_got_user_status(purple_private->account, who, - sipe_purple_activity_to_token(activity), - NULL); + purple_protocol_got_user_status(purple_private->account, who, + sipe_purple_activity_to_token(activity), + NULL); } gboolean sipe_backend_uses_photo(void) @@ -765,11 +766,11 @@ static void sipe_purple_buddy_copy_to_cb(PurpleBlistNode *node, TRUE); /* update UI */ - purple_prpl_got_user_status(purple_buddy_get_account(clone), - purple_buddy_get_name(clone), - tmp, - SIPE_PURPLE_STATUS_ATTR_ID_MESSAGE, tmp, - NULL); + purple_protocol_got_user_status(purple_buddy_get_account(clone), + purple_buddy_get_name(clone), + tmp, + SIPE_PURPLE_STATUS_ATTR_ID_MESSAGE, tmp, + NULL); } } diff --git a/src/purple/purple-ft.c b/src/purple/purple-ft.c index b26c3ff5..f682c125 100644 --- a/src/purple/purple-ft.c +++ b/src/purple/purple-ft.c @@ -3,7 +3,7 @@ * * pidgin-sipe * - * Copyright (C) 2010-2013 SIPE Project + * Copyright (C) 2010-2015 SIPE Project * Copyright (C) 2010 Jakub Adam * Copyright (C) 2010 Tomáš Hrabčík * @@ -30,11 +30,15 @@ #include #include +#ifdef HAVE_UNISTD_H +#include +#endif + #include #include "version.h" #if PURPLE_VERSION_CHECK(3,0,0) -#include "xfer.h" +#include "protocol.h" #define PURPLE_XFER_TO_SIPE_CORE_PUBLIC ((struct sipe_core_public *) purple_connection_get_protocol_data(purple_account_get_connection(purple_xfer_get_account(xfer)))) #else #include "ft.h" diff --git a/src/purple/purple-groupchat.c b/src/purple/purple-groupchat.c index 8500ba29..2439f8ed 100644 --- a/src/purple/purple-groupchat.c +++ b/src/purple/purple-groupchat.c @@ -3,7 +3,7 @@ * * pidgin-sipe * - * Copyright (C) 2010-2013 SIPE Project + * Copyright (C) 2010-2015 SIPE Project * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -47,9 +47,12 @@ GList *sipe_purple_chat_info(SIPE_UNUSED_PARAMETER PurpleConnection *gc) { GList *m = NULL; - struct proto_chat_entry *pce; - pce = g_new0(struct proto_chat_entry, 1); +#if PURPLE_VERSION_CHECK(3,0,0) + PurpleProtocolChatEntry *pce = g_new0(PurpleProtocolChatEntry, 1); +#else + struct proto_chat_entry *pce = g_new0(struct proto_chat_entry, 1); +#endif pce->label = _("_URI:"); pce->identifier = "uri"; pce->required = TRUE; diff --git a/src/purple/purple-plugin-common.c b/src/purple/purple-plugin-common.c index af31ceac..a1f7ce14 100644 --- a/src/purple/purple-plugin-common.c +++ b/src/purple/purple-plugin-common.c @@ -59,6 +59,9 @@ #define purple_connection_error(g, e, m) purple_connection_error_reason(g, e, m) #define purple_connection_get_flags(gc) 0 #define purple_connection_set_flags(gc, f) gc->flags |= f +#define purple_protocol_action_new(l, c) purple_plugin_action_new(l, c) +#define PurpleProtocolAction PurplePluginAction +#define SIPE_PURPLE_ACTION_TO_CONNECTION action->context #endif #include "sipe-backend.h" @@ -665,10 +668,10 @@ gboolean sipe_purple_plugin_unload(SIPE_UNUSED_PARAMETER PurplePlugin *plugin) return TRUE; } -static void sipe_purple_show_about_plugin(PurplePluginAction *action) +static void sipe_purple_show_about_plugin(PurpleProtocolAction *action) { gchar *tmp = sipe_core_about(); - purple_notify_formatted((PurpleConnection *) action->context, + purple_notify_formatted(SIPE_PURPLE_ACTION_TO_CONNECTION, NULL, " ", NULL, tmp, NULL, NULL); g_free(tmp); } @@ -709,9 +712,9 @@ static void sipe_purple_phone_call_cb(PurpleConnection *gc, } } -static void sipe_purple_phone_call(PurplePluginAction *action) +static void sipe_purple_phone_call(PurpleProtocolAction *action) { - PurpleConnection *gc = (PurpleConnection *) action->context; + PurpleConnection *gc = SIPE_PURPLE_ACTION_TO_CONNECTION; PurpleRequestFields *fields; PurpleRequestFieldGroup *group; PurpleRequestField *field; @@ -738,16 +741,16 @@ static void sipe_purple_phone_call(PurplePluginAction *action) gc); } -static void sipe_purple_test_call(PurplePluginAction *action) +static void sipe_purple_test_call(PurpleProtocolAction *action) { - PurpleConnection *gc = (PurpleConnection *) action->context; + PurpleConnection *gc = SIPE_PURPLE_ACTION_TO_CONNECTION; sipe_core_media_test_call(PURPLE_GC_TO_SIPE_CORE_PUBLIC); } #endif -static void sipe_purple_show_join_conference(PurplePluginAction *action) +static void sipe_purple_show_join_conference(PurpleProtocolAction *action) { - PurpleConnection *gc = (PurpleConnection *) action->context; + PurpleConnection *gc = SIPE_PURPLE_ACTION_TO_CONNECTION; PurpleRequestFields *fields; PurpleRequestFieldGroup *group; PurpleRequestField *field; @@ -780,9 +783,9 @@ static void sipe_purple_show_join_conference(PurplePluginAction *action) gc); } -static void sipe_purple_republish_calendar(PurplePluginAction *action) +static void sipe_purple_republish_calendar(PurpleProtocolAction *action) { - PurpleConnection *gc = (PurpleConnection *) action->context; + PurpleConnection *gc = SIPE_PURPLE_ACTION_TO_CONNECTION; PurpleAccount *account = purple_connection_get_account(gc); if (get_dont_publish_flag(account)) { @@ -794,9 +797,9 @@ static void sipe_purple_republish_calendar(PurplePluginAction *action) } } -static void sipe_purple_reset_status(PurplePluginAction *action) +static void sipe_purple_reset_status(PurpleProtocolAction *action) { - PurpleConnection *gc = (PurpleConnection *) action->context; + PurpleConnection *gc = SIPE_PURPLE_ACTION_TO_CONNECTION; PurpleAccount *account = purple_connection_get_account(gc); if (get_dont_publish_flag(account)) { @@ -811,29 +814,29 @@ static void sipe_purple_reset_status(PurplePluginAction *action) GList *sipe_purple_actions() { GList *menu = NULL; - PurplePluginAction *act; + PurpleProtocolAction *act; - act = purple_plugin_action_new(_("About SIPE plugin..."), sipe_purple_show_about_plugin); + act = purple_protocol_action_new(_("About SIPE plugin..."), sipe_purple_show_about_plugin); menu = g_list_prepend(menu, act); - act = purple_plugin_action_new(_("Contact search..."), sipe_purple_show_find_contact); + act = purple_protocol_action_new(_("Contact search..."), sipe_purple_show_find_contact); menu = g_list_prepend(menu, act); #ifdef HAVE_VV - act = purple_plugin_action_new(_("Call a phone number..."), sipe_purple_phone_call); + act = purple_protocol_action_new(_("Call a phone number..."), sipe_purple_phone_call); menu = g_list_prepend(menu, act); - act = purple_plugin_action_new(_("Test call"), sipe_purple_test_call); + act = purple_protocol_action_new(_("Test call"), sipe_purple_test_call); menu = g_list_prepend(menu, act); #endif - act = purple_plugin_action_new(_("Join scheduled conference..."), sipe_purple_show_join_conference); + act = purple_protocol_action_new(_("Join scheduled conference..."), sipe_purple_show_join_conference); menu = g_list_prepend(menu, act); - act = purple_plugin_action_new(_("Republish Calendar"), sipe_purple_republish_calendar); + act = purple_protocol_action_new(_("Republish Calendar"), sipe_purple_republish_calendar); menu = g_list_prepend(menu, act); - act = purple_plugin_action_new(_("Reset status"), sipe_purple_reset_status); + act = purple_protocol_action_new(_("Reset status"), sipe_purple_reset_status); menu = g_list_prepend(menu, act); return g_list_reverse(menu); diff --git a/src/purple/purple-private.h b/src/purple/purple-private.h index a4a42b48..72a12500 100644 --- a/src/purple/purple-private.h +++ b/src/purple/purple-private.h @@ -43,6 +43,7 @@ #if !PURPLE_VERSION_CHECK(3,0,0) #define PurpleIMTypingState PurpleTypingState +#define _PurpleProtocolAction _PurplePluginAction #endif /* Forward declarations */ @@ -170,7 +171,7 @@ void sipe_purple_group_buddy(struct _PurpleConnection *gc, GList *sipe_purple_buddy_menu(struct _PurpleBuddy *buddy); /* libpurple search callbacks */ -void sipe_purple_show_find_contact(struct _PurplePluginAction *action); +void sipe_purple_show_find_contact(struct _PurpleProtocolAction *action); /* libpurple status callbacks */ void sipe_purple_set_status(struct _PurpleAccount *account, diff --git a/src/purple/purple-search.c b/src/purple/purple-search.c index 89000435..1ca03b4c 100644 --- a/src/purple/purple-search.c +++ b/src/purple/purple-search.c @@ -3,7 +3,7 @@ * * pidgin-sipe * - * Copyright (C) 2011-2014 SIPE Project + * Copyright (C) 2011-2015 SIPE Project * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -201,9 +201,15 @@ static void sipe_purple_find_contact_cb(PurpleConnection *gc, country); } +#if PURPLE_VERSION_CHECK(3,0,0) +void sipe_purple_show_find_contact(PurpleProtocolAction *action) +{ + PurpleConnection *gc = action->connection; +#else void sipe_purple_show_find_contact(PurplePluginAction *action) { PurpleConnection *gc = (PurpleConnection *) action->context; +#endif PurpleRequestFields *fields; PurpleRequestFieldGroup *group; PurpleRequestField *field; -- 2.11.4.GIT