add connection unstable warning

This commit is contained in:
Laura Hausmann 2019-12-12 12:44:03 +01:00
parent 80d8f8ebb1
commit f567aad5dd
Signed by: zotan
GPG key ID: 5EC1D38FFC321311
2 changed files with 7 additions and 5 deletions

View file

@ -3,8 +3,6 @@
<component name="ChangeListManager">
<list default="true" id="36e5cfaf-0aa9-4137-8110-a5678a9c5443" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/.idea.tgcli/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.tgcli/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/telegram/Util.cs" beforeDir="false" afterPath="$PROJECT_DIR$/telegram/Util.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/telegram/telegram.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/telegram/telegram.csproj" afterDir="false" />
<change beforePath="$PROJECT_DIR$/telegram/tgcli.cs" beforeDir="false" afterPath="$PROJECT_DIR$/telegram/tgcli.cs" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@ -123,6 +121,7 @@
<workItem from="1575536474314" duration="39215000" />
<workItem from="1575724030612" duration="6335000" />
<workItem from="1575806456895" duration="35215000" />
<workItem from="1576149306510" duration="923000" />
</task>
<servers />
</component>

View file

@ -27,15 +27,12 @@ namespace telegram
* add option to disable terminal bell
* command /s /search -> list matching chats, option 1-n, archived indicator
* secret chats!
* automatically download and show images (or with a command)
* split with newline if received message enters next line
* fix issues when current_input message is longer than term width (only show as much as fits?)
* maintain a list of statuses per user (online, read, typing) ? -> make otr indicators more reliable
* photo/document/etc captions
* photo download & show externally
* error message if network/connection state changed to offline
* maybe cursor input nav (cmd+del, left/right, up for last inputs, etc)
* NOPE //edited msgs -> cache all messages by id (oof) and print old message?
*/
public class tgcli
{
@ -308,6 +305,12 @@ namespace telegram
{
switch (key.Key)
{
case ConsoleKey.Enter when connectionState != "Ready":
lock(_lock)
messageQueue.Add($"{Ansi.Red}[tgcli] " +
"Connection unstable. Check your network connection and try again.");
ScreenUpdate();
break;
case ConsoleKey.Enter when currentInputLine.StartsWith("/"):
{
var command = currentInputLine.Substring(1);