pidgin/pidgin

Cleanup old and abandoned plugins

2020-11-04, Gary Kramlich
0670e82f1f58
Parents fdf04534e7d1
Children 8d41e1838429
Cleanup old and abandoned plugins

Remove all plugins that weren't installed as well an a few that are being replaced by talkatu and new apis.

Testing Done:
built and ran `ninja pidgin-pot`

Reviewed at https://reviews.imfreedom.org/r/196/
--- a/libpurple/plugins/codeinline.c Wed Nov 04 02:41:46 2020 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/*
- * purple
- *
- * Purple is the legal property of its developers, whose names are too numerous
- * to list here. Please refer to the COPYRIGHT file distributed with this
- * source distribution.
- *
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
- */
-
-#include <glib/gi18n-lib.h>
-
-#include <purple.h>
-
-PurplePlugin *plugin_handle = NULL;
-
-static char *
-outgoing_msg_common(const char *message)
-{
- char *m;
- char **ms = g_strsplit(message, "<u>", -1);
- m = g_strjoinv("<font face=\"monospace\" color=\"#00b025\">", ms);
- g_strfreev(ms);
-
- ms = g_strsplit(m, "</u>", -1);
- g_free(m);
- m = g_strjoinv("</font>", ms);
- g_strfreev(ms);
- return m;
-}
-
-static gboolean outgoing_msg_cb1(PurpleConversation *conv, PurpleMessage *msg,
- gpointer null)
-{
- purple_message_set_contents(msg,
- outgoing_msg_common(purple_message_get_contents(msg)));
- return FALSE;
-}
-
-static void
-outgoing_msg_cb2(PurpleAccount *account, PurpleMessage *msg,
- PurpleConversation *conv, PurpleMessageFlags flags, gpointer null)
-{
- purple_message_set_contents(msg,
- outgoing_msg_common(purple_message_get_contents(msg)));
-}
-
-static PurplePluginInfo *
-plugin_query(GError **error)
-{
- const gchar * const authors[] = {
- "Sean Egan <seanegan@gmail.com>",
- NULL
- };
-
- return purple_plugin_info_new(
- "id", "codeinline",
- "name", "Code Inline",
- "version", "1.0",
- "category", "Formatting",
- "summary", "Formats text as code",
- "description", "Changes the formatting of any outgoing text such "
- "that anything underlined will be received green and "
- "monospace.",
- "authors", authors,
- "website", PURPLE_WEBSITE,
- "abi-version", PURPLE_ABI_VERSION,
- NULL
- );
-}
-
-static gboolean
-plugin_load(PurplePlugin *plugin, GError **error)
-{
- void *handle = purple_conversations_get_handle();
- plugin_handle = plugin;
- purple_signal_connect(handle, "writing-im-msg", plugin,
- PURPLE_CALLBACK(outgoing_msg_cb1), NULL);
- purple_signal_connect(handle, "sending-im-msg", plugin,
- PURPLE_CALLBACK(outgoing_msg_cb2), NULL);
-
- return TRUE;
-}
-
-static gboolean
-plugin_unload(PurplePlugin *plugin, GError **error)
-{
- return TRUE;
-}
-
-PURPLE_PLUGIN_INIT(codeinline, plugin_query, plugin_load, plugin_unload);
--- a/libpurple/plugins/debug_example.c Wed Nov 04 02:41:46 2020 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/*
- * Debug Example Plugin
- *
- * Copyright (C) 2007, John Bailey <rekkanoryo@cpw.pidgin.im>
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02111-1301, USA.
- *
- */
-
-#include <glib/gi18n-lib.h>
-
-/* This file includes all the libpurple headers */
-#include <purple.h>
-
-/* It's more convenient to type PLUGIN_ID all the time than it is to type
- * "core-debugexample", so define this convenience macro. */
-#define PLUGIN_ID "core-debugexample"
-
-/* Common practice in third-party plugins is to define convenience macros for
- * many of the fields of the plugin info struct, so we'll do that for the
- * purposes of demonstration. */
-#define PLUGIN_AUTHORS { "John Bailey <rekkanoryo@cpw.pidgin.im>", NULL }
-
-static PurplePluginInfo *
-plugin_query(GError **error)
-{
- const gchar * const authors[] = PLUGIN_AUTHORS;
-
- return purple_plugin_info_new(
- "id", PLUGIN_ID,
- "name", "Debug API Example",
- "version", DISPLAY_VERSION,
- "category", "Example",
- "summary", "Debug API Example",
- "description", "Debug API Example",
- "authors", authors,
- "website", "https://pidgin.im",
- "abi-version", PURPLE_ABI_VERSION,
- NULL
- );
-}
-
-/* As we've covered before, this function is called when the plugin is loaded.
- * Here we're using it to show off the capabilities of the debug API and just
- * blindly returning TRUE to tell libpurple it's safe to continue loading. */
-static gboolean
-plugin_load(PurplePlugin *plugin, GError **error)
-{
- /* Define these for convenience--we're just using them to show the
- * similarities of the debug functions to the standard printf(). */
- gint i = 256;
- gfloat f = 512.1024;
- const gchar *s = "example string";
-
- /* Introductory message */
- purple_debug_info(PLUGIN_ID,
- "Called plugin_load. Beginning debug demonstration\n");
-
- /* Show off the debug API a bit */
- purple_debug_misc(PLUGIN_ID,
- "MISC level debug message. i = %d, f = %f, s = %s\n", i, f, s);
-
- purple_debug_info(PLUGIN_ID,
- "INFO level debug message. i = %d, f = %f, s = %s\n", i, f, s);
-
- purple_debug_warning(PLUGIN_ID,
- "WARNING level debug message. i = %d, f = %f, s = %s\n", i, f, s);
-
- purple_debug_error(PLUGIN_ID,
- "ERROR level debug message. i = %d, f = %f, s = %s\n", i, f, s);
-
- purple_debug_fatal(PLUGIN_ID,
- "FATAL level debug message. i = %d, f = %f, s = %s\n", i, f, s);
-
- /* Now just return TRUE to tell libpurple to finish loading. */
- return TRUE;
-}
-
-static gboolean
-plugin_unload(PurplePlugin *plugin, GError **error)
-{
- return TRUE;
-}
-
-PURPLE_PLUGIN_INIT(debugexample, plugin_query, plugin_load, plugin_unload);
--- a/libpurple/plugins/filectl.c Wed Nov 04 02:41:46 2020 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,235 +0,0 @@
-/**
- * Send commands to Purple via ~/.purple/control
- *
- * Originally by Eric Warmenhoven <eric@warmenhoven.org>
- * Compile fixes/mini hacks Alex Bennee <alex@bennee.com>
- * and Brian Tarricone <bjt23@users.sourceforge.net>
- */
-
-/* system includes */
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <ctype.h>
-
-#include "internal.h"
-#include <purple.h>
-
-#define FILECTL_PLUGIN_ID "core-filectl"
-static int check;
-static time_t mtime;
-
-static void init_file(void);
-static gboolean check_file(void);
-
-/* parse char * as if were word array */
-char *getarg(char *, int, int);
-
-/* go through file and run any commands */
-void
-run_commands()
-{
- GStatBuf finfo;
- gchar *filename;
- char buffer[1024];
- char *command, *arg1, *arg2;
- FILE *file;
-
- filename = g_build_filename(purple_config_dir(), "control", NULL);
-
- file = g_fopen(filename, "r+");
- while (fgets(buffer, sizeof(buffer), file)) {
-
- /* Read the next command */
- if (buffer[strlen(buffer) - 1] == '\n')
- buffer[strlen(buffer) - 1] = 0;
- purple_debug_misc("filectl", "read: %s\n", buffer);
- command = getarg(buffer, 0, 0);
-
- if (!g_ascii_strncasecmp(command, "login", 6)) {
- PurpleAccount *account;
-
- arg1 = getarg(buffer, 1, 0);
- arg2 = getarg(buffer, 2, 1);
-
- account = purple_accounts_find(arg1, arg2);
- if (account != NULL) /* username found */
- purple_account_connect(account);
-
- free(arg1);
- free(arg2);
-
- } else if (!g_ascii_strncasecmp(command, "logout", 7)) {
- PurpleAccount *account;
-
- arg1 = getarg(buffer, 1, 1);
- arg2 = getarg(buffer, 2, 1);
-
- account = purple_accounts_find(arg1, arg2);
- if (account != NULL)
- {
- purple_account_disconnect(account);
- }
- else if (arg1 == NULL)
- purple_connections_disconnect_all();
-
- free(arg1);
- free(arg2);
-
- } else if (!g_ascii_strncasecmp(command, "away", 4)) {
- arg1 = getarg(buffer, 1, 1);
- /* serv_set_away_all(arg1); */
- free(arg1);
-
- } else if (!g_ascii_strncasecmp(command, "hide", 4)) {
- purple_blist_set_visible(FALSE);
-
- } else if (!g_ascii_strncasecmp(command, "unhide", 6)) {
- purple_blist_set_visible(TRUE);
-
- } else if (!g_ascii_strncasecmp(command, "back", 4)) {
- /* do_im_back(); */
-
- } else if (!g_ascii_strncasecmp(command, "quit", 4)) {
- purple_core_quit();
-
- }
-
- free(command);
- }
-
- fclose(file);
-
- if (g_stat(filename, &finfo) == 0)
- mtime = finfo.st_mtime;
-
- g_free(filename);
-}
-
-/**
- * Check to see if the size of the file is > 0. if so, run commands.
- */
-void
-init_file()
-{
- /* most of this was taken from Bash v2.04 by the FSF */
- GStatBuf finfo;
- gchar *filename;
-
- filename = g_build_filename(purple_config_dir(), "control", NULL);
-
- if ((g_stat(filename, &finfo) == 0) && (finfo.st_size > 0))
- run_commands();
-
- g_free(filename);
-}
-
-/**
- * Check to see if we need to run commands from the file.
- */
-gboolean
-check_file()
-{
- /* most of this was taken from Bash v2.04 by the FSF */
- GStatBuf finfo;
- gchar *filename;
-
- filename = g_build_filename(purple_config_dir(), "control", NULL);
-
- if ((g_stat(filename, &finfo) == 0) && (finfo.st_size > 0))
- {
- if (mtime != finfo.st_mtime) {
- purple_debug_info("filectl", "control changed, checking\n");
- run_commands();
- }
- }
-
- g_free(filename);
-
- return TRUE;
-}
-
-char *
-getarg(char *line, int which, int remain)
-{
- char *arr;
- char *val;
- int count = -1;
- int i;
- int state = 0;
-
- for (i = 0; i < strlen(line) && count < which; i++) {
- switch (state) {
- case 0: /* in whitespace, expecting word */
- if (isalnum(line[i])) {
- count++;
- state = 1;
- }
- break;
- case 1: /* inside word, waiting for whitespace */
- if (isspace(line[i])) {
- state = 0;
- }
- break;
- }
- }
-
- arr = g_strdup(&line[i - 1]);
- if (remain)
- return arr;
-
- for (i = 0; i < strlen(arr) && isalnum(arr[i]); i++);
- arr[i] = 0;
- val = g_strdup(arr);
- arr[i] = ' ';
- free(arr);
- return val;
-}
-
-/*
- * EXPORTED FUNCTIONS
- */
-
-static PurplePluginInfo *
-plugin_query(GError **error)
-{
- const gchar * const authors[] = {
- "Eric Warmenhoven <eric@warmenhoven.org>",
- NULL
- };
-
- return purple_plugin_info_new(
- "id", FILECTL_PLUGIN_ID,
- "name", N_("File Control"),
- "version", DISPLAY_VERSION,
- "category", N_("Utility"),
- "summary", N_("Allows control by entering commands in a file."),
- "description", N_("Allows control by entering commands in a file."),
- "authors", authors,
- "website", PURPLE_WEBSITE,
- "abi-version", PURPLE_ABI_VERSION,
- NULL
- );
-}
-
-static gboolean
-plugin_load(PurplePlugin *plugin, GError **error)
-{
- init_file();
- check = g_timeout_add_seconds(5, (GSourceFunc)check_file, NULL);
-
- return TRUE;
-}
-
-static gboolean
-plugin_unload(PurplePlugin *plugin, GError **error)
-{
- g_source_remove(check);
-
- return TRUE;
-}
-
-PURPLE_PLUGIN_INIT(filectl, plugin_query, plugin_load, plugin_unload);
--- a/libpurple/plugins/helloworld.c Wed Nov 04 02:41:46 2020 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-/*
- * Hello World Plugin
- *
- * Copyright (C) 2004, Gary Kramlich <grim@guifications.org>,
- * 2007, John Bailey <rekkanoryo@cpw.pidgin.im>
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02111-1301, USA.
- *
- */
-
-#include <glib/gi18n-lib.h>
-
-/* This file includes all the libpurple headers */
-#include <purple.h>
-
-/* This function is the callback for the plugin action we added. All we're
- * doing here is displaying a message. When the user selects the plugin
- * action, this function is called. */
-static void
-plugin_action_test_cb (PurplePluginAction * action)
-{
- purple_notify_message (action->plugin, PURPLE_NOTIFY_MSG_INFO,
- "Plugin Actions Test", "This is a plugin actions test :)", NULL, NULL,
- NULL, NULL);
-}
-
-/* we tell libpurple in the PurplePluginInfo struct to call this function to
- * get a list of plugin actions to use for the plugin. This function gives
- * libpurple that list of actions. */
-static GList *
-plugin_actions (PurplePlugin * plugin)
-{
- /* some C89 (a.k.a. ANSI C) compilers will warn if any variable declaration
- * includes an initilization that calls a function. To avoid that, we
- * generally initialize our variables first with constant values like NULL
- * or 0 and assign to them with function calls later */
- GList *list = NULL;
- PurplePluginAction *action = NULL;
-
- /* The action gets created by specifying a name to show in the UI and a
- * callback function to call. */
- action = purple_plugin_action_new ("Plugin Action Test", plugin_action_test_cb);
-
- /* libpurple requires a GList of plugin actions, even if there is only one
- * action in the list. We append the action to a GList here. */
- list = g_list_append (list, action);
-
- /* Once the list is complete, we send it to libpurple. */
- return list;
-}
-
-static PurplePluginInfo *
-plugin_query (GError ** error)
-{
- const gchar * const authors[] = {
- "John Bailey <rekkanoryo@cpw.pidgin.im>", /* correct author */
- NULL
- };
-
- /* For specific notes on the meanings of each of these members, consult the
- C Plugin Howto on the website. */
- return purple_plugin_info_new (
- "id", "core-hello_world",
- "name", "Hello World!",
- "version", DISPLAY_VERSION, /* This constant is defined in config.h, but you shouldn't use it for your
- own plugins. We use it here because it's our plugin. And we're lazy. */
- "category", "Example",
- "summary", "Hello World Plugin",
- "description", "Hello World Plugin",
- "authors", authors,
- "website", "http://helloworld.tld",
- "abi-version", PURPLE_ABI_VERSION,
- "actions-cb", plugin_actions, /* this tells libpurple the address of the function to call to get the list
- of plugin actions. */
- NULL
- );
-}
-
-static gboolean
-plugin_load (PurplePlugin * plugin, GError ** error)
-{
- purple_notify_message (plugin, PURPLE_NOTIFY_MSG_INFO, "Hello World!",
- "This is the Hello World! plugin :)", NULL, NULL,
- NULL, NULL);
-
- return TRUE;
-}
-
-static gboolean
-plugin_unload (PurplePlugin * plugin, GError ** error)
-{
- return TRUE;
-}
-
-PURPLE_PLUGIN_INIT (hello_world, plugin_query, plugin_load, plugin_unload);
--- a/libpurple/plugins/meson.build Wed Nov 04 02:41:46 2020 -0600
+++ b/libpurple/plugins/meson.build Wed Nov 04 03:24:02 2020 -0600
@@ -12,18 +12,6 @@
name_prefix : '',
install : true, install_dir : PURPLE_PLUGINDIR)
- codeinline = library('codeinline', 'codeinline.c',
- dependencies : [libpurple_dep],
- name_prefix : '')
-
- debug_example = library('debug_example', 'debug_example.c',
- dependencies : [libpurple_dep],
- name_prefix : '')
-
- helloworld = library('helloworld', 'helloworld.c',
- dependencies : [libpurple_dep],
- name_prefix : '')
-
idle = library('idle', 'idle.c',
dependencies : [libpurple_dep],
name_prefix : '',
@@ -39,46 +27,21 @@
name_prefix : '',
install : true, install_dir : PURPLE_PLUGINDIR)
- notify_example = library('notify_example', 'notify_example.c',
- dependencies : [libpurple_dep],
- name_prefix : '')
-
offlinemsg = library('offlinemsg', 'offlinemsg.c',
dependencies : [libpurple_dep],
name_prefix : '',
install : true, install_dir : PURPLE_PLUGINDIR)
- one_time_password = library('one_time_password', 'one_time_password.c',
- dependencies : [libpurple_dep],
- name_prefix : '')
-
- pluginpref_example = library('pluginpref_example', 'pluginpref_example.c',
- dependencies : [libpurple_dep],
- name_prefix : '')
-
psychic = library('psychic', 'psychic.c',
dependencies : [libpurple_dep],
name_prefix : '',
install : true, install_dir : PURPLE_PLUGINDIR)
- signals_test = library('signals-test', 'signals-test.c',
- dependencies : [libpurple_dep],
- name_prefix : '')
-
- simple = library('simple-plugin', 'simple.c',
- dependencies : [libpurple_dep],
- name_prefix : '')
-
statenotify = library('statenotify', 'statenotify.c',
dependencies : [libpurple_dep],
name_prefix : '',
install : true, install_dir : PURPLE_PLUGINDIR)
- test_request_input = library('test-request-input', 'test-request-input.c',
- dependencies : [libpurple_dep],
- name_prefix : '',
- )
-
purple_toast = library('purple-toast', 'purple-toast.c',
dependencies : [libpurple_dep],
name_prefix: '',
--- a/libpurple/plugins/notify_example.c Wed Nov 04 02:41:46 2020 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-/*
- * Notify API Example Plugin
- *
- * Copyright (C) 2007, John Bailey <rekkanoryo@cpw.pidgin.im>
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02111-1301, USA.
- *
- */
-
-#include <glib/gi18n-lib.h>
-
-/* This file includes all the libpurple headers */
-#include <purple.h>
-
-#define PLUGIN_ID "core-notifyexample"
-#define PLUGIN_AUTHORS { "John Bailey <rekkanoryo@cpw.pidgin.im>", NULL }
-
-/* The next four functions and the calls within them should cause dialog boxes to appear
- * when you select the plugin action from the Tools->Notify Example menu */
-static void
-notify_error_cb(PurplePluginAction *action)
-{
- purple_notify_error(action->plugin, "Test Notification", "Test Notification",
- "This is a test error notification", NULL);
-}
-
-static void
-notify_info_cb(PurplePluginAction *action)
-{
- purple_notify_info(action->plugin, "Test Notification", "Test Notification",
- "This is a test informative notification", NULL);
-}
-
-static void
-notify_warn_cb(PurplePluginAction *action)
-{
- purple_notify_warning(action->plugin, "Test Notification", "Test Notification",
- "This is a test warning notification", NULL);
-}
-
-static void
-notify_format_cb(PurplePluginAction *action)
-{
- purple_notify_formatted(action->plugin, "Test Notification", "Test Notification",
- "Test Notification",
- "<I>This is a test notification with formatted text.</I>", NULL, NULL);
-}
-
-static void
-notify_uri_cb(PurplePluginAction *action)
-{
- /* This one should open your web browser of choice. */
- purple_notify_uri(action->plugin, "https://pidgin.im/");
-}
-
-static GList *
-plugin_actions(PurplePlugin *plugin)
-{
- GList *actions = NULL;
-
- /* Here we take advantage of return values to avoid the need for a temp variable */
- actions = g_list_prepend(actions,
- purple_plugin_action_new("Show Error Notification", notify_error_cb));
-
- actions = g_list_prepend(actions,
- purple_plugin_action_new("Show Info Notification", notify_info_cb));
-
- actions = g_list_prepend(actions,
- purple_plugin_action_new("Show Warning Notification", notify_warn_cb));
-
- actions = g_list_prepend(actions,
- purple_plugin_action_new("Show Formatted Notification", notify_format_cb));
-
- actions = g_list_prepend(actions,
- purple_plugin_action_new("Show URI Notification", notify_uri_cb));
-
- return g_list_reverse(actions);
-}
-
-static PurplePluginInfo *
-plugin_query(GError **error)
-{
- const gchar * const authors[] = PLUGIN_AUTHORS;
-
- return purple_plugin_info_new(
- "id", PLUGIN_ID,
- "name", "Notify API Example",
- "version", DISPLAY_VERSION,
- "category", "Example",
- "summary", "Notify API Example",
- "description", "Notify API Example",
- "authors", authors,
- "website", "https://pidgin.im",
- "abi-version", PURPLE_ABI_VERSION,
- "actions-cb", plugin_actions,
- NULL
- );
-}
-
-static gboolean
-plugin_load(PurplePlugin *plugin, GError **error)
-{
- return TRUE;
-}
-
-static gboolean
-plugin_unload(PurplePlugin *plugin, GError **error)
-{
- return TRUE;
-}
-
-PURPLE_PLUGIN_INIT(notifyexample, plugin_query, plugin_load, plugin_unload);
-
--- a/libpurple/plugins/one_time_password.c Wed Nov 04 02:41:46 2020 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-/*
- * One Time Password support plugin for libpurple
- *
- * Copyright (C) 2009, Daniel Atallah <datallah@pidgin.im>
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02111-1301, USA.
- */
-#include <glib/gi18n-lib.h>
-
-#include <purple.h>
-
-#define PLUGIN_ID "core-one_time_password"
-#define PREF_NAME PLUGIN_ID "_enabled"
-
-static void
-signed_on_cb(PurpleConnection *conn, void *data)
-{
- PurpleAccount *account = purple_connection_get_account(conn);
-
- if (purple_account_get_bool(account, PREF_NAME, FALSE)) {
- if(purple_account_get_remember_password(account))
- purple_debug_error("One Time Password",
- "Unable to enforce one time password for account %s (%s).\n"
- "Account is set to remember the password.\n",
- purple_account_get_username(account),
- purple_account_get_protocol_name(account));
- else {
-
- purple_debug_info("One Time Password", "Clearing password for account %s (%s).\n",
- purple_account_get_username(account),
- purple_account_get_protocol_name(account));
-
- purple_account_set_password(account, NULL, NULL, NULL);
- /* TODO: Do we need to somehow clear conn->password ? */
- }
- }
-}
-
-static PurplePluginInfo *
-plugin_query(GError **error)
-{
- const gchar * const authors[] = {
- "Daniel Atallah <datallah@pidgin.im>",
- NULL
- };
-
- return purple_plugin_info_new(
- "id", PLUGIN_ID,
- "name", N_("One Time Password Support"),
- "version", DISPLAY_VERSION,
- "category", N_("Security"),
- "summary", N_("Enforce that passwords are used only once."),
- "description", N_("Allows you to enforce on a per-account basis that "
- "passwords not being saved are only used in a "
- "single successful connection.\n"
- "Note: The account password must not be saved for "
- "this to work."),
- "authors", authors,
- "website", PURPLE_WEBSITE,
- "abi-version", PURPLE_ABI_VERSION,
- NULL
- );
-}
-
-static gboolean
-plugin_load(PurplePlugin *plugin, GError **error)
-{
- PurpleProtocol *protocol;
- PurpleAccountOption *option;
- GList *list, *l;
-
- list = purple_protocols_get_all();
-
- /* Register protocol preference. */
- for (l = list; l != NULL; l = l->next) {
- protocol = PURPLE_PROTOCOL(l->data);
- if (protocol != NULL && !(purple_protocol_get_options(protocol) & OPT_PROTO_NO_PASSWORD)) {
- option = purple_account_option_bool_new(_("One Time Password"),
- PREF_NAME, FALSE);
- protocol->account_options = g_list_append(protocol->account_options, option);
- }
- }
- g_list_free(list);
-
- /* Register callback. */
- purple_signal_connect(purple_connections_get_handle(), "signed-on",
- plugin, PURPLE_CALLBACK(signed_on_cb), NULL);
-
- return TRUE;
-}
-
-static gboolean
-plugin_unload(PurplePlugin *plugin, GError **error)
-{
- PurpleProtocol *protocol;
- PurpleAccountOption *option;
- GList *list, *l, *options;
-
- list = purple_protocols_get_all();
-
- /* Remove protocol preference. */
- for (l = list; l != NULL; l = l->next) {
- protocol = PURPLE_PROTOCOL(l->data);
- if (protocol != NULL && !(purple_protocol_get_options(protocol) & OPT_PROTO_NO_PASSWORD)) {
- options = purple_protocol_get_account_options(protocol);
- while (options != NULL) {
- option = (PurpleAccountOption *) options->data;
- if (purple_strequal(PREF_NAME, purple_account_option_get_setting(option))) {
- protocol->account_options = g_list_delete_link(protocol->account_options, options);
- purple_account_option_destroy(option);
- break;
- }
- options = options->next;
- }
- }
- }
- g_list_free(list);
-
- /* Callback will be automagically unregistered */
-
- return TRUE;
-}
-
-PURPLE_PLUGIN_INIT(one_time_password, plugin_query, plugin_load, plugin_unload);
--- a/libpurple/plugins/pluginpref_example.c Wed Nov 04 02:41:46 2020 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,164 +0,0 @@
-/*
- * PluginPref Example Plugin
- *
- * Copyright (C) 2004, Gary Kramlich <amc_grim@users.sf.net>
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02111-1301, USA.
- */
-
-#include <glib/gi18n-lib.h>
-
-/* This file includes all the libpurple headers */
-#include <purple.h>
-
-static PurplePluginPrefFrame *
-get_plugin_pref_frame(PurplePlugin *plugin) {
- PurplePluginPrefFrame *frame;
- PurplePluginPref *ppref;
-
- frame = purple_plugin_pref_frame_new();
-
- ppref = purple_plugin_pref_new_with_label("boolean");
- purple_plugin_pref_frame_add(frame, ppref);
-
- ppref = purple_plugin_pref_new_with_name_and_label(
- "/plugins/core/pluginpref_example/bool",
- "boolean pref");
- purple_plugin_pref_frame_add(frame, ppref);
-
- ppref = purple_plugin_pref_new_with_label("integer");
- purple_plugin_pref_frame_add(frame, ppref);
-
- ppref = purple_plugin_pref_new_with_name_and_label(
- "/plugins/core/pluginpref_example/int",
- "integer pref");
- purple_plugin_pref_set_bounds(ppref, 0, 255);
- purple_plugin_pref_frame_add(frame, ppref);
-
- ppref = purple_plugin_pref_new_with_name_and_label(
- "/plugins/core/pluginpref_example/int_choice",
- "integer choice");
- purple_plugin_pref_set_pref_type(ppref, PURPLE_PLUGIN_PREF_CHOICE);
- purple_plugin_pref_add_choice(ppref, "One", GINT_TO_POINTER(1));
- purple_plugin_pref_add_choice(ppref, "Two", GINT_TO_POINTER(2));
- purple_plugin_pref_add_choice(ppref, "Four", GINT_TO_POINTER(4));
- purple_plugin_pref_add_choice(ppref, "Eight", GINT_TO_POINTER(8));
- purple_plugin_pref_add_choice(ppref, "Sixteen", GINT_TO_POINTER(16));
- purple_plugin_pref_add_choice(ppref, "Thirty Two", GINT_TO_POINTER(32));
- purple_plugin_pref_add_choice(ppref, "Sixty Four", GINT_TO_POINTER(64));
- purple_plugin_pref_add_choice(ppref, "One Hundred Twenty Eight", GINT_TO_POINTER(128));
- purple_plugin_pref_frame_add(frame, ppref);
-
- ppref = purple_plugin_pref_new_with_label("string");
- purple_plugin_pref_frame_add(frame, ppref);
-
- ppref = purple_plugin_pref_new_with_name_and_label(
- "/plugins/core/pluginpref_example/string",
- "string pref");
- purple_plugin_pref_frame_add(frame, ppref);
-
- ppref = purple_plugin_pref_new_with_name_and_label(
- "/plugins/core/pluginpref_example/masked_string",
- "masked string");
- purple_plugin_pref_set_masked(ppref, TRUE);
- purple_plugin_pref_frame_add(frame, ppref);
-
- ppref = purple_plugin_pref_new_with_name_and_label(
- "/plugins/core/pluginpref_example/max_string",
- "string pref\n(max length of 16)");
- purple_plugin_pref_set_max_length(ppref, 16);
- purple_plugin_pref_frame_add(frame, ppref);
-
- ppref = purple_plugin_pref_new_with_name_and_label(
- "/plugins/core/pluginpref_example/multiline",
- "multiline string pref");
- purple_plugin_pref_set_pref_type(ppref, PURPLE_PLUGIN_PREF_STRING_FORMAT);
- purple_plugin_pref_set_format_type(ppref, PURPLE_STRING_FORMAT_TYPE_MULTILINE);
- purple_plugin_pref_frame_add(frame, ppref);
-
- ppref = purple_plugin_pref_new_with_name_and_label(
- "/plugins/core/pluginpref_example/html",
- "html string pref");
- purple_plugin_pref_set_pref_type(ppref, PURPLE_PLUGIN_PREF_STRING_FORMAT);
- purple_plugin_pref_set_format_type(ppref, PURPLE_STRING_FORMAT_TYPE_HTML);
- purple_plugin_pref_frame_add(frame, ppref);
-
- ppref = purple_plugin_pref_new_with_name_and_label(
- "/plugins/core/pluginpref_example/string_choice",
- "string choice");
- purple_plugin_pref_set_pref_type(ppref, PURPLE_PLUGIN_PREF_CHOICE);
- purple_plugin_pref_add_choice(ppref, "red", "red");
- purple_plugin_pref_add_choice(ppref, "orange", "orange");
- purple_plugin_pref_add_choice(ppref, "yellow", "yellow");
- purple_plugin_pref_add_choice(ppref, "green", "green");
- purple_plugin_pref_add_choice(ppref, "blue", "blue");
- purple_plugin_pref_add_choice(ppref, "purple", "purple");
- purple_plugin_pref_frame_add(frame, ppref);
-
- return frame;
-}
-
-static PurplePluginInfo *
-plugin_query(GError **error)
-{
- const gchar * const authors[] = {
- "Gary Kramlich <amc_grim@users.sf.net>",
- NULL
- };
-
- return purple_plugin_info_new(
- "id", "core-pluginpref_example",
- "name", "Pluginpref Example",
- "version", DISPLAY_VERSION,
- "category", "Example",
- "summary", "An example of how to use pluginprefs",
- "description", "An example of how to use pluginprefs",
- "authors", authors,
- "website", PURPLE_WEBSITE,
- "abi-version", PURPLE_ABI_VERSION,
- "pref-frame-cb", get_plugin_pref_frame,
- NULL
- );
-}
-
-static gboolean
-plugin_load(PurplePlugin *plugin, GError **error)
-{
- purple_prefs_add_none("/plugins/core/pluginpref_example");
- purple_prefs_add_bool("/plugins/core/pluginpref_example/bool", TRUE);
- purple_prefs_add_int("/plugins/core/pluginpref_example/int", 0);
- purple_prefs_add_int("/plugins/core/pluginpref_example/int_choice", 1);
- purple_prefs_add_string("/plugins/core/pluginpref_example/string",
- "string");
- purple_prefs_add_string("/plugins/core/pluginpref_example/max_string",
- "max length string");
- purple_prefs_add_string("/plugins/core/pluginpref_example/multiline",
- "line1\nline2");
- purple_prefs_add_string("/plugins/core/pluginpref_example/html",
- "foo <b>bar</b> baz");
- purple_prefs_add_string("/plugins/core/pluginpref_example/masked_string", "masked");
- purple_prefs_add_string("/plugins/core/pluginpref_example/string_choice", "red");
-
- return TRUE;
-}
-
-static gboolean
-plugin_unload(PurplePlugin *plugin, GError **error)
-{
- return TRUE;
-}
-
-PURPLE_PLUGIN_INIT(ppexample, plugin_query, plugin_load, plugin_unload);
--- a/libpurple/plugins/signals-test.c Wed Nov 04 02:41:46 2020 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,826 +0,0 @@
-/*
- * Signals test plugin.
- *
- * Copyright (C) 2003 Christian Hammond.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02111-1301, USA.
- */
-#define SIGNAL_TEST_PLUGIN_ID "core-signals-test"
-
-#include <glib/gi18n-lib.h>
-
-#include <purple.h>
-
-#include <stdio.h>
-
-/**************************************************************************
- * Account subsystem signal callbacks
- **************************************************************************/
-static void
-account_connecting_cb(PurpleAccount *account, void *data)
-{
- purple_debug_misc("signals test", "account-connecting (%s)\n",
- purple_account_get_username(account));
-}
-
-static void
-account_setting_info_cb(PurpleAccount *account, const char *info, void *data)
-{
- purple_debug_misc("signals test", "account-setting-info (%s, %s)\n",
- purple_account_get_username(account), info);
-}
-
-static void
-account_set_info_cb(PurpleAccount *account, const char *info, void *data)
-{
- purple_debug_misc("signals test", "account-set-info (%s, %s)\n",
- purple_account_get_username(account), info);
-}
-
-static void
-account_status_changed(PurpleAccount *account, PurpleStatus *old, PurpleStatus *new,
- gpointer data)
-{
- purple_debug_misc("signals test", "account-status-changed (%s, %s, %s)\n",
- purple_account_get_username(account),
- purple_status_get_name(old),
- purple_status_get_name(new));
-}
-
-static void
-account_alias_changed(PurpleAccount *account, const char *old, gpointer data)
-{
- purple_debug_misc("signals test", "account-alias-changed (%s, %s, %s)\n",
- purple_account_get_username(account),
- old, purple_account_get_private_alias(account));
-}
-
-static int
-account_authorization_requested_cb(PurpleAccount *account, const char *user, const char *message, char *response, gpointer data)
-{
- purple_debug_misc("signals test", "account-authorization-requested (%s, %s, %s)\n",
- purple_account_get_username(account), user, message);
- return PURPLE_ACCOUNT_RESPONSE_PASS;
-}
-
-static void
-account_authorization_granted_cb(PurpleAccount *account, const char *user, const char *message, gpointer data)
-{
- purple_debug_misc("signals test", "account-authorization-granted (%s, %s, %s)\n",
- purple_account_get_username(account), user, message);
-}
-
-static void
-account_authorization_denied_cb(PurpleAccount *account, const char *user, const char *message, gpointer data)
-{
- purple_debug_misc("signals test", "account-authorization-denied (%s, %s, %s)\n",
- purple_account_get_username(account), user, message);
-}
-
-/**************************************************************************
- * Buddy Icons signal callbacks
- **************************************************************************/
-static void
-buddy_icon_changed_cb(PurpleBuddy *buddy)
-{
- purple_debug_misc("signals test", "buddy icon changed (%s)\n",
- purple_buddy_get_name(buddy));
-}
-
-/**************************************************************************
- * Buddy List subsystem signal callbacks
- **************************************************************************/
-static void
-buddy_status_changed_cb(PurpleBuddy *buddy, PurpleStatus *old_status,
- PurpleStatus *status, void *data)
-{
- purple_debug_misc("signals test", "buddy-status-changed (%s %s to %s)\n",
- purple_buddy_get_name(buddy),
- purple_status_get_id(old_status),
- purple_status_get_id(status));
-}
-
-static void
-buddy_idle_changed_cb(PurpleBuddy *buddy, gboolean old_idle, gboolean idle,
- void *data)
-{
- purple_debug_misc("signals test", "buddy-idle-changed (%s %s)\n",
- purple_buddy_get_name(buddy),
- old_idle ? "unidled" : "idled");
-}
-
-static void
-buddy_signed_on_cb(PurpleBuddy *buddy, void *data)
-{
- purple_debug_misc("signals test", "buddy-signed-on (%s)\n",
- purple_buddy_get_name(buddy));
-}
-
-static void
-buddy_signed_off_cb(PurpleBuddy *buddy, void *data)
-{
- purple_debug_misc("signals test", "buddy-signed-off (%s)\n",
- purple_buddy_get_name(buddy));
-}
-
-static void
-blist_node_added_cb(PurpleBlistNode *bnode, void *data)
-{
- const char *name;
- if (PURPLE_IS_GROUP(bnode))
- name = purple_group_get_name(PURPLE_GROUP(bnode));
- else if (PURPLE_IS_CONTACT(bnode))
- /* Close enough */
- name = purple_contact_get_alias(PURPLE_CONTACT(bnode));
- else if (PURPLE_IS_BUDDY(bnode))
- name = purple_buddy_get_name(PURPLE_BUDDY(bnode));
- else
- name = "(unknown)";
-
- purple_debug_misc("signals test", "blist_node_added_cb (%s)\n",
- name ? name : "(null)");
-}
-
-static void
-blist_node_removed_cb(PurpleBlistNode *bnode, void *data)
-{
- const char *name;
- if (PURPLE_IS_GROUP(bnode))
- name = purple_group_get_name(PURPLE_GROUP(bnode));
- else if (PURPLE_IS_CONTACT(bnode))
- /* Close enough */
- name = purple_contact_get_alias(PURPLE_CONTACT(bnode));
- else if (PURPLE_IS_BUDDY(bnode))
- name = purple_buddy_get_name(PURPLE_BUDDY(bnode));
- else
- name = "(unknown)";
-
- purple_debug_misc("signals test", "blist_node_removed_cb (%s)\n",
- name ? name : "(null)");
-}
-
-static void
-blist_node_aliased(PurpleBlistNode *node, const char *old_alias)
-{
- PurpleContact *p = PURPLE_CONTACT(node);
- PurpleBuddy *b = PURPLE_BUDDY(node);
- PurpleChat *c = PURPLE_CHAT(node);
- PurpleGroup *g = PURPLE_GROUP(node);
-
- if (PURPLE_IS_CONTACT(node)) {
- purple_debug_misc("signals test",
- "blist-node-aliased (Contact: %s, %s)\n",
- purple_contact_get_alias(p), old_alias);
- } else if (PURPLE_IS_BUDDY(node)) {
- purple_debug_misc("signals test",
- "blist-node-aliased (Buddy: %s, %s)\n",
- purple_buddy_get_name(b), old_alias);
- } else if (PURPLE_IS_CHAT(node)) {
- purple_debug_misc("signals test",
- "blist-node-aliased (Chat: %s, %s)\n",
- purple_chat_get_name(c), old_alias);
- } else if (PURPLE_IS_GROUP(node)) {
- purple_debug_misc("signals test",
- "blist-node-aliased (Group: %s, %s)\n",
- purple_group_get_name(g), old_alias);
- }
-}
-
-static void
-blist_node_extended_menu_cb(PurpleBlistNode *node, void *data)
-{
- PurpleContact *p = PURPLE_CONTACT(node);
- PurpleBuddy *b = PURPLE_BUDDY(node);
- PurpleChat *c = PURPLE_CHAT(node);
- PurpleGroup *g = PURPLE_GROUP(node);
-
- if (PURPLE_IS_CONTACT(node)) {
- purple_debug_misc("signals test",
- "blist-node-extended-menu (Contact: %s)\n",
- purple_contact_get_alias(p));
- } else if (PURPLE_IS_BUDDY(node)) {
- purple_debug_misc("signals test",
- "blist-node-extended-menu (Buddy: %s)\n",
- purple_buddy_get_name(b));
- } else if (PURPLE_IS_CHAT(node)) {
- purple_debug_misc("signals test",
- "blist-node-extended-menu (Chat: %s)\n",
- purple_chat_get_name(c));
- } else if (PURPLE_IS_GROUP(node)) {
- purple_debug_misc("signals test",
- "blist-node-extended-menu (Group: %s)\n",
- purple_group_get_name(g));
- }
-}
-
-
-/**************************************************************************
- * Connection subsystem signal callbacks
- **************************************************************************/
-static void
-signing_on_cb(PurpleConnection *gc, void *data)
-{
- purple_debug_misc("signals test", "signing-on (%s)\n",
- purple_account_get_username(purple_connection_get_account(gc)));
-}
-
-static void
-signed_on_cb(PurpleConnection *gc, void *data)
-{
- purple_debug_misc("signals test", "signed-on (%s)\n",
- purple_account_get_username(purple_connection_get_account(gc)));
-}
-
-static void
-signing_off_cb(PurpleConnection *gc, void *data)
-{
- purple_debug_misc("signals test", "signing-off (%s)\n",
- purple_account_get_username(purple_connection_get_account(gc)));
-}
-
-static void
-signed_off_cb(PurpleConnection *gc, void *data)
-{
- purple_debug_misc("signals test", "signed-off (%s)\n",
- purple_account_get_username(purple_connection_get_account(gc)));
-}
-
-static void
-connection_error_cb(PurpleConnection *gc,
- PurpleConnectionError err,
- const gchar *desc,
- void *data)
-{
- const gchar *username =
- purple_account_get_username(purple_connection_get_account(gc));
- purple_debug_misc("signals test", "connection-error (%s, %u, %s)\n",
- username, err, desc);
-}
-
-/**************************************************************************
- * Conversation subsystem signal callbacks
- **************************************************************************/
-static gboolean
-writing_im_msg_cb(PurpleConversation *conv, PurpleMessage *pmsg)
-{
- purple_debug_misc("signals test", "writing-im-msg (%s, %s)\n",
- purple_conversation_get_name(conv),
- purple_message_get_contents(pmsg));
-
- return FALSE;
-
-}
-
-static void
-wrote_im_msg_cb(PurpleConversation *conv, PurpleMessage *msg, gpointer data)
-{
- purple_debug_misc("signals test", "wrote-im-msg (%s, %s)\n",
- purple_conversation_get_name(conv),
- purple_message_get_contents(msg));
-}
-
-static void
-sending_im_msg_cb(PurpleAccount *account, PurpleMessage *msg, void *data)
-{
- purple_debug_misc("signals test", "sending-im-msg (%s, %s, %s)\n",
- purple_account_get_username(account),
- purple_message_get_recipient(msg),
- purple_message_get_contents(msg));
-
-}
-
-static void
-sent_im_msg_cb(PurpleAccount *account, PurpleMessage *msg, void *data)
-{
- purple_debug_misc("signals test", "sent-im-msg (%s, %s, %s)\n",
- purple_account_get_username(account),
- purple_message_get_recipient(msg),
- purple_message_get_contents(msg));
-}
-
-static gboolean
-receiving_im_msg_cb(PurpleAccount *account, char **sender, char **buffer,
- PurpleConversation *conv, PurpleMessageFlags *flags, void *data)
-{
- purple_debug_misc("signals test", "receiving-im-msg (%s, %s, %s, %s, %d)\n",
- purple_account_get_username(account), *sender, *buffer,
- (conv != NULL) ? purple_conversation_get_name(conv) : "(null)", *flags);
-
- return FALSE;
-}
-
-static void
-received_im_msg_cb(PurpleAccount *account, char *sender, char *buffer,
- PurpleConversation *conv, PurpleMessageFlags flags, void *data)
-{
- purple_debug_misc("signals test", "received-im-msg (%s, %s, %s, %s, %d)\n",
- purple_account_get_username(account), sender, buffer,
- (conv != NULL) ? purple_conversation_get_name(conv) : "(null)", flags);
-}
-
-static gboolean
-writing_chat_msg_cb(PurpleAccount *account, const char *who, char **buffer,
- PurpleConversation *conv, PurpleMessageFlags flags, void *data)
-{
- purple_debug_misc("signals test", "writing-chat-msg (%s, %s)\n",
- purple_conversation_get_name(conv), *buffer);
-
- return FALSE;
-}
-
-static void
-wrote_chat_msg_cb(PurpleConversation *conv, PurpleMessage *msg, gpointer data)
-{
- purple_debug_misc("signals test", "wrote-chat-msg (%s, %s)\n",
- purple_conversation_get_name(conv),
- purple_message_get_contents(msg));
-}
-
-static gboolean
-sending_chat_msg_cb(PurpleAccount *account, PurpleMessage *msg, int id, void *data)
-{
- purple_debug_misc("signals test", "sending-chat-msg (%s, %s, %d)\n",
- purple_account_get_username(account),
- purple_message_get_contents(msg), id);
-
- return FALSE;
-}
-
-static void
-sent_chat_msg_cb(PurpleAccount *account, PurpleMessage *msg, int id, void *data)
-{
- purple_debug_misc("signals test", "sent-chat-msg (%s, %s, %d)\n",
- purple_account_get_username(account),
- purple_message_get_contents(msg), id);
-}
-
-static gboolean
-receiving_chat_msg_cb(PurpleAccount *account, char **sender, char **buffer,
- PurpleConversation *chat, PurpleMessageFlags *flags, void *data)
-{
- purple_debug_misc("signals test",
- "receiving-chat-msg (%s, %s, %s, %s, %d)\n",
- purple_account_get_username(account), *sender, *buffer,
- purple_conversation_get_name(chat), *flags);
-
- return FALSE;
-}
-
-static void
-received_chat_msg_cb(PurpleAccount *account, char *sender, char *buffer,
- PurpleConversation *chat, PurpleMessageFlags flags, void *data)
-{
- purple_debug_misc("signals test",
- "received-chat-msg (%s, %s, %s, %s, %d)\n",
- purple_account_get_username(account), sender, buffer,
- purple_conversation_get_name(chat), flags);
-}
-
-static void
-conversation_created_cb(PurpleConversation *conv, void *data)
-{
- purple_debug_misc("signals test", "conversation-created (%s)\n",
- purple_conversation_get_name(conv));
-}
-
-static void
-deleting_conversation_cb(PurpleConversation *conv, void *data)
-{
- purple_debug_misc("signals test", "deleting-conversation (%s)\n",
- purple_conversation_get_name(conv));
-}
-
-static void
-buddy_typing_cb(PurpleAccount *account, const char *name, void *data)
-{
- purple_debug_misc("signals test", "buddy-typing (%s, %s)\n",
- purple_account_get_username(account), name);
-}
-
-static void
-buddy_typing_stopped_cb(PurpleAccount *account, const char *name, void *data)
-{
- purple_debug_misc("signals test", "buddy-typing-stopped (%s, %s)\n",
- purple_account_get_username(account), name);
-}
-
-static gboolean
-chat_user_joining_cb(PurpleConversation *conv, const char *user,
- PurpleChatUserFlags flags, void *data)
-{
- purple_debug_misc("signals test", "chat-user-joining (%s, %s, %d)\n",
- purple_conversation_get_name(conv), user, flags);
-
- return FALSE;
-}
-
-static void
-chat_user_joined_cb(PurpleConversation *conv, const char *user,
- PurpleChatUserFlags flags, gboolean new_arrival, void *data)
-{
- purple_debug_misc("signals test", "chat-user-joined (%s, %s, %d, %d)\n",
- purple_conversation_get_name(conv), user, flags, new_arrival);
-}
-
-static void
-chat_user_flags_cb(PurpleChatUser *cb, PurpleChatUserFlags oldflags,
- PurpleChatUserFlags newflags, void *data)
-{
- purple_debug_misc("signals test", "chat-user-flags (%s, %s, %d, %d)\n",
- purple_conversation_get_name(PURPLE_CONVERSATION(
- purple_chat_user_get_chat(cb))),
- purple_chat_user_get_name(cb), oldflags, newflags);
-}
-
-static gboolean
-chat_user_leaving_cb(PurpleConversation *conv, const char *user,
- const char *reason, void *data)
-{
- purple_debug_misc("signals test", "chat-user-leaving (%s, %s, %s)\n",
- purple_conversation_get_name(conv), user, reason);
-
- return FALSE;
-}
-
-static void
-chat_user_left_cb(PurpleConversation *conv, const char *user,
- const char *reason, void *data)
-{
- purple_debug_misc("signals test", "chat-user-left (%s, %s, %s)\n",
- purple_conversation_get_name(conv), user, reason);
-}
-
-static void
-chat_inviting_user_cb(PurpleConversation *conv, const char *name,
- char **reason, void *data)
-{
- purple_debug_misc("signals test", "chat-inviting-user (%s, %s, %s)\n",
- purple_conversation_get_name(conv), name, *reason);
-}
-
-static void
-chat_invited_user_cb(PurpleConversation *conv, const char *name,
- const char *reason, void *data)
-{
- purple_debug_misc("signals test", "chat-invited-user (%s, %s, %s)\n",
- purple_conversation_get_name(conv), name, reason);
-}
-
-static gint
-chat_invited_cb(PurpleAccount *account, const char *inviter,
- const char *room_name, const char *message,
- const GHashTable *components, void *data)
-{
- purple_debug_misc("signals test", "chat-invited (%s, %s, %s, %s)\n",
- purple_account_get_username(account), inviter,
- room_name, message);
-
- return 0;
-}
-
-static void
-chat_joined_cb(PurpleConversation *conv, void *data)
-{
- purple_debug_misc("signals test", "chat-joined (%s)\n",
- purple_conversation_get_name(conv));
-}
-
-static void
-chat_left_cb(PurpleConversation *conv, void *data)
-{
- purple_debug_misc("signals test", "chat-left (%s)\n",
- purple_conversation_get_name(conv));
-}
-
-static void
-chat_topic_changed_cb(PurpleConversation *conv, const char *who,
- const char *topic, void *data)
-{
- purple_debug_misc("signals test",
- "chat-topic-changed (%s topic changed to: \"%s\" by %s)\n",
- purple_conversation_get_name(conv), topic,
- (who) ? who : "unknown");
-}
-/**************************************************************************
- * Core signal callbacks
- **************************************************************************/
-static void
-quitting_cb(void *data)
-{
- purple_debug_misc("signals test", "quitting ()\n");
-}
-
-static void
-printhash(gpointer key, gpointer value, gpointer data)
-{
- char *a = (char *)key;
- char *b = (char *)value;
- GString *str = (GString *)data;
- g_string_append_printf(str, " [%s] = [%s]\n", a, b ? b : "(null)");
-}
-
-static gboolean
-uri_handler(const char *proto, const char *cmd, GHashTable *params)
-{
- GString *str = g_string_new("\n{\n");
- g_hash_table_foreach(params, printhash, str);
- g_string_append_c(str, '}');
- purple_debug_misc("signals test", "uri handler (%s, %s, %s)\n", proto, cmd, str->str);
- g_string_free(str, TRUE);
- return FALSE;
-}
-
-/**************************************************************************
- * Notify signals callbacks
- **************************************************************************/
-static void
-notify_email_cb(char *subject, char *from, char *to, char *url) {
- purple_debug_misc("signals test", "notify email: subject=%s, from=%s, to=%s, url=%s\n",
- subject, from, to, url);
-}
-
-static void
-notify_emails_cb(char **subjects, char **froms, char **tos, char **urls, guint count) {
- guint i;
- purple_debug_misc("signals test", "notify emails: count=%u\n", count);
- for(i=0; i<count && i<5; i++) {
- if(subjects[i]==NULL || froms[i]==NULL || tos[i]==NULL || urls[i]==NULL) continue;
- purple_debug_misc("signals test", "notify emails[%u]: subject=%s, from=%s, to=%s, url=%s\n",
- i, subjects[i], froms[i], tos[i], urls[i]);
- }
-}
-
-/**************************************************************************
- * Jabber signals callbacks
- **************************************************************************/
-static gboolean
-jabber_iq_received(PurpleConnection *pc, const char *type, const char *id,
- const char *from, PurpleXmlNode *iq)
-{
- purple_debug_misc("signals test", "jabber IQ (type=%s, id=%s, from=%s) %p\n",
- type, id, from ? from : "(null)", iq);
-
- /* We don't want the plugin to stop processing */
- return FALSE;
-}
-
-static gboolean
-jabber_message_received(PurpleConnection *pc, const char *type, const char *id,
- const char *from, const char *to, PurpleXmlNode *message)
-{
- purple_debug_misc("signals test", "jabber message (type=%s, id=%s, "
- "from=%s to=%s) %p\n",
- type ? type : "(null)", id ? id : "(null)",
- from ? from : "(null)", to ? to : "(null)", message);
-
- /* We don't want the plugin to stop processing */
- return FALSE;
-}
-
-static gboolean
-jabber_presence_received(PurpleConnection *pc, const char *type,
- const char *from, PurpleXmlNode *presence)
-{
- purple_debug_misc("signals test", "jabber presence (type=%s, from=%s) %p\n",
- type ? type : "(null)", from ? from : "(null)", presence);
-
- /* We don't want the plugin to stop processing */
- return FALSE;
-}
-
-static gboolean
-jabber_watched_iq(PurpleConnection *pc, const char *type, const char *id,
- const char *from, PurpleXmlNode *child)
-{
- purple_debug_misc("signals test", "jabber watched IQ (type=%s, id=%s, from=%s)\n"
- "child %p name=%s, namespace=%s\n",
- type, id, from, child, child->name,
- purple_xmlnode_get_namespace(child));
-
- if (purple_strequal(type, "get") || purple_strequal(type, "set")) {
- /* Send the requisite reply */
- PurpleXmlNode *iq = purple_xmlnode_new("iq");
- purple_xmlnode_set_attrib(iq, "to", from);
- purple_xmlnode_set_attrib(iq, "id", id);
- purple_xmlnode_set_attrib(iq, "type", "result");
-
- purple_signal_emit(purple_connection_get_protocol(pc),
- "jabber-sending-xmlnode", pc, &iq);
- if (iq != NULL)
- purple_xmlnode_free(iq);
- }
-
- /* Cookie monster eats IQ stanzas; the protocol shouldn't keep processing */
- return TRUE;
-}
-
-/**************************************************************************
- * Plugin stuff
- **************************************************************************/
-static PurplePluginInfo *
-plugin_query(GError **error)
-{
- const gchar * const authors[] = {
- "Christian Hammond <chipx86@gnupdate.org>",
- NULL
- };
-
- return purple_plugin_info_new(
- "id", SIGNAL_TEST_PLUGIN_ID,
- "name", N_("Signals Test"),
- "version", DISPLAY_VERSION,
- "category", N_("Testing"),
- "summary", N_("Test to see that all signals are working properly."),
- "description", N_("Test to see that all signals are working properly."),
- "authors", authors,
- "website", PURPLE_WEBSITE,
- "abi-version", PURPLE_ABI_VERSION,
- NULL
- );
-}
-
-static gboolean
-plugin_load(PurplePlugin *plugin, GError **error)
-{
- void *core_handle = purple_get_core();
- void *blist_handle = purple_blist_get_handle();
- void *conn_handle = purple_connections_get_handle();
- void *conv_handle = purple_conversations_get_handle();
- void *accounts_handle = purple_accounts_get_handle();
- void *notify_handle = purple_notify_get_handle();
- void *jabber_handle = purple_protocols_find("prpl-jabber");
-
- /* Accounts subsystem signals */
- purple_signal_connect(accounts_handle, "account-connecting",
- plugin, PURPLE_CALLBACK(account_connecting_cb), NULL);
- purple_signal_connect(accounts_handle, "account-setting-info",
- plugin, PURPLE_CALLBACK(account_setting_info_cb), NULL);
- purple_signal_connect(accounts_handle, "account-set-info",
- plugin, PURPLE_CALLBACK(account_set_info_cb), NULL);
- purple_signal_connect(accounts_handle, "account-status-changed",
- plugin, PURPLE_CALLBACK(account_status_changed), NULL);
- purple_signal_connect(accounts_handle, "account-alias-changed",
- plugin, PURPLE_CALLBACK(account_alias_changed), NULL);
- purple_signal_connect(accounts_handle, "account-authorization-requested",
- plugin, PURPLE_CALLBACK(account_authorization_requested_cb), NULL);
- purple_signal_connect(accounts_handle, "account-authorization-denied",
- plugin, PURPLE_CALLBACK(account_authorization_denied_cb), NULL);
- purple_signal_connect(accounts_handle, "account-authorization-granted",
- plugin, PURPLE_CALLBACK(account_authorization_granted_cb), NULL);
-
- /* Buddy List subsystem signals */
- purple_signal_connect(blist_handle, "buddy-status-changed",
- plugin, PURPLE_CALLBACK(buddy_status_changed_cb), NULL);
- purple_signal_connect(blist_handle, "buddy-idle-changed",
- plugin, PURPLE_CALLBACK(buddy_idle_changed_cb), NULL);
- purple_signal_connect(blist_handle, "buddy-signed-on",
- plugin, PURPLE_CALLBACK(buddy_signed_on_cb), NULL);
- purple_signal_connect(blist_handle, "buddy-signed-off",
- plugin, PURPLE_CALLBACK(buddy_signed_off_cb), NULL);
- purple_signal_connect(blist_handle, "blist-node-added",
- plugin, PURPLE_CALLBACK(blist_node_added_cb), NULL);
- purple_signal_connect(blist_handle, "blist-node-removed",
- plugin, PURPLE_CALLBACK(blist_node_removed_cb), NULL);
- purple_signal_connect(blist_handle, "buddy-icon-changed",
- plugin, PURPLE_CALLBACK(buddy_icon_changed_cb), NULL);
- purple_signal_connect(blist_handle, "blist-node-aliased",
- plugin, PURPLE_CALLBACK(blist_node_aliased), NULL);
- purple_signal_connect(blist_handle, "blist-node-extended-menu",
- plugin, PURPLE_CALLBACK(blist_node_extended_menu_cb), NULL);
-
- /* Connection subsystem signals */
- purple_signal_connect(conn_handle, "signing-on",
- plugin, PURPLE_CALLBACK(signing_on_cb), NULL);
- purple_signal_connect(conn_handle, "signed-on",
- plugin, PURPLE_CALLBACK(signed_on_cb), NULL);
- purple_signal_connect(conn_handle, "signing-off",
- plugin, PURPLE_CALLBACK(signing_off_cb), NULL);
- purple_signal_connect(conn_handle, "signed-off",
- plugin, PURPLE_CALLBACK(signed_off_cb), NULL);
- purple_signal_connect(conn_handle, "connection-error",
- plugin, PURPLE_CALLBACK(connection_error_cb), NULL);
-
- /* Conversations subsystem signals */
- purple_signal_connect(conv_handle, "writing-im-msg",
- plugin, PURPLE_CALLBACK(writing_im_msg_cb), NULL);
- purple_signal_connect(conv_handle, "wrote-im-msg",
- plugin, PURPLE_CALLBACK(wrote_im_msg_cb), NULL);
- purple_signal_connect(conv_handle, "sending-im-msg",
- plugin, PURPLE_CALLBACK(sending_im_msg_cb), NULL);
- purple_signal_connect(conv_handle, "sent-im-msg",
- plugin, PURPLE_CALLBACK(sent_im_msg_cb), NULL);
- purple_signal_connect(conv_handle, "receiving-im-msg",
- plugin, PURPLE_CALLBACK(receiving_im_msg_cb), NULL);
- purple_signal_connect(conv_handle, "received-im-msg",
- plugin, PURPLE_CALLBACK(received_im_msg_cb), NULL);
- purple_signal_connect(conv_handle, "writing-chat-msg",
- plugin, PURPLE_CALLBACK(writing_chat_msg_cb), NULL);
- purple_signal_connect(conv_handle, "wrote-chat-msg",
- plugin, PURPLE_CALLBACK(wrote_chat_msg_cb), NULL);
- purple_signal_connect(conv_handle, "sending-chat-msg",
- plugin, PURPLE_CALLBACK(sending_chat_msg_cb), NULL);
- purple_signal_connect(conv_handle, "sent-chat-msg",
- plugin, PURPLE_CALLBACK(sent_chat_msg_cb), NULL);
- purple_signal_connect(conv_handle, "receiving-chat-msg",
- plugin, PURPLE_CALLBACK(receiving_chat_msg_cb), NULL);
- purple_signal_connect(conv_handle, "received-chat-msg",
- plugin, PURPLE_CALLBACK(received_chat_msg_cb), NULL);
- purple_signal_connect(conv_handle, "conversation-created",
- plugin, PURPLE_CALLBACK(conversation_created_cb), NULL);
- purple_signal_connect(conv_handle, "deleting-conversation",
- plugin, PURPLE_CALLBACK(deleting_conversation_cb), NULL);
- purple_signal_connect(conv_handle, "buddy-typing",
- plugin, PURPLE_CALLBACK(buddy_typing_cb), NULL);
- purple_signal_connect(conv_handle, "buddy-typing-stopped",
- plugin, PURPLE_CALLBACK(buddy_typing_stopped_cb), NULL);
- purple_signal_connect(conv_handle, "chat-user-joining",
- plugin, PURPLE_CALLBACK(chat_user_joining_cb), NULL);
- purple_signal_connect(conv_handle, "chat-user-joined",
- plugin, PURPLE_CALLBACK(chat_user_joined_cb), NULL);
- purple_signal_connect(conv_handle, "chat-user-flags",
- plugin, PURPLE_CALLBACK(chat_user_flags_cb), NULL);
- purple_signal_connect(conv_handle, "chat-user-leaving",
- plugin, PURPLE_CALLBACK(chat_user_leaving_cb), NULL);
- purple_signal_connect(conv_handle, "chat-user-left",
- plugin, PURPLE_CALLBACK(chat_user_left_cb), NULL);
- purple_signal_connect(conv_handle, "chat-inviting-user",
- plugin, PURPLE_CALLBACK(chat_inviting_user_cb), NULL);
- purple_signal_connect(conv_handle, "chat-invited-user",
- plugin, PURPLE_CALLBACK(chat_invited_user_cb), NULL);
- purple_signal_connect(conv_handle, "chat-invited",
- plugin, PURPLE_CALLBACK(chat_invited_cb), NULL);
- purple_signal_connect(conv_handle, "chat-joined",
- plugin, PURPLE_CALLBACK(chat_joined_cb), NULL);
- purple_signal_connect(conv_handle, "chat-left",
- plugin, PURPLE_CALLBACK(chat_left_cb), NULL);
- purple_signal_connect(conv_handle, "chat-topic-changed",
- plugin, PURPLE_CALLBACK(chat_topic_changed_cb), NULL);
-
- /* Core signals */
- purple_signal_connect(core_handle, "quitting",
- plugin, PURPLE_CALLBACK(quitting_cb), NULL);
- purple_signal_connect(core_handle, "uri-handler",
- plugin, PURPLE_CALLBACK(uri_handler), NULL);
-
- /* Notify signals */
- purple_signal_connect(notify_handle, "displaying-email-notification",
- plugin, PURPLE_CALLBACK(notify_email_cb), NULL);
- purple_signal_connect(notify_handle, "displaying-emails-notification",
- plugin, PURPLE_CALLBACK(notify_emails_cb), NULL);
-
- /* Jabber signals */
- if (jabber_handle) {
- purple_signal_connect(jabber_handle, "jabber-receiving-iq", plugin,
- PURPLE_CALLBACK(jabber_iq_received), NULL);
- purple_signal_connect(jabber_handle, "jabber-receiving-message", plugin,
- PURPLE_CALLBACK(jabber_message_received), NULL);
- purple_signal_connect(jabber_handle, "jabber-receiving-presence", plugin,
- PURPLE_CALLBACK(jabber_presence_received), NULL);
-
- /* IQ namespace signals */
- purple_signal_emit(jabber_handle, "jabber-register-namespace-watcher",
- "bogus_node", "super-duper-namespace");
- /* The above is equivalent to doing:
- int result = GPOINTER_TO_INT(purple_plugin_ipc_call(jabber_handle, "register_namespace_watcher", &ok, "bogus_node", "super-duper-namespace"));
- */
-
- purple_signal_connect(jabber_handle, "jabber-watched-iq", plugin,
- PURPLE_CALLBACK(jabber_watched_iq), NULL);
- }
-
- return TRUE;
-}
-
-static gboolean
-plugin_unload(PurplePlugin *plugin, GError **error)
-{
- void *jabber_handle = purple_protocols_find("prpl-jabber");
-
- purple_signals_disconnect_by_handle(plugin);
-
- if (jabber_handle) {
- /* Unregister watched namespaces */
- purple_signal_emit(jabber_handle, "jabber-unregister-namespace-watcher",
- "bogus_node", "super-duper-namespace");
- /* The above is equivalent to doing:
- int result = GPOINTER_TO_INT(purple_plugin_ipc_call(jabber_handle, "unregister_namespace_watcher", &ok, "bogus_node", "super-duper-namespace"));
- */
- }
-
- return TRUE;
-}
-
-PURPLE_PLUGIN_INIT(signalstest, plugin_query, plugin_load, plugin_unload);
--- a/libpurple/plugins/simple.c Wed Nov 04 02:41:46 2020 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02111-1301, USA.
- */
-
-#include <glib/gi18n-lib.h>
-
-#include <purple.h>
-
-/** Plugin id : type-author-name (to guarantee uniqueness) */
-#define SIMPLE_PLUGIN_ID "core-ewarmenhoven-simple"
-
-static PurplePluginInfo *
-plugin_query(GError **error)
-{
- const gchar * const authors[] = {
- "Eric Warmenhoven <eric@warmenhoven.org>",
- NULL
- };
-
- return purple_plugin_info_new(
- "id", SIMPLE_PLUGIN_ID,
- "name", N_("Simple Plugin"),
- "version", DISPLAY_VERSION,
- "category", N_("Testing"),
- "summary", N_("Tests to see that most things are working."),
- "description", N_("Tests to see that most things are working."),
- "authors", authors,
- "website", PURPLE_WEBSITE,
- "abi-version", PURPLE_ABI_VERSION,
- NULL
- );
-}
-
-static gboolean
-plugin_load(PurplePlugin *plugin, GError **error)
-{
- purple_debug(PURPLE_DEBUG_INFO, "simple", "simple plugin loaded.\n");
-
- return TRUE;
-}
-
-static gboolean
-plugin_unload(PurplePlugin *plugin, GError **error)
-{
- purple_debug(PURPLE_DEBUG_INFO, "simple", "simple plugin unloaded.\n");
-
- return TRUE;
-}
-
-PURPLE_PLUGIN_INIT(simple, plugin_query, plugin_load, plugin_unload);
--- a/libpurple/plugins/test-request-input.c Wed Nov 04 02:41:46 2020 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,155 +0,0 @@
-/* pidgin
- *
- * Pidgin is the legal property of its developers, whose names are too numerous
- * to list here. Please refer to the COPYRIGHT file distributed with this
- * source distribution.
- *
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
- */
-
-#include <glib.h>
-#include <glib/gi18n-lib.h>
-
-#include <purple.h>
-
-#define PREF_ROOT "/plugins"
-#define PREF_TEST "/plugins/tests"
-#define PREF_PREFIX "/plugins/tests/request-input"
-#define PREF_SINGLE PREF_PREFIX "/single"
-#define PREF_MULTIPLE PREF_PREFIX "/multiple"
-#define PREF_HTML PREF_PREFIX "/html"
-
-static void
-plugin_input_callback(const gchar *pref, const gchar *text) {
- purple_prefs_set_string(pref, text);
-}
-
-static void
-plugin_input_single(PurplePluginAction *action) {
- purple_request_input(
- NULL,
- _("Test request input single"),
- _("Test request input single"),
- NULL,
- purple_prefs_get_string(PREF_SINGLE),
- FALSE,
- FALSE,
- NULL,
- _("OK"),
- PURPLE_CALLBACK(plugin_input_callback),
- _("Cancel"),
- NULL,
- purple_request_cpar_new(),
- PREF_SINGLE
- );
-}
-
-static void
-plugin_input_multiple(PurplePluginAction *action) {
- purple_request_input(
- NULL,
- _("Test request input multiple"),
- _("Test request input multiple"),
- NULL,
- purple_prefs_get_string(PREF_MULTIPLE),
- TRUE,
- FALSE,
- NULL,
- _("OK"),
- PURPLE_CALLBACK(plugin_input_callback),
- _("Cancel"),
- NULL,
- purple_request_cpar_new(),
- PREF_MULTIPLE
- );
-}
-
-static void
-plugin_input_html(PurplePluginAction *action) {
- purple_request_input(
- NULL,
- _("Test request input HTML"),
- _("Test request input HTML"),
- NULL,
- purple_prefs_get_string(PREF_HTML),
- FALSE,
- FALSE,
- "html",
- _("OK"),
- PURPLE_CALLBACK(plugin_input_callback),
- _("Cancel"),
- NULL,
- purple_request_cpar_new(),
- PREF_HTML
- );
-}
-
-static GList *
-plugin_actions(PurplePlugin *plugin) {
- GList *l = NULL;
- PurplePluginAction *action = NULL;
-
- action = purple_plugin_action_new(_("Input single"), plugin_input_single);
- l = g_list_append(l, action);
-
- action = purple_plugin_action_new(_("Input multiple"), plugin_input_multiple);
- l = g_list_append(l, action);
-
- action = purple_plugin_action_new(_("Input html"), plugin_input_html);
- l = g_list_append(l, action);
-
- return l;
-}
-
-static PurplePluginInfo *
-plugin_query(GError **error) {
- const gchar * const authors[] = {
- "Gary Kramlich <grim@reaperworld.com>",
- NULL
- };
-
- return purple_plugin_info_new(
- "id", "core-test_request_input",
- "name", N_("Test: request input"),
- "version", DISPLAY_VERSION,
- "category", N_("Testing"),
- "summary", N_("Test Request Input"),
- "description", N_("This plugin adds actions to test purple_request_input"),
- "authors", authors,
- "website", "https://pidgin.im",
- "abi-version", PURPLE_ABI_VERSION,
- "actions-cb", plugin_actions,
- NULL
- );
-};
-
-static gboolean
-plugin_load(PurplePlugin *plugin, GError **error) {
- purple_prefs_add_none(PREF_ROOT);
- purple_prefs_add_none(PREF_TEST);
- purple_prefs_add_none(PREF_PREFIX);
- purple_prefs_add_string(PREF_SINGLE, "");
- purple_prefs_add_string(PREF_MULTIPLE, "");
- purple_prefs_add_string(PREF_HTML, "");
-
- return TRUE;
-}
-
-static gboolean
-plugin_unload(PurplePlugin *plugin, GError **error) {
- return TRUE;
-}
-
-PURPLE_PLUGIN_INIT(test_request_input, plugin_query, plugin_load, plugin_unload);
--- a/pidgin/plugins/contact_priority.c Wed Nov 04 02:41:46 2020 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,208 +0,0 @@
-/*
- * Contact priority settings plugin.
- *
- * Copyright (C) 2003 Etan Reisner, <deryni9@users.sourceforge.net>.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA.
- */
-
-#include <glib/gi18n-lib.h>
-
-#include <gtk/gtk.h>
-
-#include <purple.h>
-
-#include <pidgin.h>
-
-#define CONTACT_PRIORITY_PLUGIN_ID "gtk-contact-priority"
-
-static void
-select_account(GtkWidget *widget, gpointer data)
-{
- PidginAccountChooser *chooser = PIDGIN_ACCOUNT_CHOOSER(widget);
- PurpleAccount *account = pidgin_account_chooser_get_selected(chooser);
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(data),
- (gdouble)purple_account_get_int(account, "score", 0));
-}
-
-static void
-account_update(GtkWidget *widget, gpointer data)
-{
- PurpleAccount *account = NULL;
- PidginAccountChooser *chooser = PIDGIN_ACCOUNT_CHOOSER(data);
-
- account = pidgin_account_chooser_get_selected(chooser);
- purple_account_set_int(account, "score", gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget)));
-}
-
-static void
-pref_update(GtkWidget *widget, char *pref)
-{
- if (purple_prefs_get_pref_type(pref) == PURPLE_PREF_INT)
- purple_prefs_set_int(pref, gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget)));
- if (purple_prefs_get_pref_type(pref) == PURPLE_PREF_BOOLEAN)
- purple_prefs_set_bool(pref, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)));
-}
-
-static struct PurpleContactPriorityStatuses
-{
- const char *id;
- const char *description;
-} const statuses[] =
-{
- { "idle", N_("Buddy is idle") },
- { "away", N_("Buddy is away") },
- { "extended_away", N_("Buddy is \"extended\" away") },
-#if 0
- /* Not used yet. */
- { "mobile", N_("Buddy is mobile") },
-#endif
- { "offline", N_("Buddy is offline") },
- { NULL, NULL }
-};
-
-static GtkWidget *
-get_config_frame(PurplePlugin *plugin)
-{
- GtkWidget *ret = NULL, *hbox = NULL, *frame = NULL, *vbox = NULL;
- GtkWidget *label = NULL, *spin = NULL, *check = NULL;
- GtkWidget *chooser = NULL;
- GtkAdjustment *adj = NULL;
- GtkSizeGroup *sg = NULL;
- GtkListStore *store = NULL;
- PurpleAccount *account = NULL;
- int i;
-
- gboolean last_match = purple_prefs_get_bool("/purple/contact/last_match");
-
- sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
-
- ret = gtk_box_new(GTK_ORIENTATION_VERTICAL, 18);
- gtk_container_set_border_width(GTK_CONTAINER(ret), 12);
-
- frame = pidgin_make_frame(ret, _("Point values to use when..."));
-
- vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
- gtk_container_add(GTK_CONTAINER(frame), vbox);
-
- /* Status Spinboxes */
- for (i = 0 ; statuses[i].id != NULL && statuses[i].description != NULL ; i++)
- {
- char *pref = g_strconcat("/purple/status/scores/", statuses[i].id, NULL);
-
- hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
- gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
-
- label = gtk_label_new_with_mnemonic(_(statuses[i].description));
- gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
- gtk_size_group_add_widget(sg, label);
- gtk_label_set_xalign(GTK_LABEL(label), 0);
- gtk_label_set_yalign(GTK_LABEL(label), 0);
-
- adj = GTK_ADJUSTMENT(gtk_adjustment_new(purple_prefs_get_int(pref),
- -500, 500, 1, 1, 1));
- spin = gtk_spin_button_new(adj, 1, 0);
- g_signal_connect(G_OBJECT(spin), "value-changed", G_CALLBACK(pref_update), pref);
- gtk_box_pack_start(GTK_BOX(hbox), spin, FALSE, FALSE, 0);
-
- g_free(pref);
- }
-
- /* Explanation */
- label = gtk_label_new(NULL);
- gtk_label_set_markup(GTK_LABEL(label), _("The buddy with the <i>largest score</i> is the buddy who will have priority in the contact.\n"));
- gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
-
- /* Last match */
- hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
- gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
-
- check = gtk_check_button_new_with_label(_("Use last buddy when scores are equal"));
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), last_match);
- g_signal_connect(G_OBJECT(check), "toggled", G_CALLBACK(pref_update), "/purple/contact/last_match");
- gtk_box_pack_start(GTK_BOX(hbox), check, FALSE, FALSE, 0);
-
- frame = pidgin_make_frame(ret, _("Point values to use for account..."));
-
- vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
- gtk_container_add(GTK_CONTAINER(frame), vbox);
-
- /* Account */
- hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
- gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
-
- /* make this here so I can use it in the option menu callback, we'll
- * actually set it up later */
- adj = GTK_ADJUSTMENT(gtk_adjustment_new(0, -500, 500, 1, 1, 1));
- spin = gtk_spin_button_new(adj, 1, 0);
-
- store = pidgin_account_store_new();
- chooser = pidgin_account_chooser_new();
- gtk_combo_box_set_model(GTK_COMBO_BOX(chooser), GTK_TREE_MODEL(store));
- g_object_unref(G_OBJECT(store));
- gtk_box_pack_start(GTK_BOX(hbox), chooser, FALSE, FALSE, 0);
- g_signal_connect(chooser, "changed", G_CALLBACK(select_account), spin);
-
- /* this is where we set up the spin button we made above */
- account = pidgin_account_chooser_get_selected(PIDGIN_ACCOUNT_CHOOSER(chooser));
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin),
- (gdouble)purple_account_get_int(account, "score", 0));
- gtk_spin_button_set_adjustment(GTK_SPIN_BUTTON(spin), GTK_ADJUSTMENT(adj));
- g_signal_connect(G_OBJECT(spin), "value-changed",
- G_CALLBACK(account_update), chooser);
- gtk_box_pack_start(GTK_BOX(hbox), spin, FALSE, FALSE, 0);
-
- gtk_widget_show_all(ret);
- g_object_unref(sg);
-
- return ret;
-}
-
-static PidginPluginInfo *
-plugin_query(GError **error)
-{
- const gchar * const authors[] = {
- "Etan Reisner <deryni@eden.rutgers.edu>",
- NULL
- };
-
- return pidgin_plugin_info_new(
- "id", CONTACT_PRIORITY_PLUGIN_ID,
- "name", N_("Contact Priority"),
- "version", DISPLAY_VERSION,
- "category", N_("Utility"),
- "summary", N_("Allows for controlling the values associated with different buddy states."),
- "description", N_("Allows for changing the point values of idle/away/offline states for buddies in contact priority computations."),
- "authors", authors,
- "website", PURPLE_WEBSITE,
- "abi-version", PURPLE_ABI_VERSION,
- "gtk-config-frame-cb", get_config_frame,
- NULL
- );
-}
-
-static gboolean
-plugin_load(PurplePlugin *plugin, GError **error)
-{
- return TRUE;
-}
-
-static gboolean
-plugin_unload(PurplePlugin *plugin, GError **error)
-{
- return TRUE;
-}
-
-PURPLE_PLUGIN_INIT(contactpriority, plugin_query, plugin_load, plugin_unload);
--- a/pidgin/plugins/gtk-signals-test.c Wed Nov 04 02:41:46 2020 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,167 +0,0 @@
-/*
- * Signals test plugin.
- *
- * Copyright (C) 2003 Christian Hammond.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02111-1301, USA.
- */
-#define GTK_SIGNAL_TEST_PLUGIN_ID "gtk-signals-test"
-
-#include <glib/gi18n.h>
-
-#include <gtk/gtk.h>
-
-#include <purple.h>
-
-#include <pidgin.h>
-
-/**************************************************************************
- * Account subsystem signal callbacks
- **************************************************************************/
-static void
-account_modified_cb(PurpleAccount *account, void *data) {
- purple_debug_info("gtk-signal-test", "account modified cb\n");
-}
-
-/**************************************************************************
- * Buddy List subsystem signal callbacks
- **************************************************************************/
-static void
-blist_created_cb(PurpleBuddyList *blist, void *data) {
- purple_debug_info("gtk-signal-test", "buddy list created\n");
-}
-
-static void
-blist_drawing_tooltip_cb(PurpleBlistNode *node, GString *str, gboolean full, void *data) {
- purple_debug_info("gtk-signal-test", "drawing tooltip cb\n");
-}
-
-/**************************************************************************
- * Conversation subsystem signal callbacks
- **************************************************************************/
-static void
-conversation_dragging_cb(PidginConvWindow *source, PidginConvWindow *destination) {
- purple_debug_info("gtk-signal-test", "conversation dragging cb\n");
-}
-
-static gboolean
-displaying_im_msg_cb(PurpleConversation *conv, PurpleMessage *pmsg, gpointer data)
-{
- purple_debug_misc("gtk-signals test", "displaying-im-msg (%s, %s)\n",
- purple_conversation_get_name(conv),
- purple_message_get_contents(pmsg));
-
- return FALSE;
-}
-
-static void
-displayed_im_msg_cb(PurpleConversation *conv, PurpleMessage *msg, gpointer data)
-{
- purple_debug_misc("gtk-signals test", "displayed-im-msg (%s, %s)\n",
- purple_conversation_get_name(conv),
- purple_message_get_contents(msg));
-}
-
-static gboolean
-displaying_chat_msg_cb(PurpleConversation *conv, PurpleMessage *pmsg, gpointer data)
-{
- purple_debug_misc("gtk-signals test", "displaying-chat-msg (%s, %s)\n",
- purple_conversation_get_name(conv),
- purple_message_get_contents(pmsg));
-
- return FALSE;
-}
-
-static void
-displayed_chat_msg_cb(PurpleConversation *conv, PurpleMessage *msg, gpointer data)
-{
- purple_debug_misc("gtk-signals test", "displayed-chat-msg (%s, %s)\n",
- purple_conversation_get_name(conv),
- purple_message_get_contents(msg));
-}
-
-static void
-conversation_switched_cb(PurpleConversation *conv, void *data)
-{
- purple_debug_misc("gtk-signals test", "conversation-switched (%s)\n",
- purple_conversation_get_name(conv));
-}
-
-/**************************************************************************
- * Plugin stuff
- **************************************************************************/
-static PidginPluginInfo *
-plugin_query(GError **error)
-{
- const gchar * const authors[] = {
- "Gary Kramlich <amc_grim@users.sf.net>",
- NULL
- };
-
- return pidgin_plugin_info_new(
- "id", GTK_SIGNAL_TEST_PLUGIN_ID,
- "name", N_("GTK Signals Test"),
- "version", DISPLAY_VERSION,
- "category", N_("Testing"),
- "summary", N_("Test to see that all ui signals are working properly."),
- "description", N_("Test to see that all ui signals are working properly."),
- "authors", authors,
- "website", PURPLE_WEBSITE,
- "abi-version", PURPLE_ABI_VERSION,
- NULL
- );
-}
-
-static gboolean
-plugin_load(PurplePlugin *plugin, GError **error)
-{
- void *accounts_handle = pidgin_accounts_get_handle();
- void *blist_handle = pidgin_blist_get_handle();
- void *conv_handle = pidgin_conversations_get_handle();
-
- /* Accounts subsystem signals */
- purple_signal_connect(accounts_handle, "account-modified",
- plugin, PURPLE_CALLBACK(account_modified_cb), NULL);
-
- /* Buddy List subsystem signals */
- purple_signal_connect(blist_handle, "gtkblist-created",
- plugin, PURPLE_CALLBACK(blist_created_cb), NULL);
- purple_signal_connect(blist_handle, "drawing-tooltip",
- plugin, PURPLE_CALLBACK(blist_drawing_tooltip_cb), NULL);
-
- /* Conversations subsystem signals */
- purple_signal_connect(conv_handle, "conversation-dragging",
- plugin, PURPLE_CALLBACK(conversation_dragging_cb), NULL);
- purple_signal_connect(conv_handle, "displaying-im-msg",
- plugin, PURPLE_CALLBACK(displaying_im_msg_cb), NULL);
- purple_signal_connect(conv_handle, "displayed-im-msg",
- plugin, PURPLE_CALLBACK(displayed_im_msg_cb), NULL);
- purple_signal_connect(conv_handle, "displaying-chat-msg",
- plugin, PURPLE_CALLBACK(displaying_chat_msg_cb), NULL);
- purple_signal_connect(conv_handle, "displayed-chat-msg",
- plugin, PURPLE_CALLBACK(displayed_chat_msg_cb), NULL);
- purple_signal_connect(conv_handle, "conversation-switched",
- plugin, PURPLE_CALLBACK(conversation_switched_cb), NULL);
-
- return TRUE;
-}
-
-static gboolean
-plugin_unload(PurplePlugin *plugin, GError **error) {
- return TRUE;
-}
-
-PURPLE_PLUGIN_INIT(gtksignalstest, plugin_query, plugin_load, plugin_unload);
--- a/pidgin/plugins/history.c Wed Nov 04 02:41:46 2020 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,235 +0,0 @@
-/* Puts last 4k of log in new conversations a la Everybuddy (and then
- * stolen by Trillian "Pro") */
-
-#include "internal.h"
-#include "pidgin.h"
-
-#include <purple.h>
-
-#include "gtkconv.h"
-#include "gtkplugin.h"
-#include "gtkwebview.h"
-
-#define HISTORY_PLUGIN_ID "gtk-history"
-
-#define HISTORY_SIZE (4 * 1024)
-
-static gboolean _scroll_webview_to_end(gpointer data)
-{
- PidginWebView *webview = data;
- pidgin_webview_scroll_to_end(PIDGIN_WEBVIEW(webview), FALSE);
- g_object_unref(G_OBJECT(webview));
- return FALSE;
-}
-
-static void historize(PurpleConversation *c)
-{
- PurpleAccount *account = purple_conversation_get_account(c);
- const char *name = purple_conversation_get_name(c);
- GList *logs = NULL;
- const char *alias = name;
- guint flags;
- char *history;
- PidginConversation *gtkconv;
-#if 0
- /* FIXME: WebView has no options */
- GtkIMHtmlOptions options = GTK_IMHTML_NO_COLOURS;
-#endif
- char *header;
-#if 0
- /* FIXME: WebView has no protocol setting */
- char *protocol;
-#endif
- char *escaped_alias;
- GDateTime *dt;
- gchar *header_date;
-
- gtkconv = PIDGIN_CONVERSATION(c);
- g_return_if_fail(gtkconv != NULL);
-
- /* An IM which is the first active conversation. */
- g_return_if_fail(gtkconv->convs != NULL);
- if (PURPLE_IS_IM_CONVERSATION(c) && !gtkconv->convs->next)
- {
- GSList *buddies;
- GSList *cur;
-
- /* If we're not logging, don't show anything.
- * Otherwise, we might show a very old log. */
- if (!purple_prefs_get_bool("/purple/logging/log_ims"))
- return;
-
- /* Find buddies for this conversation. */
- buddies = purple_blist_find_buddies(account, name);
-
- /* If we found at least one buddy, save the first buddy's alias. */
- if (buddies != NULL)
- alias = purple_buddy_get_contact_alias(PURPLE_BUDDY(buddies->data));
-
- for (cur = buddies; cur != NULL; cur = cur->next)
- {
- PurpleBlistNode *node = cur->data;
- PurpleBlistNode *prev = purple_blist_node_get_sibling_prev(node);
- PurpleBlistNode *next = purple_blist_node_get_sibling_next(node);
- if ((node != NULL) && ((prev != NULL) || (next != NULL)))
- {
- PurpleBlistNode *node2;
- PurpleBlistNode *parent = purple_blist_node_get_parent(node);
- PurpleBlistNode *child = purple_blist_node_get_first_child(parent);
-
- alias = purple_buddy_get_contact_alias(PURPLE_BUDDY(node));
-
- /* We've found a buddy that matches this conversation. It's part of a
- * PurpleContact with more than one PurpleBuddy. Loop through the PurpleBuddies
- * in the contact and get all the logs. */
- for (node2 = child ; node2 != NULL ; node2 = purple_blist_node_get_sibling_next(node2))
- {
- logs = g_list_concat(purple_log_get_logs(PURPLE_LOG_IM,
- purple_buddy_get_name(PURPLE_BUDDY(node2)),
- purple_buddy_get_account(PURPLE_BUDDY(node2))),
- logs);
- }
- break;
- }
- }
- g_slist_free(buddies);
-
- if (logs == NULL)
- logs = purple_log_get_logs(PURPLE_LOG_IM, name, account);
- else
- logs = g_list_sort(logs, purple_log_compare);
- }
- else if (PURPLE_IS_CHAT_CONVERSATION(c))
- {
- /* If we're not logging, don't show anything.
- * Otherwise, we might show a very old log. */
- if (!purple_prefs_get_bool("/purple/logging/log_chats"))
- return;
-
- logs = purple_log_get_logs(PURPLE_LOG_CHAT, name, account);
- }
-
- if (logs == NULL)
- return;
-
- history = purple_log_read((PurpleLog*)logs->data, &flags);
- gtkconv = PIDGIN_CONVERSATION(c);
-#if 0
- /* FIXME: WebView has no options */
- if (flags & PURPLE_LOG_READ_NO_NEWLINE)
- options |= GTK_IMHTML_NO_NEWLINE;
-#endif
-
-#if 0
- /* FIXME: WebView has no protocol setting */
- protocol = g_strdup(gtk_imhtml_get_protocol_name(GTK_IMHTML(gtkconv->imhtml)));
- gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml),
- purple_account_get_protocol_name(((PurpleLog*)logs->data)->account));
-#endif
-
-#if 0
- /* TODO WebKit: Do this properly... */
- if (!pidgin_webview_is_empty(PIDGIN_WEBVIEW(gtkconv->webview)))
- pidgin_webview_append_html(PIDGIN_WEBVIEW(gtkconv->webview), "<BR>");
-#endif
-
- escaped_alias = g_markup_escape_text(alias, -1);
-
- dt = g_date_time_to_local(((PurpleLog *)logs->data)->time);
- header_date = g_date_time_format(dt, "%c");
- g_date_time_unref(dt);
-
- header = g_strdup_printf(_("<b>Conversation with %s on %s:</b><br>"), escaped_alias, header_date);
- pidgin_webview_append_html(PIDGIN_WEBVIEW(gtkconv->webview), header);
- g_free(header_date);
- g_free(header);
- g_free(escaped_alias);
-
- g_strchomp(history);
- pidgin_webview_append_html(PIDGIN_WEBVIEW(gtkconv->webview), history);
- g_free(history);
-
- pidgin_webview_append_html(PIDGIN_WEBVIEW(gtkconv->webview), "<hr>");
-
-#if 0
- /* FIXME: WebView has no protocol setting */
- gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), protocol);
- g_free(protocol);
-#endif
-
- g_object_ref(G_OBJECT(gtkconv->webview));
- g_idle_add(_scroll_webview_to_end, gtkconv->webview);
-
- g_list_free_full(logs, (GDestroyNotify)purple_log_free);
-}
-
-static void
-history_prefs_check(PurplePlugin *plugin)
-{
- if (!purple_prefs_get_bool("/purple/logging/log_ims") &&
- !purple_prefs_get_bool("/purple/logging/log_chats"))
- {
- /* Translators: Please maintain the use of ⇦ or ⇨ to represent the menu hierarchy */
- purple_notify_warning(plugin, NULL, _("History Plugin Requires Logging"),
- _("Logging can be enabled from Tools ⇨ Preferences ⇨ Logging.\n\n"
- "Enabling logs for instant messages and/or chats will activate "
- "history for the same conversation type(s)."), NULL);
- }
-}
-
-static void history_prefs_cb(const char *name, PurplePrefType type,
- gconstpointer val, gpointer data)
-{
- history_prefs_check((PurplePlugin *)data);
-}
-
-static PidginPluginInfo *
-plugin_query(GError **error)
-{
- const gchar * const authors[] = {
- "Sean Egan <seanegan@gmail.com>",
- NULL
- };
-
- return pidgin_plugin_info_new(
- "id", HISTORY_PLUGIN_ID,
- "name", N_("History"),
- "version", DISPLAY_VERSION,
- "category", N_("User interface"),
- "summary", N_("Shows recently logged conversations in new "
- "conversations."),
- "description", N_("When a new conversation is opened this plugin will "
- "insert the last conversation into the current "
- "conversation."),
- "authors", authors,
- "website", PURPLE_WEBSITE,
- "abi-version", PURPLE_ABI_VERSION,
- NULL
- );
-}
-
-static gboolean
-plugin_load(PurplePlugin *plugin, GError **error)
-{
- purple_signal_connect(purple_conversations_get_handle(),
- "conversation-created",
- plugin, PURPLE_CALLBACK(historize), NULL);
- /* XXX: Do we want to listen to pidgin's "conversation-displayed" signal? */
-
- purple_prefs_connect_callback(plugin, "/purple/logging/log_ims",
- history_prefs_cb, plugin);
- purple_prefs_connect_callback(plugin, "/purple/logging/log_chats",
- history_prefs_cb, plugin);
-
- history_prefs_check(plugin);
-
- return TRUE;
-}
-
-static gboolean
-plugin_unload(PurplePlugin *plugin, GError **error)
-{
- return TRUE;
-}
-
-PURPLE_PLUGIN_INIT(history, plugin_query, plugin_load, plugin_unload);
--- a/pidgin/plugins/imgupload.c Wed Nov 04 02:41:46 2020 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,468 +0,0 @@
-/*
- * Image Uploader - an inline images implementation for protocols without
- * support for such feature.
- *
- * Copyright (C) 2014, Tomasz Wasilczyk <twasilczyk@pidgin.im>
- *
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
- */
-
-#include "internal.h"
-
-#include <purple.h>
-
-#include "gtkconv.h"
-#include "gtkplugin.h"
-#include "gtkutils.h"
-#include "gtkwebviewtoolbar.h"
-
-#include <json-glib/json-glib.h>
-#include <libsoup/soup.h>
-
-#define IMGUP_IMGUR_CLIENT_ID "b6d33c6bb80e1b6"
-#define IMGUP_PREF_PREFIX "/plugins/gtk/imgupload/"
-
-static PurplePlugin *plugin_handle = NULL;
-static SoupSession *session = NULL;
-
-static void
-imgup_upload_done(PidginWebView *webview, const gchar *url, const gchar *title);
-static void
-imgup_upload_failed(PidginWebView *webview);
-
-
-/******************************************************************************
- * Helper functions
- ******************************************************************************/
-
-static gboolean
-imgup_conn_is_hooked(PurpleConnection *gc)
-{
- return GPOINTER_TO_INT(g_object_get_data(G_OBJECT(gc), "imgupload-set"));
-}
-
-
-/******************************************************************************
- * Imgur implementation
- ******************************************************************************/
-
-static void
-imgup_imgur_uploaded(G_GNUC_UNUSED SoupSession *session, SoupMessage *msg,
- gpointer _webview)
-{
- JsonParser *parser;
- JsonObject *result;
- PidginWebView *webview = PIDGIN_WEBVIEW(_webview);
- const gchar *url, *title;
-
- if (!SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)) {
- imgup_upload_failed(webview);
- return;
- }
-
- parser = json_parser_new();
- if (!json_parser_load_from_data(parser, msg->response_body->data,
- msg->response_body->length, NULL)) {
- purple_debug_warning("imgupload", "Invalid json got from imgur");
-
- imgup_upload_failed(webview);
- return;
- }
-
- result = json_node_get_object(json_parser_get_root(parser));
-
- if (!json_object_get_boolean_member(result, "success")) {
- g_object_unref(parser);
-
- purple_debug_warning("imgupload", "imgur - not a success");
-
- imgup_upload_failed(webview);
- return;
- }
-
- result = json_object_get_object_member(result, "data");
- url = json_object_get_string_member(result, "link");
-
- title = g_object_get_data(G_OBJECT(msg), "imgupload-imgur-name");
-
- imgup_upload_done(webview, url, title);
-
- g_object_unref(parser);
- g_object_set_data(G_OBJECT(msg), "imgupload-imgur-name", NULL);
-}
-
-static PurpleHttpConnection *
-imgup_imgur_upload(PidginWebView *webview, PurpleImage *image)
-{
- SoupMessage *msg;
- gchar *req_data, *img_data, *img_data_e;
-
- msg = soup_message_new("POST", "https://api.imgur.com/3/image");
- soup_message_headers_replace(msg, "Authorization",
- "Client-ID " IMGUP_IMGUR_CLIENT_ID);
-
- /* TODO: make it a plain, multipart/form-data request */
- img_data = g_base64_encode(purple_image_get_data(image),
- purple_image_get_data_size(image));
- img_data_e = g_uri_escape_string(img_data, NULL, FALSE);
- g_free(img_data);
- req_data = g_strdup_printf("type=base64&image=%s", img_data_e);
- g_free(img_data_e);
-
- soup_message_set_request(msg, "application/x-www-form-urlencoded",
- SOUP_MESSAGE_TAKE, req_data, strlen(req_data));
-
- g_object_set_data_full(G_OBJECT(msg), "imgupload-imgur-name",
- g_strdup(purple_image_get_friendly_filename(image)),
- g_free);
-
- soup_session_queue_message(session, msg, imgup_imgur_uploaded, webview);
-
- return msg;
-}
-
-/******************************************************************************
- * Image/link upload and insertion
- ******************************************************************************/
-
-static void
-imgup_upload_finish(PidginWebView *webview)
-{
- gpointer plswait;
-
- g_object_steal_data(G_OBJECT(webview), "imgupload-msg");
- plswait = g_object_get_data(G_OBJECT(webview), "imgupload-plswait");
- g_object_set_data(G_OBJECT(webview), "imgupload-plswait", NULL);
-
- if (plswait)
- purple_request_close(PURPLE_REQUEST_WAIT, plswait);
-}
-
-static void
-imgup_upload_done(PidginWebView *webview, const gchar *url, const gchar *title)
-{
- gboolean url_desc;
-
- imgup_upload_finish(webview);
-
- if (!purple_prefs_get_bool(IMGUP_PREF_PREFIX "use_url_desc"))
- url_desc = FALSE;
- else {
- PidginWebViewButtons format;
-
- format = pidgin_webview_get_format_functions(webview);
- url_desc = format & PIDGIN_WEBVIEW_LINKDESC;
- }
-
- pidgin_webview_insert_link(webview, url, url_desc ? title : NULL);
-}
-
-static void
-imgup_upload_failed(PidginWebView *webview)
-{
- gboolean is_cancelled;
-
- imgup_upload_finish(webview);
-
- is_cancelled = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(webview),
- "imgupload-cancelled"));
- g_object_set_data(G_OBJECT(webview), "imgupload-cancelled", NULL);
-
- if (!is_cancelled)
- purple_debug_error("imgupload", "Failed uploading image");
-}
-
-static void
-imgup_upload_cancel_message(SoupMessage *msg)
-{
- soup_session_cancel_message(session, msg, SOUP_STATUS_CANCELLED);
-}
-
-static void
-imgup_upload_cancel(gpointer _webview)
-{
- SoupMessage *msg;
- PidginWebView *webview = PIDGIN_WEBVIEW(_webview);
-
- g_object_set_data(G_OBJECT(webview), "imgupload-plswait", NULL);
- g_object_set_data(G_OBJECT(webview), "imgupload-cancelled",
- GINT_TO_POINTER(TRUE));
- msg = g_object_steal_data(G_OBJECT(webview), "imgupload-msg");
- if (msg) {
- soup_session_cancel_message(session, msg, SOUP_STATUS_CANCELLED);
- }
-}
-
-static gboolean
-imgup_upload_start(PidginWebView *webview, PurpleImage *image, gpointer _gtkconv)
-{
- PidginConversation *gtkconv = _gtkconv;
- PurpleConversation *conv = gtkconv->active_conv;
- SoupMessage *msg;
- gpointer plswait;
-
- if (!imgup_conn_is_hooked(purple_conversation_get_connection(conv)))
- return FALSE;
-
- msg = imgup_imgur_upload(webview, image);
- g_object_set_data_full(G_OBJECT(webview), "imgupload-msg", msg,
- (GDestroyNotify)imgup_upload_cancel_message);
-
- plswait = purple_request_wait(plugin_handle, _("Uploading image"),
- _("Please wait for image URL being retrieved..."),
- NULL, FALSE, imgup_upload_cancel,
- purple_request_cpar_from_conversation(conv), webview);
- g_object_set_data(G_OBJECT(webview), "imgupload-plswait", plswait);
-
- return TRUE;
-}
-
-
-/******************************************************************************
- * Setup/cleanup
- ******************************************************************************/
-
-static void
-imgup_pidconv_init(PidginConversation *gtkconv)
-{
- PidginWebView *webview;
-
- webview = PIDGIN_WEBVIEW(gtkconv->entry);
-
- g_signal_connect(G_OBJECT(webview), "insert-image",
- G_CALLBACK(imgup_upload_start), gtkconv);
-}
-
-static void
-imgup_pidconv_uninit(PidginConversation *gtkconv)
-{
- PidginWebView *webview;
-
- webview = PIDGIN_WEBVIEW(gtkconv->entry);
-
- g_signal_handlers_disconnect_by_func(G_OBJECT(webview),
- G_CALLBACK(imgup_upload_start), gtkconv);
-}
-
-static void
-imgup_conv_init(PurpleConversation *conv)
-{
- PurpleConnection *gc;
-
- gc = purple_conversation_get_connection(conv);
- if (!gc)
- return;
- if (!imgup_conn_is_hooked(gc))
- return;
-
- purple_conversation_set_features(conv,
- purple_conversation_get_features(conv) &
- ~PURPLE_CONNECTION_FLAG_NO_IMAGES);
-
- g_object_set_data(G_OBJECT(conv), "imgupload-set", GINT_TO_POINTER(TRUE));
-}
-
-static void
-imgup_conv_uninit(PurpleConversation *conv)
-{
- PurpleConnection *gc;
-
- gc = purple_conversation_get_connection(conv);
- if (gc) {
- if (!imgup_conn_is_hooked(gc))
- return;
- } else {
- if (!g_object_get_data(G_OBJECT(conv), "imgupload-set"))
- return;
- }
-
- purple_conversation_set_features(conv,
- purple_conversation_get_features(conv) |
- PURPLE_CONNECTION_FLAG_NO_IMAGES);
-
- g_object_set_data(G_OBJECT(conv), "imgupload-set", NULL);
-}
-
-static void
-imgup_conn_init(PurpleConnection *gc)
-{
- PurpleConnectionFlags flags;
-
- flags = purple_connection_get_flags(gc);
-
- if (!(flags & PURPLE_CONNECTION_FLAG_NO_IMAGES))
- return;
-
- flags &= ~PURPLE_CONNECTION_FLAG_NO_IMAGES;
- purple_connection_set_flags(gc, flags);
-
- g_object_set_data(G_OBJECT(gc), "imgupload-set", GINT_TO_POINTER(TRUE));
-}
-
-static void
-imgup_conn_uninit(PurpleConnection *gc)
-{
- if (!imgup_conn_is_hooked(gc))
- return;
-
- purple_connection_set_flags(gc, purple_connection_get_flags(gc) |
- PURPLE_CONNECTION_FLAG_NO_IMAGES);
-
- g_object_set_data(G_OBJECT(gc), "imgupload-set", NULL);
-}
-
-/******************************************************************************
- * Prefs
- ******************************************************************************/
-
-static void
-imgup_prefs_ok(gpointer _unused, PurpleRequestFields *fields)
-{
- gboolean use_url_desc;
-
- use_url_desc = purple_request_fields_get_bool(fields, "use_url_desc");
-
- purple_prefs_set_bool(IMGUP_PREF_PREFIX "use_url_desc", use_url_desc);
-}
-
-static gpointer
-imgup_prefs_get(PurplePlugin *plugin)
-{
- PurpleRequestCommonParameters *cpar;
- PurpleRequestFields *fields;
- PurpleRequestFieldGroup *group;
- PurpleRequestField *field;
- gpointer handle;
-
- fields = purple_request_fields_new();
- group = purple_request_field_group_new(NULL);
- purple_request_fields_add_group(fields, group);
-
- field = purple_request_field_bool_new("use_url_desc",
- _("Use image filename as link description"),
- purple_prefs_get_bool(IMGUP_PREF_PREFIX "use_url_desc"));
- purple_request_field_group_add_field(group, field);
-
- cpar = purple_request_cpar_new();
- purple_request_cpar_set_icon(cpar, PURPLE_REQUEST_ICON_DIALOG);
-
- handle = purple_request_fields(plugin,
- _("Image Uploader"), NULL, NULL, fields,
- _("OK"), (GCallback)imgup_prefs_ok,
- _("Cancel"), NULL,
- cpar, NULL);
-
- return handle;
-}
-
-/******************************************************************************
- * Plugin stuff
- ******************************************************************************/
-
-static PidginPluginInfo *
-plugin_query(GError **error)
-{
- const gchar * const authors[] = {
- "Tomasz Wasilczyk <twasilczyk@pidgin.im>",
- NULL
- };
-
- return pidgin_plugin_info_new(
- "id", "gtk-imgupload",
- "name", N_("Image Uploader"),
- "version", DISPLAY_VERSION,
- "category", N_("Utility"),
- "summary", N_("Inline images implementation for protocols "
- "without such feature."),
- "description", N_("Adds inline images support for protocols "
- "lacking this feature by uploading them to the "
- "external service."),
- "authors", authors,
- "website", PURPLE_WEBSITE,
- "abi-version", PURPLE_ABI_VERSION,
- "pref-request-cb", imgup_prefs_get,
- NULL
- );
-}
-
-static gboolean
-plugin_load(PurplePlugin *plugin, GError **error)
-{
- GList *it;
-
- purple_prefs_add_none("/plugins");
- purple_prefs_add_none("/plugins/gtk");
- purple_prefs_add_none("/plugins/gtk/imgupload");
-
- purple_prefs_add_bool(IMGUP_PREF_PREFIX "use_url_desc", TRUE);
-
- plugin_handle = plugin;
- session = soup_session_new();
-
- it = purple_connections_get_all();
- for (; it; it = g_list_next(it)) {
- PurpleConnection *gc = it->data;
- imgup_conn_init(gc);
- }
-
- it = purple_conversations_get_all();
- for (; it; it = g_list_next(it)) {
- PurpleConversation *conv = it->data;
- imgup_conv_init(conv);
- if (PIDGIN_IS_PIDGIN_CONVERSATION(conv))
- imgup_pidconv_init(PIDGIN_CONVERSATION(conv));
- }
-
- purple_signal_connect(purple_connections_get_handle(),
- "signed-on", plugin,
- PURPLE_CALLBACK(imgup_conn_init), NULL);
- purple_signal_connect(purple_connections_get_handle(),
- "signing-off", plugin,
- PURPLE_CALLBACK(imgup_conn_uninit), NULL);
- purple_signal_connect(pidgin_conversations_get_handle(),
- "conversation-displayed", plugin,
- PURPLE_CALLBACK(imgup_pidconv_init), NULL);
-
- return TRUE;
-}
-
-static gboolean
-plugin_unload(PurplePlugin *plugin, GError **error)
-{
- GList *it;
-
- soup_session_abort(session);
-
- it = purple_conversations_get_all();
- for (; it; it = g_list_next(it)) {
- PurpleConversation *conv = it->data;
- imgup_conv_uninit(conv);
- if (PIDGIN_IS_PIDGIN_CONVERSATION(conv))
- imgup_pidconv_uninit(PIDGIN_CONVERSATION(conv));
- }
-
- it = purple_connections_get_all();
- for (; it; it = g_list_next(it)) {
- PurpleConnection *gc = it->data;
- imgup_conn_uninit(gc);
- }
-
- g_clear_object(&session);
- plugin_handle = NULL;
-
- return TRUE;
-}
-
-PURPLE_PLUGIN_INIT(imgupload, plugin_query, plugin_load, plugin_unload);
--- a/pidgin/plugins/mailchk.c Wed Nov 04 02:41:46 2020 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,169 +0,0 @@
-#include "internal.h"
-
-#include <purple.h>
-
-#include "gtkblist.h"
-#include "gtkplugin.h"
-
-#define MAILCHK_PLUGIN_ID "gtk-mailchk"
-#define MAILCHK_PLUGIN_DOMAIN (g_quark_from_static_string(MAILCHK_PLUGIN_ID))
-
-#define ANY_MAIL 0x01
-#define UNREAD_MAIL 0x02
-#define NEW_MAIL 0x04
-
-static guint timer = 0;
-static GtkWidget *mail = NULL;
-
-static gint
-check_mail()
-{
- static off_t oldsize = 0;
- gchar *filename;
- off_t newsize;
- GStatBuf st;
- gint ret = 0;
-
- filename = g_strdup(g_getenv("MAIL"));
- if (!filename)
- filename = g_strconcat("/var/spool/mail/", g_get_user_name(), NULL);
-
- if (g_stat(filename, &st) < 0) {
- g_free(filename);
- return -1;
- }
-
- newsize = st.st_size;
- if (newsize) ret |= ANY_MAIL;
- if (st.st_mtime > st.st_atime && newsize) ret |= UNREAD_MAIL;
- if (newsize != oldsize && (ret & UNREAD_MAIL)) ret |= NEW_MAIL;
- oldsize = newsize;
-
- g_free(filename);
-
- return ret;
-}
-
-static void
-destroy_cb()
-{
- mail = NULL;
-}
-
-static gboolean
-check_timeout(gpointer data)
-{
- gint count = check_mail();
- PurpleBuddyList *list = purple_blist_get_default();
-
- if (count == -1)
- return FALSE;
-
- if (!list || !(PIDGIN_BLIST(list)->vbox))
- return TRUE;
-
- if (!mail) {
- /* guess we better build it then :P */
- GtkWidget *vbox = PIDGIN_BLIST(list)->vbox;
-
- mail = gtk_label_new("No mail messages.");
- gtk_box_pack_start(GTK_BOX(vbox), mail, FALSE, FALSE, 0);
- gtk_box_reorder_child(GTK_BOX(vbox), mail, 1);
- g_signal_connect(G_OBJECT(mail), "destroy", G_CALLBACK(destroy_cb), NULL);
- gtk_widget_show(mail);
- }
-
- if (count & UNREAD_MAIL)
- gtk_label_set_text(GTK_LABEL(mail), "You have new mail!");
- else if (count & ANY_MAIL)
- gtk_label_set_text(GTK_LABEL(mail), "You have mail.");
- else
- gtk_label_set_text(GTK_LABEL(mail), "No mail messages.");
-
- return TRUE;
-}
-
-static void
-signon_cb(PurpleConnection *gc)
-{
- PurpleBuddyList *list = purple_blist_get_default();
- if (list && !timer) {
- check_timeout(NULL); /* we want the box to be drawn immediately */
- timer = g_timeout_add_seconds(2, check_timeout, NULL);
- }
-}
-
-static void
-signoff_cb(PurpleConnection *gc)
-{
- PurpleBuddyList *list = purple_blist_get_default();
- if ((!list || !PIDGIN_BLIST(list)->vbox) && timer) {
- g_source_remove(timer);
- timer = 0;
- }
-}
-
-/*
- * EXPORTED FUNCTIONS
- */
-
-static PidginPluginInfo *
-plugin_query(GError **error)
-{
- const gchar * const authors[] = {
- "Eric Warmenhoven <eric@warmenhoven.org>",
- NULL
- };
-
- return pidgin_plugin_info_new(
- "id", MAILCHK_PLUGIN_ID,
- "name", N_("Mail Checker"),
- "version", DISPLAY_VERSION,
- "category", N_("Utility"),
- "summary", N_("Checks for new local mail."),
- "description", N_("Adds a small box to the buddy list that shows if "
- "you have new mail."),
- "authors", authors,
- "website", PURPLE_WEBSITE,
- "abi-version", PURPLE_ABI_VERSION,
- NULL
- );
-}
-
-static gboolean
-plugin_load(PurplePlugin *plugin, GError **error)
-{
- PurpleBuddyList *list = purple_blist_get_default();
- void *conn_handle = purple_connections_get_handle();
-
- if (!check_timeout(NULL)) {
- g_set_error(error, MAILCHK_PLUGIN_DOMAIN, 0, _("Could not read $MAIL "
- "or /var/spool/mail/$USER\n"));
- return FALSE;
- }
-
- if (list && PIDGIN_BLIST(list)->vbox)
- timer = g_timeout_add_seconds(2, check_timeout, NULL);
-
- purple_signal_connect(conn_handle, "signed-on",
- plugin, PURPLE_CALLBACK(signon_cb), NULL);
- purple_signal_connect(conn_handle, "signed-off",
- plugin, PURPLE_CALLBACK(signoff_cb), NULL);
-
- return TRUE;
-}
-
-static gboolean
-plugin_unload(PurplePlugin *plugin, GError **error)
-{
- if (timer)
- g_source_remove(timer);
- timer = 0;
- if (mail)
- gtk_widget_destroy(mail);
- mail = NULL;
-
- return TRUE;
-}
-
-PURPLE_PLUGIN_INIT(mailchk, plugin_query, plugin_load, plugin_unload);
--- a/pidgin/plugins/meson.build Wed Nov 04 02:41:46 2020 -0600
+++ b/pidgin/plugins/meson.build Wed Nov 04 03:24:02 2020 -0600
@@ -1,42 +1,18 @@
-if false
- subdir('musicmessaging')
-endif
-
subdir('disco')
subdir('gestures')
subdir('xmppconsole')
if PLUGINS
- contact_priority = library('contact_priority', 'contact_priority.c',
- dependencies : [libpurple_dep, libpidgin_dep, glib],
- name_prefix : '')
-
gtkbuddynote = library('gtkbuddynote', 'gtkbuddynote.c',
dependencies : [libpurple_dep, libpidgin_dep, glib],
name_prefix : '',
install : true, install_dir : PIDGIN_PLUGINDIR)
- gtk_signals_test = library('gtk_signals_test', 'gtk-signals-test.c',
- dependencies : [libpurple_dep, libpidgin_dep, glib],
- name_prefix : '')
-
- history = library('history', 'history.c',
- build_by_default: false,
- dependencies : [libpurple_dep, libpidgin_dep, glib],
- name_prefix : '',
- install : false, install_dir : PIDGIN_PLUGINDIR)
-
iconaway = library('iconaway', 'iconaway.c',
dependencies : [libpurple_dep, libpidgin_dep, glib],
name_prefix : '',
install : true, install_dir : PIDGIN_PLUGINDIR)
- imgupload = library('imgupload', 'imgupload.c',
- dependencies : [json, libpurple_dep, libpidgin_dep, libsoup, glib],
- name_prefix : '',
- build_by_default: false,
- install : false, install_dir : PIDGIN_PLUGINDIR)
-
notify = library('notify', 'notify.c',
dependencies : [libpurple_dep, libpidgin_dep, glib],
name_prefix : '',
@@ -48,17 +24,18 @@
name_prefix : '',
install : true, install_dir : PIDGIN_PLUGINDIR)
- screencap = library('screencap', 'screencap.c',
+ spellchk = library('spellchk', 'spellchk.c',
dependencies : [libpurple_dep, libpidgin_dep, glib],
name_prefix : '',
build_by_default: false,
install : false, install_dir : PIDGIN_PLUGINDIR)
- spellchk = library('spellchk', 'spellchk.c',
- dependencies : [libpurple_dep, libpidgin_dep, glib],
- name_prefix : '',
- build_by_default: false,
- install : false, install_dir : PIDGIN_PLUGINDIR)
+ if IS_WIN32
+ transparency = library('transparency', 'transparency.c',
+ dependencies : [libpurple_dep, libpidgin_dep, glib],
+ name_prefix : '',
+ install : true, install_dir : PIDGIN_PLUGINDIR)
+ endif
if enable_unity
unity = library('unity', 'unity.c',
--- a/pidgin/plugins/musicmessaging/meson.build Wed Nov 04 02:41:46 2020 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-if PLUGINS and enable_dbus
- install_data('music.png',
- install_dir : get_option('datadir') / 'pixmaps/pidgin/buttons')
-
- music_messaging_bindings = custom_target('music_messaging_bindings.c',
- command : [python, dbus_analyze_functions, '--export-only', '-o', '@OUTPUT@', '@INPUT@'],
- input : 'musicmessaging.c',
- output : 'music-messaging-bindings.ch')
-
- musicmessaging = library('musicmessaging', 'musicmessaging.c', music_messaging_bindings,
- dependencies : [dbus, libpurple_dep, libpidgin_dep, glib],
- name_prefix : '',
- install : true, install_dir : PIDGIN_PLUGINDIR)
-endif
Binary file pidgin/plugins/musicmessaging/music.png has changed
--- a/pidgin/plugins/musicmessaging/musicmessaging.c Wed Nov 04 02:41:46 2020 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,712 +0,0 @@
-/*
- * Music messaging plugin for Purple
- *
- * Copyright (C) 2005 Christian Muise.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02111-1301, USA.
- */
-
-/* NOTICE: This plugin is currently broken as the libpurple DBus bindings
- * have been removed.
- */
-
-#include "internal.h"
-#include "pidgin.h"
-
-#include <purple.h>
-
-#include <pidgin.h>
-
-#define DBUS_API_SUBJECT_TO_CHANGE
-#include <dbus/dbus.h>
-#include "dbus-maybe.h"
-#include "dbus-bindings.h"
-#include "dbus-server.h"
-#include "dbus-purple.h"
-
-#define MUSICMESSAGING_PLUGIN_ID "gtk-hazure-musicmessaging"
-#define MUSICMESSAGING_PREFIX "##MM##"
-#define MUSICMESSAGING_START_MSG _("A music messaging session has been requested. Please click the MM icon to accept.")
-#define MUSICMESSAGING_CONFIRM_MSG _("Music messaging session confirmed.")
-
-typedef struct {
- PurpleConversation *conv; /* pointer to the conversation */
- GtkWidget *seperator; /* seperator in the conversation */
- GtkWidget *button; /* button in the conversation */
- GPid pid; /* the pid of the score editor */
-
- gboolean started; /* session has started and editor run */
- gboolean originator; /* started the mm session */
- gboolean requested; /* received a request to start a session */
-
-} MMConversation;
-
-static gboolean start_session(MMConversation *mmconv);
-static void run_editor(MMConversation *mmconv);
-static void kill_editor(MMConversation *mmconv);
-static void add_button (MMConversation *mmconv);
-static void remove_widget (GtkWidget *button);
-static void init_conversation (PurpleConversation *conv);
-static void conv_destroyed(PurpleConversation *conv);
-static gboolean intercept_sent(PurpleAccount *account, PurpleMessage *msg, void* pData);
-static gboolean intercept_received(PurpleAccount *account, char **sender, char **message, PurpleConversation *conv, int *flags);
-static gboolean send_change_request (const int session, const char *id, const char *command, const char *parameters);
-static gboolean send_change_confirmed (const int session, const char *command, const char *parameters);
-static void session_end (MMConversation *mmconv);
-
-/* Globals */
-/* List of sessions */
-static GList *conversations;
-
-/* Pointer to this plugin */
-static PurplePlugin *plugin_pointer;
-
-/* Define types needed for DBus */
-DBusGConnection *connection;
-DBusGProxy *proxy;
-#define DBUS_SERVICE_GSCORE "org.gscore.GScoreService"
-#define DBUS_PATH_GSCORE "/org/gscore/GScoreObject"
-#define DBUS_INTERFACE_GSCORE "org.gscore.GScoreInterface"
-
-/* Define the functions to export for use with DBus */
-DBUS_EXPORT void
-music_messaging_change_request(const int session, const char *command,
- const char *parameters);
-
-DBUS_EXPORT void
-music_messaging_change_confirmed(const int session, const char *command,
- const char *parameters);
-
-DBUS_EXPORT void
-music_messaging_change_failed(const int session, const char *id,
- const char *command, const char *parameters);
-
-DBUS_EXPORT void
-music_messaging_done_session(const int session);
-
-/* This file has been generated by the #dbus-analize-functions.py
- script. It contains dbus wrappers for the four functions declared
- above. */
-#include "music-messaging-bindings.ch"
-
-/* Exported functions */
-DBUS_EXPORT void
-music_messaging_change_request(const int session, const char *command,
- const char *parameters)
-{
-
- MMConversation *mmconv = (MMConversation *)g_list_nth_data(conversations, session);
-
- if (mmconv->started)
- {
- if (mmconv->originator)
- {
- const char *name = purple_conversation_get_name(mmconv->conv);
- send_change_request (session, name, command, parameters);
- } else
- {
- GString *to_send = g_string_new("");
- g_string_append_printf(to_send, "##MM## request %s %s##MM##", command, parameters);
-
- purple_conversation_send(mmconv->conv, to_send->str);
-
- purple_debug_misc("musicmessaging", "Sent request: %s\n", to_send->str);
- }
- }
-
-}
-
-DBUS_EXPORT void
-music_messaging_change_confirmed(const int session, const char *command,
- const char *parameters)
-{
-
- MMConversation *mmconv = (MMConversation *)g_list_nth_data(conversations, session);
-
- if (mmconv->started)
- {
- if (mmconv->originator)
- {
- GString *to_send = g_string_new("");
- g_string_append_printf(to_send, "##MM## confirm %s %s##MM##", command, parameters);
-
- purple_conversation_send(mmconv->conv, to_send->str);
- } else
- {
- /* Do nothing. If they aren't the originator, then they can't confirm. */
- }
- }
-
-}
-
-DBUS_EXPORT void
-music_messaging_change_failed(const int session, const char *id,
- const char *command, const char *parameters)
-{
- MMConversation *mmconv = (MMConversation *)g_list_nth_data(conversations, session);
-
- purple_notify_message(plugin_pointer, PURPLE_NOTIFY_MSG_INFO, command,
- parameters, NULL, NULL, NULL, NULL);
-
- if (mmconv->started)
- {
- if (mmconv->originator)
- {
- GString *to_send = g_string_new("");
- g_string_append_printf(to_send, "##MM## failed %s %s %s##MM##", id, command, parameters);
-
- purple_conversation_send(mmconv->conv, to_send->str);
- } else
- {
- /* Do nothing. If they aren't the originator, then they can't confirm. */
- }
- }
-}
-
-DBUS_EXPORT void
-music_messaging_done_session(const int session)
-{
- MMConversation *mmconv = (MMConversation *)g_list_nth_data(conversations, session);
-
- purple_notify_message(plugin_pointer, PURPLE_NOTIFY_MSG_INFO, "Session",
- "Session Complete", NULL, NULL, NULL, NULL);
-
- session_end(mmconv);
-}
-
-
-/* DBus commands that can be sent to the editor */
-G_BEGIN_DECLS
-DBusConnection *purple_dbus_get_connection(void);
-G_END_DECLS
-
-static gboolean send_change_request (const int session, const char *id, const char *command, const char *parameters)
-{
- DBusMessage *message;
-
- /* Create the signal we need */
- message = dbus_message_new_signal (PURPLE_DBUS_PATH, PURPLE_DBUS_INTERFACE, "GscoreChangeRequest");
-
- /* Append the string "Ping!" to the signal */
- dbus_message_append_args (message,
- DBUS_TYPE_INT32, &session,
- DBUS_TYPE_STRING, &id,
- DBUS_TYPE_STRING, &command,
- DBUS_TYPE_STRING, &parameters,
- DBUS_TYPE_INVALID);
-
- /* Send the signal */
- dbus_connection_send (purple_dbus_get_connection(), message, NULL);
-
- /* Free the signal now we have finished with it */
- dbus_message_unref (message);
-
- /* Tell the user we sent a signal */
- g_printerr("Sent change request signal: %d %s %s %s\n", session, id, command, parameters);
-
- return TRUE;
-}
-
-static gboolean send_change_confirmed (const int session, const char *command, const char *parameters)
-{
- DBusMessage *message;
-
- /* Create the signal we need */
- message = dbus_message_new_signal (PURPLE_DBUS_PATH, PURPLE_DBUS_INTERFACE, "GscoreChangeConfirmed");
-
- /* Append the string "Ping!" to the signal */
- dbus_message_append_args (message,
- DBUS_TYPE_INT32, &session,
- DBUS_TYPE_STRING, &command,
- DBUS_TYPE_STRING, &parameters,
- DBUS_TYPE_INVALID);
-
- /* Send the signal */
- dbus_connection_send (purple_dbus_get_connection(), message, NULL);
-
- /* Free the signal now we have finished with it */
- dbus_message_unref (message);
-
- /* Tell the user we sent a signal */
- g_printerr("Sent change confirmed signal.\n");
-
- return TRUE;
-}
-
-
-static int
-mmconv_from_conv_loc(PurpleConversation *conv)
-{
- GList *l;
- MMConversation *mmconv_current = NULL;
- guint i;
-
- i = 0;
- for (l = conversations; l != NULL; l = l->next)
- {
- mmconv_current = l->data;
- if (conv == mmconv_current->conv)
- {
- return i;
- }
- i++;
- }
- return -1;
-}
-
-static MMConversation*
-mmconv_from_conv(PurpleConversation *conv)
-{
- return (MMConversation *)g_list_nth_data(conversations, mmconv_from_conv_loc(conv));
-}
-
-static gboolean
-intercept_sent(PurpleAccount *account, PurpleMessage *msg, void* pData)
-{
- const gchar *cont = purple_message_get_contents(msg);
-
- if (purple_message_is_empty(msg))
- return FALSE;
-
- if (0 == strncmp(cont, MUSICMESSAGING_PREFIX, strlen(MUSICMESSAGING_PREFIX)))
- {
- purple_debug_misc("purple-musicmessaging", "Sent MM Message: %s\n", cont);
- }
- else if (0 == strncmp(cont, MUSICMESSAGING_START_MSG, strlen(MUSICMESSAGING_START_MSG)))
- {
- purple_debug_misc("purple-musicmessaging", "Sent MM request.\n");
- return FALSE;
- }
- else if (0 == strncmp(cont, MUSICMESSAGING_CONFIRM_MSG, strlen(MUSICMESSAGING_CONFIRM_MSG)))
- {
- purple_debug_misc("purple-musicmessaging", "Sent MM confirm.\n");
- return FALSE;
- }
- else if (0 == strncmp(cont, "test1", strlen("test1")))
- {
- purple_debug_misc("purple-musicmessaging", "\n\nTEST 1\n\n");
- send_change_request(0, "test-id", "test-command", "test-parameters");
- return FALSE;
- }
- else if (0 == strncmp(cont, "test2", strlen("test2")))
- {
- purple_debug_misc("purple-musicmessaging", "\n\nTEST 2\n\n");
- send_change_confirmed(1, "test-command", "test-parameters");
- return FALSE;
- }
- else
- {
- return FALSE;
- /* Do nothing...procceed as normal */
- }
- return TRUE;
-}
-
-static gboolean
-intercept_received(PurpleAccount *account, char **sender, char **message, PurpleConversation *conv, int *flags)
-{
- MMConversation *mmconv;
-
- if (conv == NULL) {
- /* XXX: This is just to avoid a crash (#2726).
- * We may want to create the conversation instead of returning from here
- */
- return FALSE;
- }
-
- mmconv = mmconv_from_conv(conv);
-
- purple_debug_misc("purple-musicmessaging", "Intercepted: %s\n", *message);
- if (strstr(*message, MUSICMESSAGING_PREFIX))
- {
- char *parsed_message = strtok(strstr(*message, MUSICMESSAGING_PREFIX), "<");
- purple_debug_misc("purple-musicmessaging", "Received an MM Message: %s\n", parsed_message);
-
- if (mmconv->started)
- {
- if (strstr(parsed_message, "request"))
- {
- if (mmconv->originator)
- {
- int session = mmconv_from_conv_loc(conv);
- const char *id = purple_conversation_get_name(mmconv->conv);
- char *command;
- char *parameters;
-
- purple_debug_misc("purple-musicmessaging", "Sending request to gscore.\n");
-
- /* Get past the first two terms - '##MM##' and 'request' */
- strtok(parsed_message, " "); /* '##MM##' */
- strtok(NULL, " "); /* 'request' */
-
- command = strtok(NULL, " ");
- parameters = strtok(NULL, "#");
-
- send_change_request (session, id, command, parameters);
-
- }
- } else if (strstr(parsed_message, "confirm"))
- {
- if (!mmconv->originator)
- {
- int session = mmconv_from_conv_loc(conv);
- char *command;
- char *parameters;
-
- purple_debug_misc("purple-musicmessaging", "Sending confirmation to gscore.\n");
-
- /* Get past the first two terms - '##MM##' and 'confirm' */
- strtok(parsed_message, " "); /* '##MM##' */
- strtok(NULL, " "); /* 'confirm' */
-
- command = strtok(NULL, " ");
- parameters = strtok(NULL, "#");
-
- send_change_confirmed (session, command, parameters);
- }
- } else if (strstr(parsed_message, "failed"))
- {
- char *id;
- char *command;
-
- /* Get past the first two terms - '##MM##' and 'confirm' */
- strtok(parsed_message, " "); /* '##MM##' */
- strtok(NULL, " "); /* 'failed' */
-
- id = strtok(NULL, " ");
- command = strtok(NULL, " ");
- /* char *parameters = strtok(NULL, "#"); DONT NEED PARAMETERS */
-
- // TODO: Shouldn't this be strcmp() ?
- if (purple_conversation_get_name(mmconv->conv) == id)
- {
- purple_notify_message(plugin_pointer, PURPLE_NOTIFY_MSG_ERROR,
- _("Music Messaging"),
- _("There was a conflict in running the command:"), command, NULL, NULL, NULL);
- }
- }
- }
-
- message = NULL;
- }
- else if (strstr(*message, MUSICMESSAGING_START_MSG))
- {
- purple_debug_misc("purple-musicmessaging", "Received MM request.\n");
- if (!(mmconv->originator))
- {
- mmconv->requested = TRUE;
- return FALSE;
- }
-
- }
- else if (strstr(*message, MUSICMESSAGING_CONFIRM_MSG))
- {
- purple_debug_misc("purple-musicmessagin", "Received MM confirm.\n");
-
- if (mmconv->originator)
- {
- start_session(mmconv);
- return FALSE;
- }
- }
- else
- {
- return FALSE;
- /* Do nothing. */
- }
- return TRUE;
-}
-
-static void send_request(MMConversation *mmconv)
-{
- PurpleConnection *connection = purple_conversation_get_connection(mmconv->conv);
- const char *convName = purple_conversation_get_name(mmconv->conv);
- purple_serv_send_im(connection, purple_message_new_outgoing(
- convName, MUSICMESSAGING_START_MSG, 0));
-}
-
-static void send_request_confirmed(MMConversation *mmconv)
-{
- PurpleConnection *connection = purple_conversation_get_connection(mmconv->conv);
- const char *convName = purple_conversation_get_name(mmconv->conv);
- purple_serv_send_im(connection, purple_message_new_outgoing(
- convName, MUSICMESSAGING_CONFIRM_MSG, 0));
-}
-
-
-static gboolean
-start_session(MMConversation *mmconv)
-{
- run_editor(mmconv);
- return TRUE;
-}
-
-static void session_end (MMConversation *mmconv)
-{
- mmconv->started = FALSE;
- mmconv->originator = FALSE;
- mmconv->requested = FALSE;
- kill_editor(mmconv);
-}
-
-static void music_button_toggled (GtkWidget *widget, gpointer data)
-{
- MMConversation *mmconv = mmconv_from_conv(((MMConversation *) data)->conv);
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
- {
- if (((MMConversation *) data)->requested)
- {
- start_session(mmconv);
- send_request_confirmed(mmconv);
- }
- else
- {
- ((MMConversation *) data)->originator = TRUE;
- send_request((MMConversation *) data);
- }
- } else {
- session_end((MMConversation *)data);
- }
-}
-
-static void set_editor_path (GtkWidget *button, GtkWidget *text_field)
-{
- const char * path = gtk_entry_get_text((GtkEntry*)text_field);
- purple_prefs_set_string("/plugins/gtk/musicmessaging/editor_path", path);
-
-}
-
-static void run_editor (MMConversation *mmconv)
-{
- GError *spawn_error = NULL;
- GString *session_id;
- gchar * args[4];
- args[0] = (gchar *)purple_prefs_get_string("/plugins/gtk/musicmessaging/editor_path");
-
- args[1] = "-session_id";
- session_id = g_string_new("");
- g_string_append_printf(session_id, "%d", mmconv_from_conv_loc(mmconv->conv));
- args[2] = session_id->str;
-
- args[3] = NULL;
-
- if (!(g_spawn_async (".", args, NULL, 4, NULL, NULL, &(mmconv->pid), &spawn_error)))
- {
- purple_notify_error(plugin_pointer, _("Error Running Editor"),
- _("The following error has occurred:"), spawn_error->message, NULL);
- mmconv->started = FALSE;
- }
- else
- {
- mmconv->started = TRUE;
- }
-}
-
-static void kill_editor (MMConversation *mmconv)
-{
- if (mmconv->pid)
- {
- kill(mmconv->pid, SIGINT);
- mmconv->pid = 0;
- }
-}
-
-static void init_conversation (PurpleConversation *conv)
-{
- MMConversation *mmconv;
- mmconv = g_new0(MMConversation, 1);
-
- mmconv->conv = conv;
- mmconv->started = FALSE;
- mmconv->originator = FALSE;
- mmconv->requested = FALSE;
-
- add_button(mmconv);
-
- conversations = g_list_append(conversations, mmconv);
-}
-
-static void conv_destroyed (PurpleConversation *conv)
-{
- MMConversation *mmconv = mmconv_from_conv(conv);
-
- remove_widget(mmconv->button);
- remove_widget(mmconv->seperator);
- if (mmconv->started)
- {
- kill_editor(mmconv);
- }
- conversations = g_list_remove(conversations, mmconv);
-}
-
-static void add_button (MMConversation *mmconv)
-{
-#if 0
- PurpleConversation *conv = mmconv->conv;
-#endif
-
- GtkWidget *button, *image, *sep;
- gchar *file_path;
-
- button = gtk_toggle_button_new();
- gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
-
- g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(music_button_toggled), mmconv);
-
- file_path = g_build_filename(PURPLE_DATADIR,
- "pixmaps", "purple", "buttons", "music.png", NULL);
- image = gtk_image_new_from_file(file_path);
- g_free(file_path);
-
- gtk_container_add((GtkContainer *)button, image);
-
- sep = gtk_separator_new(GTK_ORIENTATION_VERTICAL);
-
- mmconv->seperator = sep;
- mmconv->button = button;
-
- gtk_widget_show(sep);
- gtk_widget_show(image);
- gtk_widget_show(button);
-
-#if 0
- gtk_box_pack_start(GTK_BOX(PIDGIN_CONVERSATION(conv)->toolbar), sep, FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(PIDGIN_CONVERSATION(conv)->toolbar), button, FALSE, FALSE, 0);
-#endif
-}
-
-static void remove_widget (GtkWidget *button)
-{
- gtk_widget_hide(button);
- gtk_widget_destroy(button);
-}
-
-static GtkWidget *
-get_config_frame(PurplePlugin *plugin)
-{
- GtkWidget *ret;
- GtkWidget *vbox;
-
- GtkWidget *editor_path;
- GtkWidget *editor_path_label;
- GtkWidget *editor_path_button;
-
- /* Outside container */
- ret = gtk_box_new(GTK_ORIENTATION_VERTICAL, 18);
- gtk_container_set_border_width(GTK_CONTAINER(ret), 10);
-
- /* Configuration frame */
- vbox = pidgin_make_frame(ret, _("Music Messaging Configuration"));
-
- /* Path to the score editor */
- editor_path = gtk_entry_new();
- editor_path_label = gtk_label_new(_("Score Editor Path"));
- editor_path_button = gtk_button_new_with_mnemonic(_("_Apply"));
-
- gtk_entry_set_text((GtkEntry*)editor_path, "/usr/local/bin/gscore");
-
- g_signal_connect(G_OBJECT(editor_path_button), "clicked",
- G_CALLBACK(set_editor_path), editor_path);
-
- gtk_box_pack_start(GTK_BOX(vbox), editor_path_label, FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(vbox), editor_path, FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(vbox), editor_path_button, FALSE, FALSE, 0);
-
- gtk_widget_show_all(ret);
-
- return ret;
-}
-
-static PidginPluginInfo *
-plugin_query(GError **error) {
- const gchar * const authors[] = {
- "Christian Muise <christian.muise@gmail.com>",
- NULL
- };
-
- return pidgin_plugin_info_new(
- "id", MUSICMESSAGING_PLUGIN_ID,
- "name", N_("Music Messaging"),
- "version", DISPLAY_VERSION,
- "category", N_("Music"),
- "summary", N_("Music Messaging Plugin for "
- "collaborative composition."),
- "description", N_("The Music Messaging Plugin allows a "
- "number of users to simultaneously work "
- "on a piece of music by editing a common "
- "score in real-time."),
- "authors", authors,
- "website", PURPLE_WEBSITE,
- "abi-version", PURPLE_ABI_VERSION,
- "gtk-config-frame-cb", get_config_frame,
- NULL
- );
-}
-
-static gboolean
-plugin_load(PurplePlugin *plugin, GError **error) {
- void *conv_list_handle;
- GList *l;
-
- PURPLE_DBUS_RETURN_FALSE_IF_DISABLED(plugin);
-
- purple_prefs_add_none("/plugins/gtk/musicmessaging");
- purple_prefs_add_string("/plugins/gtk/musicmessaging/editor_path", "/usr/bin/gscore");
-
- /* First, we have to register our four exported functions with the
- main purple dbus loop. Without this statement, the purple dbus
- code wouldn't know about our functions. */
- PURPLE_DBUS_REGISTER_BINDINGS(plugin);
-
- /* Keep the plugin for reference (needed for notify's) */
- plugin_pointer = plugin;
-
- /* Add the button to all the current conversations */
- for (l = purple_conversations_get_all(); l != NULL; l = l->next)
- init_conversation((PurpleConversation *)l->data);
-
- /* Listen for any new conversations */
- conv_list_handle = purple_conversations_get_handle();
-
- purple_signal_connect(conv_list_handle, "conversation-created",
- plugin, PURPLE_CALLBACK(init_conversation), NULL);
-
- /* Listen for conversations that are ending */
- purple_signal_connect(conv_list_handle, "deleting-conversation",
- plugin, PURPLE_CALLBACK(conv_destroyed), NULL);
-
- /* Listen for sending/receiving messages to replace tags */
- purple_signal_connect(conv_list_handle, "sending-im-msg",
- plugin, PURPLE_CALLBACK(intercept_sent), NULL);
- purple_signal_connect(conv_list_handle, "receiving-im-msg",
- plugin, PURPLE_CALLBACK(intercept_received), NULL);
-
- return TRUE;
-}
-
-static gboolean
-plugin_unload(PurplePlugin *plugin, GError **error) {
- MMConversation *mmconv = NULL;
-
- while (conversations != NULL)
- {
- mmconv = conversations->data;
- conv_destroyed(mmconv->conv);
- }
- return TRUE;
-}
-
-PURPLE_PLUGIN_INIT(musicmessaging, plugin_query, plugin_load, plugin_unload);
--- a/pidgin/plugins/pidgininc.c Wed Nov 04 02:41:46 2020 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-/* When writing a third-party plugin, do not include libpurple's internal.h
- * included below. This file is for internal libpurple use only. We're including
- * it here for our own convenience. */
-#include "internal.h"
-#include <purple.h>
-
-/* include UI for pidgin_dialogs_about() */
-#include "gtkplugin.h"
-#include "gtkdialogs.h"
-
-#define PURPLEINC_PLUGIN_ID "core-purpleinc"
-
-static void
-echo_hi(PurpleConnection *gc)
-{
- /* this doesn't do much, just lets you know who we are :) */
- pidgin_dialogs_about();
-}
-
-static gboolean
-reverse(PurpleAccount *account, char **who, char **message,
- PurpleConversation *conv, int *flags)
-{
- /* this will drive you insane. whenever you receive a message,
- * the text of the message (HTML and all) will be reversed. */
- int i, l;
- char tmp;
-
- /* this check is necessary in case bad plugins do bad things */
- if (message == NULL || *message == NULL)
- return FALSE;
-
- l = strlen(*message);
-
- if (purple_strequal(*who, purple_account_get_username(account)))
- return FALSE;
-
- for (i = 0; i < l/2; i++) {
- tmp = (*message)[i];
- (*message)[i] = (*message)[l - i - 1];
- (*message)[l - i - 1] = tmp;
- }
- return FALSE;
-}
-
-static void
-bud(PurpleBuddy *who)
-{
- PurpleAccount *acct = purple_buddy_get_account(who);
- PurpleIMConversation *im = purple_im_conversation_new(acct,
- purple_buddy_get_name(who));
-
- purple_conversation_send(PURPLE_CONVERSATION(im), "Hello!");
-}
-
-/*
- * EXPORTED FUNCTIONS
- */
-
-static PidginPluginInfo *
-plugin_query(GError **error)
-{
- const gchar * const authors[] = {
- "Eric Warmenhoven <eric@warmenhoven.org>",
- NULL
- };
-
- return pidgin_plugin_info_new(
- "id", PURPLEINC_PLUGIN_ID,
- "name", N_("Pidgin Demonstration Plugin"),
- "version", DISPLAY_VERSION,
- "category", N_("Example"),
- "summary", N_("An example plugin that does stuff - see the description."),
- "description", N_("This is a really cool plugin that does a lot of stuff:\n"
- "- It tells you who wrote the program when you log in\n"
- "- It reverses all incoming text\n"
- "- It sends a message to people on your list immediately"
- " when they sign on"),
- "authors", authors,
- "website", PURPLE_WEBSITE,
- "abi-version", PURPLE_ABI_VERSION,
- NULL
- );
-}
-
-static gboolean
-plugin_load(PurplePlugin *plugin, GError **error)
-{
- /* this is for doing something fun when we sign on */
- purple_signal_connect(purple_connections_get_handle(), "signed-on",
- plugin, PURPLE_CALLBACK(echo_hi), NULL);
-
- /* this is for doing something fun when we get a message */
- purple_signal_connect(purple_conversations_get_handle(), "receiving-im-msg",
- plugin, PURPLE_CALLBACK(reverse), NULL);
-
- /* this is for doing something fun when a buddy comes online */
- purple_signal_connect(purple_blist_get_handle(), "buddy-signed-on",
- plugin, PURPLE_CALLBACK(bud), NULL);
-
- return TRUE;
-}
-
-static gboolean
-plugin_unload(PurplePlugin *plugin, GError **error)
-{
- return TRUE;
-}
-
-PURPLE_PLUGIN_INIT(purpleinc, plugin_query, plugin_load, plugin_unload);
--- a/pidgin/plugins/screencap.c Wed Nov 04 02:41:46 2020 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,977 +0,0 @@
-/*
- * Screen Capture - a plugin that allows taking screenshots and sending them
- * to your buddies as inline images.
- *
- * Copyright (C) 2014, Tomasz Wasilczyk <twasilczyk@pidgin.im>
- *
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
- */
-
-#include "internal.h"
-
-#include <gdk/gdkkeysyms.h>
-
-#include <purple.h>
-
-#include "gtkconv.h"
-#include "gtkplugin.h"
-#include "gtkutils.h"
-#include "gtkwebviewtoolbar.h"
-#include "pidginicon.h"
-
-#define SCRNCAP_SHOOTING_TIMEOUT 500
-#define SCRNCAP_DEFAULT_COLOR "#FFFF00000000"
-
-enum
-{
- SCRNCAP_RESPONSE_COLOR
-};
-
-static gboolean is_shooting = FALSE;
-static guint shooting_timeout = 0;
-static GtkWidget *current_window = NULL;
-
-static gint crop_origin_x, crop_origin_y;
-static gboolean crop_active;
-static gint crop_x, crop_y, crop_w, crop_h;
-
-static gint draw_origin_x, draw_origin_y;
-static gboolean draw_active;
-
-static GdkRGBA brush_color = {1, 0, 0, 1};
-static gint line_width = 2;
-
-/******************************************************************************
- * libpidgin helper functions
- ******************************************************************************/
-
-static inline void
-scrncap_conv_set_data(PidginConversation *gtkconv, const gchar *key,
- gpointer value)
-{
- g_return_if_fail(gtkconv != NULL);
-
- g_object_set_data(G_OBJECT(gtkconv->tab_cont), key, value);
-}
-
-static inline gpointer
-scrncap_conv_get_data(PidginConversation *gtkconv, const gchar *key)
-{
- g_return_val_if_fail(gtkconv != NULL, NULL);
-
- return g_object_get_data(G_OBJECT(gtkconv->tab_cont), key);
-}
-
-/******************************************************************************
- * GdkPixbuf helper functions
- ******************************************************************************/
-
-static GdkPixbuf *
-scrncap_perform_screenshot(void)
-{
- GdkWindow *root;
- gint orig_x, orig_y;
-
- root = gdk_get_default_root_window();
- gdk_window_get_origin(root, &orig_x, &orig_y);
-
- return gdk_pixbuf_get_from_window(root, 0, 0,
- gdk_window_get_width(root), gdk_window_get_height(root));
-}
-
-static void
-scrncap_pixbuf_darken(GdkPixbuf *pixbuf)
-{
- guchar *pixels;
- int i, y, width, height, row_width, n_channels, rowstride, pad;
-
- pixels = gdk_pixbuf_get_pixels(pixbuf);
- width = gdk_pixbuf_get_width(pixbuf);
- height = gdk_pixbuf_get_height(pixbuf);
- n_channels = gdk_pixbuf_get_n_channels(pixbuf);
- rowstride = gdk_pixbuf_get_rowstride(pixbuf);
-
- row_width = width * n_channels;
- pad = rowstride - row_width;
- g_return_if_fail(pad >= 0);
-
- for (y = 0; y < height; y++) {
- for (i = 0; i < row_width; i++, pixels++)
- *pixels /= 2;
- pixels += pad;
- }
-}
-
-static PurpleImage *
-scrncap_pixbuf_to_image(GdkPixbuf *pixbuf)
-{
- PurpleImage *image = NULL;
- gchar *buffer;
- gsize count;
- GError *error = NULL;
-
- if (!gdk_pixbuf_save_to_buffer(pixbuf, &buffer, &count, "png",
- &error, NULL)) {
- purple_debug_error("screencap", "Failed saving an image: %s",
- error->message);
- g_error_free(error);
- return NULL;
- }
-
- image = purple_image_new_take_data((guint8 *)buffer, count);
-
- if (purple_image_get_extension(image) == NULL) {
- purple_debug_error("screencap", "Invalid image format");
- g_object_unref(image);
- return NULL;
- }
-
- return image;
-}
-
-/******************************************************************************
- * Draw window
- ******************************************************************************/
-
-static gboolean
-scrncap_drawing_area_btnpress(GtkWidget *draw_area, GdkEventButton *event,
- gpointer _unused)
-{
- if (draw_active)
- return TRUE;
-
- draw_origin_x = event->x;
- draw_origin_y = event->y;
- draw_active = TRUE;
-
- return TRUE;
-}
-
-static gboolean
-scrncap_drawing_area_btnrelease(GtkWidget *draw_area, GdkEvent *event,
- gpointer _unused)
-{
- if (!draw_active)
- return TRUE;
-
- draw_active = FALSE;
-
- return TRUE;
-}
-
-static gboolean
-scrncap_drawing_area_motion(GtkWidget *draw_area, GdkEventButton *event,
- gpointer _cr)
-{
- cairo_t *cr = _cr;
- int x, y;
- int redraw_x, redraw_y, redraw_w, redraw_h;
-
- x = event->x;
- y = event->y;
-
- if (!draw_active) {
- draw_origin_x = x;
- draw_origin_y = y;
- draw_active = TRUE;
- return FALSE;
- }
-
- cairo_move_to(cr, draw_origin_x, draw_origin_y);
- cairo_line_to(cr, x, y);
- cairo_set_line_width(cr, line_width);
- cairo_stroke(cr);
-
- redraw_x = MIN(draw_origin_x, x) - line_width - 1;
- redraw_y = MIN(draw_origin_y, y) - line_width - 1;
- redraw_w = MAX(draw_origin_x, x) - redraw_x + line_width + 1;
- redraw_h = MAX(draw_origin_y, y) - redraw_y + line_width + 1;
-
- draw_origin_x = x;
- draw_origin_y = y;
-
- gtk_widget_queue_draw_area(draw_area,
- redraw_x, redraw_y, redraw_w, redraw_h);
-
- return FALSE;
-}
-
-static gboolean
-scrncap_drawing_area_enter(GtkWidget *widget, GdkEvent *event,
- GdkCursor *draw_cursor)
-{
- GdkWindow *gdkwindow;
-
- gdkwindow = gtk_widget_get_window(GTK_WIDGET(widget));
- gdk_window_set_cursor(gdkwindow, draw_cursor);
-
- return FALSE;
-}
-
-static gboolean
-scrncap_drawing_area_leave(GtkWidget *widget, GdkEvent *event,
- GdkCursor *draw_cursor)
-{
- GdkWindow *gdkwindow;
-
- gdkwindow = gtk_widget_get_window(GTK_WIDGET(widget));
- gdk_window_set_cursor(gdkwindow, NULL);
-
- return FALSE;
-}
-
-static void
-scrncap_draw_window_close(GtkWidget *window, gpointer _unused)
-{
- if (current_window != window)
- return;
-
- is_shooting = FALSE;
- current_window = NULL;
-}
-
-static gboolean
-scrncap_draw_window_paint(GtkWidget *widget, cairo_t *cr, gpointer _surface)
-{
- cairo_surface_t *surface = _surface;
-
- cairo_set_source_surface(cr, surface, 0, 0);
- cairo_paint(cr);
-
- return FALSE;
-}
-
-static void
-scrncap_draw_window_response(GtkDialog *draw_window, gint response_id,
- gpointer _webview)
-{
- PidginWebView *webview = PIDGIN_WEBVIEW(_webview);
- GdkPixbuf *result = NULL;
- PurpleImage *image;
- const gchar *fname_prefix;
- gchar *fname;
- static guint fname_no = 0;
-
- if (response_id == SCRNCAP_RESPONSE_COLOR)
- return;
-
- if (response_id == GTK_RESPONSE_OK) {
- cairo_surface_t *surface = g_object_get_data(
- G_OBJECT(draw_window), "surface");
- result = gdk_pixbuf_get_from_surface(surface, 0, 0,
- cairo_image_surface_get_width(surface),
- cairo_image_surface_get_height(surface));
- }
-
- gtk_widget_destroy(GTK_WIDGET(draw_window));
-
- if (result == NULL)
- return;
-
- image = scrncap_pixbuf_to_image(result);
-
- /* translators: this is the file name prefix,
- * keep it lowercase and pure ASCII.
- * Please avoid "_" character, use "-" instead. */
- fname_prefix = _("screenshot-");
- fname = g_strdup_printf("%s%u", fname_prefix, ++fname_no);
- purple_image_set_friendly_filename(image, fname);
- g_free(fname);
-
- pidgin_webview_insert_image(webview, image);
- g_object_unref(image);
-}
-
-static void
-scrncap_draw_color_selected(GtkColorButton *button, cairo_t *cr)
-{
- gchar *color_str;
-
- gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(button), &brush_color);
- gdk_cairo_set_source_rgba(cr, &brush_color);
-
- color_str = gdk_rgba_to_string(&brush_color);
- purple_prefs_set_string("/plugins/gtk/screencap/brush_color", color_str);
- g_free(color_str);
-}
-
-static void
-scrncap_draw_window(PidginWebView *webview, GdkPixbuf *screen)
-{
- GtkDialog *draw_window;
- GtkWidget *drawing_area, *box;
- GtkWidget *scroll_area;
- GtkWidget *color_button;
- int width, height;
- cairo_t *cr;
- cairo_surface_t *surface;
- GdkDisplay *display;
- GdkCursor *draw_cursor;
-
- is_shooting = TRUE;
-
- current_window = pidgin_create_dialog(
- _("Insert screenshot"), 0, "insert-screenshot", TRUE);
- draw_window = GTK_DIALOG(current_window);
- gtk_widget_set_size_request(GTK_WIDGET(draw_window), 400, 300);
- gtk_window_set_position(GTK_WINDOW(draw_window), GTK_WIN_POS_CENTER);
- g_signal_connect(G_OBJECT(draw_window), "destroy",
- G_CALLBACK(scrncap_draw_window_close), NULL);
-
- display = gtk_widget_get_display(current_window);
- draw_cursor = gdk_cursor_new_for_display(display, GDK_PENCIL);
- g_object_set_data_full(G_OBJECT(draw_window), "draw-cursor",
- draw_cursor, g_object_unref);
-
- width = gdk_pixbuf_get_width(screen);
- height = gdk_pixbuf_get_height(screen);
-
- surface = cairo_image_surface_create(CAIRO_FORMAT_RGB24, width, height);
- cr = cairo_create(surface);
- g_signal_connect_swapped(G_OBJECT(draw_window), "destroy",
- G_CALLBACK(cairo_destroy), cr);
- g_object_set_data_full(G_OBJECT(draw_window), "surface",
- surface, (GDestroyNotify)cairo_surface_destroy);
-
- gdk_cairo_set_source_pixbuf(cr, screen, 0, 0);
- cairo_rectangle(cr, 0, 0, width, height);
- cairo_fill(cr);
- g_object_unref(screen);
-
- drawing_area = gtk_drawing_area_new();
- gtk_widget_set_size_request(drawing_area, width, height);
- g_signal_connect(G_OBJECT(drawing_area), "draw",
- G_CALLBACK(scrncap_draw_window_paint), surface);
- gtk_widget_add_events(drawing_area, GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_MOTION_MASK |
- GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK);
- g_signal_connect(G_OBJECT(drawing_area), "button-press-event",
- G_CALLBACK(scrncap_drawing_area_btnpress), NULL);
- g_signal_connect(G_OBJECT(drawing_area), "button-release-event",
- G_CALLBACK(scrncap_drawing_area_btnrelease), NULL);
- g_signal_connect(G_OBJECT(drawing_area), "motion-notify-event",
- G_CALLBACK(scrncap_drawing_area_motion), cr);
- g_signal_connect(G_OBJECT(drawing_area), "enter-notify-event",
- G_CALLBACK(scrncap_drawing_area_enter), draw_cursor);
- g_signal_connect(G_OBJECT(drawing_area), "leave-notify-event",
- G_CALLBACK(scrncap_drawing_area_leave), draw_cursor);
-
- box = drawing_area;
- g_object_set(drawing_area,
- "halign", GTK_ALIGN_CENTER,
- "valign", GTK_ALIGN_CENTER,
- NULL);
- scroll_area = pidgin_make_scrollable(box,
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC,
- GTK_SHADOW_NONE, -1, -1);
- g_object_set(G_OBJECT(scroll_area), "expand", TRUE, NULL);
- gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(
- GTK_DIALOG(draw_window))), scroll_area);
-
- color_button = gtk_color_button_new();
- gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(color_button),
- &brush_color);
- g_signal_connect(G_OBJECT(color_button), "color-set",
- G_CALLBACK(scrncap_draw_color_selected), cr);
- scrncap_draw_color_selected(GTK_COLOR_BUTTON(color_button), cr);
-
- gtk_dialog_add_action_widget(draw_window, color_button,
- SCRNCAP_RESPONSE_COLOR);
- gtk_dialog_add_button(draw_window, _("_Add"), GTK_RESPONSE_OK);
- gtk_dialog_add_button(draw_window, _("_Cancel"),
- GTK_RESPONSE_CANCEL);
- gtk_dialog_set_default_response(draw_window, GTK_RESPONSE_OK);
- g_signal_connect(G_OBJECT(draw_window), "response",
- G_CALLBACK(scrncap_draw_window_response), webview);
-
- gtk_widget_show_all(GTK_WIDGET(draw_window));
-}
-
-/******************************************************************************
- * Crop window
- ******************************************************************************/
-
-static void
-scrncap_crop_window_close(GtkWidget *window, gpointer _unused)
-{
- if (current_window != window)
- return;
-
- is_shooting = FALSE;
- current_window = NULL;
-}
-
-static gboolean
-scrncap_crop_window_keypress(GtkWidget *crop_window, GdkEventKey *event,
- gpointer _webview)
-{
- PidginWebView *webview = PIDGIN_WEBVIEW(_webview);
- guint key = event->keyval;
-
- if (key == GDK_KEY_Escape) {
- gtk_widget_destroy(crop_window);
- return TRUE;
- }
- if (key == GDK_KEY_Return) {
- GdkPixbuf *screenshot, *subscreen, *result;
-
- screenshot = g_object_get_data(G_OBJECT(crop_window),
- "screenshot");
- subscreen = gdk_pixbuf_new_subpixbuf(screenshot,
- crop_x, crop_y, crop_w, crop_h);
- result = gdk_pixbuf_copy(subscreen);
- g_object_unref(subscreen);
-
- gtk_widget_destroy(crop_window);
-
- scrncap_draw_window(webview, result);
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-static gboolean
-scrncap_crop_window_focusout(GtkWidget *window, GdkEventFocus *event,
- gpointer _unused)
-{
- gtk_widget_destroy(window);
- return FALSE;
-}
-
-static gboolean
-scrncap_crop_window_btnpress(GtkWidget *window, GdkEventButton *event,
- gpointer _unused)
-{
- GtkWidget *hint_box;
- GtkImage *selection;
- GtkFixed *cont;
-
- g_return_val_if_fail(!crop_active, TRUE);
-
- hint_box = g_object_get_data(G_OBJECT(window), "hint-box");
- if (hint_box) {
- gtk_widget_destroy(hint_box);
- g_object_set_data(G_OBJECT(window), "hint-box", NULL);
- }
-
- selection = g_object_get_data(G_OBJECT(window), "selection");
- cont = g_object_get_data(G_OBJECT(window), "cont");
-
- gtk_fixed_move(cont, GTK_WIDGET(selection), -10, -10);
- gtk_image_set_from_pixbuf(selection, NULL);
- gtk_widget_show(GTK_WIDGET(selection));
-
- crop_origin_x = event->x_root;
- crop_origin_y = event->y_root;
- crop_active = TRUE;
-
- return TRUE;
-}
-
-static gboolean
-scrncap_crop_window_btnrelease(GtkWidget *window, GdkEvent *event,
- gpointer _unused)
-{
- crop_active = FALSE;
-
- return TRUE;
-}
-
-static gboolean
-scrncap_crop_window_motion(GtkWidget *window, GdkEventButton *event,
- gpointer _unused)
-{
- GtkFixed *cont;
- GtkImage *selection;
- GdkPixbuf *crop, *screenshot;
-
- g_return_val_if_fail(crop_active, FALSE);
-
- selection = g_object_get_data(G_OBJECT(window), "selection");
- cont = g_object_get_data(G_OBJECT(window), "cont");
-
- crop_x = MIN(crop_origin_x, event->x_root);
- crop_y = MIN(crop_origin_y, event->y_root);
- crop_w = abs(crop_origin_x - event->x_root);
- crop_h = abs(crop_origin_y - event->y_root);
- crop_w = MAX(crop_w, 1);
- crop_h = MAX(crop_h, 1);
-
- gtk_fixed_move(cont, GTK_WIDGET(selection), crop_x, crop_y);
-
- screenshot = g_object_get_data(G_OBJECT(window), "screenshot");
- crop = gdk_pixbuf_new_subpixbuf(screenshot,
- crop_x, crop_y, crop_w, crop_h);
- gtk_image_set_from_pixbuf(GTK_IMAGE(selection), crop);
- g_object_unref(crop);
-
- return FALSE;
-}
-
-static void
-scrncap_crop_window_realize(GtkWidget *crop_window, gpointer _unused)
-{
- GdkWindow *gdkwindow;
- GdkDisplay *display;
- GdkCursor *cursor;
-
- gdkwindow = gtk_widget_get_window(GTK_WIDGET(crop_window));
- display = gdk_window_get_display(gdkwindow);
-
- gdk_window_set_events(gdkwindow, gdk_window_get_events(gdkwindow) |
- GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
- GDK_BUTTON_MOTION_MASK);
-
- cursor = gdk_cursor_new_for_display(display, GDK_CROSSHAIR);
- gdk_window_set_cursor(gdkwindow, cursor);
- g_object_unref(cursor);
-}
-
-static gboolean
-scrncap_do_screenshot_cb(gpointer _webview)
-{
- PidginWebView *webview = PIDGIN_WEBVIEW(_webview);
- GtkWindow *crop_window;
- GdkPixbuf *screenshot, *screenshot_d;
- int width, height;
- GtkFixed *cont;
- GtkImage *image, *selection;
- GtkWidget *hint;
- gchar *hint_msg;
- GtkRequisition hint_size;
- GtkWidget *hint_box;
-
- shooting_timeout = 0;
- crop_active = FALSE;
-
- (void)webview;
-
- screenshot = scrncap_perform_screenshot();
- g_return_val_if_fail(screenshot != NULL, G_SOURCE_REMOVE);
- width = gdk_pixbuf_get_width(screenshot);
- height = gdk_pixbuf_get_height(screenshot);
-
- crop_x = crop_y = 0;
- crop_w = width;
- crop_h = height;
-
- current_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- crop_window = GTK_WINDOW(current_window);
- gtk_window_set_decorated(crop_window, FALSE);
- gtk_window_set_resizable(crop_window, FALSE);
- gtk_widget_set_size_request(GTK_WIDGET(crop_window), width, height);
- gtk_window_fullscreen(crop_window);
- gtk_window_set_keep_above(crop_window, TRUE);
-
- g_signal_connect(G_OBJECT(crop_window), "realize",
- G_CALLBACK(scrncap_crop_window_realize), NULL);
- g_signal_connect(G_OBJECT(crop_window), "destroy",
- G_CALLBACK(scrncap_crop_window_close), NULL);
- g_signal_connect(G_OBJECT(crop_window), "key-press-event",
- G_CALLBACK(scrncap_crop_window_keypress), webview);
- g_signal_connect(G_OBJECT(crop_window), "focus-out-event",
- G_CALLBACK(scrncap_crop_window_focusout), NULL);
- g_signal_connect(G_OBJECT(crop_window), "button-press-event",
- G_CALLBACK(scrncap_crop_window_btnpress), NULL);
- g_signal_connect(G_OBJECT(crop_window), "button-release-event",
- G_CALLBACK(scrncap_crop_window_btnrelease), NULL);
- g_signal_connect(G_OBJECT(crop_window), "motion-notify-event",
- G_CALLBACK(scrncap_crop_window_motion), NULL);
- g_object_set_data_full(G_OBJECT(crop_window), "screenshot",
- screenshot, g_object_unref);
-
- cont = GTK_FIXED(gtk_fixed_new());
- g_object_set_data(G_OBJECT(crop_window), "cont", cont);
- gtk_container_add(GTK_CONTAINER(crop_window), GTK_WIDGET(cont));
-
- screenshot_d = gdk_pixbuf_copy(screenshot);
- scrncap_pixbuf_darken(screenshot_d);
- image = GTK_IMAGE(gtk_image_new_from_pixbuf(screenshot_d));
- g_object_unref(screenshot_d);
- gtk_fixed_put(cont, GTK_WIDGET(image), 0, 0);
-
- selection = GTK_IMAGE(gtk_image_new_from_pixbuf(NULL));
- gtk_fixed_put(cont, GTK_WIDGET(selection), -10, -10);
- g_object_set_data(G_OBJECT(crop_window), "selection", selection);
-
- hint = gtk_label_new(NULL);
- hint_msg = g_strdup_printf("<span size='x-large'>%s</span>",
- _("Select the region to send and press Enter button to confirm "
- "or press Escape button to cancel"));
- gtk_label_set_markup(GTK_LABEL(hint), hint_msg);
- g_free(hint_msg);
- gtk_widget_set_margin_start(hint, 10);
- gtk_widget_set_margin_end(hint, 10);
- gtk_widget_set_margin_top(hint, 7);
- gtk_widget_set_margin_bottom(hint, 7);
- hint_box = gtk_event_box_new();
- gtk_container_add(GTK_CONTAINER(hint_box), hint);
- gtk_widget_get_preferred_size(hint, NULL, &hint_size);
- gtk_fixed_put(cont, hint_box,
- width / 2 - hint_size.width / 2 - 10,
- height / 2 - hint_size.height / 2 - 7);
- g_object_set_data(G_OBJECT(crop_window), "hint-box", hint_box);
-
- gtk_widget_show_all(GTK_WIDGET(crop_window));
- gtk_widget_hide(GTK_WIDGET(selection));
-
- return G_SOURCE_REMOVE;
-}
-
-static void
-scrncap_do_screenshot(GtkAction *action, PidginWebView *webview)
-{
- if (current_window) {
- gtk_window_present(GTK_WINDOW(current_window));
- return;
- }
- if (is_shooting)
- return;
- is_shooting = TRUE;
-
- shooting_timeout = g_timeout_add(SCRNCAP_SHOOTING_TIMEOUT,
- scrncap_do_screenshot_cb, webview);
-}
-
-/******************************************************************************
- * PidginConversation setup
- ******************************************************************************/
-
-static void
-scrncap_convwin_switch(GtkNotebook *notebook, GtkWidget *page, gint page_num,
- gpointer _win)
-{
- PidginConvWindow *win = _win;
- PidginConversation *gtkconv;
- PidginWebView *webview;
- gboolean images_supported;
- GtkAction *action;
-
- gtkconv = pidgin_conv_window_get_active_gtkconv(win);
- if (gtkconv == NULL)
- return;
-
- webview = PIDGIN_WEBVIEW(gtkconv->entry);
- action = g_object_get_data(G_OBJECT(win->menu->menubar),
- "insert-screenshot-action");
-
- g_return_if_fail(action != NULL);
-
- images_supported = pidgin_webview_get_format_functions(webview) &
- PIDGIN_WEBVIEW_IMAGE;
-
- gtk_action_set_sensitive(action, images_supported);
-}
-
-static void
-scrncap_convwin_menu_cb(GtkAction *action, PidginConvWindow *win)
-{
- PidginConversation *gtkconv;
- PidginWebView *webview;
-
- gtkconv = pidgin_conv_window_get_active_gtkconv(win);
- webview = PIDGIN_WEBVIEW(gtkconv->entry);
-
- scrncap_do_screenshot(action, webview);
-}
-
-static void
-scrncap_convwin_init(PidginConvWindow *win)
-{
- PidginConvWindowMenu *menu = win->menu;
- GtkAction *action;
- GtkWidget *conv_submenu, *conv_insert_image;
- GtkWidget *scrncap_btn_menu;
- gint pos = -1, i;
- GList *children, *it;
-
- action = g_object_get_data(G_OBJECT(menu->menubar),
- "insert-screenshot-action");
- if (action != NULL)
- return;
-
- action = gtk_action_new("InsertScreenshot", _("Insert Screens_hot..."),
- NULL, PIDGIN_ICON_CAMERA_PHOTO);
- gtk_action_set_is_important(action, TRUE);
- g_object_set_data_full(G_OBJECT(menu->menubar),
- "insert-screenshot-action", action, g_object_unref);
- g_signal_connect(G_OBJECT(action), "activate",
- G_CALLBACK(scrncap_convwin_menu_cb), win);
-
- conv_insert_image = gtk_ui_manager_get_widget(menu->ui,
- "/Conversation/ConversationMenu/InsertImage");
- g_return_if_fail(conv_insert_image != NULL);
- conv_submenu = gtk_widget_get_parent(conv_insert_image);
-
- children = gtk_container_get_children(GTK_CONTAINER(conv_submenu));
- pos = g_list_index(children, conv_insert_image);
- if (pos != -1)
- ++pos;
- g_list_free(children);
- g_warn_if_fail(pos >= 0);
-
- scrncap_btn_menu = gtk_action_create_menu_item(action);
- g_object_set_data(G_OBJECT(menu->menubar), "insert-screenshot-btn",
- scrncap_btn_menu);
- gtk_menu_shell_insert(GTK_MENU_SHELL(conv_submenu),
- GTK_WIDGET(scrncap_btn_menu), pos);
- gtk_widget_show(GTK_WIDGET(scrncap_btn_menu));
-
- g_signal_connect_after(G_OBJECT(win->notebook), "switch-page",
- G_CALLBACK(scrncap_convwin_switch), win);
- scrncap_convwin_switch(GTK_NOTEBOOK(win->notebook), NULL, 0, win);
-}
-
-static void
-scrncap_convwin_uninit(PidginConvWindow *win)
-{
- PidginConvWindowMenu *menu = win->menu;
- GtkWidget *btn;
-
- btn = g_object_get_data(G_OBJECT(menu->menubar),
- "insert-screenshot-btn");
- if (btn)
- gtk_widget_destroy(btn);
-
- g_object_set_data(G_OBJECT(menu->menubar),
- "insert-screenshot-btn", NULL);
- g_object_set_data(G_OBJECT(menu->menubar),
- "insert-screenshot-action", NULL);
-
- g_signal_handlers_disconnect_matched(win->notebook, G_SIGNAL_MATCH_FUNC,
- 0, 0, NULL, scrncap_convwin_switch, NULL);
-}
-
-static void
-scrncap_conversation_update(PidginWebView *webview,
- PidginWebViewButtons buttons, gpointer _action)
-{
- GtkAction *action = GTK_ACTION(_action);
-
- gtk_action_set_sensitive(action, buttons & PIDGIN_WEBVIEW_IMAGE);
-}
-
-static void
-scrncap_conversation_init(PidginConversation *gtkconv)
-{
- PidginWebView *webview;
- PidginWebViewToolbar *toolbar;
- GtkAction *action;
- GtkToolItem *scrncap_btn_wide;
- GtkWidget *scrncap_btn_lean;
- gint pos = -1, i;
- GtkToolbar *wide_view, *lean_view;
- GtkMenu *wide_menu = NULL;
- GList *wide_children, *it;
-
- if (scrncap_conv_get_data(gtkconv, "scrncap-btn-wide") != NULL)
- return;
-
- webview = PIDGIN_WEBVIEW(gtkconv->entry);
- toolbar = PIDGIN_WEBVIEWTOOLBAR(pidgin_webview_get_toolbar(webview));
- g_return_if_fail(toolbar != NULL);
- wide_view = GTK_TOOLBAR(pidgin_webviewtoolbar_get_wide_view(toolbar));
- g_return_if_fail(wide_view != NULL);
- lean_view = GTK_TOOLBAR(pidgin_webviewtoolbar_get_lean_view(toolbar));
- g_return_if_fail(lean_view != NULL);
-
- action = gtk_action_new("InsertScreenshot", _("_Screenshot"),
- _("Insert screenshot"), PIDGIN_ICON_CAMERA_PHOTO);
- gtk_action_set_is_important(action, TRUE);
- g_signal_connect(G_OBJECT(action), "activate",
- G_CALLBACK(scrncap_do_screenshot), webview);
-
- scrncap_btn_wide = GTK_TOOL_ITEM(gtk_action_create_tool_item(action));
- scrncap_conv_set_data(gtkconv, "scrncap-btn-wide", scrncap_btn_wide);
- for (i = 0; i < gtk_toolbar_get_n_items(wide_view); i++) {
- GtkToolItem *ref_item = gtk_toolbar_get_nth_item(wide_view, i);
- GtkAction *action;
-
- action = g_object_get_data(G_OBJECT(ref_item), "action");
- if (action == NULL)
- continue;
-
- if (g_strcmp0(gtk_action_get_name(action), "InsertImage") == 0) {
- pos = i + 1;
- break;
- }
- }
- gtk_toolbar_insert(wide_view, scrncap_btn_wide, pos);
- gtk_widget_show(GTK_WIDGET(scrncap_btn_wide));
-
- for (i = 0; i < gtk_toolbar_get_n_items(lean_view); i++) {
- GtkToolItem *ref_item = gtk_toolbar_get_nth_item(lean_view, i);
- const gchar *menu_name;
-
- menu_name = g_object_get_data(G_OBJECT(ref_item), "menu-name");
- if (g_strcmp0(menu_name, "insert") == 0) {
- wide_menu = g_object_get_data(G_OBJECT(ref_item), "menu");
- break;
- }
- }
- g_return_if_fail(wide_menu);
-
- pos = -1;
- wide_children = gtk_container_get_children(GTK_CONTAINER(wide_menu));
- for (it = wide_children, i = 0; it; it = g_list_next(it), i++) {
- GtkWidget *child = it->data;
- GtkAction *action;
-
- action = g_object_get_data(G_OBJECT(child), "action");
- if (action == NULL)
- continue;
-
- if (g_strcmp0(gtk_action_get_name(action), "InsertImage") == 0) {
- pos = i + 1;
- break;
- }
- }
- g_list_free(wide_children);
- if (pos < 0) {
- g_warn_if_fail(pos >= 0);
- pos = 0;
- }
-
- g_signal_connect_object(G_OBJECT(webview), "allowed-formats-updated",
- G_CALLBACK(scrncap_conversation_update), action, 0);
- scrncap_conversation_update(webview,
- pidgin_webview_get_format_functions(webview), action);
-
- scrncap_btn_lean = gtk_action_create_menu_item(action);
- scrncap_conv_set_data(gtkconv, "scrncap-btn-lean", scrncap_btn_lean);
- gtk_menu_shell_insert(GTK_MENU_SHELL(wide_menu),
- GTK_WIDGET(scrncap_btn_lean), pos);
- gtk_widget_show(GTK_WIDGET(scrncap_btn_lean));
-}
-
-static void
-scrncap_conversation_uninit(PidginConversation *gtkconv)
-{
- GtkWidget *scrncap_btn_wide, *scrncap_btn_lean;
-
- scrncap_btn_wide = scrncap_conv_get_data(gtkconv, "scrncap-btn-wide");
- if (scrncap_btn_wide == NULL)
- return;
-
- scrncap_btn_lean = scrncap_conv_get_data(gtkconv, "scrncap-btn-lean");
-
- gtk_widget_destroy(scrncap_btn_wide);
- if (scrncap_btn_lean)
- gtk_widget_destroy(scrncap_btn_lean);
-
- scrncap_conv_set_data(gtkconv, "scrncap-btn-wide", NULL);
- scrncap_conv_set_data(gtkconv, "scrncap-btn-lean", NULL);
-}
-
-/******************************************************************************
- * Plugin setup
- ******************************************************************************/
-
-static PidginPluginInfo *
-plugin_query(GError **error)
-{
- const gchar * const authors[] = {
- "Tomasz Wasilczyk <twasilczyk@pidgin.im>",
- NULL
- };
-
- return pidgin_plugin_info_new(
- "id", "gtk-screencap",
- "name", N_("Screen Capture"),
- "version", DISPLAY_VERSION,
- "category", N_("Utility"),
- "summary", N_("Send screenshots to your buddies."),
- "description", N_("Adds an option to send a screenshot as an inline "
- "image. It works only with protocols that supports "
- "inline images."),
- "authors", authors,
- "website", PURPLE_WEBSITE,
- "abi-version", PURPLE_ABI_VERSION,
- NULL
- );
-}
-
-static gboolean
-plugin_load(PurplePlugin *plugin, GError **error)
-{
- GList *it;
- const gchar *color_str;
-
- purple_prefs_add_none("/plugins");
- purple_prefs_add_none("/plugins/gtk");
- purple_prefs_add_none("/plugins/gtk/screencap");
- purple_prefs_add_string("/plugins/gtk/screencap/brush_color",
- SCRNCAP_DEFAULT_COLOR);
-
- color_str = purple_prefs_get_string("/plugins/gtk/screencap/brush_color");
- if (color_str && color_str[0])
- gdk_rgba_parse(&brush_color, color_str);
-
- purple_signal_connect(pidgin_conversations_get_handle(),
- "conversation-displayed", plugin,
- PURPLE_CALLBACK(scrncap_conversation_init), NULL);
- purple_signal_connect(pidgin_conversations_get_handle(),
- "conversation-window-created", plugin,
- PURPLE_CALLBACK(scrncap_convwin_init), NULL);
-
- it = purple_conversations_get_all();
- for (; it; it = g_list_next(it)) {
- PurpleConversation *conv = it->data;
-
- if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
- continue;
- scrncap_conversation_init(PIDGIN_CONVERSATION(conv));
- }
-
- it = pidgin_conv_windows_get_list();
- for (; it; it = g_list_next(it)) {
- PidginConvWindow *win = it->data;
- scrncap_convwin_init(win);
- }
-
- return TRUE;
-}
-
-static gboolean
-plugin_unload(PurplePlugin *plugin, GError **error)
-{
- GList *it;
-
- if (shooting_timeout > 0)
- g_source_remove(shooting_timeout);
- if (current_window != NULL)
- gtk_widget_destroy(GTK_WIDGET(current_window));
-
- it = purple_conversations_get_all();
- for (; it; it = g_list_next(it)) {
- PurpleConversation *conv = it->data;
-
- if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
- continue;
- scrncap_conversation_uninit(PIDGIN_CONVERSATION(conv));
- }
-
- it = pidgin_conv_windows_get_list();
- for (; it; it = g_list_next(it)) {
- PidginConvWindow *win = it->data;
- scrncap_convwin_uninit(win);
- }
-
- return TRUE;
-}
-
-PURPLE_PLUGIN_INIT(screencap, plugin_query, plugin_load, plugin_unload);
--- a/po/POTFILES.in Wed Nov 04 02:41:46 2020 -0600
+++ b/po/POTFILES.in Wed Nov 04 03:24:02 2020 -0600
@@ -67,10 +67,6 @@
libpurple/plugins/autoaccept.c
libpurple/plugins/buddynote.c
libpurple/plugins.c
-libpurple/plugins/codeinline.c
-libpurple/plugins/debug_example.c
-libpurple/plugins/filectl.c
-libpurple/plugins/helloworld.c
libpurple/plugins/idle.c
libpurple/plugins/joinpart.c
libpurple/plugins/keyrings/internalkeyring.c
@@ -78,15 +74,9 @@
libpurple/plugins/keyrings/secretservice.c
libpurple/plugins/keyrings/wincred.c
libpurple/plugins/log_reader.c
-libpurple/plugins/notify_example.c
libpurple/plugins/offlinemsg.c
-libpurple/plugins/one_time_password.c
-libpurple/plugins/pluginpref_example.c
libpurple/plugins/psychic.c
-libpurple/plugins/signals-test.c
-libpurple/plugins/simple.c
libpurple/plugins/statenotify.c
-libpurple/plugins/test-request-input.c
libpurple/pounce.c
libpurple/prefs.c
libpurple/protocol.c
@@ -364,7 +354,6 @@
pidgin/pidgintalkatu.c
pidgin/pidgintooltip.c
pidgin/pidginwindow.c
-pidgin/plugins/contact_priority.c
pidgin/plugins/disco/gtkdisco.c
pidgin/plugins/disco/xmppdisco.c
pidgin/plugins/disco/resources/disco.ui
@@ -372,16 +361,9 @@
pidgin/plugins/gestures/stroke.c
pidgin/plugins/gestures/stroke-draw.c
pidgin/plugins/gtkbuddynote.c
-pidgin/plugins/gtk-signals-test.c
-pidgin/plugins/history.c
pidgin/plugins/iconaway.c
-pidgin/plugins/imgupload.c
-pidgin/plugins/mailchk.c
-pidgin/plugins/musicmessaging/musicmessaging.c
pidgin/plugins/notify.c
-pidgin/plugins/pidgininc.c
pidgin/plugins/relnot.c
-pidgin/plugins/screencap.c
pidgin/plugins/spellchk.c
pidgin/plugins/transparency.c
pidgin/plugins/unity.c