From c6934754b0cb10f6510f98fb3668a5effbbe97a5 Mon Sep 17 00:00:00 2001 From: brain Date: Thu, 3 Aug 2006 11:17:03 +0000 Subject: Dynamically generate 004 numeric from the modehandler list git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4665 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/mode.cpp | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'src/mode.cpp') diff --git a/src/mode.cpp b/src/mode.cpp index 6507c6d26..807675e02 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -574,6 +574,54 @@ ModeHandler* ModeParser::FindMode(unsigned const char modeletter, ModeType mt) return modehandlers[pos]; } +std::string ModeParser::UserModeList() +{ + char modestr[256]; + int pointer = 0; + + for (unsigned char mode = 'A'; mode <= 'z'; mode++) + { + unsigned char pos = (mode-65) | MASK_USER; + + if (modehandlers[pos]) + modestr[pointer++] = mode; + } + modestr[pointer++] = 0; + return modestr; +} + +std::string ModeParser::ChannelModeList() +{ + char modestr[256]; + int pointer = 0; + + for (unsigned char mode = 'A'; mode <= 'z'; mode++) + { + unsigned char pos = (mode-65) | MASK_CHANNEL; + + if (modehandlers[pos]) + modestr[pointer++] = mode; + } + modestr[pointer++] = 0; + return modestr; +} + +std::string ModeParser::ParaModeList() +{ + char modestr[256]; + int pointer = 0; + + for (unsigned char mode = 'A'; mode <= 'z'; mode++) + { + unsigned char pos = (mode-65) | MASK_CHANNEL; + + if ((modehandlers[pos]) && (modehandlers[pos]->GetNumParams(true))) + modestr[pointer++] = mode; + } + modestr[pointer++] = 0; + return modestr; +} + bool ModeParser::AddModeWatcher(ModeWatcher* mw) { unsigned char mask = 0; -- cgit v1.2.3