diff options
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_callerid.cpp | 11 | ||||
-rw-r--r-- | src/modules/m_check.cpp | 13 | ||||
-rw-r--r-- | src/modules/m_invisible.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.cpp | 11 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.h | 1 | ||||
-rw-r--r-- | src/modules/m_spanningtree/netburst.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_sslinfo.cpp | 4 |
7 files changed, 12 insertions, 34 deletions
diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index b84ee2c9c..dab0d3d43 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -56,14 +56,15 @@ class callerid_data : public classbase } } - std::string ToString(Module* proto) const + std::string ToString(SerializeFormat format) const { std::ostringstream oss; oss << lastnotify; for (std::set<User*>::const_iterator i = accepting.begin(); i != accepting.end(); ++i) { + User* u = *i; // Encode UIDs. - oss << "," << proto->ProtoTranslate(*i); + oss << "," << (format == FORMAT_USER ? u->nick : u->uuid); } oss << std::ends; return oss.str(); @@ -77,13 +78,13 @@ struct CallerIDExtInfo : public ExtensionItem { } - std::string serialize(Module* requestor, const Extensible* container, void* item) + std::string serialize(SerializeFormat format, const Extensible* container, void* item) { callerid_data* dat = static_cast<callerid_data*>(item); - return dat->ToString(requestor); + return dat->ToString(format); } - void unserialize(Module* requestor, Extensible* container, const std::string& value) + void unserialize(SerializeFormat format, Extensible* container, const std::string& value) { callerid_data* dat = new callerid_data(value); set_raw(container, dat); diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index 33f950b4c..847e9d5c9 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -41,7 +41,7 @@ class CommandCheck : public Command ExtensionItem* item = Extensible::GetItem(i->first); std::string value; if (item) - value = item->serialize(creator, ext, i->second); + value = item->serialize(FORMAT_USER, ext, i->second); if (value.empty()) dumpkeys << " " << i->first; else @@ -211,17 +211,6 @@ class ModuleCheck : public Module { return Version("CHECK command, view user/channel details", VF_VENDOR|VF_OPTCOMMON); } - - std::string ProtoTranslate(Extensible* item) - { - User* u = dynamic_cast<User*>(item); - Channel* c = dynamic_cast<Channel*>(item); - if (u) - return u->nick; - if (c) - return c->name; - return "?"; - } }; MODULE_INIT(ModuleCheck) diff --git a/src/modules/m_invisible.cpp b/src/modules/m_invisible.cpp index ae54fa96b..068e6d666 100644 --- a/src/modules/m_invisible.cpp +++ b/src/modules/m_invisible.cpp @@ -53,7 +53,7 @@ class InvisibleMode : public ModeHandler snprintf(tb,MAXBUF,":%s %s %s", dest->GetFullHost().c_str(), adding ? "PART" : "JOIN", (*f)->name.c_str()); std::string out = tb; - std::string n = this->ServerInstance->Modes->ModeString(dest, (*f)); + std::string n = ServerInstance->Modes->ModeString(dest, (*f)); for (UserMembCIter i = ulist->begin(); i != ulist->end(); i++) { diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 3877daf42..ee8c82c8b 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -932,17 +932,6 @@ void ModuleSpanningTree::ProtoSendMetaData(void* opaque, Extensible* target, con s->WriteLine(std::string(":")+ServerInstance->Config->GetSID()+" METADATA * "+extname+" :"+extdata); } -std::string ModuleSpanningTree::ProtoTranslate(Extensible* item) -{ - User* u = dynamic_cast<User*>(item); - Channel* c = dynamic_cast<Channel*>(item); - if (u) - return u->uuid; - if (c) - return c->name; - return "*"; -} - void ModuleSpanningTree::OnEvent(Event* event) { if ((event->GetEventID() == "send_encap") || (event->GetEventID() == "send_metadata") || (event->GetEventID() == "send_topic") || (event->GetEventID() == "send_mode") || (event->GetEventID() == "send_mode_explicit") || (event->GetEventID() == "send_opers") diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index 1d3ec9d39..0144eb4a3 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -187,7 +187,6 @@ class ModuleSpanningTree : public Module ModResult OnSetAway(User* user, const std::string &awaymsg); void ProtoSendMode(void* opaque, TargetTypeFlags target_type, void* target, const std::vector<std::string> &modeline, const std::vector<TranslateType> &translate); void ProtoSendMetaData(void* opaque, Extensible* target, const std::string &extname, const std::string &extdata); - std::string ProtoTranslate(Extensible* item); void OnEvent(Event* event); void OnLoadModule(Module* mod,const std::string &name); void OnUnloadModule(Module* mod,const std::string &name); diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp index 3ed85ea1e..ada10e6a1 100644 --- a/src/modules/m_spanningtree/netburst.cpp +++ b/src/modules/m_spanningtree/netburst.cpp @@ -225,7 +225,7 @@ void TreeSocket::SendChannelModes(TreeServer* Current) ExtensionItem* item = Extensible::GetItem(i->first); std::string value; if (item) - value = item->serialize(Utils->Creator, c->second, i->second); + value = item->serialize(FORMAT_NETWORK, c->second, i->second); if (!value.empty()) Utils->Creator->ProtoSendMetaData(this, c->second, i->first, value); } @@ -276,7 +276,7 @@ void TreeSocket::SendUsers(TreeServer* Current) ExtensionItem* item = Extensible::GetItem(i->first); std::string value; if (item) - value = item->serialize(Utils->Creator, u->second, i->second); + value = item->serialize(FORMAT_NETWORK, u->second, i->second); if (!value.empty()) Utils->Creator->ProtoSendMetaData(this, u->second, i->first, value); } diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp index bf02ed879..952fcf4a1 100644 --- a/src/modules/m_sslinfo.cpp +++ b/src/modules/m_sslinfo.cpp @@ -29,12 +29,12 @@ class SSLCertExt : public ExtensionItem { delete old; } - std::string serialize(Module* requestor, const Extensible* container, void* item) + std::string serialize(SerializeFormat format, const Extensible* container, void* item) { return static_cast<ssl_cert*>(item)->GetMetaLine(); } - void unserialize(Module* requestor, Extensible* container, const std::string& value) + void unserialize(SerializeFormat format, Extensible* container, const std::string& value) { ssl_cert* cert = new ssl_cert; set(container, cert); |