static void tmr_handler(void *arg) { struct le *le; (void)arg; for (le = list_head(uag_list()); le; le = le->next) { struct ua *ua = le->data; mwi_subscribe(ua); } }
static void tmr_handler(void *arg) { struct le *le; (void)arg; for (le = list_head(uag_list()); le; le = le->next) { struct ua *ua = le->data; struct account *acc = ua_account(ua); if (account_regint(acc) > 0) uag_event_register(ua_event_handler, ua); else mwi_subscribe(ua); } }
static void ua_event_handler(struct ua *ua, enum ua_event ev, struct call *call, const char *prm, void *arg ) { (void)call; (void)prm; if (ua != (struct ua *)arg) return; if (ev == UA_EVENT_REGISTER_OK) { uag_event_unregister(ua_event_handler); mwi_subscribe(ua); } }
static void ua_event_handler(struct ua *ua, enum ua_event ev, struct call *call, const char *prm, void *arg ) { (void)call; (void)prm; (void)arg; if (ev == UA_EVENT_REGISTER_OK) { if (!mwi_find(ua)) mwi_subscribe(ua); } else if (ev == UA_EVENT_SHUTDOWN) { struct le *le; info("mwi: shutdown\n"); le = list_head(&mwil); while (le) { struct mwi *mwi = le->data; le = le->next; mwi->shutdown = true; if (mwi->sub) { mwi->sub = mem_deref(mwi->sub); tmr_start(&mwi->tmr, 500, deref_handler, mwi); } else mem_deref(mwi); } } }