ManaPlus
channeltab.cpp
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2008-2009 The Mana World Development Team
4  * Copyright (C) 2009-2010 The Mana Developers
5  * Copyright (C) 2011-2017 The ManaPlus Developers
6  *
7  * This file is part of The ManaPlus Client.
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
24 
26 
27 #include "gui/windows/chatwindow.h"
28 
29 #include "net/chathandler.h"
30 
31 #include "debug.h"
32 
33 ChannelTab::ChannelTab(const Widget2 *const widget,
34  const std::string &channel) :
35  ChatTab(widget, channel, channel, channel, ChatTabType::CHANNEL)
36 {
38 }
39 
41 {
42  if (chatWindow != nullptr)
44 }
45 
46 void ChannelTab::handleInput(const std::string &msg)
47 {
48  std::string newMsg;
49  newMsg = ChatWindow::doReplace(msg);
51 }
52 
53 bool ChannelTab::handleCommand(const std::string &restrict type,
54  const std::string &restrict args A_UNUSED)
55 {
56  if (type == "close")
57  {
58  if (windowContainer != nullptr)
60  else
61  delete this;
62  if (chatWindow != nullptr)
64  }
65  else
66  {
67  return false;
68  }
69 
70  return true;
71 }
72 
74 {
75  commands.push_back("/close");
76  commands.push_back(mChannelName);
77 }
void removeChannel(const std::string &nick)
Definition: chatwindow.cpp:598
ChatWindow * chatWindow
Definition: chatwindow.cpp:88
void scheduleDelete(Widget *const widget)
WindowContainer * windowContainer
void getAutoCompleteCommands(StringVect &commands) const
Definition: channeltab.cpp:73
bool handleCommand(const std::string &type, const std::string &args)
Definition: channeltab.cpp:53
bool msg(InputEvent &event)
Definition: chat.cpp:38
std::vector< std::string > StringVect
Definition: stringvector.h:28
ChannelTab(const Widget2 *const widget, const std::string &channel)
Definition: channeltab.cpp:33
#define setTabColors(name)
Definition: chattab.h:45
static std::string doReplace(const std::string &msg)
void defaultTab()
Definition: chatwindow.cpp:426
#define A_UNUSED
Definition: localconsts.h:171
Net::ChatHandler * chatHandler
Definition: net.cpp:80
std::string mChannelName
Definition: chattab.h:204
#define restrict
Definition: localconsts.h:176
virtual void channelMessage(const std::string &channel, const std::string &text) const =0
void handleInput(const std::string &msg)
Definition: channeltab.cpp:46