mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 02:59:01 -04:00
Add typedef ModeParser::ModeWatcherMap, remove ModeWatchIter
This commit is contained in:
parent
bc6090c224
commit
56af4909b8
@ -473,8 +473,6 @@ class CoreExport ModeWatcher : public classbase
|
|||||||
virtual void AfterMode(User* source, User* dest, Channel* channel, const std::string& parameter, bool adding);
|
virtual void AfterMode(User* source, User* dest, Channel* channel, const std::string& parameter, bool adding);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::multimap<std::string, ModeWatcher*>::iterator ModeWatchIter;
|
|
||||||
|
|
||||||
/** The mode parser handles routing of modes and handling of mode strings.
|
/** The mode parser handles routing of modes and handling of mode strings.
|
||||||
* It marshalls, controls and maintains both ModeWatcher and ModeHandler classes,
|
* It marshalls, controls and maintains both ModeWatcher and ModeHandler classes,
|
||||||
* parses client to server MODE strings for user and channel modes, and performs
|
* parses client to server MODE strings for user and channel modes, and performs
|
||||||
@ -490,6 +488,10 @@ class CoreExport ModeParser : public fakederef<ModeParser>
|
|||||||
typedef TR1NS::unordered_map<std::string, ModeHandler*, irc::insensitive, irc::StrHashComp> ModeHandlerMap;
|
typedef TR1NS::unordered_map<std::string, ModeHandler*, irc::insensitive, irc::StrHashComp> ModeHandlerMap;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
/** Type of the container that maps mode names to ModeWatchers
|
||||||
|
*/
|
||||||
|
typedef std::multimap<std::string, ModeWatcher*> ModeWatcherMap;
|
||||||
|
|
||||||
/** Last item in the ModeType enum
|
/** Last item in the ModeType enum
|
||||||
*/
|
*/
|
||||||
static const unsigned int MODETYPE_LAST = 2;
|
static const unsigned int MODETYPE_LAST = 2;
|
||||||
@ -524,7 +526,7 @@ class CoreExport ModeParser : public fakederef<ModeParser>
|
|||||||
|
|
||||||
/** Mode watcher classes
|
/** Mode watcher classes
|
||||||
*/
|
*/
|
||||||
std::multimap<std::string, ModeWatcher*> modewatchermap;
|
ModeWatcherMap modewatchermap;
|
||||||
|
|
||||||
/** Last processed mode change
|
/** Last processed mode change
|
||||||
*/
|
*/
|
||||||
|
14
src/mode.cpp
14
src/mode.cpp
@ -268,8 +268,8 @@ ModeAction ModeParser::TryMode(User* user, User* targetuser, Channel* chan, Mode
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ask mode watchers whether this mode change is OK
|
// Ask mode watchers whether this mode change is OK
|
||||||
std::pair<ModeWatchIter, ModeWatchIter> itpair = modewatchermap.equal_range(mh->name);
|
std::pair<ModeWatcherMap::iterator, ModeWatcherMap::iterator> itpair = modewatchermap.equal_range(mh->name);
|
||||||
for (ModeWatchIter i = itpair.first; i != itpair.second; ++i)
|
for (ModeWatcherMap::iterator i = itpair.first; i != itpair.second; ++i)
|
||||||
{
|
{
|
||||||
ModeWatcher* mw = i->second;
|
ModeWatcher* mw = i->second;
|
||||||
if (mw->GetModeType() == type)
|
if (mw->GetModeType() == type)
|
||||||
@ -320,7 +320,7 @@ ModeAction ModeParser::TryMode(User* user, User* targetuser, Channel* chan, Mode
|
|||||||
return ma;
|
return ma;
|
||||||
|
|
||||||
itpair = modewatchermap.equal_range(mh->name);
|
itpair = modewatchermap.equal_range(mh->name);
|
||||||
for (ModeWatchIter i = itpair.first; i != itpair.second; ++i)
|
for (ModeWatcherMap::iterator i = itpair.first; i != itpair.second; ++i)
|
||||||
{
|
{
|
||||||
ModeWatcher* mw = i->second;
|
ModeWatcher* mw = i->second;
|
||||||
if (mw->GetModeType() == type)
|
if (mw->GetModeType() == type)
|
||||||
@ -496,8 +496,8 @@ void ModeParser::ShowListModeList(User* user, Channel* chan, ModeHandler* mh)
|
|||||||
bool display = true;
|
bool display = true;
|
||||||
|
|
||||||
// Ask mode watchers whether it's OK to show the list
|
// Ask mode watchers whether it's OK to show the list
|
||||||
std::pair<ModeWatchIter, ModeWatchIter> itpair = modewatchermap.equal_range(mh->name);
|
std::pair<ModeWatcherMap::iterator, ModeWatcherMap::iterator> itpair = modewatchermap.equal_range(mh->name);
|
||||||
for (ModeWatchIter i = itpair.first; i != itpair.second; ++i)
|
for (ModeWatcherMap::iterator i = itpair.first; i != itpair.second; ++i)
|
||||||
{
|
{
|
||||||
ModeWatcher* mw = i->second;
|
ModeWatcher* mw = i->second;
|
||||||
if (mw->GetModeType() == MODETYPE_CHANNEL)
|
if (mw->GetModeType() == MODETYPE_CHANNEL)
|
||||||
@ -816,8 +816,8 @@ void ModeParser::AddModeWatcher(ModeWatcher* mw)
|
|||||||
|
|
||||||
bool ModeParser::DelModeWatcher(ModeWatcher* mw)
|
bool ModeParser::DelModeWatcher(ModeWatcher* mw)
|
||||||
{
|
{
|
||||||
std::pair<ModeWatchIter, ModeWatchIter> itpair = modewatchermap.equal_range(mw->GetModeName());
|
std::pair<ModeWatcherMap::iterator, ModeWatcherMap::iterator> itpair = modewatchermap.equal_range(mw->GetModeName());
|
||||||
for (ModeWatchIter i = itpair.first; i != itpair.second; ++i)
|
for (ModeWatcherMap::iterator i = itpair.first; i != itpair.second; ++i)
|
||||||
{
|
{
|
||||||
if (i->second == mw)
|
if (i->second == mw)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user