Create a skeleton for the IRCv3 protocol plugin
Testing Done:
Compiled and verified that the new protocol showed up in the protocol chooser in the new account editor.
Reviewed at https://reviews.imfreedom.org/r/1846/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/protocols/ircv3/meson.build Wed Sep 28 00:18:12 2022 -0500
@@ -0,0 +1,20 @@
+ 'purpleircv3protocol.c', + 'purpleircv3protocol.h', + ircv3_resources = gnome.compile_resources('ircv3resource', + 'resources/ircv3.gresource.xml', + source_dir : 'resources', + c_name : 'purple_ircv3') + IRCV3_SOURCES += ircv3_resources + ircv3_prpl = shared_library('ircv3', IRCV3_SOURCES, + c_args : ['-DG_LOG_USE_STRUCTURED', '-DG_LOG_DOMAIN="Purple-IRCv3"'], + dependencies : [sasl, libpurple_dep, glib, gio, ws2_32], + install : true, install_dir : PURPLE_PLUGINDIR) + devenv.append('PURPLE_PLUGIN_PATH', meson.current_build_dir()) --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/protocols/ircv3/purpleircv3core.c Wed Sep 28 00:18:12 2022 -0500
@@ -0,0 +1,108 @@
+ * Purple - Internet Messaging Library + * Copyright (C) Pidgin Developers <devel@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, see <https://www.gnu.org/licenses/>. +#include <glib/gi18n-lib.h> +#include <gplugin-native.h> +#include "purpleircv3protocol.h" +/****************************************************************************** + *****************************************************************************/ +#define PURPLE_IRCV3_DOMAIN (g_quark_from_static_string("ircv3-plugin")) +static PurpleProtocol *ircv3_protocol = NULL; +/****************************************************************************** + *****************************************************************************/ +static GPluginPluginInfo * +purple_ircv3_query(G_GNUC_UNUSED GError **error) { + PurplePluginInfoFlags flags = PURPLE_PLUGIN_INFO_FLAGS_INTERNAL | + PURPLE_PLUGIN_INFO_FLAGS_AUTO_LOAD; + const gchar * const authors[] = { + "Pidgin Developers <devel@pidgin.im>", + return purple_plugin_info_new( + "name", "IRCv3 Protocol", + "version", DISPLAY_VERSION, + "category", N_("Protocol"), + "summary", N_("IRCv3 Protocol Plugin"), + "description", N_("Modern IRC Support"), + "website", PURPLE_WEBSITE, + "abi-version", PURPLE_ABI_VERSION, +purple_ircv3_load(GPluginPlugin *plugin, GError **error) { + PurpleProtocolManager *manager = NULL; + if(PURPLE_IS_PROTOCOL(ircv3_protocol)) { + g_set_error_literal(error, PURPLE_IRCV3_DOMAIN, 0, + "plugin was not cleaned up properly"); + purple_ircv3_protocol_register(GPLUGIN_NATIVE_PLUGIN(plugin)); + manager = purple_protocol_manager_get_default(); + ircv3_protocol = purple_ircv3_protocol_new(); + if(!purple_protocol_manager_register(manager, ircv3_protocol, error)) { + g_clear_object(&ircv3_protocol); +purple_ircv3_unload(GPluginPlugin *plugin, gboolean shutdown, GError **error) { + PurpleProtocolManager *manager = NULL; + if(!PURPLE_IS_PROTOCOL(ircv3_protocol)) { + g_set_error_literal(error, PURPLE_IRCV3_DOMAIN, 0, + "plugin was not setup properly"); + manager = purple_protocol_manager_get_default(); + if(!purple_protocol_manager_unregister(manager, ircv3_protocol, error)) { + g_clear_object(&ircv3_protocol); +GPLUGIN_NATIVE_PLUGIN_DECLARE(purple_ircv3) --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/protocols/ircv3/purpleircv3protocol.c Wed Sep 28 00:18:12 2022 -0500
@@ -0,0 +1,66 @@
+ * Purple - Internet Messaging Library + * Copyright (C) Pidgin Developers <devel@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, see <https://www.gnu.org/licenses/>. +#include <glib/gi18n-lib.h> +#include "purpleircv3protocol.h" +} PurpleIRCv3ProtocolPrivate; +/****************************************************************************** + * GObject Implementation + *****************************************************************************/ +G_DEFINE_DYNAMIC_TYPE_EXTENDED( + PurpleIRCv3Protocol, purple_ircv3_protocol, PURPLE_TYPE_PROTOCOL, 0, + G_ADD_PRIVATE_DYNAMIC(PurpleIRCv3Protocol)) +purple_ircv3_protocol_init(PurpleIRCv3Protocol *protocol) { +purple_ircv3_protocol_class_finalize(PurpleIRCv3ProtocolClass *klass) { +purple_ircv3_protocol_class_init(PurpleIRCv3ProtocolClass *klass) { +/****************************************************************************** + * GObject Implementation + *****************************************************************************/ +purple_ircv3_protocol_register(GPluginNativePlugin *plugin) { + purple_ircv3_protocol_register_type(G_TYPE_MODULE(plugin)); +purple_ircv3_protocol_new(void) { + PURPLE_IRCV3_TYPE_PROTOCOL, + "description", _("Version 3 of Internet Relay Chat (IRC)."), + "icon-name", "im-ircv3", + "icon-resource-path", "/im/pidgin/libpurple/ircv3/icons", + "options", OPT_PROTO_CHAT_TOPIC | OPT_PROTO_PASSWORD_OPTIONAL | + OPT_PROTO_SLASH_COMMANDS_NATIVE, --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/protocols/ircv3/purpleircv3protocol.h Wed Sep 28 00:18:12 2022 -0500
@@ -0,0 +1,50 @@
+ * Purple - Internet Messaging Library + * Copyright (C) Pidgin Developers <devel@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, see <https://www.gnu.org/licenses/>. +#ifndef PURPLE_IRCV3_PROTOCOL_H +#define PURPLE_IRCV3_PROTOCOL_H +#include <glib-object.h> +#include <gplugin-native.h> +#define PURPLE_IRCV3_TYPE_PROTOCOL (purple_ircv3_protocol_get_type()) +G_DECLARE_DERIVABLE_TYPE(PurpleIRCv3Protocol, purple_ircv3_protocol, + PURPLE_IRCV3, PROTOCOL, PurpleProtocol) +struct _PurpleIRCv3ProtocolClass { + PurpleProtocolClass parent; +G_GNUC_INTERNAL void purple_ircv3_protocol_register(GPluginNativePlugin *plugin); +G_GNUC_INTERNAL PurpleProtocol *purple_ircv3_protocol_new(void); +#endif /* PURPLE_IRCV3_PROTOCOL_H */ Binary file libpurple/protocols/ircv3/resources/icons/16x16/apps/im-ircv3.png has changed
Binary file libpurple/protocols/ircv3/resources/icons/22x22/apps/im-ircv3.png has changed
Binary file libpurple/protocols/ircv3/resources/icons/48x48/apps/im-ircv3.png has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/protocols/ircv3/resources/ircv3.gresource.xml Wed Sep 28 00:18:12 2022 -0500
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?> + <gresource prefix="/im/pidgin/libpurple/ircv3"> + <file>icons/16x16/apps/im-ircv3.png</file> + <file>icons/22x22/apps/im-ircv3.png</file> + <file>icons/48x48/apps/im-ircv3.png</file> --- a/libpurple/protocols/meson.build Tue Sep 27 02:44:13 2022 -0500
+++ b/libpurple/protocols/meson.build Wed Sep 28 00:18:12 2022 -0500
@@ -3,6 +3,7 @@
--- a/meson.build Tue Sep 27 02:44:13 2022 -0500
+++ b/meson.build Wed Sep 28 00:18:12 2022 -0500
@@ -385,7 +385,7 @@
-DEFAULT_PRPLS = ['bonjour', 'demo', 'facebook', 'gg', 'irc', 'jabber',
+DEFAULT_PRPLS = ['bonjour', 'demo', 'facebook', 'gg', 'irc', 'ircv3', 'jabber', 'novell', 'null', 'sametime', 'silc', 'zephyr']
ALL_PRPLS = DEFAULT_PRPLS + ['null']
@@ -417,6 +417,7 @@
DYNAMIC_FACEBOOK = DYNAMIC_PRPLS.contains('facebook')
DYNAMIC_GG = DYNAMIC_PRPLS.contains('gg')
DYNAMIC_IRC = DYNAMIC_PRPLS.contains('irc')
+DYNAMIC_IRCV3 = DYNAMIC_PRPLS.contains('ircv3') DYNAMIC_JABBER = DYNAMIC_PRPLS.contains('jabber')
DYNAMIC_NOVELL = DYNAMIC_PRPLS.contains('novell')
DYNAMIC_NULL = DYNAMIC_PRPLS.contains('null')