grim/purple-force-online

Initial revision
draft default tip
2021-06-21, Gary Kramlich
835c979ce1ad
Parents
Children
Initial revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore Mon Jun 21 02:46:02 2021 -0500
@@ -0,0 +1,2 @@
+syntax: regexp
+build.*\/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/README.md Mon Jun 21 02:46:02 2021 -0500
@@ -0,0 +1,40 @@
+# Purple Force Online
+
+A simple plugin that tells libpurple to assume it's online. The use case for
+this plugin is that either your Network Manager is bugged out or you want to
+tell Finch that it should always assume it's online as there is no
+`--force-online` option in Finch.
+
+## Download
+
+The following downloads are available:
+
+ * [tar.gz](https://keep.imfreedom.org/grim/purple-force-online/archive/default.tar.gz)
+ * [tar.bz2](https://keep.imfreedom.org/grim/purple-force-online/archive/default.tar.bz2)
+
+## Building
+
+This plugin uses the [Meson](https://mesonbuild.com) build system and can be
+ran by the following commands.
+
+```
+meson build
+ninja -C build
+```
+
+## Installing
+
+The build system is setup to install to the system wide plugin directory and
+can be invoked via
+
+```
+ninja -C build install
+```
+
+If you would like to just install it for your user you can run the command
+below to copy it to your user specific plugins directory.
+
+```
+cp build/purple-force-online.so ~/.purple/plugins
+```
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/meson.build Mon Jun 21 02:46:02 2021 -0500
@@ -0,0 +1,28 @@
+project(
+ 'purple-force-online',
+ 'c',
+ version: '0.1.0',
+)
+
+SOURCES = [
+ 'purple-force-online.c',
+]
+
+# The code below should not need to be modified for simple use cases.
+add_project_arguments(
+ '-DPREFIX="@0@"'.format(get_option('prefix')),
+ '-DLIBDIR="@0@"'.format(get_option('libdir')),
+ '-DPLUGIN_VERSION="@0@"'.format(meson.project_version()),
+ language : 'c'
+)
+
+PURPLE = dependency('purple', version: '>=2.0.0')
+
+shared_library(
+ meson.project_name(),
+ SOURCES,
+ name_prefix: '',
+ dependencies: [PURPLE],
+ install: true,
+ install_dir: PURPLE.get_pkgconfig_variable('plugindir'),
+)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/purple-force-online.c Mon Jun 21 02:46:02 2021 -0500
@@ -0,0 +1,60 @@
+/*
+ * Purple Force Online - Calls force online on load mainly for Finch
+ * Copyright (C) 2021 Gary Kramlich <grim@reaperworld.com>
+ *
+ * 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 02110-1301, USA.
+ */
+
+#include <glib.h>
+
+#define PURPLE_PLUGINS
+
+#include "network.h"
+#include "plugin.h"
+#include "version.h"
+
+static gboolean
+plugin_load(PurplePlugin *plugin) {
+ purple_network_force_online();
+
+ return TRUE;
+}
+
+static PurplePluginInfo info = {
+ .magic = PURPLE_PLUGIN_MAGIC,
+ .major_version = PURPLE_MAJOR_VERSION,
+ .minor_version = PURPLE_MINOR_VERSION,
+ .type = PURPLE_PLUGIN_STANDARD,
+ .priority = PURPLE_PRIORITY_DEFAULT,
+
+ .id = "grim-purple_force_online",
+ .name = "Purple Force Online",
+ .version = PLUGIN_VERSION,
+
+ .summary = "Forces libpurple to think it's online",
+ .description = "Forces libpurple to think it's online. This is useful for "
+ "Finch which doesn't have the --force-online option, or if "
+ "something is broken with your network-manager install.",
+ .author = "Gary Kramlich <grim@reaperworld.com>",
+ .homepage = "https://keep.imfreedom.org/grim/purple-force-online",
+
+ .load = plugin_load
+};
+
+static void
+init_plugin(PurplePlugin *plugin) {
+}
+
+PURPLE_INIT_PLUGIN(purple_force_online, init_plugin, info);