mirror of
https://github.com/sochix/TLSharp.git
synced 2026-01-02 06:50:00 +01:00
.
This commit is contained in:
parent
acf53742f6
commit
91f837b384
|
|
@ -109,10 +109,10 @@ namespace TLSharp.Core
|
|||
}
|
||||
}
|
||||
|
||||
private async Task RequestWithDcMigration(TLMethod request)
|
||||
private async Task RequestWithDcMigration(TLMethod request)
|
||||
{
|
||||
var completed = false;
|
||||
while(!completed)
|
||||
while (!completed)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -120,7 +120,7 @@ namespace TLSharp.Core
|
|||
await _sender.Receive(request);
|
||||
completed = true;
|
||||
}
|
||||
catch(DataCenterMigrationException e)
|
||||
catch (DataCenterMigrationException e)
|
||||
{
|
||||
await ReconnectToDcAsync(e.DC);
|
||||
// prepare the request for another try
|
||||
|
|
@ -170,8 +170,8 @@ namespace TLSharp.Core
|
|||
throw new ArgumentNullException(nameof(phoneCodeHash));
|
||||
|
||||
if (String.IsNullOrWhiteSpace(code))
|
||||
throw new ArgumentNullException(nameof(code));
|
||||
|
||||
throw new ArgumentNullException(nameof(code));
|
||||
|
||||
var request = new TLRequestSignIn() { PhoneNumber = phoneNumber, PhoneCodeHash = phoneCodeHash, PhoneCode = code };
|
||||
|
||||
await RequestWithDcMigration(request);
|
||||
|
|
@ -179,8 +179,8 @@ namespace TLSharp.Core
|
|||
OnUserAuthenticated(((TLUser)request.Response.User));
|
||||
|
||||
return ((TLUser)request.Response.User);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public async Task<TLPassword> GetPasswordSetting()
|
||||
{
|
||||
var request = new TLRequestGetPassword();
|
||||
|
|
@ -210,8 +210,8 @@ namespace TLSharp.Core
|
|||
|
||||
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);
|
||||
|
||||
OnUserAuthenticated(((TLUser)request.Response.User));
|
||||
|
|
@ -251,7 +251,7 @@ namespace TLSharp.Core
|
|||
});
|
||||
}
|
||||
|
||||
public async Task<TLAbsUpdates> ForwardMessageAsync(TLAbsInputPeer target, int messageId)
|
||||
public async Task<TLAbsUpdates> ForwardMessageAsync(TLAbsInputPeer peerfrom, TLAbsInputPeer peerto, int messageId)
|
||||
{
|
||||
if (!IsUserAuthorized())
|
||||
throw new InvalidOperationException("Authorize user first!");
|
||||
|
|
@ -259,8 +259,10 @@ namespace TLSharp.Core
|
|||
return await SendRequestAsync<TLAbsUpdates>(
|
||||
new TLRequestForwardMessage()
|
||||
{
|
||||
Peer = target,
|
||||
//MessageId = _session.GetNewMessageId(),
|
||||
Id = messageId,
|
||||
Peer = peerfrom,
|
||||
PeerTo = peerto,
|
||||
RandomId = Helpers.GenerateRandomLong()
|
||||
});
|
||||
}
|
||||
|
|
@ -305,7 +307,7 @@ namespace TLSharp.Core
|
|||
Media = new TLInputMediaUploadedDocument()
|
||||
{
|
||||
File = file,
|
||||
Caption = caption,
|
||||
Caption = caption,
|
||||
MimeType = mimeType,
|
||||
Attributes = attributes
|
||||
},
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ namespace TeleSharp.TL.Messages
|
|||
}
|
||||
|
||||
public TLAbsInputPeer Peer { get; set; }
|
||||
public TLAbsInputPeer PeerTo { get; set; }
|
||||
public int Id { get; set; }
|
||||
public long RandomId { get; set; }
|
||||
public TLAbsUpdates Response { get; set; }
|
||||
|
|
|
|||
Loading…
Reference in a new issue