[xchat-gnome] utf8 safe search
- From: Ritesh Khadgaray <rkhadgaray src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [xchat-gnome] utf8 safe search
- Date: Thu, 12 Jun 2014 12:43:22 +0000 (UTC)
commit c6eb56c1190ef2bd9d265279c812dbeb71ffd3b4
Author: Ritesh Khadgaray <khadgaray gmail com>
Date: Thu Jun 12 18:11:13 2014 +0530
utf8 safe search
src/fe-gnome/channel-list-window.c | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/src/fe-gnome/channel-list-window.c b/src/fe-gnome/channel-list-window.c
index a7be33d..7de15fd 100644
--- a/src/fe-gnome/channel-list-window.c
+++ b/src/fe-gnome/channel-list-window.c
@@ -37,6 +37,20 @@ G_DEFINE_TYPE(ChannelListWindow, channel_list_window, G_TYPE_OBJECT)
static GSList *chanlists = NULL;
static gboolean
+search_matches (gchar *a, char *b)
+{
+ char *ta = g_utf8_casefold (a, -1),
+ *tb = g_utf8_casefold (b, -1);
+
+ gboolean ret = (g_strrstr (ta, tb) != NULL)? TRUE:FALSE;
+
+ g_free (ta);
+ g_free (tb);
+
+ return ret;
+}
+
+static gboolean
channel_list_window_filter (GtkTreeModel *model, GtkTreeIter *iter, ChannelListWindow *window)
{
char *name, *topic;
@@ -55,13 +69,14 @@ channel_list_window_filter (GtkTreeModel *model, GtkTreeIter *iter, ChannelListW
/* text filtering */
if (window->filter_topic && window->text_filter != NULL && strlen (window->text_filter) != 0) {
/* We have something to filter */
- if (strcasestr (topic, window->text_filter) == NULL) {
+ if ( search_matches (topic, window->text_filter) != TRUE) {
return FALSE;
}
+
}
if (window->filter_name && window->text_filter != NULL && strlen (window->text_filter) != 0) {
- if (strcasestr (name, window->text_filter) == NULL) {
+ if (search_matches (name, window->text_filter) != TRUE) {
return FALSE;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]