summaryrefslogtreecommitdiff
path: root/src/protocol
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-06-19 11:54:08 -0400
committerAdam <Adam@anope.org>2010-06-19 11:54:08 -0400
commit52058fe87b4b0475b1775198c725af14e540d355 (patch)
treec3597d6411a006ffbb670d2ce761101b9640e9b6 /src/protocol
parent43e951aed54f838ba55a4c1552214773aee2fb2f (diff)
parentdf9d291bcba9788e51d11424ebaf6f05c26cc80f (diff)
Merge remote branch 'origin/1.9.3' into 1.9
Diffstat (limited to 'src/protocol')
-rw-r--r--src/protocol/CMakeLists.txt3
-rw-r--r--src/protocol/Makefile8
-rw-r--r--src/protocol/bahamut.cpp (renamed from src/protocol/bahamut.c)183
-rw-r--r--src/protocol/inspircd11.cpp (renamed from src/protocol/inspircd11.c)204
-rw-r--r--src/protocol/inspircd12.cpp313
-rw-r--r--src/protocol/inspircd20.cpp314
-rw-r--r--src/protocol/ratbox.cpp (renamed from src/protocol/ratbox.c)166
-rw-r--r--src/protocol/unreal32.cpp (renamed from src/protocol/unreal32.c)330
8 files changed, 725 insertions, 796 deletions
diff --git a/src/protocol/CMakeLists.txt b/src/protocol/CMakeLists.txt
index a74b49a89..abca56caf 100644
--- a/src/protocol/CMakeLists.txt
+++ b/src/protocol/CMakeLists.txt
@@ -1,5 +1,4 @@
-# Find all the *.c and *.cpp files within the current source directory, and sort the list
-file(GLOB PROTOCOL_SRCS_C RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.c")
+# Find all the *.cpp files within the current source directory, and sort the list
file(GLOB PROTOCOL_SRCS_CPP RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp")
set(PROTOCOL_SRCS ${PROTOCOL_SRCS_C} ${PROTOCOL_SRCS_CPP})
sort_list(PROTOCOL_SRCS)
diff --git a/src/protocol/Makefile b/src/protocol/Makefile
index a40d009c2..7221ab2e2 100644
--- a/src/protocol/Makefile
+++ b/src/protocol/Makefile
@@ -8,8 +8,7 @@ MAKEARGS = 'CFLAGS=${CFLAGS}' 'CC=${CC}' 'ANOPELIBS=${ANOPELIBS}' \
'PROFILE=${PROFILE}' 'SHARED=${SHARED}' 'MODULEFLAGS=${MODULEFLAGS}'\
'MAKEBIN=${MAKEBIN}'
-OBJECTS= $(SRCS:.c=.so)
-OBJECTS+= $(SRCS:.cpp=.so)
+OBJECTS= $(SRCS:.cpp=.so)
CDEFS= -rdynamic -Wall
all: modules subs
@@ -21,10 +20,7 @@ install:
distclean: clean spotless
-.SUFFIXES: .c .cpp .so
-
-.c.so:
- $(MAKEBIN) $(CC) ${CFLAGS} ${CDEFS} ${MODULEFLAGS} -I../${INCLUDEDIR} -o $@ $<
+.SUFFIXES: .cpp .so
.cpp.so:
$(MAKEBIN) $(CC) ${CFLAGS} ${CDEFS} ${MODULEFLAGS} -I../${INCLUDEDIR} -o $@ $<
diff --git a/src/protocol/bahamut.c b/src/protocol/bahamut.cpp
index 1e38a4aa2..d55a08123 100644
--- a/src/protocol/bahamut.c
+++ b/src/protocol/bahamut.cpp
@@ -14,7 +14,7 @@
/*************************************************************************/
#include "services.h"
-#include "pseudo.h"
+#include "modules.h"
IRCDVar myIrcd[] = {
{"Bahamut 1.8.x", /* ircd name */
@@ -23,7 +23,7 @@ IRCDVar myIrcd[] = {
"+o", /* Channel Umode used by Botserv bots */
1, /* SVSNICK */
0, /* Vhost */
- 1, /* Supports SGlines */
+ 1, /* Supports SNlines */
1, /* Supports SQlines */
1, /* Supports SZlines */
3, /* Number of server args */
@@ -141,35 +141,33 @@ class BahamutIRCdProto : public IRCDProto
}
/* SQLINE */
- void SendSQLine(const std::string &mask, const std::string &reason)
+ void SendSQLine(XLine *x)
{
- if (mask.empty() || reason.empty())
- return;
- send_cmd(NULL, "SQLINE %s :%s", mask.c_str(), reason.c_str());
+ send_cmd(NULL, "SQLINE %s :%s", x->Mask.c_str(), x->Reason.c_str());
}
- /* UNSGLINE */
- void SendSGLineDel(SXLine *sx)
+ /* UNSLINE */
+ void SendSGLineDel(XLine *x)
{
- send_cmd(NULL, "UNSGLINE 0 :%s", sx->mask);
+ send_cmd(NULL, "UNSGLINE 0 :%s", x->Mask.c_str());
}
/* UNSZLINE */
- void SendSZLineDel(SXLine *sx)
+ void SendSZLineDel(XLine *x)
{
/* this will likely fail so its only here for legacy */
- send_cmd(NULL, "UNSZLINE 0 %s", sx->mask);
+ send_cmd(NULL, "UNSZLINE 0 %s", x->Mask.c_str());
/* this is how we are supposed to deal with it */
- send_cmd(NULL, "RAKILL %s *", sx->mask);
+ send_cmd(NULL, "RAKILL %s *", x->Mask.c_str());
}
/* SZLINE */
- void SendSZLine(SXLine *sx)
+ void SendSZLine(XLine *x)
{
/* this will likely fail so its only here for legacy */
- send_cmd(NULL, "SZLINE %s :%s", sx->mask, sx->reason);
+ send_cmd(NULL, "SZLINE %s :%s", x->Mask.c_str(), x->Reason.c_str());
/* this is how we are supposed to deal with it */
- send_cmd(NULL, "AKILL %s * %d %s %ld :%s", sx->mask, 172800, sx->by, static_cast<long>(time(NULL)), sx->reason);
+ send_cmd(NULL, "AKILL %s * %d %s %ld :%s", x->Mask.c_str(), 172800, x->By.c_str(), static_cast<long>(time(NULL)), x->Reason.c_str());
}
/* SVSNOOP */
@@ -179,15 +177,15 @@ class BahamutIRCdProto : public IRCDProto
}
/* SGLINE */
- void SendSGLine(SXLine *sx)
+ void SendSGLine(XLine *x)
{
- send_cmd(NULL, "SGLINE %d :%s:%s", static_cast<int>(strlen(sx->mask)), sx->mask, sx->reason);
+ send_cmd(NULL, "SGLINE %d :%s:%s", static_cast<int>(x->Mask.length()), x->Mask.c_str(), x->Reason.c_str());
}
/* RAKILL */
- void SendAkillDel(Akill *ak)
+ void SendAkillDel(XLine *x)
{
- send_cmd(NULL, "RAKILL %s %s", ak->host, ak->user);
+ send_cmd(NULL, "RAKILL %s %s", x->GetHost().c_str(), x->GetUser().c_str());
}
/* TOPIC */
@@ -197,11 +195,9 @@ class BahamutIRCdProto : public IRCDProto
}
/* UNSQLINE */
- void SendSQLineDel(const std::string &user)
+ void SendSQLineDel(XLine *x)
{
- if (user.empty())
- return;
- send_cmd(NULL, "UNSQLINE %s", user.c_str());
+ send_cmd(NULL, "UNSQLINE %s", x->Mask.c_str());
}
/* JOIN - SJOIN */
@@ -210,12 +206,12 @@ class BahamutIRCdProto : public IRCDProto
send_cmd(user->nick, "SJOIN %ld %s", static_cast<long>(chantime), channel);
}
- void SendAkill(Akill *ak)
+ void SendAkill(XLine *x)
{
// Calculate the time left before this would expire, capping it at 2 days
- time_t timeleft = ak->expires - time(NULL);
+ time_t timeleft = x->Expires - time(NULL);
if (timeleft > 172800) timeleft = 172800;
- send_cmd(NULL, "AKILL %s %s %d %s %ld :%s", ak->host, ak->user, static_cast<int>(timeleft), ak->by, static_cast<long>(time(NULL)), ak->reason);
+ send_cmd(NULL, "AKILL %s %s %d %s %ld :%s", x->GetHost().c_str(), x->GetUser().c_str(), static_cast<int>(timeleft), x->By.c_str(), static_cast<long>(time(NULL)), x->Reason.c_str());
}
/*
@@ -265,7 +261,7 @@ class BahamutIRCdProto : public IRCDProto
/* nc_change was = 1, and there is no na->status */
void SendUnregisteredNick(User *u)
{
- BotInfo *bi = findbot(Config.s_NickServ);
+ BotInfo *bi = NickServ;
u->RemoveMode(bi, UMODE_REGISTERED);
ircdproto->SendMode(bi, u, "+d 1");
}
@@ -273,15 +269,15 @@ class BahamutIRCdProto : public IRCDProto
/* SERVER */
void SendServer(Server *server)
{
- send_cmd(NULL, "SERVER %s %d :%s", server->name, server->hops, server->desc);
+ send_cmd(NULL, "SERVER %s %d :%s", server->GetName().c_str(), server->GetHops(), server->GetDescription().c_str());
}
void SendConnect()
{
+ Me = new Server(NULL, Config.ServerName, 0, Config.ServerDesc, "");
bahamut_cmd_pass(uplink_server->password);
bahamut_cmd_capab();
- me_server = new_server(NULL, Config.ServerName, Config.ServerDesc, SERVER_ISME, "");
- SendServer(me_server);
+ SendServer(Me);
bahamut_cmd_svinfo();
bahamut_cmd_burst();
}
@@ -299,7 +295,7 @@ class BahamutIRCdProto : public IRCDProto
u->Account()->Shrink("authenticationtoken");
u->Account()->Extend("authenticationtoken", new ExtensibleItemPointerArray<char>(sstrdup(svidbuf)));
- BotInfo *bi = findbot(Config.s_NickServ);
+ BotInfo *bi = NickServ;
u->SetMode(bi, UMODE_REGISTERED);
ircdproto->SendMode(bi, u, "+d %s", svidbuf);
}
@@ -575,11 +571,7 @@ int anope_event_436(const char *source, int ac, const char **av)
/* EVENT : SERVER */
int anope_event_server(const char *source, int ac, const char **av)
{
- if (!stricmp(av[1], "1")) {
- uplink = sstrdup(av[0]);
- }
-
- do_server(source, av[0], av[1], av[2], "");
+ do_server(source, av[0], atoi(av[1]), av[2], "");
return MOD_CONT;
}
@@ -711,8 +703,8 @@ int anope_event_error(const char *source, int ac, const char **av)
int anope_event_burst(const char *source, int ac, const char **av)
{
- Server *s;
- s = findserver(servlist, source);
+ Server *s = Server::Find(source ? source : "");
+
if (!ac) {
/* for future use - start burst */
} else {
@@ -720,9 +712,10 @@ int anope_event_burst(const char *source, int ac, const char **av)
* finished bursting. If there was no source, then our uplink
* server finished bursting. -GD
*/
- if (!s && serv_uplink)
- s = serv_uplink;
- finish_sync(s, 1);
+ if (!s)
+ s = Me->GetUplink();
+ if (s)
+ s->Sync(true);
}
return MOD_CONT;
}
@@ -737,73 +730,71 @@ bool ChannelModeFlood::IsValid(const std::string &value)
return false;
}
-void moduleAddIRCDMsgs() {
- Message *m;
-
- /* now add the commands */
- m = createMessage("436", anope_event_436); addCoreMessage(IRCD,m);
- m = createMessage("AWAY", anope_event_away); addCoreMessage(IRCD,m);
- m = createMessage("JOIN", anope_event_join); addCoreMessage(IRCD,m);
- m = createMessage("KICK", anope_event_kick); addCoreMessage(IRCD,m);
- m = createMessage("KILL", anope_event_kill); addCoreMessage(IRCD,m);
- m = createMessage("MODE", anope_event_mode); addCoreMessage(IRCD,m);
- m = createMessage("MOTD", anope_event_motd); addCoreMessage(IRCD,m);
- m = createMessage("NICK", anope_event_nick); addCoreMessage(IRCD,m);
- m = createMessage("PART", anope_event_part); 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);
- m = createMessage("SERVER", anope_event_server); addCoreMessage(IRCD,m);
- m = createMessage("SQUIT", anope_event_squit); addCoreMessage(IRCD,m);
- m = createMessage("TOPIC", anope_event_topic); addCoreMessage(IRCD,m);
- m = createMessage("WHOIS", anope_event_whois); addCoreMessage(IRCD,m);
- m = createMessage("SVSMODE", anope_event_mode); addCoreMessage(IRCD,m);
- m = createMessage("CAPAB", anope_event_capab); addCoreMessage(IRCD,m);
- m = createMessage("CS", anope_event_cs); addCoreMessage(IRCD,m);
- m = createMessage("HS", anope_event_hs); addCoreMessage(IRCD,m);
- m = createMessage("MS", anope_event_ms); addCoreMessage(IRCD,m);
- m = createMessage("NS", anope_event_ns); addCoreMessage(IRCD,m);
- m = createMessage("OS", anope_event_os); addCoreMessage(IRCD,m);
- m = createMessage("SJOIN", anope_event_sjoin); addCoreMessage(IRCD,m);
- m = createMessage("ERROR", anope_event_error); addCoreMessage(IRCD,m);
- m = createMessage("BURST", anope_event_burst); addCoreMessage(IRCD,m);
-}
-
-void moduleAddModes()
+void moduleAddIRCDMsgs()
+{
+ Anope::AddMessage("436", anope_event_436);
+ Anope::AddMessage("AWAY", anope_event_away);
+ Anope::AddMessage("JOIN", anope_event_join);
+ Anope::AddMessage("KICK", anope_event_kick);
+ Anope::AddMessage("KILL", anope_event_kill);
+ Anope::AddMessage("MODE", anope_event_mode);
+ Anope::AddMessage("MOTD", anope_event_motd);
+ Anope::AddMessage("NICK", anope_event_nick);
+ Anope::AddMessage("PART", anope_event_part);
+ Anope::AddMessage("PING", anope_event_ping);
+ Anope::AddMessage("PRIVMSG", anope_event_privmsg);
+ Anope::AddMessage("QUIT", anope_event_quit);
+ Anope::AddMessage("SERVER", anope_event_server);
+ Anope::AddMessage("SQUIT", anope_event_squit);
+ Anope::AddMessage("TOPIC", anope_event_topic);
+ Anope::AddMessage("WHOIS", anope_event_whois);
+ Anope::AddMessage("SVSMODE", anope_event_mode);
+ Anope::AddMessage("CAPAB", anope_event_capab);
+ Anope::AddMessage("CS", anope_event_cs);
+ Anope::AddMessage("HS", anope_event_hs);
+ Anope::AddMessage("MS", anope_event_ms);
+ Anope::AddMessage("NS", anope_event_ns);
+ Anope::AddMessage("OS", anope_event_os);
+ Anope::AddMessage("SJOIN", anope_event_sjoin);
+ Anope::AddMessage("ERROR", anope_event_error);
+ Anope::AddMessage("BURST", anope_event_burst);
+}
+
+static void AddModes()
{
/* Add user modes */
- ModeManager::AddUserMode(new UserMode(UMODE_SERV_ADMIN, 'A'));
- ModeManager::AddUserMode(new UserMode(UMODE_REGPRIV, 'R'));
- ModeManager::AddUserMode(new UserMode(UMODE_ADMIN, 'a'));
- ModeManager::AddUserMode(new UserMode(UMODE_INVIS, 'i'));
- ModeManager::AddUserMode(new UserMode(UMODE_OPER, 'o'));
- ModeManager::AddUserMode(new UserMode(UMODE_REGISTERED, 'r'));
- ModeManager::AddUserMode(new UserMode(UMODE_SNOMASK, 's'));
- ModeManager::AddUserMode(new UserMode(UMODE_WALLOPS, 'w'));
- ModeManager::AddUserMode(new UserMode(UMODE_DEAF, 'd'));
+ ModeManager::AddUserMode(new UserMode(UMODE_SERV_ADMIN, "UMODE_SERV_ADMIN", 'A'));
+ ModeManager::AddUserMode(new UserMode(UMODE_REGPRIV, "UMODE_REGPRIV", 'R'));
+ ModeManager::AddUserMode(new UserMode(UMODE_ADMIN, "UMODE_ADMIN", 'a'));
+ ModeManager::AddUserMode(new UserMode(UMODE_INVIS, "UMODE_INVIS", 'i'));
+ ModeManager::AddUserMode(new UserMode(UMODE_OPER,"UMODE_OPER", 'o'));
+ ModeManager::AddUserMode(new UserMode(UMODE_REGISTERED, "UMODE_REGISTERED", 'r'));
+ ModeManager::AddUserMode(new UserMode(UMODE_SNOMASK, "UMODE_SNOMASK", 's'));
+ ModeManager::AddUserMode(new UserMode(UMODE_WALLOPS, "UMODE_WALLOPS", 'w'));
+ ModeManager::AddUserMode(new UserMode(UMODE_DEAF, "UMODE_DEAF", 'd'));
/* b/e/I */
ModeManager::AddChannelMode(new ChannelModeBan('b'));
/* v/h/o/a/q */
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_VOICE, 'v', '+'));
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OP, 'o', '@'));
+ ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_VOICE, "CMODE_VOICE", 'v', '+'));
+ ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OP, "CMODE_OP", 'o', '@'));
/* Add channel modes */
- ModeManager::AddChannelMode(new ChannelMode(CMODE_BLOCKCOLOR, 'c'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_INVITE, 'i'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_BLOCKCOLOR, "CMODE_BLOCKCOLOR", 'c'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_INVITE, "CMODE_INVITE", 'i'));
ModeManager::AddChannelMode(new ChannelModeFlood('f'));
ModeManager::AddChannelMode(new ChannelModeKey('k'));
- ModeManager::AddChannelMode(new ChannelModeParam(CMODE_LIMIT, 'l'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_MODERATED, 'm'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_NOEXTERNAL, 'n'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_PRIVATE, 'p'));
+ ModeManager::AddChannelMode(new ChannelModeParam(CMODE_LIMIT, "CMODE_LIMIT", 'l'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_MODERATED, "CMODE_MODERATED", 'm'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_NOEXTERNAL, "CMODE_NOEXTERNAL", 'n'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_PRIVATE, "CMODE_PRIVATE", 'p'));
ModeManager::AddChannelMode(new ChannelModeRegistered('r'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_SECRET, 's'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_TOPIC, 't'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_REGMODERATED, 'M'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_SECRET, "CMODE_SECRET", 's'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_TOPIC, "CMODE_TOPIC", 't'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_REGMODERATED, "CMODE_REGMODERATED", 'M'));
ModeManager::AddChannelMode(new ChannelModeOper('O'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_REGISTEREDONLY, 'R'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_REGISTEREDONLY, "CMODE_REGISTEREDONLY", 'R'));
}
class ProtoBahamut : public Module
@@ -824,7 +815,7 @@ class ProtoBahamut : public Module
Capab.SetFlag(c[i]);
moduleAddIRCDMsgs();
- moduleAddModes();
+ AddModes();
pmodule_ircd_proto(&ircd_proto);
diff --git a/src/protocol/inspircd11.c b/src/protocol/inspircd11.cpp
index b5c55cfa8..09c329f0c 100644
--- a/src/protocol/inspircd11.c
+++ b/src/protocol/inspircd11.cpp
@@ -14,7 +14,7 @@
/*************************************************************************/
#include "services.h"
-#include "pseudo.h"
+#include "modules.h"
#include "hashcomp.h"
#ifndef _WIN32
@@ -40,7 +40,7 @@ IRCDVar myIrcd[] = {
"+ao", /* Channel Umode used by Botserv bots */
1, /* SVSNICK */
1, /* Vhost */
- 1, /* Supports SGlines */
+ 1, /* Supports SNlines */
1, /* Supports SQlines */
1, /* Supports SZlines */
4, /* Number of server args */
@@ -97,7 +97,7 @@ void inspircd_cmd_chghost(const char *nick, const char *vhost)
send_cmd(Config.s_OperServ, "CHGHOST %s %s", nick, vhost);
}
else
- ircdproto->SendGlobops(findbot(Config.s_OperServ), "CHGHOST not loaded!");
+ ircdproto->SendGlobops(OperServ, "CHGHOST not loaded!");
}
int anope_event_idle(const char *source, int ac, const char **av)
@@ -119,9 +119,9 @@ void inspircd_cmd_pass(const char *pass)
class InspIRCdProto : public IRCDProto
{
- void SendAkillDel(Akill *ak)
+ void SendAkillDel(XLine *x)
{
- send_cmd(Config.s_OperServ, "GLINE %s@%s", ak->user, ak->host);
+ send_cmd(Config.s_OperServ, "GLINE %s", x->Mask.c_str());
}
void SendTopic(BotInfo *whosets, Channel *c, const char *whosetit, const char *topic)
@@ -142,13 +142,13 @@ class InspIRCdProto : public IRCDProto
}
}
- void SendAkill(Akill *ak)
+ void SendAkill(XLine *x)
{
// Calculate the time left before this would expire, capping it at 2 days
- time_t timeleft = ak->expires - time(NULL);
+ time_t timeleft = x->Expires - time(NULL);
if (timeleft > 172800)
timeleft = 172800;
- send_cmd(Config.ServerName, "ADDLINE G %s@%s %s %ld %ld :%s", ak->user, ak->host, ak->by, static_cast<long>(time(NULL)), static_cast<long>(timeleft), ak->reason);
+ send_cmd(Config.ServerName, "ADDLINE G %s %s %ld %ld :%s", x->Mask.c_str(), x->By.c_str(), static_cast<long>(time(NULL)), static_cast<long>(timeleft), x->Reason.c_str());
}
void SendSVSKillInternal(BotInfo *source, User *user, const char *buf)
@@ -204,7 +204,7 @@ class InspIRCdProto : public IRCDProto
/* SERVER services-dev.chatspike.net password 0 :Description here */
void SendServer(Server *server)
{
- send_cmd(Config.ServerName, "SERVER %s %s %d :%s", server->name, currentpass, server->hops, server->desc);
+ send_cmd(Config.ServerName, "SERVER %s %s %d :%s", server->GetName().c_str(), currentpass, server->GetHops(), server->GetDescription().c_str());
}
/* JOIN */
@@ -214,19 +214,15 @@ class InspIRCdProto : public IRCDProto
}
/* UNSQLINE */
- void SendSQLineDel(const std::string &user)
+ void SendSQLineDel(XLine *x)
{
- if (user.empty())
- return;
- send_cmd(Config.s_OperServ, "QLINE %s", user.c_str());
+ send_cmd(Config.s_OperServ, "QLINE %s", x->Mask.c_str());
}
/* SQLINE */
- void SendSQLine(const std::string &mask, const std::string &reason)
+ void SendSQLine(XLine *x)
{
- if (mask.empty() || reason.empty())
- return;
- send_cmd(Config.ServerName, "ADDLINE Q %s %s %ld 0 :%s", mask.c_str(), Config.s_OperServ, static_cast<long>(time(NULL)), reason.c_str());
+ send_cmd(Config.ServerName, "ADDLINE Q %s %s %ld 0 :%s", x->Mask.c_str(), Config.s_OperServ, static_cast<long>(time(NULL)), x->Reason.c_str());
}
/* SQUIT */
@@ -248,11 +244,11 @@ class InspIRCdProto : public IRCDProto
void SendConnect()
{
+ Me = new Server(NULL, Config.ServerName, 0, Config.ServerDesc, "");
inspircd_cmd_pass(uplink_server->password);
- me_server = new_server(NULL, Config.ServerName, Config.ServerDesc, SERVER_ISME, "");
- SendServer(me_server);
+ SendServer(Me);
send_cmd(NULL, "BURST");
- send_cmd(Config.ServerName, "VERSION :Anope-%s %s :%s - %s (%s) -- %s", version_number, Config.ServerName, ircd->name, version_flags, Config.EncModuleList.begin()->c_str(), version_build);
+ send_cmd(Config.ServerName, "VERSION :Anope-%s %s :%s - (%s) -- %s", version_number, Config.ServerName, ircd->name, Config.EncModuleList.begin()->c_str(), version_build);
}
/* CHGIDENT */
@@ -264,7 +260,7 @@ class InspIRCdProto : public IRCDProto
}
send_cmd(Config.s_OperServ, "CHGIDENT %s %s", nick, vIdent);
} else {
- ircdproto->SendGlobops(findbot(Config.s_OperServ), "CHGIDENT not loaded!");
+ ircdproto->SendGlobops(OperServ, "CHGIDENT not loaded!");
}
}
@@ -281,21 +277,21 @@ class InspIRCdProto : public IRCDProto
}
/* UNSZLINE */
- void SendSZLineDel(SXLine *sx)
+ void SendSZLineDel(XLine *x)
{
- send_cmd(Config.s_OperServ, "ZLINE %s", sx->mask);
+ send_cmd(Config.s_OperServ, "ZLINE %s", x->Mask.c_str());
}
/* SZLINE */
- void SendSZLine(SXLine *sx)
+ void SendSZLine(XLine *x)
{
- send_cmd(Config.ServerName, "ADDLINE Z %s %s %ld 0 :%s", sx->mask, sx->by, static_cast<long>(time(NULL)), sx->reason);
+ send_cmd(Config.ServerName, "ADDLINE Z %s %s %ld 0 :%s", x->Mask.c_str(), x->By.c_str(), static_cast<long>(time(NULL)), x->Reason.c_str());
}
/* SVSMODE +- */
void SendUnregisteredNick(User *u)
{
- u->RemoveMode(findbot(Config.s_NickServ), UMODE_REGISTERED);
+ u->RemoveMode(NickServ, UMODE_REGISTERED);
}
void SendSVSJoin(const char *source, const char *nick, const char *chan, const char *param)
@@ -325,7 +321,7 @@ class InspIRCdProto : public IRCDProto
u->Account()->Shrink("authenticationtoken");
u->Account()->Extend("authenticationtoken", new ExtensibleItemPointerArray<char>(sstrdup(svidbuf)));
- u->SetMode(findbot(Config.s_NickServ), UMODE_REGISTERED);
+ u->SetMode(NickServ, UMODE_REGISTERED);
}
} ircd_proto;
@@ -823,10 +819,7 @@ int anope_event_chghost(const char *source, int ac, const char **av)
/* EVENT: SERVER */
int anope_event_server(const char *source, int ac, const char **av)
{
- if (!stricmp(av[1], "1")) {
- uplink = sstrdup(av[0]);
- }
- do_server(source, av[0], av[1], av[2], "");
+ do_server(source, av[0], atoi(av[1]), av[2], "");
return MOD_CONT;
}
@@ -923,7 +916,7 @@ int anope_event_capab(const char *source, int ac, const char **av)
ModeManager::AddChannelMode(new ChannelModeInvite('I'));
continue;
default:
- ModeManager::AddChannelMode(new ChannelModeList(CMODE_END, modebuf[t]));
+ ModeManager::AddChannelMode(new ChannelModeList(CMODE_END, "", modebuf[t]));
}
}
@@ -936,7 +929,7 @@ int anope_event_capab(const char *source, int ac, const char **av)
ModeManager::AddChannelMode(new ChannelModeKey('k'));
continue;
default:
- ModeManager::AddChannelMode(new ChannelModeParam(CMODE_END, modebuf[t]));
+ ModeManager::AddChannelMode(new ChannelModeParam(CMODE_END, "", modebuf[t]));
}
}
@@ -950,13 +943,13 @@ int anope_event_capab(const char *source, int ac, const char **av)
ModeManager::AddChannelMode(new ChannelModeFlood('f'));
continue;
case 'l':
- ModeManager::AddChannelMode(new ChannelModeParam(CMODE_LIMIT, 'l', true));
+ ModeManager::AddChannelMode(new ChannelModeParam(CMODE_LIMIT, "CMODE_LIMIT", 'l', true));
continue;
case 'L':
- ModeManager::AddChannelMode(new ChannelModeParam(CMODE_REDIRECT, 'L', true));
+ ModeManager::AddChannelMode(new ChannelModeParam(CMODE_REDIRECT, "CMODE_REDIRECT", 'L', true));
continue;
default:
- ModeManager::AddChannelMode(new ChannelModeParam(CMODE_END, modebuf[t], true));
+ ModeManager::AddChannelMode(new ChannelModeParam(CMODE_END, "", modebuf[t], true));
}
}
@@ -966,67 +959,67 @@ int anope_event_capab(const char *source, int ac, const char **av)
switch (modebuf[t])
{
case 'i':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_INVITE, 'i'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_INVITE, "CMODE_INVITE", 'i'));
continue;
case 'm':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_MODERATED, 'm'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_MODERATED, "CMODE_MODERATED", 'm'));
continue;
case 'n':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_NOEXTERNAL, 'n'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_NOEXTERNAL, "CMODE_NOEXTERNAL", 'n'));
continue;
case 'p':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_PRIVATE, 'p'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_PRIVATE, "CMODE_PRIVATE", 'p'));
continue;
case 's':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_SECRET, 's'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_SECRET, "CMODE_SECRET", 's'));
continue;
case 't':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_TOPIC, 't'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_TOPIC, "CMODE_TOPIC", 't'));
continue;
case 'r':
ModeManager::AddChannelMode(new ChannelModeRegistered('r'));
continue;
case 'c':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_BLOCKCOLOR, 'c'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_BLOCKCOLOR, "CMODE_BLOCKCOLOR", 'c'));
continue;
case 'u':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_AUDITORIUM, 'u'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_AUDITORIUM, "CMODE_AUDITORIUM", 'u'));
continue;
case 'z':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_SSL, 'z'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_SSL, "CMODE_SSL", 'z'));
continue;
case 'A':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_ALLINVITE, 'A'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_ALLINVITE, "CMODE_ALLINVITE", 'A'));
continue;
case 'C':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_NOCTCP, 'C'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_NOCTCP, "CMODE_NOCTCP", 'C'));
continue;
case 'G':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_FILTER, 'G'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_FILTER, "CMODE_FILTER", 'G'));
continue;
case 'K':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_NOKNOCK, 'K'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_NOKNOCK, "CMODE_NOKNOCK", 'K'));
continue;
case 'N':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_NONICK, 'N'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_NONICK, "CMODE_NONICK", 'N'));
continue;
case 'O':
ModeManager::AddChannelMode(new ChannelModeOper('O'));
continue;
case 'Q':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_NOKICK, 'Q'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_NOKICK, "CMODE_NOKICK", 'Q'));
continue;
case 'R':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_REGISTEREDONLY, 'R'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_REGISTEREDONLY, "CMODE_REGISTEREDONLY", 'R'));
continue;
case 'S':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_STRIPCOLOR, 'S'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_STRIPCOLOR, "CMODE_STRIPCOLOR", 'S'));
continue;
case 'V':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_NOINVITE, 'V'));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_NOINVITE, "CMODE_NOINVITE", 'V'));
continue;
default:
- ModeManager::AddChannelMode(new ChannelMode(CMODE_END, modebuf[t]));
+ ModeManager::AddChannelMode(new ChannelMode(CMODE_END, "", modebuf[t]));
}
}
}
@@ -1040,19 +1033,19 @@ int anope_event_capab(const char *source, int ac, const char **av)
switch (modes[t])
{
case 'q':
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OWNER, 'q', '~'));
+ ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OWNER, "CMODE_OWNER", 'q', '~'));
continue;
case 'a':
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_PROTECT, 'a', '&'));
+ ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_PROTECT, "CMODE_PROTECT", 'a', '&'));
continue;
case 'o':
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OP, 'o', '@'));
+ ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OP, "CMODE_OP", 'o', '@'));
continue;
case 'h':
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_HALFOP, 'h', '%'));
+ ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_HALFOP, "CMODE_HALFOP", 'h', '%'));
continue;
case 'v':
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_VOICE, 'v', '+'));
+ ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_VOICE, "CMODE_VOICE", 'v', '+'));
continue;
}
}
@@ -1083,13 +1076,13 @@ int anope_event_capab(const char *source, int ac, const char **av)
return MOD_STOP;
}
if (!has_svsholdmod) {
- ircdproto->SendGlobops(findbot(Config.s_OperServ), "SVSHOLD missing, Usage disabled until module is loaded.");
+ ircdproto->SendGlobops(OperServ, "SVSHOLD missing, Usage disabled until module is loaded.");
}
if (!has_chghostmod) {
- ircdproto->SendGlobops(findbot(Config.s_OperServ), "CHGHOST missing, Usage disabled until module is loaded.");
+ ircdproto->SendGlobops(OperServ, "CHGHOST missing, Usage disabled until module is loaded.");
}
if (!has_chgidentmod) {
- ircdproto->SendGlobops(findbot(Config.s_OperServ), "CHGIDENT missing, Usage disabled until module is loaded.");
+ ircdproto->SendGlobops(OperServ, "CHGIDENT missing, Usage disabled until module is loaded.");
}
ircd->svshold = has_svsholdmod;
}
@@ -1100,45 +1093,44 @@ int anope_event_capab(const char *source, int ac, const char **av)
int anope_event_endburst(const char *source, int ac, const char **av)
{
- finish_sync(serv_uplink, 1);
+ Me->GetUplink()->Sync(true);
return MOD_CONT;
}
-void moduleAddIRCDMsgs() {
- Message *m;
-
- m = createMessage("ENDBURST", anope_event_endburst); addCoreMessage(IRCD, m);
- m = createMessage("436", anope_event_436); addCoreMessage(IRCD,m);
- m = createMessage("AWAY", anope_event_away); addCoreMessage(IRCD,m);
- m = createMessage("JOIN", anope_event_join); addCoreMessage(IRCD,m);
- m = createMessage("KICK", anope_event_kick); addCoreMessage(IRCD,m);
- m = createMessage("KILL", anope_event_kill); addCoreMessage(IRCD,m);
- m = createMessage("MODE", anope_event_mode); addCoreMessage(IRCD,m);
- m = createMessage("MOTD", anope_event_motd); addCoreMessage(IRCD,m);
- m = createMessage("NICK", anope_event_nick); addCoreMessage(IRCD,m);
- m = createMessage("CAPAB", anope_event_capab); addCoreMessage(IRCD,m);
- m = createMessage("PART", anope_event_part); 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);
- m = createMessage("SERVER", anope_event_server); addCoreMessage(IRCD,m);
- m = createMessage("SQUIT", anope_event_squit); addCoreMessage(IRCD,m);
- m = createMessage("RSQUIT", anope_event_rsquit); addCoreMessage(IRCD,m);
- m = createMessage("TOPIC", anope_event_topic); addCoreMessage(IRCD,m);
- m = createMessage("WHOIS", anope_event_whois); addCoreMessage(IRCD,m);
- m = createMessage("SVSMODE", anope_event_mode) ;addCoreMessage(IRCD,m);
- m = createMessage("FHOST", anope_event_chghost); addCoreMessage(IRCD,m);
- m = createMessage("CHGIDENT", anope_event_chgident); addCoreMessage(IRCD,m);
- m = createMessage("FNAME", anope_event_chgname); addCoreMessage(IRCD,m);
- m = createMessage("SETHOST", anope_event_sethost); addCoreMessage(IRCD,m);
- m = createMessage("SETIDENT", anope_event_setident); addCoreMessage(IRCD,m);
- m = createMessage("SETNAME", anope_event_setname); addCoreMessage(IRCD,m);
- m = createMessage("FJOIN", anope_event_fjoin); addCoreMessage(IRCD,m);
- m = createMessage("FMODE", anope_event_fmode); addCoreMessage(IRCD,m);
- m = createMessage("FTOPIC", anope_event_ftopic); addCoreMessage(IRCD,m);
- m = createMessage("OPERTYPE", anope_event_opertype); addCoreMessage(IRCD,m);
- m = createMessage("IDLE", anope_event_idle); addCoreMessage(IRCD,m);
+void moduleAddIRCDMsgs()
+{
+ Anope::AddMessage("ENDBURST", anope_event_endburst);
+ Anope::AddMessage("436", anope_event_436);
+ Anope::AddMessage("AWAY", anope_event_away);
+ Anope::AddMessage("JOIN", anope_event_join);
+ Anope::AddMessage("KICK", anope_event_kick);
+ Anope::AddMessage("KILL", anope_event_kill);
+ Anope::AddMessage("MODE", anope_event_mode);
+ Anope::AddMessage("MOTD", anope_event_motd);
+ Anope::AddMessage("NICK", anope_event_nick);
+ Anope::AddMessage("CAPAB",anope_event_capab);
+ Anope::AddMessage("PART", anope_event_part);
+ Anope::AddMessage("PING", anope_event_ping);
+ Anope::AddMessage("PRIVMSG", anope_event_privmsg);
+ Anope::AddMessage("QUIT", anope_event_quit);
+ Anope::AddMessage("SERVER", anope_event_server);
+ Anope::AddMessage("SQUIT", anope_event_squit);
+ Anope::AddMessage("RSQUIT", anope_event_rsquit);
+ Anope::AddMessage("TOPIC", anope_event_topic);
+ Anope::AddMessage("WHOIS", anope_event_whois);
+ Anope::AddMessage("SVSMODE", anope_event_mode);
+ Anope::AddMessage("FHOST", anope_event_chghost);
+ Anope::AddMessage("CHGIDENT", anope_event_chgident);
+ Anope::AddMessage("FNAME", anope_event_chgname);
+ Anope::AddMessage("SETHOST", anope_event_sethost);
+ Anope::AddMessage("SETIDENT", anope_event_setident);
+ Anope::AddMessage("SETNAME", anope_event_setname);
+ Anope::AddMessage("FJOIN", anope_event_fjoin);
+ Anope::AddMessage("FMODE", anope_event_fmode);
+ Anope::AddMessage("FTOPIC", anope_event_ftopic);
+ Anope::AddMessage("OPERTYPE", anope_event_opertype);
+ Anope::AddMessage("IDLE", anope_event_idle);
}
bool ChannelModeFlood::IsValid(const std::string &value)
@@ -1153,13 +1145,13 @@ bool ChannelModeFlood::IsValid(const std::string &value)
static void AddModes()
{
- ModeManager::AddUserMode(new UserMode(UMODE_CALLERID, 'g'));
- ModeManager::AddUserMode(new UserMode(UMODE_HELPOP, 'h'));
- ModeManager::AddUserMode(new UserMode(UMODE_INVIS, 'i'));
- ModeManager::AddUserMode(new UserMode(UMODE_OPER, 'o'));
- ModeManager::AddUserMode(new UserMode(UMODE_REGISTERED, 'r'));
- ModeManager::AddUserMode(new UserMode(UMODE_WALLOPS, 'w'));
- ModeManager::AddUserMode(new UserMode(UMODE_CLOAK, 'x'));
+ ModeManager::AddUserMode(new UserMode(UMODE_CALLERID, "UMODE_CALLERID", 'g'));
+ ModeManager::AddUserMode(new UserMode(UMODE_HELPOP, "UMODE_HELPOP", 'h'));
+ ModeManager::AddUserMode(new UserMode(UMODE_INVIS, "UMODE_INVIS", 'i'));
+ ModeManager::AddUserMode(new UserMode(UMODE_OPER, "UMODE_OPER", 'o'));
+ ModeManager::AddUserMode(new UserMode(UMODE_REGISTERED, "UMODE_REGISTERED", 'r'));
+ ModeManager::AddUserMode(new UserMode(UMODE_WALLOPS, "UMODE_WALLOPS", 'w'));
+ ModeManager::AddUserMode(new UserMode(UMODE_CLOAK, "UMODE_CLOAK", 'x'));
}
class ProtoInspIRCd : public Module
@@ -1171,7 +1163,7 @@ class ProtoInspIRCd : public Module
this->SetVersion(VERSION_STRING);
this->SetType(PROTOCOL);
- pmodule_ircd_version("inspircdIRCd 1.1");
+ pmodule_ircd_version("InspIRCd 1.1");
pmodule_ircd_var(myIrcd);
pmodule_ircd_useTSMode(0);
diff --git a/src/protocol/inspircd12.cpp b/src/protocol/inspircd12.cpp
index 4ad390f00..9a9f88fea 100644
--- a/src/protocol/inspircd12.cpp
+++ b/src/protocol/inspircd12.cpp
@@ -14,7 +14,7 @@
/*************************************************************************/
#include "services.h"
-#include "pseudo.h"
+#include "modules.h"
#include "hashcomp.h"
#ifndef _WIN32
@@ -40,7 +40,7 @@ IRCDVar myIrcd[] = {
"+ao", /* Channel Umode used by Botserv bots */
1, /* SVSNICK */
1, /* Vhost */
- 0, /* Supports SGlines */
+ 0, /* Supports SNlines */
1, /* Supports SQlines */
1, /* Supports SZlines */
4, /* Number of server args */
@@ -94,11 +94,11 @@ void inspircd_cmd_chghost(const char *nick, const char *vhost)
{
if (has_chghostmod != 1)
{
- ircdproto->SendGlobops(findbot(Config.s_OperServ), "CHGHOST not loaded!");
+ ircdproto->SendGlobops(OperServ, "CHGHOST not loaded!");
return;
}
- BotInfo *bi = findbot(Config.s_OperServ);
+ BotInfo *bi = OperServ;
send_cmd(bi->uid, "CHGHOST %s %s", nick, vhost);
}
@@ -123,10 +123,10 @@ void inspircd_cmd_pass(const char *pass)
class InspIRCdProto :