diff --git a/SparkleShare/SparkleInvitation.cs b/SparkleShare/SparkleInvitation.cs index 5b135107..e9d0bfef 100644 --- a/SparkleShare/SparkleInvitation.cs +++ b/SparkleShare/SparkleInvitation.cs @@ -22,9 +22,17 @@ namespace SparkleShare { class SparkleInvitation { + public string Server; + public string Repository; + public string Key; + + public SparkleInvitation (string file_path) { + if (!File.Exists (file_path)) + return; + XmlDocument xml_doc = new XmlDocument (); xml_doc.Load (file_path); @@ -32,9 +40,18 @@ namespace SparkleShare { XmlNodeList repository_xml = xml_doc.GetElementsByTagName ("repository"); XmlNodeList key_xml = xml_doc.GetElementsByTagName ("key"); - string server = server_xml [0].InnerText; - string repository = repository_xml [0].InnerText; - string key = key_xml [0].InnerText; + Server = server_xml [0].InnerText; + Repository = repository_xml [0].InnerText; + Key = key_xml [0].InnerText; + + } + + + public void Activate () + { + + string url = "http://" + Server + "/repo=" + Repository + "&key=" + Key; + Console.WriteLine (url); } diff --git a/SparkleShare/SparkleUI.cs b/SparkleShare/SparkleUI.cs index 7d10a66a..7e404828 100644 --- a/SparkleShare/SparkleUI.cs +++ b/SparkleShare/SparkleUI.cs @@ -49,8 +49,6 @@ namespace SparkleShare { BusG.Init (); Gtk.Application.Init (); -// SparkleInvitation i = new SparkleInvitation ("/home/hbons/SparkleShare/sparkleshare.invitation"); - SetProcessName ("sparkleshare"); Repositories = new List (); @@ -89,7 +87,18 @@ namespace SparkleShare { watcher.Created += delegate (object o, FileSystemEventArgs args) { - AddRepository (args.FullPath); + if (args.Name.EndsWith ("sparkleshare.invitation")) { + + SparkleInvitation invitation; + invitation = new SparkleInvitation (args.FullPath); + + invitation.Activate (); + + } else if (Directory.Exists (args.FullPath)) { + + AddRepository (args.FullPath); + + } };