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/>.
32 CmdBuilder(const char* cmd)
35 content.append(ServerInstance->Config->GetSID());
39 CmdBuilder(const std::string& src, const char* cmd)
46 CmdBuilder(User* src, const char* cmd)
49 content.append(src->uuid);
53 CmdBuilder& push_raw(const std::string& s)
59 CmdBuilder& push_raw(const char* s)
65 CmdBuilder& push_raw(char c)
72 CmdBuilder& push_raw_int(T i)
74 content.append(ConvToStr(i));
78 CmdBuilder& push(const std::string& s)
80 content.push_back(' ');
85 CmdBuilder& push(const char* s)
87 content.push_back(' ');
92 CmdBuilder& push(char c)
94 content.push_back(' ');
100 CmdBuilder& push_int(T i)
102 content.push_back(' ');
103 content.append(ConvToStr(i));
107 CmdBuilder& push_last(const std::string& s)
109 content.push_back(' ');
110 content.push_back(':');
116 CmdBuilder& insert(const T& cont)
118 for (typename T::const_iterator i = cont.begin(); i != cont.end(); ++i)
123 void push_back(const std::string& s) { push(s); }
125 const std::string& str() const { return content; }
126 operator const std::string&() const { return str(); }
128 void Broadcast() const
130 Utils->DoOneToMany(*this);
133 void Forward(TreeServer* omit) const
135 Utils->DoOneToAllButSender(*this, omit);
138 bool Unicast(const std::string& target) const
140 return Utils->DoOneToOne(*this, target);
143 void Unicast(User* target) const
145 Utils->DoOneToOne(*this, target->server);