From 22a936d4a81f0ecd441357cf5f1e1ba93d75a761 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 15 Oct 2011 00:35:00 +0100 Subject: [PATCH] Fix style --- SparkleShare/SparkleInvite.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/SparkleShare/SparkleInvite.cs b/SparkleShare/SparkleInvite.cs index ff1d9891..a2462e2a 100644 --- a/SparkleShare/SparkleInvite.cs +++ b/SparkleShare/SparkleInvite.cs @@ -57,15 +57,12 @@ namespace SparkleShare { private Thread thread; private TcpListener tcp_listener; - private int port; public SparkleInviteListener (int port) { - this.port = port; this.tcp_listener = new TcpListener (IPAddress.Any, port); this.thread = new Thread(new ThreadStart (Listen)); - } @@ -115,18 +112,20 @@ namespace SparkleShare { if (bytes_read == 0) break; - ASCIIEncoding encoding = new ASCIIEncoding (); + ASCIIEncoding encoding = new ASCIIEncoding (); string received_message = encoding.GetString (message, 0, bytes_read); - // SparkleShare's protocol format looks like this: // sparkle://user@host.org/path/token + Uri uri = new Uri (received_message); + string token = uri.AbsolutePath.Substring (uri.AbsolutePath.LastIndexOf ("/") + 1); + string path = uri.AbsolutePath.Substring (0, uri.AbsolutePath.LastIndexOf ("/")); if (InviteReceived != null) - InviteReceived (new SparkleInvite ("", "", "")); + InviteReceived (new SparkleInvite (uri.Host, path, token)); } - tcp_client.Close(); + tcp_client.Close (); } } }