Browse Source

Update NuGet packages & fix avatar uploading, but I think we need to make it use vcard somehow to get it to display.

master
Starbeamrainbowlabs 4 years ago
parent
commit
a4c8ef89f5
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
  1. 8
      RhinoReminds/ClientListener.cs
  2. 13
      RhinoReminds/Program.cs
  3. 10
      RhinoReminds/RhinoReminds.csproj
  4. 8
      RhinoReminds/packages.config

8
RhinoReminds/ClientListener.cs

@ -15,10 +15,15 @@ using SBRL.Geometry; @@ -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 @@ -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 @@ -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);

13
RhinoReminds/Program.cs

@ -84,13 +84,16 @@ namespace RhinoReminds @@ -84,13 +84,16 @@ namespace RhinoReminds
ReminderFilePath = settings.Filepath
};
client.AllowedDomains.Add(settings.AllowedDomain);
// Connect to the server & start listening
Task clientListener = client.Start();
// Update the avatar if appropriate
if(settings.AvatarFilepath != string.Empty)
client.SetAvatar(settings.AvatarFilepath);
if (settings.AvatarFilepath != string.Empty) {
client.OnConnected += (object sender, OnConnectedEventArgs eventArgs) => {
client.SetAvatar(settings.AvatarFilepath);
Console.WriteLine($"[Program] Set avatar to '{settings.AvatarFilepath}'.");
};
}
// Connect to the server & start listening
// Make sure the program doesn't exit whilst we're connected
clientListener.Wait();
client.Start().Wait();
}
}
}

10
RhinoReminds/RhinoReminds.csproj

@ -43,19 +43,19 @@ @@ -43,19 +43,19 @@
</Reference>
<Reference Include="System.Xml" />
<Reference Include="Microsoft.Recognizers.Definitions">
<HintPath>..\packages\Microsoft.Recognizers.Text.1.1.3\lib\net462\Microsoft.Recognizers.Definitions.dll</HintPath>
<HintPath>..\packages\Microsoft.Recognizers.Text.1.1.4\lib\net462\Microsoft.Recognizers.Definitions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Recognizers.Text">
<HintPath>..\packages\Microsoft.Recognizers.Text.1.1.3\lib\net462\Microsoft.Recognizers.Text.dll</HintPath>
<HintPath>..\packages\Microsoft.Recognizers.Text.1.1.4\lib\net462\Microsoft.Recognizers.Text.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Recognizers.Text.Number">
<HintPath>..\packages\Microsoft.Recognizers.Text.Number.1.1.3\lib\net462\Microsoft.Recognizers.Text.Number.dll</HintPath>
<HintPath>..\packages\Microsoft.Recognizers.Text.Number.1.1.4\lib\net462\Microsoft.Recognizers.Text.Number.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Recognizers.Text.NumberWithUnit">
<HintPath>..\packages\Microsoft.Recognizers.Text.NumberWithUnit.1.1.3\lib\net462\Microsoft.Recognizers.Text.NumberWithUnit.dll</HintPath>
<HintPath>..\packages\Microsoft.Recognizers.Text.NumberWithUnit.1.1.4\lib\net462\Microsoft.Recognizers.Text.NumberWithUnit.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Recognizers.Text.DateTime">
<HintPath>..\packages\Microsoft.Recognizers.Text.DateTime.1.1.3\lib\net462\Microsoft.Recognizers.Text.DateTime.dll</HintPath>
<HintPath>..\packages\Microsoft.Recognizers.Text.DateTime.1.1.4\lib\net462\Microsoft.Recognizers.Text.DateTime.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>

8
RhinoReminds/packages.config

@ -1,9 +1,9 @@ @@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Recognizers.Text" version="1.1.3" targetFramework="net47" />
<package id="Microsoft.Recognizers.Text.DateTime" version="1.1.3" targetFramework="net47" />
<package id="Microsoft.Recognizers.Text.Number" version="1.1.3" targetFramework="net47" />
<package id="Microsoft.Recognizers.Text.NumberWithUnit" version="1.1.3" targetFramework="net47" />
<package id="Microsoft.Recognizers.Text" version="1.1.4" targetFramework="net47" />
<package id="Microsoft.Recognizers.Text.DateTime" version="1.1.4" targetFramework="net47" />
<package id="Microsoft.Recognizers.Text.Number" version="1.1.4" targetFramework="net47" />
<package id="Microsoft.Recognizers.Text.NumberWithUnit" version="1.1.4" targetFramework="net47" />
<package id="S22.Xmpp" version="1.0.0.0" targetFramework="net47" />
<package id="System.Collections.Immutable" version="1.5.0" targetFramework="net47" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net47" />

Loading…
Cancel
Save