diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-02 00:45:37 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-02 00:45:37 +0000 |
commit | f25c4b7a2263f5f3ce9bb41ba56b43c0d3a6d124 (patch) | |
tree | 43fba09e698269cd4c22c68be7ecb4a5875f55f3 /src/modules/m_check.cpp | |
parent | 6e85701ecb09604f2c87010683638ec0446cc515 (diff) |
MetaData rework
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11607 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_check.cpp')
-rw-r--r-- | src/modules/m_check.cpp | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index 3b79081ad..42be6a350 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -99,18 +99,7 @@ class CommandCheck : public Command ServerInstance->DumpText(user,checkstr + " onchans ", dump); - std::deque<std::string> extlist; - targuser->GetExtList(extlist); - std::stringstream dumpkeys; - for(std::deque<std::string>::iterator i = extlist.begin(); i != extlist.end(); i++) - { - md_sent = false; - FOREACH_MOD_I(ServerInstance,I_OnSyncUserMetaData,OnSyncUserMetaData(targuser,Parent,(void*)user,*i, true)); - if (!md_sent) - dumpkeys << " " << *i; - } - if (!dumpkeys.str().empty()) - ServerInstance->DumpText(user,checkstr + " metadata ", dumpkeys); + FOREACH_MOD_I(ServerInstance,I_OnSyncUser,OnSyncUser(targuser,Parent,(void*)user)); } else if (targchan) { @@ -143,18 +132,7 @@ class CommandCheck : public Command user->WriteServ(checkstr + " member " + tmpbuf); } - std::deque<std::string> extlist; - targchan->GetExtList(extlist); - std::stringstream dumpkeys; - for(std::deque<std::string>::iterator i = extlist.begin(); i != extlist.end(); i++) - { - md_sent = false; - FOREACH_MOD_I(ServerInstance,I_OnSyncChannelMetaData,OnSyncChannelMetaData(targchan,Parent,(void*)user,*i, true)); - if (!md_sent) - dumpkeys << " " << *i; - } - if (!dumpkeys.str().empty()) - ServerInstance->DumpText(user,checkstr + " metadata ", dumpkeys); + FOREACH_MOD_I(ServerInstance,I_OnSyncChannel,OnSyncChannel(targchan,Parent,(void*)user)); } else { @@ -206,12 +184,23 @@ class ModuleCheck : public Module return Version("$Id$", VF_VENDOR, API_VERSION); } - virtual void ProtoSendMetaData(void* opaque, TargetTypeFlags type, void* target, const std::string& name, const std::string& value) + virtual void ProtoSendMetaData(void* opaque, Extensible* target, const std::string& name, const std::string& value) { User* user = static_cast<User*>(opaque); user->WriteServ("304 " + std::string(user->nick) + " :CHECK meta:" + name + " " + value); mycommand.md_sent = true; } + + virtual 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) |