InspIRCd  4.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  size_t usercount;
51  size_t opercount;
52  unsigned long latencyms;
53  };
54 
55  typedef std::vector<ServerInfo> ServerList;
56 
57  virtual ~ProtocolInterface() = default;
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(const Channel* chan, const std::string& key, const std::string& data) { }
87 
93  virtual void SendMetaData(const User* user, const std::string& key, const std::string& data) { }
94 
100  virtual void SendMetaData(const Membership* memb, const std::string& key, const std::string& data) { }
101 
106  virtual void SendMetaData(const std::string& key, const std::string& data) { }
107 
112  virtual void SendSNONotice(char snomask, const std::string& text) { }
113 
120  virtual void SendMessage(Channel* target, char status, const std::string& text, MessageType type = MSG_PRIVMSG) { }
121 
127  virtual void SendMessage(User* target, const std::string& text, MessageType type = MSG_PRIVMSG) { }
128 
132  virtual void GetServerList(ServerList& sl) { }
133 };
Definition: channels.h:41
Definition: ctables.h:128
Definition: membership.h:36
Definition: protocol.h:45
Definition: protocol.h:40
virtual void SendMetaData(const User *user, const std::string &key, const std::string &data)
Definition: protocol.h:93
virtual void GetServerList(ServerList &sl)
Definition: protocol.h:132
virtual void SendMetaData(const std::string &key, const std::string &data)
Definition: protocol.h:106
virtual void SendMetaData(const Channel *chan, const std::string &key, const std::string &data)
Definition: protocol.h:86
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:112
virtual void SendMetaData(const Membership *memb, const std::string &key, const std::string &data)
Definition: protocol.h:100
virtual void SendMessage(Channel *target, char status, const std::string &text, MessageType type=MSG_PRIVMSG)
Definition: protocol.h:120
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:127
Definition: protocol.h:30
virtual void SendMetaData(const std::string &key, const std::string &data)=0
Definition: users.h:238