InspIRCd  2.0
 All Classes Namespaces Functions Variables Typedefs Enumerations
protocol.h
1 /*
2  * InspIRCd -- Internet Relay Chat Daemon
3  *
4  * Copyright (C) 2008 Robin Burchell <robin+git@viroteck.net>
5  * Copyright (C) 2008 Craig Edwards <craigedwards@brainbox.cc>
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 #ifndef PROTOCOL_H
22 #define PROTOCOL_H
23 
24 #include "hashcomp.h"
25 
26 class User;
27 
28 typedef std::vector<std::string> parameterlist;
29 
31 {
32  public:
33  std::string servername;
34  std::string parentname;
35  std::string gecos;
36  unsigned int usercount;
37  unsigned int opercount;
38  unsigned int latencyms;
39 };
40 
41 typedef std::list<ProtoServer> ProtoServerList;
42 
44 {
45  public:
46  ProtocolInterface() { }
47  virtual ~ProtocolInterface() { }
48 
56  virtual bool SendEncapsulatedData(const parameterlist &encap) { return false; }
57 
63  virtual void SendMetaData(Extensible* target, const std::string &key, const std::string &data) { }
64 
69  virtual void SendTopic(Channel* channel, std::string &topic) { }
70 
76  virtual void SendMode(const std::string &target, const parameterlist &modedata, const std::vector<TranslateType> &translate) { }
77 
80  virtual void SendModeStr(const std::string &target, const std::string &modeline)
81  {
82  irc::spacesepstream x(modeline);
83  parameterlist n;
84  std::vector<TranslateType> types;
85  std::string v;
86  while (x.GetToken(v))
87  {
88  n.push_back(v);
89  types.push_back(TR_TEXT);
90  }
91  SendMode(target, n, types);
92  }
93 
98  virtual void SendSNONotice(const std::string &snomask, const std::string &text) { }
99 
104  virtual void PushToClient(User* target, const std::string &rawline) { }
105 
111  virtual void SendChannelPrivmsg(Channel* target, char status, const std::string &text) { }
112 
118  virtual void SendChannelNotice(Channel* target, char status, const std::string &text) { }
119 
124  virtual void SendUserPrivmsg(User* target, const std::string &text) { }
125 
130  virtual void SendUserNotice(User* target, const std::string &text) { }
131 
136  virtual void GetServerList(ProtoServerList &sl) { }
137 };
138 
139 #endif
140 
virtual void PushToClient(User *target, const std::string &rawline)
Definition: protocol.h:104
Definition: extensible.h:76
Definition: users.h:230
virtual void SendSNONotice(const std::string &snomask, const std::string &text)
Definition: protocol.h:98
virtual void SendModeStr(const std::string &target, const std::string &modeline)
Definition: protocol.h:80
Definition: hashcomp.h:420
virtual void SendMode(const std::string &target, const parameterlist &modedata, const std::vector< TranslateType > &translate)
Definition: protocol.h:76
virtual void SendUserPrivmsg(User *target, const std::string &text)
Definition: protocol.h:124
virtual void SendChannelNotice(Channel *target, char status, const std::string &text)
Definition: protocol.h:118
virtual void SendChannelPrivmsg(Channel *target, char status, const std::string &text)
Definition: protocol.h:111
virtual void GetServerList(ProtoServerList &sl)
Definition: protocol.h:136
virtual bool SendEncapsulatedData(const parameterlist &encap)
Definition: protocol.h:56
virtual bool GetToken(std::string &token)
Definition: hashcomp.cpp:306
Definition: protocol.h:30
virtual void SendMetaData(Extensible *target, const std::string &key, const std::string &data)
Definition: protocol.h:63
Definition: protocol.h:43
virtual void SendUserNotice(User *target, const std::string &text)
Definition: protocol.h:130
virtual void SendTopic(Channel *channel, std::string &topic)
Definition: protocol.h:69
Definition: channels.h:59