diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-13 20:30:25 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-13 20:30:25 +0000 |
commit | 6d57bbe05c31c79eaad02fe81cfb9c1ed6b79c58 (patch) | |
tree | e0c89ed36b00f4c2925d7f39c32a835657b0fa6e /src/modules/m_spanningtree | |
parent | 7eea21b8d43b0d5993e88b62d9d4894c2af49303 (diff) |
Change Extensible to use strongly typed entries
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11696 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_spanningtree')
-rw-r--r-- | src/modules/m_spanningtree/hmac.cpp | 17 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/netburst.cpp | 28 | ||||
-rw-r--r-- | src/modules/m_spanningtree/operquit.cpp | 2 |
4 files changed, 38 insertions, 11 deletions
diff --git a/src/modules/m_spanningtree/hmac.cpp b/src/modules/m_spanningtree/hmac.cpp index 332e47585..348a453a6 100644 --- a/src/modules/m_spanningtree/hmac.cpp +++ b/src/modules/m_spanningtree/hmac.cpp @@ -128,17 +128,22 @@ bool TreeSocket::ComparePass(const Link& link, const std::string &theirs) this->auth_fingerprint = !link.Fingerprint.empty(); this->auth_challenge = !ourchallenge.empty() && !theirchallenge.empty(); - const char* fp = NULL; + std::string fp; if (GetHook()) - fp = BufferedSocketFingerprintRequest(this, Utils->Creator, GetHook()).Send(); - - if (fp) - ServerInstance->Logs->Log("m_spanningtree", DEFAULT, std::string("Server SSL fingerprint ") + fp); + { + BufferedSocketCertificateRequest req(this, Utils->Creator, GetHook()); + req.Send(); + if (req.cert) + { + fp = req.cert->GetFingerprint(); + ServerInstance->Logs->Log("m_spanningtree", DEFAULT, std::string("Server SSL fingerprint ") + fp); + } + } if (auth_fingerprint) { /* Require fingerprint to exist and match */ - if (!fp || link.Fingerprint != std::string(fp)) + if (link.Fingerprint != fp) return false; } diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 726b0713e..5e30ced35 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -731,7 +731,7 @@ void ModuleSpanningTree::OnRemoteKill(User* source, User* dest, const std::strin if (!IS_LOCAL(source)) return; // Only start routing if we're origin. - dest->Extend("operquit", new std::string(operreason)); + User::OperQuit.set(dest, operreason); parameterlist params; params.push_back(":"+operreason); Utils->DoOneToMany(dest->uuid,"OPERQUIT",params); diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp index 951d019ef..abefad728 100644 --- a/src/modules/m_spanningtree/netburst.cpp +++ b/src/modules/m_spanningtree/netburst.cpp @@ -17,6 +17,7 @@ #include "treesocket.h" #include "treeserver.h" #include "utils.h" +#include "main.h" /* $ModDep: m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */ @@ -46,7 +47,7 @@ void TreeSocket::DoBurst(TreeServer* s) /* Send everything else (channel modes, xlines etc) */ this->SendChannelModes(s); this->SendXLines(s); - FOREACH_MOD_I(this->ServerInstance,I_OnSyncNetwork,OnSyncNetwork((Module*)Utils->Creator,(void*)this)); + FOREACH_MOD_I(this->ServerInstance,I_OnSyncNetwork,OnSyncNetwork(Utils->Creator,(void*)this)); this->WriteLine(endburst); this->ServerInstance->SNO->WriteToSnoMask('l',"Finished bursting to \2"+name+"\2."); } @@ -218,7 +219,18 @@ void TreeSocket::SendChannelModes(TreeServer* Current) snprintf(data,MAXBUF,":%s FTOPIC %s %lu %s :%s", sn, c->second->name.c_str(), (unsigned long)c->second->topicset, c->second->setby.c_str(), c->second->topic.c_str()); this->WriteLine(data); } - FOREACH_MOD_I(this->ServerInstance,I_OnSyncChannel,OnSyncChannel(c->second,(Module*)Utils->Creator,(void*)this)); + + for(ExtensibleStore::const_iterator i = c->second->GetExtList().begin(); i != c->second->GetExtList().end(); i++) + { + ExtensionItem* item = Extensible::GetItem(i->first); + std::string value; + if (item) + value = item->serialize(Utils->Creator, c->second, i->second); + if (!value.empty()) + Utils->Creator->ProtoSendMetaData(this, c->second, i->first, value); + } + + FOREACH_MOD_I(this->ServerInstance,I_OnSyncChannel,OnSyncChannel(c->second,Utils->Creator,this)); } } @@ -259,7 +271,17 @@ void TreeSocket::SendUsers(TreeServer* Current) } } - FOREACH_MOD_I(this->ServerInstance,I_OnSyncUser,OnSyncUser(u->second,(Module*)Utils->Creator,(void*)this)); + for(ExtensibleStore::const_iterator i = u->second->GetExtList().begin(); i != u->second->GetExtList().end(); i++) + { + ExtensionItem* item = Extensible::GetItem(i->first); + std::string value; + if (item) + value = item->serialize(Utils->Creator, u->second, i->second); + if (!value.empty()) + Utils->Creator->ProtoSendMetaData(this, u->second, i->first, value); + } + + FOREACH_MOD_I(this->ServerInstance,I_OnSyncUser,OnSyncUser(u->second,Utils->Creator,this)); } } } diff --git a/src/modules/m_spanningtree/operquit.cpp b/src/modules/m_spanningtree/operquit.cpp index 5260cd990..5cdee3bc6 100644 --- a/src/modules/m_spanningtree/operquit.cpp +++ b/src/modules/m_spanningtree/operquit.cpp @@ -30,7 +30,7 @@ bool TreeSocket::OperQuit(const std::string &prefix, parameterlist ¶ms) if (u) { - u->Extend("operquit", new std::string(params[0])); + User::OperQuit.set(u, params[0]); params[0] = ":" + params[0]; Utils->DoOneToAllButSender(prefix,"OPERQUIT",params,prefix); } |