]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix voicemail e-mail time
authorAnthony Minessale <anthony.minessale@gmail.com>
Fri, 10 Oct 2008 20:30:05 +0000 (20:30 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Fri, 10 Oct 2008 20:30:05 +0000 (20:30 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9945 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/applications/mod_voicemail/mod_voicemail.c
src/switch_time.c

index ee421dd4f6b22ad94dcae7f3e0a78d9dc1ab36ac..58498bb6e57049edcc5fdcf08ed0d427081d2e85 100644 (file)
@@ -2222,8 +2222,10 @@ static switch_status_t deliver_vm(vm_profile_t *profile,
                message_count(profile, myid, domain_name, myfolder, &total_new_messages, &total_saved_messages,
                                          &total_new_urgent_messages, &total_saved_urgent_messages);
 
-               switch_time_exp_lt(&tm, switch_timestamp_now());
-               switch_strftime(date, &retsize, sizeof(date), profile->date_fmt, &tm);
+               if (switch_strlen_zero(vm_timezone) || (switch_strftime_tz(vm_timezone, profile->date_fmt, date, sizeof(date)) != SWITCH_STATUS_SUCCESS)) {
+                       switch_time_exp_lt(&tm, switch_timestamp_now());
+                       switch_strftime(date, &retsize, sizeof(date), profile->date_fmt, &tm);
+               }
 
                switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_current_folder", myfolder);
                switch_snprintf(tmpvar, sizeof(tmpvar), "%d", total_new_messages);
@@ -2240,15 +2242,7 @@ static switch_status_t deliver_vm(vm_profile_t *profile,
                switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_caller_id_name", caller_id_name);
                switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_file_path", file_path);
                switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_read_flags", read_flags);
-               
-               if (!switch_strlen_zero(vm_timezone)) {
-                       char tz_date[80] = "";
-                       if ((switch_strftime_tz(vm_timezone, profile->date_fmt, tz_date, sizeof(tz_date)) == SWITCH_STATUS_SUCCESS) && !switch_strlen_zero_buf(tz_date)) {
-                               switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_time", tz_date);
-                       } else {
-                               switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_time", date);
-                       }
-               }
+               switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_time", date);
 
                switch_snprintf(tmpvar, sizeof(tmpvar), "%d", priority);
                switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_priority", tmpvar);
index d7d44d415f295fac54b61d7ee042d62d1c699662..a2bf2379a1751b981198d4316906219f90832c9f 100644 (file)
@@ -572,10 +572,11 @@ SWITCH_DECLARE(switch_status_t) switch_strftime_tz(const char *tz, const char *f
                tztime( &timep, tzdef, &tm );
                tm2switchtime( &tm, &stm );
                switch_strftime(date, &retsize, len, switch_strlen_zero(format) ? "%Y-%m-%d %T" : format, &stm);
-               return SWITCH_STATUS_SUCCESS;
-       } else {
-               return SWITCH_STATUS_FALSE;
+               if (!switch_strlen_zero_buf(date)) {
+                       return SWITCH_STATUS_SUCCESS;
+               }
        }
+       return SWITCH_STATUS_FALSE;
 }
 
 SWITCH_MODULE_LOAD_FUNCTION(softtimer_load)