@ -482,6 +482,13 @@ static struct ast_calendar *build_calendar(struct ast_config *cfg, const char *c
}
}
}
}
if ( cal - > autoreminder & & ast_strlen_zero ( cal - > notify_channel ) ) {
ast_log ( LOG_WARNING ,
" You have set 'autoreminder' but not 'channel' for calendar '%s.' "
" Notifications will not occur. \n " ,
cal - > name ) ;
}
if ( new_calendar ) {
if ( new_calendar ) {
cal - > thread = AST_PTHREADT_NULL ;
cal - > thread = AST_PTHREADT_NULL ;
ast_cond_init ( & cal - > unload , NULL ) ;
ast_cond_init ( & cal - > unload , NULL ) ;
@ -489,7 +496,7 @@ static struct ast_calendar *build_calendar(struct ast_config *cfg, const char *c
if ( ast_pthread_create ( & cal - > thread , NULL , cal - > tech - > load_calendar , cal ) ) {
if ( ast_pthread_create ( & cal - > thread , NULL , cal - > tech - > load_calendar , cal ) ) {
/* If we start failing to create threads, go ahead and return NULL
/* If we start failing to create threads, go ahead and return NULL
* and the tech module will be unregistered
* and the tech module will be unregistered
*/
*/
ao2_unlink ( calendars , cal ) ;
ao2_unlink ( calendars , cal ) ;
cal = unref_calendar ( cal ) ;
cal = unref_calendar ( cal ) ;
}
}
@ -948,7 +955,7 @@ static int schedule_calendar_event(struct ast_calendar *cal, struct ast_calendar
event = cmp_event ? cmp_event : old_event ;
event = cmp_event ? cmp_event : old_event ;
ao2_lock ( event ) ;
ao2_lock ( event ) ;
if ( ! cmp_event | | old_event - > alarm ! = event - > alarm ) {
if ( ! ast_strlen_zero ( cal - > notify_channel ) & & ( ! cmp_event | | old_event - > alarm ! = event - > alarm ) ) {
changed = 1 ;
changed = 1 ;
if ( cal - > autoreminder ) {
if ( cal - > autoreminder ) {
alarm_notify_sched = ( event - > start - ( 60 * cal - > autoreminder ) - now . tv_sec ) * 1000 ;
alarm_notify_sched = ( event - > start - ( 60 * cal - > autoreminder ) - now . tv_sec ) * 1000 ;
@ -957,7 +964,7 @@ static int schedule_calendar_event(struct ast_calendar *cal, struct ast_calendar
}
}
/* For now, send the notification if we missed it, but the meeting hasn't happened yet */
/* For now, send the notification if we missed it, but the meeting hasn't happened yet */
if ( event - > start > = now . tv_sec ) {
if ( event - > start > = now . tv_sec ) {
if ( alarm_notify_sched < = 0 ) {
if ( alarm_notify_sched < = 0 ) {
alarm_notify_sched = 1 ;
alarm_notify_sched = 1 ;
}
}
@ -1590,7 +1597,7 @@ static char *epoch_to_string(char *buf, size_t buflen, time_t epoch)
static char * handle_show_calendar ( struct ast_cli_entry * e , int cmd , struct ast_cli_args * a )
static char * handle_show_calendar ( struct ast_cli_entry * e , int cmd , struct ast_cli_args * a )
{
{
# define FORMAT "%-17.17 s : %-20.20s\n"
# define FORMAT "%-18.18 s : %-20.20s\n"
# define FORMAT2 "%-12.12s: %-40.60s\n"
# define FORMAT2 "%-12.12s: %-40.60s\n"
struct ao2_iterator i ;
struct ao2_iterator i ;
struct ast_calendar * cal ;
struct ast_calendar * cal ;
@ -1639,7 +1646,13 @@ static char *handle_show_calendar(struct ast_cli_entry *e, int cmd, struct ast_c
ast_cli ( a - > fd , FORMAT , " Notify appdata " , cal - > notify_appdata ) ;
ast_cli ( a - > fd , FORMAT , " Notify appdata " , cal - > notify_appdata ) ;
ast_cli ( a - > fd , " %-17.17s : %d \n " , " Refresh time " , cal - > refresh ) ;
ast_cli ( a - > fd , " %-17.17s : %d \n " , " Refresh time " , cal - > refresh ) ;
ast_cli ( a - > fd , " %-17.17s : %d \n " , " Timeframe " , cal - > timeframe ) ;
ast_cli ( a - > fd , " %-17.17s : %d \n " , " Timeframe " , cal - > timeframe ) ;
ast_cli ( a - > fd , " %-17.17s : %d \n " , " Autoreminder " , cal - > autoreminder ) ;
if ( cal - > autoreminder ) {
ast_cli ( a - > fd , " %-17.17s : %d minutes before event \n " , " Autoreminder " , cal - > autoreminder ) ;
} else {
ast_cli ( a - > fd , " %-17.17s : None \n " , " Autoreminder " ) ;
}
ast_cli ( a - > fd , " %s \n " , " Events " ) ;
ast_cli ( a - > fd , " %s \n " , " Events " ) ;
ast_cli ( a - > fd , " %s \n " , " ------ " ) ;
ast_cli ( a - > fd , " %s \n " , " ------ " ) ;