Start looking at setting the avatar automatically.

It's untested though.
This commit is contained in:
Starbeamrainbowlabs 2018-11-23 17:55:23 +00:00
parent 0bf68aa35c
commit cbbc750955
Signed by: sbrl
GPG key ID: 1BE5172E637709C2

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using S22.Xmpp;
using S22.Xmpp.Client;
using S22.Xmpp.Im;
@ -13,6 +14,8 @@ namespace RhinoReminds
public string Filepath = "./reminders.xml";
public string Jid = null;
public string AvatarFilepath = string.Empty;
public string Password = null;
}
@ -44,6 +47,7 @@ namespace RhinoReminds
Console.WriteLine(" -h --help Show this message");
Console.WriteLine($" -f --file Specify where to save reminders (default: {settings.Filepath})");
Console.WriteLine(" --domain {domain} Set the domain users are allowed to originate at. Defaults to any domain.");
Console.WriteLine(" --avatar Update the XMPP account's avatar to the specified image. By default the avatar is not updated.");
Console.WriteLine();
Console.WriteLine("Environment Variables:");
Console.WriteLine(" XMPP_JID The JID to login to");
@ -59,6 +63,10 @@ namespace RhinoReminds
settings.AllowedDomain = args[++i];
break;
case "--avatar":
settings.AvatarFilepath = args[++i];
break;
}
}
@ -76,7 +84,13 @@ namespace RhinoReminds
ReminderFilePath = settings.Filepath
};
client.AllowedDomains.Add(settings.AllowedDomain);
client.Start().Wait();
// Connect to the server & start listening
Task clientListener = client.Start();
// Update the avatar if appropriate
if(settings.AvatarFilepath != string.Empty)
client.SetAvatar(settings.AvatarFilepath);
// Make sure the program doesn't exit whilst we're connected
clientListener.Wait();
}
}
}