You could "use the source" Lourens ?

In gwlib/cfg.[ch] looks like config file is loaded into 
generic structures so 
e.g. adding to dlr-db group or mysql-db group:
   delete-dlrs = 0
or:
   delete-dlrs = 1
is already supported?   
I could be wrong as I just glanced at it but I don't think so.
I've a preference for 0/1 as opposed to false/true

Then you've only got to find out where dlrs are deleted ...
 gw/dlr.[ch] might be a good place to start? :)

look here in dlr.c in dlr_init:

    /* check which DLR storage type we are using */
    grp = cfg_get_single_group(cfg, octstr_imm("core"));
    dlr_type = cfg_get(grp, octstr_imm("dlr-storage"));

looks like it is instantiating structure for accessing values from 
 "core" group and getting value of "dlr-storage" parameter.

that dlr_type is a global veriable (declared in dlr.h) the grp
is local to dlr_init

poking around more:
grep "log-level" gw/*.c
/home/jamesc/src/topupclub/gateway-1.2.1/gw/bearerbox.c:        if 
(cfg_get_integer(&loglevel, grp, octstr_imm("log-level")) == -1)
/home/jamesc/src/topupclub/gateway-1.2.1/gw/smsbox.c:    cfg_get_integer(&lvl, grp, 
octstr_imm("log-level"));
this is how we can get integer values as opposed to string values



look again in dlr.c in dlr_find_sdb and dlr_find_mysql
one of the last things each does is this (more or less equivalent):

    if ((typ & DLR_BUFFERED) && ((dlr_mask & DLR_SUCCESS) || (dlr_mask & DLR_FAIL))) {
        debug("dlr.sdb", 0, "DLR not deleted because we wait on more reports");
    } else {
        debug("dlr.sdb", 0, "removing DLR from database");
        sql = octstr_format("DELETE FROM %s WHERE %s='%s' AND %s='%s' LIMIT 1",
                            octstr_get_cstr(table), octstr_get_cstr(field_smsc), 
                            smsc, octstr_get_cstr(field_ts), ts);
         
         * connect to db and execute delete *
    }


if we change this in both places to :

    if ((typ & DLR_BUFFERED) && ((dlr_mask & DLR_SUCCESS) || (dlr_mask & DLR_FAIL))) {
        debug("dlr.sdb", 0, "DLR not deleted because we wait on more reports");
+   } else if (delete_dlrs == 0) {
+       debug("dlr.sdb", 0, "DLR not deleted because delete_dlrs = 0 in .conf");
    } else {
        debug("dlr.sdb", 0, "removing DLR from database");
        sql = octstr_format("DELETE FROM %s WHERE %s='%s' AND %s='%s' LIMIT 1",
                            octstr_get_cstr(table), octstr_get_cstr(field_smsc), 
                            smsc, octstr_get_cstr(field_ts), ts);
         
         * connect to db and execute delete *
    }

AND add global var delete_dlrs to dlr.h
    Mutex *dlr_mutex;
    Octstr *dlr_type;
+   static long delete_dlrs;



AND get value of delete_dlrs in dlr_init
    /* check which DLR storage type we are using */
    grp = cfg_get_single_group(cfg, octstr_imm("core"));
    dlr_type = cfg_get(grp, octstr_imm("dlr-storage"));
+   /* delete dlrs 1 true, 0 false */
+   cfg_get_integer(&delete_dlrs, grp, octstr_imm("delete-dlrs"));
+   /* -1 (parameter not specified - default false) */
+   if (delete_dlrs == -1) delete_dlrs = 0;



Then ... those 9 lines could add the feature you need?
They compile okay and boxes run but I'm not going to test further - today anyway,

This is the shoddiest glance at the code and guess as to what
 works but I hope it gets the general idea across ?

James.

On Tue, May 18, 2004 at 06:39:32PM +0530, Sahil Aggarwal wrote:
> 
>    i never tried this
>    but wht if u revoke delete rights from the user kannel is using to
>    delete rows from the dlr table?
>    On Tue, 2004-05-18 at 18:24, Lourens Janse van Rensburg wrote:
>    
> I agree that it's a dirty hack, but it's been working
> in a production environment for several months now
> without any problems.
> 
> I think the most elegant solution would be to add an
> option to the .conf file to indicate that Kannel
> should in fact NOT delete the DLRs from its DLR table
> when the messages have been delivered (or not
> delivered).
> 
> Something like:
> group = dlr-db
> id = ...
> table = ...
> delete-dlrs = false
> 
> What is the procedure to bring this request to the
> developers' attention ?  I haven't posted to the
> developers list before.
> 
> Let's help to make Kannel even better.
> 
> Lourens...
> 
> 
>  
> -Regards
> 
> Sahil Aggarwal
> 
> ValueFirst Messaging Pvt. Ltd.
> 
> www.vfirst.com



-- 

http://web.tiscali.it/cedric/jacques_brel_show.html
http://www.thehelix.ie/2004_06_02_Jacques_Brel.html
June Wed/Thur 2/3, Jacques Brel - Ced & Stella

http://www.greenpeace.org/international_en/features/details?item_id=327510
Greenpeace tree-huggers indicted by U.S..
Brazilian mahogany barons curtailing free speech. Grrr,


The following statement is false.
The preceding statement is true.    - Douglas Hofstadter

I, James row worse maji.

http://www.bcoleman.com my brother Bill Coleman 
He's a bit good! Launching his debut CD right now.


software patents (coming soon to an EU near you) bad for users, for developers
 good for monopolistic innovation stifling big business 
http://swpat.ffii.org/
beware entering overwhelming twisty maze of political legalese

Reply via email to