From fb3964d5c007900061e86e392ceb786bd47260c0 Mon Sep 17 00:00:00 2001 From: danieldg Date: Sun, 15 Nov 2009 18:26:53 +0000 Subject: Add Inspircd::AddServices git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12135 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'src/modules.cpp') diff --git a/src/modules.cpp b/src/modules.cpp index a2c4aa6ea..d86dc6270 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -469,7 +469,30 @@ void InspIRCd::AddCommand(Command *f) { if (!this->Parser->AddCommand(f)) { - throw ModuleException("Command "+std::string(f->command)+" already exists."); + throw ModuleException("Command "+std::string(f->name)+" already exists."); + } +} + +void InspIRCd::AddService(providerbase& item) +{ + switch (item.service) + { + case SERVICE_COMMAND: + if (!Parser->AddCommand(static_cast(&item))) + throw ModuleException("Command "+std::string(item.name)+" already exists."); + return; + case SERVICE_CMODE: + case SERVICE_UMODE: + if (!Modes->AddMode(static_cast(&item))) + throw ModuleException("Mode "+std::string(item.name)+" already exists."); + return; + case SERVICE_METADATA: + Extensions.Register(static_cast(&item)); + return; + case SERVICE_DATA: + case SERVICE_IOHOOK: + default: + throw ModuleException("Cannot add unknown service type"); } } -- cgit v1.2.3