about summary refs log tree commit diff stats
path: root/src/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common.c')
-rw-r--r--src/common.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/common.c b/src/common.c
index 050fc2b7..c056d167 100644
--- a/src/common.c
+++ b/src/common.c
@@ -510,3 +510,18 @@ get_random_string(int length)
 
     return rand;
 }
+
+GSList*
+get_mentions(gboolean whole_word, gboolean case_sensitive, const char *const message, const char *const nick)
+{
+    GSList *mentions = NULL;
+    char *message_search = case_sensitive ? strdup(message) : g_utf8_strdown(message, -1);
+    char *mynick_search = case_sensitive ? strdup(nick) : g_utf8_strdown(nick, -1);
+
+    mentions = prof_occurrences(mynick_search, message_search, 0, whole_word, &mentions);
+
+    g_free(message_search);
+    g_free(mynick_search);
+
+    return mentions;
+}