1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 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__
22 typedef std::vector<std::string> parameterlist;
27 std::string servername;
28 std::string parentname;
30 unsigned int usercount;
31 unsigned int opercount;
32 unsigned int latencyms;
35 typedef std::list<ProtoServer> ProtoServerList;
37 class ProtocolInterface : public Extensible
40 InspIRCd* ServerInstance;
42 ProtocolInterface(InspIRCd* Instance) : ServerInstance(Instance) { }
43 virtual ~ProtocolInterface() { }
45 /** Send an ENCAP message to one or more linked servers.
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.
51 virtual void SendEncapsulatedData(parameterlist &encap) { }
53 /** Send metadata for an object to other linked servers.
54 * @param target The object to send metadata for.
55 * @param key The 'key' of the data, e.g. "swhois" for swhois desc on a user
56 * @param data The string representation of the data
58 virtual void SendMetaData(Extensible* target, const std::string &key, const std::string &data) { }
60 /** Send a topic change for a channel
61 * @param channel The channel to change the topic for.
62 * @param topic The new topic to use for the channel.
64 virtual void SendTopic(Channel* channel, std::string &topic) { }
66 /** Send mode changes for an object.
67 * @param target The channel name or user to send mode changes for.
68 * @param The mode changes to send.
70 virtual void SendMode(const std::string &target, const parameterlist &modedata, const std::vector<TranslateType> &translate) { }
72 /** Convenience function, string wrapper around the above.
74 virtual void SendModeStr(const std::string &target, const std::string &modeline)
76 irc::spacesepstream x(modeline);
78 std::vector<TranslateType> types;
83 types.push_back(TR_TEXT);
85 SendMode(target, n, types);
88 /** Send a notice to users with a given mode(s).
89 * @param modes The modes required for the message to be sent.
90 * @param text The message to send.
92 virtual void SendModeNotice(const std::string &modes, const std::string &text) { }
94 /** Send a notice to users with a given snomask.
95 * @param snomask The snomask required for the message to be sent.
96 * @param text The message to send.
98 virtual void SendSNONotice(const std::string &snomask, const std::string &text) { }
100 /** Send raw data to a remote client.
101 * @param target The user to push data to.
102 * @param rawline The raw IRC protocol line to deliver (":me NOTICE you :foo", whatever).
104 virtual void PushToClient(User* target, const std::string &rawline) { }
106 /** Send a message to a channel.
107 * @param target The channel to message.
108 * @param status The status character (e.g. %) required to recieve.
109 * @param text The message to send.
111 virtual void SendChannelPrivmsg(Channel* target, char status, const std::string &text) { }
113 /** Send a notice to a channel.
114 * @param target The channel to message.
115 * @param status The status character (e.g. %) required to recieve.
116 * @param text The message to send.
118 virtual void SendChannelNotice(Channel* target, char status, const std::string &text) { }
120 /** Send a message to a user.
121 * @param target The user to message.
122 * @param text The message to send.
124 virtual void SendUserPrivmsg(User* target, const std::string &text) { }
126 /** Send a notice to a user.
127 * @param target The user to message.
128 * @param text The message to send.
130 virtual void SendUserNotice(User* target, const std::string &text) { }
132 /** Fill a list of servers and information about them.
133 * @param sl The list of servers to fill.
134 * XXX: document me properly, this is shit.
136 virtual void GetServerList(ProtoServerList &sl) { }