diff options
author | C. McEnroe | 2020-02-11 18:08:05 -0500 |
---|---|---|
committer | C. McEnroe | 2020-02-11 18:08:05 -0500 |
commit | 4d532ec738259a146319183df8a244423563e755 (patch) | |
tree | fa58274aeb2c4da16f9578a9701956a4b24b3efb | |
parent | c9590bab061fcaa3e11a94eea8c34026a6c7a880 (diff) |
Take first two words in colorMentions
This lets phrases like "hi june" get colored, but still doesn't get carried away.
-rw-r--r-- | handle.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/handle.c b/handle.c index 95ef50d..40d3f28 100644 --- a/handle.c +++ b/handle.c @@ -529,7 +529,10 @@ static bool isMention(const struct Message *msg) { static const char *colorMentions(size_t id, struct Message *msg) { 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])]; for (char *ch = msg->params[1]; ch < split; ++ch) { if (iscntrl(*ch)) return ""; |