2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2013 Attila Molnar <attilamolnar@hush.com>
6 * This file is part of InspIRCd. InspIRCd is free software: you can
7 * redistribute it and/or modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation, version 2.
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
31 CmdBuilder(const char* cmd)
34 content.append(ServerInstance->Config->GetSID());
38 CmdBuilder(const std::string& src, const char* cmd)
45 CmdBuilder(User* src, const char* cmd)
48 content.append(src->uuid);
52 CmdBuilder& push_raw(const std::string& s)
58 CmdBuilder& push_raw(const char* s)
64 CmdBuilder& push_raw(char c)
70 CmdBuilder& push(const std::string& s)
72 content.push_back(' ');
77 CmdBuilder& push(const char* s)
79 content.push_back(' ');
84 CmdBuilder& push(char c)
86 content.push_back(' ');
92 CmdBuilder& push_int(T i)
94 content.push_back(' ');
95 content.append(ConvToStr(i));
99 CmdBuilder& push_last(const std::string& s)
101 content.push_back(' ');
102 content.push_back(':');
108 CmdBuilder& insert(const T& cont)
110 for (typename T::const_iterator i = cont.begin(); i != cont.end(); ++i)
115 void push_back(const std::string& s) { push(s); }
117 const std::string& str() const { return content; }
118 operator const std::string&() const { return str(); }
120 void Broadcast() const
122 Utils->DoOneToMany(*this);
125 void Forward(TreeServer* omit) const
127 Utils->DoOneToAllButSender(*this, omit);
130 bool Unicast(const std::string& target) const
132 return Utils->DoOneToOne(*this, target);
135 bool Unicast(User* target) const
137 return Unicast(target->server);