summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorGroil <groil2@hotmail.com>2016-08-28 23:47:45 -0400
committerPatrick Griffis <tingping@tingping.se>2016-10-08 14:48:49 -0400
commit31dd0201146418d66e7edeb351be4e0502f0b8ce (patch)
tree7591aba27e7b9e5107eddea9ba0185483672d952
parent321587c73b1da2eef1e9094132e1ff5606055291 (diff)
fishlim: Add support for the /me command
Part of #1440
-rw-r--r--plugins/fishlim/plugin_hexchat.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/plugins/fishlim/plugin_hexchat.c b/plugins/fishlim/plugin_hexchat.c
index 5024a903..dadba0d7 100644
--- a/plugins/fishlim/plugin_hexchat.c
+++ b/plugins/fishlim/plugin_hexchat.c
@@ -498,6 +498,22 @@ static int handle_crypt_msg(char *word[], char *word_eol[], void *userdata)
     return HEXCHAT_EAT_ALL;
 }
 
+static int handle_crypt_me(char *word[], char *word_eol[], void *userdata) {
+	const char *channel = hexchat_get_info(ph, "channel");
+	char *buf;
+
+    buf = fish_encrypt_for_nick(channel, word_eol[2]);
+	if (!buf)
+        return HEXCHAT_EAT_NONE;
+
+	hexchat_commandf(ph, "PRIVMSG %s :\001ACTION +OK %s \001", channel, buf);
+	hexchat_emit_print(ph, "Your Action", hexchat_get_info(ph, "nick"),
+                       word_eol[2], NULL);
+
+	g_free(buf);
+	return HEXCHAT_EAT_ALL;
+}
+
 /**
  * Returns the plugin name version information.
  */
@@ -530,6 +546,7 @@ int hexchat_plugin_init(hexchat_plugin *plugin_handle,
     hexchat_hook_command(ph, "TOPIC+", HEXCHAT_PRI_NORM, handle_crypt_topic, usage_topic, NULL);
     hexchat_hook_command(ph, "NOTICE+", HEXCHAT_PRI_NORM, handle_crypt_notice, usage_notice, NULL);
     hexchat_hook_command(ph, "MSG+", HEXCHAT_PRI_NORM, handle_crypt_msg, usage_msg, NULL);
+    hexchat_hook_command(ph, "ME", HEXCHAT_PRI_NORM, handle_crypt_me, NULL, NULL);
 
     /* Add handlers */
     hexchat_hook_command(ph, "", HEXCHAT_PRI_NORM, handle_outgoing, NULL, NULL);