]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/channels.cpp
Removal of ancient TRUE/FALSE #defines (C-ish stuff)
[user/henk/code/inspircd.git] / src / channels.cpp
index 819195871b1baa6b371c52093a9783a5c974bd2a..3f2eca3f5f85ff33e12594c9ff5667e94dec9a15 100644 (file)
@@ -71,14 +71,14 @@ chanrec* ForceChan(chanrec* Ptr,ucrec *a,userrec* user, int created);
 chanrec::chanrec()
 {
        *name = *topic = *setby = *key = 0;
-       created = topicset = limit = binarymodes = 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<char,char*>::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<char,char*>::iterator n = custom_mode_params.find(mode);
+               if (n != custom_mode_params.end())
+               {
+                       return n->second;
+               }
+               return "";
        }
-       return "";
 }
 
 long chanrec::GetUserCounter()
@@ -254,7 +265,8 @@ 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]->binarymodes = CM_TOPICLOCK | CM_NOEXTERNAL;
+               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;
                strlcpy(chanlist[cname]->setby, user->nick,NICKMAX-1);
@@ -311,7 +323,7 @@ chanrec* add_channel(userrec *user, const char* cn, const char* key, bool overri
                                                }
                                        }
                                }
-                               if (Ptr->binarymodes & CM_INVITEONLY)
+                               if (Ptr->modes[CM_INVITEONLY])
                                {
                                        MOD_RESULT = 0;
                                        irc::string xname(Ptr->name);