[invitation] add early logic
This commit is contained in:
parent
4475c27000
commit
2acd8fa1f0
|
@ -22,9 +22,17 @@ namespace SparkleShare {
|
||||||
|
|
||||||
class SparkleInvitation {
|
class SparkleInvitation {
|
||||||
|
|
||||||
|
public string Server;
|
||||||
|
public string Repository;
|
||||||
|
public string Key;
|
||||||
|
|
||||||
|
|
||||||
public SparkleInvitation (string file_path)
|
public SparkleInvitation (string file_path)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (!File.Exists (file_path))
|
||||||
|
return;
|
||||||
|
|
||||||
XmlDocument xml_doc = new XmlDocument ();
|
XmlDocument xml_doc = new XmlDocument ();
|
||||||
xml_doc.Load (file_path);
|
xml_doc.Load (file_path);
|
||||||
|
|
||||||
|
@ -32,9 +40,18 @@ namespace SparkleShare {
|
||||||
XmlNodeList repository_xml = xml_doc.GetElementsByTagName ("repository");
|
XmlNodeList repository_xml = xml_doc.GetElementsByTagName ("repository");
|
||||||
XmlNodeList key_xml = xml_doc.GetElementsByTagName ("key");
|
XmlNodeList key_xml = xml_doc.GetElementsByTagName ("key");
|
||||||
|
|
||||||
string server = server_xml [0].InnerText;
|
Server = server_xml [0].InnerText;
|
||||||
string repository = repository_xml [0].InnerText;
|
Repository = repository_xml [0].InnerText;
|
||||||
string key = key_xml [0].InnerText;
|
Key = key_xml [0].InnerText;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void Activate ()
|
||||||
|
{
|
||||||
|
|
||||||
|
string url = "http://" + Server + "/repo=" + Repository + "&key=" + Key;
|
||||||
|
Console.WriteLine (url);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,8 +49,6 @@ namespace SparkleShare {
|
||||||
BusG.Init ();
|
BusG.Init ();
|
||||||
Gtk.Application.Init ();
|
Gtk.Application.Init ();
|
||||||
|
|
||||||
// SparkleInvitation i = new SparkleInvitation ("/home/hbons/SparkleShare/sparkleshare.invitation");
|
|
||||||
|
|
||||||
SetProcessName ("sparkleshare");
|
SetProcessName ("sparkleshare");
|
||||||
|
|
||||||
Repositories = new List <SparkleRepo> ();
|
Repositories = new List <SparkleRepo> ();
|
||||||
|
@ -89,8 +87,19 @@ namespace SparkleShare {
|
||||||
|
|
||||||
watcher.Created += delegate (object o, FileSystemEventArgs args) {
|
watcher.Created += delegate (object o, FileSystemEventArgs args) {
|
||||||
|
|
||||||
|
if (args.Name.EndsWith ("sparkleshare.invitation")) {
|
||||||
|
|
||||||
|
SparkleInvitation invitation;
|
||||||
|
invitation = new SparkleInvitation (args.FullPath);
|
||||||
|
|
||||||
|
invitation.Activate ();
|
||||||
|
|
||||||
|
} else if (Directory.Exists (args.FullPath)) {
|
||||||
|
|
||||||
AddRepository (args.FullPath);
|
AddRepository (args.FullPath);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue