@ -637,6 +637,7 @@ static void populate_defaults(struct ast_vm_user *vmu)
static void apply_option ( struct ast_vm_user * vmu , const char * var , const char * value )
static void apply_option ( struct ast_vm_user * vmu , const char * var , const char * value )
{
{
ast_log ( LOG_DEBUG , " I'm applying option %s with value %s \n " , var , value ) ;
int x ;
int x ;
if ( ! strcasecmp ( var , " attach " ) ) {
if ( ! strcasecmp ( var , " attach " ) ) {
ast_set2_flag ( vmu , ast_true ( value ) , VM_ATTACH ) ;
ast_set2_flag ( vmu , ast_true ( value ) , VM_ATTACH ) ;
@ -651,6 +652,7 @@ static void apply_option(struct ast_vm_user *vmu, const char *var, const char *v
# ifdef IMAP_STORAGE
# ifdef IMAP_STORAGE
} else if ( ! strcasecmp ( var , " imapuser " ) ) {
} else if ( ! strcasecmp ( var , " imapuser " ) ) {
ast_copy_string ( vmu - > imapuser , value , sizeof ( vmu - > imapuser ) ) ;
ast_copy_string ( vmu - > imapuser , value , sizeof ( vmu - > imapuser ) ) ;
ast_log ( LOG_DEBUG , " vmu->imapuser = %s \n " , vmu - > imapuser ) ;
} else if ( ! strcasecmp ( var , " imappassword " ) ) {
} else if ( ! strcasecmp ( var , " imappassword " ) ) {
ast_copy_string ( vmu - > imappassword , value , sizeof ( vmu - > imappassword ) ) ;
ast_copy_string ( vmu - > imappassword , value , sizeof ( vmu - > imappassword ) ) ;
# endif
# endif
@ -743,6 +745,7 @@ static void apply_options_full(struct ast_vm_user *retval, struct ast_variable *
{
{
struct ast_variable * tmp ;
struct ast_variable * tmp ;
tmp = var ;
tmp = var ;
ast_log ( LOG_DEBUG , " I'm applying the value %s somewhere... \n " , tmp - > name ) ;
while ( tmp ) {
while ( tmp ) {
if ( ! strcasecmp ( tmp - > name , " vmsecret " ) ) {
if ( ! strcasecmp ( tmp - > name , " vmsecret " ) ) {
ast_copy_string ( retval - > password , tmp - > value , sizeof ( retval - > password ) ) ;
ast_copy_string ( retval - > password , tmp - > value , sizeof ( retval - > password ) ) ;
@ -761,6 +764,7 @@ static void apply_options_full(struct ast_vm_user *retval, struct ast_variable *
ast_copy_string ( retval - > context , tmp - > value , sizeof ( retval - > context ) ) ;
ast_copy_string ( retval - > context , tmp - > value , sizeof ( retval - > context ) ) ;
# ifdef IMAP_STORAGE
# ifdef IMAP_STORAGE
} else if ( ! strcasecmp ( tmp - > name , " imapuser " ) ) {
} else if ( ! strcasecmp ( tmp - > name , " imapuser " ) ) {
ast_log ( LOG_DEBUG , " I'm setting the imapuser field to %s \n " , tmp - > name ) ;
ast_copy_string ( retval - > imapuser , tmp - > value , sizeof ( retval - > imapuser ) ) ;
ast_copy_string ( retval - > imapuser , tmp - > value , sizeof ( retval - > imapuser ) ) ;
} else if ( ! strcasecmp ( tmp - > name , " imappassword " ) ) {
} else if ( ! strcasecmp ( tmp - > name , " imappassword " ) ) {
ast_copy_string ( retval - > imappassword , tmp - > value , sizeof ( retval - > imappassword ) ) ;
ast_copy_string ( retval - > imappassword , tmp - > value , sizeof ( retval - > imappassword ) ) ;
@ -2115,16 +2119,6 @@ static void make_email_file(FILE *p, char *srcemail, struct ast_vm_user *vmu, in
fprintf ( p , " Content-Disposition: attachment; filename= \" msg%04d.%s \" " ENDL ENDL , msgnum + 1 , format ) ;
fprintf ( p , " Content-Disposition: attachment; filename= \" msg%04d.%s \" " ENDL ENDL , msgnum + 1 , format ) ;
snprintf ( fname , sizeof ( fname ) , " %s.%s " , attach , format ) ;
snprintf ( fname , sizeof ( fname ) , " %s.%s " , attach , format ) ;
base_encode ( fname , p ) ;
base_encode ( fname , p ) ;
/* only attach if necessary */
if ( imap & & ! strcmp ( format , " gsm " ) ) {
fprintf ( p , " --%s " ENDL , bound ) ;
fprintf ( p , " Content-Type: audio/x-gsm; name= \" msg%04d.%s \" " ENDL , msgnum + 1 , format ) ;
fprintf ( p , " Content-Transfer-Encoding: base64 " ENDL ) ;
fprintf ( p , " Content-Description: Voicemail sound attachment. " ENDL ) ;
fprintf ( p , " Content-Disposition: attachment; filename= \" msg%04d.gsm \" " ENDL ENDL , msgnum + 1 ) ;
snprintf ( fname , sizeof ( fname ) , " %s.gsm " , attach ) ;
base_encode ( fname , p ) ;
}
fprintf ( p , ENDL ENDL " --%s-- " ENDL " . " ENDL , bound ) ;
fprintf ( p , ENDL ENDL " --%s-- " ENDL " . " ENDL , bound ) ;
if ( tmpfd > - 1 )
if ( tmpfd > - 1 )
close ( tmpfd ) ;
close ( tmpfd ) ;
@ -3152,7 +3146,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
newmsgs = vms - > newmessages + + ;
newmsgs = vms - > newmessages + + ;
oldmsgs = vms - > oldmessages ;
oldmsgs = vms - > oldmessages ;
} else {
} else {
res = inboxcount ( ext , & newmsgs , & oldmsgs ) ;
res = inboxcount ( ext _context , & newmsgs , & oldmsgs ) ;
if ( res < 0 ) {
if ( res < 0 ) {
ast_log ( LOG_NOTICE , " Can not leave voicemail, unable to count messages \n " ) ;
ast_log ( LOG_NOTICE , " Can not leave voicemail, unable to count messages \n " ) ;
return - 1 ;
return - 1 ;