diff options
-rw-r--r-- | src/gui/gui-chat.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/src/gui/gui-chat.c b/src/gui/gui-chat.c index 9d7e8bc84..1a0e7cf30 100644 --- a/src/gui/gui-chat.c +++ b/src/gui/gui-chat.c @@ -495,21 +495,38 @@ int gui_chat_line_search (struct t_gui_line *line, const char *text, int case_sensitive) { - char *message; + char *prefix, *message; int rc; if (!line || !line->message || !text || !text[0]) return 0; rc = 0; - message = (char *)gui_color_decode ((unsigned char *)line->message); - if (message) + + if (line->prefix) { - if ((case_sensitive && (strstr (message, text))) - || (!case_sensitive && (string_strcasestr (message, text)))) - rc = 1; - free (message); + prefix = (char *)gui_color_decode ((unsigned char *)line->prefix); + if (prefix) + { + if ((case_sensitive && (strstr (prefix, text))) + || (!case_sensitive && (string_strcasestr (prefix, text)))) + rc = 1; + free (prefix); + } } + + if (!rc) + { + message = (char *)gui_color_decode ((unsigned char *)line->message); + if (message) + { + if ((case_sensitive && (strstr (message, text))) + || (!case_sensitive && (string_strcasestr (message, text)))) + rc = 1; + free (message); + } + } + return rc; } |