From a9989ac3978bd6e1f9e915aeed399d9db327c235 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Fri, 19 Jul 2019 13:01:59 +0100 Subject: Get rid of CommandBuilder::push_back. --- src/modules/m_spanningtree/commandbuilder.h | 2 -- src/modules/m_spanningtree/idle.cpp | 6 ++-- src/modules/m_spanningtree/main.cpp | 36 ++++++++++++------------ src/modules/m_spanningtree/nickcollide.cpp | 4 +-- src/modules/m_spanningtree/ping.cpp | 4 +-- src/modules/m_spanningtree/postcommand.cpp | 8 +++--- src/modules/m_spanningtree/protocolinterface.cpp | 2 +- 7 files changed, 30 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/modules/m_spanningtree/commandbuilder.h b/src/modules/m_spanningtree/commandbuilder.h index ec9533f2e..4913120e0 100644 --- a/src/modules/m_spanningtree/commandbuilder.h +++ b/src/modules/m_spanningtree/commandbuilder.h @@ -151,8 +151,6 @@ class CmdBuilder return *this; } - void push_back(const std::string& s) { push(s); } - const std::string& str() const { return content; } operator const std::string&() const { return str(); } diff --git a/src/modules/m_spanningtree/idle.cpp b/src/modules/m_spanningtree/idle.cpp index 972707ca2..904142999 100644 --- a/src/modules/m_spanningtree/idle.cpp +++ b/src/modules/m_spanningtree/idle.cpp @@ -60,9 +60,9 @@ CmdResult CommandIdle::HandleRemote(RemoteUser* issuer, Params& params) idle = ((unsigned int) (ServerInstance->Time() - localtarget->idle_lastmsg)); CmdBuilder reply(target, "IDLE"); - reply.push_back(issuer->uuid); - reply.push_back(ConvToStr(target->signon)); - reply.push_back(ConvToStr(idle)); + reply.push(issuer->uuid); + reply.push(ConvToStr(target->signon)); + reply.push(ConvToStr(idle)); reply.Unicast(issuer); } diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 2651e1a4a..561eed2fb 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -359,10 +359,10 @@ void ModuleSpanningTree::OnUserInvite(User* source, User* dest, Channel* channel if (IS_LOCAL(source)) { CmdBuilder params(source, "INVITE"); - params.push_back(dest->uuid); - params.push_back(channel->name); + params.push(dest->uuid); + params.push(channel->name); params.push_int(channel->age); - params.push_back(ConvToStr(expiry)); + params.push(ConvToStr(expiry)); params.Broadcast(); } } @@ -403,7 +403,7 @@ void ModuleSpanningTree::OnUserPostMessage(User* user, const MessageTarget& targ { CmdBuilder params(user, message_type); params.push_tags(details.tags_out); - params.push_back(d->uuid); + params.push(d->uuid); params.push_last(details.text); params.Unicast(d); } @@ -419,7 +419,7 @@ void ModuleSpanningTree::OnUserPostMessage(User* user, const MessageTarget& targ const std::string* serverglob = target.Get(); CmdBuilder par(user, message_type); par.push_tags(details.tags_out); - par.push_back(*serverglob); + par.push(*serverglob); par.push_last(details.text); par.Broadcast(); break; @@ -441,7 +441,7 @@ void ModuleSpanningTree::OnUserPostTagMessage(User* user, const MessageTarget& t { CmdBuilder params(user, "TAGMSG"); params.push_tags(details.tags_out); - params.push_back(d->uuid); + params.push(d->uuid); params.Unicast(d); } break; @@ -456,7 +456,7 @@ void ModuleSpanningTree::OnUserPostTagMessage(User* user, const MessageTarget& t const std::string* serverglob = target.Get(); CmdBuilder par(user, "TAGMSG"); par.push_tags(details.tags_out); - par.push_back(*serverglob); + par.push(*serverglob); par.Broadcast(); break; } @@ -513,12 +513,12 @@ void ModuleSpanningTree::OnUserJoin(Membership* memb, bool sync, bool created_by else { CmdBuilder params(memb->user, "IJOIN"); - params.push_back(memb->chan->name); + params.push(memb->chan->name); params.push_int(memb->id); if (!memb->modes.empty()) { - params.push_back(ConvToStr(memb->chan->age)); - params.push_back(memb->modes); + params.push(ConvToStr(memb->chan->age)); + params.push(memb->modes); } params.Broadcast(); } @@ -553,7 +553,7 @@ void ModuleSpanningTree::OnUserPart(Membership* memb, std::string &partmessage, if (IS_LOCAL(memb->user)) { CmdBuilder params(memb->user, "PART"); - params.push_back(memb->chan->name); + params.push(memb->chan->name); if (!partmessage.empty()) params.push_last(partmessage); params.Broadcast(); @@ -593,8 +593,8 @@ void ModuleSpanningTree::OnUserPostNick(User* user, const std::string &oldnick) { // The nick TS is updated by the core, we don't do it CmdBuilder params(user, "NICK"); - params.push_back(user->nick); - params.push_back(ConvToStr(user->age)); + params.push(user->nick); + params.push(ConvToStr(user->age)); params.Broadcast(); } else if (!loopCall) @@ -609,8 +609,8 @@ void ModuleSpanningTree::OnUserKick(User* source, Membership* memb, const std::s return; CmdBuilder params(source, "KICK"); - params.push_back(memb->chan->name); - params.push_back(memb->user->uuid); + params.push(memb->chan->name); + params.push(memb->user->uuid); // If a remote user is being kicked by us then send the membership id in the kick too if (!IS_LOCAL(memb->user)) params.push_int(memb->id); @@ -626,7 +626,7 @@ void ModuleSpanningTree::OnPreRehash(User* user, const std::string ¶meter) if (!parameter.empty() && parameter[0] != '-') { CmdBuilder params(user ? user : ServerInstance->FakeClient, "REHASH"); - params.push_back(parameter); + params.push(parameter); params.Forward(user ? TreeServer::Get(user)->GetRoute() : NULL); } } @@ -749,8 +749,8 @@ void ModuleSpanningTree::OnDelLine(User* user, XLine *x) user = ServerInstance->FakeClient; CmdBuilder params(user, "DELLINE"); - params.push_back(x->type); - params.push_back(x->Displayable()); + params.push(x->type); + params.push(x->Displayable()); params.Broadcast(); } diff --git a/src/modules/m_spanningtree/nickcollide.cpp b/src/modules/m_spanningtree/nickcollide.cpp index 62e200921..f1c6a9ae0 100644 --- a/src/modules/m_spanningtree/nickcollide.cpp +++ b/src/modules/m_spanningtree/nickcollide.cpp @@ -108,8 +108,8 @@ bool SpanningTreeUtilities::DoCollision(User* u, TreeServer* server, time_t remo * this "local" nick is actually behind us, send a SAVE out. */ CmdBuilder params("SAVE"); - params.push_back(u->uuid); - params.push_back(ConvToStr(u->age)); + params.push(u->uuid); + params.push(ConvToStr(u->age)); params.Broadcast(); u->ChangeNick(u->uuid, CommandSave::SavedTimestamp); diff --git a/src/modules/m_spanningtree/ping.cpp b/src/modules/m_spanningtree/ping.cpp index 844feb35b..51e87874d 100644 --- a/src/modules/m_spanningtree/ping.cpp +++ b/src/modules/m_spanningtree/ping.cpp @@ -30,10 +30,10 @@ CmdResult CommandPing::Handle(User* user, Params& params) { // PING for us, reply with a PONG CmdBuilder reply("PONG"); - reply.push_back(user->uuid); + reply.push(user->uuid); if (params.size() >= 2) // If there is a second parameter, append it - reply.push_back(params[1]); + reply.push(params[1]); reply.Unicast(user); } diff --git a/src/modules/m_spanningtree/postcommand.cpp b/src/modules/m_spanningtree/postcommand.cpp index fe54abde2..10cbbce82 100644 --- a/src/modules/m_spanningtree/postcommand.cpp +++ b/src/modules/m_spanningtree/postcommand.cpp @@ -45,7 +45,7 @@ void SpanningTreeUtilities::RouteCommand(TreeServer* origin, CommandBase* thiscm if (routing.type == ROUTE_TYPE_OPT_BCAST) { params.push('*'); - params.push_back(command); + params.push(command); } else if (routing.type == ROUTE_TYPE_UNICAST || routing.type == ROUTE_TYPE_OPT_UCAST) { @@ -64,8 +64,8 @@ void SpanningTreeUtilities::RouteCommand(TreeServer* origin, CommandBase* thiscm if (encap) { - params.push_back(sdest->GetID()); - params.push_back(command); + params.push(sdest->GetID()); + params.push(command); } } else @@ -83,7 +83,7 @@ void SpanningTreeUtilities::RouteCommand(TreeServer* origin, CommandBase* thiscm std::string output_text = CommandParser::TranslateUIDs(thiscmd->translation, parameters, true, thiscmd); - params.push_back(output_text); + params.push(output_text); if (routing.type == ROUTE_TYPE_MESSAGE) { diff --git a/src/modules/m_spanningtree/protocolinterface.cpp b/src/modules/m_spanningtree/protocolinterface.cpp index 2af122010..9fe93a389 100644 --- a/src/modules/m_spanningtree/protocolinterface.cpp +++ b/src/modules/m_spanningtree/protocolinterface.cpp @@ -118,7 +118,7 @@ void SpanningTreeProtocolInterface::SendMessage(Channel* target, char status, co void SpanningTreeProtocolInterface::SendMessage(User* target, const std::string& text, MessageType msgtype) { CmdBuilder p(msgtype == MSG_PRIVMSG ? "PRIVMSG" : "NOTICE"); - p.push_back(target->uuid); + p.push(target->uuid); p.push_last(text); p.Unicast(target); } -- cgit v1.2.3