fishlim: Add support for the /me command

Part of #1440
This commit is contained in:
Groil 2016-08-28 23:47:45 -04:00 committed by Patrick Griffis
parent 321587c73b
commit 31dd020114

View File

@ -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);