1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2010 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
14 #ifndef __PROTOCOL_H__
15 #define __PROTOCOL_H__
21 typedef std::vector<std::string> parameterlist;
26 std::string servername;
27 std::string parentname;
29 unsigned int usercount;
30 unsigned int opercount;
31 unsigned int latencyms;
34 typedef std::list<ProtoServer> ProtoServerList;
36 class ProtocolInterface
39 ProtocolInterface() { }
40 virtual ~ProtocolInterface() { }
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 * @return True if the message was sent out (target exists)
49 virtual bool SendEncapsulatedData(const parameterlist &encap) { return false; }
51 /** Send metadata for an object to other linked servers.
52 * @param target The object to send metadata for.
53 * @param key The 'key' of the data, e.g. "swhois" for swhois desc on a user
54 * @param data The string representation of the data
56 virtual void SendMetaData(Extensible* target, const std::string &key, const std::string &data) { }
58 /** Send a topic change for a channel
59 * @param channel The channel to change the topic for.
60 * @param topic The new topic to use for the channel.
62 virtual void SendTopic(Channel* channel, std::string &topic) { }
64 /** Send mode changes for an object.
65 * @param target The channel name or user to send mode changes for.
66 * @param The mode changes to send.
68 virtual void SendMode(const std::string &target, const parameterlist &modedata, const std::vector<TranslateType> &translate) { }
70 /** Convenience function, string wrapper around the above.
72 virtual void SendModeStr(const std::string &target, const std::string &modeline)
74 irc::spacesepstream x(modeline);
76 std::vector<TranslateType> types;
81 types.push_back(TR_TEXT);
83 SendMode(target, n, types);
86 /** Send a notice to users with a given snomask.
87 * @param snomask The snomask required for the message to be sent.
88 * @param text The message to send.
90 virtual void SendSNONotice(const std::string &snomask, const std::string &text) { }
92 /** Send raw data to a remote client.
93 * @param target The user to push data to.
94 * @param rawline The raw IRC protocol line to deliver (":me NOTICE you :foo", whatever).
96 virtual void PushToClient(User* target, const std::string &rawline) { }
98 /** Send a message to a channel.
99 * @param target The channel to message.
100 * @param status The status character (e.g. %) required to recieve.
101 * @param text The message to send.
103 virtual void SendChannelPrivmsg(Channel* target, char status, const std::string &text) { }
105 /** Send a notice to a channel.
106 * @param target The channel to message.
107 * @param status The status character (e.g. %) required to recieve.
108 * @param text The message to send.
110 virtual void SendChannelNotice(Channel* target, char status, const std::string &text) { }
112 /** Send a message to a user.
113 * @param target The user to message.
114 * @param text The message to send.
116 virtual void SendUserPrivmsg(User* target, const std::string &text) { }
118 /** Send a notice to a user.
119 * @param target The user to message.
120 * @param text The message to send.
122 virtual void SendUserNotice(User* target, const std::string &text) { }
124 /** Fill a list of servers and information about them.
125 * @param sl The list of servers to fill.
126 * XXX: document me properly, this is shit.
128 virtual void GetServerList(ProtoServerList &sl) { }