From 9471b87d27bda1ec762c712f68489e88244b8fae Mon Sep 17 00:00:00 2001 From: Tilghman Lesher Date: Thu, 5 Jun 2008 19:07:27 +0000 Subject: Merge the adaptive realtime branch, which will make adding new required fields to realtime less painful in the future. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@120789 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_meetme.c | 5 +++++ apps/app_queue.c | 3 +++ apps/app_voicemail.c | 10 ++++++++++ 3 files changed, 18 insertions(+) (limited to 'apps') diff --git a/apps/app_meetme.c b/apps/app_meetme.c index 08e2fb56e..14ba77b5e 100644 --- a/apps/app_meetme.c +++ b/apps/app_meetme.c @@ -1743,6 +1743,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c if (rt_log_members) { /* Update table */ snprintf(members, sizeof(members), "%d", conf->users); + ast_realtime_require_field("meetme", "confno", RQ_INTEGER, strlen(conf->confno), "members", RQ_INTEGER, strlen(members), NULL); ast_update_realtime("meetme", "confno", conf->confno, "members", members, NULL); } setusercount = 1; @@ -2682,6 +2683,7 @@ bailoutandtrynormal: if (rt_log_members) { /* Update table */ snprintf(members, sizeof(members), "%d", conf->users); + ast_realtime_require_field("meetme", "confno", RQ_INTEGER, strlen(conf->confno), "members", RQ_INTEGER, strlen(members), NULL); ast_update_realtime("meetme", "confno", conf->confno, "members", members, NULL); } if (confflags & CONFFLAG_MARKEDUSER) @@ -5677,6 +5679,7 @@ static int unload_module(void) sla_destroy(); res |= ast_custom_function_unregister(&meetme_info_acf); + ast_unload_realtime("meetme"); return res; } @@ -5707,12 +5710,14 @@ static int load_module(void) res |= ast_devstate_prov_add("SLA", sla_state); res |= ast_custom_function_register(&meetme_info_acf); + ast_realtime_require_field("meetme", "confno", RQ_INTEGER, 3, "members", RQ_INTEGER, 3, NULL); return res; } static int reload(void) { + ast_unload_realtime("meetme"); return load_config(1); } diff --git a/apps/app_queue.c b/apps/app_queue.c index 0efbbca8a..2a7f1e612 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -6284,6 +6284,7 @@ static int unload_module(void) } ao2_ref(queues, -1); devicestate_tps = ast_taskprocessor_unreference(devicestate_tps); + ast_unload_realtime("queue_members"); return res; } @@ -6335,12 +6336,14 @@ static int load_module(void) if (!(device_state_sub = ast_event_subscribe(AST_EVENT_DEVICE_STATE, device_state_cb, NULL, AST_EVENT_IE_END))) res = -1; + ast_realtime_require_field("queue_members", "paused", RQ_INTEGER, 1, "uniqueid", RQ_INTEGER, 5, NULL); return res ? AST_MODULE_LOAD_DECLINE : 0; } static int reload(void) { + ast_unload_realtime("queue_members"); reload_queues(1); return 0; } diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 9f0f21180..3ff833ea6 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -928,6 +928,9 @@ static int change_password_realtime(struct ast_vm_user *vmu, const char *passwor { int res; if (!ast_strlen_zero(vmu->uniqueid)) { + if (strlen(password) > 10) { + ast_realtime_require_field("voicemail", "password", RQ_CHAR, strlen(password), NULL); + } res = ast_update_realtime("voicemail", "uniqueid", vmu->uniqueid, "password", password, NULL); if (res > 0) { ast_copy_string(vmu->password, password, sizeof(vmu->password)); @@ -9367,6 +9370,9 @@ static int load_config(int reload) int tmpadsi[4]; struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 }; + ast_unload_realtime("voicemail"); + ast_unload_realtime("voicemail_data"); + if ((cfg = ast_config_load(VOICEMAIL_CONFIG, config_flags)) == CONFIG_STATUS_FILEUNCHANGED) { if ((ucfg = ast_config_load("users.conf", config_flags)) == CONFIG_STATUS_FILEUNCHANGED) return 0; @@ -10050,6 +10056,8 @@ static int unload_module(void) stop_poll_thread(); mwi_subscription_tps = ast_taskprocessor_unreference(mwi_subscription_tps); + ast_unload_realtime("voicemail"); + ast_unload_realtime("voicemail_data"); return res; } @@ -10081,6 +10089,8 @@ static int load_module(void) ast_cli_register_multiple(cli_voicemail, sizeof(cli_voicemail) / sizeof(struct ast_cli_entry)); ast_install_vm_functions(has_voicemail, inboxcount, messagecount, sayname); + ast_realtime_require_field("voicemail", "uniqueid", RQ_INTEGER, 11, "password", RQ_CHAR, 10, NULL); + ast_realtime_require_field("voicemail_data", "filename", RQ_CHAR, 30, "duration", RQ_INTEGER, 5, NULL); return res; } -- cgit v1.2.3