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 template <typename InputIterator>
79 CmdBuilder& push_raw(InputIterator first, InputIterator last)
81 content.append(first, last);
85 CmdBuilder& push(const std::string& s)
87 content.push_back(' ');
92 CmdBuilder& push(const char* s)
94 content.push_back(' ');
99 CmdBuilder& push(char c)
101 content.push_back(' ');
102 content.push_back(c);
106 template <typename T>
107 CmdBuilder& push_int(T i)
109 content.push_back(' ');
110 content.append(ConvToStr(i));
114 CmdBuilder& push_last(const std::string& s)
116 content.push_back(' ');
117 content.push_back(':');
123 CmdBuilder& insert(const T& cont)
125 for (typename T::const_iterator i = cont.begin(); i != cont.end(); ++i)
130 void push_back(const std::string& s) { push(s); }
132 const std::string& str() const { return content; }
133 operator const std::string&() const { return str(); }
135 void Broadcast() const
137 Utils->DoOneToMany(*this);
140 void Forward(TreeServer* omit) const
142 Utils->DoOneToAllButSender(*this, omit);
145 void Unicast(User* target) const
147 Utils->DoOneToOne(*this, target->server);