Here is a new version in my devel cvs tree, a bit more verbose in debug
-logs for aliases and services names
-logs when executing get_matching_translations() and return an empty list
Vincent.
----- Original Message -----
From: "Stipe Tolj" <[EMAIL PROTECTED]>
Cc: <[email protected]>
Sent: Saturday, October 07, 2006 4:24 PM
Subject: Re: [PATCH] Fix aliases in smsbox
Vincent CHAVANIS wrote:
It fixes aliases in smsbox.
I don't understand why list should be destroy after executing the
function find_translation()
It fixes the segfault when smsbox is exiting. (seem happens in free
variables process)
Thanks uhuru for reporting this and provide a patch.
Please comment/vote
anyone reviewed this one from Vincent?
Stipe
-------------------------------------------------------------------
Kölner Landstrasse 419
40589 Düsseldorf, NRW, Germany
tolj.org system architecture Kannel Software Foundation (KSF)
http://www.tolj.org/ http://www.kannel.org/
mailto:st_{at}_tolj.org mailto:stolj_{at}_kannel.org
-------------------------------------------------------------------
diff -rauw /gateway-cvs/gw/urltrans.c /gateway/gw/urltrans.c
--- /gateway-cvs/gw/urltrans.c 2006-10-02 16:06:39.000000000 +0200
+++ /gateway/gw/urltrans.c 2006-10-05 15:45:00.000000000 +0200
@@ -1415,14 +1415,26 @@
octstr_convert_range(keyword, 0, octstr_len(keyword), tolower);
list = get_matching_translations(trans, keyword);
+
+ /*
+ if list is empty we will check into trans->dict (Dict of lowercase
Octstr keywords)
+ */
+ if (gwlist_len(list) == 0) {
+ debug("sms", 0, "list is empty, maybe aliases ?!");
+ list = dict_get(trans->dict, keyword);
+ }
+
/* List now contains all translations where the keyword of the sms
* matches the pattern defined by the tranlsation's keyword. */
for (i = 0; i < gwlist_len(list); ++i) {
t = gwlist_get(list, i);
if (check_allowed_translation(t, smsc, sender, receiver, reject,
account) == 0
- && check_num_args(t, words) == 0)
+ && check_num_args(t, words) == 0) {
+ debug("sms", 0, "Executing service <%s> using <%s>",
+ octstr_get_cstr(t->keyword), octstr_get_cstr(keyword));
break;
+ }
t = NULL;
}
@@ -1432,7 +1444,6 @@
*reject = 0;
octstr_destroy(keyword);
- gwlist_destroy(list, NULL);
return t;
}