]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/base.cpp
Added m_blockcolor, implements unreal-style mode +c for color blocking
[user/henk/code/inspircd.git] / src / base.cpp
1 #include "base.h"
2 #include "inspircd_config.h" 
3 #include <time.h>
4 #include <map>
5 #include <string>
6 #include "inspircd.h"
7 #include "modules.h"
8
9 bool Extensible::Extend(std::string key, char* p)
10 {
11         // only add an item if it doesnt already exist
12         if (this->Extension_Items.find(key) == this->Extension_Items.end())
13         {
14                 this->Extension_Items[key] = p;
15                 log(DEBUG,"Extending object with item %s",key.c_str());
16                 return true;
17         }
18         // item already exists, return false
19         return false;
20 }
21
22 bool Extensible::Shrink(std::string key)
23 {
24         // only attempt to remove a map item that exists
25         if (this->Extension_Items.find(key) != this->Extension_Items.end())
26         {
27                 this->Extension_Items.erase(this->Extension_Items.find(key));
28                 log(DEBUG,"Shrinking object with item %s",key.c_str());
29                 return true;
30         }
31         return false;
32 }
33
34 char* Extensible::GetExt(std::string key)
35 {
36         log(DEBUG,"Checking extension items for %s",key.c_str());
37         if (this->Extension_Items.find(key) != this->Extension_Items.end())
38         {
39                 log(DEBUG,"Found item %s %s",key.c_str(),(this->Extension_Items.find(key))->second);
40                 return (this->Extension_Items.find(key))->second;
41         }
42         log(DEBUG,"Cant find item %s",key.c_str());
43         return NULL;
44 }
45