GetUserDialogsAsync() has new parameter offset so that when a dialogsSlice is received, the continuation can be asked for.

This commit is contained in:
Paulo Rogerio Panhoto 2018-03-12 17:59:42 -03:00
parent 8180ee94f0
commit 6836e563ad

View file

@ -1,102 +1,102 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using TeleSharp.TL; using TeleSharp.TL;
using TeleSharp.TL.Account; using TeleSharp.TL.Account;
using TeleSharp.TL.Auth; using TeleSharp.TL.Auth;
using TeleSharp.TL.Contacts; using TeleSharp.TL.Contacts;
using TeleSharp.TL.Help; using TeleSharp.TL.Help;
using TeleSharp.TL.Messages; using TeleSharp.TL.Messages;
using TeleSharp.TL.Upload; using TeleSharp.TL.Upload;
using TLSharp.Core.Auth; using TLSharp.Core.Auth;
using TLSharp.Core.MTProto.Crypto; using TLSharp.Core.MTProto.Crypto;
using TLSharp.Core.Network; using TLSharp.Core.Network;
using TLSharp.Core.Utils; using TLSharp.Core.Utils;
using TLAuthorization = TeleSharp.TL.Auth.TLAuthorization; using TLAuthorization = TeleSharp.TL.Auth.TLAuthorization;
namespace TLSharp.Core namespace TLSharp.Core
{ {
public class TelegramClient : IDisposable public class TelegramClient : IDisposable
{ {
internal static NLog.Logger logger = NLog.LogManager.GetLogger("TelegramClient"); internal static NLog.Logger logger = NLog.LogManager.GetLogger("TelegramClient");
private MtProtoSender _sender; private MtProtoSender _sender;
private AuthKey _key; private AuthKey _key;
private TcpTransport _transport; private TcpTransport _transport;
private string _apiHash = ""; private string _apiHash = "";
private int _apiId = 0; private int _apiId = 0;
private Session _session; private Session _session;
private List<TLDcOption> dcOptions; private List<TLDcOption> dcOptions;
private TcpClientConnectionHandler _handler; private TcpClientConnectionHandler _handler;
private bool _looping = true; private bool _looping = true;
public delegate void UpdatesEvent (TelegramClient source, TLAbsUpdates updates); public delegate void UpdatesEvent (TelegramClient source, TLAbsUpdates updates);
public delegate void ClientEvent(TelegramClient source); public delegate void ClientEvent(TelegramClient source);
public event UpdatesEvent Updates; public event UpdatesEvent Updates;
public event ClientEvent ScheduledTasks; public event ClientEvent ScheduledTasks;
public event ClientEvent IdleTasks; public event ClientEvent IdleTasks;
public Session Session { get { return _session; } } public Session Session { get { return _session; } }
public volatile bool AllowEvents = false; public volatile bool AllowEvents = false;
public TelegramClient(int apiId, string apiHash, public TelegramClient(int apiId, string apiHash,
Session session = null, string sessionUserId = "session", TcpClientConnectionHandler handler = null) Session session = null, string sessionUserId = "session", TcpClientConnectionHandler handler = null)
{ {
if (apiId == default(int)) if (apiId == default(int))
throw new MissingApiConfigurationException("API_ID"); throw new MissingApiConfigurationException("API_ID");
if (string.IsNullOrEmpty(apiHash)) if (string.IsNullOrEmpty(apiHash))
throw new MissingApiConfigurationException("API_HASH"); throw new MissingApiConfigurationException("API_HASH");
TLContext.Init(); TLContext.Init();
_apiHash = apiHash; _apiHash = apiHash;
_apiId = apiId; _apiId = apiId;
_handler = handler; _handler = handler;
_session = Session.GetSession(session?.Store ?? new FileSessionStore(), session?.SessionUserId ?? sessionUserId, session); _session = Session.GetSession(session?.Store ?? new FileSessionStore(), session?.SessionUserId ?? sessionUserId, session);
_transport = new TcpTransport(_session.ServerAddress, _session.Port, _handler); _transport = new TcpTransport(_session.ServerAddress, _session.Port, _handler);
} }
public async Task<bool> ConnectAsync(bool reconnect = false) public async Task<bool> ConnectAsync(bool reconnect = false)
{ {
if (_session.AuthKey == null || reconnect) if (_session.AuthKey == null || reconnect)
{ {
var result = await Authenticator.DoAuthentication(_transport); var result = await Authenticator.DoAuthentication(_transport);
_session.AuthKey = result.AuthKey; _session.AuthKey = result.AuthKey;
_session.TimeOffset = result.TimeOffset; _session.TimeOffset = result.TimeOffset;
} }
_sender = new MtProtoSender(_transport, _session); _sender = new MtProtoSender(_transport, _session);
_sender.UpdatesEvent += _sender_UpdatesEvent; _sender.UpdatesEvent += _sender_UpdatesEvent;
//set-up layer //set-up layer
var config = new TLRequestGetConfig(); var config = new TLRequestGetConfig();
var request = new TLRequestInitConnection() var request = new TLRequestInitConnection()
{ {
ApiId = _apiId, ApiId = _apiId,
AppVersion = "1.0.0", AppVersion = "1.0.0",
DeviceModel = "PC", DeviceModel = "PC",
LangCode = "en", LangCode = "en",
Query = config, Query = config,
SystemVersion = "Win 10.0" SystemVersion = "Win 10.0"
}; };
var invokewithLayer = new TLRequestInvokeWithLayer() { Layer = 66, Query = request }; var invokewithLayer = new TLRequestInvokeWithLayer() { Layer = 66, Query = request };
await _sender.Send(invokewithLayer); await _sender.Send(invokewithLayer);
await _sender.Receive(invokewithLayer); await _sender.Receive(invokewithLayer);
dcOptions = ((TLConfig)invokewithLayer.Response).DcOptions.ToList(); dcOptions = ((TLConfig)invokewithLayer.Response).DcOptions.ToList();
return true; return true;
} }
private async Task ReconnectToDcAsync(int dcId) private async Task ReconnectToDcAsync(int dcId)
{ {
if (dcOptions == null || !dcOptions.Any()) if (dcOptions == null || !dcOptions.Any())
throw new InvalidOperationException($"Can't reconnect. Establish initial connection first."); throw new InvalidOperationException($"Can't reconnect. Establish initial connection first.");
TLExportedAuthorization exported = null; TLExportedAuthorization exported = null;
if (_session.TLUser != null) if (_session.TLUser != null)
@ -104,13 +104,13 @@ namespace TLSharp.Core
TLRequestExportAuthorization exportAuthorization = new TLRequestExportAuthorization() { DcId = dcId }; TLRequestExportAuthorization exportAuthorization = new TLRequestExportAuthorization() { DcId = dcId };
exported = await SendRequestAsync<TLExportedAuthorization>(exportAuthorization); exported = await SendRequestAsync<TLExportedAuthorization>(exportAuthorization);
} }
var dc = dcOptions.First(d => d.Id == dcId); var dc = dcOptions.First(d => d.Id == dcId);
_transport = new TcpTransport(dc.IpAddress, dc.Port, _handler); _transport = new TcpTransport(dc.IpAddress, dc.Port, _handler);
_session.ServerAddress = dc.IpAddress; _session.ServerAddress = dc.IpAddress;
_session.Port = dc.Port; _session.Port = dc.Port;
await ConnectAsync(true); await ConnectAsync(true);
if (_session.TLUser != null) if (_session.TLUser != null)
@ -118,264 +118,264 @@ namespace TLSharp.Core
TLRequestImportAuthorization importAuthorization = new TLRequestImportAuthorization() { Id = exported.Id, Bytes = exported.Bytes }; TLRequestImportAuthorization importAuthorization = new TLRequestImportAuthorization() { Id = exported.Id, Bytes = exported.Bytes };
var imported = await SendRequestAsync<TLAuthorization>(importAuthorization); var imported = await SendRequestAsync<TLAuthorization>(importAuthorization);
OnUserAuthenticated(((TLUser)imported.User)); OnUserAuthenticated(((TLUser)imported.User));
} }
} }
public void Close() public void Close()
{
_looping = false;
}
public async Task MainLoopAsync(int timeslicems)
{ {
logger.Trace("Entered loop"); _looping = false;
var lastPing = DateTime.UtcNow; }
await SendPingAsync();
while (_looping) public async Task MainLoopAsync(int timeslicems)
{ {
try logger.Trace("Entered loop");
var lastPing = DateTime.UtcNow;
await SendPingAsync();
while (_looping)
{
try
{ {
await WaitEventAsync(timeslicems); await WaitEventAsync(timeslicems);
} catch (OperationCanceledException) } catch (OperationCanceledException)
{ {
logger.Trace("Timeout"); logger.Trace("Timeout");
} }
finally finally
{ {
var now = DateTime.UtcNow; var now = DateTime.UtcNow;
if ((now - lastPing).TotalSeconds >= 30) if ((now - lastPing).TotalSeconds >= 30)
{ {
await SendPingAsync(); await SendPingAsync();
lastPing = now; lastPing = now;
} }
if (ScheduledTasks != null) if (ScheduledTasks != null)
{ {
logger.Trace("Running idle tasks"); logger.Trace("Running idle tasks");
ScheduledTasks.Invoke(this); ScheduledTasks.Invoke(this);
ScheduledTasks = null; ScheduledTasks = null;
} }
IdleTasks?.Invoke(this); IdleTasks?.Invoke(this);
} }
} }
} }
private void _sender_UpdatesEvent (TLAbsUpdates updates) private void _sender_UpdatesEvent (TLAbsUpdates updates)
{ {
if (AllowEvents && Updates != null) if (AllowEvents && Updates != null)
Updates(this, updates); Updates(this, updates);
} }
private async Task RequestWithDcMigration(TLMethod request) private async Task RequestWithDcMigration(TLMethod request)
{ {
var completed = false; var completed = false;
while(!completed) while(!completed)
{ {
try try
{ {
await _sender.Send(request); await _sender.Send(request);
await _sender.Receive(request); await _sender.Receive(request);
completed = true; completed = true;
} }
catch(DataCenterMigrationException e) catch(DataCenterMigrationException e)
{ {
await ReconnectToDcAsync(e.DC); await ReconnectToDcAsync(e.DC);
// prepare the request for another try // prepare the request for another try
request.ConfirmReceived = false; request.ConfirmReceived = false;
} }
} }
} }
public async Task WaitEventAsync(int timeoutms) public async Task WaitEventAsync(int timeoutms)
{ {
await _sender.Receive (timeoutms); await _sender.Receive (timeoutms);
} }
public bool IsUserAuthorized() public bool IsUserAuthorized()
{ {
return _session.TLUser != null; return _session.TLUser != null;
} }
public async Task<bool> IsPhoneRegisteredAsync(string phoneNumber) public async Task<bool> IsPhoneRegisteredAsync(string phoneNumber)
{ {
if (String.IsNullOrWhiteSpace(phoneNumber)) if (String.IsNullOrWhiteSpace(phoneNumber))
throw new ArgumentNullException(nameof(phoneNumber)); throw new ArgumentNullException(nameof(phoneNumber));
if (_sender == null) if (_sender == null)
throw new InvalidOperationException("Not connected!"); throw new InvalidOperationException("Not connected!");
var authCheckPhoneRequest = new TLRequestCheckPhone() { PhoneNumber = phoneNumber }; var authCheckPhoneRequest = new TLRequestCheckPhone() { PhoneNumber = phoneNumber };
await RequestWithDcMigration(authCheckPhoneRequest); await RequestWithDcMigration(authCheckPhoneRequest);
return authCheckPhoneRequest.Response.PhoneRegistered; return authCheckPhoneRequest.Response.PhoneRegistered;
} }
public async Task<string> SendCodeRequestAsync(string phoneNumber) public async Task<string> SendCodeRequestAsync(string phoneNumber)
{ {
if (String.IsNullOrWhiteSpace(phoneNumber)) if (String.IsNullOrWhiteSpace(phoneNumber))
throw new ArgumentNullException(nameof(phoneNumber)); throw new ArgumentNullException(nameof(phoneNumber));
var request = new TLRequestSendCode() { PhoneNumber = phoneNumber, ApiId = _apiId, ApiHash = _apiHash }; var request = new TLRequestSendCode() { PhoneNumber = phoneNumber, ApiId = _apiId, ApiHash = _apiHash };
await RequestWithDcMigration(request); await RequestWithDcMigration(request);
return request.Response.PhoneCodeHash; return request.Response.PhoneCodeHash;
} }
public async Task<TLUser> MakeAuthAsync(string phoneNumber, string phoneCodeHash, string code) public async Task<TLUser> MakeAuthAsync(string phoneNumber, string phoneCodeHash, string code)
{ {
if (String.IsNullOrWhiteSpace(phoneNumber)) if (String.IsNullOrWhiteSpace(phoneNumber))
throw new ArgumentNullException(nameof(phoneNumber)); throw new ArgumentNullException(nameof(phoneNumber));
if (String.IsNullOrWhiteSpace(phoneCodeHash)) if (String.IsNullOrWhiteSpace(phoneCodeHash))
throw new ArgumentNullException(nameof(phoneCodeHash)); throw new ArgumentNullException(nameof(phoneCodeHash));
if (String.IsNullOrWhiteSpace(code)) if (String.IsNullOrWhiteSpace(code))
throw new ArgumentNullException(nameof(code)); throw new ArgumentNullException(nameof(code));
var request = new TLRequestSignIn() { PhoneNumber = phoneNumber, PhoneCodeHash = phoneCodeHash, PhoneCode = code }; var request = new TLRequestSignIn() { PhoneNumber = phoneNumber, PhoneCodeHash = phoneCodeHash, PhoneCode = code };
await RequestWithDcMigration(request); await RequestWithDcMigration(request);
OnUserAuthenticated(((TLUser)request.Response.User)); OnUserAuthenticated(((TLUser)request.Response.User));
return ((TLUser)request.Response.User); return ((TLUser)request.Response.User);
} }
public async Task<TLPassword> GetPasswordSetting() public async Task<TLPassword> GetPasswordSetting()
{ {
var request = new TLRequestGetPassword(); var request = new TLRequestGetPassword();
await RequestWithDcMigration(request); await RequestWithDcMigration(request);
return ((TLPassword)request.Response); return ((TLPassword)request.Response);
} }
public async Task<TLUser> MakeAuthWithPasswordAsync(TLPassword password, string password_str) public async Task<TLUser> MakeAuthWithPasswordAsync(TLPassword password, string password_str)
{ {
byte[] password_Bytes = Encoding.UTF8.GetBytes(password_str); byte[] password_Bytes = Encoding.UTF8.GetBytes(password_str);
IEnumerable<byte> rv = password.CurrentSalt.Concat(password_Bytes).Concat(password.CurrentSalt); IEnumerable<byte> rv = password.CurrentSalt.Concat(password_Bytes).Concat(password.CurrentSalt);
SHA256Managed hashstring = new SHA256Managed(); SHA256Managed hashstring = new SHA256Managed();
var password_hash = hashstring.ComputeHash(rv.ToArray()); var password_hash = hashstring.ComputeHash(rv.ToArray());
var request = new TLRequestCheckPassword() { PasswordHash = password_hash }; var request = new TLRequestCheckPassword() { PasswordHash = password_hash };
await RequestWithDcMigration(request); await RequestWithDcMigration(request);
OnUserAuthenticated(((TLUser)request.Response.User)); OnUserAuthenticated(((TLUser)request.Response.User));
return ((TLUser)request.Response.User); return ((TLUser)request.Response.User);
} }
public async Task<TLUser> SignUpAsync(string phoneNumber, string phoneCodeHash, string code, string firstName, string lastName) public async Task<TLUser> SignUpAsync(string phoneNumber, string phoneCodeHash, string code, string firstName, string lastName)
{ {
var request = new TLRequestSignUp() { PhoneNumber = phoneNumber, PhoneCode = code, PhoneCodeHash = phoneCodeHash, FirstName = firstName, LastName = lastName }; var request = new TLRequestSignUp() { PhoneNumber = phoneNumber, PhoneCode = code, PhoneCodeHash = phoneCodeHash, FirstName = firstName, LastName = lastName };
await RequestWithDcMigration(request); await RequestWithDcMigration(request);
OnUserAuthenticated(((TLUser)request.Response.User)); OnUserAuthenticated(((TLUser)request.Response.User));
return ((TLUser)request.Response.User); return ((TLUser)request.Response.User);
} }
public async Task<T> SendRequestAsync<T>(TLMethod methodToExecute) public async Task<T> SendRequestAsync<T>(TLMethod methodToExecute)
{ {
logger.Info("Sending Request: {0} {1:x8}", methodToExecute, methodToExecute.Constructor); logger.Info("Sending Request: {0} {1:x8}", methodToExecute, methodToExecute.Constructor);
await RequestWithDcMigration(methodToExecute); await RequestWithDcMigration(methodToExecute);
var result = methodToExecute.GetType().GetProperty("Response").GetValue(methodToExecute); var result = methodToExecute.GetType().GetProperty("Response").GetValue(methodToExecute);
return (T)result; return (T)result;
} }
public async Task<TLContacts> GetContactsAsync() public async Task<TLContacts> GetContactsAsync()
{ {
if (!IsUserAuthorized()) if (!IsUserAuthorized())
throw new InvalidOperationException("Authorize user first!"); throw new InvalidOperationException("Authorize user first!");
var req = new TLRequestGetContacts() { Hash = "" }; var req = new TLRequestGetContacts() { Hash = "" };
return await SendRequestAsync<TLContacts>(req); return await SendRequestAsync<TLContacts>(req);
} }
public async Task<TLAbsUpdates> SendMessageAsync(TLAbsInputPeer peer, string message) public async Task<TLAbsUpdates> SendMessageAsync(TLAbsInputPeer peer, string message)
{ {
if (!IsUserAuthorized()) if (!IsUserAuthorized())
throw new InvalidOperationException("Authorize user first!"); throw new InvalidOperationException("Authorize user first!");
return await SendRequestAsync<TLAbsUpdates>( return await SendRequestAsync<TLAbsUpdates>(
new TLRequestSendMessage() new TLRequestSendMessage()
{ {
Peer = peer, Peer = peer,
Message = message, Message = message,
RandomId = Helpers.GenerateRandomLong() RandomId = Helpers.GenerateRandomLong()
}); });
} }
public async Task<Boolean> SendTypingAsync(TLAbsInputPeer peer) public async Task<Boolean> SendTypingAsync(TLAbsInputPeer peer)
{ {
var req = new TLRequestSetTyping() var req = new TLRequestSetTyping()
{ {
Action = new TLSendMessageTypingAction(), Action = new TLSendMessageTypingAction(),
Peer = peer Peer = peer
}; };
return await SendRequestAsync<Boolean>(req); return await SendRequestAsync<Boolean>(req);
} }
public async Task<TLAbsDialogs> GetUserDialogsAsync() public async Task<TLAbsDialogs> GetUserDialogsAsync(int offset = 0)
{ {
var peer = new TLInputPeerSelf(); var peer = new TLInputPeerSelf();
return await SendRequestAsync<TLAbsDialogs>( return await SendRequestAsync<TLAbsDialogs>(
new TLRequestGetDialogs() { OffsetDate = 0, OffsetPeer = peer, Limit = 100 }); new TLRequestGetDialogs() { OffsetDate = offset, OffsetPeer = peer, Limit = 100 });
} }
public async Task<TLAbsUpdates> SendUploadedPhoto(TLAbsInputPeer peer, TLAbsInputFile file, string caption) public async Task<TLAbsUpdates> SendUploadedPhoto(TLAbsInputPeer peer, TLAbsInputFile file, string caption)
{ {
return await SendRequestAsync<TLAbsUpdates>(new TLRequestSendMedia() return await SendRequestAsync<TLAbsUpdates>(new TLRequestSendMedia()
{ {
RandomId = Helpers.GenerateRandomLong(), RandomId = Helpers.GenerateRandomLong(),
Background = false, Background = false,
ClearDraft = false, ClearDraft = false,
Media = new TLInputMediaUploadedPhoto() { File = file, Caption = caption }, Media = new TLInputMediaUploadedPhoto() { File = file, Caption = caption },
Peer = peer Peer = peer
}); });
} }
public async Task<TLAbsUpdates> SendUploadedDocument( public async Task<TLAbsUpdates> SendUploadedDocument(
TLAbsInputPeer peer, TLAbsInputFile file, string caption, string mimeType, TLVector<TLAbsDocumentAttribute> attributes) TLAbsInputPeer peer, TLAbsInputFile file, string caption, string mimeType, TLVector<TLAbsDocumentAttribute> attributes)
{ {
return await SendRequestAsync<TLAbsUpdates>(new TLRequestSendMedia() return await SendRequestAsync<TLAbsUpdates>(new TLRequestSendMedia()
{ {
RandomId = Helpers.GenerateRandomLong(), RandomId = Helpers.GenerateRandomLong(),
Background = false, Background = false,
ClearDraft = false, ClearDraft = false,
Media = new TLInputMediaUploadedDocument() Media = new TLInputMediaUploadedDocument()
{ {
File = file, File = file,
Caption = caption, Caption = caption,
MimeType = mimeType, MimeType = mimeType,
Attributes = attributes Attributes = attributes
}, },
Peer = peer Peer = peer
}); });
} }
public async Task<TLFile> GetFile(TLAbsInputFileLocation location, int filePartSize, int offset = 0) public async Task<TLFile> GetFile(TLAbsInputFileLocation location, int filePartSize, int offset = 0)
{ {
TLFile result = null; TLFile result = null;
result = await SendRequestAsync<TLFile>(new TLRequestGetFile() result = await SendRequestAsync<TLFile>(new TLRequestGetFile()
{ {
Location = location, Location = location,
Limit = filePartSize, Limit = filePartSize,
Offset = offset Offset = offset
}); });
return result; return result;
} }
public async Task SendPingAsync() public async Task SendPingAsync()
{ {
await _sender.SendPingAsync(); await _sender.SendPingAsync();
} }
public async Task<TLAbsMessages> GetHistoryAsync(TLAbsInputPeer peer, int offset, int max_id, int limit) public async Task<TLAbsMessages> GetHistoryAsync(TLAbsInputPeer peer, int offset, int max_id, int limit)
@ -391,31 +391,31 @@ namespace TLSharp.Core
Limit = limit Limit = limit
}; };
return await SendRequestAsync<TLAbsMessages>(req); return await SendRequestAsync<TLAbsMessages>(req);
} }
/// <summary> /// <summary>
/// Serch user or chat. API: contacts.search#11f812d8 q:string limit:int = contacts.Found; /// Serch user or chat. API: contacts.search#11f812d8 q:string limit:int = contacts.Found;
/// </summary> /// </summary>
/// <param name="q">User or chat name</param> /// <param name="q">User or chat name</param>
/// <param name="limit">Max result count</param> /// <param name="limit">Max result count</param>
/// <returns></returns> /// <returns></returns>
public async Task<TLFound> SearchUserAsync(string q, int limit = 10) public async Task<TLFound> SearchUserAsync(string q, int limit = 10)
{ {
var r = new TeleSharp.TL.Contacts.TLRequestSearch var r = new TeleSharp.TL.Contacts.TLRequestSearch
{ {
Q = q, Q = q,
Limit = limit Limit = limit
}; };
return await SendRequestAsync<TLFound>(r); return await SendRequestAsync<TLFound>(r);
} }
private void OnUserAuthenticated(TLUser TLUser) private void OnUserAuthenticated(TLUser TLUser)
{ {
_session.TLUser = TLUser; _session.TLUser = TLUser;
_session.SessionExpires = int.MaxValue; _session.SessionExpires = int.MaxValue;
_session.Save(); _session.Save();
} }
public bool IsConnected public bool IsConnected
@ -426,34 +426,34 @@ namespace TLSharp.Core
return false; return false;
return _transport.IsConnected; return _transport.IsConnected;
} }
} }
public void Dispose() public void Dispose()
{ {
if (_transport != null) if (_transport != null)
{ {
_transport.Dispose(); _transport.Dispose();
_transport = null; _transport = null;
} }
} }
} }
public class MissingApiConfigurationException : Exception public class MissingApiConfigurationException : Exception
{ {
public const string InfoUrl = "https://github.com/sochix/TLSharp#quick-configuration"; public const string InfoUrl = "https://github.com/sochix/TLSharp#quick-configuration";
internal MissingApiConfigurationException(string invalidParamName) : internal MissingApiConfigurationException(string invalidParamName) :
base($"Your {invalidParamName} setting is missing. Adjust the configuration first, see {InfoUrl}") base($"Your {invalidParamName} setting is missing. Adjust the configuration first, see {InfoUrl}")
{ {
} }
} }
public class InvalidPhoneCodeException : Exception public class InvalidPhoneCodeException : Exception
{ {
internal InvalidPhoneCodeException(string msg) : base(msg) { } internal InvalidPhoneCodeException(string msg) : base(msg) { }
} }
public class CloudPasswordNeededException : Exception public class CloudPasswordNeededException : Exception
{ {
internal CloudPasswordNeededException(string msg) : base(msg) { } internal CloudPasswordNeededException(string msg) : base(msg) { }
} }
} }