+ // If the message is a CTCP then we skip it unless it is
+ // an ACTION in which case we strip the prefix and suffix.
+ std::string::const_iterator text_begin = details.text.begin();
+ std::string::const_iterator text_end = details.text.end();
+ if (details.text[0] == '\1')
+ {
+ // If the CTCP is not an action then skip it.
+ if (details.text.compare(0, 8, "\1ACTION ", 8))
+ return MOD_RES_PASSTHRU;
+
+ // Skip the CTCP message characters.
+ text_begin += 8;
+ if (*details.text.rbegin() == '\1')
+ text_end -= 1;
+ }
+
+ // If the message is shorter than the minimum length
+ // then we don't need to do anything else.
+ size_t length = std::distance(text_begin, text_end);
+ if (length < minlen)
+ return MOD_RES_PASSTHRU;