From 7c52e29e6e53d48be1c38596f7489da3b041c180 Mon Sep 17 00:00:00 2001 From: Samuel Lidén Borell Date: Mon, 2 Jun 2014 20:27:13 +0000 Subject: Handle a special character before "+OK", e.g. identify-msg + or - --- plugins/fishlim/plugin_hexchat.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'plugins/fishlim/plugin_hexchat.c') diff --git a/plugins/fishlim/plugin_hexchat.c b/plugins/fishlim/plugin_hexchat.c index 35d05b6b..72517ca9 100644 --- a/plugins/fishlim/plugin_hexchat.c +++ b/plugins/fishlim/plugin_hexchat.c @@ -40,7 +40,7 @@ static const char plugin_name[] = "FiSHLiM"; static const char plugin_desc[] = "Encryption plugin for the FiSH protocol. Less is More!"; -static const char plugin_version[] = "0.0.16"; +static const char plugin_version[] = "0.0.17"; static const char usage_setkey[] = "Usage: SETKEY [] , sets the key for a channel or nick"; static const char usage_delkey[] = "Usage: DELKEY , deletes the key for a channel or nick"; @@ -119,6 +119,7 @@ static int handle_incoming(char *word[], char *word_eol[], void *userdata) { size_t ew; size_t uw; size_t length; + char prefix_char = 0; if (!irc_parse_message((const char **)word, &prefix, &command, &w)) return HEXCHAT_EAT_NONE; @@ -129,6 +130,8 @@ static int handle_incoming(char *word[], char *word_eol[], void *userdata) { // Look for encrypted data for (ew = w+1; ew < HEXCHAT_MAX_WORDS-1; ew++) { const char *s = (ew == w+1 ? word[ew]+1 : word[ew]); + if (*s && (s[1] == '+' || s[1] == 'm')) { prefix_char = *(s++); } + else { prefix_char = 0; } if (strcmp(s, "+OK") == 0 || strcmp(s, "mcps") == 0) goto has_encrypted_data; } return HEXCHAT_EAT_NONE; @@ -163,6 +166,11 @@ static int handle_incoming(char *word[], char *word_eol[], void *userdata) { if (!append(&message, &length, ":")) goto decrypt_error; } + if (prefix_char) { + char prefix_str[2] = { prefix_char, '\0' }; + if (!append(&message, &length, prefix_str)) goto decrypt_error; + } + } else { // Add unencrypted data (for example, a prefix from a bouncer or bot) peice = word[uw]; -- cgit 1.4.1