/* * do_notify: This simply goes through the notify list, sending out a WHOIS * for each person on it. This uses the fancy whois stuff in whois.c to * figure things out. */ void do_notify(void) { int old_from_server = from_server; int servnum; static time_t last_notify = 0; int interval = get_int_var(NOTIFY_INTERVAL_VAR); time_t current_time = time(NULL); if (current_time < last_notify) last_notify = current_time; else if (!interval || interval > (current_time - last_notify)) return; /* Not yet */ last_notify = current_time; if (!server_list_size() || !get_int_var(NOTIFY_VAR)) return; for (servnum = 0; servnum < server_list_size(); servnum++) { if (is_server_connected(servnum) && !get_server_watch(servnum)) { from_server = servnum; if (NOTIFY_LIST(servnum)->ison && *NOTIFY_LIST(servnum)->ison) { char *lame = LOCAL_COPY(NOTIFY_LIST(servnum)->ison); isonbase(lame, ison_notify); } } } from_server = old_from_server; return; }
void remove_all(int type) { UserList *tmp; ShitList *tmp_s, *next_s; ChannelList *chan; NickList *nick; void *location = NULL; int i = 0; if (type == -1 || type == USERLIST_REMOVE) { int size = -1; while ((tmp = next_userlist(NULL, &size, &location))) { if ((tmp = find_userlist(tmp->host, tmp->channels, 1))) { new_free(&tmp->nick); new_free(&tmp->host); new_free(&tmp->channels); new_free(&tmp->password); new_free(&tmp->comment); new_free((char **)&tmp); } } user_count = 0; user_list = NULL; for (i = 0; i < server_list_size(); i ++) { for (chan = get_server_channels(i); chan; chan = chan->next) { for(nick = next_nicklist(chan,NULL); nick; nick = next_nicklist(chan, nick)) nick->userlist = NULL; } } } if (type == -1 || type == SHITLIST_REMOVE) { for (tmp_s = shitlist_list; tmp_s; tmp_s = next_s) { next_s = tmp_s->next; sync_shitlist(tmp_s, 0); new_free(&tmp_s->filter); new_free(&tmp_s->channels); new_free(&tmp_s->reason); new_free((char **)&tmp_s); } for (i = 0; i < server_list_size(); i ++) { for (chan = get_server_channels(i); chan; chan = chan->next) { for(nick = next_nicklist(chan,NULL); nick; nick = next_nicklist(chan, nick)) nick->shitlist = NULL; } } shit_count = 0; shitlist_list = NULL; } }
void check_serverlag(int server) { int i; struct timeval tv; int ofs = from_server; get_time(&tv); if (server == -1) { for (i = 0; i < server_list_size(); i++) { if (is_connected(i) && !get_server_sping(i)) { from_server = i; if (!get_server_ircmode(i) && (get_server_admin(i) > USER_USER)) { send_ncommand(CMDS_SPING, "%s LAG %lu %lu", get_server_itsname(i) ? get_server_itsname(i):get_server_name(i), tv.tv_sec, tv.tv_usec); set_server_sping(i, 1); } } } from_server = ofs; return; } if (is_connected(server) && !get_server_sping(server) && (get_server_admin(server) > USER_USER)) { if (!get_server_ircmode(server)) { send_ncommand(CMDS_SPING, "%s LAG %lu %lu", get_server_itsname(server) ? get_server_itsname(server) : get_server_name(server), tv.tv_sec, tv.tv_usec); set_server_sping(server, 1); } } }
void sync_nicklist(UserList *added, int type) { ChannelList *chan; NickList *nick; int i; char *check; check = clear_server_flags(added->host); for (i = 0; i < server_list_size(); i ++) { for (chan = get_server_channels(i); chan; chan = chan->next) { for (nick = next_nicklist(chan, NULL); nick; nick = next_nicklist(chan, nick)) { if (wild_match(check, nick->host)) { if (type) { nick->userlist = added; check_auto(chan->channel, nick, chan); } else nick->userlist = NULL; } } } } }
void rebuild_all_ison (void) { int i; int ofs = from_server; for (i = 0; i < server_list_size(); i++) { from_server = i; rebuild_notify_ison(i); } from_server = ofs; }
void sync_shitlist(ShitList *added, int type) { ChannelList *chan; NickList *nick; int i; char tmp[BIG_BUFFER_SIZE+1]; char *check; for (i = 0; i < server_list_size(); i ++) { for (chan = get_server_channels(i); chan; chan = chan->next) { for (nick = next_nicklist(chan, NULL); nick; nick = next_nicklist(chan, nick)) { check = clear_server_flags(nick->host); sprintf(tmp, "%s!%s", nick->nick, check); if (wild_match(added->filter, tmp)) { if (type) { nick->shitlist = added; check_auto(chan->channel, nick, chan); } else { BanList *b = NULL; nick->shitlist = NULL; if ((b = ban_is_on_channel(tmp, chan)) && !eban_is_on_channel(tmp, chan)) add_mode(chan, "b", 0, b->ban, NULL, get_int_var(NUM_BANMODES_VAR)); } } } flush_mode_all(chan); } } }