blob: 1c92f6941e4d796bb83a2ad3f505b7cee5aeda06 (
plain)
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
|
/*
*
* (C) 2003-2013 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*/
#ifndef UPLINK_H
#define UPLINK_H
#include "sockets.h"
namespace Uplink
{
extern void Connect();
}
/* This is the socket to our uplink */
class UplinkSocket : public ConnectionSocket, public BufferedSocket
{
public:
UplinkSocket();
~UplinkSocket();
bool ProcessRead() anope_override;
void OnConnect() anope_override;
void OnError(const Anope::string &) anope_override;
/* A message sent over the uplink socket */
class CoreExport Message
{
private:
/* The source of the message, can be a server (Me), or any user (one of our bots) */
const Server *server;
const User *user;
std::stringstream buffer;
public:
Message();
explicit Message(const Server *);
explicit Message(const User *);
~Message();
template<typename T> Message &operator<<(const T &val)
{
this->buffer << val;
return *this;
}
};
};
extern CoreExport UplinkSocket *UplinkSock;
#endif // UPLINK_H
|