diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index a26210d..bdfb48f 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -36,9 +36,10 @@ namespace WTelegram var client = await GetClientForDC(-_dcSession.DcID, true); using (stream) { + const long SMALL_FILE_MAX_SIZE = 10 << 20; bool hasLength = stream.CanSeek; long transmitted = 0, length = hasLength ? stream.Length : -1; - bool isBig = !hasLength || length >= 10 * 1024 * 1024; + bool isBig = !hasLength || length > SMALL_FILE_MAX_SIZE; int file_total_parts = hasLength ? (int)((length - 1) / FilePartSize) + 1 : -1; long file_id = Helpers.RandomLong(); int file_part = 0, read; diff --git a/src/Client.cs b/src/Client.cs index 2b302fe..08b6207 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1238,10 +1238,13 @@ namespace WTelegram if (verified is Account_EmailVerifiedLogin verifiedLogin) // (it should always be) sentCodeBase = verifiedLogin.sent_code; } + RaiseUpdates(sentCodeBase); } resent: if (sentCodeBase is Auth_SentCodeSuccess success) authorization = success.authorization; + else if (sentCodeBase is Auth_SentCodePaymentRequired paymentRequired) + throw new WTException("Auth_SentCodePaymentRequired unsupported"); else if (sentCodeBase is Auth_SentCode sentCode) { phone_code_hash = sentCode.phone_code_hash; @@ -1410,7 +1413,7 @@ namespace WTelegram public User LoginAlreadyDone(Auth_AuthorizationBase authorization) { if (authorization is not Auth_Authorization { user: User self }) - throw new WTException("Failed to get Authorization: " + authorization.GetType().Name); + throw new WTException("Failed to get Authorization: " + authorization?.GetType().Name); _session.UserId = _dcSession.UserId = self.id; lock (_session) _session.Save(); RaiseUpdates(self);