diff --git a/src/Client.cs b/src/Client.cs index 0635949..d7b39bd 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -20,7 +20,7 @@ using static WTelegram.Encryption; namespace WTelegram { - public sealed class Client : IDisposable + public class Client : IDisposable { /// This event will be called when an unsollicited update/message is sent by Telegram servers /// See Examples/Program_ListenUpdate.cs for how to use this @@ -143,6 +143,7 @@ namespace WTelegram { Helpers.Log(2, $"{_dcSession.DcID}>Disposing the client"); Reset(false, IsMainDC); + GC.SuppressFinalize(this); } /// Disconnect from Telegram (shouldn't be needed in normal usage) @@ -994,7 +995,7 @@ namespace WTelegram var users = await this.Users_GetUsers(new[] { InputUser.Self }); // this calls also reenable incoming Updates var self = users[0] as User; // check user_id or phone_number match currently logged-in user - if ((int.TryParse(_config("user_id"), out int id) && (id == -1 || self.id == id)) || + if ((long.TryParse(_config("user_id"), out long id) && (id == -1 || self.id == id)) || self.phone == string.Concat((phone_number = Config("phone_number")).Where(char.IsDigit))) { _session.UserId = _dcSession.UserId = self.id; @@ -1021,6 +1022,7 @@ namespace WTelegram } Helpers.Log(3, $"A verification code has been sent via {sentCode.type.GetType().Name[17..]}"); Auth_AuthorizationBase authorization = null; + //TODO: implement auth.resendCode logic for (int retry = 1; authorization == null; retry++) try {