summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/extern.h55
-rw-r--r--include/servers.h3
-rw-r--r--include/services.h25
-rw-r--r--include/users.h6
-rw-r--r--modules/core/cs_forbid.cpp2
-rw-r--r--modules/core/cs_info.cpp2
-rw-r--r--modules/core/cs_list.cpp2
-rw-r--r--modules/core/cs_suspend.cpp2
-rw-r--r--modules/core/cs_unban.cpp2
-rw-r--r--modules/core/ns_ghost.cpp2
-rw-r--r--modules/core/ns_group.cpp2
-rw-r--r--modules/core/ns_info.cpp2
-rw-r--r--modules/core/ns_list.cpp2
-rw-r--r--modules/core/ns_register.cpp4
-rw-r--r--modules/core/os_chankill.cpp2
-rw-r--r--modules/core/os_defcon.cpp6
-rw-r--r--modules/core/os_noop.cpp4
-rw-r--r--modules/extra/cs_entrymsg.cpp2
-rw-r--r--modules/extra/cs_set_misc.cpp2
-rw-r--r--modules/extra/m_alias.cpp2
-rw-r--r--modules/extra/m_xmlrpc_main.cpp2
-rw-r--r--modules/extra/ns_set_misc.cpp2
-rw-r--r--modules/protocol/bahamut.cpp512
-rw-r--r--modules/protocol/inspircd-ts6.h413
-rw-r--r--modules/protocol/inspircd11.cpp908
-rw-r--r--modules/protocol/inspircd12.cpp1149
-rw-r--r--modules/protocol/inspircd20.cpp1147
-rw-r--r--modules/protocol/plexus.cpp436
-rw-r--r--modules/protocol/ratbox.cpp449
-rw-r--r--modules/protocol/unreal32.cpp960
-rw-r--r--src/actions.cpp29
-rw-r--r--src/botserv.cpp59
-rw-r--r--src/command.cpp6
-rw-r--r--src/commands.cpp2
-rw-r--r--src/ircd.cpp34
-rw-r--r--src/messages.cpp316
-rw-r--r--src/misc.cpp64
-rw-r--r--src/modes.cpp4
-rw-r--r--src/operserv.cpp14
-rw-r--r--src/process.cpp2
-rw-r--r--src/protocol.cpp329
-rw-r--r--src/regchannel.cpp2
-rw-r--r--src/servers.cpp61
-rw-r--r--src/sessions.cpp29
-rw-r--r--src/users.cpp70
45 files changed, 3041 insertions, 4087 deletions
diff --git a/include/extern.h b/include/extern.h
index 24f12a84f..c30914c9e 100644
--- a/include/extern.h
+++ b/include/extern.h
@@ -23,12 +23,13 @@ E void ModuleRunTimeDirCleanUp();
E IRCDVar *ircd;
E IRCDProto *ircdproto;
+E IRCdMessage *ircdmessage;
/**** actions.c ****/
-E void kill_user(const Anope::string &source, const Anope::string &user, const Anope::string &reason);
+E void kill_user(const Anope::string &source, User *user, const Anope::string &reason);
E bool bad_password(User *u);
-E void common_unban(ChannelInfo *ci, const Anope::string &nick);
+E void common_unban(ChannelInfo *ci, User *u);
E BotInfo *BotServ;
E BotInfo *ChanServ;
@@ -53,7 +54,6 @@ E Anope::string normalizeBuffer(const Anope::string &);
E void bot_raw_ban(User *requester, ChannelInfo *ci, const Anope::string &nick, const Anope::string &reason);
E void bot_raw_kick(User *requester, ChannelInfo *ci, const Anope::string &nick, const Anope::string &reason);
-E void bot_raw_mode(User *requester, ChannelInfo *ci, const Anope::string &mode, const Anope::string &nick);
/**** channels.c ****/
@@ -133,6 +133,7 @@ E Uplink *uplink_server;
/**** ircd.c ****/
E void pmodule_ircd_proto(IRCDProto *);
E void pmodule_ircd_var(IRCDVar *ircdvar);
+E void pmodule_ircd_message(IRCdMessage *message);
/**** language.cpp ****/
E std::vector<Anope::string> languages;
@@ -191,32 +192,45 @@ E void check_memos(User *u);
E MemoInfo *getmemoinfo(const Anope::string &name, bool &ischan, bool &isforbid);
E void memo_send(CommandSource &source, const Anope::string &name, const Anope::string &text, int z);
-/**** messages.c ****/
-
-E int m_nickcoll(const Anope::string &user);
-E int m_away(const Anope::string &source, const Anope::string &msg);
-E int m_kill(const Anope::string &nick, const Anope::string &msg);
-E int m_motd(const Anope::string &source);
-E int m_privmsg(const Anope::string &source, const Anope::string &receiver, const Anope::string &message);
-E bool m_stats(const Anope::string &source, const std::vector<Anope::string> &);
-E int m_whois(const Anope::string &source, const Anope::string &who);
-E bool m_time(const Anope::string &source, const std::vector<Anope::string> &);
-E bool m_version(const Anope::string &source, const std::vector<Anope::string> &);
+/**** messages.cpp ****/
+
E void init_core_messages();
+E bool OnStats(const Anope::string &source, const std::vector<Anope::string> &);
+E bool OnTime(const Anope::string &source, const std::vector<Anope::string> &);
+E bool OnVersion(const Anope::string &source, const std::vector<Anope::string> &);
+
+E bool On436(const Anope::string &, const std::vector<Anope::string> &);
+E bool OnAway(const Anope::string &, const std::vector<Anope::string> &);
+E bool OnJoin(const Anope::string &, const std::vector<Anope::string> &);
+E bool OnKick(const Anope::string &, const std::vector<Anope::string> &);
+E bool OnKill(const Anope::string &, const std::vector<Anope::string> &);
+E bool OnMode(const Anope::string &, const std::vector<Anope::string> &);
+E bool OnNick(const Anope::string &, const std::vector<Anope::string> &);
+E bool OnUID(const Anope::string &, const std::vector<Anope::string> &);
+E bool OnPart(const Anope::string &, const std::vector<Anope::string> &);
+E bool OnPing(const Anope::string &, const std::vector<Anope::string> &);
+E bool OnPrivmsg(const Anope::string &, const std::vector<Anope::string> &);
+E bool OnQuit(const Anope::string &, const std::vector<Anope::string> &);
+E bool OnServer(const Anope::string &, const std::vector<Anope::string> &);
+E bool OnSQuit(const Anope::string &, const std::vector<Anope::string> &);
+E bool OnTopic(const Anope::string &, const std::vector<Anope::string> &);
+E bool OnWhois(const Anope::string &, const std::vector<Anope::string> &);
+E bool OnCapab(const Anope::string &, const std::vector<Anope::string> &);
+E bool OnSJoin(const Anope::string &, const std::vector<Anope::string> &);
+E bool OnError(const Anope::string &, const std::vector<Anope::string> &);
+
/**** misc.c ****/
E bool IsFile(const Anope::string &filename);
E int toupper(char);
E int tolower(char);
-E char *strscpy(char *d, const char *s, size_t len);
#ifndef HAVE_STRLCPY
E size_t strlcpy(char *, const char *, size_t);
#endif
#ifndef HAVE_STRLCAT
E size_t strlcat(char *, const char *, size_t);
#endif
-E char *strnrepl(char *s, int32 size, const char *old, const char *nstr);
E const char *merge_args(int argc, char **argv);
E const char *merge_args(int argc, const char **argv);
@@ -302,8 +316,8 @@ E std::vector<Exception *> exceptions;
E void get_session_stats(long &count, long &mem);
E void get_exception_stats(long &count, long &mem);
-E void add_session(const Anope::string &nick, const Anope::string &host, const Anope::string &hostip);
-E void del_session(const Anope::string &host);
+E void add_session(User *u);
+E void del_session(User *u);
E void expire_exceptions();
@@ -333,10 +347,7 @@ E User *finduser(const Anope::string &nick);
E User *do_nick(const Anope::string &source, const Anope::string &nick, const Anope::string &username, const Anope::string &host, const Anope::string &server, const Anope::string &realname, time_t ts, const Anope::string &ip, const Anope::string &vhost, const Anope::string &uid, const Anope::string &modes);
E void do_umode(const Anope::string &, const Anope::string &user, const Anope::string &modes);
-E void do_quit(const Anope::string &source, const Anope::string &reason);
-E void do_kill(const Anope::string &source, const Anope::string &reason);
-
-E bool is_oper(User *user);
+E void do_kill(User *user, const Anope::string &reason);
E bool is_excepted(ChannelInfo *ci, User *user);
E bool is_excepted_mask(ChannelInfo *ci, const Anope::string &mask);
diff --git a/include/servers.h b/include/servers.h
index 43f3dc659..d22ab05ac 100644
--- a/include/servers.h
+++ b/include/servers.h
@@ -4,10 +4,7 @@
/* Anope */
extern CoreExport Server *Me;
-extern CoreExport void CapabParse(const std::vector<Anope::string> &params);
-
extern CoreExport void do_server(const Anope::string &source, const Anope::string &servername, unsigned int hops, const Anope::string &descript, const Anope::string &numeric);
-extern CoreExport void do_squit(const Anope::string &source, const Anope::string &server);
extern CoreExport const char *ts6_uid_retrieve();
extern CoreExport const char *ts6_sid_retrieve();
diff --git a/include/services.h b/include/services.h
index 2b4c13f7c..75aa4905c 100644
--- a/include/services.h
+++ b/include/services.h
@@ -897,6 +897,7 @@ enum DefconLevel
* Forward declaration reqired, because the base IRCDProto class uses some crap from in here.
*/
class IRCDProto;
+class IRCdMessage;
struct Uplink;
class ServerConfig;
@@ -999,6 +1000,30 @@ class CoreExport IRCDProto
virtual void SetAutoIdentificationToken(User *u) { }
};
+class CoreExport IRCdMessage
+{
+ public:
+ virtual bool On436(const Anope::string &, const std::vector<Anope::string> &);
+ virtual bool OnAway(const Anope::string &, const std::vector<Anope::string> &);
+ virtual bool OnJoin(const Anope::string &, const std::vector<Anope::string> &);
+ virtual bool OnKick(const Anope::string &, const std::vector<Anope::string> &);
+ virtual bool OnKill(const Anope::string &, const std::vector<Anope::string> &);
+ virtual bool OnMode(const Anope::string &, const std::vector<Anope::string> &) = 0;
+ virtual bool OnUID(const Anope::string &, const std::vector<Anope::string> &);
+ virtual bool OnNick(const Anope::string &, const std::vector<Anope::string> &) = 0;
+ virtual bool OnPart(const Anope::string &, const std::vector<Anope::string> &);
+ virtual bool OnPing(const Anope::string &, const std::vector<Anope::string> &);
+ virtual bool OnPrivmsg(const Anope::string &, const std::vector<Anope::string> &);
+ virtual bool OnQuit(const Anope::string &, const std::vector<Anope::string> &);
+ virtual bool OnServer(const Anope::string &, const std::vector<Anope::string> &) = 0;
+ virtual bool OnSQuit(const Anope::string &, const std::vector<Anope::string> &);
+ virtual bool OnTopic(const Anope::string &, const std::vector<Anope::string> &) = 0;
+ virtual bool OnWhois(const Anope::string &, const std::vector<Anope::string> &);
+ virtual bool OnCapab(const Anope::string &, const std::vector<Anope::string> &);
+ virtual bool OnSJoin(const Anope::string &, const std::vector<Anope::string> &) = 0;
+ virtual bool OnError(const Anope::string &, const std::vector<Anope::string> &);
+};
+
/*************************************************************************/
struct Uplink
diff --git a/include/users.h b/include/users.h
index 26ee5f33e..e06c5c5a5 100644
--- a/include/users.h
+++ b/include/users.h
@@ -149,12 +149,12 @@ class CoreExport User : public Extensible
/**
* Send a message (notice or privmsg, depending on settings) to a user
- * @param source Sender nick
+ * @param source Sender
* @param fmt Format of the Message
* @param ... any number of parameters
*/
- void SendMessage(const Anope::string &source, const char *fmt, ...);
- virtual void SendMessage(const Anope::string &source, const Anope::string &msg);
+ void SendMessage(BotInfo *source, const char *fmt, ...);
+ virtual void SendMessage(BotInfo *source, const Anope::string &msg);
/** Send a language string message to a user
* @param source Sender
diff --git a/modules/core/cs_forbid.cpp b/modules/core/cs_forbid.cpp
index 19f4b6f04..d3976929d 100644
--- a/modules/core/cs_forbid.cpp
+++ b/modules/core/cs_forbid.cpp
@@ -71,7 +71,7 @@ class CommandCSForbid : public Command
{
UserContainer *uc = *it++;
- if (is_oper(uc->user))
+ if (uc->user->HasMode(UMODE_OPER))
continue;
c->Kick(ChanServ, uc->user, "%s", !reason.empty() ? reason.c_str() : GetString(uc->user, CHAN_FORBID_REASON).c_str());
diff --git a/modules/core/cs_info.cpp b/modules/core/cs_info.cpp
index 7f4784270..d842ad4ea 100644
--- a/modules/core/cs_info.cpp
+++ b/modules/core/cs_info.cpp
@@ -46,7 +46,7 @@ class CommandCSInfo : public Command
if (ci->HasFlag(CI_FORBIDDEN))
{
- if (is_oper(u) && !ci->forbidby.empty())
+ if (u->HasMode(UMODE_OPER) && !ci->forbidby.empty())
source.Reply(CHAN_X_FORBIDDEN_OPER, chan.c_str(), ci->forbidby.c_str(), !ci->forbidreason.empty() ? ci->forbidreason.c_str() : GetString(u, NO_REASON).c_str());
else
source.Reply(CHAN_X_FORBIDDEN, chan.c_str());
diff --git a/modules/core/cs_list.cpp b/modules/core/cs_list.cpp
index 87d0afb79..73947c9de 100644
--- a/modules/core/cs_list.cpp
+++ b/modules/core/cs_list.cpp
@@ -33,7 +33,7 @@ public:
int count = 0, from = 0, to = 0;
bool forbidden = false, suspended = false, channoexpire = false;
- if (Config->CSListOpersOnly && !is_oper(u))
+ if (Config->CSListOpersOnly && !u->HasMode(UMODE_OPER))
{
source.Reply(ACCESS_DENIED);
return MOD_STOP;
diff --git a/modules/core/cs_suspend.cpp b/modules/core/cs_suspend.cpp
index ee0dd4d17..c2172dcb2 100644
--- a/modules/core/cs_suspend.cpp
+++ b/modules/core/cs_suspend.cpp
@@ -56,7 +56,7 @@ class CommandCSSuspend : public Command
{
UserContainer *uc = *it++;
- if (is_oper(uc->user))
+ if (uc->user->HasMode(UMODE_OPER))
continue;
c->Kick(NULL, uc->user, "%s", !reason.empty() ? reason.c_str() : GetString(uc->user->Account(), CHAN_SUSPEND_REASON).c_str());
diff --git a/modules/core/cs_unban.cpp b/modules/core/cs_unban.cpp
index f9b5908e0..df5d2877e 100644
--- a/modules/core/cs_unban.cpp
+++ b/modules/core/cs_unban.cpp
@@ -48,7 +48,7 @@ class CommandCSUnban : public Command
return MOD_CONT;
}
- common_unban(ci, u2->nick);
+ common_unban(ci, u2);
if (u2 == u)
source.Reply(CHAN_UNBANNED, c->name.c_str());
else
diff --git a/modules/core/ns_ghost.cpp b/modules/core/ns_ghost.cpp
index 14796bc78..323b0378c 100644
--- a/modules/core/ns_ghost.cpp
+++ b/modules/core/ns_ghost.cpp
@@ -49,7 +49,7 @@ class CommandNSGhost : public Command
{
Log(LOG_COMMAND, u, this) << "for " << nick;
Anope::string buf = "GHOST command used by " + u->nick;
- kill_user(Config->s_NickServ, nick, buf);
+ kill_user(Config->s_NickServ, user, buf);
source.Reply(NICK_GHOST_KILLED, nick.c_str());
}
}
diff --git a/modules/core/ns_group.cpp b/modules/core/ns_group.cpp
index 697c29447..ebf6c74af 100644
--- a/modules/core/ns_group.cpp
+++ b/modules/core/ns_group.cpp
@@ -48,7 +48,7 @@ class CommandNSGroup : public Command
if (Config->RestrictOperNicks)
for (std::list<std::pair<Anope::string, Anope::string> >::iterator it = Config->Opers.begin(), it_end = Config->Opers.end(); it != it_end; ++it)
- if (!is_oper(u) && u->nick.find_ci(it->first) != Anope::string::npos)
+ if (!u->HasMode(UMODE_OPER) && u->nick.find_ci(it->first) != Anope::string::npos)
{
source.Reply(NICK_CANNOT_BE_REGISTERED, u->nick.c_str());
return MOD_CONT;
diff --git a/modules/core/ns_info.cpp b/modules/core/ns_info.cpp
index 32d8fe8f7..a3ee2f70f 100644
--- a/modules/core/ns_info.cpp
+++ b/modules/core/ns_info.cpp
@@ -57,7 +57,7 @@ class CommandNSInfo : public Command
}
else if (na->HasFlag(NS_FORBIDDEN))
{
- if (is_oper(u) && !na->last_usermask.empty())
+ if (u->HasMode(UMODE_OPER) && !na->last_usermask.empty())
source.Reply(NICK_X_FORBIDDEN_OPER, nick.c_str(), na->last_usermask.c_str(), !na->last_realname.empty() ? na->last_realname.c_str() : GetString(u, NO_REASON).c_str());
else
source.Reply(NICK_X_FORBIDDEN, nick.c_str());
diff --git a/modules/core/ns_list.cpp b/modules/core/ns_list.cpp
index 89fba90d8..bf7a0efbd 100644
--- a/modules/core/ns_list.cpp
+++ b/modules/core/ns_list.cpp
@@ -49,7 +49,7 @@ class CommandNSList : public Command
suspended = nsnoexpire = forbidden = unconfirmed = false;
- if (Config->NSListOpersOnly && !is_oper(u)) /* reverse the help logic */
+ if (Config->NSListOpersOnly && !u->HasMode(UMODE_OPER)) /* reverse the help logic */
{
source.Reply(ACCESS_DENIED);
return MOD_STOP;
diff --git a/modules/core/ns_register.cpp b/modules/core/ns_register.cpp
index abcba133d..edf8181e5 100644
--- a/modules/core/ns_register.cpp
+++ b/modules/core/ns_register.cpp
@@ -196,7 +196,7 @@ class CommandNSRegister : public CommandNSConfirm
return MOD_CONT;
}
- if (!is_oper(u) && Config->NickRegDelay && Anope::CurTime - u->my_signon < Config->NickRegDelay)
+ if (!u->HasMode(UMODE_OPER) && Config->NickRegDelay && Anope::CurTime - u->my_signon < Config->NickRegDelay)
{
source.Reply(NICK_REG_DELAY, Config->NickRegDelay);
return MOD_CONT;
@@ -230,7 +230,7 @@ class CommandNSRegister : public CommandNSConfirm
{
Anope::string nick = it->first;
- if (u->nick.find_ci(nick) != Anope::string::npos && !is_oper(u))
+ if (u->nick.find_ci(nick) != Anope::string::npos && !u->HasMode(UMODE_OPER))
{
source.Reply(NICK_CANNOT_BE_REGISTERED, u->nick.c_str());
return MOD_CONT;
diff --git a/modules/core/os_chankill.cpp b/modules/core/os_chankill.cpp
index 3201858e7..506adbdfb 100644
--- a/modules/core/os_chankill.cpp
+++ b/modules/core/os_chankill.cpp
@@ -70,7 +70,7 @@ class CommandOSChanKill : public Command
{
UserContainer *uc = *it++;
- if (is_oper(uc->user))
+ if (uc->user->HasMode(UMODE_OPER))
continue;
SGLine->Add(OperServ, u, "*@" + uc->user->host, expires, realreason);
diff --git a/modules/core/os_defcon.cpp b/modules/core/os_defcon.cpp
index 0dd9dcedb..cc8809586 100644
--- a/modules/core/os_defcon.cpp
+++ b/modules/core/os_defcon.cpp
@@ -164,7 +164,7 @@ class OSDefcon : public Module
}
if (CheckDefCon(DEFCON_NO_NEW_CLIENTS) || CheckDefCon(DEFCON_AKILL_NEW_CLIENTS))
- kill_user(Config->s_OperServ, u->nick, Config->DefConAkillReason);
+ kill_user(Config->s_OperServ, u, Config->DefConAkillReason);
return EVENT_STOP;
}
@@ -208,7 +208,7 @@ class OSDefcon : public Module
EventReturn OnPreCommandRun(User *u, BotInfo *bi, Anope::string &command, Anope::string &message, ChannelInfo *ci)
{
- if (!is_oper(u) && (CheckDefCon(DEFCON_OPER_ONLY) || CheckDefCon(DEFCON_SILENT_OPER_ONLY)))
+ if (!u->HasMode(UMODE_OPER) && (CheckDefCon(DEFCON_OPER_ONLY) || CheckDefCon(DEFCON_SILENT_OPER_ONLY)))
{
if (!CheckDefCon(DEFCON_SILENT_OPER_ONLY))
u->SendMessage(bi, OPER_DEFCON_DENIED);
@@ -281,7 +281,7 @@ class OSDefcon : public Module
if (!Config->SessionLimitDetailsLoc.empty())
ircdproto->SendMessage(OperServ, u->nick, "%s", Config->SessionLimitDetailsLoc.c_str());
- kill_user(Config->s_OperServ, u->nick, "Session limit exceeded");
+ kill_user(Config->s_OperServ, u, "Session limit exceeded");
++session->hits;
if (Config->MaxSessionKill && session->hits >= Config->MaxSessionKill)
{
diff --git a/modules/core/os_noop.cpp b/modules/core/os_noop.cpp
index 0d740d29a..1e799d4d3 100644
--- a/modules/core/os_noop.cpp
+++ b/modules/core/os_noop.cpp
@@ -44,8 +44,8 @@ class CommandOSNOOP : public Command
User *u2 = *it;
++it;
- if (u2 && is_oper(u2) && Anope::Match(u2->server->GetName(), server, true))
- kill_user(Config->s_OperServ, u2->nick, reason);
+ if (u2 && u2->HasMode(UMODE_OPER) && Anope::Match(u2->server->GetName(), server, true))
+ kill_user(Config->s_OperServ, u2, reason);
}
}
else if (cmd.equals_ci("REVOKE"))
diff --git a/modules/extra/cs_entrymsg.cpp b/modules/extra/cs_entrymsg.cpp
index aae1b5f0e..e44d21827 100644
--- a/modules/extra/cs_entrymsg.cpp
+++ b/modules/extra/cs_entrymsg.cpp
@@ -174,7 +174,7 @@ class CSEntryMessage : public Module
if (c->ci->GetExtRegular("cs_entrymsg", messages))
for (unsigned i = 0; i < messages.size(); ++i)
- u->SendMessage(whosends(c->ci)->nick, "[%s] %s", c->ci->name.c_str(), messages[i].message.c_str());
+ u->SendMessage(whosends(c->ci), "[%s] %s", c->ci->name.c_str(), messages[i].message.c_str());
}
}
diff --git a/modules/extra/cs_set_misc.cpp b/modules/extra/cs_set_misc.cpp
index 9f4ade29c..2e5fa5965 100644
--- a/modules/extra/cs_set_misc.cpp
+++ b/modules/extra/cs_set_misc.cpp
@@ -173,7 +173,7 @@ class CSSetMisc : public Module
Anope::string value;
if (ci->GetExtRegular("chanserv:" + it->first, value))
- u->SendMessage(Config->s_ChanServ, " %s: %s", it->first.c_str(), value.c_str());
+ u->SendMessage(ChanServ, " %s: %s", it->first.c_str(), value.c_str());
}
}
diff --git a/modules/extra/m_alias.cpp b/modules/extra/m_alias.cpp
index de23557a3..3b9556772 100644
--- a/modules/extra/m_alias.cpp
+++ b/modules/extra/m_alias.cpp
@@ -66,7 +66,7 @@ class ModuleAlias : public Module
if (fantasy != alias.fantasy)
return EVENT_CONTINUE;
- else if (!is_oper(u) && alias.operonly)
+ else if (!u->HasMode(UMODE_OPER) && alias.operonly)
return EVENT_CONTINUE;
else if (!fantasy && !bi->nick.equals_ci(alias.client))
return EVENT_CONTINUE;
diff --git a/modules/extra/m_xmlrpc_main.cpp b/modules/extra/m_xmlrpc_main.cpp
index 74b570ee2..59088792f 100644
--- a/modules/extra/m_xmlrpc_main.cpp
+++ b/modules/extra/m_xmlrpc_main.cpp
@@ -13,7 +13,7 @@ class XMLRPCUser : public User
this->server = Me;
}
- void SendMessage(const Anope::string &source, const Anope::string &msg)
+ void SendMessage(BotInfo *, const Anope::string &msg)
{
this->out += msg + "\n";
}
diff --git a/modules/extra/ns_set_misc.cpp b/modules/extra/ns_set_misc.cpp
index 65dfadc2d..b38c98ae7 100644
--- a/modules/extra/ns_set_misc.cpp
+++ b/modules/extra/ns_set_misc.cpp
@@ -176,7 +176,7 @@ class NSSetMisc : public Module
Anope::string value;
if (na->nc->GetExtRegular("nickserv:" + it->first, value))
- u->SendMessage(Config->s_NickServ, " %s: %s", it->first.c_str(), value.c_str());
+ u->SendMessage(NickServ, " %s: %s", it->first.c_str(), value.c_str());
}
}
diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp
index 7c0a23112..0dc409b29 100644
--- a/modules/protocol/bahamut.cpp
+++ b/modules/protocol/bahamut.cpp
@@ -287,366 +287,263 @@ class BahamutIRCdProto : public IRCDProto
ircdproto->SendMode(NickServ, u, "+d %d", u->timestamp);
}
-} ircd_proto;
+};
-/* EVENT: SJOIN */
-bool event_sjoin(const Anope::string &source, const std::vector<Anope::string> &params)
+class BahamutIRCdMessage : public IRCdMessage
{
- Channel *c = findchan(params[1]);
- time_t ts = Anope::string(params[0]).is_pos_number_only() ? convertTo<time_t>(params[0]) : 0;
- bool keep_their_modes = false;
-
- if (!c)
+ public:
+ bool OnMode(const Anope::string &source, const std::vector<Anope::string> &params)
{
- c = new Channel(params[1], ts);
- c->SetFlag(CH_SYNCING);
+ if (params.size() < 3)
+ return true;
+
+ if (params[0][0] == '#' || params[0][0] == '&')
+ do_cmode(source, params[0], params[2], params[1]);
+ else
+ do_umode(source, params[0], params[1]);
+
+ return true;
}
- /* Our creation time is newer than what the server gave us */
- else if (c->creation_time > ts)
+
+ /*
+ ** NICK - new
+ ** source = NULL
+ ** parv[0] = nickname
+ ** parv[1] = hopcount
+ ** parv[2] = timestamp
+ ** parv[3] = modes
+ ** parv[4] = username
+ ** parv[5] = hostname
+ ** parv[6] = server
+ ** parv[7] = servicestamp
+ ** parv[8] = IP
+ ** parv[9] = info
+ ** NICK - change
+ ** source = oldnick
+ ** parv[0] = new nickname
+ ** parv[1] = hopcount
+ */
+ bool OnNick(const Anope::string &source, const std::vector<Anope::string> &params)
{
- c->creation_time = ts;
- c->Reset();
+ if (params.size() != 2)
+ {
+ User *user = do_nick(source, params[0], params[4], params[5], params[6], params[9], Anope::string(params[2]).is_pos_number_only() ? convertTo<time_t>(params[2]) : 0, params[8], "", "", params[3]);
+ if (user)
+ {
+ NickAlias *na;
+ if (user->timestamp == convertTo<time_t>(params[7]) && (na = findnick(user->nick)))
+ {
+ user->Login(na->nc);
+ user->SetMode(NickServ, UMODE_REGISTERED);
+ }
+ else
+ validate_user(user);
+ }
+ }
+ else
+ do_nick(source, params[0], "", "", "", "", Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : 0, "", "", "", "");
- /* Reset mlock */
- check_modes(c);
+ return true;
}
- /* Their TS is newer than ours, our modes > theirs, unset their modes if need be */
- else if (ts > c->creation_time)
- keep_their_modes = false;
- /* If we need to keep their modes, and this SJOIN string contains modes */
- if (keep_their_modes && params.size() >= 4)
+ bool OnServer(const Anope::string &source, const std::vector<Anope::string> &params)
{
- /* Set the modes internally */
- Anope::string modes;
- for (unsigned i = 2; i < params.size(); ++i)
- modes += " " + params[i];
- if (!modes.empty())
- modes.erase(modes.begin());
- c->SetModesInternal(NULL, modes);
+ do_server(source, params[0], Anope::string(params[1]).is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0, params[2], "");
+ return true;
}
- /* For a reason unknown to me, bahamut will send a SJOIN from the user joining a channel
- * if the channel already existed
- */
- if (!c->HasFlag(CH_SYNCING) && params.size() == 2)
+ bool OnTopic(const Anope::string &, const std::vector<Anope::string> &params)
{
- User *u = finduser(source);
- if (!u)
- Log(LOG_DEBUG) << "SJOIN for nonexistant user " << source << " on " << c->name;
- else
+ if (params.size() < 4)
+ return true;
+
+ Channel *c = findchan(params[0]);
+ if (!c)
{
- EventReturn MOD_RESULT;
- FOREACH_RESULT(I_OnPreJoinChannel, OnPreJoinChannel(u, c));
+ Log() << "TOPIC for nonexistant channel " << params[0];
+ return true;
+ }
+
+ c->ChangeTopicInternal(params[1], params[3], Anope::string(params[2]).is_pos_number_only() ? convertTo<time_t>(params[2]) : Anope::CurTime);