pidgin/purple-plugin-pack

aba0d765ff0f
Parents 9d3d85579cf6
Children 050247809d73
A patch from Elliott Sales de Andrade that makes !command and /exec command
optional in slashexec. Also acnowledgement and a comment tweak for grammar.
Fixes #391. Thanks!
--- a/AUTHORS Sat Aug 25 03:52:25 2007 -0400
+++ b/AUTHORS Sun Aug 26 17:01:50 2007 -0400
@@ -30,6 +30,7 @@
Accepted Patches
================
+Elliott Sales de Andrade
Chris Banal
Daniel Beardsmore
Joshua Cowan
--- a/ChangeLog Sat Aug 25 03:52:25 2007 -0400
+++ b/ChangeLog Sun Aug 26 17:01:50 2007 -0400
@@ -1,6 +1,7 @@
Version 2.2.0mtn:
* Merged autorejoin into irc-more. No prefs migration will take place.
You will need to reconfigure the delay yourself.
+ * Slashexec's '/exec command' and '!command' are now optional (QuLogic)
Version 2.1.1: 8/19/07
* Fixed lack of .build, .pidgin-plugin, and Makefile.mingw for convbadger
--- a/slashexec/slashexec.c Sat Aug 25 03:52:25 2007 -0400
+++ b/slashexec/slashexec.c Sun Aug 26 17:01:50 2007 -0400
@@ -44,7 +44,7 @@
#include <util.h>
#ifdef _WIN32
-/* Windows 2000 and earlier only allow 2047 bytes in an argv vector for cmd.exe
+/* Windows 2000 and earlier allow only 2047 bytes in an argv vector for cmd.exe
* so we need to make sure we don't exceed that. 2036 allows "cmd.exe /c " to
* fit inside the vector. */
# define MAX_CMD_LEN 2036
@@ -56,6 +56,10 @@
# define MAX_CMD_LEN 8000
#endif
+#define PREF_PREFIX "/plugins/core/slashexec"
+#define PREF_SLASH PREF_PREFIX "/slash"
+#define PREF_BANG PREF_PREFIX "/bang"
+
static PurpleCmdId se_cmd;
static gchar *shell;
@@ -278,6 +282,9 @@
gboolean send = FALSE;
char *string = args[0];
+ if(!purple_prefs_get_bool(PREF_SLASH))
+ return PURPLE_CMD_RET_CONTINUE;
+
if(string && !strncmp(string, "-o ", 3)) {
send = TRUE;
string += 3;
@@ -295,7 +302,7 @@
char *string = *message, *strip;
gboolean send = TRUE;
- if(conv == NULL) return;
+ if(conv == NULL || !purple_prefs_get_bool(PREF_BANG)) return;
strip = purple_markup_strip_html(string);
@@ -407,6 +414,40 @@
return TRUE;
}
+static PurplePluginPrefFrame *
+get_plugin_pref_frame(PurplePlugin *plugin)
+{
+ PurplePluginPrefFrame *frame;
+ PurplePluginPref *pref;
+
+ frame = purple_plugin_pref_frame_new();
+
+ pref = purple_plugin_pref_new_with_label(_("Execute commands starting with: "));
+ purple_plugin_pref_frame_add(frame, pref);
+
+ pref = purple_plugin_pref_new_with_name_and_label(PREF_SLASH,
+ _("/exec Command (/exec some_command)"));
+ purple_plugin_pref_frame_add(frame, pref);
+
+ pref = purple_plugin_pref_new_with_name_and_label(PREF_BANG,
+ _("Exclamation point (!some_command)"));
+ purple_plugin_pref_frame_add(frame, pref);
+
+ return frame;
+}
+
+static PurplePluginUiInfo prefs_info = {
+ get_plugin_pref_frame,
+ 0,
+ NULL,
+
+ /* padding */
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
static PurplePluginInfo se_info = {
PURPLE_PLUGIN_MAGIC,
PURPLE_MAJOR_VERSION,
@@ -433,11 +474,11 @@
NULL, /* destroy */
NULL, /* ui info */
NULL, /* extra info */
+ &prefs_info, /* prefs info */
NULL, /* actions info */
NULL,
NULL,
NULL,
- NULL,
NULL
};
@@ -453,6 +494,9 @@
" clients have. Also included is the ability to"
" execute commands with an exclamation point"
" (!uptime, for instance).\n");
+ purple_prefs_add_none(PREF_PREFIX);
+ purple_prefs_add_bool(PREF_SLASH, TRUE);
+ purple_prefs_add_bool(PREF_BANG, FALSE);
}
PURPLE_INIT_PLUGIN(slashexec, init_plugin, se_info)