--- a/irc-more/irc-more.c Tue Mar 09 23:26:42 2010 -0500
+++ b/irc-more/irc-more.c Sun Mar 28 01:26:38 2010 -0400
@@ -25,15 +25,17 @@
#include <conversation.h>
+#define AUTOJOIN purple_account_get_string(account, "autojoin", NULL) #define CTCP_REPLY purple_account_get_string(account, "ctcp-message", "Purple IRC")
#define PART_MESSAGE purple_account_get_string(account, "part-message", "Leaving.")
#define QUIT_MESSAGE purple_account_get_string(account, "quit-message", "Leaving.")
-#define SET_UMODES purple_account_get_string(account, "setumodes", "i")
+#define SET_UMODES purple_account_get_string(account, "setumodes", NULL) #define UNSET_UMODES purple_account_get_string(account, "unsetumodes", NULL)
#define PLUGIN_ID "core-plugin_pack-irc-more"
@@ -102,12 +104,38 @@
+autojoin_cb(gpointer data) + PurpleAccount *account = data; + gchar *cmd = g_strdup_printf("join %s", AUTOJOIN), *error = NULL, + *esc = g_markup_escape_text(cmd, -1); + /* this hack courtesy irchelper -- don't use purple_conversation_set_account + * because it will fire a signal that other plugins can use. Instead do + * this hack. This will break when struct hiding is complete and ABI breaks. */ + PurpleConversation *conv = g_new0(PurpleConversation, 1); + conv->account = account; + purple_debug_info("irc-more", "Executng command: %s\n", cmd); + result = purple_cmd_do_command(conv, cmd, esc, &error); + purple_debug_info("irc-more", "Executed command. Result: %d. Error: %s\n", + result, error ? error : "(null)"); signed_on_cb(PurpleConnection *gc)
/* should this be done on a timeout? */
PurpleAccount *account = NULL;
- const gchar *nick = NULL, *setmodes = NULL, *unsetmodes = NULL;
+ const gchar *nick = NULL, *setmodes = NULL, *unsetmodes = NULL, *autojoin = NULL; gchar *msg = NULL, *msg2 = NULL;
account = purple_connection_get_account(gc);
@@ -119,17 +147,25 @@
nick = purple_connection_get_display_name(gc);
unsetmodes = UNSET_UMODES;
- msg = g_strdup_printf("MODE %s +%s\r\n", nick, setmodes);
- irc_info->send_raw(gc, msg, strlen(msg));
+ if(setmodes && *setmodes) { + msg = g_strdup_printf("MODE %s +%s\r\n", nick, setmodes); + purple_debug_info("irc-more", "Sending command: %s\n", msg); + irc_info->send_raw(gc, msg, strlen(msg)); if(unsetmodes && *unsetmodes) {
msg2 = g_strdup_printf("MODE %s -%s\r\n", nick, unsetmodes);
+ purple_debug_info("irc-more", "Sending command: %s\n", msg); irc_info->send_raw(gc, msg2, strlen(msg2));
+ if(autojoin && *autojoin) + purple_timeout_add_seconds(6, autojoin_cb, account); @@ -219,8 +255,10 @@
PurplePlugin *prpl = NULL;
PurpleAccountOption *option;
+ void *gc_handle = NULL; +#if !PURPLE_VERSION_CHECK(2,4,0) gchar *notice_help = NULL;
- void *gc_handle = NULL;
prpl = purple_find_prpl("prpl-irc");
@@ -228,10 +266,10 @@
+#if !PURPLE_VERSION_CHECK(2,4,0) /* specify our help string and register our command */
notice_help = _("notice target message: Send a notice to the specified target.");
-#if !PURPLE_VERSION_CHECK(2,4,0)
notice_cmd_id = purple_cmd_register("notice", "ws", PURPLE_CMD_P_PLUGIN,
PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY,
"prpl-irc", notice_cmd_cb, notice_help, NULL);
@@ -251,6 +289,9 @@
irc_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
/* Alphabetize the option label strings */
+ option = purple_account_option_string_new(_("Auto-Join Channels"), "autojoin", ""); + irc_info->protocol_options = g_list_append(irc_info->protocol_options, option); option = purple_account_option_string_new(_("CTCP Version reply"), "ctcp-message", "Purple IRC");
irc_info->protocol_options = g_list_append(irc_info->protocol_options, option);
@@ -292,7 +333,8 @@
- "Sadrul H Chowdhury <sadrul@users.sourceforge.net>",
+ "Sadrul H Chowdhury <sadrul@users.sourceforge.net>\n" + "John Bailey <rekkanoryo@rekkanoryo.org>", @@ -320,9 +362,16 @@
info.name = _("IRC More");
info.summary = _("Adds additional IRC features.");
+#if !PURPLE_VERSION_CHECK(2,4,0) info.description = _("Adds additional IRC features, including a "
"customizable quit message, a customizable CTCP VERSION reply, "
- "and the /notice command for notices.");
+ "a rudimentary channel autojoin list, and the /notice command for " + info.description = _("Adds additional IRC features, including a " + "customizable quit message, a customizable CTCP VERSION reply, " + "and a rudimentary channel autojoin list."); PURPLE_INIT_PLUGIN(irc_more, init_plugin, info)
--- a/irc-more/plugins.cfg Tue Mar 09 23:26:42 2010 -0500
+++ b/irc-more/plugins.cfg Sun Mar 28 01:26:38 2010 -0400
@@ -3,7 +3,7 @@
summary=Adds additional IRC features
-description=Adds additional IRC features, including a customizable quit message, a customizable CTCP VERSION reply, and the /notice command for notices where libpurple does not support it.
+description=Adds additional IRC features, including a customizable quit message, a customizable CTCP VERSION reply, a rudimentary channel autojoin list and the /notice command for notices where libpurple does not support it. authors=Sadrul Habib Chowdhury,John Bailey
notes=Support for /notice only when built with libpurple older than 2.4.0.