]> www.infradead.org Git - pidgin-chime.git/commitdiff
Support .get_cb_alias even when built against older libpurple
authorDavid Woodhouse <dwmw@amazon.co.uk>
Sat, 5 May 2018 11:14:12 +0000 (12:14 +0100)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Sat, 5 May 2018 11:16:09 +0000 (12:16 +0100)
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.

configure.ac
prpl/chime.c

index 11b4f04139b196ff08a251fa33932e8828d0f82b..8d498e42fd2164d85e51b2421d266c473e060d4c 100644 (file)
@@ -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)
index e8f54abdf3096790ef9d1d73f80da7653bc2aa7b..4d08c90d0aa7beda2e14b3c5e6968bb5686d1272 100644 (file)
@@ -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);