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

This commit is contained in:
Starbeamrainbowlabs 2018-12-05 23:18:38 +00:00
parent 216cd6d479
commit a4c8ef89f5
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
4 changed files with 24 additions and 15 deletions

View file

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

View file

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

View file

@ -43,19 +43,19 @@
</Reference> </Reference>
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="Microsoft.Recognizers.Definitions"> <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>
<Reference Include="Microsoft.Recognizers.Text"> <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>
<Reference Include="Microsoft.Recognizers.Text.Number"> <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>
<Reference Include="Microsoft.Recognizers.Text.NumberWithUnit"> <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>
<Reference Include="Microsoft.Recognizers.Text.DateTime"> <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> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View file

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