]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/users.cpp
Make User::WriteRemoteNumeric() virtual, implement it in SpanningTree::RemoteUser
[user/henk/code/inspircd.git] / src / users.cpp
index f6cdcc769926d132a980051f8fb0ff8ad5cdf479..7437e8a209f83baea1e3345608785616883e1732 100644 (file)
@@ -340,7 +340,7 @@ void User::Oper(OperInfo* info)
                LocalUser* l = IS_LOCAL(this);
                std::string vhost = oper->getConfig("vhost");
                if (!vhost.empty())
-                       l->ChangeDisplayedHost(vhost.c_str());
+                       l->ChangeDisplayedHost(vhost);
                std::string opClass = oper->getConfig("class");
                if (!opClass.empty())
                        l->SetClass(opClass);
@@ -811,7 +811,8 @@ void User::WriteNumeric(const Numeric::Numeric& numeric)
        if (MOD_RESULT == MOD_RES_DENY)
                return;
 
-       this->Write(BuildNumeric(ServerInstance->Config->ServerName, this, numeric.GetNumeric(), numeric.GetParams()));
+       const std::string& servername = (numeric.GetServer() ? numeric.GetServer()->GetName() : ServerInstance->Config->ServerName);
+       this->Write(BuildNumeric(servername, this, numeric.GetNumeric(), numeric.GetParams()));
 }
 
 void User::WriteFrom(User *user, const std::string &text)
@@ -830,6 +831,16 @@ void User::WriteFrom(User *user, const char* text, ...)
        this->WriteFrom(user, textbuffer);
 }
 
+void User::WriteRemoteNotice(const std::string& text)
+{
+       ServerInstance->PI->SendUserNotice(this, text);
+}
+
+void LocalUser::WriteRemoteNotice(const std::string& text)
+{
+       WriteNotice(text);
+}
+
 namespace
 {
        class WriteCommonRawHandler : public User::ForEachNeighborHandler
@@ -937,27 +948,9 @@ void User::SendText(const char *text, ...)
        SendText(line);
 }
 
-void User::SendText(const std::string& linePrefix, std::stringstream& textStream)
-{
-       std::string line;
-       std::string word;
-       while (textStream >> word)
-       {
-               size_t lineLength = linePrefix.length() + line.length() + word.length() + 3; // "\s\n\r"
-               if (lineLength > ServerInstance->Config->Limits.MaxLine)
-               {
-                       SendText(linePrefix + line);
-                       line.clear();
-               }
-               line += " " + word;
-       }
-       SendText(linePrefix + line);
-}
-
 void User::WriteRemoteNumeric(const Numeric::Numeric& numeric)
 {
-       const std::string& servername = (numeric.GetServer() ? numeric.GetServer()->GetName() : ServerInstance->Config->ServerName);
-       SendText(BuildNumeric(servername, this, numeric.GetNumeric(), numeric.GetParams()));
+       WriteNumeric(numeric);
 }
 
 /* return 0 or 1 depending if users u and u2 share one or more common channels