static int module_init(void) { list_init(&mwil); tmr_start(&tmr, 1, tmr_handler, 0); return uag_event_register(ua_event_handler, NULL); }
int mqtt_publish_init(struct mqtt *mqtt) { int err; err = uag_event_register(ua_event_handler, mqtt); if (err) return err; return err; }
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 int module_init(void) { uag_event_register( ua_event_handler, NULL ); if ( mkfifo( DTMF_OUT, S_IWUSR | S_IRUSR ) ) { error("Creation of the FIFO errored." " This might cause issues.\n"); } fd = fopen( DTMF_OUT , "w+" ); if ( fd == 0 ){ error("Opening of the FIFO errored." " This might cause issues.\n"); } return 0; }
int publisher_init(void) { struct le *le; int err = 0; uag_event_register(pub_ua_event_handler, NULL); for (le = list_head(uag_list()); le; le = le->next) { struct ua *ua = le->data; struct account *acc = ua_account(ua); if (account_pubint(acc) == 0) continue; err |= publisher_alloc(ua); } if (err) return err; return 0; }
static void *gtk_thread(void *arg) { struct gtk_mod *mod = arg; GtkMenuShell *app_menu; GtkWidget *item; GError *err = NULL; struct le *le; gdk_threads_init(); gtk_init(0, NULL); g_set_application_name("baresip"); mod->app = g_application_new ("com.creytiv.baresip", G_APPLICATION_FLAGS_NONE); g_application_register (G_APPLICATION (mod->app), NULL, &err); if (err != NULL) { warning ("Unable to register GApplication: %s", err->message); g_error_free (err); err = NULL; } #ifdef USE_LIBNOTIFY notify_init("baresip"); #endif mod->status_icon = gtk_status_icon_new_from_icon_name("call-start"); gtk_status_icon_set_tooltip_text (mod->status_icon, "baresip"); g_signal_connect(G_OBJECT(mod->status_icon), "button_press_event", G_CALLBACK(status_icon_on_button_press), mod); gtk_status_icon_set_visible(mod->status_icon, TRUE); mod->contacts_inited = false; mod->dial_dialog = NULL; mod->call_windows = NULL; mod->incoming_call_menus = NULL; /* App menu */ mod->app_menu = gtk_menu_new(); app_menu = GTK_MENU_SHELL(mod->app_menu); /* Account submenu */ mod->accounts_menu = gtk_menu_new(); mod->accounts_menu_group = NULL; item = gtk_menu_item_new_with_mnemonic("_Account"); gtk_menu_shell_append(app_menu, item); gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), mod->accounts_menu); /* Add accounts to submenu */ for (le = list_head(uag_list()); le; le = le->next) { struct ua *ua = le->data; accounts_menu_add_item(mod, ua); } /* Status submenu */ mod->status_menu = gtk_menu_new(); item = gtk_menu_item_new_with_mnemonic("_Status"); gtk_menu_shell_append(GTK_MENU_SHELL(app_menu), item); gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), mod->status_menu); /* Open */ item = gtk_radio_menu_item_new_with_label(NULL, "Open"); g_object_set_data(G_OBJECT(item), "presence", GINT_TO_POINTER(PRESENCE_OPEN)); g_signal_connect(item, "activate", G_CALLBACK(menu_on_presence_set), mod); gtk_menu_shell_append(GTK_MENU_SHELL(mod->status_menu), item); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); /* Closed */ item = gtk_radio_menu_item_new_with_label_from_widget( GTK_RADIO_MENU_ITEM(item), "Closed"); g_object_set_data(G_OBJECT(item), "presence", GINT_TO_POINTER(PRESENCE_CLOSED)); g_signal_connect(item, "activate", G_CALLBACK(menu_on_presence_set), mod); gtk_menu_shell_append(GTK_MENU_SHELL(mod->status_menu), item); gtk_menu_shell_append(app_menu, gtk_separator_menu_item_new()); /* Dial */ item = gtk_menu_item_new_with_mnemonic("_Dial..."); gtk_menu_shell_append(app_menu, item); g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(menu_on_dial), mod); /* Dial contact */ mod->contacts_menu = gtk_menu_new(); item = gtk_menu_item_new_with_mnemonic("Dial _contact"); gtk_menu_shell_append(app_menu, item); gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), mod->contacts_menu); gtk_menu_shell_append(app_menu, gtk_separator_menu_item_new()); /* About */ item = gtk_menu_item_new_with_mnemonic("A_bout"); g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(menu_on_about), mod); gtk_menu_shell_append(app_menu, item); gtk_menu_shell_append(app_menu, gtk_separator_menu_item_new()); /* Quit */ item = gtk_menu_item_new_with_mnemonic("_Quit"); g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(menu_on_quit), mod); gtk_menu_shell_append(app_menu, item); g_action_map_add_action_entries(G_ACTION_MAP(mod->app), app_entries, G_N_ELEMENTS(app_entries), mod); info("gtk_menu starting\n"); uag_event_register( ua_event_handler, mod ); mod->run = true; gtk_main(); mod->run = false; uag_event_unregister(ua_event_handler); if (mod->dial_dialog) { mem_deref(mod->dial_dialog); mod->dial_dialog = NULL; } return NULL; }