summary refs log tree commit diff stats
diff options
context:
space:
mode:
-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);