1
0
mirror of https://github.com/anope/anope.git synced 2026-07-09 18:23:12 +02:00

Added generic support for unknown modes told to Anope at runtime by the IRCd

git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2790 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
Adam-
2010-02-12 19:51:16 +00:00
parent 2eb2cb7650
commit 84ecd1866c
5 changed files with 41 additions and 0 deletions
+2
View File
@@ -350,6 +350,8 @@ E uint32 str_is_ip(char *str);
E int str_is_cidr(char *str, uint32 * ip, uint32 * mask, char **host);
/**** modes.cpp ****/
/* Number of generic modes we support */
E unsigned GenericChannelModes, GenericUserModes;
E std::bitset<128> DefMLockOn;
E std::bitset<128> DefMLockOff;
E std::map<ChannelModeName, std::string> DefMLockParams;
+12
View File
@@ -28,6 +28,8 @@ std::map<ChannelModeName, ChannelMode *> ModeManager::ChannelModesByName;
/* List of all modes Anope knows about */
std::list<Mode *> ModeManager::Modes;
/* Number of generic modes we support */
unsigned GenericChannelModes = 0, GenericUserModes = 0;
/* Default mlocked modes on */
std::bitset<128> DefMLockOn;
/* Default mlocked modes off */
@@ -617,6 +619,11 @@ bool ModeManager::AddUserMode(UserMode *um)
{
if (ModeManager::UserModesByChar.insert(std::make_pair(um->ModeChar, um)).second)
{
if (um->Name == UMODE_END)
{
um->Name = static_cast<UserModeName>(UMODE_END + ++GenericUserModes);
Alog() << "ModeManager: Added generic support for user mode " << um->ModeChar;
}
ModeManager::UserModesByName.insert(std::make_pair(um->Name, um)).second;
ModeManager::Modes.push_back(um);
@@ -636,6 +643,11 @@ bool ModeManager::AddChannelMode(ChannelMode *cm)
{
if (ModeManager::ChannelModesByChar.insert(std::make_pair(cm->ModeChar, cm)).second)
{
if (cm->Name == CMODE_END)
{
cm->Name = static_cast<ChannelModeName>(CMODE_END + ++GenericChannelModes);
Alog() << "ModeManager: Added generic support for channel mode " << cm->ModeChar;
}
ModeManager::ChannelModesByName.insert(std::make_pair(cm->Name, cm)).second;
ModeManager::Modes.push_back(cm);
+9
View File
@@ -920,6 +920,8 @@ int anope_event_capab(const char *source, int ac, const char **av)
case 'I':
ModeManager::AddChannelMode(new ChannelModeInvite('I'));
continue;
default:
ModeManager::AddChannelMode(new ChannelModeList(CMODE_END, modebuf[t]));
}
}
@@ -931,6 +933,9 @@ int anope_event_capab(const char *source, int ac, const char **av)
case 'k':
ModeManager::AddChannelMode(new ChannelModeKey('k'));
continue;
default:
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_END, modebuf[t]));
}
}
@@ -948,6 +953,8 @@ int anope_event_capab(const char *source, int ac, const char **av)
case 'L':
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_REDIRECT, 'L', true));
continue;
default:
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_END, modebuf[t], true));
}
}
@@ -1016,6 +1023,8 @@ int anope_event_capab(const char *source, int ac, const char **av)
case 'V':
ModeManager::AddChannelMode(new ChannelMode(CMODE_NOINVITE, 'V'));
continue;
default:
ModeManager::AddChannelMode(new ChannelMode(CMODE_END, modebuf[t]));
}
}
}
+10
View File
@@ -1011,6 +1011,8 @@ int anope_event_capab(const char *source, int ac, const char **av)
case 'I':
ModeManager::AddChannelMode(new ChannelModeInvite('I'));
continue;
default:
ModeManager::AddChannelMode(new ChannelModeList(CMODE_END, modebuf[t]));
}
}
@@ -1022,6 +1024,8 @@ int anope_event_capab(const char *source, int ac, const char **av)
case 'k':
ModeManager::AddChannelMode(new ChannelModeKey('k'));
continue;
default:
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_END, modebuf[t]));
}
}
@@ -1048,6 +1052,8 @@ int anope_event_capab(const char *source, int ac, const char **av)
case 'l':
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_LIMIT, 'l', true));
continue;
default:
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_END, modebuf[t], true));
}
}
@@ -1125,6 +1131,8 @@ int anope_event_capab(const char *source, int ac, const char **av)
case 'z':
ModeManager::AddChannelMode(new ChannelMode(CMODE_SSL, 'z'));
continue;
default:
ModeManager::AddChannelMode(new ChannelMode(CMODE_END, modebuf[t]));
}
}
}
@@ -1194,6 +1202,8 @@ int anope_event_capab(const char *source, int ac, const char **av)
case 'd':
ModeManager::AddUserMode(new UserMode(UMODE_DEAF, 'd'));
continue;
default:
ModeManager::AddUserMode(new UserMode(UMODE_END, modebuf[t]));
}
}
}
+8
View File
@@ -465,6 +465,8 @@ int anope_event_capab(const char *source, int ac, const char **av)
case 'I':
ModeManager::AddChannelMode(new ChannelModeInvite('I'));
continue;
default:
ModeManager::AddChannelMode(new ChannelModeList(CMODE_END, modebuf[t]));
}
}
@@ -482,6 +484,8 @@ int anope_event_capab(const char *source, int ac, const char **av)
case 'L':
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_REDIRECT, 'L'));
continue;
default:
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_END, modebuf[t]));
}
}
@@ -496,6 +500,8 @@ int anope_event_capab(const char *source, int ac, const char **av)
case 'j':
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_JOINFLOOD, 'j', true));
continue;
default:
ModeManager::AddChannelMode(new ChannelModeParam(CMODE_END, modebuf[t], true));
}
}
@@ -570,6 +576,8 @@ int anope_event_capab(const char *source, int ac, const char **av)
case 'G':
ModeManager::AddChannelMode(new ChannelMode(CMODE_FILTER, 'G'));
continue;
default:
ModeManager::AddChannelMode(new ChannelMode(CMODE_END, modebuf[t]));
}
}
}