InspIRCd  3.0
protocol.h
1 /*
2  * InspIRCd -- Internet Relay Chat Daemon
3  *
4  * Copyright (C) 2008 Robin Burchell <[email protected]>
5  * Copyright (C) 2008 Craig Edwards <[email protected]>
6  *
7  * This file is part of InspIRCd. InspIRCd is free software: you can
8  * redistribute it and/or modify it under the terms of the GNU General Public
9  * License as published by the Free Software Foundation, version 2.
10  *
11  * This program is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14  * details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 
21 #pragma once
22 
23 #include "hashcomp.h"
24 
25 class User;
26 
27 typedef std::vector<std::string> parameterlist;
28 
30 {
31  public:
36  virtual void SendMetaData(const std::string& key, const std::string& data) = 0;
37 };
38 
39 class CoreExport ProtocolInterface
40 {
41  public:
42  typedef ProtocolServer Server;
43 
44  class ServerInfo
45  {
46  public:
47  std::string servername;
48  std::string parentname;
49  std::string gecos;
50  unsigned int usercount;
51  unsigned int opercount;
52  unsigned int latencyms;
53  };
54 
55  typedef std::vector<ServerInfo> ServerList;
56 
57  virtual ~ProtocolInterface() { }
58 
69  virtual bool SendEncapsulatedData(const std::string& targetmask, const std::string& cmd, const parameterlist& params, User* source = NULL) { return false; }
70 
79  virtual void BroadcastEncap(const std::string& cmd, const parameterlist& params, User* source = NULL, User* omit = NULL) { }
80 
86  virtual void SendMetaData(Channel* chan, const std::string& key, const std::string& data) { }
87 
93  virtual void SendMetaData(User* user, const std::string& key, const std::string& data) { }
94 
99  virtual void SendMetaData(const std::string& key, const std::string& data) { }
100 
105  virtual void SendSNONotice(char snomask, const std::string& text) { }
106 
113  virtual void SendMessage(Channel* target, char status, const std::string& text, MessageType type = MSG_PRIVMSG) { }
114 
120  virtual void SendMessage(User* target, const std::string& text, MessageType type = MSG_PRIVMSG) { }
121 
127  void SendChannelNotice(Channel* target, char status, const std::string &text)
128  {
129  SendMessage(target, status, text, MSG_NOTICE);
130  }
131 
136  void SendUserNotice(User* target, const std::string &text)
137  {
138  SendMessage(target, text, MSG_NOTICE);
139  }
140 
145  virtual void GetServerList(ServerList& sl) { }
146 };
Definition: protocol.h:44
virtual void SendMetaData(User *user, const std::string &key, const std::string &data)
Definition: protocol.h:93
Definition: users.h:224
virtual void BroadcastEncap(const std::string &cmd, const parameterlist &params, User *source=NULL, User *omit=NULL)
Definition: protocol.h:79
virtual void SendMessage(User *target, const std::string &text, MessageType type=MSG_PRIVMSG)
Definition: protocol.h:120
virtual void SendMetaData(Channel *chan, const std::string &key, const std::string &data)
Definition: protocol.h:86
virtual void SendMetaData(const std::string &key, const std::string &data)
Definition: protocol.h:99
virtual void GetServerList(ServerList &sl)
Definition: protocol.h:145
virtual void SendMessage(Channel *target, char status, const std::string &text, MessageType type=MSG_PRIVMSG)
Definition: protocol.h:113
virtual void SendMetaData(const std::string &key, const std::string &data)=0
virtual bool SendEncapsulatedData(const std::string &targetmask, const std::string &cmd, const parameterlist &params, User *source=NULL)
Definition: protocol.h:69
void SendChannelNotice(Channel *target, char status, const std::string &text)
Definition: protocol.h:127
Definition: protocol.h:39
Definition: protocol.h:29
virtual void SendSNONotice(char snomask, const std::string &text)
Definition: protocol.h:105
Definition: channels.h:37
void SendUserNotice(User *target, const std::string &text)
Definition: protocol.h:136