Commit graph

285 commits

Author SHA1 Message Date
Solarin81 28951d6952
Merge 27d680f526 into dab442f45b 2021-12-06 11:50:06 +05:00
Ilia Pirozhenko dab442f45b
Update README.md 2021-12-05 18:14:06 +03:00
Ilia Pirozhenko f003a879c0
Update README.md 2021-12-02 13:19:07 +03:00
Andres G. Aragoneses 1b06473108 Core: save session as soon as a the sequence is incremented
Just be safe, let's not wait until other part of the code saves the
session, and let's do it right here on the spot, where we know it
changes.

@Laituex was having a ErrCode=32 'msg_seqno too low' problem and this
is the second thing we suspected to be the culprit, because if there's
any issue (e.g. exception) that makes the session not be saved after
the sequence got incremented, then an old sequence would be used the
next time upon loading an old session file.
2020-09-21 14:56:11 +08:00
Andres G. Aragoneses 881bdd27a5 Core: make MtProtoSender.GenerateSequence() thread-safe
Even if you're not supposed to use multiple threads with TLSharp,
it might be worth it to try to make this sequence increment in
a thread-safe way. Race conditions are always bad even if you know
you are not supposed to use something in a certain way...

@Laituex was having a ErrCode=32 'msg_seqno too low' problem and this
is the first thing we looked at (even if he swore that he was not
using different threads to access the telegram network)
2020-09-21 14:52:07 +08:00
Andres G. Aragoneses a79362ea24 README.md: update 2020-09-18 16:38:21 +08:00
Andres G. Aragoneses bca8bc5631 Generator: default to a schema filename in line to online resource
The schema is in https://core.telegram.org/schema/json so it's more
logical to expect the file to be named `json`, which is what would
happen if you download it with wget, for example.
2020-04-12 17:58:56 +08:00
solarin 9a6e391cae Core: don't consider MediaOnly DCs at reconnect
Fixes https://github.com/sochix/TLSharp/issues/935
2020-04-12 01:52:25 +08:00
Andres G. Aragoneses 34c5a106df README.md: tiny nit just to push out new nuget build
I just realised that pushing to branches also pushes to nuget, so
I should stop doing that.
2020-04-10 15:53:27 +08:00
Andres G. Aragoneses b961897062 README.md: update about layer number 2020-04-10 15:12:46 +08:00
Andres G. Aragoneses 7fb4a0f8a7 README.md: expand on FLOOD_WAIT error
Thanks to some inspiration by this comment:
https://github.com/sochix/TLSharp/issues/474#issuecomment-611422648
2020-04-10 15:12:46 +08:00
solarin 27d680f526 remove unnecessary list usage 2020-04-06 11:15:43 +04:00
solarin ce93c766c4 ! fixed conflicts
+ eol
2020-04-06 10:49:19 +04:00
solarin 9623f9d5ac Revert "+ overload for method InviteToChannel"
This reverts commit 45be5f51d3.
2020-04-06 10:45:40 +04:00
solarin 45be5f51d3 + overload for method InviteToChannel
! filter wasn't actually used
! renamed the ParticipantTypes -> ParticipantFilterTypes
2020-04-06 10:22:41 +04:00
solarin c67801a6c9
Added an IPv4/IPv6 toggle to TelegramClient constructor (#925)
Fixes https://github.com/sochix/TLSharp/issues/857
2020-04-05 23:22:36 +08:00
solarin 7dedf2a28a + InviteToChannel
! Added token to the parameters of async methods
! Typos and comments
2020-04-05 17:30:15 +04:00
solarin c28a41c03f removed unnecessary file 2020-04-05 16:00:25 +04:00
solarin 3721e8cfee added methods to get the participants of a group/channel 2020-04-05 15:50:09 +04:00
solarin 65ff8ccbc1 2020-04-05 15:42:48 +04:00
Afshin Arani 6d2c77f5ef Remove unnecessary dependencies 2020-04-05 19:33:18 +08:00
Afshin Arani 709e5be7cc Upgrade from .NET4.5 to .NET4.6
Because we might use dependencies soon that require this framework.
And anyway these days the .NET world is mostly a hybrid between
.NETStandard/.NETCore libs and .NET4.6 ones, not older than that.
2020-04-05 03:11:45 +08:00
Andres G. Aragoneses 6b35857923 nuspec: fix warning
WARNING: NU5118: File 'D:\a\TLSharp\TLSharp\TLSharp.Core\bin\Debug\TLSharp.Core.dll' is not added because the package already contains file 'lib\net45\TLSharp.Core.dll'
2020-04-05 02:55:48 +08:00
solarin 00fb3ae500 removed the previously added changed not pertinent to this PR 2020-04-03 20:31:44 +04:00
Andres G. Aragoneses 2d4aa3e8f9 style: more consistent naming removing underscores
There were less places with underscores in field names than
places without them, so we now are consistent with the most
abundant occurrence.
2020-04-03 20:31:24 +04:00
solarin 54781b235f + GetFullChat to get the info of a chat
+ GetAllChats to get all available user's chats
+ MakeAuthBotAsync to authenticate a bot instead of a user
2020-04-03 17:57:48 +04:00
solarin 406a73b89c fixed typos and spaces 2020-04-03 17:55:21 +04:00
solarin 92ca5a9ac1 + GetFullChat to get the info of a chat
+ GetAllChats to get all available user's chats
+ MakeAuthBotAsync to authenticate a bot instead of a user
2020-04-03 17:35:18 +04:00
solarin e067688a48 tabs-> 4 spaces
added the csproj
2020-04-03 17:15:53 +04:00
solarin 80d16fe4a4 Added an IPv4/IPv6 toggle to TelegramClient constructor 2020-04-03 17:05:06 +04:00
Andres G. Aragoneses 08f3b08277 README.md: fix CI badge
Otherwise if there's a PR whose build is failing, it would show
a red badge here (but we only care about master branch).

Spotted & fix by @aarani
2020-04-03 19:56:12 +08:00
Afshin Arani f8b35dab61
GithubActions Workflow for crossplatform CI (#921)
AppVeyor only has Windows support on the free tier
2020-04-02 15:10:27 +08:00
emRzed 43f16e879e
Fix InvalidCastException in TLRequestGetStickerSet (#905)
When trying to SendRequest it was throwing an exception saying "cannot cast object of type TeleSharp.TL.TLStickerSet to TeleSharp.TL.Messages.TLStickerSet" 

Fixes https://github.com/sochix/TLSharp/issues/826
2020-02-03 14:57:57 +08:00
Andres G. Aragoneses 90f9305dd6 style: more consistent naming removing underscores
There were less places with underscores in field names than
places without them, so we now are consistent with the most
abundant occurrence.
2020-01-31 14:39:19 +08:00
Andres G. Aragoneses c031fa4f6d
Merge pull request #903 from CheshireCaat/pr-branch
Improvements for async methods
2020-01-28 15:12:26 +08:00
CheshireCaat c5a2c816fc Improvements for async methods
Added CancellationToken with default value to all async methods in TLSharp.Core
Added ConfigureAwait(false) to all async methods in TLSharp.Core
SendRequestAsync replaced to SendAuthenticatedRequestAsync in methods that need auth
Private modifier in SendAuthenticatedRequestAsync changed to internal

Based on PR created by @IaRuslan
2020-01-28 10:10:49 +03:00
Andres G. Aragoneses 1ccafe22a3
Merge pull request #901 from CheshireCaat/pr-sub
Code refactoring
2020-01-27 13:34:43 +08:00
CheshireCaat bdbaf76481 DataCenter refactoring
Remove unused private setter for properties
2020-01-26 21:29:41 +03:00
CheshireCaat d42a367cf4 TeleSharp.Generator refactoring
Fix naming for models properties (Use JsonProperty instead)
Move models to separate folder
Rename models

Remove unused references in Program.cs
Use string instead of String
2020-01-26 21:29:40 +03:00
CheshireCaat 79cf25d257 Reformat MTProto.Serializers
Fix naming for string serializer
Fix naming for bytes serializer
Remove unused method - VectorToString
2020-01-26 02:12:43 +03:00
Andres G. Aragoneses dc8c20df63 Core: avoid some code repetition 2020-01-25 16:16:14 +08:00
CheshireCaat 7230b9b509 Requests refactoring (#900)
* Remove unused requests.
* Move PingRequest and AckRequest to TLSharp.Core.Network.Requests.
2020-01-25 13:04:50 +08:00
CheshireCaat 8729b7d85b Exceptions moved to separate folders (#899)
Exceptions from MtProtoSender.cs to TLSharp.Core/Network/Exceptions
Exceptions from TelegramClient.cs to TLSharp.Core/Exceptions
2020-01-25 02:28:37 +08:00
CheshireCaat 0a91487ea7 Add methods for working with usernames. (#897)
Added methods for working with usernames:

Check username (Validates a username and checks availability)
Update username (Changes username for the current user)
2020-01-23 15:11:24 +08:00
CheshireCaat c9ac0bab87 Add methods for working with contacts. (#896)
Added methods for working with contacts:

* Import contact list
* Delete contact list
* Delete one contact
2020-01-23 12:02:19 +08:00
dependabot[bot] 3c6f53be68 Bump DotNetZip from 1.9.3 to 1.11.0 in /TLSharp.Core (#885)
Bumps [DotNetZip](https://github.com/haf/DotNetZip.Semverd) from 1.9.3 to 1.11.0.
- [Release notes](https://github.com/haf/DotNetZip.Semverd/releases)
- [Commits](https://github.com/haf/DotNetZip.Semverd/commits)

(Security vulnerabilities happening in older versions than 1.11.0: https://snyk.io/vuln/nuget:dotnetzip )

Signed-off-by: dependabot[bot] <support@github.com>
2019-10-30 10:31:26 +08:00
Andres G. Aragoneses e4d0e97571 Add ability to set directory to store sessions
Now user can set directory to store sessions somewhere else
other than the folder where the program's executable is.

(Based on patch from Felony <onyfel@gmail.com> contributed
in https://github.com/sochix/TLSharp/pull/874 )
2019-10-05 12:41:50 +08:00
Felony 8a15feea7c Add Session getter-only property to TelegramClient
Add Session readonly field which lets the developer read session
properties like current logged-in user's Username et-al.

https://github.com/sochix/TLSharp/pull/875
2019-10-05 10:23:14 +08:00
Felony 4a663d89b3 Fix typo in Receive method declaration 2019-10-02 22:02:54 +08:00
Felony 460ec6fb32 Free TCP network stream
- Use single TCP network stream fore read and write

- Cleanup TCP stream on disposing as microsoft note : https://docs.microsoft.com/en-us/dotnet/api/system.net.sockets.tcpclient.getstream?view=netframework-4.8
2019-10-02 22:02:54 +08:00