InspIRCd  3.0
protocol.h
1 /*
2  * InspIRCd -- Internet Relay Chat Daemon
3  *
4  * Copyright (C) 2018 Matt Schatz <[email protected]>
5  * Copyright (C) 2013-2014 Attila Molnar <[email protected]>
6  * Copyright (C) 2013, 2018-2019 Sadie Powell <[email protected]>
7  * Copyright (C) 2012, 2019 Robby <[email protected]>
8  * Copyright (C) 2008, 2010 Craig Edwards <[email protected]>
9  * Copyright (C) 2008 Robin Burchell <[email protected]>
10  *
11  * This file is part of InspIRCd. InspIRCd is free software: you can
12  * redistribute it and/or modify it under the terms of the GNU General Public
13  * License as published by the Free Software Foundation, version 2.
14  *
15  * This program is distributed in the hope that it will be useful, but WITHOUT
16  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 
25 #pragma once
26 
27 class User;
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 description;
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 CommandBase::Params& params, User* source = NULL) { return false; }
70 
79  virtual void BroadcastEncap(const std::string& cmd, const CommandBase::Params& 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  DEPRECATED_METHOD(void SendChannelNotice(Channel* target, char status, const std::string& text))
128  {
129  SendMessage(target, status, text, MSG_NOTICE);
130  }
131 
136  DEPRECATED_METHOD(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: channels.h:41
Definition: ctables.h:118
Definition: protocol.h:45
Definition: protocol.h:40
virtual void GetServerList(ServerList &sl)
Definition: protocol.h:145
virtual void SendMetaData(User *user, const std::string &key, const std::string &data)
Definition: protocol.h:93
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 bool SendEncapsulatedData(const std::string &targetmask, const std::string &cmd, const CommandBase::Params &params, User *source=NULL)
Definition: protocol.h:69
virtual void SendSNONotice(char snomask, const std::string &text)
Definition: protocol.h:105
virtual void SendMessage(Channel *target, char status, const std::string &text, MessageType type=MSG_PRIVMSG)
Definition: protocol.h:113
virtual void BroadcastEncap(const std::string &cmd, const CommandBase::Params &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
Definition: protocol.h:30
virtual void SendMetaData(const std::string &key, const std::string &data)=0
Definition: users.h:247