diff options
author | Attila Molnar <attilamolnar@hush.com> | 2016-02-25 15:25:02 +0100 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2016-02-25 15:25:02 +0100 |
commit | 28dcc1f9e017152f03b0d9bfbcc494260b015a0a (patch) | |
tree | 9786e2481c03df5aca1fc1c0e2ffeb44bcb32d4a /src | |
parent | 810ddfb91ac24f23234fff9bbee6a757df123234 (diff) |
Add Numeric::Numeric
Diffstat (limited to 'src')
-rw-r--r-- | src/users.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/users.cpp b/src/users.cpp index fd4afbcef..915afd8b8 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -786,6 +786,22 @@ void User::WriteCommand(const char* command, const std::string& text) this->WriteServ(command + (this->registered & REG_NICK ? " " + this->nick : " *") + " " + text); } +namespace +{ + std::string BuildNumeric(const std::string& source, User* targetuser, unsigned int num, const std::vector<std::string>& params) + { + const char* const target = (targetuser->registered & REG_NICK ? targetuser->nick.c_str() : "*"); + std::string raw = InspIRCd::Format(":%s %03u %s", source.c_str(), num, target); + if (!params.empty()) + { + for (std::vector<std::string>::const_iterator i = params.begin(); i != params.end()-1; ++i) + raw.append(1, ' ').append(*i); + raw.append(" :").append(params.back()); + } + return raw; + } +} + void User::WriteNumeric(unsigned int numeric, const char* text, ...) { std::string textbuffer; |