Commit graph

212 commits

Author SHA1 Message Date
Meysam Navaei
91f837b384 . 2017-12-13 17:42:20 +03:30
Meysam Navaei
acf53742f6 add forward message method 2017-12-04 16:17:27 +03:30
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
Robert Massa
3ba3ea53fd Handle DataCenterMigration exceptions in all methods exposed by TelegramClient
This handles the data center migration in more cases.
Fixes bugs like mentioned in #599.
2017-11-08 09:54:05 +08:00
Daniel Vygolov
0015cf494b Added new type of DataCenterMigrateException - NetworkMigrateException
Now we catch not only PhoneMigrateException but all DataCenterMigrationExceptions and reconnect
Fixes #568
2017-09-29 01:09:48 +08:00
Afshin Arani
133b9fdf6c TL-Layer: Update To Layer 66 (#519)
* TL-Layer: Update To Layer 66
2017-07-20 10:07:24 +08:00
AmiNadim
0d55940c12 Added while loop to MakeAuthAsync method. (#477)
fix PhoneMigrationException by reconnecting to DC on the error .
(fix for #458)
2017-05-18 21:06:33 +08:00
Ilya Pirozhenko
97a593e25e Update README.md 2017-05-04 18:01:13 +03:00
salarcode
c5187ae12b Implementing IsConnected
Closes #460
2017-04-26 13:18:17 +08:00
Ilya Pirozhenko
1697db9d7f Update README.md 2017-02-28 16:45:20 +03:00
Barsham Sotoudeh
26aa35b88a Add missing "offset" parameter in catch block of the GetFile method (#402)
This offset optional parameter was added in a753a1ab13
2017-02-17 23:16:55 +08:00
Ilya Pirozhenko
f6ef04ed01 Update README.md 2017-01-29 17:06:22 +03:00
Andres G. Aragoneses
fbe8c9bf84 Merge pull request #373 from Starli0n/master
Http proxy authentication
2017-01-27 20:23:44 +08:00
Starli0n
48077961ae Custom TCP hanlder to allow HTTP proxy auth 2017-01-27 10:58:47 +01:00
Andres G. Aragoneses
85c206cc24 Merge pull request #372 from Starli0n/master
Add offset parameter to GetFile() method
2017-01-20 10:03:06 +08:00
Starli0n
a753a1ab13 Add offset parameter to GetFile() method 2017-01-19 19:31:27 +01:00
Andres G. Aragoneses
5ddd9a3ad0 Merge pull request #362 from Starli0n/master
Add GetHistoryAsync() to TelegramClient
2017-01-11 17:53:25 +08:00
Starli0n
5e6cf48490 Add GetHistoryAsync() to TelegramClient 2017-01-09 18:25:55 +01:00
Mikhail
47d1c10c9d Search user by username with send message test. (#356)
* Search user by username with send message test.
2016-12-28 22:37:34 +08:00
Andres G. Aragoneses
0428753b2b Merge pull request #350 from salarcode/master
Tests: Use OfType() instead of GetType() == typeof()
2016-12-21 17:07:07 +08:00
Salar Khalilzadeh
dfc89dc3ab Tests: Use OfType() instead of GetType() == typeof() 2016-12-20 12:21:18 +03:30
Andres G. Aragoneses
6d73c0e964 Merge pull request #344 from salarcode/master
Implement IDisposable in TelegramClient class
2016-12-16 15:00:46 +08:00
salar2k
fc09dba71b Implementing IDisposable 2016-12-16 10:25:33 +03:30
Ilya Pirozhenko
3ef3ff86ad Merge pull request #323 from mykolasglinskis/master
FloodExceptionShouldNotCauseCannotReadPackageLengthError
2016-12-15 11:00:06 +03:00
Mykolas Glinskis
e191b59233 Tests: include testcase for "couldn't read packet length" bug
It seems that after triggering a FloodException, and waiting the required time
to be able to use Telegram again, TLSharp throws an exception. I include the
way to reproduce this bug as an [Ignore]d test with the hope that someone
may help me fix the problem soon.

For reference, the whole stacktrace of the exception was:

Test Name:	FloodExceptionShouldNotCauseCannotReadPackageLengthError
Test FullName:	TLSharp.Tests.TLSharpTestsVS.FloodExceptionShouldNotCauseCannotReadPackageLengthError
Test Source:	D:\Projects\GitHub\TLSharp\TLSharp.Tests.VS\TLSharpTestsVs.cs : line 72
Test Outcome:	Failed
Test Duration:	0:04:30.7467012

Result StackTrace:
at TLSharp.Core.Network.TcpTransport.<Receieve>d__4.MoveNext() in D:\Projects\GitHub\TLSharp\TLSharp.Core\Network\TcpTransport.cs:line 39
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at TLSharp.Core.Network.MtProtoSender.<Receive>d__9.MoveNext() in D:\Projects\GitHub\TLSharp\TLSharp.Core\Network\MtProtoSender.cs:line 139
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at TLSharp.Core.TelegramClient.<ConnectAsync>d__8.MoveNext() in D:\Projects\GitHub\TLSharp\TLSharp.Core\TelegramClient.cs:line 76
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at TLSharp.Tests.TLSharpTests.<CheckPhones>d__54.MoveNext() in D:\Projects\GitHub\TLSharp\TLSharp.Tests\TLSharpTests.cs:line 329
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at TLSharp.Tests.TLSharpTestsVS.<CheckPhones>d__9.MoveNext() in D:\Projects\GitHub\TLSharp\TLSharp.Tests.VS\TLSharpTestsVs.cs:line 68
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at TLSharp.Tests.TLSharpTests.<FloodExceptionShouldNotCauseCannotReadPackageLengthError>d__55.MoveNext() in D:\Projects\GitHub\TLSharp\TLSharp.Tests\TLSharpTests.cs:line 340
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at TLSharp.Tests.TLSharpTestsVS.<FloodExceptionShouldNotCauseCannotReadPackageLengthError>d__10.MoveNext() in D:\Projects\GitHub\TLSharp\TLSharp.Tests.VS\TLSharpTestsVs.cs:line 73
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
Result Message:
Test method TLSharp.Tests.TLSharpTestsVS.FloodExceptionShouldNotCauseCannotReadPackageLengthError threw exception:
System.InvalidOperationException: Couldn't read the packet length
2016-11-30 09:34:44 +01:00
Ilya Pirozhenko
c22ee8dea6 Merge pull request #317 from unn4m3d/patch-1
Catch PhoneMigrationException in IsPhoneRegisteredAsync
2016-11-28 09:56:40 +03:00
unn4m3d
545e736808 Catch PhoneMigrationException in IsPhoneRegisteredAsync 2016-11-27 19:37:15 +10:00
Ilya Pirozhenko
6b3c96eaa6 Merge pull request #289 from knocte/nunitSupport
Tests: add NUnit support
2016-11-17 09:20:07 +03:00
Ilya Pirozhenko
ca6e18b50e Merge pull request #306 from aarani/cloud-password
Add Cloud password Support
2016-11-17 09:17:36 +03:00
Afshin Arani
6f9c328349 Add Cloud Password Support 2016-11-16 17:01:00 +03:30
Afshin Arani
7a6191871d Merge pull request #4 from sochix/master
Update to HEAD
2016-11-16 15:37:22 +03:30
Ilya Pirozhenko
61e2b1e732 Merge pull request #296 from knocte/md
Add C# style policy to SLN file
2016-11-09 09:17:51 +03:00
Andres G. Aragoneses
d6887a70f1 Tests: add NUnit support
What's an open source project that cannot be
tested in an open source platform? The best
open source .NET IDE that works in Linux
(MonoDevelop) doesn't have support for
VisualStudio Testing framework, but it has
support for NUnit.

By abstracting a bit the TLSharp.Tests assembly
we can have two different wrappers, one for
NUnit tests and other for VisualStudio tests,
so no one can be left behind.
2016-11-09 00:50:34 +08:00
Andres G. Aragoneses
cc0ca3bcd4 Add C# style policy to SLN file
This helps MonoDevelop know that the solution will default
to spaces instead of tabs, etc. This doesn't disrupt the
solution in VisualStudio at all.
2016-11-09 00:49:07 +08:00
Ilya Pirozhenko
ec48dede94 Merge pull request #294 from timocov/send_ping_method
Added possibility to do ping request (SendPingAsync method)
2016-11-08 15:37:01 +03:00
Eugene Timokhov
8b2f227142 Added possibility to do ping request (SendPingAsync method) 2016-11-07 02:40:19 +03:00
Ilya Pirozhenko
ca78532b34 Merge pull request #284 from knocte/normalizeSendMessageTest
SendNumberTest: remove the + from the phone number in app.config
2016-11-03 16:16:10 +03:00
Andres G. Aragoneses
adef68b747 SendNumberTest: remove the + from the phone number in app.config
NumberToAuthenticate works fine for the AuthTest if we put
a "+" before our international prefix when writing the number,
but because this test compares the numbers we got from the
Contacts List with the one in app.config, it could not find it
due to this prefix. Let's rather be prepared for that.
2016-11-03 01:33:56 +08:00
Andres G. Aragoneses
738a84937e SendMessageTest: rather crash with meaningful exception
Rather crash with meaningful exception than not passing the
test and only giving a hint when debugging.
2016-11-03 01:31:47 +08:00
Ilya Pirozhenko
8b04f82846 Merge pull request #283 from knocte/throwInsteadOfSleep
Throw FloodException instead of calling Thread.Sleep()
2016-11-01 21:05:14 +03:00
Andres G. Aragoneses
5e9bb6163f Throw FloodException instead of calling Thread.Sleep()
Doing this is better when looking at the problem from at least
these 2 points of view:

a) You're working on TLSharp itself: You might be testing some
new things or running TLSharp's tests. Suddenly, if a FLOOD_WAIT
response happens, there's no clear way to know. You just see the
tests taking forever. But if a test has reached a situation in
which Telegram has returned a FLOOD_WAIT error, it's very likely
that what happens is that the TLSharp operation being tested is
actually buggy, which means that the test should FAIL FAST and
show a stacktrace of the problem so that you can see where in the
code was the FLOOD_WAIT received/caused. You shouldn't need to
kill the run of the test suite and hope to hit the problem again
only when you were using the debugger (to be able to pause
execution and examine a stacktrace of where the execution flow is).

b) You're using TLSharp: if you hit a FLOOD_WAIT problem it may
happen because:

b1) TLSharp has a bug: in this case it's better to throw an
exception so that the user can copy the stacktrace and paste
it into a new Github issue.

b2) Your program uses TLSharp sending excessive requests: you
want to have your program know when you hit the limit, to be
able to fix your program to not be so floody. But a call to
Thread.Sleep() doesn't help you to know this, you just know
that suddenly your program has hung, and you don't know why.
You cannot react to the problem, however with an exception you
can react to the problem (for example by examining the time
that the exception provides, as a TimeSpan property, to know
how much your program needs to wait to be able to use TLSharp
again).
2016-11-01 23:52:58 +08:00
Ilya Pirozhenko
d8fca8619c Merge pull request #281 from knocte/fixTypo
Fix typo "CpdeToAuthenticate" -> CodeToAuthenticate
2016-11-01 08:53:57 +03:00
Andres G. Aragoneses
9986270bed Fix typo "CpdeToAuthenticate" -> CodeToAuthenticate
And let's use nameof() in all cases so this doesn't happen again.
2016-11-01 01:33:26 +08:00
Ilya Pirozhenko
24a9ea1ed9 Merge pull request #277 from knocte/friendlerAuthTestFailures
Friendlier exceptions for Auth testing
2016-10-31 11:12:36 +03:00
Ilya Pirozhenko
054bbe88f3 Update README.md 2016-10-31 09:08:38 +03:00