mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-23 15:06:22 +00:00
Put getting mentions in own function
So we can use it somewhere else too. Regards https://github.com/profanity-im/profanity/issues/1261
This commit is contained in:
15
src/common.c
15
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user