From 31dd0201146418d66e7edeb351be4e0502f0b8ce Mon Sep 17 00:00:00 2001 From: Groil Date: Sun, 28 Aug 2016 23:47:45 -0400 Subject: [PATCH] fishlim: Add support for the /me command Part of #1440 --- plugins/fishlim/plugin_hexchat.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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);