Patch: gw/urltrans.c

"Nikos Balkanas" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <2ACD20B909E647D8B927672A351FD87B@drwho>
Hi,

Currently keyword-regex is configured to only do exact case matches. This is 
in contrast to keyword matching, which is case incensitive. Additionaly, 
input string input string is converted to lower case for matching. This will 
cause all keyword-regex patterns with capital letters to fail.

This patch corrects that by inittializing keyword-regex to case incensitive 
matching.
Reported by Mike Cariotoglou

BR,
Nikos
urltrans.diff (application/octet-stream, 1.2 KB)
Index: gw/urltrans.c
===================================================================
RCS file: /home/cvs/gateway/gw/urltrans.c,v
retrieving revision 1.111
diff -a -u -b -r1.111 urltrans.c
--- gw/urltrans.c	14 Jan 2009 11:11:46 -0000	1.111
+++ gw/urltrans.c	26 Aug 2010 04:55:41 -0000
@@ -993,7 +993,7 @@
 	    octstr_append_cstr(keyword_regex, ")[ ]*");
 	}
 
-        if (keyword_regex != NULL && (ot->keyword_regex = gw_regex_comp(keyword_regex, REG_EXTENDED)) == NULL) {
+        if (keyword_regex != NULL && (ot->keyword_regex = gw_regex_comp(keyword_regex, REG_EXTENDED | REG_ICASE)) == NULL) {
             error(0, "Could not compile pattern '%s'", octstr_get_cstr(keyword_regex));
             octstr_destroy(keyword_regex);
             goto error;
@@ -1353,11 +1353,12 @@
         if (gw_regex_match_pre(t->keyword_regex, msg) == 1) {
             debug("", 0, "match found: %s", octstr_get_cstr(t->name));
             gwlist_append(list, t);
-        } else {
-            debug("", 0, "no match found: %s", octstr_get_cstr(t->name));
         }
     }
     
+    if (!gwlist_len(list))
+       debug("", 0, "no match found: \"%s\"", octstr_get_cstr(msg));
+    
     return list;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.