From: David Woodhouse Date: Sat, 5 May 2018 11:14:12 +0000 (+0100) Subject: Support .get_cb_alias even when built against older libpurple X-Git-Tag: v0.95~4 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=18a952efdbd0328438922ee6718a4dbdc101203e;p=pidgin-chime.git Support .get_cb_alias even when built against older libpurple It's harmless to extend the PRPL struct and provide the feature bits as they'll be ignored. So just do it and don't make the newer libpurple a build dependency. --- diff --git a/configure.ac b/configure.ac index 11b4f04..8d498e4 100644 --- a/configure.ac +++ b/configure.ac @@ -38,11 +38,7 @@ AC_ARG_WITH([certsdir], AC_SUBST([certsdir], [${with_certsdir}]) purple_plugindir= -PKG_CHECK_MODULES(PURPLE, [purple >= 2.4.0], - [purple_pkg=purple], - [PKG_CHECK_MODULES(PURPLE, purple-3, - [AC_MSG_ERROR([Pidgin 3.0 is not yet released. Do not use it. It has nothing you need for Lync support that I didn't already backport to Pidgin 2.11.])])]) - +PKG_CHECK_MODULES(PURPLE, [purple >= 2.8.0], [purple_pkg=purple]) purple_plugindir="$($PKG_CONFIG --variable=plugindir $purple_pkg)" AC_SUBST(purple_plugindir, $purple_plugindir) diff --git a/prpl/chime.c b/prpl/chime.c index e8f54ab..4d08c90 100644 --- a/prpl/chime.c +++ b/prpl/chime.c @@ -360,7 +360,7 @@ static PurpleMediaCaps chime_purple_get_media_caps(PurpleAccount *account, const #ifdef PURPLE_BLIST_NODE_IS_VISIBLE /* This was added at the same time */ #define PRPL_HAS_GET_CB_ALIAS #else -#define OPT_PROTO_TRANSIENT_BUDDIES 0 +#define OPT_PROTO_TRANSIENT_BUDDIES 0x1000 #endif static PurplePluginProtocolInfo chime_prpl_info = { @@ -389,6 +389,8 @@ static PurplePluginProtocolInfo chime_prpl_info = { .blist_node_menu = chime_purple_blist_node_menu, .get_media_caps = chime_purple_get_media_caps, .initiate_media = chime_purple_initiate_media, + .add_buddies_with_invite = NULL, /* We *really* depend on 2.8.0, and this is + * immediately before .get_cb_alias() */ #ifdef PRPL_HAS_GET_CB_ALIAS .get_cb_alias = chime_purple_get_cb_alias, #endif @@ -510,6 +512,17 @@ static void chime_purple_init_plugin(PurplePlugin *plugin) opts = g_list_append(opts, opt); chime_prpl_info.protocol_options = opts; + +#ifndef PRPL_HAS_GET_CB_ALIAS + PurplePluginProtocolInfo *i = g_malloc0(sizeof (*i) + sizeof(void *)); + memcpy(i, &chime_prpl_info, sizeof(*i)); + chime_plugin_info.extra_info = i; + + /* Now add the .get_cb_alias method */ + i->struct_size += sizeof(void *); + i++; + *(void **)i = chime_purple_get_cb_alias; +#endif } PURPLE_INIT_PLUGIN(chime, chime_purple_init_plugin, chime_plugin_info);