[Asterisk-cvs] asterisk/apps app_voicemail.c,1.78,1.79
jeremy at lists.digium.com
jeremy at lists.digium.com
Thu Apr 29 09:28:10 CDT 2004
Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv16290/apps
Modified Files:
app_voicemail.c
Log Message:
populate global options correctly. Bug#1515
Index: app_voicemail.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_voicemail.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -d -r1.78 -r1.79
--- app_voicemail.c 29 Apr 2004 02:30:14 -0000 1.78
+++ app_voicemail.c 29 Apr 2004 13:34:54 -0000 1.79
@@ -242,12 +242,9 @@
LOCAL_USER_DECL;
-static void apply_options(struct ast_vm_user *vmu, char *options)
+static void populate_defaults(struct ast_vm_user *vmu)
{
- /* Destructively Parse options and apply */
- char *stringp = ast_strdupa(options);
- char *s;
- char *var, *value;
+ vmu->attach = -1;
if (reviewvm)
vmu->review = 1;
if (calloper)
@@ -258,6 +255,15 @@
strncpy(vmu->callback, callcontext, sizeof(vmu->callback) -1);
if (dialcontext)
strncpy(vmu->dialout, dialcontext, sizeof(vmu->dialout) -1);
+}
+
+static void apply_options(struct ast_vm_user *vmu, char *options)
+{
+ /* Destructively Parse options and apply */
+ char *stringp = ast_strdupa(options);
+ char *s;
+ char *var, *value;
+
while((s = strsep(&stringp, "|"))) {
value = s;
if ((var = strsep(&value, "=")) && value) {
@@ -344,16 +350,8 @@
/* fprintf(stderr,"postgres find_user:\n"); */
if (retval) {
- *retval->mailbox='\0';
- *retval->context='\0';
- strcpy(retval->password, "NULL");
- *retval->fullname='\0';
- *retval->email='\0';
- *retval->pager='\0';
- *retval->serveremail='\0';
- retval->attach=-1;
+ memset(retval, 0, sizeof(struct ast_vm_user));
retval->alloced=1;
- retval->next=NULL;
if (mailbox) {
strcpy(retval->mailbox, mailbox);
}
@@ -364,6 +362,7 @@
{
strcpy(retval->context, "default");
}
+ populate_defaults(retval);
sprintf(query, "SELECT password,fullname,email,pager,options FROM voicemail WHERE context='%s' AND mailbox='%s'", retval->context, mailbox);
/* fprintf(stderr,"postgres find_user: query = %s\n",query); */
@@ -3338,7 +3337,7 @@
memset(vmu, 0, sizeof(struct ast_vm_user));
strncpy(vmu->context, context, sizeof(vmu->context) - 1);
strncpy(vmu->mailbox, mbox, sizeof(vmu->mailbox) - 1);
- vmu->attach = -1;
+ populate_defaults(vmu);
stringp = tmp;
if ((s = strsep(&stringp, ",")))
strncpy(vmu->password, s, sizeof(vmu->password) - 1);
More information about the svn-commits
mailing list