1
0
mirror of https://github.com/anope/anope.git synced 2026-06-25 13:46:38 +02:00

Compare commits

...

13 Commits

20 changed files with 309 additions and 320 deletions
+2 -2
View File
@@ -593,7 +593,7 @@ options
* nickserv/getpass nickserv/sendpass nickserv/getemail nickserv/suspend
* nickserv/resetpass
*
* hostserv/set - Can add/modify/delete any vhost
* hostserv/set hostserv/del
*
* operserv/global operserv/news operserv/stats operserv/kick
* operserv/mode operserv/session operserv/modlist operserv/ignore
@@ -633,7 +633,7 @@ opertype
opertype
{
name = "Helper"
privs = "hostserv/set"
privs = "hostserv/*"
}
/*
+1
View File
@@ -16,6 +16,7 @@ A Added a sha_256 encryption module
A Added the ability to load multiple encryption modules, and the ability to seamlessly convert your database between diferent encryptions
A Added configuration options to allow Anope to reconnect if it disconnects from the uplink instead of dieing
A Added support for linking with IPv6
A Added support for InspIRCd2.0's customprefix module
F Unban command to accept an optional nick arg
F Some typos in services.conf
F Crash when users change their host that are identified to a group, but not a nick
+1
View File
@@ -13,6 +13,7 @@ uplink:ipv6 added to enable IPv6 connectivity
options:maxretries added to specify the number of reconnect attempts allowed
options:retrywait added to specify how long to wait between reconnect attempts
opertype command chanserv/aop/list removed as it was unnecessary, use chanserv/access/list instead
opertype command privilege hostserv/del added
** MODIFIED CONFIGURATION DIRECTIVES **
options:encryption added enc_sha256
+4 -4
View File
@@ -117,7 +117,7 @@ class CoreExport UserMode : public Mode
virtual ~UserMode();
};
class UserModeParam : public UserMode
class CoreExport UserModeParam : public UserMode
{
public:
/** Default constructor
@@ -269,10 +269,10 @@ class CoreExport ChannelModeExcept : public ChannelModeList
/** Channel mode +I
*/
class CoreExport ChannelModeInvite : public ChannelModeList
class CoreExport ChannelModeInvex : public ChannelModeList
{
public:
ChannelModeInvite(char modeChar) : ChannelModeList(CMODE_INVITEOVERRIDE, modeChar) { }
public:
ChannelModeInvex(char modeChar) : ChannelModeList(CMODE_INVITEOVERRIDE, modeChar) { }
void AddMask(Channel *chan, const char *mask);
+1 -1
View File
@@ -18,7 +18,7 @@
class CommandHSDel : public Command
{
public:
CommandHSDel() : Command("DEL", 1, 1, "hostserv/set")
CommandHSDel() : Command("DEL", 1, 1, "hostserv/del")
{
}
+1 -1
View File
@@ -18,7 +18,7 @@
class CommandHSDelAll : public Command
{
public:
CommandHSDelAll() : Command("DELALL", 1, 1, "hostserv/set")
CommandHSDelAll() : Command("DELALL", 1, 1, "hostserv/del")
{
}
+4 -2
View File
@@ -89,10 +89,12 @@ class CommandNSDrop : public Command
notice_lang(Config.s_NickServ, u, NICK_X_DROPPED, nick);
else
notice_lang(Config.s_NickServ, u, NICK_DROPPED);
if (my_nick)
delete [] my_nick;
}
}
if (my_nick)
delete [] my_nick;
return MOD_CONT;
}
+9
View File
@@ -557,6 +557,15 @@ int main(int ac, char **av, char **envp)
{
FOREACH_MOD(I_OnServerDisconnect, OnServerDisconnect());
/* Clear all of our users */
User *u = firstuser();
while (u)
{
User *unext = nextuser();
delete u;
u = unext;
}
unsigned j = 0;
for (; j < (Config.MaxRetries ? Config.MaxRetries : j + 1); ++j)
{
+2 -2
View File
@@ -361,7 +361,7 @@ void ChannelModeExcept::DelMask(Channel *chan, const char *mask)
* @param chan The channel
* @param mask The invex
*/
void ChannelModeInvite::AddMask(Channel *chan, const char *mask)
void ChannelModeInvex::AddMask(Channel *chan, const char *mask)
{
Entry *invite;
@@ -388,7 +388,7 @@ void ChannelModeInvite::AddMask(Channel *chan, const char *mask)
* @param chan The channel
* @param mask The index
*/
void ChannelModeInvite::DelMask(Channel *chan, const char *mask)
void ChannelModeInvex::DelMask(Channel *chan, const char *mask)
{
Entry *invite;
+15 -8
View File
@@ -65,7 +65,7 @@ struct HostRequest
time_t time;
};
std::map<std::string, HostRequest *> Requests;
std::map<ci::string, HostRequest *> Requests;
static Module *me;
@@ -221,10 +221,11 @@ class CommandHSActivate : public Command
if ((na = findnick(nick)))
{
std::map<std::string, HostRequest *>::iterator it = Requests.find(na->nick);
std::map<ci::string, HostRequest *>::iterator it = Requests.find(na->nick);
if (it != Requests.end())
{
na->hostinfo.SetVhost(it->second->ident, it->second->host, u->nick, it->second->time);
na->hostinfo.SetVhost(it->second->ident, it->second->host, u->nick, it->second->time);
delete it->second;
Requests.erase(it);
if (HSRequestMemoUser)
@@ -271,9 +272,12 @@ class CommandHSReject : public Command
const char *nick = params[0].c_str();
const char *reason = params.size() > 1 ? params[1].c_str() : NULL;
std::map<std::string, HostRequest *>::iterator it = Requests.find(nick);
std::map<ci::string, HostRequest *>::iterator it = Requests.find(nick);
if (it != Requests.end())
{
delete it->second;
Requests.erase(it);
if (HSRequestMemoUser)
{
if (reason)
@@ -319,7 +323,7 @@ class HSListBase : public Command
unsigned display_counter = 0;
tm *tm;
for (std::map<std::string, HostRequest *>::iterator it = Requests.begin(); it != Requests.end(); ++it)
for (std::map<ci::string, HostRequest *>::iterator it = Requests.begin(), it_end = Requests.end(); it != it_end; ++it)
{
HostRequest *hr = it->second;
if (((counter >= from && counter <= to) || (!from && !to)) && display_counter < Config.NSListMax)
@@ -684,7 +688,7 @@ class HSRequest : public Module
if (na)
{
std::map<std::string, HostRequest *>::iterator it = Requests.find(na->nick);
std::map<ci::string, HostRequest *>::iterator it = Requests.find(na->nick);
if (it != Requests.end())
{
@@ -719,7 +723,7 @@ class HSRequest : public Module
void OnDatabaseWrite(void (*Write)(const std::string &))
{
for (std::map<std::string, HostRequest *>::iterator it = Requests.begin(); it != Requests.end(); ++it)
for (std::map<ci::string, HostRequest *>::iterator it = Requests.begin(), it_end = Requests.end(); it != it_end; ++it)
{
HostRequest *hr = it->second;
std::stringstream buf;
@@ -806,9 +810,12 @@ void my_add_host_request(char *nick, char *vIdent, char *vhost, char *creator, t
hr->ident = vIdent ? vIdent : "";
hr->host = vhost;
hr->time = tmp_time;
std::map<std::string, HostRequest *>::iterator it = Requests.find(nick);
std::map<ci::string, HostRequest *>::iterator it = Requests.find(nick);
if (it != Requests.end())
{
delete it->second;
Requests.erase(it);
}
Requests.insert(std::make_pair(nick, hr));
}
+4 -5
View File
@@ -284,14 +284,13 @@ int split_buf(char *buf, const char ***argv, int colon_special)
void process(const std::string &buffer)
{
int retVal = 0;
Message *current = NULL;
char source[64];
char cmd[64];
char buf[512]; /* Longest legal IRC command line */
char source[64] = "";
char cmd[64] = "";
char buf[1024] = ""; // XXX InspIRCd 2.0 can send messages longer than 512 characters to servers... how disappointing.
char *s;
int ac; /* Parameters for the command */
const char **av;
Message *m;
Message *m, *current = NULL;
/* zero out the buffers before we do much else */
*buf = '\0';
+2 -2
View File
@@ -386,7 +386,7 @@ int anope_event_opertype(const char *source, int ac, const char **av)
int anope_event_fmode(const char *source, int ac, const char **av)
{
const char *newav[25];
const char *newav[128];
int n, o;
Channel *c;
@@ -920,7 +920,7 @@ int anope_event_capab(const char *source, int ac, const char **av)
ModeManager::AddChannelMode(new ChannelModeExcept('e'));
continue;
case 'I':
ModeManager::AddChannelMode(new ChannelModeInvite('I'));
ModeManager::AddChannelMode(new ChannelModeInvex('I'));
continue;
default:
ModeManager::AddChannelMode(new ChannelModeList(CMODE_END, modebuf[t]));
+2 -5
View File
@@ -432,7 +432,7 @@ int anope_event_opertype(const char *source, int ac, const char **av)
int anope_event_fmode(const char *source, int ac, const char **av)
{
const char *newav[25];
const char *newav[128];
int n, o;
Channel *c;
@@ -1022,7 +1022,7 @@ int anope_event_capab(const char *source, int ac, const char **av)
ModeManager::AddChannelMode(new ChannelModeExcept('e'));
continue;
case 'I':
ModeManager::AddChannelMode(new ChannelModeInvite('I'));
ModeManager::AddChannelMode(new ChannelModeInvex('I'));
continue;
/* InspIRCd sends q and a here if they have no prefixes */
case 'q':
@@ -1175,9 +1175,6 @@ int anope_event_capab(const char *source, int ac, const char **av)
case 'h':
ModeManager::AddUserMode(new UserMode(UMODE_HELPOP, 'h'));
continue;
case 's':
ModeManager::AddUserMode(new UserMode(UMODE_STRIPCOLOR, 'S'));
continue;
case 'B':
ModeManager::AddUserMode(new UserMode(UMODE_BOT, 'B'));
continue;
+242 -273
View File
@@ -76,14 +76,9 @@ IRCDVar myIrcd[] = {
};
static int has_servicesmod = 0;
static int has_globopsmod = 0;
static int has_svsholdmod = 0;
static int has_chghostmod = 0;
static int has_chgidentmod = 0;
static int has_messagefloodmod = 0;
static int has_banexceptionmod = 0;
static int has_inviteexceptionmod = 0;
static int has_hidechansmod = 0;
/* Previously introduced user during burst */
static User *prev_u_intro = NULL;
@@ -251,6 +246,9 @@ class InspIRCdProto : public IRCDProto
void SendConnect()
{
send_cmd(NULL, "CAPAB START 1202");
send_cmd(NULL, "CAPAB CAPABILITIES :PROTOCOL=1202");
send_cmd(NULL, "CAPAB END");
inspircd_cmd_pass(uplink_server->password);
me_server = new_server(NULL, Config.ServerName, Config.ServerDesc, SERVER_ISME, TS6SID);
SendServer(me_server);
@@ -332,10 +330,7 @@ class InspIRCdProto : public IRCDProto
void SendGlobopsInternal(BotInfo *source, const char *buf)
{
if (has_globopsmod)
send_cmd(source ? source->uid : TS6SID, "SNONOTICE g :%s", buf);
else
send_cmd(source ? source->uid : TS6SID, "SNONOTICE A :%s", buf);
send_cmd(source ? source->uid : TS6SID, "SNONOTICE g :%s", buf);
}
void SendAccountLogin(User *u, NickCore *account)
@@ -431,7 +426,7 @@ int anope_event_opertype(const char *source, int ac, const char **av)
int anope_event_fmode(const char *source, int ac, const char **av)
{
const char *newav[25];
const char *newav[128];
int n, o;
Channel *c;
@@ -781,16 +776,15 @@ int anope_event_setident(const char *source, int ac, const char **av)
int anope_event_chgident(const char *source, int ac, const char **av)
{
User *u;
User *u = finduser(source);
u = finduser(av[0]);
if (!u)
{
Alog(LOG_DEBUG) << "CHGIDENT for nonexistent user " << av[0];
Alog(LOG_DEBUG) << "FIDENT for nonexistent user " << source;
return MOD_CONT;
}
u->SetIdent(av[1]);
u->SetIdent(av[0]);
return MOD_CONT;
}
@@ -955,50 +949,217 @@ int anope_event_metadata(const char *source, int ac, const char **av)
int anope_event_capab(const char *source, int ac, const char **av)
{
if (strcasecmp(av[0], "START") == 0) {
if (strcasecmp(av[0], "START") == 0)
{
if (ac < 2 || atoi(av[1]) < 1202)
{
send_cmd(NULL, "ERROR :Protocol mismatch, no or invalid protocol version given in CAPAB START");
quitmsg = "Protocol mismatch, no or invalid protocol version given in CAPAB START";
quitting = 1;
return MOD_STOP;
}
/* reset CAPAB */
has_servicesmod = 0;
has_globopsmod = 0;
has_svsholdmod = 0;
has_chghostmod = 0;
has_chgidentmod = 0;
has_messagefloodmod = 0;
has_banexceptionmod = 0;
has_inviteexceptionmod = 0;
has_hidechansmod = 0;
}
else if (strcasecmp(av[0], "CHANMODES") == 0)
{
spacesepstream ssep(av[1]);
std::string capab;
} else if (strcasecmp(av[0], "MODULES") == 0) {
if (strstr(av[1], "m_globops.so")) {
has_globopsmod = 1;
while (ssep.GetToken(capab))
{
std::string modename = capab.substr(0, capab.find('='));
std::string modechar = capab.substr(capab.find('=') + 1);
ChannelMode *cm = NULL;
if (modename == "admin")
cm = new ChannelModeStatus(CMODE_PROTECT, modechar[1], modechar[0]);
else if (modename == "allowinvite")
cm = new ChannelMode(CMODE_ALLINVITE, modechar[0]);
else if (modename == "auditorium")
cm = new ChannelMode(CMODE_AUDITORIUM, modechar[0]);
else if (modename == "autoop")
continue; // XXX Not currently tracked
else if (modename == "ban")
cm = new ChannelModeBan(modechar[0]);
else if (modename == "banexception")
cm = new ChannelModeExcept(modechar[0]);
else if (modename == "blockcaps")
cm = new ChannelMode(CMODE_BLOCKCAPS, modechar[0]);
else if (modename == "blockcolor")
cm = new ChannelMode(CMODE_BLOCKCOLOR, modechar[0]);
else if (modename == "c_registered")
cm = new ChannelModeRegistered(modechar[0]);
else if (modename == "censor")
cm = new ChannelMode(CMODE_FILTER, modechar[0]);
else if (modename == "delayjoin")
cm = new ChannelMode(CMODE_DELAYEDJOIN, modechar[0]);
else if (modename == "delaymsg")
continue;
else if (modename == "exemptchanops")
continue; // XXX
else if (modename == "filter")
continue; // XXX
else if (modename == "flood")
cm = new ChannelModeFlood(modechar[0], true);
else if (modename == "founder")
cm = new ChannelModeStatus(CMODE_OWNER, modechar[1], modechar[0]);
else if (modename == "halfop")
cm = new ChannelModeStatus(CMODE_HALFOP, modechar[1], modechar[0]);
else if (modename == "history")
continue; // XXX
else if (modename == "invex")
cm = new ChannelModeInvex(modechar[0]);
else if (modename == "inviteonly")
cm = new ChannelMode(CMODE_INVITE, modechar[0]);
else if (modename == "joinflood")
cm = new ChannelModeParam(CMODE_JOINFLOOD, modechar[0], true);
else if (modename == "key")
cm = new ChannelModeKey(modechar[0]);
else if (modename == "kicknorejoin")
cm = new ChannelModeParam(CMODE_NOREJOIN, modechar[0], true);
else if (modename == "limit")
cm = new ChannelModeParam(CMODE_LIMIT, modechar[0], true);
else if (modename == "moderated")
cm = new ChannelMode(CMODE_MODERATED, modechar[0]);
else if (modename == "namebase")
continue; // XXX
else if (modename == "nickflood")
cm = new ChannelModeParam(CMODE_NICKFLOOD, modechar[0], true);
else if (modename == "noctcp")
cm = new ChannelMode(CMODE_NOCTCP, modechar[0]);
else if (modename == "noextmsg")
cm = new ChannelMode(CMODE_NOEXTERNAL, modechar[0]);
else if (modename == "nokick")
cm = new ChannelMode(CMODE_NOKICK, modechar[0]);
else if (modename == "noknock")
cm = new ChannelMode(CMODE_NOKNOCK, modechar[0]);
else if (modename == "nonick")
cm = new ChannelMode(CMODE_NONICK, modechar[0]);
else if (modename == "nonotice")
cm = new ChannelMode(CMODE_NONOTICE, modechar[0]);
else if (modename == "op")
cm = new ChannelModeStatus(CMODE_OP, modechar[1], modechar[0]);
else if (modename == "operonly")
cm = new ChannelModeOper(modechar[0]);
else if (modename == "permanent")
cm = new ChannelMode(CMODE_PERM, modechar[0]);
else if (modename == "private")
cm = new ChannelMode(CMODE_PRIVATE, modechar[0]);
else if (modename == "redirect")
cm = new ChannelModeParam(CMODE_REDIRECT, modechar[0], true);
else if (modename == "reginvite")
cm = new ChannelMode(CMODE_REGISTEREDONLY, modechar[0]);
else if (modename == "regmoderated")
cm = new ChannelMode(CMODE_REGMODERATED, modechar[0]);
else if (modename == "secret")
cm = new ChannelMode(CMODE_SECRET, modechar[0]);
else if (modename == "sslonly")
cm = new ChannelMode(CMODE_SSL, modechar[0]);
else if (modename == "stripcolor")
cm = new ChannelMode(CMODE_STRIPCOLOR, modechar[0]);
else if (modename == "topiclock")
cm = new ChannelMode(CMODE_TOPIC, modechar[0]);
else if (modename == "voice")
cm = new ChannelModeStatus(CMODE_VOICE, modechar[1], modechar[0]);
/* Unknown status mode, (customprefix) - add it */
else if (modechar.length() == 2)
cm = new ChannelModeStatus(CMODE_END, modechar[1], modechar[0]);
if (cm)
ModeManager::AddChannelMode(cm);
else
Alog() << "Unrecognized mode string in CAPAB CHANMODES: " << capab;
}
if (strstr(av[1], "m_services_account.so")) {
has_servicesmod = 1;
}
else if (strcasecmp(av[0], "USERMODES") == 0)
{
spacesepstream ssep(av[1]);
std::string capab;
while (ssep.GetToken(capab))
{
std::string modename = capab.substr(0, capab.find('='));
std::string modechar = capab.substr(capab.find('=') + 1);
UserMode *um = NULL;
if (modename == "bot")
um = new UserMode(UMODE_BOT, modechar[0]);
else if (modename == "callerid")
um = new UserMode(UMODE_CALLERID, modechar[0]);
else if (modename == "cloak")
um = new UserMode(UMODE_CLOAK, modechar[0]);
else if (modename == "deaf")
um = new UserMode(UMODE_DEAF, modechar[0]);
else if (modename == "deaf_commonchan")
um = new UserMode(UMODE_COMMONCHANS, modechar[0]);
else if (modename == "helpop")
um = new UserMode(UMODE_HELPOP, modechar[0]);
else if (modename == "hidechans")
um = new UserMode(UMODE_PRIV, modechar[0]);
else if (modename == "hideoper")
um = new UserMode(UMODE_HIDEOPER, modechar[0]);
else if (modename == "invisible")
um = new UserMode(UMODE_INVIS, modechar[0]);
else if (modename == "oper")
um = new UserMode(UMODE_OPER, modechar[0]);
else if (modename == "regdeaf")
um = new UserMode(UMODE_REGPRIV, modechar[0]);
else if (modename == "servprotect")
um = new UserMode(UMODE_PROTECTED, modechar[0]);
else if (modename == "showwhois")
um = new UserMode(UMODE_WHOIS, modechar[0]);
else if (modename == "snomask")
continue; // XXX
else if (modename == "u_censor")
um = new UserMode(UMODE_FILTER, modechar[0]);
else if (modename == "u_registered")
um = new UserMode(UMODE_REGISTERED, modechar[0]);
else if (modename == "u_stripcolor")
um = new UserMode(UMODE_STRIPCOLOR, modechar[0]);
else if (modename == "wallops")
um = new UserMode(UMODE_WALLOPS, modechar[0]);
if (um)
ModeManager::AddUserMode(um);
else
Alog() << "Unrecognized mode string in CAPAB USERMODES: " << capab;
}
if (strstr(av[1], "m_svshold.so")) {
has_svsholdmod = 1;
}
else if (strcasecmp(av[0], "MODULES") == 0)
{
spacesepstream ssep(av[1]);
std::string module;
while (ssep.GetToken(module))
{
if (module == "m_svshold.so")
has_svsholdmod = 1;
}
if (strstr(av[1], "m_chghost.so")) {
has_chghostmod = 1;
}
else if (strcasecmp(av[0], "MODSUPPORT") == 0)
{
spacesepstream ssep(av[1]);
std::string module;
while (ssep.GetToken(module))
{
if (module == "m_services_account.so")
has_servicesmod = 1;
else if (module == "m_chghost.so")
has_chghostmod = 1;
else if (module == "m_chgident.so")
has_chgidentmod = 1;
else if (module == "m_servprotect.so")
ircd->pseudoclient_mode = "+Ik";
}
if (strstr(av[1], "m_chgident.so")) {
has_chgidentmod = 1;
}
if (strstr(av[1], "m_messageflood.so")) {
has_messagefloodmod = 1;
}
if (strstr(av[1], "m_banexception.so")) {
has_banexceptionmod = 1;
}
if (strstr(av[1], "m_inviteexception.so")) {
has_inviteexceptionmod = 1;
}
if (strstr(av[1], "m_hidechans.so")) {
has_hidechansmod = 1;
}
if (strstr(av[1], "m_servprotect.so")) {
ircd->pseudoclient_mode = "+Ik";
}
} else if (strcasecmp(av[0], "CAPABILITIES") == 0) {
}
else if (strcasecmp(av[0], "CAPABILITIES") == 0)
{
spacesepstream ssep(av[1]);
std::string capab;
while (ssep.GetToken(capab))
@@ -1012,151 +1173,34 @@ int anope_event_capab(const char *source, int ac, const char **av)
sep.GetToken(modebuf);
for (size_t t = 0; t < modebuf.size(); ++t)
{
switch (modebuf[t])
{
case 'b':
ModeManager::AddChannelMode(new ChannelModeBan('b'));
continue;
case 'e':
ModeManager::AddChannelMode(new ChannelModeExcept('e'));
continue;
case 'I':
ModeManager::AddChannelMode(new ChannelModeInvite('I'));
continue;
/* InspIRCd sends q and a here if they have no prefixes */
case 'q':
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OWNER, 'q', '@'));
continue;
case 'a':
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_PROTECT , 'a', '@'));
continue;
// XXX list modes needs a bit of a rewrite, we need to be able to support +g here
default:
ModeManager::AddChannelMode(new ChannelModeList(CMODE_END, modebuf[t]));
}
if (ModeManager::FindChannelModeByChar(modebuf[t]))
continue;
// XXX list modes needs a bit of a rewrite
ModeManager::AddChannelMode(new ChannelModeList(CMODE_END, modebuf[t]));
}
sep.GetToken(modebuf);
for (size_t t = 0; t < modebuf.size(); ++t)
{
switch (modebuf[t])
{
case 'k':
ModeManager::AddChannelMode(new ChannelModeKey('k'));
continue;
default:
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_END, modebuf[t]));
}
if (ModeManager::FindChannelModeByChar(modebuf[t]))
continue;
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_END, modebuf[t]));
}
sep.GetToken(modebuf);
for (size_t t = 0; t < modebuf.size(); ++t)
{
switch (modebuf[t])
{
case 'F':
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_NICKFLOOD, 'F', true));
continue;
case 'J':
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_NOREJOIN, 'J', true));
continue;
case 'L':
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_REDIRECT, 'L', true));
continue;
case 'f':
ModeManager::AddChannelMode(new ChannelModeFlood('f', true));
continue;
case 'j':
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_JOINFLOOD, 'j', true));
continue;
case 'l':
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_LIMIT, 'l', true));
continue;
default:
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_END, modebuf[t], true));
}
if (ModeManager::FindChannelModeByChar(modebuf[t]))
continue;
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_END, modebuf[t], true));
}
sep.GetToken(modebuf);
for (size_t t = 0; t < modebuf.size(); ++t)
{
switch (modebuf[t])
{
case 'A':
ModeManager::AddChannelMode(new ChannelMode(CMODE_ALLINVITE, 'A'));
continue;
case 'B':
ModeManager::AddChannelMode(new ChannelMode(CMODE_BLOCKCAPS, 'B'));
continue;
case 'C':
ModeManager::AddChannelMode(new ChannelMode(CMODE_NOCTCP, 'C'));
continue;
case 'D':
ModeManager::AddChannelMode(new ChannelMode(CMODE_DELAYEDJOIN, 'D'));
continue;
case 'G':
ModeManager::AddChannelMode(new ChannelMode(CMODE_FILTER, 'G'));
continue;
case 'K':
ModeManager::AddChannelMode(new ChannelMode(CMODE_NOKNOCK, 'K'));
continue;
case 'M':
ModeManager::AddChannelMode(new ChannelMode(CMODE_REGMODERATED, 'M'));
continue;
case 'N':
ModeManager::AddChannelMode(new ChannelMode(CMODE_NONICK, 'N'));
continue;
case 'O':
ModeManager::AddChannelMode(new ChannelModeOper('O'));
continue;
case 'P':
ModeManager::AddChannelMode(new ChannelMode(CMODE_PERM, 'P'));
continue;
case 'Q':
ModeManager::AddChannelMode(new ChannelMode(CMODE_NOKICK, 'Q'));
continue;
case 'R':
ModeManager::AddChannelMode(new ChannelMode(CMODE_REGISTEREDONLY, 'R'));
continue;
case 'S':
ModeManager::AddChannelMode(new ChannelMode(CMODE_STRIPCOLOR, 'S'));
continue;
case 'T':
ModeManager::AddChannelMode(new ChannelMode(CMODE_NONOTICE, 'T'));
continue;
case 'c':
ModeManager::AddChannelMode(new ChannelMode(CMODE_BLOCKCOLOR, 'c'));
continue;
case 'i':
ModeManager::AddChannelMode(new ChannelMode(CMODE_INVITE, 'i'));
continue;
case 'm':
ModeManager::AddChannelMode(new ChannelMode(CMODE_MODERATED, 'm'));
continue;
case 'n':
ModeManager::AddChannelMode(new ChannelMode(CMODE_NOEXTERNAL, 'n'));
continue;
case 'p':
ModeManager::AddChannelMode(new ChannelMode(CMODE_PRIVATE, 'p'));
continue;
case 'r':
ModeManager::AddChannelMode(new ChannelModeRegistered('r'));
continue;
case 's':
ModeManager::AddChannelMode(new ChannelMode(CMODE_SECRET, 's'));
continue;
case 't':
ModeManager::AddChannelMode(new ChannelMode(CMODE_TOPIC, 't'));
continue;
case 'u':
ModeManager::AddChannelMode(new ChannelMode(CMODE_AUDITORIUM, 'u'));
continue;
case 'z':
ModeManager::AddChannelMode(new ChannelMode(CMODE_SSL, 'z'));
continue;
default:
ModeManager::AddChannelMode(new ChannelMode(CMODE_END, modebuf[t]));
}
if (ModeManager::FindChannelModeByChar(modebuf[t]))
continue;
ModeManager::AddChannelMode(new ChannelMode(CMODE_END, modebuf[t]));
}
}
else if (capab.find("USERMODES") != std::string::npos)
@@ -1165,99 +1209,26 @@ int anope_event_capab(const char *source, int ac, const char **av)
commasepstream sep(modes);
std::string modebuf;
while (sep.GetToken(modebuf))
sep.GetToken(modebuf);
sep.GetToken(modebuf);
if (sep.GetToken(modebuf))
{
for (size_t t = 0; t < modebuf.size(); ++t)
{
switch (modebuf[t])
{
case 'h':
ModeManager::AddUserMode(new UserMode(UMODE_HELPOP, 'h'));
continue;
case 's':
ModeManager::AddUserMode(new UserMode(UMODE_STRIPCOLOR, 'S'));
continue;
case 'B':
ModeManager::AddUserMode(new UserMode(UMODE_BOT, 'B'));
continue;
case 'G':
ModeManager::AddUserMode(new UserMode(UMODE_FILTER, 'G'));
continue;
case 'H':
ModeManager::AddUserMode(new UserMode(UMODE_HIDEOPER, 'H'));
continue;
case 'I':
ModeManager::AddUserMode(new UserMode(UMODE_PRIV, 'I'));
continue;
case 'Q':
ModeManager::AddUserMode(new UserMode(UMODE_HIDDEN, 'Q'));
continue;
case 'R':
ModeManager::AddUserMode(new UserMode(UMODE_REGPRIV, 'R'));
continue;
case 'S':
ModeManager::AddUserMode(new UserMode(UMODE_STRIPCOLOR, 'S'));
continue;
case 'W':
ModeManager::AddUserMode(new UserMode(UMODE_WHOIS, 'W'));
continue;
case 'c':
ModeManager::AddUserMode(new UserMode(UMODE_COMMONCHANS, 'c'));
continue;
case 'g':
ModeManager::AddUserMode(new UserMode(UMODE_CALLERID, 'g'));
continue;
case 'i':
ModeManager::AddUserMode(new UserMode(UMODE_INVIS, 'i'));
continue;
case 'k':
ModeManager::AddUserMode(new UserMode(UMODE_PROTECTED, 'k'));
continue;
case 'o':
ModeManager::AddUserMode(new UserMode(UMODE_OPER, 'o'));
continue;
case 'r':
ModeManager::AddUserMode(new UserMode(UMODE_REGISTERED, 'r'));
continue;
case 'w':
ModeManager::AddUserMode(new UserMode(UMODE_WALLOPS, 'w'));
continue;
case 'x':
ModeManager::AddUserMode(new UserMode(UMODE_CLOAK, 'x'));
continue;
case 'd':
ModeManager::AddUserMode(new UserMode(UMODE_DEAF, 'd'));
continue;
default:
ModeManager::AddUserMode(new UserMode(UMODE_END, modebuf[t]));
}
if (ModeManager::FindUserModeByChar(modebuf[t]))
continue;
ModeManager::AddUserMode(new UserModeParam(UMODE_END, modebuf[t]));
}
}
}
else if (capab.find("PREFIX=(") != std::string::npos)
{
std::string modes(capab.begin() + 8, capab.begin() + capab.find(")"));
std::string chars(capab.begin() + capab.find(")") + 1, capab.end());
for (size_t t = 0; t < modes.size(); ++t)
if (sep.GetToken(modebuf))
{
switch (modes[t])
for (size_t t = 0; t < modebuf.size(); ++t)
{
case 'q':
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OWNER, 'q', chars[t]));
continue;
case 'a':
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_PROTECT, 'a', chars[t]));
continue;
case 'o':
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OP, 'o', chars[t]));
continue;
case 'h':
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_HALFOP, 'h', chars[t]));
continue;
case 'v':
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_VOICE, 'v', chars[t]));
if (ModeManager::FindUserModeByChar(modebuf[t]))
continue;
ModeManager::AddUserMode(new UserMode(UMODE_END, modebuf[t]));
}
}
}
@@ -1267,20 +1238,18 @@ int anope_event_capab(const char *source, int ac, const char **av)
ircd->maxmodes = atoi(maxmodes.c_str());
}
}
} else if (strcasecmp(av[0], "END") == 0) {
if (!has_globopsmod) {
send_cmd(NULL, "ERROR :m_globops is not loaded. This is required by Anope");
quitmsg = "Remote server does not have the m_globops module loaded, and this is required.";
quitting = 1;
return MOD_STOP;
}
if (!has_servicesmod) {
}
else if (strcasecmp(av[0], "END") == 0)
{
if (!has_servicesmod)
{
send_cmd(NULL, "ERROR :m_services_account.so is not loaded. This is required by Anope");
quitmsg = "ERROR: Remote server does not have the m_services_account module loaded, and this is required.";
quitting = 1;
return MOD_STOP;
}
if (!has_hidechansmod) {
if (!ModeManager::FindUserModeByName(UMODE_PRIV))
{
send_cmd(NULL, "ERROR :m_hidechans.so is not loaded. This is required by Anope");
quitmsg = "ERROR: Remote server does not have the m_hidechans module loaded, and this is required.";
quitting = 1;
@@ -1356,7 +1325,7 @@ void moduleAddIRCDMsgs() {
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("FIDENT", 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);
+1 -1
View File
@@ -854,7 +854,7 @@ void moduleAddModes()
/* b/e/I */
ModeManager::AddChannelMode(new ChannelModeBan('b'));
ModeManager::AddChannelMode(new ChannelModeExcept('e'));
ModeManager::AddChannelMode(new ChannelModeInvite('I'));
ModeManager::AddChannelMode(new ChannelModeInvex('I'));
/* v/h/o/a/q */
ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_VOICE, 'v', '+'));
+1 -1
View File
@@ -459,7 +459,7 @@ int anope_event_capab(const char *source, int ac, const char **av)
ModeManager::AddChannelMode(new ChannelModeExcept('e'));
continue;
case 'I':
ModeManager::AddChannelMode(new ChannelModeInvite('I'));
ModeManager::AddChannelMode(new ChannelModeInvex('I'));
continue;
default:
ModeManager::AddChannelMode(new ChannelModeList(CMODE_END, modebuf[t]));
+2 -5
View File
@@ -199,9 +199,9 @@ static void delete_server(Server * serv, const char *quitreason)
return;
}
Alog(LOG_DEBUG) << "delete_server() called, deleting " << serv->name << "(" << serv->suid << ") uplinked to "
Alog(LOG_DEBUG) << "delete_server() called, deleting " << serv->name << "(" << (serv->suid ? serv->suid : "") << ") uplinked to "
<< (serv->uplink ? serv->uplink->name : "NOTHING") << "("
<< (serv->uplink ? serv->uplink->suid : "NOSUIDUPLINK") << ")";
<< (serv->uplink && serv->uplink->suid ? serv->uplink->suid : "") << ")";
if (Capab.HasFlag(CAPAB_NOQUIT) || Capab.HasFlag(CAPAB_QS))
{
@@ -218,9 +218,6 @@ static void delete_server(Server * serv, const char *quitreason)
if (na->last_quit)
delete [] na->last_quit;
na->last_quit = (quitreason ? sstrdup(quitreason) : NULL);
}
if (Config.LimitSessions && !is_ulined(u->server->name)) {
del_session(u->host);
}
delete u;
}
+5
View File
@@ -202,6 +202,11 @@ bool Socket::ProcessRead()
sbuffer.append(buffer);
extrabuf.clear();
size_t lastnewline = sbuffer.find_last_of('\n');
if (lastnewline == std::string::npos)
{
extrabuf = sbuffer;
return true;
}
if (lastnewline < sbuffer.size() - 1)
{
extrabuf = sbuffer.substr(lastnewline);
+8 -6
View File
@@ -226,6 +226,8 @@ User::~User()
{
Alog(LOG_DEBUG_2) << "User::~User() called";
this->Logout();
if (Config.LogUsers)
{
const char *srealname = normalizeBuffer(this->realname);
@@ -249,6 +251,11 @@ User::~User()
this->chans.front()->chan->DeleteUser(this);
}
if (Config.LimitSessions && !is_ulined(this->server->name))
{
del_session(this->host);
}
if (this->prev)
this->prev->next = this->next;
else
@@ -450,6 +457,7 @@ void User::AutoID(const std::string &account)
*/
void User::Login(NickCore *core)
{
this->Logout();
nc = core;
core->Users.push_back(this);
}
@@ -1056,9 +1064,6 @@ void do_quit(const char *source, int ac, const char **av)
delete [] na->last_quit;
na->last_quit = *av[0] ? sstrdup(av[0]) : NULL;
}
if (Config.LimitSessions && !is_ulined(user->server->name)) {
del_session(user->host);
}
FOREACH_MOD(I_OnUserQuit, OnUserQuit(user, *av[0] ? av[0] : ""));
delete user;
}
@@ -1089,9 +1094,6 @@ void do_kill(const std::string &nick, const std::string &msg)
delete [] na->last_quit;
na->last_quit = !msg.empty() ? sstrdup(msg.c_str()) : NULL;
}
if (Config.LimitSessions && !is_ulined(user->server->name)) {
del_session(user->host);
}
delete user;
}
+2 -2
View File
@@ -8,8 +8,8 @@
VERSION_MAJOR="1"
VERSION_MINOR="9"
VERSION_PATCH="2"
VERSION_EXTRA="-p1"
VERSION_BUILD="1"
VERSION_EXTRA="-p2"
VERSION_BUILD="2"