mirror of
https://github.com/wiz0u/WTelegramClient.git
synced 2025-12-06 06:52:01 +01:00
Manager: added opportunity to call DropPendingUpdates/StopResync before a resync
This commit is contained in:
parent
9712233c00
commit
8654f99d2b
2
.github/dev.yml
vendored
2
.github/dev.yml
vendored
|
|
@ -1,7 +1,7 @@
|
||||||
pr: none
|
pr: none
|
||||||
trigger: [ master ]
|
trigger: [ master ]
|
||||||
|
|
||||||
name: 4.1.5-dev.$(Rev:r)
|
name: 4.1.6-dev.$(Rev:r)
|
||||||
|
|
||||||
pool:
|
pool:
|
||||||
vmImage: ubuntu-latest
|
vmImage: ubuntu-latest
|
||||||
|
|
|
||||||
|
|
@ -210,6 +210,8 @@ that simplifies the download of a photo/document/file once you get a reference t
|
||||||
|
|
||||||
See [Examples/Program_DownloadSavedMedia.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_DownloadSavedMedia.cs?ts=4#L28) that download all media files you forward to yourself (Saved Messages)
|
See [Examples/Program_DownloadSavedMedia.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_DownloadSavedMedia.cs?ts=4#L28) that download all media files you forward to yourself (Saved Messages)
|
||||||
|
|
||||||
|
_Note: To abort an ongoing download, you can throw an exception via the `progress` callback argument._
|
||||||
|
|
||||||
<a name="upload"></a>
|
<a name="upload"></a>
|
||||||
## Upload a media file and post it with caption to a chat
|
## Upload a media file and post it with caption to a chat
|
||||||
```csharp
|
```csharp
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,7 @@ namespace WTelegram
|
||||||
goto newSession;
|
goto newSession;
|
||||||
case NewSessionCreated when _client.User != null:
|
case NewSessionCreated when _client.User != null:
|
||||||
newSession:
|
newSession:
|
||||||
|
await Task.Delay(HalfSec); // let the opportunity to call DropPendingUpdates/StopResync before a big resync
|
||||||
if (_local[L_PTS].pts != 0) await ResyncState();
|
if (_local[L_PTS].pts != 0) await ResyncState();
|
||||||
else await ResyncState(await _client.Updates_GetState());
|
else await ResyncState(await _client.Updates_GetState());
|
||||||
break;
|
break;
|
||||||
|
|
@ -282,6 +283,18 @@ namespace WTelegram
|
||||||
finally { _sem.Release(); }
|
finally { _sem.Release(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task StopResync()
|
||||||
|
{
|
||||||
|
await _sem.WaitAsync();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach (var local in _local.Values)
|
||||||
|
local.pts = 0;
|
||||||
|
_pending.Clear();
|
||||||
|
}
|
||||||
|
finally { _sem.Release(); }
|
||||||
|
}
|
||||||
|
|
||||||
private async Task<InputChannel> GetInputChannel(long channel_id, MBoxState local)
|
private async Task<InputChannel> GetInputChannel(long channel_id, MBoxState local)
|
||||||
{
|
{
|
||||||
if (channel_id <= 0) return null;
|
if (channel_id <= 0) return null;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue