From 9b35c4c78cb15bdae0431f1425983bc41150fee5 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Wed, 12 Jun 2019 12:42:47 +0100 Subject: Add an API for accessing a batch end event. This is essentially identical to the one for the start event. --- src/modules/m_ircv3_batch.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_ircv3_batch.cpp b/src/modules/m_ircv3_batch.cpp index df2b00f49..91ff0b140 100644 --- a/src/modules/m_ircv3_batch.cpp +++ b/src/modules/m_ircv3_batch.cpp @@ -44,10 +44,14 @@ struct IRCv3::Batch::BatchInfo std::vector users; BatchMessage startmsg; ClientProtocol::Event startevent; + BatchMessage endmsg; + ClientProtocol::Event endevent; BatchInfo(ClientProtocol::EventProvider& protoevprov, IRCv3::Batch::Batch& b) : startmsg(b, true) , startevent(protoevprov, startmsg) + , endmsg(b, false) + , endevent(protoevprov, endmsg) { } }; @@ -151,6 +155,7 @@ class IRCv3::Batch::ManagerImpl : public Manager batch.manager = this; batch.batchinfo = new IRCv3::Batch::BatchInfo(protoevprov, batch); batch.batchstartmsg = &batch.batchinfo->startmsg; + batch.batchendmsg = &batch.batchinfo->endmsg; active_batches.push_back(&batch); } @@ -164,12 +169,10 @@ class IRCv3::Batch::ManagerImpl : public Manager BatchInfo& batchinfo = *batch.batchinfo; // Send end batch message to all users who got the batch start message and unset bit so it can be reused - BatchMessage endbatchmsg(batch, false); - ClientProtocol::Event endbatchevent(protoevprov, endbatchmsg); for (std::vector::const_iterator i = batchinfo.users.begin(); i != batchinfo.users.end(); ++i) { LocalUser* const user = *i; - user->Send(endbatchevent); + user->Send(batchinfo.endevent); batchbits.set(user, batchbits.get(user) & ~batch.GetBit()); } -- cgit v1.2.3