summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/protocol.h16
-rw-r--r--modules/commands/ns_ajoin.cpp5
-rw-r--r--modules/commands/ns_recover.cpp4
-rw-r--r--modules/protocol/inspircd11.cpp13
-rw-r--r--modules/protocol/inspircd12.cpp12
-rw-r--r--modules/protocol/inspircd20.cpp4
-rw-r--r--modules/protocol/plexus.cpp10
-rw-r--r--modules/protocol/unreal.cpp21
-rw-r--r--src/protocol.cpp4
9 files changed, 67 insertions, 22 deletions
diff --git a/include/protocol.h b/include/protocol.h
index 7d86693bc..a11335172 100644
--- a/include/protocol.h
+++ b/include/protocol.h
@@ -43,8 +43,10 @@ class CoreExport IRCDProto : public Service
const Anope::string &GetProtocolName();
/* Modes used by default by our clients */
Anope::string DefaultPseudoclientModes;
- /* Can we force change a users's nick */
+ /* Can we force change a users's nick? */
bool CanSVSNick;
+ /* Can we force join or part users? */
+ bool CanSVSJoin;
/* Can we set vhosts/vidents on users? */
bool CanSetVHost, CanSetVIdent;
/* Can we ban specific gecos from being used? */
@@ -151,11 +153,19 @@ class CoreExport IRCDProto : public Service
/** Force joins a user that isn't ours to a channel.
* @param bi The source of the message
- * @param nick The user to join
+ * @param u The user to join
* @param chan The channel to join the user to
* @param param Channel key?
*/
- virtual void SendSVSJoin(const BotInfo *bi, const Anope::string &nick, const Anope::string &chan, const Anope::string &param) { }
+ virtual void SendSVSJoin(const BotInfo *bi, const User *u, const Anope::string &chan, const Anope::string &param) { }
+
+ /** Force parts a user that isn't ours from a channel.
+ * @param bi The source of the message
+ * @param u The user to part
+ * @param chan The channel to part the user from
+ * @param param part reason, some IRCds don't support this
+ */
+ virtual void SendSVSPart(const BotInfo *bi, const User *u, const Anope::string &chan, const Anope::string &param) { }
virtual void SendInvite(const BotInfo *bi, const Channel *c, const User *u);
virtual void SendGlobops(const BotInfo *source, const char *fmt, ...);
diff --git a/modules/commands/ns_ajoin.cpp b/modules/commands/ns_ajoin.cpp
index 54e37ad36..ce92582f6 100644
--- a/modules/commands/ns_ajoin.cpp
+++ b/modules/commands/ns_ajoin.cpp
@@ -233,6 +233,9 @@ class NSAJoin : public Module
{
this->SetAuthor("Anope");
+ if (!IRCD->CanSVSJoin)
+ throw ModuleException("Your IRCd does not support SVSJOIN");
+
Implementation i[] = { I_OnNickIdentify };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
}
@@ -317,7 +320,7 @@ class NSAJoin : public Module
IRCD->SendInvite(NickServ, c, u);
}
- IRCD->SendSVSJoin(NickServ, u->nick, entry->channel, key);
+ IRCD->SendSVSJoin(NickServ, u, entry->channel, key);
}
}
};
diff --git a/modules/commands/ns_recover.cpp b/modules/commands/ns_recover.cpp
index 287224a1b..419857eee 100644
--- a/modules/commands/ns_recover.cpp
+++ b/modules/commands/ns_recover.cpp
@@ -243,8 +243,8 @@ class NSRecover : public Module
/* User might already be on the channel */
if (u->FindChannel(c))
this->OnJoinChannel(u, c);
- else
- IRCD->SendSVSJoin(NickServ, u->GetUID(), cname, "");
+ else if (IRCD->CanSVSJoin)
+ IRCD->SendSVSJoin(NickServ, u, cname, "");
}
}
}
diff --git a/modules/protocol/inspircd11.cpp b/modules/protocol/inspircd11.cpp
index 14ac8fde7..2b4851fcd 100644
--- a/modules/protocol/inspircd11.cpp
+++ b/modules/protocol/inspircd11.cpp
@@ -26,6 +26,7 @@ class InspIRCdProto : public IRCDProto
{
DefaultPseudoclientModes = "+I";
CanSVSNick = true;
+ CanSVSJoin = true;
CanSetVHost = true;
CanSetVIdent = true;
CanSNLine = true;
@@ -286,9 +287,17 @@ class InspIRCdProto : public IRCDProto
UplinkSocket::Message(Me) << "ADDLINE Z " << x->GetHost() << " " << x->by << " " << Anope::CurTime << " " << timeleft << " :" << x->GetReason();
}
- void SendSVSJoin(const BotInfo *source, const Anope::string &nick, const Anope::string &chan, const Anope::string &) anope_override
+ void SendSVSJoin(const BotInfo *source, const User *u, const Anope::string &chan, const Anope::string &) anope_override
{
- UplinkSocket::Message(source) << "SVSJOIN " << nick << " " << chan;
+ UplinkSocket::Message(source) << "SVSJOIN " << u->GetUID() << " " << chan;
+ }
+
+ void SendSVSPart(const BotInfo *source, const User *u, const Anope::string &chan, const Anope::string &param) anope_override
+ {
+ if (!param.empty())
+ UplinkSocket::Message(source) << "SVSPART " << u->GetUID() << " " << chan << " :" << param;
+ else
+ UplinkSocket::Message(source) << "SVSPART " << u->GetUID() << " " << chan;
}
void SendBOB() anope_override
diff --git a/modules/protocol/inspircd12.cpp b/modules/protocol/inspircd12.cpp
index dbe6cefb5..edbb27c88 100644
--- a/modules/protocol/inspircd12.cpp
+++ b/modules/protocol/inspircd12.cpp
@@ -74,6 +74,7 @@ class InspIRCd12Proto : public IRCDProto
{
DefaultPseudoclientModes = "+I";
CanSVSNick = true;
+ CanSVSJoin = true;
CanSetVHost = true;
CanSetVIdent = true;
CanSQLine = true;
@@ -309,12 +310,19 @@ class InspIRCd12Proto : public IRCDProto
SendAddLine("Z", x->GetHost(), timeleft, x->by, x->GetReason());
}
- void SendSVSJoin(const BotInfo *source, const Anope::string &nick, const Anope::string &chan, const Anope::string &) anope_override
+ void SendSVSJoin(const BotInfo *source, const User *u, const Anope::string &chan, const Anope::string &) anope_override
{
- User *u = User::Find(nick);
UplinkSocket::Message(source) << "SVSJOIN " << u->GetUID() << " " << chan;
}
+ void SendSVSPart(const BotInfo *source, const User *u, const Anope::string &chan, const Anope::string &param) anope_override
+ {
+ if (!param.empty())
+ UplinkSocket::Message(source) << "SVSPART " << u->GetUID() << " " << chan << " :" << param;
+ else
+ UplinkSocket::Message(source) << "SVSPART " << u->GetUID() << " " << chan;
+ }
+
void SendSWhois(const BotInfo *, const Anope::string &who, const Anope::string &mask) anope_override
{
User *u = User::Find(who);
diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp
index b6895735d..37c5f7cb8 100644
--- a/modules/protocol/inspircd20.cpp
+++ b/modules/protocol/inspircd20.cpp
@@ -29,6 +29,7 @@ class InspIRCd20Proto : public IRCDProto
{
DefaultPseudoclientModes = "+I";
CanSVSNick = true;
+ CanSVSJoin = true;
CanSetVHost = true;
CanSetVIdent = true;
CanSQLine = true;
@@ -66,7 +67,8 @@ class InspIRCd20Proto : public IRCDProto
void SendSVSHoldDel(const Anope::string &nick) anope_override { insp12->SendSVSHoldDel(nick); }
void SendSZLineDel(const XLine *x) anope_override { insp12->SendSZLineDel(x); }
void SendSZLine(User *u, const XLine *x) anope_override { insp12->SendSZLine(u, x); }
- void SendSVSJoin(const BotInfo *source, const Anope::string &nick, const Anope::string &chan, const Anope::string &other) anope_override { insp12->SendSVSJoin(source, nick, chan, other); }
+ void SendSVSJoin(const BotInfo *source, const User *u, const Anope::string &chan, const Anope::string &other) anope_override { insp12->SendSVSJoin(source, u, chan, other); }
+ void SendSVSPart(const BotInfo *source, const User *u, const Anope::string &chan, const Anope::string &param) anope_override { insp12->SendSVSPart(source, u, chan, param); }
void SendSWhois(const BotInfo *bi, const Anope::string &who, const Anope::string &mask) anope_override { insp12->SendSWhois(bi, who, mask); }
void SendBOB() anope_override { insp12->SendBOB(); }
void SendEOB() anope_override { insp12->SendEOB(); }
diff --git a/modules/protocol/plexus.cpp b/modules/protocol/plexus.cpp
index 3026e1c4d..42d282d19 100644
--- a/modules/protocol/plexus.cpp
+++ b/modules/protocol/plexus.cpp
@@ -151,6 +151,16 @@ class PlexusProto : public IRCDProto
{
UplinkSocket::Message(bi) << "ENCAP * TOPIC " << c->name << " " << c->topic_setter << " " << c->topic_ts << " :" << c->topic;
}
+
+ void SendSVSJoin(const BotInfo *source, const User *user, const Anope::string &chan, const Anope::string &param) anope_override
+ {
+ UplinkSocket::Message(source) << "ENCAP " << user->server->GetSID() << " SVSJOIN " << user->GetUID() << " " << chan;
+ }
+
+ void SendSVSPart(const BotInfo *source, const User *user, const Anope::string &chan, const Anope::string &param) anope_override
+ {
+ UplinkSocket::Message(source) << "ENCAP " << user->server->GetSID() << " SVSPART " << user->GetUID() << " " << chan;
+ }
};
struct IRCDMessageEncap : IRCDMessage
diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp
index 8f3f3f810..08fe8d237 100644
--- a/modules/protocol/unreal.cpp
+++ b/modules/protocol/unreal.cpp
@@ -20,6 +20,7 @@ class UnrealIRCdProto : public IRCDProto
{
DefaultPseudoclientModes = "+Soiq";
CanSVSNick = true;
+ CanSVSJoin = true;
CanSetVHost = true;
CanSetVIdent = true;
CanSNLine = true;
@@ -202,12 +203,6 @@ class UnrealIRCdProto : public IRCDProto
UplinkSocket::Message(source) << "SVSO " << nick << " " << flag;
}
- /* NICK <newnick> */
- void SendChangeBotNick(const BotInfo *oldnick, const Anope::string &newnick) anope_override
- {
- UplinkSocket::Message(oldnick) << "NICK " << newnick << " " << Anope::CurTime;
- }
-
/* Functions that use serval cmd functions */
void SendVhost(User *u, const Anope::string &vIdent, const Anope::string &vhost) anope_override
@@ -300,12 +295,20 @@ class UnrealIRCdProto : public IRCDProto
/* In older Unreal SVSJOIN and SVSNLINE tokens were mixed so SVSJOIN and SVSNLINE are broken
when coming from a none TOKEN'd server
*/
- void SendSVSJoin(const BotInfo *source, const Anope::string &nick, const Anope::string &chan, const Anope::string &param) anope_override
+ void SendSVSJoin(const BotInfo *source, const User *user, const Anope::string &chan, const Anope::string &param) anope_override
+ {
+ if (!param.empty())
+ UplinkSocket::Message(source) << "SVSJOIN " << user->GetUID() << " " << chan << " :" << param;
+ else
+ UplinkSocket::Message(source) << "SVSJOIN " << user->GetUID() << " " << chan;
+ }
+
+ void SendSVSPart(const BotInfo *source, const User *user, const Anope::string &chan, const Anope::string &param) anope_override
{
if (!param.empty())
- UplinkSocket::Message(source) << "SVSJOIN " << nick << " " << chan << " :" << param;
+ UplinkSocket::Message(source) << "SVSPART " << user->GetUID() << " " << chan << " :" << param;
else
- UplinkSocket::Message(source) << "SVSJOIN " << nick << " :" << chan;
+ UplinkSocket::Message(source) << "SVSPART " << user->GetUID() << " " << chan;
}
void SendSWhois(const BotInfo *source, const Anope::string &who, const Anope::string &mask) anope_override
diff --git a/src/protocol.cpp b/src/protocol.cpp
index 315b3955c..d8c9cd635 100644
--- a/src/protocol.cpp
+++ b/src/protocol.cpp
@@ -26,8 +26,8 @@ IRCDProto *IRCD = NULL;
IRCDProto::IRCDProto(Module *creator, const Anope::string &p) : Service(creator, "IRCDProto", creator->name), proto_name(p)
{
DefaultPseudoclientModes = "+io";
- CanSVSNick = CanSetVHost = CanSetVIdent = CanSNLine = CanSQLine = CanSQLineChannel = CanSZLine = CanSVSHold =
- CanSVSO = CanCertFP = RequiresID = false;
+ CanSVSNick = CanSVSJoin = CanSetVHost = CanSetVIdent = CanSNLine = CanSQLine = CanSQLineChannel
+ = CanSZLine = CanSVSHold = CanSVSO = CanCertFP = RequiresID = false;
MaxModes = 3;
if (IRCD == NULL)