diff options
Diffstat (limited to 'src/channels.cpp')
-rw-r--r-- | src/channels.cpp | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index afa748f08..f6658db95 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -2,6 +2,7 @@ #include "channels.h" #include "inspircd.h" #include <stdio.h> +#include <string> chanrec::chanrec() { @@ -40,9 +41,56 @@ void chanrec::SetCustomMode(char mode,bool mode_on) } } +vector<ModeParameter> custom_mode_params; + void chanrec::SetCustomModeParam(char mode,char* parameter,bool mode_on) { -} + log(DEBUG,"SetCustomModeParam called"); + ModeParameter M; + M.mode = mode; + strcpy(M.channel,this->name); + strcpy(M.parameter,parameter); + if (mode_on) + { + log(DEBUG,"Custom mode parameter %c %s added",mode,parameter); + custom_mode_params.push_back(M); + } + else + { + if (custom_mode_params.size()) + { + for (vector<ModeParameter>::iterator i = custom_mode_params.begin(); i < custom_mode_params.end(); i++) + { + if ((i->mode == mode) && (!strcasecmp(this->name,i->channel))) + { + log(DEBUG,"Custom mode parameter %c %s removed",mode,parameter); + custom_mode_params.erase(i); + return; + } + } + } + log(DEBUG,"*** BUG *** Attempt to remove non-existent mode parameter!"); + } +} +bool chanrec::IsCustomModeSet(char mode) +{ + log(DEBUG,"Checking ISCustomModeSet: %c %s",mode,this->custom_modes); + return (strchr(this->custom_modes,mode) != 0); +} +std::string chanrec::GetModeParameter(char mode) +{ + if (custom_mode_params.size()) + { + for (vector<ModeParameter>::iterator i = custom_mode_params.begin(); i < custom_mode_params.end(); i++) + { + if ((i->mode == mode) && (!strcasecmp(this->name,i->channel))) + { + return std::string(i->parameter); + } + } + } + return std::string(""); +} |