about summary refs log tree commit diff
path: root/README.md
diff options
context:
space:
mode:
authorBen Harris <ben@tilde.team>2020-05-05 21:32:08 -0400
committerBen Harris <ben@tilde.team>2020-05-05 21:32:08 -0400
commitb3c1a9a929d5f57e3c760087ec9e9950bd1e7aff (patch)
treea5fc840eeaca66fe9adb1604072bc01b6caa554b /README.md
parent2c4e412c189ef54c181ffad96667232eaf80fcef (diff)
move example projects into a subfolder
Diffstat (limited to 'README.md')
-rw-r--r--README.md106
1 files changed, 10 insertions, 96 deletions
diff --git a/README.md b/README.md
index 309faed..1a559ec 100644
--- a/README.md
+++ b/README.md
@@ -1,102 +1,16 @@
-# irctokens
+# IrcSharp
 
-[![Build Status](https://drone.tildegit.org/api/badges/ben/ircsharp/status.svg)](https://drone.tildegit.org/ben/ircsharp)
+[![Build Status](https://drone.tildegit.org/api/badges/ben/irctokens/status.svg)](https://drone.tildegit.org/ben/irctokens)
 
-this is a c\# port of jesopo's [irctokens](
-https://github.com/jesopo/irctokens)
+this is a collection of c\# projects to tokenize, parse, and maintain
+state for IRC clients.
 
-## usage
+unless otherwise noted, this is mostly a port of jesopo's python libraries.
 
-### tokenization
+- [irctokens](https://github.com/jesopo/irctokens)
+- [ircstates](https://github.com/jesopo/ircstates)
+- [ircrobots](https://github.com/jesopo/ircrobots)
 
-    using IrcTokens;
-    
-    ...
-
-    var line = new Line("@id=123 :ben!~ben@host.tld PRIVMSG #channel :hello there!");
-    Console.WriteLine(line);
-    Console.WriteLine(line.Format());
-
-### formatting
-
-    var line = new Line {Command = "USER", Params = new List<string> {"user", "0", "*", "real name"}};
-    Console.WriteLine(line);
-    Console.WriteLine(line.Format());
-
-### stateful
-
-see the full example in [TokensSample/Client.cs](TokensSample/Client.cs)
-
-    public class Client
-    {
-        private readonly byte[] _bytes;
-        private readonly StatefulDecoder _decoder;
-        private readonly StatefulEncoder _encoder;
-        private readonly Socket _socket;
-
-        public Client()
-        {
-            _decoder = new StatefulDecoder();
-            _encoder = new StatefulEncoder();
-            _socket  = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);
-            _bytes   = new byte[1024];
-        }
-
-        public void Start()
-        {
-            _socket.Connect("127.0.0.1", 6667);
-            while (!_socket.Connected) Thread.Sleep(1000);
-
-            Send(new Line {Command = "NICK", Params = new List<string> {"tokensbot"}});
-            Send(new Line {Command = "USER", Params = new List<string> {"tokensbot", "0", "*", "real name"}});
-
-            while (true)
-            {
-                var bytesReceived = _socket.Receive(_bytes);
-
-                if (bytesReceived == 0)
-                {
-                    Console.WriteLine("! disconnected");
-                    _socket.Shutdown(SocketShutdown.Both);
-                    _socket.Close();
-                    break;
-                }
-
-                var lines = _decoder.Push(_bytes, bytesReceived);
-
-                foreach (var line in lines)
-                {
-                    Console.WriteLine($"< {line.Format()}");
-
-                    switch (line.Command)
-                    {
-                        case "PING":
-                            Send(new Line {Command = "PONG", Params = line.Params});
-                            break;
-                        case "001":
-                            Send(new Line {Command = "JOIN", Params = new List<string> {"#test"}});
-                            break;
-                        case "PRIVMSG":
-                            Send(new Line
-                            {
-                                Command = "PRIVMSG", Params = new List<string> {line.Params[0], "hello there"}
-                            });
-                            break;
-                    }
-                }
-            }
-        }
-
-        private void Send(Line line)
-        {
-            Console.WriteLine($"> {line.Format()}");
-            _encoder.Push(line);
-            while (_encoder.PendingBytes.Length > 0)
-                _encoder.Pop(_socket.Send(_encoder.PendingBytes, SocketFlags.None));
-        }
-    }
-
-## contact
-
-come say hi on [\#irctokens on irc.tilde.chat](https://web.tilde.chat/?join=irctokens)
+discussion and support on irc: [#irctokens](
+https://web.tilde.chat/?join=irctokens)