[smuxi/experiments/torchat: 8/8] WIP



commit 833257a2593e33b6bbc0d478dfc726b0165fd7c0
Author: Mirco Bauer <meebey meebey net>
Date:   Fri Dec 20 17:00:08 2013 +0100

    WIP

 src/Engine/Engine.csproj                           |    4 +-
 .../Protocols/TorChat/TorChatProtocolManager.cs    |   52 ++++++++++++++++++++
 2 files changed, 55 insertions(+), 1 deletions(-)
---
diff --git a/src/Engine/Engine.csproj b/src/Engine/Engine.csproj
index b593a18..a8397ae 100644
--- a/src/Engine/Engine.csproj
+++ b/src/Engine/Engine.csproj
@@ -17,7 +17,7 @@
     <DebugType>full</DebugType>
     <Optimize>false</Optimize>
     <OutputPath>..\..\bin\debug</OutputPath>
-    <DefineConstants>DEBUG;TRACE;LOG4NET;CONFIG_NINI;DB4O_8_0</DefineConstants>
+    <DefineConstants>DEBUG;TRACE;LOG4NET;CONFIG_NINI;DB4O_8_0;TOR</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
@@ -106,6 +106,7 @@
     <Compile Include="Hooks\Commands\ProtocolManagerHookCommand.cs" />
     <Compile Include="Hooks\Commands\SessionHookCommand.cs" />
     <Compile Include="Hooks\Environments\CommandHookEnvironment.cs" />
+    <Compile Include="Protocols\TorChat\TorChatProtocolManager.cs" />
   </ItemGroup>
   <ItemGroup>
     <Folder Include="Protocols\" />
@@ -119,6 +120,7 @@
     <Folder Include="Hooks\" />
     <Folder Include="Hooks\Commands\" />
     <Folder Include="Hooks\Environments\" />
+    <Folder Include="Protocols\TorChat\" />
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\po-Engine\da.po" />
diff --git a/src/Engine/Protocols/TorChat/TorChatProtocolManager.cs 
b/src/Engine/Protocols/TorChat/TorChatProtocolManager.cs
new file mode 100644
index 0000000..0ba99af
--- /dev/null
+++ b/src/Engine/Protocols/TorChat/TorChatProtocolManager.cs
@@ -0,0 +1,52 @@
+// Smuxi - Smart MUltipleXed Irc
+//
+// Copyright (c) 2013 Mirco Bauer <meebey meebey net>
+//
+// Full GPL License: <http://www.gnu.org/licenses/gpl.txt>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+using System;
+using System.Linq;
+using System.IO;
+
+#if TOR && DISABLED
+namespace Smuxi.Engine
+{
+    public class TorChatProtocolManager : ProtocolManagerBase
+    {
+        const char MSG_SEPARATOR = '\n';
+
+        public TorChatProtocolManager(Session session) : base(session)
+        {
+        }
+
+        void OnReceived(byte[] buffer)
+        {
+            foreach (byte @byte in buffer) {
+                byte[] msg;
+
+            }
+            do {
+                msg = buffer.TakeWhile((@byte) => @byte != MSG_SEPARATOR);
+            } while (msg.Length > 0);
+        }
+
+        void DecodeMessage(string msg)
+        {
+            return msg.Replace(@"\r\n", @"\n").Replace(@"\n", "\n");
+        }
+    }
+}
+#endif
\ No newline at end of file


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]