]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/protocol.h
Move MODENOTICE command to a command module
[user/henk/code/inspircd.git] / include / protocol.h
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
6  * See: http://wiki.inspircd.org/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 User;
20
21 typedef std::vector<std::string> parameterlist;
22
23 class ProtoServer
24 {
25  public:
26         std::string servername;
27         std::string parentname;
28         std::string gecos;
29         unsigned int usercount;
30         unsigned int opercount;
31         unsigned int latencyms;
32 };
33
34 typedef std::list<ProtoServer> ProtoServerList;
35
36 class ProtocolInterface
37 {
38  public:
39         ProtocolInterface() { }
40         virtual ~ProtocolInterface() { }
41
42         /** Send an ENCAP message to one or more linked servers.
43          * See the protocol documentation for the purpose of ENCAP.
44          * @param encap This is a list of string parameters, the first of which must be a server ID or glob matching servernames.
45          * The second must be a subcommand. All subsequent parameters are dependant on the subcommand.
46          * ENCAP (should) be used instead of creating new protocol messages for easier third party application support.
47          */
48         virtual void SendEncapsulatedData(parameterlist &encap) { }
49
50         /** Send metadata for an object to other linked servers.
51          * @param target The object to send metadata for.
52          * @param key The 'key' of the data, e.g. "swhois" for swhois desc on a user
53          * @param data The string representation of the data
54          */
55         virtual void SendMetaData(Extensible* target, const std::string &key, const std::string &data) { }
56
57         /** Send a topic change for a channel
58          * @param channel The channel to change the topic for.
59          * @param topic The new topic to use for the channel.
60          */
61         virtual void SendTopic(Channel* channel, std::string &topic) { }
62
63         /** Send mode changes for an object.
64          * @param target The channel name or user to send mode changes for.
65          * @param The mode changes to send.
66          */
67         virtual void SendMode(const std::string &target, const parameterlist &modedata, const std::vector<TranslateType> &translate) { }
68
69         /** Convenience function, string wrapper around the above.
70           */
71         virtual void SendModeStr(const std::string &target, const std::string &modeline)
72         {
73                 irc::spacesepstream x(modeline);
74                 parameterlist n;
75                 std::vector<TranslateType> types;
76                 std::string v;
77                 while (x.GetToken(v))
78                 {
79                         n.push_back(v);
80                         types.push_back(TR_TEXT);
81                 }
82                 SendMode(target, n, types);
83         }
84
85         /** Send a notice to users with a given snomask.
86          * @param snomask The snomask required for the message to be sent.
87          * @param text The message to send.
88          */
89         virtual void SendSNONotice(const std::string &snomask, const std::string &text) { }
90
91         /** Send raw data to a remote client.
92          * @param target The user to push data to.
93          * @param rawline The raw IRC protocol line to deliver (":me NOTICE you :foo", whatever).
94          */
95         virtual void PushToClient(User* target, const std::string &rawline) { }
96
97         /** Send a message to a channel.
98          * @param target The channel to message.
99          * @param status The status character (e.g. %) required to recieve.
100          * @param text The message to send.
101          */
102         virtual void SendChannelPrivmsg(Channel* target, char status, const std::string &text) { }
103
104         /** Send a notice to a channel.
105          * @param target The channel to message.
106          * @param status The status character (e.g. %) required to recieve.
107          * @param text The message to send.
108          */
109         virtual void SendChannelNotice(Channel* target, char status, const std::string &text) { }
110
111         /** Send a message to a user.
112          * @param target The user to message.
113          * @param text The message to send.
114          */
115         virtual void SendUserPrivmsg(User* target, const std::string &text) { }
116
117         /** Send a notice to a user.
118          * @param target The user to message.
119          * @param text The message to send.
120          */
121         virtual void SendUserNotice(User* target, const std::string &text) { }
122
123         /** Fill a list of servers and information about them.
124          * @param sl The list of servers to fill.
125          * XXX: document me properly, this is shit.
126          */
127         virtual void GetServerList(ProtoServerList &sl) { }
128 };
129
130 #endif
131