Take first two words in colorMentions

This lets phrases like "hi june" get colored, but still doesn't get
carried away.
weechat-hashes
C. McEnroe 2020-02-11 18:08:05 -05:00
parent c9590bab06
commit 4d532ec738
1 changed files with 4 additions and 1 deletions

View File

@ -529,7 +529,10 @@ static bool isMention(const struct Message *msg) {
static const char *colorMentions(size_t id, struct Message *msg) { static const char *colorMentions(size_t id, struct Message *msg) {
char *split = strchr(msg->params[1], ':'); char *split = strchr(msg->params[1], ':');
if (!split) split = strchr(msg->params[1], ' '); if (!split) {
split = strchr(msg->params[1], ' ');
if (split) split = strchr(&split[1], ' ');
}
if (!split) split = &msg->params[1][strlen(msg->params[1])]; if (!split) split = &msg->params[1][strlen(msg->params[1])];
for (char *ch = msg->params[1]; ch < split; ++ch) { for (char *ch = msg->params[1]; ch < split; ++ch) {
if (iscntrl(*ch)) return ""; if (iscntrl(*ch)) return "";