summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-09-05 00:43:13 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-09-05 00:43:13 +0000
commitb82873d78eeb95e5c332f237f9ecff5ce4064225 (patch)
tree0e590bad39a09c00d3cf28f547452c5c5775284a
parentddb0e734b5fa6edc36747893ec3759a7fc2ebb05 (diff)
New CAPAB variable (manditory): PROTOCOL
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5145 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/modules/m_spanningtree.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp
index 9c27ee7f5..679dc00df 100644
--- a/src/modules/m_spanningtree.cpp
+++ b/src/modules/m_spanningtree.cpp
@@ -33,6 +33,12 @@ using namespace std;
#define nspace __gnu_cxx
+
+/** If you make a change which breaks the protocol, increment this.
+ * If you completely change the protocol, completely change the number.
+ */
+const long ProtocolVersion = 1100;
+
/*
* The server list in InspIRCd is maintained as two structures
* which hold the data in different ways. Most of the time, we
@@ -852,7 +858,7 @@ class TreeSocket : public InspSocket
#ifdef SUPPORT_IP6LINKS
ip6support = 1;
#endif
- this->WriteLine("CAPAB CAPABILITIES :NICKMAX="+ConvToStr(NICKMAX)+" HALFOP="+ConvToStr(this->Instance->Config->AllowHalfop)+" CHANMAX="+ConvToStr(CHANMAX)+" MAXMODES="+ConvToStr(MAXMODES)+" IDENTMAX="+ConvToStr(IDENTMAX)+" MAXQUIT="+ConvToStr(MAXQUIT)+" MAXTOPIC="+ConvToStr(MAXTOPIC)+" MAXKICK="+ConvToStr(MAXKICK)+" MAXGECOS="+ConvToStr(MAXGECOS)+" MAXAWAY="+ConvToStr(MAXAWAY)+" IP6NATIVE="+ConvToStr(ip6)+" IP6SUPPORT="+ConvToStr(ip6support));
+ this->WriteLine("CAPAB CAPABILITIES :NICKMAX="+ConvToStr(NICKMAX)+" HALFOP="+ConvToStr(this->Instance->Config->AllowHalfop)+" CHANMAX="+ConvToStr(CHANMAX)+" MAXMODES="+ConvToStr(MAXMODES)+" IDENTMAX="+ConvToStr(IDENTMAX)+" MAXQUIT="+ConvToStr(MAXQUIT)+" MAXTOPIC="+ConvToStr(MAXTOPIC)+" MAXKICK="+ConvToStr(MAXKICK)+" MAXGECOS="+ConvToStr(MAXGECOS)+" MAXAWAY="+ConvToStr(MAXAWAY)+" IP6NATIVE="+ConvToStr(ip6)+" IP6SUPPORT="+ConvToStr(ip6support)+" PROTOCOL="+ConvToStr(ProtocolVersion));
this->WriteLine("CAPAB END");
}
@@ -938,6 +944,18 @@ class TreeSocket : public InspSocket
if (((this->CapKeys.find("NICKMAX") == this->CapKeys.end()) || ((this->CapKeys.find("NICKMAX") != this->CapKeys.end()) && (this->CapKeys.find("NICKMAX")->second != ConvToStr(NICKMAX)))))
reason = "Maximum nickname lengths differ or remote nickname length not specified";
+ if (((this->CapKeys.find("PROTOCOL") == this->CapKeys.end()) || ((this->CapKeys.find("PROTOCOL") != this->CapKeys.end()) && (this->CapKeys.find("PROTOCOL")->second != ConvToStr(ProtocolVersion)))))
+ {
+ if (this->CapKeys.find("PROTOCOL") != this->CapKeys.end())
+ {
+ reason = "Mismatched protocol versions "+this->CapKeys.find("PROTOCOL")->second+" and "+ConvToStr(ProtocolVersion);
+ }
+ else
+ {
+ reason = "Protocol version not specified";
+ }
+ }
+
if (((this->CapKeys.find("HALFOP") == this->CapKeys.end()) && (Instance->Config->AllowHalfop)) || ((this->CapKeys.find("HALFOP") != this->CapKeys.end()) && (this->CapKeys.find("HALFOP")->second != ConvToStr(Instance->Config->AllowHalfop))))
reason = "We don't both have halfop support enabled/disabled identically";