Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: IrcBot.h
- Revision:
- 1:cf586c9bbb52
- Parent:
- 0:b8fb2df56652
- Child:
- 2:e4c74eb20586
diff -r b8fb2df56652 -r cf586c9bbb52 IrcBot.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/IrcBot.h Sat Aug 02 12:17:28 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