-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathircserver.h
60 lines (47 loc) · 1.45 KB
/
ircserver.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
* Copyright (C) 2001-2009 Jan Vidar Krey, [email protected]
* See the file "COPYING" for licensing details.
*/
#ifndef HAVE_IRC_SERVER_CONNECTION_H
#define HAVE_IRC_SERVER_CONNECTION_H
#include <samurai/samurai.h>
#include <samurai/io/net/socket.h>
#include <samurai/io/net/socketevent.h>
#include <samurai/io/buffer.h>
#include "ircmsg.h"
namespace IRC
{
class ServerConfig;
class ServerEventHandler;
class ServerConnection : public Samurai::IO::Net::SocketEventHandler
{
public:
ServerConnection(ServerConfig*, ServerEventHandler*);
virtual ~ServerConnection();
void connect();
void disconnect(bool send_event = true);
protected:
/**
* Process the readbuffer.
*/
void process();
void login();
void ping();
void handle(const IRC::Message& message);
void send(const IRC::Message& message);
protected:
void EventConnected(const Samurai::IO::Net::Socket*);
void EventDisconnected(const Samurai::IO::Net::Socket*);
void EventDataAvailable(const Samurai::IO::Net::Socket*);
void EventCanWrite(const Samurai::IO::Net::Socket*);
void EventError(const Samurai::IO::Net::Socket*, enum Samurai::IO::Net::SocketError error, const char* msg);
void EventTimeout(const Samurai::IO::Net::Socket*);
protected:
Samurai::IO::Net::Socket* socket;
Samurai::IO::Buffer* writeBuffer;
Samurai::IO::Buffer* readBuffer;
ServerEventHandler* listener;
ServerConfig* config;
};
} // namespace IRC
#endif // HAVE_IRC_SERVER_CONNECTION_H