pidgin/purple-plugin-pack

Parents a67c80ac8163
Children 92a8368712c3
Add nomobility plugin to stop you from sending messages to mobile users. Right now it forces it for all messages while i'm dev'n. This will be fixed before I push, but I need some more functionality here first ;)
--- a/ChangeLog Wed Nov 05 03:39:13 2008 -0500
+++ b/ChangeLog Wed Nov 05 03:58:53 2008 -0500
@@ -1,10 +1,11 @@
-Version 2.4.1:
+Version 2.5.0:
* Fixed some crashes in autprofile related to old preference paths
(amishmm)
* ListHandler now handles "FriendlyName" lines in .blt files generated by
newer Windows AIM versions when importing.
* Added Vietnamese translation - thanks Nguyen Huu Phuoc
* findip and groupmsg are now default plugins.
+ * Added nomobility plugin
Version 2.4.0: 08/03/08
* Rewrote the build system to make our lifes easier, as well as support
--- a/VERSION Wed Nov 05 03:39:13 2008 -0500
+++ b/VERSION Wed Nov 05 03:58:53 2008 -0500
@@ -1,1 +1,1 @@
-2.4.1mtn
+2.5.1mtn
--- a/configure.ac Wed Nov 05 03:39:13 2008 -0500
+++ b/configure.ac Wed Nov 05 03:58:53 2008 -0500
@@ -1,4 +1,4 @@
-AC_INIT([purple-plugin_pack], [2.4.1mtn], [plugins-devel@lists.guifications.org])
+AC_INIT([purple-plugin_pack], [2.5.1mtn], [plugins-devel@lists.guifications.org])
AC_CANONICAL_SYSTEM
AM_CONFIG_HEADER(pre_config.h)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nomobility/Makefile.am Wed Nov 05 03:58:53 2008 -0500
@@ -0,0 +1,28 @@
+EXTRA_DIST = \
+ Makefile.mingw \
+ plugins.cfg
+
+nomobilitydir = $(PURPLE_LIBDIR)
+
+nomobility_la_LDFLAGS = -module -avoid-version
+
+if HAVE_PURPLE
+
+nomobility_LTLIBRARIES = nomobility.la
+
+nomobility_la_SOURCES = \
+ nomobility.c
+
+nomobility_la_LIBADD = \
+ $(GLIB_LIBS) \
+ $(PURPLE_LIBS)
+
+endif
+
+AM_CPPFLAGS = \
+ -DLIBDIR=\"$(PURPLE_LIBDIR)\" \
+ -DDATADIR=\"$(PURPLE_DATADIR)\" \
+ -DPIXMAPSDIR=\"$(PURPLE_PIXMAPSDIR)\" \
+ $(DEBUG_CFLAGS) \
+ $(PURPLE_CFLAGS)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nomobility/Makefile.mingw Wed Nov 05 03:58:53 2008 -0500
@@ -0,0 +1,12 @@
+#
+# Makefile.mingw
+#
+# Description: Makefile for dice plugin.
+#
+
+PP_TOP := ..
+
+PP = nomobility
+
+include $(PP_TOP)/win_pp.mak
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nomobility/nomobility.c Wed Nov 05 03:58:53 2008 -0500
@@ -0,0 +1,143 @@
+/*
+ * nomobility - stops you from sending messages to mobile users
+ * Copyright (C) 2008 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 02111-1301, USA.
+ */
+
+/* If you can't figure out what this line is for, DON'T TOUCH IT. */
+#include "../common/pp_internal.h"
+
+#include <time.h>
+
+#include <plugin.h>
+
+#include <blist.h>
+#include <conversation.h>
+#include <debug.h>
+#include <status.h>
+
+/******************************************************************************
+ * Callbacks
+ *****************************************************************************/
+static void
+sending_im_msg(PurpleAccount *account, gchar *receiver, gchar **message,
+ gpointer data)
+{
+ PurpleBuddy *buddy = NULL;
+ PurplePresence *presence = NULL;
+
+ buddy = purple_find_buddy(account, receiver);
+
+ if(!buddy)
+ return;
+
+ presence = purple_buddy_get_presence(buddy);
+
+ if(!presence)
+ return;
+
+#if 0
+ if(purple_presence_is_status_primitive_active(presence,
+ PURPLE_STATUS_MOBILE))
+#endif
+ {
+ PurpleConversation *conv = NULL;
+ gchar *msg = NULL;
+
+ purple_debug_info("nomobility", "killing message!\n");
+ g_free(*message);
+ *message = NULL;
+
+ conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM,
+ receiver, account);
+ if(!conv)
+ return;
+
+ msg = g_strdup_printf(_("Cancelled message to %s, they are currently "
+ "mobile."),
+ receiver);
+ purple_conv_im_write(PURPLE_CONV_IM(conv), receiver, msg,
+ PURPLE_MESSAGE_NO_LOG | PURPLE_MESSAGE_DELAYED,
+ time(NULL));
+ g_free(msg);
+ }
+}
+
+/******************************************************************************
+ * Plugin Stuff
+ *****************************************************************************/
+static gboolean
+plugin_load(PurplePlugin *plugin) {
+ purple_signal_connect(purple_conversations_get_handle(),
+ "sending-im-msg", plugin,
+ PURPLE_CALLBACK(sending_im_msg), NULL);
+ return TRUE;
+}
+
+static gboolean
+plugin_unload(PurplePlugin *plugin)
+{
+ return TRUE;
+}
+
+static PurplePluginInfo info =
+{
+ PURPLE_PLUGIN_MAGIC,
+ PURPLE_MAJOR_VERSION,
+ PURPLE_MINOR_VERSION,
+ PURPLE_PLUGIN_STANDARD,
+ NULL,
+ 0,
+ NULL,
+ PURPLE_PRIORITY_DEFAULT,
+
+ "core-plugin_pack-nomobility",
+ NULL,
+ PP_VERSION,
+ NULL,
+ NULL,
+ "Gary Kramlich <grim@reaperworld.com>",
+ PP_WEBSITE,
+
+ plugin_load,
+ plugin_unload,
+ NULL,
+
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
+static void
+init_plugin(PurplePlugin *plugin)
+{
+#ifdef ENABLE_NLS
+ bindtextdomain(GETTEXT_PACKAGE, PP_LOCALEDIR);
+ bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
+#endif /* ENABLE_NLS */
+
+ info.name = _("nomobility");
+ info.summary = _("Stops you from messaging mobile users");
+ info.description = info.summary;
+
+}
+
+PURPLE_INIT_PLUGIN(nomobility, init_plugin, info)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nomobility/plugins.cfg Wed Nov 05 03:58:53 2008 -0500
@@ -0,0 +1,9 @@
+[No Mobility]
+type=default
+depends=purple
+provides=nomobility
+summary=Stops you from messaging mobile users
+description=%(summary)s
+authors=Gary Kramlich
+introduced=2.5.0
+