+
+/* This method will attempt to get a link message out to as many people as is required.
+ * If a user is provided, and that user is local, then the user is sent the message using
+ * WriteServ (they are the local initiator of that message). If the user is remote, they are
+ * sent that message remotely via PUSH.
+ * If the user is NULL, then the notice is sent locally via WriteToSnoMask with snomask 'l',
+ * and remotely via SNONOTICE with mask 'l'.
+ */
+void ModuleSpanningTree::RemoteMessage(userrec* user, const char* format, ...)
+{
+ std::deque<std::string> params;
+ char text[MAXBUF];
+ va_list argsPtr;
+
+ va_start(argsPtr, format);
+ vsnprintf(text, MAXBUF, format, argsPtr);
+ va_end(argsPtr);
+
+ if (!user)
+ {
+ /* No user, target it generically at everyone */
+ ServerInstance->SNO->WriteToSnoMask('l', "%s", text);
+ params.push_back("l");
+ params.push_back(std::string(":") + text);
+ Utils->DoOneToMany(ServerInstance->Config->GetSID(), "SNONOTICE", params);
+ }
+ else
+ {
+ if (IS_LOCAL(user))
+ user->WriteServ("NOTICE %s :%s", user->nick, text);
+ else
+ {
+ params.push_back(user->uuid);
+ params.push_back(std::string("::") + ServerInstance->Config->ServerName + " NOTICE " + user->nick + " :*** From " +
+ ServerInstance->Config->ServerName+ ": " + text);
+ Utils->DoOneToMany(ServerInstance->Config->GetSID(), "PUSH", params);
+ }
+ }
+}