pidgin/purple-plugin-pack

d550a70c5fb1
Merge in dx's changes which I started doing as well
--- a/blistops/blistops.c Thu May 25 21:55:19 2017 -0500
+++ b/blistops/blistops.c Thu May 25 22:02:12 2017 -0500
@@ -175,7 +175,11 @@
PidginBuddyList *gtkblist = PIDGIN_BLIST(blist);
w_blist = gtkblist->window;
+#if PURPLE_VERSION_CHECK(3,0,0)
+ w_menubar = gtk_ui_manager_get_widget(gtkblist->ui, "/BList");
+#else
w_menubar = gtk_item_factory_get_widget(gtkblist->ift, "<PurpleMain>");
+#endif
g_signal_connect(gtkblist->treemodel, "row_changed", G_CALLBACK(row_changed_cb), gtkblist);
--- a/configure.ac Thu May 25 21:55:19 2017 -0500
+++ b/configure.ac Thu May 25 22:02:12 2017 -0500
@@ -68,10 +68,20 @@
fi
AC_SUBST(CFLAGS)
+AC_ARG_WITH(purple-ver,
+ AC_HELP_STRING([--with-purple-ver], [set to 3 to compile against libpurple3]),
+ ,with_purple_ver=2)
+
+if test "x$with_purple_ver" = "x3" ; then
+ # this is used as the suffix below (for purple-3, pidgin-3, etc)
+ # and also as the -3 param to plugin_pack.py
+ PURPLE_VER="-3"
+fi
+
dnl #######################################################################
dnl # Check for purple
dnl #######################################################################
-PKG_CHECK_MODULES(PURPLE, purple,
+PKG_CHECK_MODULES(PURPLE, purple${PURPLE_VER},
[
AC_DEFINE(HAVE_PURPLE, 1, [Define if we've found libpurple.])
])
@@ -115,7 +125,7 @@
dnl #######################################################################
dnl # Check for pidgin
dnl #######################################################################
-PKG_CHECK_MODULES(PIDGIN, pidgin,
+PKG_CHECK_MODULES(PIDGIN, pidgin${PURPLE_VER},
[
AC_DEFINE(HAVE_PIDGIN, 1, [Define if we've found pidgin.])
HAVE_PIDGIN="yes"
@@ -155,7 +165,7 @@
dnl #######################################################################
dnl # Check for finch
dnl #######################################################################
-PKG_CHECK_MODULES(FINCH, finch,
+PKG_CHECK_MODULES(FINCH, finch${PURPLE_VER},
[
AC_DEFINE(HAVE_FINCH, 1, [Define if we've found finch.])
HAVE_FINCH="yes"
--- a/difftopic/difftopic.c Thu May 25 21:55:19 2017 -0500
+++ b/difftopic/difftopic.c Thu May 25 22:02:12 2017 -0500
@@ -151,19 +151,23 @@
topic_changed(PurpleConversation *conv, const char *who, const char *what)
{
PidginConversation *gtkconv;
+ GtkWidget *imhtml;
char *old;
#if PURPLE_VERSION_CHECK(3,0,0)
gtkconv = purple_conversation_get_ui_data(conv);
+ imhtml = gtkconv->webview;
#else
gtkconv = conv->ui_data;
+ imhtml = gtkconv->imhtml;
#endif
- old = g_object_get_data(G_OBJECT(gtkconv->imhtml), "difftopic");
+ old = g_object_get_data(G_OBJECT(imhtml), "difftopic");
if (old && what) {
- have_fun(GTK_IMHTML(gtkconv->imhtml), old, what);
+ /* TODO: GTK_IMHTML() cast gone from pidgin3 */
+ have_fun(GTK_IMHTML(imhtml), old, what);
}
- g_object_set_data_full(G_OBJECT(gtkconv->imhtml), "difftopic", g_strdup(what), (GDestroyNotify)g_free);
+ g_object_set_data_full(G_OBJECT(imhtml), "difftopic", g_strdup(what), (GDestroyNotify)g_free);
}
static gboolean
--- a/enhancedhist/plugins.cfg Thu May 25 21:55:19 2017 -0500
+++ b/enhancedhist/plugins.cfg Thu May 25 22:02:12 2017 -0500
@@ -1,9 +1,10 @@
[Enhanced History]
-type=broken
+type=default
depends=pidgin
provides=enhancedhist
summary=An enhanced version of the history plugin
description=%(summary)s Grants ability to select the number of previous conversations to show instead of just one.
authors=Andrew Pangborn
introduced=2.3.0
+purple3=no
--- a/irc-more/irc-more.c Thu May 25 21:55:19 2017 -0500
+++ b/irc-more/irc-more.c Thu May 25 22:02:12 2017 -0500
@@ -113,11 +113,17 @@
*esc = g_markup_escape_text(cmd, -1);
int result = 0;
+#if !PURPLE_VERSION_CHECK(3,0,0)
/* this hack courtesy irchelper -- don't use purple_conversation_set_account
* because it will fire a signal that other plugins can use. Instead do
* this hack. This will break when struct hiding is complete and ABI breaks. */
+ PurpleConversation *conv = g_new0(PurpleConversation, 1);
+ conv->type = PURPLE_CONV_TYPE_IM;
+ conv->account = account;
+#else
PurpleConversation *conv = purple_conversation_new(PURPLE_CONV_TYPE_IM,
account, "None");
+#endif
purple_debug_info("irc-more", "Executng command: %s\n", cmd);
result = purple_cmd_do_command(conv, cmd, esc, &error);
--- a/irchelper/irchelper.c Thu May 25 21:55:19 2017 -0500
+++ b/irchelper/irchelper.c Thu May 25 22:02:12 2017 -0500
@@ -223,12 +223,18 @@
{
PurpleConversation *conv;
+#if PURPLE_VERSION_CHECK(3,0,0)
conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, "None");
+#else
+ conv = g_new0(PurpleConversation, 1);
+ conv->type = PURPLE_CONV_TYPE_IM;
/* If we use this then the conversation updated signal is fired and
* other plugins might start doing things to our conversation, such as
* setting data on it which we would then need to free etc. It's easier
* just to be more hacky by setting account directly. */
/* purple_conversation_set_account(conv, account); */
+ conv->account = account;
+#endif
return conv;
}
@@ -1312,7 +1318,11 @@
prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, option);
option = purple_account_option_string_new(_("Nick password"), PLUGIN_ID "_nickpassword", "");
+#if PURPLE_VERSION_CHECK(3,0,0)
+ purple_account_option_string_set_masked(option, TRUE);
+#else
purple_account_option_set_masked(option, TRUE);
+#endif
prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, option);
option = purple_account_option_bool_new(_("Disconnect ghosts (Duplicate nicknames)"),
@@ -1320,7 +1330,11 @@
prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, option);
option = purple_account_option_string_new(_("Operator password"), PLUGIN_ID "_operpassword", "");
+#if PURPLE_VERSION_CHECK(3,0,0)
+ purple_account_option_string_set_masked(option, TRUE);
+#else
purple_account_option_set_masked(option, TRUE);
+#endif
prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, option);
--- a/irssi/lastlog.c Thu May 25 21:55:19 2017 -0500
+++ b/irssi/lastlog.c Thu May 25 22:02:12 2017 -0500
@@ -58,9 +58,11 @@
/* let's avoid some warnings on anal C compilers like mipspro cc */
result = g_string_new(NULL);
- /*
+#if PURPLE_VERSION_CHECK(3,0,0)
+ /* TODO: not implemented */
+#else
lines = gtk_imhtml_get_markup_lines(GTK_IMHTML(gtkconv->imhtml));
- */
+#endif
/* XXX: This will include all messages, including the output of the
* history plugin, system messages, timestamps etc. This might be
--- a/mystatusbox/plugins.cfg Thu May 25 21:55:19 2017 -0500
+++ b/mystatusbox/plugins.cfg Thu May 25 22:02:12 2017 -0500
@@ -1,9 +1,10 @@
[Mystatusbox]
-type=broken
+type=default
depends=pidgin
provides=mystatusbox
summary=Hide/Show the per-account statusboxes
description=You can show all the per-account statusboxes, hide all of them, or just show the ones that are in a different status from the global status. For ease of use, you can bind keyboard shortcuts for the menu items.
authors=Sadrul Habib Chowdhury
introduced=1.0beta1
+purple3=no
--- a/napster/plugins.cfg Thu May 25 21:55:19 2017 -0500
+++ b/napster/plugins.cfg Thu May 25 22:02:12 2017 -0500
@@ -1,5 +1,5 @@
[Napster Protocol Plugin]
-type=broken
+type=default
depends=purple
provides=napster
summary=NAPSTER Protocol Plugin
@@ -7,4 +7,5 @@
authors=Rob Flynn
introduced=1.0beta6
notes=Introduced into the Purple Plugin Pack after it was removed from libpurple.
+purple3=no
--- a/nicksaid/plugins.cfg Thu May 25 21:55:19 2017 -0500
+++ b/nicksaid/plugins.cfg Thu May 25 22:02:12 2017 -0500
@@ -1,9 +1,10 @@
[Nicksaid]
-type=broken
+type=default
depends=pidgin
provides=nicksaid
summary=Record when someone said your nick in a chat
description=%(summary)s
authors=Sadrul Habib Chowdhury
introduced=1.0beta1
+purple3=no
--- a/ning/plugins.cfg Thu May 25 21:55:19 2017 -0500
+++ b/ning/plugins.cfg Thu May 25 22:02:12 2017 -0500
@@ -1,9 +1,10 @@
[Ning Protocol Plugin]
-type=broken
+type=default
depends=purple json-glib
provides=ning
summary=Protocol plugin for the Ning social networking site framework
description=Protocol plugin for the Ning social networking site framework
authors=Eion Robb
introduced=2.7.0
+purple3=no
--- a/okcupid/plugins.cfg Thu May 25 21:55:19 2017 -0500
+++ b/okcupid/plugins.cfg Thu May 25 22:02:12 2017 -0500
@@ -1,9 +1,10 @@
[OkCupid Protocol Plugin]
-type=broken
+type=default
depends=purple json-glib
provides=okcupid
summary=Protocol plugin for the OkCupid social networking site framework
description=Protocol plugin for the OkCupid social networking site framework
authors=Eion Robb
introduced=2.7.0
+purple3=no
--- a/omegle/plugins.cfg Thu May 25 21:55:19 2017 -0500
+++ b/omegle/plugins.cfg Thu May 25 22:02:12 2017 -0500
@@ -1,9 +1,10 @@
[Omegle Protocol Plugin]
-type=broken
+type=default
depends=purple json-glib
provides=omegle
summary=Protocol plugin for the Omegle social network
description=Protocol plugin for the Omegle social network
authors=Eion Robb
introduced=2.7.0
+purple3=no
--- a/plugin_pack.py Thu May 25 21:55:19 2017 -0500
+++ b/plugin_pack.py Thu May 25 22:02:12 2017 -0500
@@ -37,7 +37,6 @@
import getopt
import glob
import os.path
-import string
import sys
try:
@@ -62,6 +61,7 @@
authors = []
introduced = ''
notes = ''
+ purple3 = True
def __init__(self, directory, name, parser):
self.name = name
@@ -79,14 +79,17 @@
if parser.has_option(name, 'notes'):
self.notes = parser.get(name, 'notes')
+ if parser.has_option(name, 'purple3'):
+ self.purple3 = parser.get(name, 'purple3') != 'no'
+
if self.type != 'default' and self.type != 'incomplete' and self.type != 'abusive':
printerr('\'%s\' has an unknown type of \'%s\'!' % (self.name, self.type))
def __str__(self):
output = 'name: {}\n'.format(self.name)
- output += 'authors: {}\n'.format(string.join(self.authors, ', '))
+ output += 'authors: {}\n'.format(', '.join(self.authors))
output += 'type: {}\n'.format(self.type)
- output += 'depends: {}\n'.format(string.join(self.depends, ' '))
+ output += 'depends: {}\n'.format(' '.join(self.depends))
output += 'provides: {}\n'.format(self.provides)
output += 'directory: {}\n'.format(self.directory)
output += 'summary: {}\n'.format(self.summary)
@@ -95,13 +98,20 @@
if self.notes:
output += 'notes: {}\n'.format(self.notes)
+ if not self.purple3:
+ output += 'purple3: no\n'
+
return output
+ def __lt__(self, other):
+ return self.name < other.name
+
+
class PluginPack:
commands = {}
plugins = {}
- def load_plugins(self, types, depends):
+ def load_plugins(self, types, depends, purple_ver=2):
if len(types) == 0:
types = None
@@ -131,6 +141,9 @@
if len(set(depends).intersection(set(p.depends))) == 0:
continue
+ if purple_ver == 3 and not p.purple3:
+ continue
+
self.plugins[p.provides] = p
def list_type(self, type):
@@ -164,7 +177,7 @@
for plugin in list:
names.append(plugin.name)
- print(string.join(names, ','))
+ print(','.join(names))
def default_plugins(self):
return self.list_type('default')
@@ -207,12 +220,12 @@
cmds = self.commands.keys()
cmds.remove('help')
cmds.sort()
- print(' {}'.format(string.join(cmds, ' ')))
+ print(' {}'.format(' '.join(cmds)))
commands['help'] = help
def dist_dirs(self, args):
"""Displays a list of all plugin directories to included in the distribution"""
- print(string.join(self.unique_dirs(), ' '))
+ print(' '.join(self.unique_dirs()))
commands['dist_dirs'] = dist_dirs
def build_dirs(self, args):
@@ -309,7 +322,7 @@
output.sort()
- print("{}".format(string.join(output, ',')))
+ print("{}".format(','.join(output)))
commands['build_dirs'] = build_dirs
def list_plugins(self, args):
@@ -356,10 +369,9 @@
fmt = '{}{} {:<' + str(widths[0]) + '} {:<' + str(widths[1]) + '} {}'
# now loop through the list again, with everything formatted
- list = data.keys()
- list.sort()
+ keys = sorted(list(data.keys()))
- for p in list:
+ for p in keys:
d = data[p]
print(fmt.format(d[0], d[1], d[2], d[3], d[4]))
commands['list'] = list_plugins
@@ -388,12 +400,12 @@
# setup a second call to determine the plugins to be built
print('{}\n\n{}\n{}\n\n{}\n{}\n{}'.format(
- 'PP_BUILD=`$PYTHON $srcdir/plugin_pack.py build_dirs $DEPENDENCIES $with_plugins`',
+ 'PP_BUILD=`$PYTHON $srcdir/plugin_pack.py $PURPLE_VER build_dirs $DEPENDENCIES $with_plugins`',
'PP_BUILD_DIRS=`echo $PP_BUILD | sed \'s/,/\ /g\'`',
'AC_SUBST(PP_BUILD_DIRS)',
- 'PP_PURPLE_BUILD="$PYTHON $srcdir/plugin_pack.py -p show_names $PP_BUILD"',
- 'PP_PIDGIN_BUILD="$PYTHON $srcdir/plugin_pack.py -P show_names $PP_BUILD"',
- 'PP_FINCH_BUILD="$PYTHON $srcdir/plugin_pack.py -f show_names $PP_BUILD"'))
+ 'PP_PURPLE_BUILD="$PYTHON $srcdir/plugin_pack.py -p $PURPLE_VER show_names $PP_BUILD"',
+ 'PP_PIDGIN_BUILD="$PYTHON $srcdir/plugin_pack.py -P $PURPLE_VER show_names $PP_BUILD"',
+ 'PP_FINCH_BUILD="$PYTHON $srcdir/plugin_pack.py -f $PURPLE_VER show_names $PP_BUILD"'))
commands['config_file'] = config_file
def dependency_graph(self, args):
@@ -534,11 +546,10 @@
def show_usage(pp, exitcode):
print(__doc__)
- cmds = pp.commands.keys()
- cmds.sort()
+ cmds = sorted(list(pp.commands.keys()))
for cmd in cmds:
- print(" {:<-20} {}".format(cmd, pp.commands[cmd].__doc__))
+ print(" {:20} {}".format(cmd, pp.commands[cmd].__doc__))
print("")
@@ -550,9 +561,10 @@
types = []
depends = []
+ purple_ver = 2
try:
- shortopts = 'adfiPp'
+ shortopts = 'adfiPp23'
opts, args = getopt.getopt(sys.argv[1:], shortopts)
except getopt.error as msg:
@@ -572,10 +584,14 @@
depends.append('pidgin')
elif o == '-p':
depends.append('purple')
+ elif o == '-2':
+ purple_ver = 2
+ elif o == '-3':
+ purple_ver = 3
# load the plugins that have been requested, if both lists are empty, all
# plugins are loaded
- pp.load_plugins(types, depends)
+ pp.load_plugins(types, depends, purple_ver)
if(len(args) == 0):
show_usage(pp, 1)
--- a/schedule/pidgin-schedule.c Thu May 25 21:55:19 2017 -0500
+++ b/schedule/pidgin-schedule.c Thu May 25 22:02:12 2017 -0500
@@ -271,7 +271,14 @@
win->accounts = optmenu = pidgin_account_option_menu_new(NULL, TRUE, NULL, NULL, NULL);
win->buddy = entry = gtk_entry_new();
+#if PURPLE_VERSION_CHECK(3,0,0)
+ /* TODO: this doesn't seem to be equivalent to the purple2 version
+ * The last parameter, all=FALSE, means "Whether to include usernames
+ * from disconnected accounts". If it doesn't matter remove me. */
pidgin_setup_screenname_autocomplete(entry, optmenu, NULL, NULL);
+#else
+ pidgin_setup_screenname_autocomplete(entry, optmenu, FALSE);
+#endif
fr = pidgin_create_imhtml(TRUE, &imhtml, NULL, NULL);
win->imhtml = imhtml;
/* XXX: set the formatting to default send-message format */
--- a/snpp/plugins.cfg Thu May 25 21:55:19 2017 -0500
+++ b/snpp/plugins.cfg Thu May 25 22:02:12 2017 -0500
@@ -1,9 +1,10 @@
[SNPP]
-type=broken
+type=default
depends=purple
provides=snpp
summary=SNPP Plugin
description=Allows libpurple to send messages over the Simple Network Paging Protocol (SNPP).
authors=Don Seiler
introduced=2.1.0
+purple3=no
--- a/timelog/plugins.cfg Thu May 25 21:55:19 2017 -0500
+++ b/timelog/plugins.cfg Thu May 25 22:02:12 2017 -0500
@@ -1,9 +1,10 @@
[TimeLog]
-type=broken
+type=default
depends=pidgin
provides=timelog
summary=allows the viewing of Pidgin logs within a specific time range
description=%(summary)s
authors=Jon Oberheide
introduced=2.2.0
+purple3=no
--- a/translate/plugins.cfg Thu May 25 21:55:19 2017 -0500
+++ b/translate/plugins.cfg Thu May 25 22:02:12 2017 -0500
@@ -1,9 +1,10 @@
[Translate]
-type=broken
+type=default
depends=purple
provides=translate
summary=Automatic translation of messages
description=Provides automatic translation of messages using Google Translate (default) or Bing Translator
authors=Eion Robb
introduced=2.7.0
+purple3=no
--- a/xchat-chats/plugins.cfg Thu May 25 21:55:19 2017 -0500
+++ b/xchat-chats/plugins.cfg Thu May 25 22:02:12 2017 -0500
@@ -1,9 +1,10 @@
[XChat Chats]
-type=broken
+type=default
depends=pidgin
provides=xchat-chats
summary=XChat-like chats with Pidgin
description=You can chat in Pidgin using XChat's indented view.
authors=Sadrul Habib Chowdhury
introduced=1.0beta1
+purple3=no