From ced58c3be3f1da8dcf70c3904e5fe4bdaabf0e3d Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 12 Mar 2006 14:49:30 +0000 Subject: Renamed to chanrec::modes Renamed IsCustomModeSet to IsModeSet GetModeParameter will now return the channel limit (as a string) for a request for mode 'l' and the channel key for a request for mode 'k'. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3692 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/channels.cpp | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'src/channels.cpp') diff --git a/src/channels.cpp b/src/channels.cpp index aabf9664c..3f2eca3f5 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -73,12 +73,12 @@ chanrec::chanrec() *name = *topic = *setby = *key = 0; created = topicset = limit = 0; internal_userlist.clear(); - memset(&custom_modes,0,64); + memset(&modes,0,64); } void chanrec::SetCustomMode(char mode,bool mode_on) { - custom_modes[mode-65] = mode_on; + modes[mode-65] = mode_on; if (!mode_on) this->SetCustomModeParam(mode,"",false); } @@ -108,19 +108,30 @@ void chanrec::SetCustomModeParam(char mode,char* parameter,bool mode_on) } } -bool chanrec::IsCustomModeSet(char mode) +bool chanrec::IsModeSet(char mode) { - return custom_modes[mode-65]; + return modes[mode-65]; } std::string chanrec::GetModeParameter(char mode) { - std::map::iterator n = custom_mode_params.find(mode); - if (n != custom_mode_params.end()) + if (mode == 'k') { - return n->second; + return this->key; + } + else if (mode == 'l') + { + return ConvToStr(this->limit); + } + else + { + std::map::iterator n = custom_mode_params.find(mode); + if (n != custom_mode_params.end()) + { + return n->second; + } + return ""; } - return ""; } long chanrec::GetUserCounter() @@ -254,7 +265,7 @@ chanrec* add_channel(userrec *user, const char* cn, const char* key, bool overri /* create a new one */ chanlist[cname] = new chanrec(); strlcpy(chanlist[cname]->name, cname,CHANMAX); - chanlist[cname]->custom_modes[CM_TOPICLOCK] = chanlist[cname]->custom_modes[CM_NOEXTERNAL] = 1; + chanlist[cname]->modes[CM_TOPICLOCK] = chanlist[cname]->modes[CM_NOEXTERNAL] = 1; //chanlist[cname]->binarymodes = CM_TOPICLOCK | CM_NOEXTERNAL; chanlist[cname]->created = TIME; *chanlist[cname]->topic = 0; @@ -312,7 +323,7 @@ chanrec* add_channel(userrec *user, const char* cn, const char* key, bool overri } } } - if (Ptr->custom_modes[CM_INVITEONLY]) + if (Ptr->modes[CM_INVITEONLY]) { MOD_RESULT = 0; irc::string xname(Ptr->name); -- cgit v1.3.1-10-gc9f91