- who = ServerInstance->FindUUID(prefix.substr(0, 3));
- if (!who)
- who = this->MyRoot->ServerUser;
- }
- else
- {
- ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Command '%s' from unknown prefix '%s'! Dropping entire command.",
- command.c_str(), prefix.c_str());
- return;
- }
- }
+ if ((prefix.length() == UIDGenerator::UUID_LENGTH) && (isdigit(prefix[0])) &&
+ ((command == "FMODE") || (command == "MODE") || (command == "KICK") || (command == "TOPIC") || (command == "KILL") || (command == "ADDLINE") || (command == "DELLINE")))
+ {
+ /* Special case, we cannot drop these commands as they've been committed already on a
+ * part of the network by the time we receive them, so in this scenario pretend the
+ * command came from a server to avoid desync.
+ */
+
+ TreeServer* const usersserver = Utils->FindServerID(prefix.substr(0, 3));
+ if (usersserver)
+ return usersserver->ServerUser;
+ return this->MyRoot->ServerUser;
+ }
+
+ // Unknown prefix
+ return NULL;
+}
+
+void TreeSocket::ProcessTag(User* source, const std::string& tag, ClientProtocol::TagMap& tags)
+{
+ std::string tagkey;
+ std::string tagval;
+ const std::string::size_type p = tag.find('=');
+ if (p != std::string::npos)
+ {
+ // Tag has a value
+ tagkey.assign(tag, 0, p);
+ tagval.assign(tag, p + 1, std::string::npos);
+ }
+ else
+ {
+ tagkey.assign(tag);
+ }
+
+ const Events::ModuleEventProvider::SubscriberList& list = Utils->Creator->tagevprov.GetSubscribers();
+ for (Events::ModuleEventProvider::SubscriberList::const_iterator i = list.begin(); i != list.end(); ++i)
+ {
+ ClientProtocol::MessageTagProvider* const tagprov = static_cast<ClientProtocol::MessageTagProvider*>(*i);
+ const ModResult res = tagprov->OnProcessTag(source, tagkey, tagval);
+ if (res == MOD_RES_ALLOW)
+ tags.insert(std::make_pair(tagkey, ClientProtocol::MessageTagData(tagprov, tagval)));
+ else if (res == MOD_RES_DENY)
+ break;
+ }
+}
+
+void TreeSocket::ProcessConnectedLine(std::string& taglist, std::string& prefix, std::string& command, CommandBase::Params& params)
+{
+ User* who = FindSource(prefix, command);
+ if (!who)
+ {
+ ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Command '%s' from unknown prefix '%s'! Dropping entire command.", command.c_str(), prefix.c_str());
+ return;