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 #include "hashcomp.h"
28 
29 class User;
30 
32 {
33  public:
38  virtual void SendMetaData(const std::string& key, const std::string& data) = 0;
39 };
40 
41 class CoreExport ProtocolInterface
42 {
43  public:
44  typedef ProtocolServer Server;
45 
46  class ServerInfo
47  {
48  public:
49  std::string servername;
50  std::string parentname;
51  std::string description;
52  unsigned int usercount;
53  unsigned int opercount;
54  unsigned int latencyms;
55  };
56 
57  typedef std::vector<ServerInfo> ServerList;
58 
59  virtual ~ProtocolInterface() { }
60 
71  virtual bool SendEncapsulatedData(const std::string& targetmask, const std::string& cmd, const CommandBase::Params& params, User* source = NULL) { return false; }
72 
81  virtual void BroadcastEncap(const std::string& cmd, const CommandBase::Params& params, User* source = NULL, User* omit = NULL) { }
82 
88  virtual void SendMetaData(Channel* chan, const std::string& key, const std::string& data) { }
89 
95  virtual void SendMetaData(User* user, const std::string& key, const std::string& data) { }
96 
101  virtual void SendMetaData(const std::string& key, const std::string& data) { }
102 
107  virtual void SendSNONotice(char snomask, const std::string& text) { }
108 
115  virtual void SendMessage(Channel* target, char status, const std::string& text, MessageType type = MSG_PRIVMSG) { }
116 
122  virtual void SendMessage(User* target, const std::string& text, MessageType type = MSG_PRIVMSG) { }
123 
129  DEPRECATED_METHOD(void SendChannelNotice(Channel* target, char status, const std::string& text))
130  {
131  SendMessage(target, status, text, MSG_NOTICE);
132  }
133 
138  DEPRECATED_METHOD(void SendUserNotice(User* target, const std::string& text))
139  {
140  SendMessage(target, text, MSG_NOTICE);
141  }
142 
147  virtual void GetServerList(ServerList& sl) { }
148 };
ProtocolInterface::SendEncapsulatedData
virtual bool SendEncapsulatedData(const std::string &targetmask, const std::string &cmd, const CommandBase::Params &params, User *source=NULL)
Definition: protocol.h:71
ProtocolInterface::SendSNONotice
virtual void SendSNONotice(char snomask, const std::string &text)
Definition: protocol.h:107
ProtocolInterface::SendUserNotice
void SendUserNotice(User *target, const std::string &text)
Definition: protocol.h:138
ProtocolServer::SendMetaData
virtual void SendMetaData(const std::string &key, const std::string &data)=0
ProtocolInterface::SendChannelNotice
void SendChannelNotice(Channel *target, char status, const std::string &text)
Definition: protocol.h:129
ProtocolInterface::SendMetaData
virtual void SendMetaData(User *user, const std::string &key, const std::string &data)
Definition: protocol.h:95
ProtocolInterface::SendMessage
virtual void SendMessage(User *target, const std::string &text, MessageType type=MSG_PRIVMSG)
Definition: protocol.h:122
ProtocolInterface
Definition: protocol.h:41
ProtocolInterface::GetServerList
virtual void GetServerList(ServerList &sl)
Definition: protocol.h:147
ProtocolServer
Definition: protocol.h:31
Channel
Definition: channels.h:40
ProtocolInterface::SendMessage
virtual void SendMessage(Channel *target, char status, const std::string &text, MessageType type=MSG_PRIVMSG)
Definition: protocol.h:115
ProtocolInterface::SendMetaData
virtual void SendMetaData(Channel *chan, const std::string &key, const std::string &data)
Definition: protocol.h:88
ProtocolInterface::SendMetaData
virtual void SendMetaData(const std::string &key, const std::string &data)
Definition: protocol.h:101
User
Definition: users.h:233
ProtocolInterface::ServerInfo
Definition: protocol.h:46
ProtocolInterface::BroadcastEncap
virtual void BroadcastEncap(const std::string &cmd, const CommandBase::Params &params, User *source=NULL, User *omit=NULL)
Definition: protocol.h:81
CommandBase::Params
Definition: ctables.h:117