summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Lidén Borell <samuel@kodafritt.se>2014-06-02 20:27:13 (GMT)
committerSamuel Lidén Borell <samuel@kodafritt.se>2014-06-02 20:27:13 (GMT)
commite8461bce4c4af65b3aac89d3f48c95f94c960422 (patch)
tree536c01584d3cff421f556a4bb58be2abefb0a9d1
parentbefa297aa3a1719a76a138b8690d529d2e56f70a (diff)
downloadfishlim-e8461bce4c4af65b3aac89d3f48c95f94c960422.zip
fishlim-e8461bce4c4af65b3aac89d3f48c95f94c960422.tar.gz
fishlim-e8461bce4c4af65b3aac89d3f48c95f94c960422.tar.bz2
Handle a special character before "+OK", e.g. identify-msg + or -
-rw-r--r--plugin_xchat.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/plugin_xchat.c b/plugin_xchat.c
index 5e26111..fcaa371 100644
--- a/plugin_xchat.c
+++ b/plugin_xchat.c
@@ -44,7 +44,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 [<nick or #channel>] <password>, sets the key for a channel or nick";
static const char usage_delkey[] = "Usage: DELKEY <nick or #channel>, deletes the key for a channel or nick";
@@ -123,6 +123,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 XCHAT_EAT_NONE;
@@ -133,6 +134,8 @@ static int handle_incoming(char *word[], char *word_eol[], void *userdata) {
// Look for encrypted data
for (ew = w+1; ew < XCHAT_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 XCHAT_EAT_NONE;
@@ -167,6 +170,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];