/* monitor "theme destroyed" signal */ static void theme_cleanup(THEME_REC *rec) { PyTheme *pytheme = signal_get_user_data(); if (pytheme->data == rec) { pytheme->data = NULL; pytheme->cleanup_installed = 0; signal_remove_data("theme destroyed", theme_cleanup, pytheme); } }
/* monitor "netsplit remove" signal */ static void netsplit_server_cleanup(NETSPLIT_SERVER_REC *netsplit) { PyNetsplitServer *pynetsplit = signal_get_user_data(); if (netsplit == pynetsplit->data) { pynetsplit->data = NULL; pynetsplit->cleanup_installed = 0; signal_remove_data("netsplit remove", netsplit_server_cleanup, pynetsplit); } }
/* monitor "ignore destroy" signal */ static void ignore_cleanup(IGNORE_REC *ignore) { PyIgnore *pyignore = signal_get_user_data(); if (ignore == pyignore->data) { pyignore->data = NULL; pyignore->cleanup_installed = 0; signal_remove_data("ignore destroy", ignore_cleanup, pyignore); } }
static void chatnet_cleanup(CHATNET_REC *cn) { PyChatnet *pycn = signal_get_user_data(); if (cn == pycn->data) { pycn->data = NULL; pycn->cleanup_installed = 0; signal_remove_data("chatnet destroyed", chatnet_cleanup, pycn); } }
/* monitor "ban remove" signal */ static void ban_cleanup(CHANNEL_REC *chan, BAN_REC *ban) { PyBan *pyban = signal_get_user_data(); if (ban == pyban->data) { pyban->data = NULL; pyban->cleanup_installed = 0; signal_remove_data("ban remove", ban_cleanup, pyban); } }
/* monitor "query destroyed" signal */ static void query_cleanup(QUERY_REC *query) { PyQuery *pyquery = signal_get_user_data(); if (query == pyquery->data) { pyquery->data = NULL; pyquery->cleanup_installed = 0; signal_remove_data("query destroyed", query_cleanup, pyquery); } }
static void nick_cleanup(CHANNEL_REC *chan, NICK_REC *nick) { PyNick *pynick = signal_get_user_data(); if (nick == pynick->data) { pynick->data = NULL; pynick->cleanup_installed = 0; signal_remove_data("nicklist remove", nick_cleanup, pynick); } }
static void sig_func(const void *p1, const void *p2, const void *p3, const void *p4, const void *p5, const void *p6) { PERL_SIGNAL_REC *rec; const void *args[6]; args[0] = p1; args[1] = p2; args[2] = p3; args[3] = p4; args[4] = p5; args[5] = p6; rec = signal_get_user_data(); perl_call_signal(rec->script, rec->func, signal_get_emitted_id(), args); }
/* SYNTAX: STATUSBAR ADDITEM|MODIFYITEM [-before | -after <item>] [-priority #] [-alignment left|right] <item> <statusbar> */ static void cmd_statusbar_additem_modifyitem(const char *data, void *server, void *witem) { CONFIG_NODE *node; GHashTable *optlist; char *item, *statusbar, *value; void *free_arg; int index; int additem = GPOINTER_TO_INT(signal_get_user_data()); if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_OPTIONS | PARAM_FLAG_STRIP_TRAILING_WS, "statusbar additem", &optlist, &item, &statusbar)) return; if (*statusbar == '\0') { cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); } node = sbar_find_item_with_defaults(statusbar, item, additem); if (node == NULL) { cmd_params_free(free_arg); return; } /* get the index */ index = -1; value = g_hash_table_lookup(optlist, "before"); if (value != NULL) index = config_node_index(node, value); value = g_hash_table_lookup(optlist, "after"); if (value != NULL) index = config_node_index(node, value) + 1; /* create/move item */ node = iconfig_node_section_index(node, item, index, NODE_TYPE_BLOCK); /* set the options */ value = g_hash_table_lookup(optlist, "priority"); if (value != NULL) iconfig_node_set_int(node, "priority", atoi(value)); value = g_hash_table_lookup(optlist, "alignment"); if (value != NULL) { iconfig_node_set_str(node, "alignment", g_ascii_strcasecmp(value, "right") == 0 ? "right" : NULL); } read_statusbar_config(); cmd_params_free(free_arg); }
static void server_cleanup(SERVER_REC *server) { PyServer *pyserver = signal_get_user_data(); if (server == pyserver->data) { if (pyserver->connect) ((PyConnect *)pyserver->connect)->data = NULL; if (pyserver->rawlog) ((PyRawlog *)pyserver->rawlog)->data = NULL; pyserver->data = NULL; pyserver->cleanup_installed = 0; signal_remove_data("server disconnected", server_cleanup, pyserver); } }
/* SYNTAX: STATUSBAR ADD|MODIFY [-disable | -nodisable] [-type window|root] [-placement top|bottom] [-position #] [-visible always|active|inactive] <statusbar> */ static void cmd_statusbar_add_modify(const char *data, void *server, void *witem) { GHashTable *optlist; CONFIG_NODE *node; char *name, *type, *placement, *visible; void *free_arg; int error; int add = GPOINTER_TO_INT(signal_get_user_data()); if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS | PARAM_FLAG_STRIP_TRAILING_WS, "statusbar add", &optlist, &name)) return; if (*name == '\0') { cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); } error = 0; type = NULL; data = g_hash_table_lookup(optlist, "type"); if (data != NULL) { if (g_ascii_strcasecmp(data, "window") == 0) type = "window"; else if (g_ascii_strcasecmp(data, "root") == 0) type = "root"; else { printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_STATUSBAR_UNKNOWN_TYPE, data); error++; } } placement = NULL; data = g_hash_table_lookup(optlist, "placement"); if (data != NULL) { if (g_ascii_strcasecmp(data, "top") == 0) placement = "top"; else if (g_ascii_strcasecmp(data, "bottom") == 0) placement = "bottom"; else { printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_STATUSBAR_UNKNOWN_PLACEMENT, data); error++; } } visible = NULL; data = g_hash_table_lookup(optlist, "visible"); if (data != NULL) { if (g_ascii_strcasecmp(data, "always") == 0) visible = "always"; else if (g_ascii_strcasecmp(data, "active") == 0) visible = "active"; else if (g_ascii_strcasecmp(data, "inactive") == 0) visible = "inactive"; else { printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_STATUSBAR_UNKNOWN_VISIBILITY, data); error++; } } if (!error) { node = sbar_node(name, add); if (node == NULL && !add && sbar_node_isdefault(name)) { /* If this node is a default status bar, we need to create it in the config * to configure it */ node = sbar_node(name, TRUE); } if (node == NULL) { printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_STATUSBAR_NOT_FOUND, name); error++; } } if (error) { cmd_params_free(free_arg); return; } if (g_hash_table_lookup(optlist, "nodisable")) iconfig_node_set_str(node, "disabled", NULL); if (g_hash_table_lookup(optlist, "disable")) iconfig_node_set_bool(node, "disabled", TRUE); if (type != NULL) iconfig_node_set_str(node, "type", type); if (placement != NULL) iconfig_node_set_str(node, "placement", placement); data = g_hash_table_lookup(optlist, "position"); if (data != NULL) iconfig_node_set_int(node, "position", atoi(data)); if (visible != NULL) iconfig_node_set_str(node, "visible", visible); read_statusbar_config(); cmd_params_free(free_arg); }