Removed annoying Peer implicit long operator (reverts #229)
Some checks failed
Dev build / build (push) Has been cancelled

This commit is contained in:
Wizou 2025-11-09 22:32:47 +01:00
parent d6fdcab440
commit 30bc536ebc
3 changed files with 6 additions and 7 deletions

View file

@ -589,7 +589,7 @@ namespace WTelegram
{
var msg = new _Message(reader.ReadInt64(), reader.ReadInt32(), null) { bytes = reader.ReadInt32() };
messages.Add(msg);
if ((msg.seq_no & 1) != 0) lock (_msgsToAck) _msgsToAck.Add(msg.msg_id);
if ((msg.seqno & 1) != 0) lock (_msgsToAck) _msgsToAck.Add(msg.msg_id);
var pos = reader.BaseStream.Position;
try
{
@ -602,7 +602,7 @@ namespace WTelegram
else
{
var obj = msg.body = reader.ReadTLObject(ctorNb);
Helpers.Log(1, $" → {obj.GetType().Name,-38} {MsgIdToStamp(msg.msg_id):u} {((msg.seq_no & 1) != 0 ? "" : "(svc)")} {((msg.msg_id & 2) == 0 ? "" : "NAR")}");
Helpers.Log(1, $" → {obj.GetType().Name,-38} {MsgIdToStamp(msg.msg_id):u} {((msg.seqno & 1) != 0 ? "" : "(svc)")} {((msg.msg_id & 2) == 0 ? "" : "NAR")}");
}
}
catch (Exception ex)

View file

@ -148,7 +148,6 @@ namespace TL
{
public abstract long ID { get; }
protected internal abstract IPeerInfo UserOrChat(Dictionary<long, User> users, Dictionary<long, ChatBase> chats);
public static implicit operator long(Peer peer) => peer.ID;
}
partial class PeerUser
{

View file

@ -218,10 +218,10 @@ namespace TL
foreach (var msg in messages)
{
writer.Write(msg.msg_id);
writer.Write(msg.seq_no);
writer.Write(msg.seqno);
var patchPos = writer.BaseStream.Position;
writer.Write(0); // patched below
if ((msg.seq_no & 1) != 0)
if ((msg.seqno & 1) != 0)
WTelegram.Helpers.Log(1, $" → {msg.body.GetType().Name.TrimEnd('_'),-38} #{(short)msg.msg_id.GetHashCode():X4}");
else
WTelegram.Helpers.Log(1, $" → {msg.body.GetType().Name.TrimEnd('_'),-38}");
@ -464,10 +464,10 @@ namespace TL
}
[TLDef(0x5BB8E511)] //message#5bb8e511 msg_id:long seqno:int bytes:int body:Object = Message
public sealed partial class _Message(long msgId, int seqNo, IObject obj) : IObject
public sealed partial class _Message(long msgId, int seqno, IObject obj) : IObject
{
public long msg_id = msgId;
public int seq_no = seqNo;
public int seqno = seqno;
public int bytes;
public IObject body = obj;
}