]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/protocol.h
Document ENCAP.
[user/henk/code/inspircd.git] / include / protocol.h
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
6  * See: http://www.inspircd.org/wiki/index.php/Credits
7  *
8  * This program is free but copyrighted software; see
9  *            the file COPYING for details.
10  *
11  * ---------------------------------------------------
12  */
13
14 #ifndef __PROTOCOL_H__
15 #define __PROTOCOL_H__
16
17 #include "hashcomp.h"
18
19 class InspIRCd;
20 class User;
21
22 typedef std::deque<std::string> parameterlist;
23
24 class ProtoServer
25 {
26  public:
27         std::string servername;
28         std::string parentname;
29         std::string gecos;
30         unsigned int usercount;
31         unsigned int opercount;
32         unsigned int latencyms;
33 };
34
35 typedef std::list<ProtoServer> ProtoServerList;
36
37 class ProtocolInterface : public Extensible
38 {
39  protected:
40         InspIRCd* ServerInstance;
41  public:
42         ProtocolInterface(InspIRCd* Instance) : ServerInstance(Instance) { }
43         virtual ~ProtocolInterface() { }
44
45         /** Generate an ENCAP message.
46          * See the protocol documentation for the purpose of ENCAP.
47          * @param encap This is a list of string parameters, the first of which must be a server ID or glob matching servernames.
48          * The second must be a subcommand. All subsequent parameters are dependant on the subcommand.
49          * ENCAP (should) be used instead of creating new protocol messages for easier third party application support.
50          */
51         virtual void SendEncapsulatedData(parameterlist &encap) { }
52
53         virtual void SendMetaData(void* target, int type, const std::string &key, const std::string &data) { }
54
55         virtual void SendTopic(Channel* channel, std::string &topic) { }
56
57         virtual void SendMode(const std::string &target, parameterlist &modedata) { }
58
59         virtual void SendModeStr(const std::string &target, const std::string &modeline)
60         {
61                 /* Convenience function */
62                 irc::spacesepstream x(modeline);
63                 parameterlist n;
64                 std::string v;
65                 while (x.GetToken(v))
66                         n.push_back(v);
67                 SendMode(target, n);
68         }
69
70         virtual void SendModeNotice(const std::string &modes, const std::string &text) { }
71
72         virtual void SendSNONotice(const std::string &snomask, const std::string &text) { }
73
74         virtual void PushToClient(User* target, const std::string &rawline) { }
75
76         virtual void SendChannelPrivmsg(Channel* target, char status, const std::string &text) { }
77
78         virtual void SendChannelNotice(Channel* target, char status, const std::string &text) { }
79
80         virtual void SendUserPrivmsg(User* target, const std::string &text) { }
81
82         virtual void SendUserNotice(User* target, const std::string &text) { }
83
84         virtual void GetServerList(ProtoServerList &sl) { }
85
86         virtual void Introduce(User* u) { }
87 };
88
89 #endif
90