The IrcBot class can connect to a channel on an IRC network. Users on the same network can send messages to the bot that are parsed by message handlers. The included handlers read digital/analog inputs and write digital outputs or echo messages back to the command sender/channel. Users can write their own message handlers inheriting from the MessageHandler class to perform different actions.

Revision:
0:b8fb2df56652
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/irc.h	Sat Aug 02 12:09:10 2014 +0000
@@ -0,0 +1,48 @@
+#ifndef __mbed_irc_h__
+#define __mbed_irc_h__
+
+#include "mbed.h"
+#include "EthernetInterface.h"
+#include <vector>
+
+class IrcMessage {
+    public:
+        IrcMessage();
+        IrcMessage(char *, char *, char *);    
+        char from[32], to[32], msg[256];
+};
+
+class MessageHandler {
+    public:
+        MessageHandler() {};
+        virtual IrcMessage handle(IrcMessage msg) {return IrcMessage();}
+};
+
+class Irc {
+    public:
+        Irc(char *, char *, int, char *);
+        void connect();
+        void disconnect();
+        void add(MessageHandler *);
+        void identify(char *);
+        void join(char *);
+        bool read();
+    private:
+        void handle(IrcMessage);
+        void parse();
+        void send(char *);
+        Serial pc;
+        TCPSocketConnection sock;
+        char network[64];
+        char channel[64];
+        int port;
+        char nickname[64];
+        char password[64];
+        bool ident, connected, setup, joined;
+        char readbuffer[512];
+        char parsebuffer[512];
+        int parseindex;
+        vector<MessageHandler *> handlers;
+};
+
+#endif
\ No newline at end of file