|
|
|
@ -15,10 +15,15 @@ using SBRL.Geometry; |
|
|
|
|
|
|
|
|
|
namespace RhinoReminds |
|
|
|
|
{ |
|
|
|
|
public class OnConnectedEventArgs : EventArgs { } |
|
|
|
|
public delegate void OnConnectedHandler(object sender, OnConnectedEventArgs eventArgs); |
|
|
|
|
|
|
|
|
|
public class ClientListener |
|
|
|
|
{ |
|
|
|
|
public bool Debug { get; set; } = false; |
|
|
|
|
|
|
|
|
|
public event OnConnectedHandler OnConnected; |
|
|
|
|
|
|
|
|
|
public readonly string Jid; |
|
|
|
|
public string Username => Jid.Split('@')[0]; |
|
|
|
|
public string Hostname => Jid.Split('@')[1]; |
|
|
|
@ -89,6 +94,7 @@ namespace RhinoReminds |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Console.WriteLine($"[Rhino/Setup] Connected as {Jid}"); |
|
|
|
|
OnConnected(this, new OnConnectedEventArgs()); |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
@ -109,7 +115,7 @@ namespace RhinoReminds |
|
|
|
|
{ |
|
|
|
|
Console.Error.WriteLine($"[Error] {e.Reason}: {e.Exception}"); |
|
|
|
|
|
|
|
|
|
if(!client.Connected) |
|
|
|
|
if(!client.Connected || e.Exception is IOException) |
|
|
|
|
{ |
|
|
|
|
Console.Error.WriteLine($"[Error/Handler] Reconnecting in {TimeSpan.FromSeconds(nextBackoffDelay).ToString()}."); |
|
|
|
|
Thread.Sleep(nextBackoffDelay * 1000); |
|
|
|
|