[Serusers] how can I look up the username in the location table?

Dana Olson rickaster at gmail.com
Thu Mar 10 21:04:18 CET 2005


I want to look up the username in the location table during the
method==register if block.

The reason I wish to do this is to see if there is another location
currently registered in the database for this particular username. How
can I do this? Do I have to use exec_msg() or exec_dset(), or does
lookup() work?

I've tried lookup("location") but it failed to work, it seems.

Can anyone help me out? Here is the block of code that I'm trying to use:

        if (method=="REGISTER") {
                if (!search("^Expires: 0")) {
                        if (lookup("location")) {
                                sl_send_reply("200","Another registration.");
                        } else {
                                sl_send_reply("200", "First registration.");
                        }
                } else {
                        sl_send_reply("200", "Unregistration.");
                }
                save_noreply("location");
                break;
        }

Note that it is sending the proper replies for "First registrations"
and "Unregistrations," but not for "Another registrations."

Thanks in advance,

Dana




More information about the sr-users mailing list