diff options
| author | 2016-02-25 15:25:02 +0100 | |
|---|---|---|
| committer | 2016-02-25 15:25:02 +0100 | |
| commit | 28dcc1f9e017152f03b0d9bfbcc494260b015a0a (patch) | |
| tree | 9786e2481c03df5aca1fc1c0e2ffeb44bcb32d4a /src/users.cpp | |
| parent | Add no-op ConvToStr(const std::string&) (diff) | |
| download | inspircd++-28dcc1f9e017152f03b0d9bfbcc494260b015a0a.tar.gz inspircd++-28dcc1f9e017152f03b0d9bfbcc494260b015a0a.tar.bz2 inspircd++-28dcc1f9e017152f03b0d9bfbcc494260b015a0a.zip | |
Add Numeric::Numeric
Diffstat (limited to 'src/users.cpp')
| -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; |
