--- a/mcabber/src/settings.c Fri Apr 27 23:46:15 2007 +0200
+++ b/mcabber/src/settings.c Sat Apr 28 12:16:45 2007 +0200
@@ -154,11 +154,13 @@
// We only allow assignments line, except for commands "pgp" and "source"
if ((strchr(line, '=') != NULL) ||
- startswith(line, "pgp ") || startswith(line, "source ")) {
+ startswith(line, "pgp ", FALSE) || startswith(line, "source ", FALSE)) {
// Only accept the set, alias, bind, pgp and source commands
- if (!startswith(line, "set ") && !startswith(line, "bind ") &&
- !startswith(line, "alias ") && !startswith(line, "pgp ") &&
- !startswith(line, "source ")) {
+ if (!startswith(line, "set ", FALSE) &&
+ !startswith(line, "bind ", FALSE) &&
+ !startswith(line, "alias ", FALSE) &&
+ !startswith(line, "pgp ", FALSE) &&
+ !startswith(line, "source ", FALSE)) {
scr_LogPrint(LPRINT_LOGNORM,
"Error in configuration file (l. %d): bad command", ln);
err++;
--- a/mcabber/src/utils.c Fri Apr 27 23:46:15 2007 +0200
+++ b/mcabber/src/utils.c Sat Apr 28 12:16:45 2007 +0200
@@ -648,11 +648,13 @@
}
#endif /* !HAVE_STRCASESTR */
-// startswith(str, word)
+// startswith(str, word, ignore_case)
// Returns TRUE if string str starts with word.
-int startswith(const char *str, const char *word)
+int startswith(const char *str, const char *word, guint ignore_case)
{
- if (!strncmp(str, word, strlen(word)))
+ if (ignore_case && !strncasecmp(str, word, strlen(word)))
+ return TRUE;
+ else if (!ignore_case && !strncmp(str, word, strlen(word)))
return TRUE;
return FALSE;
}
--- a/mcabber/src/utils.h Fri Apr 27 23:46:15 2007 +0200
+++ b/mcabber/src/utils.h Sat Apr 28 12:16:45 2007 +0200
@@ -43,7 +43,7 @@
char *strcasestr(const char *haystack, const char *needle);
#endif
-int startswith(const char *str, const char *word);
+int startswith(const char *str, const char *word, guint ignore_case);
#endif // __UTILS_H__