summaryrefslogtreecommitdiff
path: root/src/protocol
diff options
context:
space:
mode:
authorAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2009-12-17 02:10:35 +0000
committerAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2009-12-17 02:10:35 +0000
commit861fe9e7b32c8e1e523cc774547e460c9ed67289 (patch)
treeb821f00ef784751ff7c43771175b818fec4645bb /src/protocol
parent453963eeaeb4232df3e331522408034606cfefd6 (diff)
Added BotInfo* sender arg to all of the User mode functions, changed IRcdProto::SendMode for channels to accept a Channel pointer and fixed unsetting users vhosts on Unreal
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2710 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/protocol')
-rw-r--r--src/protocol/bahamut.c22
-rw-r--r--src/protocol/inspircd11.c13
-rw-r--r--src/protocol/inspircd12.cpp19
-rw-r--r--src/protocol/ratbox.c12
-rw-r--r--src/protocol/unreal32.c29
5 files changed, 50 insertions, 45 deletions
diff --git a/src/protocol/bahamut.c b/src/protocol/bahamut.c
index 288b36329..6ec072b87 100644
--- a/src/protocol/bahamut.c
+++ b/src/protocol/bahamut.c
@@ -141,17 +141,17 @@ void bahamut_cmd_chghost(const char *nick, const char *vhost)
class BahamutIRCdProto : public IRCDProto
{
- void SendModeInternal(BotInfo *source, const char *dest, const char *buf)
+ void SendModeInternal(BotInfo *source, Channel *dest, const char *buf)
{
if (!buf) return;
- if (ircdcap->tsmode && (uplink_capab & ircdcap->tsmode)) send_cmd(source->nick, "MODE %s 0 %s", dest, buf);
- else send_cmd(source->nick, "MODE %s %s", dest, buf);
+ if (ircdcap->tsmode && (uplink_capab & ircdcap->tsmode)) send_cmd(source->nick, "MODE %s 0 %s", dest->name, buf);
+ else send_cmd(source->nick, "MODE %s %s", dest->name, buf);
}
- void SendModeInternal(User *u, const char *buf)
+ void SendModeInternal(BotInfo *bi, User *u, const char *buf)
{
if (!buf) return;
- send_cmd(Config.ServerName, "SVSMODE %s %ld %s", u->nick, static_cast<long>(u->timestamp), buf);
+ send_cmd(bi ? bi->nick : Config.ServerName, "SVSMODE %s %ld %s", u->nick, static_cast<long>(u->timestamp), buf);
}
/* SVSHOLD - set */
@@ -271,7 +271,7 @@ class BahamutIRCdProto : public IRCDProto
*/
void SendSVSMode(User *u, int ac, const char **av)
{
- this->SendModeInternal(u, merge_args(ac, av));
+ this->SendModeInternal(NULL, u, merge_args(ac, av));
}
void SendEOB()
@@ -302,8 +302,9 @@ class BahamutIRCdProto : public IRCDProto
/* nc_change was = 1, and there is no na->status */
void SendUnregisteredNick(User *u)
{
- u->RemoveMode(UMODE_REGISTERED);
- ircdproto->SendMode(u, "+d 1");
+ BotInfo *bi = findbot(Config.s_NickServ);
+ u->RemoveMode(bi, UMODE_REGISTERED);
+ ircdproto->SendMode(bi, u, "+d 1");
}
/* SERVER */
@@ -340,8 +341,9 @@ class BahamutIRCdProto : public IRCDProto
u->nc->Extend("authenticationtoken", sstrdup(svidbuf));
- u->SetMode(UMODE_REGISTERED);
- ircdproto->SendMode(u, "+d %s", svidbuf);
+ BotInfo *bi = findbot(Config.s_NickServ);
+ u->SetMode(bi, UMODE_REGISTERED);
+ ircdproto->SendMode(bi, u, "+d %s", svidbuf);
}
} ircd_proto;
diff --git a/src/protocol/inspircd11.c b/src/protocol/inspircd11.c
index 84aa044de..1eb6ba56e 100644
--- a/src/protocol/inspircd11.c
+++ b/src/protocol/inspircd11.c
@@ -197,7 +197,7 @@ class InspIRCdProto : public IRCDProto
void SendSVSMode(User *u, int ac, const char **av)
{
- this->SendModeInternal(u, merge_args(ac, av));
+ this->SendModeInternal(NULL, u, merge_args(ac, av));
}
void SendNumericInternal(const char *source, int numeric, const char *dest, const char *buf)
@@ -210,17 +210,16 @@ class InspIRCdProto : public IRCDProto
send_cmd(Config.ServerName, "NICK %ld %s %s %s %s +%s 0.0.0.0 :%s", static_cast<long>(time(NULL)), nick, host, host, user, modes, real);
}
- void SendModeInternal(BotInfo *source, const char *dest, const char *buf)
+ void SendModeInternal(BotInfo *source, Channel *dest, const char *buf)
{
if (!buf) return;
- Channel *c = findchan(dest);
- send_cmd(source ? source->nick : Config.s_OperServ, "FMODE %s %u %s", dest, static_cast<unsigned>(c ? c->creation_time : time(NULL)), buf);
+ send_cmd(source ? source->nick : Config.s_OperServ, "FMODE %s %u %s", dest->name, static_cast<unsigned>(dest->creation_time), buf);
}
- void SendModeInternal(User *u, const char *buf)
+ void SendModeInternal(BotInfo *bi, User *u, const char *buf)
{
if (!buf) return;
- send_cmd(Config.s_NickServ, "MODE %s %s", u->nick, buf);
+ send_cmd(bi ? bi->nick : Config.ServerName, "MODE %s %s", u->nick, buf);
}
void SendClientIntroduction(const char *nick, const char *user, const char *host, const char *real, const char *modes, const char *uid)
@@ -331,7 +330,7 @@ class InspIRCdProto : public IRCDProto
/* SVSMODE +- */
void SendUnregisteredNick(User *u)
{
- u->RemoveMode(UMODE_REGISTERED);
+ u->RemoveMode(findbot(Config.s_NickServ), UMODE_REGISTERED);
}
void SendSVSJoin(const char *source, const char *nick, const char *chan, const char *param)
diff --git a/src/protocol/inspircd12.cpp b/src/protocol/inspircd12.cpp
index 2b232fe81..5161fdc22 100644
--- a/src/protocol/inspircd12.cpp
+++ b/src/protocol/inspircd12.cpp
@@ -204,7 +204,7 @@ class InspIRCdProto : public IRCDProto
void SendSVSMode(User *u, int ac, const char **av)
{
- this->SendModeInternal(u, merge_args(ac, av));
+ this->SendModeInternal(NULL, u, merge_args(ac, av));
}
void SendNumericInternal(const char *source, int numeric, const char *dest, const char *buf)
@@ -217,16 +217,15 @@ class InspIRCdProto : public IRCDProto
send_cmd(TS6SID, "UID %ld %s %s %s %s +%s 0.0.0.0 :%s", static_cast<long>(time(NULL)), nick, host, host, user, modes, real);
}
- void SendModeInternal(BotInfo *source, const char *dest, const char *buf)
+ void SendModeInternal(BotInfo *source, Channel *dest, const char *buf)
{
- Channel *c = findchan(dest);
- send_cmd(source ? source->uid : TS6SID, "FMODE %s %u %s", dest, static_cast<unsigned>(c ? c->creation_time : time(NULL)), buf);
+ send_cmd(source ? source->uid : TS6SID, "FMODE %s %u %s", dest->name, static_cast<unsigned>(dest->creation_time), buf);
}
- void SendModeInternal(User *u, const char *buf)
+ void SendModeInternal(BotInfo *bi, User *u, const char *buf)
{
if (!buf) return;
- send_cmd(findbot(Config.s_NickServ)->uid, "MODE %s %s", u->GetUID().c_str(), buf);
+ send_cmd(bi ? bi->uid : TS6SID, "MODE %s %s", u->GetUID().c_str(), buf);
}
void SendClientIntroduction(const char *nick, const char *user, const char *host, const char *real, const char *modes, const char *uid)
@@ -338,7 +337,7 @@ class InspIRCdProto : public IRCDProto
/* SVSMODE -r */
void SendUnregisteredNick(User *u)
{
- u->RemoveMode(UMODE_REGISTERED);
+ u->RemoveMode(findbot(Config.s_NickServ), UMODE_REGISTERED);
}
void SendSVSJoin(const char *source, const char *nick, const char *chan, const char *param)
@@ -398,7 +397,7 @@ class InspIRCdProto : public IRCDProto
if (!u->nc)
return;
- u->SetMode(UMODE_REGISTERED);
+ u->SetMode(findbot(Config.s_NickServ), UMODE_REGISTERED);
}
} ircd_proto;
@@ -839,7 +838,7 @@ int anope_event_uid(const char *source, int ac, const char **av)
{
validate_user(user);
if (user->HasMode(UMODE_REGISTERED))
- user->RemoveMode(UMODE_REGISTERED);
+ user->RemoveMode(findbot(Config.s_NickServ), UMODE_REGISTERED);
}
user = NULL;
@@ -1125,7 +1124,7 @@ int anope_event_endburst(const char *source, int ac, const char **av)
{
validate_user(u);
if (u->HasMode(UMODE_REGISTERED))
- u->RemoveMode(UMODE_REGISTERED);
+ u->RemoveMode(findbot(Config.s_NickServ), UMODE_REGISTERED);
}
alog("Processed ENDBURST for %s", s->name);
diff --git a/src/protocol/ratbox.c b/src/protocol/ratbox.c
index 3996bf736..f10c86206 100644
--- a/src/protocol/ratbox.c
+++ b/src/protocol/ratbox.c
@@ -219,7 +219,7 @@ class RatboxProto : public IRCDTS6Proto
void SendSVSMode(User *u, int ac, const char **av)
{
- this->SendModeInternal(u, merge_args(ac, av));
+ this->SendModeInternal(NULL, u, merge_args(ac, av));
}
/* SERVER name hop descript */
@@ -259,19 +259,19 @@ class RatboxProto : public IRCDTS6Proto
send_cmd(TS6SID, "%03d %s %s", numeric, dest, buf);
}
- void SendModeInternal(BotInfo *bi, const char *dest, const char *buf)
+ void SendModeInternal(BotInfo *bi, Channel *dest, const char *buf)
{
if (bi)
{
- send_cmd(bi->uid, "MODE %s %s", dest, buf);
+ send_cmd(bi->uid, "MODE %s %s", dest->name, buf);
}
- else send_cmd(TS6SID, "MODE %s %s", dest, buf);
+ else send_cmd(TS6SID, "MODE %s %s", dest->name, buf);
}
- void SendModeInternal(User *u, const char *buf)
+ void SendModeInternal(BotInfo *bi, User *u, const char *buf)
{
if (!buf) return;
- send_cmd(TS6SID, "SVSMODE %s %s", u->nick, buf);
+ send_cmd(bi ? bi->uid : TS6SID, "SVSMODE %s %s", u->nick, buf);
}
void SendKickInternal(BotInfo *bi, Channel *chan, User *user, const char *buf)
diff --git a/src/protocol/unreal32.c b/src/protocol/unreal32.c
index fb52d3129..7dc55a452 100644
--- a/src/protocol/unreal32.c
+++ b/src/protocol/unreal32.c
@@ -186,9 +186,12 @@ class UnrealIRCdProto : public IRCDProto
void SendVhostDel(User *u)
{
- u->RemoveMode(UMODE_CLOAK);
- u->RemoveMode(UMODE_VHOST);
- u->SetMode(UMODE_CLOAK);
+ BotInfo *bi = findbot(Config.s_HostServ);
+ u->RemoveMode(bi, UMODE_CLOAK);
+ u->RemoveMode(bi, UMODE_VHOST);
+ ModeManager::ProcessModes();
+ u->SetMode(bi, UMODE_CLOAK);
+ ModeManager::ProcessModes();
}
void SendAkill(Akill *ak)
@@ -215,20 +218,20 @@ class UnrealIRCdProto : public IRCDProto
{
if (ac >= 1) {
if (!u || !av[0]) return;
- this->SendModeInternal(u, merge_args(ac, av));
+ this->SendModeInternal(NULL, u, merge_args(ac, av));
}
}
- void SendModeInternal(BotInfo *source, const char *dest, const char *buf)
+ void SendModeInternal(BotInfo *source, Channel *dest, const char *buf)
{
if (!buf) return;
- send_cmd(source->nick, "G %s %s", dest, buf);
+ send_cmd(source->nick, "G %s %s", dest->name, buf);
}
- void SendModeInternal(User *u, const char *buf)
+ void SendModeInternal(BotInfo *bi, User *u, const char *buf)
{
if (!buf) return;
- send_cmd(Config.ServerName, "v %s %s", u->nick, buf);
+ send_cmd(bi ? bi->nick : Config.ServerName, "v %s %s", u->nick, buf);
}
void SendClientIntroduction(const char *nick, const char *user, const char *host, const char *real, const char *modes, const char *uid)
@@ -462,14 +465,16 @@ class UnrealIRCdProto : public IRCDProto
u->nc->Extend("authenticationtoken", sstrdup(svidbuf));
- u->SetMode(UMODE_REGISTERED);
- ircdproto->SendMode(u, "+d %s", svidbuf);
+ BotInfo *bi = findbot(Config.s_NickServ);
+ u->SetMode(bi, UMODE_REGISTERED);
+ ircdproto->SendMode(bi, u, "+d %s", svidbuf);
}
void SendUnregisteredNick(User *u)
{
- u->RemoveMode(UMODE_REGISTERED);
- ircdproto->SendMode(u, "+d 1");
+ BotInfo *bi = findbot(Config.s_NickServ);
+ u->RemoveMode(bi, UMODE_REGISTERED);
+ ircdproto->SendMode(bi, u, "+d 1");
}
} ircd_proto;