char *dns_start(Function *global_funcs) { int idx; global = global_funcs; module_register(MODULE_NAME, dns_table, 1, 0); if (!module_depend(MODULE_NAME, "eggdrop", 106, 0)) { module_undepend(MODULE_NAME); return "This module requires Eggdrop 1.6.0 or later."; } idx = new_dcc(&DCC_DNS, 0); if (idx < 0) return "NO MORE DCC CONNECTIONS -- Can't create DNS socket."; if (!init_dns_core()) { lostdcc(idx); return "DNS initialisation failed."; } dcc[idx].sock = resfd; dcc[idx].timeval = now; strcpy(dcc[idx].nick, "(dns)"); add_hook(HOOK_SECONDLY, (Function) dns_check_expires); add_hook(HOOK_DNS_HOSTBYIP, (Function) dns_lookup); add_hook(HOOK_DNS_IPBYHOST, (Function) dns_forward); return NULL; }
char *notes_start(Function *global_funcs) { global = global_funcs; notefile[0] = 0; module_register(MODULE_NAME, notes_table, 2, 2); if (!module_depend(MODULE_NAME, "eggdrop", 108, 0)) { module_undepend(MODULE_NAME); return "This module requires Eggdrop 1.8.0 or later."; } add_hook(HOOK_HOURLY, (Function) notes_hourly); add_hook(HOOK_MATCH_NOTEREJ, (Function) match_note_ignore); add_tcl_ints(notes_ints); add_tcl_strings(notes_strings); add_tcl_commands(notes_tcls); add_builtins(H_dcc, notes_cmds); add_builtins(H_chon, notes_chon); add_builtins(H_away, notes_away); add_builtins(H_nkch, notes_nkch); add_builtins(H_load, notes_load); add_help_reference("notes.help"); add_lang_section("notes"); notes_server_setup(0); notes_irc_setup(0); my_memcpy(&USERENTRY_FWD, &USERENTRY_INFO, sizeof(void *) * 12); add_entry_type(&USERENTRY_FWD); return NULL; }
void check_no_return(int id) { if (!option_info) return; my_id = id; add_hook(&match_return, RETURN_HOOK); add_hook(&match_func_end, END_FUNC_HOOK); }
void check_get_user_overflow(int id) { if (option_project != PROJ_KERNEL) return; my_max_id = id; add_hook(&match_condition, CONDITION_HOOK); add_hook(&match_assign, ASSIGNMENT_HOOK); add_hook(&match_binop, BINOP_HOOK); }
void register_start_states(int id) { my_id = id; add_hook(&save_start_states, AFTER_DEF_HOOK); add_hook(&match_save_states, INLINE_FN_START); add_hook(&match_restore_states, INLINE_FN_END); add_hook(&match_end_func, END_FUNC_HOOK); }
bool quest_wolves_init_hook(int q_idx) { if ((cquest.status >= QUEST_STATUS_UNTAKEN) && (cquest.status < QUEST_STATUS_FINISHED)) { add_hook(HOOK_MONSTER_DEATH, quest_wolves_death_hook, "wolves_monster_death"); add_hook(HOOK_QUEST_FINISH, quest_wolves_finish_hook, "wolves_finish"); add_hook(HOOK_GEN_QUEST, quest_wolves_gen_hook, "wolves_geb"); } return (FALSE); }
void check_propagate(int id) { if (option_project != PROJ_KERNEL) return; my_id = id; add_hook(&match_unset, ASSIGNMENT_HOOK); add_hook(&match_call_assignment, CALL_ASSIGNMENT_HOOK); add_hook(&match_return, RETURN_HOOK); }
void check_missing_break(int id) { my_id = id; add_unmatched_state_hook(my_id, &unmatched_state); add_merge_hook(my_id, &merge_hook); add_hook(&match_assign, ASSIGNMENT_HOOK); add_hook(&match_symbol, SYM_HOOK); add_hook(&match_stmt, STMT_HOOK); }
void check_or_vs_and(int id) { my_id = id; unconstant_macros = create_function_hashtable(100); load_strings("unconstant_macros", unconstant_macros); add_hook(&match_logic, LOGIC_HOOK); add_hook(&match_condition, CONDITION_HOOK); if (option_spammy) add_hook(&match_binop, BINOP_HOOK); }
static void create() { ::create(); set_name("a bloodletting knife"); add_id("knife"); set_long("A surgeon knife drenched in blood."); set_class(11); set_value(866); set_damage_type("pierce"); set_weight(1); add_property("metal"); add_hook("__wield",store_fp("do_wield")); add_hook("__remove",store_fp("do_unwield")); }
void check_allocation_funcs(int id) { int i; if (!option_info || option_project != PROJ_KERNEL) return; my_id = id; add_hook(&match_return, RETURN_HOOK); add_hook(&match_end_func, AFTER_FUNC_HOOK); for (i = 0; allocation_funcs[i]; i++) { add_function_assign_hook(allocation_funcs[i], &match_allocation, NULL); } }
void failover_start(struct secchan *secchan, const struct settings *settings, struct switch_status *switch_status, struct rconn *remote_rconn) { struct failover_context *context = NULL; int i; static struct hook_class failover_hook_class = { NULL, /* local_packet_cb */ NULL, /* remote_packet_cb */ failover_periodic_cb, /* periodic_cb */ NULL, /* wait_cb */ NULL, /* closing_cb */ }; context = xmalloc(sizeof(*context)); context->settings = settings; context->secchan = secchan; context->remote_rconn = remote_rconn; context->index = 0; for (i = 0; i < MAX_CONTROLLERS; ++i) { context->peers[i] = NULL; if (settings->controller_names[i] == NULL) continue; context->peers[i] = xmalloc(sizeof(struct failover_peer)); context->peers[i]->epoch = time_now(); } switch_status_register_category(switch_status, "failover", failover_status_cb, context); add_hook(secchan, &failover_hook_class, context); }
static void mcview_hook (void *v) { mcview_t *view = (mcview_t *) v; WPanel *panel; /* If the user is busy typing, wait until he finishes to update the screen */ if (!is_idle ()) { if (!hook_present (idle_hook, mcview_hook)) add_hook (&idle_hook, mcview_hook, v); return; } delete_hook (&idle_hook, mcview_hook); if (get_current_type () == view_listing) panel = current_panel; else if (get_other_type () == view_listing) panel = other_panel; else return; mcview_done (view); mcview_init (view); mcview_load (view, 0, panel->dir.list[panel->selected].fname, 0, 0, 0); mcview_display (view); }
static void create() { ::create(); set_name("Cloak of the Lord"); set_short("an undescribable cloak"); set_long("It is forever changing, and it can not be described in words."); set_type("cloak"); set_ac(1); set_weight(1); set_value(1111); add_property("wear_msg", "You feel strangely random in this cloak.\n"); add_property("remove_msg", "You feel less random.\n"); add_hook("__wear", store_fp("on_wear")); add_hook("__remove", store_fp("on_remove")); }
void execute_hooks (hook_t * hook_list) { hook_t *new_hook = NULL; hook_t *p; /* We copy the hook list first so tahat we let the hook * function call delete_hook */ while (hook_list != NULL) { add_hook (&new_hook, hook_list->hook_fn, hook_list->hook_data); hook_list = hook_list->next; } p = new_hook; while (new_hook != NULL) { new_hook->hook_fn (new_hook->hook_data); new_hook = new_hook->next; } for (hook_list = p; hook_list != NULL;) { p = hook_list; hook_list = hook_list->next; g_free (p); } }
void execute_hooks (Hook *hook_list) { Hook *new_hook = 0; Hook *p; /* We copy the hook list first so tahat we let the hook * function call delete_hook */ while (hook_list){ add_hook (&new_hook, hook_list->hook_fn, hook_list->hook_data); hook_list = hook_list->next; } p = new_hook; while (new_hook){ (*new_hook->hook_fn)(new_hook->hook_data); new_hook = new_hook->next; } for (hook_list = p; hook_list;){ p = hook_list; hook_list = hook_list->next; g_free (p); } }
void check_return_negative_var(int id) { if (option_project != PROJ_KERNEL) return; my_id = id; add_hook(&match_return, RETURN_HOOK); }
void check_minutely() { minutes++; if (minutes >= next_minutes) { /* We're down to zero minutes. Now do the seconds. */ del_hook(HOOK_MINUTELY, (Function) check_minutely); add_hook(HOOK_SECONDLY, (Function) check_secondly); } }
void check_bit_shift(int id) { my_id = id; shifters = create_function_hashtable(5000); register_shifters(); add_hook(&match_assign, ASSIGNMENT_HOOK); add_hook(&match_binop, BINOP_HOOK); if (option_info) { add_hook(&match_binop_info, BINOP_HOOK); if (option_project == PROJ_KERNEL) { add_function_hook("set_bit", &match_call, INT_PTR(0)); add_function_hook("test_bit", &match_call, INT_PTR(0)); } } }
static void create() { ::create(); set_race("demon"); set_no_corpse(1); setmin("flies in"); setmout("flies"); add_property("unarmed_damage_type", "claw"); add_property("flying"); add_property("evil"); add_skill("resist_cold", 100); add_skill("prot_magic", 50); add_skill("two_weapon", 100); add_hook("__die", store_fp("count_death")); add_hook("__init", store_fp("attack_good")); add_hook("__hit_player", store_fp("modify_damage")); add_hook("__bnotify_attack", store_fp("scare_mortals")); }
void check_held_dev(int id) { if (option_project != PROJ_KERNEL) return; my_id = id; add_function_hook("dev_hold", &match_dev_hold, NULL); add_function_hook("dev_put", &match_dev_put, NULL); register_returns_held_funcs(); add_hook(&match_return, RETURN_HOOK); }
static char *traced_rfccompliant(ClientData cdata, Tcl_Interp *irp, EGG_CONST char *name1, EGG_CONST char *name2, int flags) { /* This hook forces eggdrop core to change the rfc_ match function * links to point to the rfc compliant versions if rfc_compliant * is 1, or to the normal version if it's 0. */ add_hook(HOOK_RFC_CASECMP, (Function) (intptr_t) rfc_compliant); return NULL; }
void check_capable(int id) { if (option_project != PROJ_KERNEL) return; capable_id = id; add_function_hook("capable", &match_capable, INT_PTR(0)); add_hook(&save_call_info, FUNCTION_CALL_HOOK); add_split_return_callback(save_return_info); select_caller_info_hook(set_db_capable, CAPABLE); }
void switch_status_start(struct secchan *secchan, const struct settings *s, struct switch_status **ssp) { struct switch_status *ss = xcalloc(1, sizeof *ss); ss->s = s; ss->booted = time_now(); switch_status_register_category(ss, "config", config_status_cb, (void *) s); switch_status_register_category(ss, "switch", switch_status_cb, ss); *ssp = ss; add_hook(secchan, &switch_status_hook_class, ss); }
bool quest_poison_init_hook(int q_idx) { /* Get a place to place the poison */ if (!cquest.data[1]) { cquest.data[1] = TRUE; cquest.data[0] = rand_int(4); if (wizard) message_add(MESSAGE_MSG, format("Wilderness poison %d, %d", wild_locs[cquest.data[0]][0], wild_locs[cquest.data[0]][1]), TERM_BLUE); } if ((cquest.status >= QUEST_STATUS_TAKEN) && (cquest.status < QUEST_STATUS_FINISHED)) { add_hook(HOOK_DROP, quest_poison_drop_hook, "poison_drop"); add_hook(HOOK_WILD_GEN, quest_poison_gen_hook, "poison_gen"); add_hook(HOOK_QUEST_FINISH, quest_poison_finish_hook, "poison_finish"); } if (cquest.status < QUEST_STATUS_COMPLETED) { add_hook(HOOK_INIT_QUEST, quest_poison_quest_hook, "poison_iquest"); } add_hook(HOOK_CHAR_DUMP, quest_poison_dump_hook, "poison_dump"); return (FALSE); }
void delete_hook (Hook **hook_list, void (*hook_fn)(void *)) { Hook *current, *new_list, *next; new_list = 0; for (current = *hook_list; current; current = next){ next = current->next; if (current->hook_fn == hook_fn) g_free (current); else add_hook (&new_list, current->hook_fn, current->hook_data); } *hook_list = new_list; }
void check_wine_filehandles(int id) { int i; if (option_project != PROJ_WINE) return; my_id = id; for (i = 0; filehandle_funcs[i]; i++) { add_function_assign_hook(filehandle_funcs[i], &match_returns_handle, NULL); } add_hook(&match_condition, CONDITION_HOOK); add_modification_hook(my_id, ok_to_use); }
bool plugin_init(plugin_h self) { plugin.self = self; plugin_h orbment, configuration; if (!(orbment = import_plugin(self, "orbment")) || !(configuration = import_plugin(self, "configuration"))) return false; if (!(add_hook = import_method(self, orbment, "add_hook", "b(h,c[],fun)|1")) || !(configuration_get = import_method(self, configuration, "get", "b(c[],c,v)|1"))) return false; return add_hook(self, "compositor.ready", FUN(do_autostart, "v(v)|1")); }
void delete_hook (hook_t ** hook_list, void (*hook_fn) (void *)) { hook_t *new_list = NULL; hook_t *current, *next; for (current = *hook_list; current != NULL; current = next) { next = current->next; if (current->hook_fn == hook_fn) g_free (current); else add_hook (&new_list, current->hook_fn, current->hook_data); } *hook_list = new_list; }
char *uptime_start(Function *global_funcs) { if (global_funcs) { global = global_funcs; module_register(MODULE_NAME, uptime_table, 1, 3); if (!module_depend(MODULE_NAME, "eggdrop", 106, 11)) { module_undepend(MODULE_NAME); return "This module requires Eggdrop 1.6.11 or later."; } add_help_reference("uptime.help"); add_hook(HOOK_MINUTELY, (Function) check_minutely); init_uptime(); } return NULL; }