Commit graph

254 commits

Author SHA1 Message Date
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
Nicholas Rodine 0dd3992997 Added .idea/ directory (for JetBrains Rider) to .gitignore 2019-07-24 17:30:29 +08:00
Mike 00330c9bd0 Fix Issue #862 (#863)
Fix connection with IPv4 address. A regression introduced in 3224113e4c.
2019-07-12 07:35:26 +08:00
Nicholas Rodine 3224113e4c Modified TcpClient setup to work with IPv6 addresses, fixing #773. 2019-06-28 13:25:35 +08:00
Andres G. Aragoneses 6ce4eceaca Core: fix typo in commented logging code 2019-02-10 13:54:04 +01:00
Andres G. Aragoneses 60a3c62357 Core: avoid possible infinite loop if switching to same DC
People are reporting that under some circumstances, an infinite
loop could happen when TLSharp tries to handle a reconnection to
a different DC, if the DC instructed to be used is the same as
the one that was used in the last connection.

Not sure how could this happen (although the analysis present in
this github issue [1] might help understand it), but this commit
helps to make TLSharp fail fast (with an exception) instead of an
infinite loop from now on, which will help avoiding people file
issues such as [2] and [3] and instead maybe file a proper bug
report easier to understand, to try to fix the underlying root
cause.

[1] https://github.com/sochix/TLSharp/issues/719
[2] https://github.com/sochix/TLSharp/issues/803
[3] https://github.com/sochix/TLSharp/issues/839
2019-02-10 13:53:46 +01:00
Andres G. Aragoneses d04ddb1e0e Core: fix 2 warnings 2019-02-10 13:36:37 +01:00
Marc R Kellerman f2a394ea15 Fixed OffSet paramets for GetUserDialogsAsync & GetHistoryAsync (#831)
Fixes https://github.com/sochix/TLSharp/issues/696

Fixes https://github.com/sochix/TLSharp/issues/597
2019-01-04 18:16:35 +08:00
vlad_neg 47e973823a issue#768 fix exception 'Constructor Invalid Or Context.Init Not Called !' 2018-05-30 07:31:03 +08:00
Ilya Pirozhenko 1aa63e565a
Update README.md 2018-04-25 19:02:57 +03:00
Ilya Pirozhenko faf129e636
Update README.md 2018-04-25 13:23:29 +03:00
Ilya Pirozhenko 28b83aaec3
Update README.md
Removed gitter as it too noisy
2018-04-24 10:47:03 +03:00
Afshin Arani fdcb195fbb Use ToArray instead of GetBuffer
Buffer normally contain lots of extra zero bytes
2018-04-13 09:51:26 +08:00
Andres G. Aragoneses 4197df89aa
Merge pull request #732 from MasihAkbari/master
README.md: fix compilation error for getting dialogs in code snippet
2018-03-21 09:28:16 +08:00
Masih Akbari 0ff9980cc9 fix compilation error for getting dialogs in README.md file 2018-03-21 01:53:48 +03:30
Andres G. Aragoneses f8f31ddb19
Merge pull request #728 from MasihAkbari/master
README.md: update to support new PascalCase changes in the API and fix other things
2018-03-19 17:22:17 +08:00
Masih Akbari 27fcd8242c update README.md to support new PascalCase changes of API and some other fixes 2018-03-19 07:57:59 +03:30
Andres G. Aragoneses bd7f5f09eb Core(MtProtoSender): mark immutable fields as readonly
To make sure they are kept immutable when upcoming
devs make changes to this file.
2018-03-05 03:54:21 +08:00
Andres G. Aragoneses e6250b1234 Core(MtProtoSender): remove mutation-based dangerous API
It wasn't being used internally, and the use-case to be used
externally is too intricated. There's already a way to change
the handler at contructor time[1] so that should be enough
customization.

[1] 48077961ae
2018-03-05 03:54:21 +08:00
Andres G. Aragoneses 3762664c14 Normalize line endings 2018-03-04 00:39:23 +08:00
Andres G. Aragoneses c1ce5e25ba
README.md: add link to gitter channel et-al 2018-03-02 11:35:21 +08:00
Andres G. Aragoneses bf568d80cc TelegramClient: change Connect() to return void instead of always true
If a method that returns bool is never returning false,
it's essentially not giving any information at all, which
means that it should return void. This will help the
consumers of this API to stop thinking that the result
of this function means if the connection was succesful
(which it is, actually, but it was never returning false
because if there's any problem connecting, the result would
be an exception instead).
2018-03-01 23:41:35 +08:00
Andres G. Aragoneses 4ce0f72d6d TelegramClient: move the _sender null check to RequestWithDcMigration()
The method IsPhoneRegisteredAsync() was calling
RequestWithDcMigration() which was the real method
that made use of the _sender field, so we can move
the null check to there.

This will also help track down possible NullReferenceExceptions
that could happen when other callers of this method
arrive with a bad _sender, which might aid us trying
to fix #706.
2018-02-28 08:43:28 +08:00
Ilya Pirozhenko fe2baf5110
Update README.md 2018-01-23 13:34:28 +03:00
Andres G. Aragoneses 687eca968a
Merge pull request #659 from PROger4ever/master
Make Session constructor public for custom ISessionStore imlementations
2017-12-18 00:09:43 +08:00
PROger4ever 7cbc40a090 Make Session constructor public for custom ISessionStore implementations
Load() method in ISessionStore requires public constructor of class Session in some cases.
E.g., loading session from a db or a key-value store, manual loading from text-file, JSON/XML and so on.
2017-12-17 21:04:11 +05:00
Robert Massa 0940d3d982 Prepare requests for re-sending after a DC migration
Fixes #608.
2017-11-21 21:02:51 +08:00
Andres G. Aragoneses b55b28fa5d
Merge pull request #629 from aarani/master
Handle Import & Export Authorization While Reconnecting
2017-11-16 19:16:46 +08:00
Afshin Arani d15d87833e Remove Old FileMigrationException Handler
this catch block could never be reached anymore because of changes
proposed in #622
2017-11-16 14:04:24 +03:30
Afshin Arani 1877c9061c Handle Import & Export Authorization While Reconnecting
closes #624
2017-11-16 14:03:31 +03:30
Afshin Arani 659becfd51 Make TLVector implement IList 2017-11-09 20:10:22 +08:00
Afshin Arani d769dd3c2f Generator Must Respect MS .NET API guidelines 2017-11-09 19:37:09 +08:00