]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/base.cpp
Hide User#host and User#dhost and use accessors to modify them.
[user/henk/code/inspircd.git] / src / base.cpp
index b007a109863b34587d26b0c389b4871f70b92562..0ff3fbe4c303256865110bd050492abdeb7c6de2 100644 (file)
@@ -95,6 +95,10 @@ ServiceProvider::~ServiceProvider()
 {
 }
 
+void ServiceProvider::RegisterService()
+{
+}
+
 ExtensionItem::ExtensionItem(const std::string& Key, ExtensibleType exttype, Module* mod)
        : ServiceProvider(mod, Key, SERVICE_METADATA)
        , type(exttype)
@@ -140,6 +144,12 @@ void* ExtensionItem::unset_raw(Extensible* container)
        return rv;
 }
 
+void ExtensionItem::RegisterService()
+{
+       if (!ServerInstance->Extensions.Register(this))
+               throw ModuleException("Extension already exists: " + name);
+}
+
 bool ExtensionManager::Register(ExtensionItem* item)
 {
        return types.insert(std::make_pair(item->name, item)).second;
@@ -243,6 +253,12 @@ std::string LocalStringExt::serialize(SerializeFormat format, const Extensible*
        return "";
 }
 
+void LocalStringExt::unserialize(SerializeFormat format, Extensible* container, const std::string& value)
+{
+       if (format != FORMAT_NETWORK)
+               set(container, value);
+}
+
 LocalIntExt::LocalIntExt(const std::string& Key, ExtensibleType exttype, Module* mod)
        : LocalExtItem(Key, exttype, mod)
 {
@@ -259,6 +275,12 @@ std::string LocalIntExt::serialize(SerializeFormat format, const Extensible* con
        return ConvToStr(reinterpret_cast<intptr_t>(item));
 }
 
+void LocalIntExt::unserialize(SerializeFormat format, Extensible* container, const std::string& value)
+{
+       if (format != FORMAT_NETWORK)
+               set(container, ConvToInt(value));
+}
+
 intptr_t LocalIntExt::get(const Extensible* container) const
 {
        return reinterpret_cast<intptr_t>(get_raw(container));