#include "src/mod/module.h"
#include "irc.h"
#include "server.mod/server.h"
#include "channels.mod/channels.h"
#include "chan.c"
#include "mode.c"
#include "cmdsirc.c"
#include "msgcmds.c"
#include "tclirc.c"
Go to the source code of this file.
Defines | |
#define | MODULE_NAME "irc" |
#define | MAKING_IRC |
Functions | |
static int | want_to_revenge (struct chanset_t *chan, struct userrec *u, struct userrec *u2, char *badnick, char *victim, int mevictim) |
static void | punish_badguy (struct chanset_t *chan, char *whobad, struct userrec *u, char *badnick, char *victim, int mevictim, int type) |
static void | maybe_revenge (struct chanset_t *chan, char *whobad, char *whovictim, int type) |
static void | set_key (struct chanset_t *chan, char *k) |
static int | hand_on_chan (struct chanset_t *chan, struct userrec *u) |
static void | refresh_who_chan (char *channame) |
static void | newmask (masklist *m, char *s, char *who) |
static int | killmember (struct chanset_t *chan, char *nick) |
static int | me_op (struct chanset_t *chan) |
static int | me_halfop (struct chanset_t *chan) |
static int | me_voice (struct chanset_t *chan) |
static int | any_ops (struct chanset_t *chan) |
static void | reset_chan_info (struct chanset_t *chan, int reset) |
static void | do_channel_part (struct chanset_t *chan) |
static void | status_log () |
static void | check_lonely_channel (struct chanset_t *chan) |
static void | check_expired_chanstuff () |
static void | flush_modes () |
static void | irc_report (int idx, int details) |
static void | do_nettype () |
static char * | traced_nettype (ClientData cdata, Tcl_Interp *irp, char *name1, char *name2, int flags) |
static char * | traced_rfccompliant (ClientData cdata, Tcl_Interp *irp, char *name1, char *name2, int flags) |
static int | irc_expmem () |
static char * | irc_close () |
EXPORT_SCOPE char * | irc_start () |
char * | irc_start (Function *global_funcs) |
Variables | |
static p_tcl_bind_list | H_topc |
static p_tcl_bind_list | H_splt |
static p_tcl_bind_list | H_sign |
static p_tcl_bind_list | H_rejn |
static p_tcl_bind_list | H_part |
static p_tcl_bind_list | H_pub |
static p_tcl_bind_list | H_pubm |
static p_tcl_bind_list | H_nick |
static p_tcl_bind_list | H_mode |
static p_tcl_bind_list | H_kick |
static p_tcl_bind_list | H_join |
static p_tcl_bind_list | H_need |
static Function * | global = 0 |
static Function * | channels_funcs = 0 |
static Function * | server_funcs = 0 |
static int | ctcp_mode |
static int | net_type |
static int | strict_host |
static int | wait_split = 300 |
static int | max_bans = 20 |
static int | max_exempts = 20 |
static int | max_invites = 20 |
static int | max_modes = 20 |
static int | bounce_bans = 1 |
static int | bounce_exempts = 0 |
static int | bounce_invites = 0 |
static int | bounce_modes = 0 |
static int | learn_users = 0 |
static int | wait_info = 15 |
static int | invite_key = 1 |
static int | no_chanrec_info = 0 |
static int | modesperline = 3 |
static int | mode_buf_len = 200 |
static int | use_354 = 0 |
static int | kick_method = 1 |
static int | kick_fun = 0 |
static int | ban_fun = 0 |
static int | keepnick = 1 |
static int | prevent_mixing = 1 |
static int | rfc_compliant = 1 |
static int | include_lk = 1 |
static char | opchars [8] |
static tcl_ints | myints [] |
static Function | irc_table [] |
static int any_ops | ( | struct chanset_t * | chan | ) | [static] |
Definition at line 401 of file irc.c.
References chan_hasop, chanset_t::channel, chan_t::member, memstruct::next, and memstruct::nick.
Referenced by check_lonely_channel(), and got352or4().
00402 { 00403 memberlist *x; 00404 00405 for (x = chan->channel.member; x && x->nick[0]; x = x->next) 00406 if (chan_hasop(x)) 00407 break; 00408 if (!x || !x->nick[0]) 00409 return 0; 00410 return 1; 00411 }
static void check_expired_chanstuff | ( | ) | [static] |
Definition at line 601 of file irc.c.
References add_mode, chan_t::ban, chanset_t::ban_time, chanset_t::bans, chan_deop, chan_friend, chan_hasop, chan_issplit, chan_op, CHANINV, chanset_t::channel, channel_active, channel_dynamicbans, channel_dynamicexempts, channel_dynamicinvites, channel_inactive, channel_pending, chanset, check_lonely_channel(), check_tcl_sign, chanset_t::dname, DP_SERVER, dprintf, e, chan_t::exempt, chanset_t::exempt_time, chanset_t::exempts, expired_mask(), memstruct::flags, FR_CHAN, FR_GLOBAL, get_user_by_host, get_user_flagrec, glob_bot, glob_friend, glob_op, global_bans, global_exempts, global_invites, chanset_t::idle_kick, chan_t::invite, chanset_t::invite_time, chanset_t::invites, chan_t::key, chanset_t::key_prot, killmember(), memstruct::last, LOG_JOIN, LOG_MODES, maskstruct::mask, mask_match, flag_record::match, match_my_nick(), me_halfop(), me_op(), chan_t::member, chan_t::mode, chanset_t::name, memstruct::next, maskstruct::next, chanset_t::next, memstruct::nick, now, putlog, SENTKICK, server_online, memstruct::split, maskstruct::timer, u_sticky_mask(), UHOSTLEN, use_exempts, use_invites, memstruct::user, memstruct::userhost, wait_split, and maskstruct::who.
Referenced by irc_close(), and irc_start().
00602 { 00603 masklist *b, *e; 00604 memberlist *m, *n; 00605 char *key, s[UHOSTLEN]; 00606 struct chanset_t *chan; 00607 struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 }; 00608 00609 if (!server_online) 00610 return; 00611 for (chan = chanset; chan; chan = chan->next) { 00612 if (channel_active(chan)) { 00613 if (me_op(chan) || me_halfop(chan)) { 00614 if (channel_dynamicbans(chan) && chan->ban_time) 00615 for (b = chan->channel.ban; b->mask[0]; b = b->next) 00616 if (now - b->timer > 60 * chan->ban_time && 00617 !u_sticky_mask(chan->bans, b->mask) && 00618 !u_sticky_mask(global_bans, b->mask) && 00619 expired_mask(chan, b->who)) { 00620 putlog(LOG_MODES, chan->dname, 00621 "(%s) Channel ban on %s expired.", chan->dname, b->mask); 00622 add_mode(chan, '-', 'b', b->mask); 00623 b->timer = now; 00624 } 00625 00626 if (use_exempts && channel_dynamicexempts(chan) && chan->exempt_time) 00627 for (e = chan->channel.exempt; e->mask[0]; e = e->next) 00628 if (now - e->timer > 60 * chan->exempt_time && 00629 !u_sticky_mask(chan->exempts, e->mask) && 00630 !u_sticky_mask(global_exempts, e->mask) && 00631 expired_mask(chan, e->who)) { 00632 /* Check to see if it matches a ban */ 00633 int match = 0; 00634 00635 for (b = chan->channel.ban; b->mask[0]; b = b->next) 00636 if (mask_match(b->mask, e->mask)) { 00637 match = 1; 00638 break; 00639 } 00640 /* Leave this extra logging in for now. Can be removed later 00641 * Jason 00642 */ 00643 if (match) { 00644 putlog(LOG_MODES, chan->dname, 00645 "(%s) Channel exemption %s NOT expired. Exempt still set!", 00646 chan->dname, e->mask); 00647 } else { 00648 putlog(LOG_MODES, chan->dname, 00649 "(%s) Channel exemption on %s expired.", 00650 chan->dname, e->mask); 00651 add_mode(chan, '-', 'e', e->mask); 00652 } 00653 e->timer = now; 00654 } 00655 00656 if (use_invites && channel_dynamicinvites(chan) && 00657 chan->invite_time && !(chan->channel.mode & CHANINV)) 00658 for (b = chan->channel.invite; b->mask[0]; b = b->next) 00659 if (now - b->timer > 60 * chan->invite_time && 00660 !u_sticky_mask(chan->invites, b->mask) && 00661 !u_sticky_mask(global_invites, b->mask) && 00662 expired_mask(chan, b->who)) { 00663 putlog(LOG_MODES, chan->dname, 00664 "(%s) Channel invitation on %s expired.", 00665 chan->dname, b->mask); 00666 add_mode(chan, '-', 'I', b->mask); 00667 b->timer = now; 00668 } 00669 00670 if (chan->idle_kick) 00671 for (m = chan->channel.member; m && m->nick[0]; m = m->next) 00672 if (now - m->last >= chan->idle_kick * 60 && 00673 !match_my_nick(m->nick) && !chan_issplit(m)) { 00674 sprintf(s, "%s!%s", m->nick, m->userhost); 00675 get_user_flagrec(m->user ? m->user : get_user_by_host(s), 00676 &fr, chan->dname); 00677 if ((!(glob_bot(fr) || glob_friend(fr) || (glob_op(fr) && 00678 !chan_deop(fr)) || chan_friend(fr) || chan_op(fr))) && 00679 (me_op(chan) || (me_halfop(chan) && !chan_hasop(m)))) { 00680 dprintf(DP_SERVER, "KICK %s %s :idle %d min\n", chan->name, 00681 m->nick, chan->idle_kick); 00682 m->flags |= SENTKICK; 00683 } 00684 } 00685 } 00686 for (m = chan->channel.member; m && m->nick[0]; m = n) { 00687 n = m->next; 00688 if (m->split && now - m->split > wait_split) { 00689 sprintf(s, "%s!%s", m->nick, m->userhost); 00690 check_tcl_sign(m->nick, m->userhost, 00691 m->user ? m->user : get_user_by_host(s), 00692 chan->dname, "lost in the netsplit"); 00693 putlog(LOG_JOIN, chan->dname, 00694 "%s (%s) got lost in the net-split.", m->nick, m->userhost); 00695 killmember(chan, m->nick); 00696 } 00697 m = n; 00698 } 00699 check_lonely_channel(chan); 00700 } else if (!channel_inactive(chan) && !channel_pending(chan)) { 00701 00702 key = chan->channel.key[0] ? chan->channel.key : chan->key_prot; 00703 if (key[0]) 00704 dprintf(DP_SERVER, "JOIN %s %s\n", 00705 chan->name[0] ? chan->name : chan->dname, key); 00706 else 00707 dprintf(DP_SERVER, "JOIN %s\n", 00708 chan->name[0] ? chan->name : chan->dname); 00709 } 00710 } 00711 }
static void check_lonely_channel | ( | struct chanset_t * | chan | ) | [static] |
Definition at line 532 of file irc.c.
References any_ops(), chan_issplit, CHAN_WHINED, CHANANON, chanset_t::channel, channel_active, channel_cycle, channel_inactive, channel_logstatus, channel_pending, channel_stop_cycle, channel_whined, check_tcl_need(), chanset_t::dname, do_tcl, DP_MODE, DP_SERVER, dprintf, userrec::flags, get_user_by_host, chanset_t::key_prot, LOG_MISC, match_my_nick(), me_op(), chan_t::member, chan_t::mode, chanset_t::name, chanset_t::need_op, memstruct::next, memstruct::nick, putlog, chanset_t::status, UHOSTLEN, USER_BOT, and memstruct::userhost.
Referenced by check_expired_chanstuff(), gotkick(), gotpart(), and gotquit().
00533 { 00534 memberlist *m; 00535 char s[UHOSTLEN]; 00536 int i = 0; 00537 00538 if (channel_pending(chan) || !channel_active(chan) || me_op(chan) || 00539 channel_inactive(chan) || (chan->channel.mode & CHANANON)) 00540 return; 00541 /* Count non-split channel members */ 00542 for (m = chan->channel.member; m && m->nick[0]; m = m->next) 00543 if (!chan_issplit(m)) 00544 i++; 00545 if (i == 1 && channel_cycle(chan) && !channel_stop_cycle(chan)) { 00546 if (chan->name[0] != '+') { /* Its pointless to cycle + chans for ops */ 00547 putlog(LOG_MISC, "*", "Trying to cycle %s to regain ops.", chan->dname); 00548 dprintf(DP_MODE, "PART %s\n", chan->name); 00549 00550 /* If it's a !chan, we need to recreate the channel with !!chan <cybah> */ 00551 if (chan->key_prot[0]) 00552 dprintf(DP_MODE, "JOIN %s%s %s\n", (chan->dname[0] == '!') ? "!" : "", 00553 chan->dname, chan->key_prot); 00554 else 00555 dprintf(DP_MODE, "JOIN %s%s\n", (chan->dname[0] == '!') ? "!" : "", 00556 chan->dname); 00557 chan->status &= ~CHAN_WHINED; 00558 } 00559 } else if (any_ops(chan)) { 00560 chan->status &= ~CHAN_WHINED; 00561 check_tcl_need(chan->dname, "op"); 00562 if (chan->need_op[0]) 00563 do_tcl("need-op", chan->need_op); 00564 } else { 00565 /* Other people here, but none are ops. If there are other bots make 00566 * them LEAVE! 00567 */ 00568 int ok = 1; 00569 struct userrec *u; 00570 00571 if (!channel_whined(chan)) { 00572 /* + is opless. Complaining about no ops when without special 00573 * help(services), we cant get them - Raist 00574 */ 00575 if (chan->name[0] != '+' && channel_logstatus(chan)) 00576 putlog(LOG_MISC, "*", "%s is active but has no ops :(", chan->dname); 00577 chan->status |= CHAN_WHINED; 00578 } 00579 for (m = chan->channel.member; m && m->nick[0]; m = m->next) { 00580 sprintf(s, "%s!%s", m->nick, m->userhost); 00581 u = get_user_by_host(s); 00582 if (!match_my_nick(m->nick) && (!u || !(u->flags & USER_BOT))) { 00583 ok = 0; 00584 break; 00585 } 00586 } 00587 if (ok && channel_cycle(chan)) { 00588 /* ALL bots! make them LEAVE!!! */ 00589 for (m = chan->channel.member; m && m->nick[0]; m = m->next) 00590 if (!match_my_nick(m->nick)) 00591 dprintf(DP_SERVER, "PRIVMSG %s :go %s\n", m->nick, chan->dname); 00592 } else { 00593 /* Some humans on channel, but still op-less */ 00594 check_tcl_need(chan->dname, "op"); 00595 if (chan->need_op[0]) 00596 do_tcl("need-op", chan->need_op); 00597 } 00598 } 00599 }
static void do_channel_part | ( | struct chanset_t * | chan | ) | [static] |
Definition at line 466 of file irc.c.
References botname, botuserhost, channel_inactive, check_tcl_part(), chanset_t::dname, DP_SERVER, dprintf, chanset_t::name, and NULL.
00467 { 00468 if (!channel_inactive(chan) && chan->name[0]) { 00469 /* Using chan->name is important here, especially for !chans <cybah> */ 00470 dprintf(DP_SERVER, "PART %s\n", chan->name); 00471 00472 /* As we don't know of this channel anymore when we receive the server's 00473 * ack for the above PART, we have to notify about it _now_. */ 00474 check_tcl_part(botname, botuserhost, NULL, chan->dname, NULL); 00475 } 00476 }
static void do_nettype | ( | ) | [static] |
Definition at line 1031 of file irc.c.
References add_hook, HOOK_RFC_CASECMP, include_lk, kick_method, max_bans, max_exempts, max_invites, max_modes, modesperline, net_type, rfc_compliant, use_354, use_exempts, and use_invites.
Referenced by irc_start(), server_start(), and traced_nettype().
01032 { 01033 switch (net_type) { 01034 case 0: /* EFnet */ 01035 kick_method = 1; 01036 modesperline = 4; 01037 use_354 = 0; 01038 use_exempts = 1; 01039 use_invites = 1; 01040 max_bans = 100; 01041 max_exempts = 100; 01042 max_invites = 100; 01043 max_modes = 100; 01044 rfc_compliant = 1; 01045 include_lk = 0; 01046 break; 01047 case 1: /* IRCnet */ 01048 kick_method = 4; 01049 modesperline = 3; 01050 use_354 = 0; 01051 use_exempts = 1; 01052 use_invites = 1; 01053 max_bans = 30; 01054 max_exempts = 30; 01055 max_invites = 30; 01056 max_modes = 30; 01057 rfc_compliant = 1; 01058 include_lk = 1; 01059 break; 01060 case 2: /* UnderNet */ 01061 kick_method = 1; 01062 modesperline = 6; 01063 use_354 = 1; 01064 use_exempts = 0; 01065 use_invites = 0; 01066 max_bans = 45; 01067 max_exempts = 45; 01068 max_invites = 45; 01069 max_modes = 45; 01070 rfc_compliant = 1; 01071 include_lk = 1; 01072 break; 01073 case 3: /* DALnet */ 01074 kick_method = 1; 01075 modesperline = 6; 01076 use_354 = 0; 01077 use_exempts = 0; 01078 use_invites = 0; 01079 max_bans = 100; 01080 max_exempts = 100; 01081 max_invites = 100; 01082 max_modes = 100; 01083 rfc_compliant = 0; 01084 include_lk = 1; 01085 break; 01086 case 4: /* Hybrid-6+ */ 01087 kick_method = 1; 01088 modesperline = 4; 01089 use_354 = 0; 01090 use_exempts = 1; 01091 use_invites = 1; 01092 max_bans = 20; 01093 max_exempts = 20; 01094 max_invites = 20; 01095 max_modes = 20; 01096 rfc_compliant = 1; 01097 include_lk = 0; 01098 break; 01099 default: 01100 break; 01101 } 01102 /* Update all rfc_ function pointers */ 01103 add_hook(HOOK_RFC_CASECMP, (Function) (intptr_t) rfc_compliant); 01104 }
static void flush_modes | ( | ) | [static] |
Definition at line 960 of file irc.c.
References add_mode, chan_senthalfop, chan_sentop, chan_sentvoice, chanset_t::channel, chanset, memstruct::delay, memstruct::flags, flush_mode(), FULL_DELAY, chan_t::member, MODES_PER_LINE_MAX, modesperline, memstruct::next, chanset_t::next, memstruct::nick, NORMAL, now, SENTHALFOP, SENTOP, and SENTVOICE.
Referenced by irc_close(), and irc_start().
00961 { 00962 struct chanset_t *chan; 00963 memberlist *m; 00964 00965 if (modesperline > MODES_PER_LINE_MAX) 00966 modesperline = MODES_PER_LINE_MAX; 00967 00968 for (chan = chanset; chan; chan = chan->next) { 00969 for (m = chan->channel.member; m && m->nick[0]; m = m->next) { 00970 if (m->delay && m->delay <= now) { 00971 m->delay = 0L; 00972 m->flags &= ~FULL_DELAY; 00973 if (chan_sentop(m)) { 00974 m->flags &= ~SENTOP; 00975 add_mode(chan, '+', 'o', m->nick); 00976 } 00977 if (chan_senthalfop(m)) { 00978 m->flags &= ~SENTHALFOP; 00979 add_mode(chan, '+', 'h', m->nick); 00980 } 00981 if (chan_sentvoice(m)) { 00982 m->flags &= ~SENTVOICE; 00983 add_mode(chan, '+', 'v', m->nick); 00984 } 00985 } 00986 } 00987 flush_mode(chan, NORMAL); 00988 } 00989 }
Definition at line 271 of file irc.c.
References chanset_t::channel, get_user_by_host, chan_t::member, memstruct::next, memstruct::nick, UHOSTLEN, and memstruct::userhost.
Referenced by msg_who(), and msg_whois().
00272 { 00273 char s[UHOSTLEN]; 00274 memberlist *m; 00275 00276 for (m = chan->channel.member; m && m->nick[0]; m = m->next) { 00277 sprintf(s, "%s!%s", m->nick, m->userhost); 00278 if (u == get_user_by_host(s)) 00279 return 1; 00280 } 00281 return 0; 00282 }
static char* irc_close | ( | ) | [static] |
Definition at line 1131 of file irc.c.
References C_msg, chanset, check_expired_chanstuff(), clear_channel(), del_bind_table, del_hook, DP_MODE, dprintf, flush_modes(), H_dcc, H_msg, H_raw, HOOK_5MINUTELY, HOOK_ADD_MODE, HOOK_IDLE, HOOK_MINUTELY, interp, irc_dcc, irc_raw, MODULE_NAME, module_undepend, chanset_t::next, NULL, real_add_mode(), rem_builtins, rem_help_reference, rem_tcl_commands, rem_tcl_ints, rem_tcl_strings, status_log(), traced_nettype(), and traced_rfccompliant().
01132 { 01133 struct chanset_t *chan; 01134 01135 /* Force bot to part all channels */ 01136 dprintf(DP_MODE, "JOIN 0\n"); 01137 01138 for (chan = chanset; chan; chan = chan->next) 01139 clear_channel(chan, 1); 01140 del_bind_table(H_topc); 01141 del_bind_table(H_splt); 01142 del_bind_table(H_sign); 01143 del_bind_table(H_rejn); 01144 del_bind_table(H_part); 01145 del_bind_table(H_nick); 01146 del_bind_table(H_mode); 01147 del_bind_table(H_kick); 01148 del_bind_table(H_join); 01149 del_bind_table(H_pubm); 01150 del_bind_table(H_pub); 01151 del_bind_table(H_need); 01152 rem_tcl_strings(mystrings); 01153 rem_tcl_ints(myints); 01154 rem_builtins(H_dcc, irc_dcc); 01155 rem_builtins(H_msg, C_msg); 01156 rem_builtins(H_raw, irc_raw); 01157 rem_tcl_commands(tclchan_cmds); 01158 rem_help_reference("irc.help"); 01159 del_hook(HOOK_MINUTELY, (Function) check_expired_chanstuff); 01160 del_hook(HOOK_5MINUTELY, (Function) status_log); 01161 del_hook(HOOK_ADD_MODE, (Function) real_add_mode); 01162 del_hook(HOOK_IDLE, (Function) flush_modes); 01163 Tcl_UntraceVar(interp, "rfc-compliant", 01164 TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS, 01165 traced_rfccompliant, NULL); 01166 Tcl_UntraceVar(interp, "net-type", 01167 TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS, 01168 traced_nettype, NULL); 01169 module_undepend(MODULE_NAME); 01170 return NULL; 01171 }
static int irc_expmem | ( | ) | [static] |
static void irc_report | ( | int | idx, | |
int | details | |||
) | [static] |
Definition at line 991 of file irc.c.
References CHAN_ACTIVE, CHAN_JUPED, chan_master, CHAN_PEND, channel_inactive, chanset, dcc, chanset_t::dname, DP_STDOUT, dprintf, FR_CHAN, FR_GLOBAL, get_user_flagrec, glob_master, me_op(), MISC_JUPED, MISC_PENDING, MISC_TRYING, MISC_WANTOPS, my_strcpy, chanset_t::next, NULL, simple_sprintf, chanset_t::status, and user.
00992 { 00993 struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 }; 00994 char ch[1024], q[256], *p; 00995 int k, l; 00996 struct chanset_t *chan; 00997 00998 strcpy(q, "Channels: "); 00999 k = 10; 01000 for (chan = chanset; chan; chan = chan->next) { 01001 if (idx != DP_STDOUT) 01002 get_user_flagrec(dcc[idx].user, &fr, chan->dname); 01003 if ((idx == DP_STDOUT) || glob_master(fr) || chan_master(fr)) { 01004 p = NULL; 01005 if (!channel_inactive(chan)) { 01006 if (chan->status & CHAN_JUPED) 01007 p = MISC_JUPED; 01008 else if (!(chan->status & CHAN_ACTIVE)) 01009 p = MISC_TRYING; 01010 else if (chan->status & CHAN_PEND) 01011 p = MISC_PENDING; 01012 else if ((chan->dname[0] != '+') && !me_op(chan)) 01013 p = MISC_WANTOPS; 01014 } 01015 l = simple_sprintf(ch, "%s%s%s%s, ", chan->dname, p ? " (" : "", 01016 p ? p : "", p ? ")" : ""); 01017 if ((k + l) > 70) { 01018 dprintf(idx, " %s\n", q); 01019 strcpy(q, " "); 01020 k = 10; 01021 } 01022 k += my_strcpy(q + k, ch); 01023 } 01024 } 01025 if (k > 10) { 01026 q[k - 2] = 0; 01027 dprintf(idx, " %s\n", q); 01028 } 01029 }
char* irc_start | ( | Function * | global_funcs | ) |
Definition at line 1210 of file irc.c.
References add_bind_table, add_builtins, add_help_reference, add_hook, add_tcl_commands, add_tcl_ints, add_tcl_strings, C_msg, CHAN_ACTIVE, CHAN_ASKED_EXEMPTS, CHAN_ASKED_INVITED, CHAN_ASKEDBANS, CHAN_PEND, channel_inactive, channels_funcs, chanset, check_expired_chanstuff(), chanset_t::dname, do_nettype(), DP_SERVER, dprintf, flush_modes(), global, H_dcc, H_msg, H_raw, HOOK_5MINUTELY, HOOK_ADD_MODE, HOOK_IDLE, HOOK_MINUTELY, HT_STACKABLE, interp, irc_dcc, irc_raw, chanset_t::ircnet_status, chanset_t::key_prot, module_depend, MODULE_NAME, module_register, module_undepend, chanset_t::name, chanset_t::next, NULL, opchars, real_add_mode(), server_funcs, chanset_t::status, status_log(), traced_nettype(), and traced_rfccompliant().
01211 { 01212 struct chanset_t *chan; 01213 01214 global = global_funcs; 01215 01216 module_register(MODULE_NAME, irc_table, 1, 4); 01217 if (!module_depend(MODULE_NAME, "eggdrop", 106, 20)) { 01218 module_undepend(MODULE_NAME); 01219 return "This module requires Eggdrop 1.6.20 or later."; 01220 } 01221 if (!(server_funcs = module_depend(MODULE_NAME, "server", 1, 0))) { 01222 module_undepend(MODULE_NAME); 01223 return "This module requires server module 1.0 or later."; 01224 } 01225 if (!(channels_funcs = module_depend(MODULE_NAME, "channels", 1, 1))) { 01226 module_undepend(MODULE_NAME); 01227 return "This module requires channels module 1.1 or later."; 01228 } 01229 for (chan = chanset; chan; chan = chan->next) { 01230 if (!channel_inactive(chan)) { 01231 if (chan->key_prot[0]) 01232 dprintf(DP_SERVER, "JOIN %s %s\n", 01233 chan->name[0] ? chan->name : chan->dname, chan->key_prot); 01234 else 01235 dprintf(DP_SERVER, "JOIN %s\n", 01236 chan->name[0] ? chan->name : chan->dname); 01237 } 01238 chan->status &= ~(CHAN_ACTIVE | CHAN_PEND | CHAN_ASKEDBANS); 01239 chan->ircnet_status &= ~(CHAN_ASKED_INVITED | CHAN_ASKED_EXEMPTS); 01240 } 01241 add_hook(HOOK_MINUTELY, (Function) check_expired_chanstuff); 01242 add_hook(HOOK_5MINUTELY, (Function) status_log); 01243 add_hook(HOOK_ADD_MODE, (Function) real_add_mode); 01244 add_hook(HOOK_IDLE, (Function) flush_modes); 01245 Tcl_TraceVar(interp, "net-type", 01246 TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS, 01247 traced_nettype, NULL); 01248 Tcl_TraceVar(interp, "rfc-compliant", 01249 TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS, 01250 traced_rfccompliant, NULL); 01251 strcpy(opchars, "@"); 01252 add_tcl_strings(mystrings); 01253 add_tcl_ints(myints); 01254 add_builtins(H_dcc, irc_dcc); 01255 add_builtins(H_msg, C_msg); 01256 add_builtins(H_raw, irc_raw); 01257 add_tcl_commands(tclchan_cmds); 01258 add_help_reference("irc.help"); 01259 H_topc = add_bind_table("topc", HT_STACKABLE, channels_5char); 01260 H_splt = add_bind_table("splt", HT_STACKABLE, channels_4char); 01261 H_sign = add_bind_table("sign", HT_STACKABLE, channels_5char); 01262 H_rejn = add_bind_table("rejn", HT_STACKABLE, channels_4char); 01263 H_part = add_bind_table("part", HT_STACKABLE, channels_5char); 01264 H_nick = add_bind_table("nick", HT_STACKABLE, channels_5char); 01265 H_mode = add_bind_table("mode", HT_STACKABLE, channels_6char); 01266 H_kick = add_bind_table("kick", HT_STACKABLE, channels_6char); 01267 H_join = add_bind_table("join", HT_STACKABLE, channels_4char); 01268 H_pubm = add_bind_table("pubm", HT_STACKABLE, channels_5char); 01269 H_pub = add_bind_table("pub", 0, channels_5char); 01270 H_need = add_bind_table("need", HT_STACKABLE, channels_2char); 01271 do_nettype(); 01272 return NULL; 01273 }
EXPORT_SCOPE char* irc_start | ( | ) |
static int killmember | ( | struct chanset_t * | chan, | |
char * | nick | |||
) | [static] |
Definition at line 316 of file irc.c.
References chanset_t::channel, channel_djoins, channel_malloc(), channel_pending, LOG_MISC, chan_t::member, chan_t::members, memstruct::next, nfree, memstruct::nick, NULL, putlog, and rfc_casecmp.
Referenced by check_expired_chanstuff(), gotjoin(), gotkick(), gotnick(), gotpart(), and gotquit().
00317 { 00318 memberlist *x, *old; 00319 00320 old = NULL; 00321 for (x = chan->channel.member; x && x->nick[0]; old = x, x = x->next) 00322 if (!rfc_casecmp(x->nick, nick)) 00323 break; 00324 if (!x || !x->nick[0]) { 00325 if (!channel_pending(chan) && !channel_djoins(chan)) 00326 putlog(LOG_MISC, "*", "(!) killmember(%s) -> nonexistent", nick); 00327 return 0; 00328 } 00329 if (old) 00330 old->next = x->next; 00331 else 00332 chan->channel.member = x->next; 00333 nfree(x); 00334 chan->channel.members--; 00335 00336 /* The following two errors should NEVER happen. We will try to correct 00337 * them though, to keep the bot from crashing. 00338 */ 00339 if (chan->channel.members < 0) { 00340 chan->channel.members = 0; 00341 for (x = chan->channel.member; x && x->nick[0]; x = x->next) 00342 chan->channel.members++; 00343 putlog(LOG_MISC, "*", "(!) actually I know of %d members.", 00344 chan->channel.members); 00345 } 00346 if (!chan->channel.member) { 00347 chan->channel.member = (memberlist *) channel_malloc(sizeof(memberlist)); 00348 chan->channel.member->nick[0] = 0; 00349 chan->channel.member->next = NULL; 00350 } 00351 return 1; 00352 }
static void maybe_revenge | ( | struct chanset_t * | chan, | |
char * | whobad, | |||
char * | whovictim, | |||
int | type | |||
) | [static] |
Definition at line 233 of file irc.c.
References get_user_by_host, match_my_nick(), punish_badguy(), splitnick, victim, and want_to_revenge().
Referenced by got_deop(), and gotkick().
00235 { 00236 char *badnick, *victim; 00237 int mevictim; 00238 struct userrec *u, *u2; 00239 00240 if (!chan || (type < 0)) 00241 return; 00242 00243 /* Get info about offender */ 00244 u = get_user_by_host(whobad); 00245 badnick = splitnick(&whobad); 00246 00247 /* Get info about victim */ 00248 u2 = get_user_by_host(whovictim); 00249 victim = splitnick(&whovictim); 00250 mevictim = match_my_nick(victim); 00251 00252 /* Do we want to revenge? */ 00253 if (want_to_revenge(chan, u, u2, badnick, victim, mevictim)) 00254 punish_badguy(chan, whobad, u, badnick, victim, mevictim, type); 00255 }
static int me_halfop | ( | struct chanset_t * | chan | ) | [static] |
Definition at line 371 of file irc.c.
References botname, chan_hashalfop, ismember, and NULL.
Referenced by check_expired_chanstuff(), check_this_member(), cmd_act(), cmd_invite(), cmd_kick(), cmd_say(), cmd_topic(), detect_chan_flood(), got_halfop(), gotjoin(), gotmode(), gotmsg(), kick_all(), punish_badguy(), resetmasks(), and status_log().
00372 { 00373 memberlist *mx = NULL; 00374 00375 mx = ismember(chan, botname); 00376 if (!mx) 00377 return 0; 00378 if (chan_hashalfop(mx)) 00379 return 1; 00380 else 00381 return 0; 00382 }
static int me_op | ( | struct chanset_t * | chan | ) | [static] |
Definition at line 356 of file irc.c.
References botname, chan_hasop, ismember, and NULL.
Referenced by check_expired_chanstuff(), check_lonely_channel(), check_this_member(), cmd_act(), cmd_invite(), cmd_kick(), cmd_kickban(), cmd_say(), cmd_topic(), detect_chan_flood(), got315(), got352or4(), got_halfop(), got_op(), got_unexempt(), got_uninvite(), gotjoin(), gotmode(), gotmsg(), gotnotice(), irc_report(), kick_all(), msg_go(), msg_status(), punish_badguy(), real_add_mode(), resetmasks(), and status_log().
00357 { 00358 memberlist *mx = NULL; 00359 00360 mx = ismember(chan, botname); 00361 if (!mx) 00362 return 0; 00363 if (chan_hasop(mx)) 00364 return 1; 00365 else 00366 return 0; 00367 }
static int me_voice | ( | struct chanset_t * | chan | ) | [static] |
Definition at line 386 of file irc.c.
References botname, chan_hasvoice, and ismember.
Referenced by cmd_act(), cmd_say(), and status_log().
00387 { 00388 memberlist *mx; 00389 00390 mx = ismember(chan, botname); 00391 if (!mx) 00392 return 0; 00393 if (chan_hasvoice(mx)) 00394 return 1; 00395 else 00396 return 0; 00397 }
static void newmask | ( | masklist * | m, | |
char * | s, | |||
char * | who | |||
) | [static] |
Definition at line 296 of file irc.c.
References channel_malloc(), maskstruct::mask, maskstruct::next, nfree, now, NULL, rfc_casecmp, maskstruct::timer, and maskstruct::who.
00297 { 00298 for (; m && m->mask[0] && rfc_casecmp(m->mask, s); m = m->next); 00299 if (m->mask[0]) 00300 return; /* Already existent mask */ 00301 00302 m->next = (masklist *) channel_malloc(sizeof(masklist)); 00303 m->next->next = NULL; 00304 m->next->mask = (char *) channel_malloc(1); 00305 m->next->mask[0] = 0; 00306 nfree(m->mask); 00307 m->mask = (char *) channel_malloc(strlen(s) + 1); 00308 strcpy(m->mask, s); 00309 m->who = (char *) channel_malloc(strlen(who) + 1); 00310 strcpy(m->who, who); 00311 m->timer = now; 00312 }
static void punish_badguy | ( | struct chanset_t * | chan, | |
char * | whobad, | |||
struct userrec * | u, | |||
char * | badnick, | |||
char * | victim, | |||
int | mevictim, | |||
int | type | |||
) | [static] |
Definition at line 116 of file irc.c.
References add_mode, adduser, chanset_t::ban_time, chanset_t::ban_type, botnetnick, flag_record::chan, chan_deop, chan_hasop, chan_op, chan_sentkick, channel_dontkickops, chanset_t::dname, DP_MODE, dprintf, egg_strftime(), memstruct::flags, flush_mode(), FR_CHAN, FR_GLOBAL, get_user_by_handle, get_user_flagrec, glob_deop, glob_op, HALFOP_CANDOMODE, userrec::handle, IRC_DEOP_PROTECT, IRC_KICK_PROTECT, ismember, LOG_MISC, maskaddr, flag_record::match, me_halfop(), me_op(), chanset_t::name, NOHALFOPS_MODES, now, NULL, putlog, QUICK, REVENGE_DEOP, REVENGE_KICK, chanset_t::revenge_mode, SENTKICK, set_user, set_user_flagrec, simple_sprintf, splitnick, u_addban(), flag_record::udef_chan, UHOSTLEN, memstruct::user, USER_DEOP, USER_OP, USERENTRY_COMMENT, and userlist.
Referenced by maybe_revenge().
00119 { 00120 char reason[1024], ct[81], *kick_msg; 00121 memberlist *m; 00122 struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 }; 00123 00124 m = ismember(chan, badnick); 00125 if (!m) 00126 return; 00127 get_user_flagrec(u, &fr, chan->dname); 00128 00129 /* Get current time into a string */ 00130 egg_strftime(ct, 7, "%d %b", localtime(&now)); 00131 00132 /* Put together log and kick messages */ 00133 reason[0] = 0; 00134 switch (type) { 00135 case REVENGE_KICK: 00136 kick_msg = IRC_KICK_PROTECT; 00137 simple_sprintf(reason, "kicked %s off %s", victim, chan->dname); 00138 break; 00139 case REVENGE_DEOP: 00140 simple_sprintf(reason, "deopped %s on %s", victim, chan->dname); 00141 kick_msg = IRC_DEOP_PROTECT; 00142 break; 00143 default: 00144 kick_msg = "revenge!"; 00145 } 00146 putlog(LOG_MISC, chan->dname, "Punishing %s (%s)", badnick, reason); 00147 00148 /* Set the offender +d */ 00149 if ((chan->revenge_mode > 0) && !(chan_deop(fr) || glob_deop(fr))) { 00150 char s[UHOSTLEN], s1[UHOSTLEN]; 00151 memberlist *mx = NULL; 00152 00153 /* Removing op */ 00154 if (chan_op(fr) || (glob_op(fr) && !chan_deop(fr))) { 00155 fr.match = FR_CHAN; 00156 if (chan_op(fr)) 00157 fr.chan &= ~USER_OP; 00158 else 00159 fr.chan |= USER_DEOP; 00160 set_user_flagrec(u, &fr, chan->dname); 00161 putlog(LOG_MISC, "*", "No longer opping %s[%s] (%s)", u->handle, whobad, 00162 reason); 00163 } 00164 /* ... or just setting to deop */ 00165 else if (u) { 00166 /* In the user list already, cool :) */ 00167 fr.match = FR_CHAN; 00168 fr.chan |= USER_DEOP; 00169 set_user_flagrec(u, &fr, chan->dname); 00170 simple_sprintf(s, "(%s) %s", ct, reason); 00171 putlog(LOG_MISC, "*", "Now deopping %s[%s] (%s)", u->handle, whobad, s); 00172 } 00173 /* ... or creating new user and setting that to deop */ 00174 else { 00175 strcpy(s1, whobad); 00176 maskaddr(s1, s, chan->ban_type); 00177 strcpy(s1, badnick); 00178 /* If that handle exists use "badX" (where X is an increasing number) 00179 * instead. 00180 */ 00181 while (get_user_by_handle(userlist, s1)) { 00182 if (!strncmp(s1, "bad", 3)) { 00183 int i; 00184 00185 i = atoi(s1 + 3); 00186 simple_sprintf(s1 + 3, "%d", i + 1); 00187 } else 00188 strcpy(s1, "bad1"); /* Start with '1' */ 00189 } 00190 userlist = adduser(userlist, s1, s, "-", 0); 00191 fr.match = FR_CHAN; 00192 fr.chan = USER_DEOP; 00193 fr.udef_chan = 0; 00194 u = get_user_by_handle(userlist, s1); 00195 if ((mx = ismember(chan, badnick))) 00196 mx->user = u; 00197 set_user_flagrec(u, &fr, chan->dname); 00198 simple_sprintf(s, "(%s) %s (%s)", ct, reason, whobad); 00199 set_user(&USERENTRY_COMMENT, u, (void *) s); 00200 putlog(LOG_MISC, "*", "Now deopping %s (%s)", whobad, reason); 00201 } 00202 } 00203 00204 /* Always try to deop the offender */ 00205 if (!mevictim) 00206 add_mode(chan, '-', 'o', badnick); 00207 /* Ban. Should be done before kicking. */ 00208 if (chan->revenge_mode > 2) { 00209 char s[UHOSTLEN], s1[UHOSTLEN]; 00210 00211 splitnick(&whobad); 00212 maskaddr(whobad, s1, chan->ban_type); 00213 simple_sprintf(s, "(%s) %s", ct, reason); 00214 u_addban(chan, s1, botnetnick, s, now + (60 * chan->ban_time), 0); 00215 if (!mevictim && HALFOP_CANDOMODE('b')) { 00216 add_mode(chan, '+', 'b', s1); 00217 flush_mode(chan, QUICK); 00218 } 00219 } 00220 /* Kick the offender */ 00221 if (!mevictim && (chan->revenge_mode > 1) && (!channel_dontkickops(chan) || 00222 (!chan_op(fr) && (!glob_op(fr) || chan_deop(fr)))) && 00223 !chan_sentkick(m) && (me_op(chan) || (me_halfop(chan) && 00224 !chan_hasop(m) && (strchr(NOHALFOPS_MODES, 'b') == NULL)))) { 00225 dprintf(DP_MODE, "KICK %s %s :%s\n", chan->name, badnick, kick_msg); 00226 m->flags |= SENTKICK; 00227 } 00228 }
static void refresh_who_chan | ( | char * | channame | ) | [static] |
Definition at line 284 of file irc.c.
References DP_MODE, dprintf, and use_354.
Referenced by got_dehalfop(), got_deop(), got_halfop(), got_op(), gotmode(), and reset_chan_info().
00285 { 00286 if (use_354) 00287 dprintf(DP_MODE, "WHO %s c%%chnuf\n", channame); 00288 else 00289 dprintf(DP_MODE, "WHO %s\n", channame); 00290 return; 00291 }
static void reset_chan_info | ( | struct chanset_t * | chan, | |
int | reset | |||
) | [static] |
Definition at line 415 of file irc.c.
References CHAN_ACTIVE, CHAN_ASKED_EXEMPTS, CHAN_ASKED_INVITED, CHAN_ASKEDBANS, CHAN_ASKEDMODES, CHAN_PEND, CHAN_RESETBANS, CHAN_RESETEXEMPTS, CHAN_RESETINVITED, CHAN_RESETMODES, CHAN_RESETTOPIC, CHAN_RESETWHO, chanset_t::channel, channel_inactive, channel_malloc(), channel_pending, clear_channel(), DP_MODE, dprintf, chanset_t::ircnet_status, chan_t::key, chanset_t::name, nfree, refresh_who_chan(), chanset_t::status, use_exempts, and use_invites.
Referenced by cmd_reset(), gotjoin(), gotpart(), msg_reset(), and recheck_channel().
00416 { 00417 char beI[4] = "\0"; 00418 /* Leave the channel if we aren't supposed to be there */ 00419 if (channel_inactive(chan)) { 00420 dprintf(DP_MODE, "PART %s\n", chan->name); 00421 return; 00422 } 00423 00424 /* Don't reset the channel if we're already resetting it */ 00425 if (channel_pending(chan)) 00426 return; 00427 00428 clear_channel(chan, reset); 00429 if ((reset & CHAN_RESETBANS) && !(chan->status & CHAN_ASKEDBANS)) { 00430 chan->status |= CHAN_ASKEDBANS; 00431 strcat(beI, "b"); 00432 } 00433 if ((reset & CHAN_RESETEXEMPTS) && 00434 !(chan->ircnet_status & CHAN_ASKED_EXEMPTS) && (use_exempts == 1)) { 00435 chan->ircnet_status |= CHAN_ASKED_EXEMPTS; 00436 strcat(beI, "e"); 00437 } 00438 if ((reset & CHAN_RESETINVITED) && 00439 !(chan->ircnet_status & CHAN_ASKED_INVITED) && (use_invites == 1)) { 00440 chan->ircnet_status |= CHAN_ASKED_INVITED; 00441 strcat(beI, "I"); 00442 } 00443 if (beI[0]) 00444 dprintf(DP_MODE, "MODE %s +%s\n", chan->name, beI); 00445 if (reset & CHAN_RESETMODES) { 00446 /* done here to keep expmem happy, as this is accounted in 00447 irc.mod, not channels.mod where clear_channel() resides */ 00448 nfree(chan->channel.key); 00449 chan->channel.key = (char *) channel_malloc (1); 00450 chan->channel.key[0] = 0; 00451 chan->status &= ~CHAN_ASKEDMODES; 00452 dprintf(DP_MODE, "MODE %s\n", chan->name); 00453 } 00454 if (reset & CHAN_RESETWHO) { 00455 chan->status |= CHAN_PEND; 00456 chan->status &= ~CHAN_ACTIVE; 00457 refresh_who_chan(chan->name); 00458 } 00459 if (reset & CHAN_RESETTOPIC) 00460 dprintf(DP_MODE, "TOPIC %s\n", chan->name); 00461 }
static void set_key | ( | struct chanset_t * | chan, | |
char * | k | |||
) | [static] |
Definition at line 259 of file irc.c.
References chanset_t::channel, channel_malloc(), chan_t::key, nfree, and NULL.
Referenced by got324(), and gotmode().
00260 { 00261 nfree(chan->channel.key); 00262 if (k == NULL) { 00263 chan->channel.key = (char *) channel_malloc(1); 00264 chan->channel.key[0] = 0; 00265 return; 00266 } 00267 chan->channel.key = (char *) channel_malloc(strlen(k) + 1); 00268 strcpy(chan->channel.key, k); 00269 }
static void status_log | ( | ) | [static] |
Definition at line 481 of file irc.c.
References chan_t::ban, chanset_t::bans, chan_hashalfop, chan_hasop, chan_hasvoice, chanset_t::channel, channel_active, channel_inactive, channel_logstatus, chanset, chanset_t::dname, chan_t::exempt, chanset_t::exempts, getchanmode(), chan_t::invite, chanset_t::invites, LOG_MISC, maskstruct::mask, me_halfop(), me_op(), me_voice(), chan_t::member, chan_t::members, maskstruct::next, memstruct::next, chanset_t::next, memstruct::nick, NULL, putlog, server_online, use_exempts, and use_invites.
Referenced by irc_close(), and irc_start().
00482 { 00483 masklist *b; 00484 memberlist *m; 00485 struct chanset_t *chan; 00486 char s[20], s2[20]; 00487 int chops, halfops, voice, nonops, bans, invites, exempts; 00488 00489 if (!server_online) 00490 return; 00491 00492 for (chan = chanset; chan != NULL; chan = chan->next) { 00493 if (channel_active(chan) && channel_logstatus(chan) && 00494 !channel_inactive(chan)) { 00495 chops = 0; 00496 voice = 0; 00497 halfops = 0; 00498 for (m = chan->channel.member; m && m->nick[0]; m = m->next) { 00499 if (chan_hasop(m)) 00500 chops++; 00501 else if (chan_hashalfop(m)) 00502 halfops++; 00503 else if (chan_hasvoice(m)) 00504 voice++; 00505 } 00506 nonops = (chan->channel.members - (chops + voice + halfops)); 00507 00508 for (bans = 0, b = chan->channel.ban; b->mask[0]; b = b->next) 00509 bans++; 00510 for (exempts = 0, b = chan->channel.exempt; b->mask[0]; b = b->next) 00511 exempts++; 00512 for (invites = 0, b = chan->channel.invite; b->mask[0]; b = b->next) 00513 invites++; 00514 00515 sprintf(s, "%d", exempts); 00516 sprintf(s2, "%d", invites); 00517 00518 putlog(LOG_MISC, chan->dname, 00519 "%s%s (%s) : [m/%d o/%d h/%d v/%d n/%d b/%d e/%s I/%s]", 00520 me_op(chan) ? "@" : me_voice(chan) ? "+" : 00521 me_halfop(chan) ? "%" : "", chan->dname, getchanmode(chan), 00522 chan->channel.members, chops, halfops, voice, nonops, bans, 00523 use_exempts ? s : "-", use_invites ? s2 : "-"); 00524 } 00525 } 00526 }
static char* traced_nettype | ( | ClientData | cdata, | |
Tcl_Interp * | irp, | |||
char * | name1, | |||
char * | name2, | |||
int | flags | |||
) | [static] |
Definition at line 1106 of file irc.c.
References do_nettype(), and NULL.
Referenced by irc_close(), irc_start(), server_close(), and server_start().
01109 { 01110 do_nettype(); 01111 return NULL; 01112 }
static char* traced_rfccompliant | ( | ClientData | cdata, | |
Tcl_Interp * | irp, | |||
char * | name1, | |||
char * | name2, | |||
int | flags | |||
) | [static] |
Definition at line 1114 of file irc.c.
References add_hook, HOOK_RFC_CASECMP, NULL, and rfc_compliant.
Referenced by irc_close(), and irc_start().
01117 { 01118 /* This hook forces eggdrop core to change the rfc_ match function 01119 * links to point to the rfc compliant versions if rfc_compliant 01120 * is 1, or to the normal version if it's 0. 01121 */ 01122 add_hook(HOOK_RFC_CASECMP, (Function) (intptr_t) rfc_compliant); 01123 return NULL; 01124 }
static int want_to_revenge | ( | struct chanset_t * | chan, | |
struct userrec * | u, | |||
struct userrec * | u2, | |||
char * | badnick, | |||
char * | victim, | |||
int | mevictim | |||
) | [static] |
Definition at line 83 of file irc.c.
References chan_deop, chan_friend, chan_op, channel_protectfriends, channel_protectops, channel_revenge, channel_revengebot, chanset_t::dname, FR_CHAN, FR_GLOBAL, get_user_flagrec, glob_friend, glob_op, match_my_nick(), and rfc_casecmp.
Referenced by maybe_revenge().
00086 { 00087 struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 }; 00088 00089 /* Do not take revenge upon ourselves. */ 00090 if (match_my_nick(badnick)) 00091 return 0; 00092 00093 get_user_flagrec(u, &fr, chan->dname); 00094 00095 /* Kickee is not a friend? */ 00096 if (!chan_friend(fr) && !glob_friend(fr) && rfc_casecmp(badnick, victim)) { 00097 if (mevictim && channel_revengebot(chan)) 00098 return 1; 00099 else if (channel_revenge(chan) && u2) { 00100 struct flag_record fr2 = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 }; 00101 00102 get_user_flagrec(u2, &fr2, chan->dname); 00103 /* Protecting friends? */ 00104 if ((channel_protectfriends(chan) && (chan_friend(fr2) || 00105 (glob_friend(fr2) && !chan_deop(fr2)))) || 00106 (channel_protectops(chan) && (chan_op(fr2) || (glob_op(fr2) && 00107 !chan_deop(fr2))))) 00108 return 1; 00109 } 00110 } 00111 return 0; 00112 }
int ban_fun = 0 [static] |
Definition at line 66 of file irc.c.
Referenced by gotmsg(), and gotnotice().
int bounce_bans = 1 [static] |
int bounce_exempts = 0 [static] |
Definition at line 52 of file irc.c.
Referenced by got_exempt().
int bounce_invites = 0 [static] |
Definition at line 53 of file irc.c.
Referenced by got_invite().
int bounce_modes = 0 [static] |
Definition at line 54 of file irc.c.
Referenced by got_ban(), got_exempt(), got_invite(), got_key(), and gotmode().
Function * channels_funcs = 0 [static] |
Definition at line 41 of file irc.c.
Referenced by irc_start().
p_tcl_bind_list H_join [static] |
p_tcl_bind_list H_kick [static] |
p_tcl_bind_list H_mode [static] |
p_tcl_bind_list H_need [static] |
p_tcl_bind_list H_nick [static] |
p_tcl_bind_list H_part [static] |
p_tcl_bind_list H_pub [static] |
p_tcl_bind_list H_pubm [static] |
p_tcl_bind_list H_rejn [static] |
p_tcl_bind_list H_sign [static] |
p_tcl_bind_list H_splt [static] |
p_tcl_bind_list H_topc [static] |
int include_lk = 1 [static] |
Definition at line 70 of file irc.c.
Referenced by do_nettype(), and real_add_mode().
int invite_key = 1 [static] |
int keepnick = 1 [static] |
int kick_fun = 0 [static] |
Definition at line 65 of file irc.c.
Referenced by gotmsg(), and gotnotice().
int kick_method = 1 [static] |
Definition at line 62 of file irc.c.
Referenced by do_nettype(), and kick_all().
int learn_users = 0 [static] |
Definition at line 55 of file irc.c.
Referenced by msg_hello(), and msg_help().
int max_bans = 20 [static] |
Definition at line 47 of file irc.c.
Referenced by do_nettype(), and real_add_mode().
int max_exempts = 20 [static] |
Definition at line 48 of file irc.c.
Referenced by do_nettype(), and real_add_mode().
int max_invites = 20 [static] |
Definition at line 49 of file irc.c.
Referenced by do_nettype(), and real_add_mode().
int max_modes = 20 [static] |
Definition at line 50 of file irc.c.
Referenced by do_nettype(), and real_add_mode().
int mode_buf_len = 200 [static] |
Definition at line 60 of file irc.c.
Referenced by real_add_mode().
int modesperline = 3 [static] |
Definition at line 59 of file irc.c.
Referenced by do_nettype(), flush_mode(), flush_modes(), real_add_mode(), and set_delay().
{ {"learn-users", &learn_users, 0}, {"wait-split", &wait_split, 0}, {"wait-info", &wait_info, 0}, {"bounce-bans", &bounce_bans, 0}, {"bounce-exempts", &bounce_exempts, 0}, {"bounce-invites", &bounce_invites, 0}, {"bounce-modes", &bounce_modes, 0}, {"modes-per-line", &modesperline, 0}, {"mode-buf-length", &mode_buf_len, 0}, {"use-354", &use_354, 0}, {"kick-method", &kick_method, 0}, {"kick-fun", &kick_fun, 0}, {"ban-fun", &ban_fun, 0}, {"invite-key", &invite_key, 0}, {"no-chanrec-info", &no_chanrec_info, 0}, {"max-bans", &max_bans, 0}, {"max-exempts", &max_exempts, 0}, {"max-invites", &max_invites, 0}, {"max-modes", &max_modes, 0}, {"net-type", &net_type, 0}, {"strict-host", &strict_host, 0}, {"ctcp-mode", &ctcp_mode, 0}, {"keep-nick", &keepnick, 0}, {"prevent-mixing", &prevent_mixing, 0}, {"rfc-compliant", &rfc_compliant, 0}, {"include-lk", &include_lk, 0}, { 0 , 0 , 0} }
int net_type [static] |
Definition at line 44 of file irc.c.
Referenced by do_nettype().
int no_chanrec_info = 0 [static] |
char opchars[8] [static] |
Definition at line 72 of file irc.c.
Referenced by got352or4(), and irc_start().
int prevent_mixing = 1 [static] |
Definition at line 68 of file irc.c.
Referenced by check_exemptlist(), and real_add_mode().
int rfc_compliant = 1 [static] |
Definition at line 69 of file irc.c.
Referenced by do_nettype(), and traced_rfccompliant().
Function * server_funcs = 0 [static] |
Definition at line 41 of file irc.c.
Referenced by irc_start().
int strict_host [static] |
int use_354 = 0 [static] |
Definition at line 61 of file irc.c.
Referenced by do_nettype(), got354(), and refresh_who_chan().
int wait_split = 300 [static] |
Definition at line 46 of file irc.c.
Referenced by check_expired_chanstuff().