summaryrefslogtreecommitdiff
path: root/src/protocol
diff options
context:
space:
mode:
Diffstat (limited to 'src/protocol')
-rw-r--r--src/protocol/bahamut.c47
-rw-r--r--src/protocol/inspircd11.c42
-rw-r--r--src/protocol/inspircd12.cpp44
-rw-r--r--src/protocol/ratbox.c41
-rw-r--r--src/protocol/unreal32.c45
5 files changed, 34 insertions, 185 deletions
diff --git a/src/protocol/bahamut.c b/src/protocol/bahamut.c
index 1115e05e7..14407eb6b 100644
--- a/src/protocol/bahamut.c
+++ b/src/protocol/bahamut.c
@@ -45,14 +45,12 @@ IRCDVar myIrcd[] = {
0, /* Change RealName */
1,
1, /* No Knock requires +i */
- NULL, /* CAPAB Chan Modes */
0, /* We support TOKENS */
0, /* TIME STAMPS are BASE64 */
0, /* Can remove User Channel Modes with SVSMODE */
0, /* Sglines are not enforced until user reconnects */
0, /* ts6 */
0, /* p10 */
- NULL, /* character set */
0, /* CIDR channelbans */
"$", /* TLD Prefix for Global */
false, /* Auth for users is sent after the initial NICK/UID command */
@@ -62,39 +60,6 @@ IRCDVar myIrcd[] = {
{NULL}
};
-IRCDCAPAB myIrcdcap[] = {
- {
- CAPAB_NOQUIT, /* NOQUIT */
- CAPAB_TSMODE, /* TSMODE */
- CAPAB_UNCONNECT, /* UNCONNECT */
- 0, /* NICKIP */
- 0, /* SJOIN */
- 0, /* ZIP */
- CAPAB_BURST, /* BURST */
- 0, /* TS5 */
- 0, /* TS3 */
- CAPAB_DKEY, /* DKEY */
- 0, /* PT4 */
- 0, /* SCS */
- 0, /* QS */
- 0, /* UID */
- 0, /* KNOCK */
- 0, /* CLIENT */
- 0, /* IPV6 */
- 0, /* SSJ5 */
- 0, /* SN2 */
- 0, /* TOKEN */
- 0, /* VHOST */
- 0, /* SSJ3 */
- 0, /* NICK2 */
- 0, /* VL */
- 0, /* TLKEXT */
- 0, /* DODKEY */
- CAPAB_DOZIP, /* DOZIP */
- 0, 0, 0}
-};
-
-
void bahamut_cmd_burst()
{
send_cmd(NULL, "BURST");
@@ -140,8 +105,10 @@ class BahamutIRCdProto : public IRCDProto
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->name.c_str(), buf);
- else send_cmd(source->nick, "MODE %s %s", dest->name.c_str(), buf);
+ if (Capab.HasFlag(CAPAB_TSMODE))
+ send_cmd(source->nick, "MODE %s 0 %s", dest->name.c_str(), buf);
+ else
+ send_cmd(source->nick, "MODE %s %s", dest->name.c_str(), buf);
}
void SendModeInternal(BotInfo *bi, User *u, const char *buf)
@@ -550,6 +517,7 @@ int anope_event_nick(const char *source, int ac, const char **av)
/* EVENT : CAPAB */
int anope_event_capab(const char *source, int ac, const char **av)
{
+ CapabParse(ac, av);
return MOD_CONT;
}
@@ -851,10 +819,13 @@ class ProtoBahamut : public Module
this->SetType(PROTOCOL);
pmodule_ircd_version("BahamutIRCd 1.4.*/1.8.*");
- pmodule_ircd_cap(myIrcdcap);
pmodule_ircd_var(myIrcd);
pmodule_ircd_useTSMode(0);
+ CapabType c[] = { CAPAB_NOQUIT, CAPAB_TSMODE, CAPAB_UNCONNECT, CAPAB_BURST, CAPAB_DKEY, CAPAB_DOZIP };
+ for (unsigned i = 0; i < 6; ++i)
+ Capab.SetFlag(c[i]);
+
moduleAddIRCDMsgs();
moduleAddModes();
diff --git a/src/protocol/inspircd11.c b/src/protocol/inspircd11.c
index 35f3b6edb..95f93e652 100644
--- a/src/protocol/inspircd11.c
+++ b/src/protocol/inspircd11.c
@@ -62,14 +62,12 @@ IRCDVar myIrcd[] = {
0, /* Change RealName */
0,
1, /* No Knock requires +i */
- NULL, /* CAPAB Chan Modes */
0, /* We support inspircd TOKENS */
0, /* TIME STAMPS are BASE64 */
0, /* Can remove User Channel Modes with SVSMODE */
0, /* Sglines are not enforced until user reconnects */
0, /* ts6 */
0, /* p10 */
- NULL, /* character set */
1, /* CIDR channelbans */
"$", /* TLD Prefix for Global */
false, /* Auth for users is sent after the initial NICK/UID command */
@@ -80,39 +78,6 @@ IRCDVar myIrcd[] = {
};
-IRCDCAPAB myIrcdcap[] = {
- {
- CAPAB_NOQUIT, /* NOQUIT */
- 0, /* TSMODE */
- 1, /* UNCONNECT */
- 0, /* NICKIP */
- 0, /* SJOIN */
- 0, /* ZIP */
- 0, /* BURST */
- 0, /* TS5 */
- 0, /* TS3 */
- 0, /* DKEY */
- 0, /* PT4 */
- 0, /* SCS */
- 0, /* QS */
- 0, /* UID */
- 0, /* KNOCK */
- 0, /* CLIENT */
- 0, /* IPV6 */
- 0, /* SSJ5 */
- 0, /* SN2 */
- 0, /* TOKEN */
- 0, /* VHOST */
- CAPAB_SSJ3, /* SSJ3 */
- CAPAB_NICK2, /* NICK2 */
- CAPAB_VL, /* VL */
- CAPAB_TLKEXT, /* TLKEXT */
- 0, /* DODKEY */
- 0, /* DOZIP */
- 0,
- 0, 0}
-};
-
static int has_servicesmod = 0;
static int has_globopsmod = 0;
static int has_svsholdmod = 0;
@@ -1116,6 +1081,8 @@ int anope_event_capab(const char *source, int ac, const char **av)
}
ircd->svshold = has_svsholdmod;
}
+
+ CapabParse(ac, av);
return MOD_CONT;
}
@@ -1193,10 +1160,13 @@ class ProtoInspIRCd : public Module
this->SetType(PROTOCOL);
pmodule_ircd_version("inspircdIRCd 1.1");
- pmodule_ircd_cap(myIrcdcap);
pmodule_ircd_var(myIrcd);
pmodule_ircd_useTSMode(0);
+ CapabType c[] = { CAPAB_NOQUIT, CAPAB_SSJ3, CAPAB_NICK2, CAPAB_VL, CAPAB_TLKEXT };
+ for (unsigned i = 0; i < 5; ++i)
+ Capab.SetFlag(c[i]);
+
AddModes();
pmodule_ircd_proto(&ircd_proto);
diff --git a/src/protocol/inspircd12.cpp b/src/protocol/inspircd12.cpp
index 27acf77a2..698cc86ea 100644
--- a/src/protocol/inspircd12.cpp
+++ b/src/protocol/inspircd12.cpp
@@ -62,14 +62,12 @@ IRCDVar myIrcd[] = {
0, /* Change RealName */
0,
1, /* No Knock requires +i */
- NULL, /* CAPAB Chan Modes */
0, /* We support inspircd TOKENS */
0, /* TIME STAMPS are BASE64 */
0, /* Can remove User Channel Modes with SVSMODE */
0, /* Sglines are not enforced until user reconnects */
1, /* ts6 */
0, /* p10 */
- NULL, /* character set */
1, /* CIDR channelbans */
"$", /* TLD Prefix for Global */
true, /* Auth for users is sent after the initial NICK/UID command */
@@ -79,40 +77,6 @@ IRCDVar myIrcd[] = {
{NULL}
};
-
-IRCDCAPAB myIrcdcap[] = {
- {
- CAPAB_NOQUIT, /* NOQUIT */
- 0, /* TSMODE */
- 1, /* UNCONNECT */
- 0, /* NICKIP */
- 0, /* SJOIN */
- 0, /* ZIP */
- 0, /* BURST */
- 0, /* TS5 */
- 0, /* TS3 */
- 0, /* DKEY */
- 0, /* PT4 */
- 0, /* SCS */
- 0, /* QS */
- 0, /* UID */
- 0, /* KNOCK */
- 0, /* CLIENT */
- 0, /* IPV6 */
- 0, /* SSJ5 */
- 0, /* SN2 */
- 0, /* TOKEN */
- 0, /* VHOST */
- CAPAB_SSJ3, /* SSJ3 */
- CAPAB_NICK2, /* NICK2 */
- CAPAB_VL, /* VL */
- CAPAB_TLKEXT, /* TLKEXT */
- 0, /* DODKEY */
- 0, /* DOZIP */
- 0,
- 0, 0}
-};
-
static int has_servicesmod = 0;
static int has_globopsmod = 0;
static int has_svsholdmod = 0;
@@ -1303,6 +1267,9 @@ int anope_event_capab(const char *source, int ac, const char **av)
}
ircd->svshold = has_svsholdmod;
}
+
+ CapabParse(ac, av);
+
return MOD_CONT;
}
@@ -1392,10 +1359,13 @@ class ProtoInspIRCd : public Module
TS6SID = sstrdup(Config.Numeric);
pmodule_ircd_version("InspIRCd 1.2");
- pmodule_ircd_cap(myIrcdcap);
pmodule_ircd_var(myIrcd);
pmodule_ircd_useTSMode(0);
+ CapabType c[] = { CAPAB_NOQUIT, CAPAB_SSJ3, CAPAB_NICK2, CAPAB_VL, CAPAB_TLKEXT };
+ for (unsigned i = 0; i < 5; ++i)
+ Capab.SetFlag(c[i]);
+
pmodule_ircd_proto(&ircd_proto);
moduleAddIRCDMsgs();
}
diff --git a/src/protocol/ratbox.c b/src/protocol/ratbox.c
index b3fa7eaf0..3fd7315fe 100644
--- a/src/protocol/ratbox.c
+++ b/src/protocol/ratbox.c
@@ -43,14 +43,12 @@ IRCDVar myIrcd[] = {
0, /* Change RealName */
0, /* On nick change check if they could be identified */
0, /* No Knock requires +i */
- NULL, /* CAPAB Chan Modes */
0, /* We support TOKENS */
0, /* TIME STAMPS are BASE64 */
0, /* Can remove User Channel Modes with SVSMODE */
0, /* Sglines are not enforced until user reconnects */
1, /* ts6 */
0, /* p10 */
- NULL, /* character set */
0, /* CIDR channelbans */
"$$", /* TLD Prefix for Global */
false, /* Auth for users is sent after the initial NICK/UID command */
@@ -60,39 +58,6 @@ IRCDVar myIrcd[] = {
{NULL}
};
-IRCDCAPAB myIrcdcap[] = {
- {
- 0, /* NOQUIT */
- 0, /* TSMODE */
- 0, /* UNCONNECT */
- 0, /* NICKIP */
- 0, /* SJOIN */
- CAPAB_ZIP, /* ZIP */
- 0, /* BURST */
- CAPAB_TS5, /* TS5 */
- 0, /* TS3 */
- 0, /* DKEY */
- 0, /* PT4 */
- 0, /* SCS */
- CAPAB_QS, /* QS */
- CAPAB_UID, /* UID */
- CAPAB_KNOCK, /* KNOCK */
- 0, /* CLIENT */
- 0, /* IPV6 */
- 0, /* SSJ5 */
- 0, /* SN2 */
- 0, /* TOKEN */
- 0, /* VHOST */
- 0, /* SSJ3 */
- 0, /* NICK2 */
- 0, /* VL */
- 0, /* TLKEXT */
- 0, /* DODKEY */
- 0, /* DOZIP */
- 0, 0, 0}
-};
-
-
/*
* SVINFO
* parv[0] = sender prefix
@@ -795,6 +760,7 @@ int anope_event_tmode(const char *source, int ac, const char **av)
/* Event: PROTOCTL */
int anope_event_capab(const char *source, int ac, const char **av)
{
+ CapabParse(ac, av);
return MOD_CONT;
}
@@ -923,10 +889,13 @@ class ProtoRatbox : public Module
UseTSMODE = 1; /* TMODE */
pmodule_ircd_version("Ratbox IRCD 2.0+");
- pmodule_ircd_cap(myIrcdcap);
pmodule_ircd_var(myIrcd);
pmodule_ircd_useTSMode(1);
+ CapabType c[] = { CAPAB_ZIP, CAPAB_TS5, CAPAB_QS, CAPAB_UID, CAPAB_KNOCK };
+ for (unsigned i = 0; i < 5; ++i)
+ Capab.SetFlag(c[i]);
+
moduleAddModes();
pmodule_ircd_proto(&ircd_proto);
diff --git a/src/protocol/unreal32.c b/src/protocol/unreal32.c
index 8ef6ca187..4016a5f18 100644
--- a/src/protocol/unreal32.c
+++ b/src/protocol/unreal32.c
@@ -45,14 +45,12 @@ IRCDVar myIrcd[] = {
1, /* Change RealName */
0, /* On nick change check if they could be identified */
1, /* No Knock requires +i */
- NULL, /* CAPAB Chan Modes */
1, /* We support Unreal TOKENS */
1, /* TIME STAMPS are BASE64 */
1, /* Can remove User Channel Modes with SVSMODE */
0, /* Sglines are not enforced until user reconnects */
0, /* ts6 */
0, /* p10 */
- NULL, /* character set */
0, /* CIDR channelbans */
"$", /* TLD Prefix for Global */
false, /* Auth for users is sent after the initial NICK/UID command */
@@ -62,41 +60,6 @@ IRCDVar myIrcd[] = {
{NULL}
};
-IRCDCAPAB myIrcdcap[] = {
- {
- CAPAB_NOQUIT, /* NOQUIT */
- 0, /* TSMODE */
- 0, /* UNCONNECT */
- CAPAB_NICKIP, /* NICKIP */
- 0, /* SJOIN */
- CAPAB_ZIP, /* ZIP */
- 0, /* BURST */
- 0, /* TS5 */
- 0, /* TS3 */
- 0, /* DKEY */
- 0, /* PT4 */
- 0, /* SCS */
- 0, /* QS */
- 0, /* UID */
- 0, /* KNOCK */
- 0, /* CLIENT */
- 0, /* IPV6 */
- 0, /* SSJ5 */
- 0, /* SN2 */
- CAPAB_TOKEN, /* TOKEN */
- 0, /* VHOST */
- CAPAB_SSJ3, /* SSJ3 */
- CAPAB_NICK2, /* NICK2 */
- CAPAB_VL, /* VL */
- CAPAB_TLKEXT, /* TLKEXT */
- 0, /* DODKEY */
- 0, /* DOZIP */
- CAPAB_CHANMODE, /* CHANMODE */
- CAPAB_SJB64,
- CAPAB_NICKCHARS,
- }
-};
-
/* svswatch
* parv[0] - sender
* parv[1] - target nick
@@ -611,6 +574,9 @@ int anope_event_capab(const char *source, int ac, const char **av)
}
}
}
+
+ CapabParse(ac, av);
+
return MOD_CONT;
}
@@ -1398,10 +1364,13 @@ class ProtoUnreal : public Module
this->SetType(PROTOCOL);
pmodule_ircd_version("UnrealIRCd 3.2+");
- pmodule_ircd_cap(myIrcdcap);
pmodule_ircd_var(myIrcd);
pmodule_ircd_useTSMode(0);
+ CapabType c[] = { CAPAB_NOQUIT, CAPAB_NICKIP, CAPAB_ZIP, CAPAB_TOKEN, CAPAB_SSJ3, CAPAB_NICK2, CAPAB_VL, CAPAB_TLKEXT, CAPAB_CHANMODE, CAPAB_SJB64, CAPAB_NICKCHARS };
+ for (unsigned i = 0; i < 11; ++i)
+ Capab.SetFlag(c[i]);
+
AddModes();
pmodule_ircd_proto(&ircd_proto);