Skip to content

Commit

Permalink
doit
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyalatt committed Feb 4, 2019
1 parent 1b2d60a commit 3f3e88d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Telega/Rpc/TgTransport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,22 +110,22 @@ byte[] CreateMsg(ITgSerializable dto, bool isContentRelated, long? msgId = null)
(byte[], long) WithAck(ITgSerializable dto)
{
var unconfirmedIds = PopUnconfirmedMsgIds();
var shouldAck = unconfirmedIds.Count != 0;
if (!shouldAck)
var shouldNotAck = unconfirmedIds.Count == 0;
if (shouldNotAck)
{
var singleDtoMsgId = Session.GetNewMessageId(_session);
return (CreateMsg(dto, isContentRelated: true, msgId: singleDtoMsgId), singleDtoMsgId);
}

var ack = CreateMsg(new MsgsAck(unconfirmedIds.ToArr()), isContentRelated: false);
var ackBts = CreateMsg(new MsgsAck(unconfirmedIds.ToArr()), isContentRelated: false);
var msgId = Session.GetNewMessageId(_session);
var dtoBts = CreateMsg(dto, isContentRelated: true, msgId: msgId);

return BtHelpers.UsingMemBinWriter(bw =>
{
bw.Write(MsgContainerTypeNumber);
bw.Write(2);
bw.Write(ack);
bw.Write(ackBts);
bw.Write(dtoBts);
}).Apply(bts => CreateMsg(bts, isContentRelated: false)).Apply(bts => (bts, msgId));
}
Expand Down

0 comments on commit 3f3e88d

Please sign in to comment.