summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2006-06-26 09:58:55 +0000
committerSebastien Helleu <flashcode@flashtux.org>2006-06-26 09:58:55 +0000
commitc5f1a1af6c8c33b874f9e44601e052a0a54e4628 (patch)
tree01641c1acd34855d979980d52a2402fb3ced63cf /src/common
parente5ba6dcb856d5b83c87ca0f5ea249de63f9110f4 (diff)
downloadweechat-c5f1a1af6c8c33b874f9e44601e052a0a54e4628.zip
Case ignored for channel names in charset options (bug #16858)
Diffstat (limited to 'src/common')
-rw-r--r--src/common/weechat.c25
-rw-r--r--src/common/weechat.h1
-rw-r--r--src/common/weeconfig.c4
3 files changed, 28 insertions, 2 deletions
diff --git a/src/common/weechat.c b/src/common/weechat.c
index 76d426aa0..7e99ae250 100644
--- a/src/common/weechat.c
+++ b/src/common/weechat.c
@@ -196,6 +196,31 @@ ascii_strncasecmp (char *string1, char *string2, int max)
}
/*
+ * ascii_strcasestr: locale and case independent string search
+ */
+
+char *
+ascii_strcasestr (char *string, char *search)
+{
+ int length_search;
+
+ length_search = strlen (search);
+
+ if (!string || !search || (length_search == 0))
+ return NULL;
+
+ while (string[0])
+ {
+ if (ascii_strncasecmp (string, search, length_search) == 0)
+ return string;
+
+ string++;
+ }
+
+ return NULL;
+}
+
+/*
* weechat_iconv: convert string to another charset
*/
diff --git a/src/common/weechat.h b/src/common/weechat.h
index 5c08702e4..c238008b8 100644
--- a/src/common/weechat.h
+++ b/src/common/weechat.h
@@ -108,6 +108,7 @@ extern void ascii_tolower (char *);
extern void ascii_toupper (char *);
extern int ascii_strcasecmp (char *, char *);
extern int ascii_strncasecmp (char *, char *, int);
+extern char *ascii_strcasestr (char *, char *);
extern char *weechat_iconv (char *, char *, char *);
extern char *weechat_strreplace (char *, char *, char *);
extern void weechat_dump (int);
diff --git a/src/common/weeconfig.c b/src/common/weeconfig.c
index 4a142e977..20d5604b2 100644
--- a/src/common/weeconfig.c
+++ b/src/common/weeconfig.c
@@ -1366,7 +1366,7 @@ config_option_list_remove (char **string, char *item)
name = (char *) malloc (strlen (item) + 2);
strcpy (name, item);
strcat (name, ":");
- pos = strstr (*string, name);
+ pos = ascii_strcasestr (*string, name);
free (name);
if (pos)
{
@@ -1442,7 +1442,7 @@ config_option_list_get_value (char **string, char *item,
name = (char *) malloc (strlen (item) + 2);
strcpy (name, item);
strcat (name, ":");
- pos = strstr (*string, name);
+ pos = ascii_strcasestr (*string, name);
free (name);
if (pos)
{