31
31
static Function *global = NULL;
33
33
static int ctcp_mode;
34
static int serv; /* sock # of server currently */
35
static int strict_host; /* strict masking of hosts ? */
36
static char newserver[121]; /* new server? */
37
static int newserverport; /* new server port? */
38
static char newserverpass[121]; /* new server password? */
39
static time_t trying_server; /* trying to connect to a server right now? */
40
static int server_lag; /* how lagged (in seconds) is the server? */
41
static char altnick[NICKLEN]; /* possible alternate nickname to use */
42
static char raltnick[NICKLEN]; /* random nick created from altnick */
43
static int curserv; /* current position in server list: */
44
static int flud_thr; /* msg flood threshold */
45
static int flud_time; /* msg flood time */
46
static int flud_ctcp_thr; /* ctcp flood threshold */
47
static int flud_ctcp_time; /* ctcp flood time */
48
static char initserver[121]; /* what, if anything, to send to the
49
server on connection */
50
static char botuserhost[121]; /* bot's user@host (refreshed whenever the
51
bot joins a channel) */
52
/* may not be correct user@host BUT it's
53
how the server sees it */
54
static int keepnick; /* keep trying to regain my intended
56
static int nick_juped = 0; /* True if origbotname is juped(RPL437) (dw) */
57
static int check_stoned; /* Check for a stoned server? */
58
static int serverror_quit; /* Disconnect from server if ERROR
60
static int quiet_reject; /* Quietly reject dcc chat or sends from
61
users without access? */
62
static int waiting_for_awake; /* set when i unidle myself, cleared when
64
static time_t server_online; /* server connection time */
65
static time_t server_cycle_wait; /* seconds to wait before
66
re-beginning the server list */
67
static char botrealname[121]; /* realname of bot */
68
static int min_servs; /* minimum number of servers to be around */
69
static int server_timeout; /* server timeout for connecting */
70
static int never_give_up; /* never give up when connecting to servers? */
71
static int strict_servernames; /* don't update server list */
72
static struct server_list *serverlist; /* old-style queue, still used by
74
static int cycle_time; /* cycle time till next server connect */
75
static int default_port; /* default IRC port */
76
static char oldnick[NICKLEN]; /* previous nickname *before* rehash */
77
static int trigger_on_ignore; /* trigger bindings if user is ignored ? */
78
static int answer_ctcp; /* answer how many stacked ctcp's ? */
79
static int lowercase_ctcp; /* answer lowercase CTCP's (non-standard) */
80
static int check_mode_r; /* check for IRCNET +r modes */
34
static int serv; /* sock # of server currently */
35
static char newserver[121]; /* new server? */
36
static int newserverport; /* new server port? */
37
static char newserverpass[121]; /* new server password? */
38
static time_t trying_server; /* trying to connect to a server right now? */
39
static int server_lag; /* how lagged (in seconds) is the server? */
40
static char altnick[NICKLEN]; /* possible alternate nickname to use */
41
static char raltnick[NICKLEN]; /* random nick created from altnick */
42
static int curserv; /* current position in server list: */
43
static int flud_thr; /* msg flood threshold */
44
static int flud_time; /* msg flood time */
45
static int flud_ctcp_thr; /* ctcp flood threshold */
46
static int flud_ctcp_time; /* ctcp flood time */
47
static char initserver[121]; /* what, if anything, to send to the
48
* server on connection */
49
static char botuserhost[121]; /* bot's user@host (refreshed whenever the
50
* bot joins a channel) */
51
/* may not be correct user@host BUT it's
52
* how the server sees it */
53
static int keepnick; /* keep trying to regain my intended
55
static int nick_juped = 0; /* True if origbotname is juped(RPL437) (dw) */
56
static int check_stoned; /* Check for a stoned server? */
57
static int serverror_quit; /* Disconnect from server if ERROR
58
* messages received? */
59
static int waiting_for_awake; /* set when i unidle myself, cleared when
60
* i get the response */
61
static time_t server_online; /* server connection time */
62
static time_t server_cycle_wait; /* seconds to wait before
63
* re-beginning the server list */
64
static char botrealname[121]; /* realname of bot */
65
static int min_servs; /* minimum number of servers to be around */
66
static int server_timeout; /* server timeout for connecting */
67
static int never_give_up; /* never give up when connecting to servers? */
68
static struct server_list *serverlist; /* old-style queue, still used by
70
static int cycle_time; /* cycle time till next server connect */
71
static int default_port; /* default IRC port */
72
static char oldnick[NICKLEN]; /* previous nickname *before* rehash */
73
static int trigger_on_ignore; /* trigger bindings if user is ignored ? */
74
static int answer_ctcp; /* answer how many stacked ctcp's ? */
75
static int lowercase_ctcp; /* answer lowercase CTCP's (non-standard) */
76
static int check_mode_r; /* check for IRCnet +r modes */
81
77
static int net_type;
82
static char connectserver[121]; /* what, if anything, to do before connect
84
static int resolvserv; /* in the process of resolving a server host */
85
static int double_mode; /* allow a msgs to be twice in a queue? */
78
static char connectserver[121]; /* what, if anything, to do before connect
80
static int resolvserv; /* in the process of resolving a server host */
81
static int double_mode; /* allow a msgs to be twice in a queue? */
86
82
static int double_server;
87
83
static int double_help;
88
84
static int double_warned;
89
static int lastpingtime; /* IRCNet LAGmeter support -- drummer */
85
static int lastpingtime; /* IRCnet LAGmeter support -- drummer */
90
86
static char stackablecmds[511];
91
87
static char stackable2cmds[511];
92
88
static time_t last_time;
93
89
static int use_penalties;
94
90
static int use_fastdeq;
95
static int nick_len; /* Maximal nick length allowed on the
91
static int nick_len; /* Maximal nick length allowed on the
97
93
static int kick_method;
98
94
static int optimize_kicks;
101
static p_tcl_bind_list H_wall, H_raw, H_notc, H_msgm, H_msg, H_flud,
97
static p_tcl_bind_list H_wall, H_raw, H_notc, H_msgm, H_msg, H_flud, H_ctcr,
104
100
static void empty_msgq(void);
105
101
static void next_server(int *, char *, unsigned int *, char *);
840
putlog(LOG_MISC, "*", "!!! queuing unknown type to server!!");
845
putlog(LOG_MISC, "*", "Warning: queuing unknown type to server!");
844
849
if (h->tot < maxqmsg) {
845
850
/* Don't queue msg if it's already queued? */
847
852
for (tq = tempq.head; tq; tq = tqq) {
849
if (!egg_strcasecmp(tq->msg, buf)) {
850
if (!double_warned) {
851
if (buf[len - 1] == '\n')
853
debug1("msg already queued. skipping: %s", buf);
854
if (!egg_strcasecmp(tq->msg, buf)) {
855
if (!double_warned) {
856
debug1("Message already queued; skipping: %s", buf);
860
864
q = nmalloc(sizeof(struct msgq));
866
/* Insert into queue. */
862
868
q->next = h->head;
867
876
h->last->next = q;
874
883
q->msg = nmalloc(len + 1);
875
strncpyz(q->msg, buf, len + 1);
884
memcpy(q->msg, buf, len);
878
888
double_warned = 0;
893
putlog(LOG_SRVOUT, "*", "[!m] %s", buf);
896
putlog(LOG_SRVOUT, "*", "[!s] %s", buf);
899
putlog(LOG_SRVOUT, "*", "[!h] %s", buf);
902
putlog(LOG_SRVOUT, "*", "[!!m] %s", buf);
905
putlog(LOG_SRVOUT, "*", "[!!s] %s", buf);
908
putlog(LOG_SRVOUT, "*", "[!!h] %s", buf);
880
913
if (!h->warned) {
885
putlog(LOG_MISC, "*", "!!! OVER MAXIMUM MODE QUEUE");
891
putlog(LOG_MISC, "*", "!!! OVER MAXIMUM SERVER QUEUE");
897
putlog(LOG_MISC, "*", "!!! OVER MAXIMUM HELP QUEUE");
918
putlog(LOG_MISC, "*", "Warning: over maximum mode queue!");
924
putlog(LOG_MISC, "*", "Warning: over maximum server queue!");
930
putlog(LOG_MISC, "*", "Warning: over maximum help queue!");
905
if (buf[len - 1] == '\n')
909
putlog(LOG_SRVOUT, "*", "[!m] %s", buf);
912
putlog(LOG_SRVOUT, "*", "[!s] %s", buf);
915
putlog(LOG_SRVOUT, "*", "[!h] %s", buf);
918
putlog(LOG_SRVOUT, "*", "[!!m] %s", buf);
921
putlog(LOG_SRVOUT, "*", "[!!s] %s", buf);
924
putlog(LOG_SRVOUT, "*", "[!!h] %s", buf);
929
937
if (which == DP_MODE || which == DP_MODE_NEXT)
930
deq_msg(); /* DP_MODE needs to be sent ASAP, flush if
938
deq_msg(); /* DP_MODE needs to be sent ASAP, flush if possible. */
934
941
/* Add a new server to the server_list.
1191
1207
Tcl_SetVar2(interp, name1, name2, s, TCL_GLOBAL_ONLY);
1192
1208
if (flags & TCL_TRACE_UNSETS)
1193
1209
Tcl_TraceVar(irp, name1, TCL_TRACE_READS | TCL_TRACE_WRITES |
1194
TCL_TRACE_UNSETS, traced_server, cdata);
1198
static char *traced_botname(ClientData cdata, Tcl_Interp *irp, char *name1,
1199
char *name2, int flags)
1203
simple_sprintf(s, "%s%s%s", botname,
1204
botuserhost[0] ? "!" : "", botuserhost[0] ? botuserhost : "");
1205
Tcl_SetVar2(interp, name1, name2, s, TCL_GLOBAL_ONLY);
1206
if (flags & TCL_TRACE_UNSETS)
1207
Tcl_TraceVar(irp, name1, TCL_TRACE_READS | TCL_TRACE_WRITES |
1208
TCL_TRACE_UNSETS, traced_botname, cdata);
1210
TCL_TRACE_UNSETS, traced_serveraddress, cdata);
1214
static char *traced_server(ClientData cdata, Tcl_Interp *irp,
1215
EGG_CONST char *name1,
1216
EGG_CONST char *name2, int flags)
1220
if (server_online && realservername) {
1221
int servidx = findanyidx(serv);
1223
/* return real server name */
1224
simple_sprintf(s, "%s:%u", realservername, dcc[servidx].port);
1227
Tcl_SetVar2(interp, name1, name2, s, TCL_GLOBAL_ONLY);
1228
if (flags & TCL_TRACE_UNSETS)
1229
Tcl_TraceVar(irp, name1, TCL_TRACE_READS | TCL_TRACE_WRITES |
1230
TCL_TRACE_UNSETS, traced_server, cdata);
1234
static char *traced_botname(ClientData cdata, Tcl_Interp *irp,
1235
EGG_CONST char *name1,
1236
EGG_CONST char *name2, int flags)
1240
simple_sprintf(s, "%s%s%s", botname,
1241
botuserhost[0] ? "!" : "", botuserhost[0] ? botuserhost : "");
1242
Tcl_SetVar2(interp, name1, name2, s, TCL_GLOBAL_ONLY);
1243
if (flags & TCL_TRACE_UNSETS)
1244
Tcl_TraceVar(irp, name1, TCL_TRACE_READS | TCL_TRACE_WRITES |
1245
TCL_TRACE_UNSETS, traced_botname, cdata);
1262
1303
Tcl_SetVar2(interp, name1, name2, s, TCL_GLOBAL_ONLY);
1263
1304
if (flags & TCL_TRACE_UNSETS)
1264
1305
Tcl_TraceVar(irp, name1, TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
1265
traced_nicklen, cdata);
1306
traced_nicklen, cdata);
1267
char *cval = Tcl_GetVar2(interp, name1, name2, TCL_GLOBAL_ONLY);
1308
EGG_CONST char *cval = Tcl_GetVar2(interp, name1, name2, TCL_GLOBAL_ONLY);
1270
1311
if (cval && Tcl_ExprLong(interp, cval, &lval) != TCL_ERROR) {
1271
1312
if (lval > NICKMAX)
1273
1314
nick_len = (int) lval;
1279
static tcl_strings my_tcl_strings[] =
1281
{"botnick", NULL, 0, STR_PROTECT},
1282
{"altnick", altnick, NICKMAX, 0},
1283
{"realname", botrealname, 80, 0},
1284
{"init-server", initserver, 120, 0},
1285
{"connect-server", connectserver, 120, 0},
1286
{"stackable-commands", stackablecmds, 510, 0},
1287
{"stackable2-commands", stackable2cmds, 510, 0},
1291
static tcl_coups my_tcl_coups[] =
1293
{"flood-msg", &flud_thr, &flud_time},
1294
{"flood-ctcp", &flud_ctcp_thr, &flud_ctcp_time},
1298
static tcl_ints my_tcl_ints[] =
1300
{"use-console-r", NULL, 1},
1301
{"servlimit", &min_servs, 0},
1302
{"server-timeout", &server_timeout, 0},
1303
{"lowercase-ctcp", &lowercase_ctcp, 0},
1304
{"server-online", (int *) &server_online, 2},
1305
{"never-give-up", &never_give_up, 0},
1306
{"keep-nick", &keepnick, 0},
1307
{"strict-servernames", &strict_servernames, 0},
1308
{"check-stoned", &check_stoned, 0},
1309
{"serverror-quit", &serverror_quit, 0},
1310
{"quiet-reject", &quiet_reject, 0},
1311
{"max-queue-msg", &maxqmsg, 0},
1312
{"trigger-on-ignore", &trigger_on_ignore, 0},
1313
{"answer-ctcp", &answer_ctcp, 0},
1314
{"server-cycle-wait", (int *) &server_cycle_wait, 0},
1315
{"default-port", &default_port, 0},
1316
{"check-mode-r", &check_mode_r, 0},
1317
{"net-type", &net_type, 0},
1318
{"ctcp-mode", &ctcp_mode, 0},
1319
{"double-mode", &double_mode, 0},/* G`Quann */
1320
{"double-server", &double_server, 0},
1321
{"double-help", &double_help, 0},
1322
{"use-penalties", &use_penalties, 0},
1323
{"use-fastdeq", &use_fastdeq, 0},
1324
{"nicklen", &nick_len, 0},
1325
{"nick-len", &nick_len, 0},
1326
{"optimize-kicks", &optimize_kicks, 0},
1327
{"isjuped", &nick_juped, 0},
1320
static tcl_strings my_tcl_strings[] = {
1321
{"botnick", NULL, 0, STR_PROTECT},
1322
{"altnick", altnick, NICKMAX, 0},
1323
{"realname", botrealname, 80, 0},
1324
{"init-server", initserver, 120, 0},
1325
{"connect-server", connectserver, 120, 0},
1326
{"stackable-commands", stackablecmds, 510, 0},
1327
{"stackable2-commands", stackable2cmds, 510, 0},
1331
static tcl_coups my_tcl_coups[] = {
1332
{"flood-ctcp", &flud_ctcp_thr, &flud_ctcp_time},
1333
{"flood-msg", &flud_thr, &flud_time},
1337
static tcl_ints my_tcl_ints[] = {
1338
{"servlimit", &min_servs, 0},
1339
{"server-timeout", &server_timeout, 0},
1340
{"lowercase-ctcp", &lowercase_ctcp, 0},
1341
{"server-online", (int *) &server_online, 2},
1342
{"never-give-up", &never_give_up, 0},
1343
{"keep-nick", &keepnick, 0},
1344
{"check-stoned", &check_stoned, 0},
1345
{"serverror-quit", &serverror_quit, 0},
1346
{"max-queue-msg", &maxqmsg, 0},
1347
{"trigger-on-ignore", &trigger_on_ignore, 0},
1348
{"answer-ctcp", &answer_ctcp, 0},
1349
{"server-cycle-wait", (int *) &server_cycle_wait, 0},
1350
{"default-port", &default_port, 0},
1351
{"check-mode-r", &check_mode_r, 0},
1352
{"net-type", &net_type, 0},
1353
{"ctcp-mode", &ctcp_mode, 0},
1354
{"double-mode", &double_mode, 0},
1355
{"double-server", &double_server, 0},
1356
{"double-help", &double_help, 0},
1357
{"use-penalties", &use_penalties, 0},
1358
{"use-fastdeq", &use_fastdeq, 0},
1359
{"nicklen", &nick_len, 0},
1360
{"nick-len", &nick_len, 0},
1361
{"optimize-kicks", &optimize_kicks, 0},
1362
{"isjuped", &nick_juped, 0},
1363
{"stack-limit", &stack_limit, 0},
1566
1603
cycle_time = 100;
1567
1604
if (server_online) {
1568
1605
dprintf(-serv, "QUIT :%s\n", quit_msg[0] ? quit_msg : "");
1569
sleep(3); /* Give the server time to understand */
1606
sleep(3); /* Give the server time to understand */
1571
1608
nuke_server(NULL);
1574
/* A report on the module status.
1612
static void msgq_clear(struct msgq_head *qh)
1614
register struct msgq *q, *qq;
1616
for (q = qh->head; q; q = qq) {
1621
qh->head = qh->last = NULL;
1622
qh->tot = qh->warned = 0;
1625
static int msgq_expmem(struct msgq_head *qh)
1627
register int tot = 0;
1628
register struct msgq *m;
1630
for (m = qh->head; m; m = m->next) {
1632
tot += sizeof(struct msgq);
1637
static int server_expmem()
1640
struct server_list *s = serverlist;
1642
for (; s; s = s->next) {
1644
tot += strlen(s->name) + 1;
1646
tot += strlen(s->pass) + 1;
1648
tot += strlen(s->realname) + 1;
1649
tot += sizeof(struct server_list);
1653
tot += strlen(realservername) + 1;
1654
tot += msgq_expmem(&mq) + msgq_expmem(&hq) + msgq_expmem(&modeq);
1576
1659
static void server_report(int idx, int details)
1578
1661
char s1[64], s[128];
1581
1664
if (server_online) {
1582
dprintf(idx, " Online as: %s%s%s (%s)\n", botname,
1583
botuserhost[0] ? "!" : "", botuserhost[0] ? botuserhost : "",
1665
dprintf(idx, " Online as: %s%s%s (%s)\n", botname, botuserhost[0] ?
1666
"!" : "", botuserhost[0] ? botuserhost : "", botrealname);
1585
1667
if (nick_juped)
1586
dprintf(idx, " NICK IS JUPED: %s %s\n", origbotname,
1587
keepnick ? "(trying)" : "");
1588
nick_juped = 0; /* WHY?? -- drummer */
1668
dprintf(idx, " NICK IS JUPED: %s%s\n", origbotname,
1669
keepnick ? " (trying)" : "");
1589
1670
daysdur(now, server_online, s1);
1590
1671
egg_snprintf(s, sizeof s, "(connected %s)", s1);
1591
1672
if (server_lag && !waiting_for_awake) {
1592
if (server_lag == (-1))
1593
egg_snprintf(s1, sizeof s1, " (bad pong replies)");
1673
if (server_lag == -1)
1674
egg_snprintf(s1, sizeof s1, " (bad pong replies)");
1595
egg_snprintf(s1, sizeof s1, " (lag: %ds)", server_lag);
1676
egg_snprintf(s1, sizeof s1, " (lag: %ds)", server_lag);
1599
1681
if ((trying_server || server_online) &&
1600
((servidx = findanyidx(serv)) != (-1))) {
1682
((servidx = findanyidx(serv)) != -1)) {
1601
1683
dprintf(idx, " Server %s:%d %s\n", dcc[servidx].host, dcc[servidx].port,
1602
trying_server ? "(trying)" : s);
1684
trying_server ? "(trying)" : s);
1604
1686
dprintf(idx, " %s\n", IRC_NOSERVER);
1606
dprintf(idx, " %s %d%%, %d msgs\n", IRC_MODEQUEUE,
1689
dprintf(idx, " %s %d%% (%d msgs)\n", IRC_MODEQUEUE,
1607
1690
(int) ((float) (modeq.tot * 100.0) / (float) maxqmsg),
1610
dprintf(idx, " %s %d%%, %d msgs\n", IRC_SERVERQUEUE,
1611
(int) ((float) (mq.tot * 100.0) / (float) maxqmsg), (int) mq.tot);
1693
dprintf(idx, " %s %d%% (%d msgs)\n", IRC_SERVERQUEUE,
1694
(int) ((float) (mq.tot * 100.0) / (float) maxqmsg), (int) mq.tot);
1613
dprintf(idx, " %s %d%%, %d msgs\n", IRC_HELPQUEUE,
1614
(int) ((float) (hq.tot * 100.0) / (float) maxqmsg), (int) hq.tot);
1696
dprintf(idx, " %s %d%% (%d msgs)\n", IRC_HELPQUEUE,
1697
(int) ((float) (hq.tot * 100.0) / (float) maxqmsg), (int) hq.tot);
1700
int size = server_expmem();
1617
dprintf(idx, " Requiring a net of at least %d server(s)\n", min_servs);
1703
dprintf(idx, " Requiring a network with at least %d server%s\n",
1704
min_servs, (min_servs != 1) ? "s" : "");
1618
1705
if (initserver[0])
1619
1706
dprintf(idx, " On connect, I do: %s\n", initserver);
1620
1707
if (connectserver[0])
1621
1708
dprintf(idx, " Before connect, I do: %s\n", connectserver);
1622
dprintf(idx, " Flood is: %d msg/%ds, %d ctcp/%ds\n",
1623
flud_thr, flud_time, flud_ctcp_thr, flud_ctcp_time);
1627
static void msgq_clear(struct msgq_head *qh)
1629
register struct msgq *q, *qq;
1631
for (q = qh->head; q; q = qq) {
1636
qh->head = qh->last = NULL;
1637
qh->tot = qh->warned = 0;
1640
static int msgq_expmem(struct msgq_head *qh)
1642
register int tot = 0;
1643
register struct msgq *m;
1645
for (m = qh->head; m; m = m->next) {
1647
tot += sizeof(struct msgq);
1652
static int server_expmem()
1655
struct server_list *s = serverlist;
1657
for (; s; s = s->next) {
1659
tot += strlen(s->name) + 1;
1661
tot += strlen(s->pass) + 1;
1663
tot += strlen(s->realname) + 1;
1664
tot += sizeof(struct server_list);
1667
tot += msgq_expmem(&mq) + msgq_expmem(&hq) + msgq_expmem(&modeq);
1672
static cmd_t my_ctcps[] =
1674
{"DCC", "", ctcp_DCC_CHAT, "server:DCC"},
1675
{NULL, NULL, NULL, NULL}
1709
dprintf(idx, " Msg flood: %d msg%s/%d second%s\n", flud_thr,
1710
(flud_thr != 1) ? "s" : "", flud_time,
1711
(flud_time != 1) ? "s" : "");
1712
dprintf(idx, " CTCP flood: %d msg%s/%d second%s\n", flud_ctcp_thr,
1713
(flud_ctcp_thr != 1) ? "s" : "", flud_ctcp_time,
1714
(flud_ctcp_time != 1) ? "s" : "");
1715
dprintf(idx, " Using %d byte%s of memory\n", size,
1716
(size != 1) ? "s" : "");
1720
static cmd_t my_ctcps[] = {
1721
{"DCC", "", ctcp_DCC_CHAT, "server:DCC"},
1722
{NULL, NULL, NULL, NULL}
1678
1725
static char *server_close()
1698
1745
rem_help_reference("server.help");
1699
1746
rem_tcl_commands(my_tcl_cmds);
1700
1747
Tcl_UntraceVar(interp, "nick",
1701
TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
1748
TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
1703
1750
Tcl_UntraceVar(interp, "altnick",
1704
TCL_TRACE_WRITES | TCL_TRACE_UNSETS, altnick_change, NULL);
1751
TCL_TRACE_WRITES | TCL_TRACE_UNSETS, altnick_change, NULL);
1705
1752
Tcl_UntraceVar(interp, "botname",
1706
TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
1707
traced_botname, NULL);
1753
TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
1754
traced_botname, NULL);
1708
1755
Tcl_UntraceVar(interp, "server",
1709
TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
1710
traced_server, NULL);
1756
TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
1757
traced_server, NULL);
1758
Tcl_UntraceVar(interp, "serveraddress",
1759
TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
1760
traced_serveraddress, NULL);
1711
1761
Tcl_UntraceVar(interp, "net-type",
1712
TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
1713
traced_nettype, NULL);
1762
TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
1763
traced_nettype, NULL);
1714
1764
Tcl_UntraceVar(interp, "nick-len",
1715
TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
1716
traced_nicklen, NULL);
1765
TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
1766
traced_nicklen, NULL);
1717
1767
tcl_untraceserver("servers", NULL);
1719
1769
del_hook(HOOK_SECONDLY, (Function) server_secondly);
1730
1780
EXPORT_SCOPE char *server_start();
1732
static Function server_table[] =
1782
static Function server_table[] = {
1734
1783
(Function) server_start,
1735
1784
(Function) server_close,
1736
1785
(Function) server_expmem,
1737
1786
(Function) server_report,
1739
(Function) NULL, /* char * (points to botname later on) */
1740
(Function) botuserhost, /* char * */
1741
(Function) & quiet_reject, /* int */
1742
(Function) & serv, /* int */
1788
(Function) NULL, /* char * (points to botname later on) */
1789
(Function) botuserhost, /* char * */
1790
(Function) NULL, /* Was quiet_reject <Wcc[01/21/03]>. */
1791
(Function) & serv, /* int */
1744
(Function) & flud_thr, /* int */
1745
(Function) & flud_time, /* int */
1746
(Function) & flud_ctcp_thr, /* int */
1747
(Function) & flud_ctcp_time, /* int */
1793
(Function) & flud_thr, /* int */
1794
(Function) & flud_time, /* int */
1795
(Function) & flud_ctcp_thr, /* int */
1796
(Function) & flud_ctcp_time, /* int */
1749
1798
(Function) match_my_nick,
1750
1799
(Function) check_tcl_flud,
1751
(Function) NULL, /* fixfrom - moved to the core (drummer) */
1752
(Function) & answer_ctcp, /* int */
1800
(Function) NULL, /* fixfrom - moved to core (drummer) */
1801
(Function) & answer_ctcp, /* int */
1754
(Function) & trigger_on_ignore, /* int */
1803
(Function) & trigger_on_ignore, /* int */
1755
1804
(Function) check_tcl_ctcpr,
1756
1805
(Function) detect_avalanche,
1757
1806
(Function) nuke_server,
1759
(Function) newserver, /* char * */
1760
(Function) & newserverport, /* int */
1761
(Function) newserverpass, /* char * */
1808
(Function) newserver, /* char * */
1809
(Function) & newserverport, /* int */
1810
(Function) newserverpass, /* char * */
1811
(Function) & cycle_time, /* int */
1763
(Function) & cycle_time, /* int */
1764
(Function) & default_port, /* int */
1765
(Function) & server_online, /* int */
1766
(Function) & min_servs, /* int */
1813
(Function) & default_port, /* int */
1814
(Function) & server_online, /* int */
1815
(Function) & min_servs, /* int */
1816
(Function) & H_raw, /* p_tcl_bind_list */
1768
(Function) & H_raw, /* p_tcl_bind_list */
1769
(Function) & H_wall, /* p_tcl_bind_list */
1770
(Function) & H_msg, /* p_tcl_bind_list */
1771
(Function) & H_msgm, /* p_tcl_bind_list */
1818
(Function) & H_wall, /* p_tcl_bind_list */
1819
(Function) & H_msg, /* p_tcl_bind_list */
1820
(Function) & H_msgm, /* p_tcl_bind_list */
1821
(Function) & H_notc, /* p_tcl_bind_list */
1773
(Function) & H_notc, /* p_tcl_bind_list */
1774
(Function) & H_flud, /* p_tcl_bind_list */
1775
(Function) & H_ctcp, /* p_tcl_bind_list */
1776
(Function) & H_ctcr, /* p_tcl_bind_list */
1823
(Function) & H_flud, /* p_tcl_bind_list */
1824
(Function) & H_ctcp, /* p_tcl_bind_list */
1825
(Function) & H_ctcr, /* p_tcl_bind_list */
1778
1826
(Function) ctcp_reply,
1779
(Function) get_altbotnick, /* char * */
1780
(Function) & nick_len, /* int */
1828
(Function) get_altbotnick, /* char * */
1829
(Function) & nick_len, /* int */
1781
1830
(Function) check_tcl_notc
1784
1833
char *server_start(Function *global_funcs)
1788
1837
global = global_funcs;
1858
1906
strncpyz(origbotname, s, NICKLEN);
1859
1907
Tcl_TraceVar(interp, "nick",
1860
TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
1908
TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
1862
1910
Tcl_TraceVar(interp, "altnick",
1863
TCL_TRACE_WRITES | TCL_TRACE_UNSETS, altnick_change, NULL);
1911
TCL_TRACE_WRITES | TCL_TRACE_UNSETS, altnick_change, NULL);
1864
1912
Tcl_TraceVar(interp, "botname",
1865
TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
1866
traced_botname, NULL);
1913
TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
1914
traced_botname, NULL);
1867
1915
Tcl_TraceVar(interp, "server",
1868
TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
1869
traced_server, NULL);
1916
TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
1917
traced_server, NULL);
1918
Tcl_TraceVar(interp, "serveraddress",
1919
TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
1920
traced_serveraddress, NULL);
1870
1921
Tcl_TraceVar(interp, "net-type",
1871
TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
1872
traced_nettype, NULL);
1922
TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
1923
traced_nettype, NULL);
1873
1924
Tcl_TraceVar(interp, "nick-len",
1874
TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
1875
traced_nicklen, NULL);
1925
TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
1926
traced_nicklen, NULL);
1877
1928
H_wall = add_bind_table("wall", HT_STACKABLE, server_2char);
1878
1929
H_raw = add_bind_table("raw", HT_STACKABLE, server_raw);
1879
H_notc = add_bind_table("notc", HT_STACKABLE, server_6char);
1930
H_notc = add_bind_table("notc", HT_STACKABLE, server_5char);
1880
1931
H_msgm = add_bind_table("msgm", HT_STACKABLE, server_msg);
1881
1932
H_msg = add_bind_table("msg", 0, server_msg);
1882
1933
H_flud = add_bind_table("flud", HT_STACKABLE, server_5char);