summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile4
-rw-r--r--src/actions.c16
-rw-r--r--src/bahamut.c196
-rw-r--r--src/base64.c125
-rw-r--r--src/botserv.c80
-rw-r--r--src/channels.c214
-rw-r--r--src/chanserv.c74
-rw-r--r--src/config.c13
-rw-r--r--src/dreamforge.c132
-rw-r--r--src/hostserv.c7
-rw-r--r--src/hybrid.c242
-rw-r--r--src/init.c31
-rw-r--r--src/main.c5
-rw-r--r--src/memoserv.c3
-rw-r--r--src/messages.c25
-rw-r--r--src/misc.c58
-rw-r--r--src/modules.c20
-rw-r--r--src/modules/ircd_catserv.c9
-rw-r--r--src/mysql.c1
-rw-r--r--src/nickserv.c38
-rw-r--r--src/operserv.c15
-rw-r--r--src/ptlink.c365
-rw-r--r--src/rageircd.c173
-rw-r--r--src/servers.c63
-rw-r--r--src/ultimate2.c235
-rw-r--r--src/ultimate3.c213
-rw-r--r--src/unreal31.c84
-rw-r--r--src/unreal32.c657
-rw-r--r--src/users.c68
-rw-r--r--src/viagra.c211
30 files changed, 2874 insertions, 503 deletions
diff --git a/src/Makefile b/src/Makefile
index 7db726aa3..dd672c721 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,13 +1,13 @@
MYSQL_OBJ = $(MYSQL:.c=.o)
RDB_OBJ = $(RDB:.c=.o)
-OBJS = actions.o botserv.o channels.o chanserv.o commands.o compat.o converter.o \
+OBJS = actions.o base64.o botserv.o channels.o chanserv.o commands.o compat.o converter.o \
config.o datafiles.o encrypt.o helpserv.o hostserv.o init.o language.o list.o log.o mail.o main.o \
memory.o memoserv.o messages.o misc.o modules.o news.o nickserv.o operserv.o \
process.o proxy.o send.o servers.o sessions.o slist.o sockutil.o \
timeout.o users.o dreamforge.o bahamut.o unreal31.o ultimate2.o ultimate3.o \
hybrid.o ptlink.o viagra.o rageircd.o unreal32.o \
$(VSNPRINTF_O) $(RDB_OBJ) $(MYSQL_OBJ)
-SRCS = actions.c botserv.c channels.c chanserv.c commands.c compat.c converter.c \
+SRCS = actions.c base64.c botserv.c channels.c chanserv.c commands.c compat.c converter.c \
config.c datafiles.c encrypt.c helpserv.c hostserv.c init.c language.c list.c log.c mail.c main.c \
memory.c memoserv.c messages.c misc.c modules.c news.c nickserv.c operserv.c \
process.c proxy.c send.c servers.c sessions.c slist.c sockutil.c \
diff --git a/src/actions.c b/src/actions.c
index a863eae76..1cfcdf2e1 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -113,12 +113,16 @@ void common_unban(ChannelInfo * ci, char *nick)
int count, i;
char *av[3], **bans;
User *u;
+ char *host;
- if (!ci || !ci->c || !ci->bi || !nick)
+ if (!ci || !ci->c || !nick)
return;
+
if (!(u = finduser(nick)))
return;
+ host = host_resolve(u->host);
+
if (ircd->svsmode_unban) {
anope_cmd_unban(ci->name, nick);
} else {
@@ -131,7 +135,15 @@ void common_unban(ChannelInfo * ci, char *nick)
if (match_usermask(bans[i], u)) {
anope_cmd_mode(whosends(ci), ci->name, "-b %s", bans[i]);
av[2] = bans[i];
- do_cmode(ci->bi->nick, 3, av);
+ do_cmode(whosends(ci), 3, av);
+ }
+ if (host) {
+ if (match_userip(bans[i], u, host)) {
+ anope_cmd_mode(whosends(ci), ci->name, "-b %s",
+ bans[i]);
+ av[2] = bans[i];
+ do_cmode(whosends(ci), 3, av);
+ }
}
}
free(bans);
diff --git a/src/bahamut.c b/src/bahamut.c
index 468d3be46..e54627faf 100644
--- a/src/bahamut.c
+++ b/src/bahamut.c
@@ -91,6 +91,9 @@ IRCDVar ircd[] = {
1,
1, /* No Knock requires +i */
NULL, /* CAPAB Chan Modes */
+ 0, /* We support TOKENS */
+ 1, /* TOKENS are CASE inSensitive */
+ 1, /* validate - to the #:# standard */
}
,
{NULL}
@@ -195,29 +198,55 @@ void anope_set_umode(User * user, int ac, char **av)
}
-
-
unsigned long umodes[128] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, UMODE_A, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0,
- 0,
- UMODE_R,
- 0, 0, 0, 0, 0, 0, 0,
- 0,
- 0, 0, 0, 0, 0,
- 0, UMODE_a, 0, 0, 0, 0, 0,
- 0,
- UMODE_h, UMODE_i, 0, 0, 0, 0, 0, UMODE_o,
- 0,
- 0, UMODE_r, 0, 0, 0, 0, UMODE_w,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0
+ 0, 0, 0, /* Unused */
+ 0, 0, 0, /* Unused */
+ 0, 0, 0, /* Unused, Unused, Horzontal Tab */
+ 0, 0, 0, /* Line Feed, Unused, Unused */
+ 0, 0, 0, /* Carriage Return, Unused, Unused */
+ 0, 0, 0, /* Unused */
+ 0, 0, 0, /* Unused */
+ 0, 0, 0, /* Unused */
+ 0, 0, 0, /* Unused */
+ 0, 0, 0, /* Unused */
+ 0, 0, 0, /* Unused, Unused, Space */
+ 0, 0, 0, /* ! " # */
+ 0, 0, 0, /* $ % & */
+ 0, 0, 0, /* ! ( ) */
+ 0, 0, 0, /* * + , */
+ 0, 0, 0, /* - . / */
+ 0, 0, /* 0 1 */
+ 0, 0, /* 2 3 */
+ 0, 0, /* 4 5 */
+ 0, 0, /* 6 7 */
+ 0, 0, /* 8 9 */
+ 0, 0, /* : ; */
+ 0, 0, 0, /* < = > */
+ 0, 0, /* ? @ */
+ UMODE_A, 0, 0, /* A B C */
+ UMODE_D, 0, UMODE_F, /* D E F */
+ 0, 0, UMODE_I, /* G H I */
+ 0, UMODE_K, 0, /* J K L */
+ 0, 0, UMODE_O, /* M N O */
+ 0, 0, UMODE_R, /* P Q R */
+ 0, 0, 0, /* S T U */
+ 0, 0, UMODE_X, /* V W X */
+ 0, /* Y */
+ 0, /* Z */
+ 0, 0, 0, /* [ \ ] */
+ 0, 0, 0, /* ^ _ ` */
+ UMODE_a, UMODE_b, UMODE_c, /* a b c */
+ UMODE_d, UMODE_e, UMODE_f, /* d e f */
+ UMODE_g, UMODE_h, UMODE_i, /* g h i */
+ UMODE_j, UMODE_k, 0, /* j k l */
+ UMODE_m, UMODE_n, UMODE_o, /* m n o */
+ 0, 0, UMODE_r, /* p q r */
+ UMODE_s, 0, 0, /* s t u */
+ 0, 0, UMODE_x, /* v w x */
+ UMODE_y, /* y */
+ 0, /* z */
+ 0, 0, 0, /* { | } */
+ 0, 0 /* ~ ‚ */
};
char csmodes[128] = {
@@ -505,7 +534,7 @@ int anope_event_os(char *source, int ac, char **av)
{
if (ac < 1)
return MOD_CONT;
- m_privmsg(source, av[0], av[1]);
+ m_privmsg(source, s_OperServ, av[0]);
return MOD_CONT;
}
@@ -514,7 +543,7 @@ int anope_event_ns(char *source, int ac, char **av)
{
if (ac < 1)
return MOD_CONT;
- m_privmsg(source, av[0], av[1]);
+ m_privmsg(source, s_NickServ, av[0]);
return MOD_CONT;
}
@@ -523,7 +552,7 @@ int anope_event_ms(char *source, int ac, char **av)
{
if (ac < 1)
return MOD_CONT;
- m_privmsg(source, av[0], av[1]);
+ m_privmsg(source, s_MemoServ, av[0]);
return MOD_CONT;
}
@@ -532,7 +561,7 @@ int anope_event_hs(char *source, int ac, char **av)
{
if (ac < 1)
return MOD_CONT;
- m_privmsg(source, av[0], av[1]);
+ m_privmsg(source, s_HostServ, av[0]);
return MOD_CONT;
}
@@ -541,7 +570,7 @@ int anope_event_cs(char *source, int ac, char **av)
{
if (ac < 1)
return MOD_CONT;
- m_privmsg(source, av[0], av[1]);
+ m_privmsg(source, s_ChanServ, av[0]);
return MOD_CONT;
}
@@ -570,7 +599,7 @@ void moduleAddIRCDMsgs(void) {
m = createMessage("NICK", anope_event_nick); addCoreMessage(IRCD,m);
m = createMessage("NOTICE", anope_event_notice); addCoreMessage(IRCD,m);
m = createMessage("PART", anope_event_part); addCoreMessage(IRCD,m);
- m = createMessage("PASS", NULL); addCoreMessage(IRCD,m);
+ m = createMessage("PASS", anope_event_pass); addCoreMessage(IRCD,m);
m = createMessage("PING", anope_event_ping); addCoreMessage(IRCD,m);
m = createMessage("PRIVMSG", anope_event_privmsg); addCoreMessage(IRCD,m);
m = createMessage("QUIT", anope_event_quit); addCoreMessage(IRCD,m);
@@ -582,7 +611,7 @@ void moduleAddIRCDMsgs(void) {
m = createMessage("WHOIS", anope_event_whois); addCoreMessage(IRCD,m);
m = createMessage("AKILL", NULL); addCoreMessage(IRCD,m);
m = createMessage("GLOBOPS", NULL); addCoreMessage(IRCD,m);
- m = createMessage("GNOTICE", NULL); addCoreMessage(IRCD,m);
+ m = createMessage("GNOTICE", anope_event_gnotice); addCoreMessage(IRCD,m);
m = createMessage("GOPER", NULL); addCoreMessage(IRCD,m);
m = createMessage("RAKILL", NULL); addCoreMessage(IRCD,m);
m = createMessage("SILENCE", NULL); addCoreMessage(IRCD,m);
@@ -590,7 +619,7 @@ void moduleAddIRCDMsgs(void) {
m = createMessage("SVSMODE", NULL); addCoreMessage(IRCD,m);
m = createMessage("SVSNICK", NULL); addCoreMessage(IRCD,m);
m = createMessage("SVSNOOP", NULL); addCoreMessage(IRCD,m);
- m = createMessage("SQLINE", NULL); addCoreMessage(IRCD,m);
+ m = createMessage("SQLINE", anope_event_sqline); addCoreMessage(IRCD,m);
m = createMessage("UNSQLINE", NULL); addCoreMessage(IRCD,m);
m = createMessage("CAPAB", anope_event_capab); addCoreMessage(IRCD,m);
m = createMessage("CS", anope_event_cs); addCoreMessage(IRCD,m);
@@ -607,6 +636,9 @@ void moduleAddIRCDMsgs(void) {
m = createMessage("UNSGLINE", NULL); addCoreMessage(IRCD,m);
m = createMessage("UNSZLINE", NULL); addCoreMessage(IRCD,m);
m = createMessage("ERROR", anope_event_error); addCoreMessage(IRCD,m);
+ m = createMessage("LUSERSLOCK",anope_event_luserslock); addCoreMessage(IRCD,m);
+ m = createMessage("BURST", anope_event_burst); addCoreMessage(IRCD,m);
+ m = createMessage("ADMIN", anope_event_admin); addCoreMessage(IRCD,m);
}
@@ -646,6 +678,11 @@ void anope_cmd_svsnoop(char *server, int set)
send_cmd(NULL, "SVSNOOP %s %s", server, (set ? "+" : "-"));
}
+void anope_cmd_svsadmin(char *server, int set)
+{
+ anope_cmd_svsnoop(server, set);
+}
+
/* SGLINE */
void anope_cmd_sgline(char *mask, char *reason)
{
@@ -760,6 +797,11 @@ void anope_cmd_svsmode(User * u, int ac, char **av)
}
/* SQUIT */
+/*
+ * parv[0] = sender prefix
+ * parv[1] = server name
+ * parv[2] = comment
+*/
void anope_cmd_squit(char *servname, char *message)
{
send_cmd(servname, "SQUIT %s :%s", servname, message);
@@ -783,9 +825,18 @@ void anope_cmd_connect(int servernum)
anope_cmd_capab();
anope_cmd_server(ServerName, 1, ServerDesc);
anope_cmd_svinfo();
+ anope_cmd_burst();
}
-/* SVINFO */
+
+/*
+ * SVINFO
+ * parv[0] = sender prefix
+ * parv[1] = TS_CURRENT for the server
+ * parv[2] = TS_MIN for the server
+ * parv[3] = server is standalone or connected to non-TS only
+ * parv[4] = server's idea of UTC time
+ */
void anope_cmd_svinfo()
{
send_cmd(NULL, "SVINFO 3 1 0 :%ld", time(NULL));
@@ -806,7 +857,8 @@ void anope_cmd_server(char *servname, int hop, char *descript)
/* CAPAB */
void anope_cmd_capab()
{
- send_cmd(NULL, "CAPAB NICKIP SSJOIN TS3 NOQUIT TSMODE UNCONNECT");
+ send_cmd(NULL,
+ "CAPAB SSJOIN NOQUIT BURST UNCONNECT NICKIP TSMODE TS3");
}
/* EVENT : SERVER */
@@ -818,7 +870,7 @@ int anope_event_server(char *source, int ac, char **av)
uplink = sstrdup(av[0]);
}
- do_server(source, ac, av);
+ do_server(source, av[0], av[1], av[2], NULL);
return MOD_CONT;
}
@@ -1233,6 +1285,7 @@ void anope_cmd_211(const char *fmt, ...)
void anope_cmd_nick(char *nick, char *name, char *modes)
{
+ EnforceQlinedNick(nick, NULL);
send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s 0 0 :%s", nick, time(NULL),
modes, ServiceUser, ServiceHost, ServerName, name);
anope_cmd_sqline(nick, "Reserved for services");
@@ -1340,6 +1393,7 @@ void anope_cmd_351(char *source)
void anope_cmd_bot_nick(char *nick, char *user, char *host, char *real,
char *modes)
{
+ EnforceQlinedNick(nick, s_BotServ);
send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s 0 0 :%s", nick, time(NULL),
modes, user, host, ServerName, real);
anope_cmd_sqline(nick, "Reserved for services");
@@ -1443,4 +1497,80 @@ int anope_event_sqline(char *source, int ac, char **av)
}
+int anope_event_gnotice(char *source, int ac, char **av)
+{
+ return MOD_CONT;
+}
+
+int anope_event_pass(char *source, int ac, char **av)
+{
+ return MOD_CONT;
+}
+
+void anope_cmd_svsjoin(char *source, char *nick, char *chan)
+{
+ /* Can not find any reference to these in Bahamut */
+}
+
+void anope_cmd_svspart(char *source, char *nick, char *chan)
+{
+ /* Can not find any reference to these in Bahamut */
+}
+
+void anope_cmd_swhois(char *source, char *who, char *mask)
+{
+ /* not supported */
+}
+
+
+void anope_cmd_burst()
+{
+ send_cmd(NULL, "BURST");
+}
+
+void anope_cmd_eob()
+{
+ send_cmd(NULL, "BURST 0");
+}
+
+int anope_event_burst(char *source, int ac, char **av)
+{
+ Server *s;
+ s = findserver(servlist, source);
+ if (!ac) {
+ /* for future use - start burst */
+ } else {
+ if (s) {
+ s->sync = 1;
+ }
+ }
+ return MOD_CONT;
+}
+
+int anope_event_luserslock(char *source, int ac, char **av)
+{
+ return MOD_CONT;
+}
+
+int anope_event_rehash(char *source, int ac, char **av)
+{
+ return MOD_CONT;
+}
+
+int anope_event_credits(char *source, int ac, char **av)
+{
+ return MOD_CONT;
+}
+
+int anope_event_admin(char *source, int ac, char **av)
+{
+ return MOD_CONT;
+}
+
+int anope_flood_mode_check(char *value)
+{
+ return 0;
+}
+
+
#endif
diff --git a/src/base64.c b/src/base64.c
new file mode 100644
index 000000000..f17550bba
--- /dev/null
+++ b/src/base64.c
@@ -0,0 +1,125 @@
+/* base64 routines.
+ *
+ * (C) 2003 Anope Team
+ * Contact us at info@anope.org
+ *
+ * Please read COPYING and README for furhter details.
+ *
+ * Based on the original code of Epona by Lara.
+ * Based on the original code of Services by Andy Church.
+ *
+ *
+ */
+
+/*
+ This is borrowed from Unreal
+*/
+
+#include "services.h"
+
+static char *int_to_base64(long);
+static long base64_to_int(char *);
+
+char *base64enc(long i)
+{
+ if (i < 0)
+ return ("0");
+ return int_to_base64(i);
+}
+
+long base64dec(char *b64)
+{
+ if (b64)
+ return base64_to_int(b64);
+ else
+ return 0;
+}
+
+/* ':' and '#' and '&' and '+' and '@' must never be in this table. */
+/* these tables must NEVER CHANGE! >) */
+char int6_to_base64_map[] = {
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D',
+ 'E', 'F',
+ 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
+ 'U', 'V',
+ 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
+ 'k', 'l',
+ 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
+ '{', '}'
+};
+
+char base64_to_int6_map[] = {
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1,
+ -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1,
+ -1, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
+ 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, -1, 63, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
+};
+
+static char *int_to_base64(long val)
+{
+ /* 32/6 == max 6 bytes for representation,
+ * +1 for the null, +1 for byte boundaries
+ */
+ static char base64buf[8];
+ long i = 7;
+
+ base64buf[i] = '\0';
+
+ /* Temporary debugging code.. remove before 2038 ;p.
+ * This might happen in case of 64bit longs (opteron/ia64),
+ * if the value is then too large it can easily lead to
+ * a buffer underflow and thus to a crash. -- Syzop
+ */
+ if (val > 2147483647L) {
+ abort();
+ }
+
+ do {
+ base64buf[--i] = int6_to_base64_map[val & 63];
+ }
+ while (val >>= 6);
+
+ return base64buf + i;
+}
+
+static long base64_to_int(char *b64)
+{
+ int v = base64_to_int6_map[(u_char) * b64++];
+
+ if (!b64)
+ return 0;
+
+ while (*b64) {
+ v <<= 6;
+ v += base64_to_int6_map[(u_char) * b64++];
+ }
+
+ return v;
+}
+
+long base64dects(char *ts)
+{
+ char *token;
+
+ if (!ts) {
+ return 0;
+ }
+ token = myStrGetToken(ts, '!', 1);
+
+ if (!token) {
+ return strtoul(ts, NULL, 10);;
+ }
+ return base64dec(token);
+}
diff --git a/src/botserv.c b/src/botserv.c
index 03fdafdf5..d38ab917c 100644
--- a/src/botserv.c
+++ b/src/botserv.c
@@ -1236,46 +1236,9 @@ static int do_bot(User * u)
**/
/* Check whether it's a services client's nick and return if so - Certus */
+ /* use nickIsServices reduce the total number lines of code - TSL */
- if ((s_NickServ && (stricmp(nick, s_NickServ) == 0))
- || (s_NickServAlias && !stricmp(nick, s_NickServAlias))) {
- notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED);
- return MOD_CONT;
- } else if ((s_ChanServ && (stricmp(nick, s_ChanServ) == 0))
- || (s_ChanServAlias
- && !stricmp(nick, s_ChanServAlias))) {
- notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED);
- return MOD_CONT;
- } else if ((s_MemoServ && (stricmp(nick, s_MemoServ) == 0))
- || (s_MemoServAlias
- && !stricmp(nick, s_MemoServAlias))) {
- notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED);
- return MOD_CONT;
- } else if ((s_BotServ && (stricmp(nick, s_BotServ) == 0))
- || (s_BotServAlias
- && !stricmp(nick, s_BotServAlias))) {
- notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED);
- return MOD_CONT;
- } else if ((s_HelpServ && (stricmp(nick, s_HelpServ) == 0))
- || (s_HelpServAlias
- && !stricmp(nick, s_HelpServAlias))) {
- notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED);
- return MOD_CONT;
- } else if ((s_OperServ && (stricmp(nick, s_OperServ) == 0))
- || (s_OperServAlias
- && !stricmp(nick, s_OperServAlias))) {
- notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED);
- return MOD_CONT;
- } else
- if ((s_GlobalNoticer
- && (stricmp(nick, s_GlobalNoticer) == 0))
- || (s_GlobalNoticerAlias
- && !stricmp(nick, s_GlobalNoticerAlias))) {
- notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED);
- return MOD_CONT;
- } else if ((s_HostServ && (stricmp(nick, s_HostServ) == 0))
- || (s_HostServAlias
- && !stricmp(nick, s_HostServAlias))) {
+ if (nickIsServices(nick, 0)) {
notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED);
return MOD_CONT;
}
@@ -1342,43 +1305,8 @@ static int do_bot(User * u)
}
/* Check whether it's a services client's nick and return if so - Certus */
- if ((s_NickServ && !stricmp(nick, s_NickServ))
- || (s_NickServAlias && !stricmp(nick, s_NickServAlias))) {
- notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED);
- return MOD_CONT;
- } else if ((s_ChanServ && !stricmp(nick, s_ChanServ))
- || (s_ChanServAlias
- && !stricmp(nick, s_ChanServAlias))) {
- notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED);
- return MOD_CONT;
- } else if ((s_MemoServ && !stricmp(nick, s_MemoServ))
- || (s_MemoServAlias
- && !stricmp(nick, s_MemoServAlias))) {
- notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED);
- return MOD_CONT;
- } else if ((s_BotServ && !stricmp(nick, s_BotServ))
- || (s_BotServAlias
- && !stricmp(nick, s_BotServAlias))) {
- notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED);
- return MOD_CONT;
- } else if ((s_HelpServ && !stricmp(nick, s_HelpServ))
- || (s_HelpServAlias
- && !stricmp(nick, s_HelpServAlias))) {
- notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED);
- return MOD_CONT;
- } else if ((s_OperServ && !stricmp(nick, s_OperServ))
- || (s_OperServAlias
- && !stricmp(nick, s_OperServAlias))) {
- notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED);
- return MOD_CONT;
- } else if ((s_GlobalNoticer && !stricmp(nick, s_GlobalNoticer))
- || (s_GlobalNoticerAlias
- && !stricmp(nick, s_GlobalNoticerAlias))) {
- notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED);
- return MOD_CONT;
- } else if ((s_HostServ && !stricmp(nick, s_HostServ))
- || (s_HostServAlias
- && !stricmp(nick, s_HostServAlias))) {
+ /* use nickIsServices() to reduce the number of lines of code - TSL */
+ if (nickIsServices(nick, 0)) {
notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED);
return MOD_CONT;
}
diff --git a/src/channels.c b/src/channels.c
index ebee50403..2b871853d 100644
--- a/src/channels.c
+++ b/src/channels.c
@@ -21,11 +21,13 @@ Channel *chanlist[1024];
void add_ban(Channel * chan, char *mask);
void add_exception(Channel * chan, char *mask);
+void add_invite(Channel * chan, char *mask);
void chan_adduser2(User * user, Channel * c);
Channel *chan_create(char *chan);
void chan_delete(Channel * c);
void del_ban(Channel * chan, char *mask);
void del_exception(Channel * chan, char *mask);
+void del_invite(Channel * chan, char *mask);
char *get_flood(Channel * chan);
char *get_key(Channel * chan);
char *get_limit(Channel * chan);
@@ -390,6 +392,13 @@ void get_channel_stats(long *nrec, long *memuse)
mem += strlen(chan->excepts[j]) + 1;
}
}
+ if (ircd->invitemode) {
+ mem += sizeof(char *) * chan->invitesize;
+ for (j = 0; j < chan->invitecount; j++) {
+ if (chan->invite[j])
+ mem += strlen(chan->invite[j]) + 1;
+ }
+ }
for (cu = chan->users; cu; cu = cu->next) {
mem += sizeof(*cu);
if (cu->ud) {
@@ -618,22 +627,48 @@ void do_part(const char *source, int ac, char **av)
av[0] = timestamp
av[1] = user
+ ============================================================
+
+ Unreal SJOIN
+
+ On Connect there is
+ SJOIN !11LkOb #ircops +nt :@Trystan
+
+ av[0] = time stamp (base64)
+ av[1] = channel
+ av[2] = modes
+ av[3] = users + bans
+
+ On Channel Creation or a User joins an existing
+ Luna.NomadIrc.Net SJOIN !11LkW9 #akill :@Trystan
+ Luna.NomadIrc.Net SJOIN !11LkW9 #akill :Trystan`
+
+ av[0] = time stamp (base64)
+ av[1] = channel
+ av[2] = users
+
*/
void do_sjoin(const char *source, int ac, char **av)
{
Channel *c;
User *user;
+ char *s, *end, cubuf[ircd->max_symbols + 2], *end2,
+ *cumodes[ircd->max_symbols + 1];
+
int is_sqlined = 0;
+ int ts = 0;
+
+ if (ircd->sjb64) {
+ ts = base64dects(av[0]);
+ } else {
+ ts = strtoul(av[0], NULL, 10);
+ }
/* Double check to avoid unknown modes that need parameters */
if (ac >= 4 && ac <= 6) {
- char *s, *end, cubuf[ircd->max_symbols + 2], *end2,
- *cumodes[ircd->max_symbols + 1];
-
c = findchan(av[1]);
-
if (ircd->chansqline) {
if (!c)
is_sqlined = check_chan_sqline(av[1]);
@@ -651,6 +686,26 @@ void do_sjoin(const char *source, int ac, char **av)
*end = 0;
end2 = cubuf + 1;
+
+#ifdef SJOINBANNCHAR
+ if (*s == SJOINBANNCHAR) {
+ add_ban(c, myStrGetToken(s, SJOINBANNCHAR, 1));
+ if (!end)
+ break;
+ s = end + 1;
+ continue;
+ }
+#endif
+#ifdef SJOINEXCEPTIONCHAR
+ if (*s == SJOINEXCEPTIONCHAR) {
+ add_exception(c, myStrGetToken(s, SJOINEXCEPTIONCHAR, 1));
+ if (!end)
+ break;
+ s = end + 1;
+ continue;
+ }
+#endif
+
while (csmodes[(int) *s] != 0)
*end2++ = csmodes[(int) *s++];
*end2 = 0;
@@ -693,10 +748,75 @@ void do_sjoin(const char *source, int ac, char **av)
if (c) {
/* Set the timestamp */
- c->creation_time = strtoul(av[0], NULL, 10);
+ c->creation_time = ts;
/* We now update the channel mode. */
chan_set_modes(source, c, ac - 3, &av[2], 1);
}
+
+ /* Unreal just had to be different */
+ } else if (ac == 3) {
+ c = findchan(av[1]);
+ if (ircd->chansqline) {
+ if (!c)
+ is_sqlined = check_chan_sqline(av[1]);
+ }
+
+ cubuf[0] = '+';
+ cumodes[0] = cubuf;
+
+ /* We make all the users join */
+ s = av[2]; /* Users are always the last element */
+
+ while (*s) {
+ end = strchr(s, ' ');
+ if (end)
+ *end = 0;
+
+ end2 = cubuf + 1;
+
+ while (csmodes[(int) *s] != 0)
+ *end2++ = csmodes[(int) *s++];
+ *end2 = 0;
+
+ user = finduser(s);
+ if (!user) {
+ alog("user: SJOIN for nonexistent user %s on %s", s,
+ av[1]);
+ return;
+ }
+
+ if (is_sqlined && !is_oper(user)) {
+ anope_cmd_kick(s_OperServ, av[1], s, "Q-Lined");
+ } else {
+ if (!check_kick(user, av[1])) {
+ /* Make the user join; if the channel does not exist it
+ * will be created there. This ensures that the channel
+ * is not created to be immediately destroyed, and
+ * that the locked key or topic is not shown to anyone
+ * who joins the channel when empty.
+ */
+ c = join_user_update(user, c, av[1]);
+
+ /* We update user mode on the channel */
+ if (end2 - cubuf > 1) {
+ int i;
+
+ for (i = 1; i < end2 - cubuf; i++)
+ cumodes[i] = user->nick;
+ chan_set_modes(source, c, 1 + (end2 - cubuf - 1),
+ cumodes, 1);
+ }
+ }
+ }
+
+ if (!end)
+ break;
+ s = end + 1;
+ }
+
+ if (c) {
+ c->creation_time = ts;
+ }
} else if (ac == 2) {
user = finduser(source);
if (!user) {
@@ -718,7 +838,7 @@ void do_sjoin(const char *source, int ac, char **av)
anope_cmd_kick(s_OperServ, av[1], user->nick, "Q-Lined");
} else {
c = join_user_update(user, c, av[1]);
- c->creation_time = strtoul(av[0], NULL, 10);
+ c->creation_time = ts;
}
}
}
@@ -786,7 +906,16 @@ void do_cmode(const char *source, int ac, char **av)
void do_topic(const char *source, int ac, char **av)
{
Channel *c = findchan(av[0]);
- time_t topic_time = strtoul(av[2], NULL, 10);
+ int ts;
+ time_t topic_time;
+
+ if (ircd->sjb64) {
+ ts = base64dects(av[0]);
+ } else {
+ ts = strtoul(av[0], NULL, 10);
+ }
+
+ topic_time = ts;
if (!c) {
alog("channel: TOPIC %s for nonexistent channel %s",
@@ -856,6 +985,21 @@ void add_exception(Channel * chan, char *mask)
/*************************************************************************/
+void add_invite(Channel * chan, char *mask)
+{
+ if (chan->invitecount >= chan->invitesize) {
+ chan->invitesize += 8;
+ chan->invite =