mirror of
https://github.com/anope/anope.git
synced 2026-07-05 17:43:13 +02:00
Keep track on what ircds we can svsjoin, add an svspart method
This commit is contained in:
+13
-3
@@ -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 ¶m) { }
|
||||
virtual void SendSVSJoin(const BotInfo *bi, const User *u, const Anope::string &chan, const Anope::string ¶m) { }
|
||||
|
||||
/** 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 ¶m) { }
|
||||
|
||||
virtual void SendInvite(const BotInfo *bi, const Channel *c, const User *u);
|
||||
virtual void SendGlobops(const BotInfo *source, const char *fmt, ...);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 ¶m) 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
|
||||
|
||||
@@ -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 ¶m) 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);
|
||||
|
||||
@@ -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 ¶m) 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(); }
|
||||
|
||||
@@ -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 ¶m) 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 ¶m) anope_override
|
||||
{
|
||||
UplinkSocket::Message(source) << "ENCAP " << user->server->GetSID() << " SVSPART " << user->GetUID() << " " << chan;
|
||||
}
|
||||
};
|
||||
|
||||
struct IRCDMessageEncap : IRCDMessage
|
||||
|
||||
@@ -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 ¶m) anope_override
|
||||
void SendSVSJoin(const BotInfo *source, const User *user, const Anope::string &chan, const Anope::string ¶m) anope_override
|
||||
{
|
||||
if (!param.empty())
|
||||
UplinkSocket::Message(source) << "SVSJOIN " << nick << " " << chan << " :" << param;
|
||||
UplinkSocket::Message(source) << "SVSJOIN " << user->GetUID() << " " << chan << " :" << param;
|
||||
else
|
||||
UplinkSocket::Message(source) << "SVSJOIN " << nick << " :" << chan;
|
||||
UplinkSocket::Message(source) << "SVSJOIN " << user->GetUID() << " " << chan;
|
||||
}
|
||||
|
||||
void SendSVSPart(const BotInfo *source, const User *user, const Anope::string &chan, const Anope::string ¶m) anope_override
|
||||
{
|
||||
if (!param.empty())
|
||||
UplinkSocket::Message(source) << "SVSPART " << user->GetUID() << " " << chan << " :" << param;
|
||||
else
|
||||
UplinkSocket::Message(source) << "SVSPART " << user->GetUID() << " " << chan;
|
||||
}
|
||||
|
||||
void SendSWhois(const BotInfo *source, const Anope::string &who, const Anope::string &mask) anope_override
|
||||
|
||||
+2
-2
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user