diff options
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/channel.cpp | 18 | ||||
-rw-r--r-- | src/channel.h | 19 | ||||
-rw-r--r-- | src/commandhandler.cpp | 189 | ||||
-rw-r--r-- | src/commandhandler.h | 109 | ||||
-rw-r--r-- | src/game.cpp | 4 | ||||
-rw-r--r-- | src/gui/chat.cpp | 134 | ||||
-rw-r--r-- | src/gui/chat.h | 51 | ||||
-rw-r--r-- | src/net/chathandler.cpp | 33 | ||||
-rw-r--r-- | src/net/guildhandler.cpp | 7 |
12 files changed, 389 insertions, 191 deletions
@@ -1,3 +1,15 @@ +2008-06-09 Roderic Morris <roderic@ccs.neu.edu> + + * src/commandhandler.cpp, src/commandhandler.h, + src/game.cpp, src/CMakeLists.txt, src/Makefile.am: + Add a command handler class to handle commands issued by + the user. + * src/gui/chat.cpp, src/gui/chat.h, src/net/chathandler.cpp, + src/net/guildhandler.cpp: Display messages about chats in + green, and take command parsing code out of the chat dialog, + * src/channel.cpp, src/channel.h: Don't store channel users, + its handled with packets. + 2008-06-03 Roderic Morris <roderic@ccs.neu.edu> * src/gui/chat.cpp, src/gui/chat.h, src/net/guildhandler.cpp: diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7fd5983e..80d0a17a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -328,6 +328,8 @@ SET(SRCS channel.h channelmanager.cpp channelmanager.h + commandhandler.cpp + commandhandler.h configlistener.h configuration.cpp configuration.h diff --git a/src/Makefile.am b/src/Makefile.am index 75e81951..0bbfdc20 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -282,6 +282,8 @@ tmw_SOURCES = gui/widgets/dropdown.cpp \ channel.h \ channelmanager.cpp \ channelmanager.h \ + commandhandler.cpp \ + commandhandler.h \ configlistener.h \ configuration.cpp \ configuration.h \ diff --git a/src/channel.cpp b/src/channel.cpp index 2bebcf51..969386f1 100644 --- a/src/channel.cpp +++ b/src/channel.cpp @@ -21,7 +21,6 @@ * $Id$ */ -#include <algorithm> #include "channel.h" @@ -34,20 +33,3 @@ Channel::Channel(short id, { } - -void Channel::addUser(const std::string &user) -{ - // Check if the user already exists in the channel - ChannelUsers::const_iterator i = mUserList.begin(), - i_end = mUserList.end(); - if (std::find(i, i_end, user) != i_end) return; - mUserList.push_back(user); -} - -void Channel::removeUser(const std::string &user) -{ - ChannelUsers::iterator i_end = mUserList.end(), - i = std::find(mUserList.begin(), i_end, user); - if (i == i_end) return; - mUserList.erase(i); -} diff --git a/src/channel.h b/src/channel.h index 9f7557c1..3cb38a1c 100644 --- a/src/channel.h +++ b/src/channel.h @@ -27,8 +27,6 @@ class Channel { public: - - typedef std::vector<std::string> ChannelUsers; /** * Constructor. @@ -59,12 +57,6 @@ class Channel { return mAnnouncement; } /** - * Get the list of users in this channel - */ - const ChannelUsers& getUserList() const - { return mUserList; } - - /** * Sets the name of the channel. */ void setName(const std::string &channelName) @@ -76,20 +68,9 @@ class Channel void setAnnouncement(const std::string &channelAnnouncement) { mAnnouncement = channelAnnouncement; } - /** - * Adds a user to this channel. - */ - void addUser(const std::string &user); - - /** - * Removes a user from the channel. - */ - void removeUser(const std::string &user); - private: unsigned short mId; std::string mName; std::string mAnnouncement; - ChannelUsers mUserList; }; diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp new file mode 100644 index 00000000..07184f66 --- /dev/null +++ b/src/commandhandler.cpp @@ -0,0 +1,189 @@ +/* + * The Mana World + * Copyright 2008 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + */ + + +#include "commandhandler.h" +#include "channelmanager.h" +#include "channel.h" +#include "game.h" +#include "gui/chat.h" +#include "net/chatserver/chatserver.h" +#include "net/gameserver/player.h" + +void CommandHandler::handleCommand(const std::string &command) +{ + std::string::size_type pos = command.find(' '); + std::string type(command, 0, pos); + std::string args(command, pos == std::string::npos ? command.size() : pos + 1); + + if (type == "announce") + { + handleAnnounce(args); + } + else if (type == "help") + { + handleHelp(); + } + else if (type == "where") + { + handleWhere(); + } + else if (type == "who") + { + handleWho(); + } + else if (type == "msg") + { + handleMsg(args); + } + else if (type == "channel") + { + handleChannel(args); + } + else if (type == "join") + { + handleJoin(args); + } + else if (type == "listchannels") + { + handleListChannels(); + } + else if (type == "listusers") + { + handleListUsers(); + } + else if (type == "quit") + { + handleQuit(); + } + else if (type == "admin") + { + Net::GameServer::Player::say("/" + args); + } + else if (type == "clear") + { + handleClear(); + } + else + { + chatWindow->chatLog("Unknown command"); + } +} + +void CommandHandler::handleAnnounce(const std::string &args) +{ + Net::ChatServer::announce(args); +} + +void CommandHandler::handleHelp() +{ + chatWindow->chatLog("-- Help --"); + chatWindow->chatLog("/help > Display this help."); + chatWindow->chatLog("/announce > Global announcement (GM only)"); + chatWindow->chatLog("/where > Display map name"); + chatWindow->chatLog("/who > Display number of online users"); + chatWindow->chatLog("/msg > Send a private message to a user"); + chatWindow->chatLog("/listchannels > Display all public channels"); + chatWindow->chatLog("/listusers > Lists the users in the current channel"); + chatWindow->chatLog("/channel > Register a new channel"); + chatWindow->chatLog("/join > Join an already registered channel"); + chatWindow->chatLog("/quit > Leave a channel"); + chatWindow->chatLog("/admin > Send a command to the server (GM only)"); + chatWindow->chatLog("/clear > Clears this window"); +} + +void CommandHandler::handleWhere() +{ + chatWindow->chatLog(map_path, BY_SERVER); +} + +void CommandHandler::handleWho() +{ + +} + +void CommandHandler::handleMsg(const std::string &args) +{ + std::string::size_type pos = args.find(' '); + std::string recipient(args, 0, pos); + std::string text(args, pos+1); + Net::ChatServer::privMsg(recipient, text); +} + +void CommandHandler::handleChannel(const std::string &args) +{ + std::string::size_type pos = args.find(" "); + std::string name(args, 0, pos); + std::string password; + std::string announcement; + if(pos == std::string::npos) + { + password = std::string(); + announcement = std::string(); + } + else + { + password = std::string(args, pos + 1, args.find(" ", pos + 1) - pos - 1); + pos = args.find("\""); + announcement = std::string(args, pos == std::string::npos ? args.size() : + pos + 1, args.size() - pos - 2); + } + chatWindow->chatLog("Requesting to register channel " + name); + Net::ChatServer::registerChannel(name, announcement, password); +} + +void CommandHandler::handleJoin(const std::string &args) +{ + std::string::size_type pos = args.find(' '); + std::string name(args, 0, pos); + std::string password(args, pos+1); + chatWindow->chatLog("Requesting to join channel " + name); + Net::ChatServer::enterChannel(name, password); +} + +void CommandHandler::handleListChannels() +{ + Net::ChatServer::getChannelList(); +} + +void CommandHandler::handleListUsers() +{ + Net::ChatServer::getUserList(chatWindow->getFocused()); +} + +void CommandHandler::handleQuit() +{ + if (Channel *channel = channelManager->findByName(chatWindow->getFocused())) + { + Net::ChatServer::quitChannel(channel->getId()); + } + else + { + chatWindow->chatLog("Unable to quit this channel", BY_CHANNEL); + } +} + +void CommandHandler::handleClear() +{ + chatWindow->clearTab(chatWindow->getFocused()); +} diff --git a/src/commandhandler.h b/src/commandhandler.h new file mode 100644 index 00000000..b409c5f5 --- /dev/null +++ b/src/commandhandler.h @@ -0,0 +1,109 @@ +/* + * The Mana World + * Copyright 2008 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + */ + +#ifndef _TMW_COMMANDHANDLER_H +#define _TMW_COMMANDHANDLER_H + +#include <string> + +/** + * A class to parse and handle user commands + */ +class CommandHandler +{ + public: + /** + * Constructor + */ + CommandHandler() {} + + /** + * Destructor + */ + ~CommandHandler() {} + + /** + * Parse and handle the given command. + */ + void handleCommand(const std::string &command); + + private: + /** + * Handle an announce command. + */ + void handleAnnounce(const std::string &args); + + /** + * Handle a help command. + */ + void handleHelp(); + + /** + * Handle a where command. + */ + void handleWhere(); + + /** + * Handle a who command. + */ + void handleWho(); + + /** + * Handle a msg command. + */ + void handleMsg(const std::string &args); + + /** + * Handle a channel command. + */ + void handleChannel(const std::string &args); + + /** + * Handle a join command. + */ + void handleJoin(const std::string &args); + + /** + * Handle a listchannels command. + */ + void handleListChannels(); + + /** + * Handle a listusers command. + */ + void handleListUsers(); + + /** + * Handle a quit command. + */ + void handleQuit(); + + /** + * Handle a clear command. + */ + void handleClear(); +}; + +extern CommandHandler *commandHandler; + +#endif //_TMW_COMMANDHANDLER_H diff --git a/src/game.cpp b/src/game.cpp index 8860d4c4..789a13f6 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -32,6 +32,7 @@ #include "beingmanager.h" #include "channelmanager.h" +#include "commandhandler.h" #include "configuration.h" #include "engine.h" #include "flooritemmanager.h" @@ -129,6 +130,7 @@ PartyWindow *partyWindow; BeingManager *beingManager = NULL; FloorItemManager *floorItemManager = NULL; ChannelManager *channelManager = NULL; +CommandHandler *commandHandler = NULL; Particle *particleEngine = NULL; @@ -279,6 +281,7 @@ Game::Game(): beingManager = new BeingManager; floorItemManager = new FloorItemManager(); channelManager = new ChannelManager(); + commandHandler = new CommandHandler(); particleEngine = new Particle(NULL); particleEngine->setupEngine(); @@ -324,6 +327,7 @@ Game::~Game() delete beingManager; delete floorItemManager; delete channelManager; + delete commandHandler; delete joystick; delete particleEngine; delete engine; diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index e7b82621..ba9ef8ee 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -37,6 +37,7 @@ #include "widgets/tab.h" #include "widgets/tabbedarea.h" +#include "../commandhandler.h" #include "../channelmanager.h" #include "../channel.h" #include "../configuration.h" @@ -96,6 +97,18 @@ ChatWindow::~ChatWindow() delete mChatTabs; } +const std::string& ChatWindow::getFocused() const +{ + return mChatTabs->getSelectedTab()->getCaption(); +} + +void ChatWindow::clearTab(const std::string &tab) +{ + ChannelMap::const_iterator chan = mChannels.find(tab); + if (chan != mChannels.end()) + chan->second.browser->clearRows(); +} + void ChatWindow::widgetResized(const gcn::Event &event) { Window::widgetResized(event); @@ -122,8 +135,11 @@ void ChatWindow::widgetResized(const gcn::Event &event) } void -ChatWindow::chatLog(std::string line, int own, const std::string &channelName) +ChatWindow::chatLog(std::string line, int own, std::string channelName) { + if(channelName == "getFocused\"") + channelName = getFocused(); + ChannelMap::const_iterator chan = mChannels.find(channelName); if (chan == mChannels.end()) return; @@ -164,6 +180,10 @@ ChatWindow::chatLog(std::string line, int own, const std::string &channelName) tmp.text = line; lineColor = "##7"; // Equiv. to BrowserBox::PINK break; + case BY_CHANNEL: + tmp.nick = ""; + lineColor = "##2"; // Equiv. to BrowserBox::GREEN + break; case BY_LOGGER: tmp.nick = ""; tmp.text = line; @@ -220,8 +240,7 @@ ChatWindow::action(const gcn::ActionEvent &event) mCurHist = mHistory.end(); // Send the message to the server - gcn::Tab *tab = mChatTabs->getSelectedTab(); - chatSend(player_node->getName(), message, tab->getCaption()); + chatSend(message); // Clear the text from the chat input mChatInput->setText(""); @@ -265,115 +284,29 @@ ChatWindow::isFocused() return mChatInput->isFocused(); } -void ChatWindow::chatSend(std::string const &nick, std::string const &msg, - std::string const &channelName) +void ChatWindow::chatSend(std::string const &msg) { - /* Some messages are managed client side, while others - * require server handling by proper packet. Probably - * those if elses should be replaced by protocol calls */ - if (msg.empty()) return; // Prepare ordinary message - if (msg[0] != '/') { - gcn::Tab *tab = mChatTabs->getSelectedTab(); - if (tab->getCaption() == "General") + if (msg[0] != '/') + { + if (getFocused() == "General") { Net::GameServer::Player::say(msg); } else { - Channel *channel = channelManager->findByName(channelName); + Channel *channel = channelManager->findByName(getFocused()); if (channel) { - int channelId = channel->getId(); - Net::ChatServer::chat(channelId, msg); + Net::ChatServer::chat(channel->getId(), msg); } } - return; - } - - std::string::size_type pos = msg.find(' ', 1); - std::string command(msg, 1, pos == std::string::npos ? pos : pos - 1); - std::string arg(msg, pos == std::string::npos ? msg.size() : pos + 1); - - if (command == "announce") - { - Net::ChatServer::announce(arg); - } - else if (command == "help") - { - chatLog("-- Help --", BY_SERVER, channelName); - chatLog("/help > Display this help.", BY_SERVER, channelName); - chatLog("/announce > Global announcement (GM only)", BY_SERVER, channelName); - chatLog("/where > Display map name", BY_SERVER, channelName); - chatLog("/who > Display number of online users", BY_SERVER, channelName); - chatLog("/msg > Send a private message to a user", BY_SERVER, channelName); - chatLog("/list > Display all public channels", BY_SERVER, channelName); - chatLog("/register > Register a new channel", BY_SERVER, channelName); - chatLog("/join > Join an already registered channel", BY_SERVER, channelName); - chatLog("/quit > Leave a channel", BY_SERVER, channelName); - chatLog("/admin > Send a command to the server (GM only)", BY_SERVER, channelName); - chatLog("/clear > Clears this window", BY_SERVER); - } - else if (command == "where") - { - chatLog(map_path, BY_SERVER); - } - else if (command == "who") - { - // XXX Convert for new server - /* - MessageOut outMsg(0x00c1); - */ - } - else if (command == "msg") - { - std::string::size_type pos = arg.find(' ', 1); - std::string recipient(arg, 0, pos); - std::string text(arg, pos+1); - Net::ChatServer::privMsg(recipient, text); - } - else if (command == "register") - { - // TODO: Parse the announcement and password - chatLog("Requesting to register channel " + arg, BY_SERVER); - Net::ChatServer::registerChannel(arg, "", ""); - } - else if (command == "join") - { - //TODO: have passwords too - chatLog("Requesting to join channel " + arg, BY_SERVER); - enterChannel(arg, "None"); - } - else if (command == "list") - { - Net::ChatServer::getChannelList(); - } - else if (command == "quit") - { - if (Channel *channel = channelManager->findByName(channelName)) - { - Net::ChatServer::quitChannel(channel->getId()); - } - else - { - chatLog("Unable to quit this channel", BY_SERVER); - } - } - else if (command == "admin") - { - Net::GameServer::Player::say("/" + arg); - } - else if (command == "clear") - { - ChannelMap::const_iterator chan = mChannels.find(channelName); - if (chan != mChannels.end()) - chan->second.browser->clearRows(); } else { - chatLog("Unknown command", BY_SERVER, channelName); + commandHandler->handleCommand(std::string(msg, 1)); } } @@ -429,20 +362,11 @@ ChatWindow::createNewChannelTab(const std::string &channelName) mChannels.insert( std::make_pair(channelName, ChatArea(textOutput, scrollArea))); - // Ask for channel users - Net::ChatServer::getUserList(channelName); - // Update UI logic(); } void -ChatWindow::enterChannel(const std::string &channel, const std::string &password) -{ - Net::ChatServer::enterChannel(channel, password); -} - -void ChatWindow::sendToChannel(short channelId, const std::string &user, const std::string &msg) { Channel *channel = channelManager->findById(channelId); diff --git a/src/gui/chat.h b/src/gui/chat.h index 148feb7e..a999f8fc 100644 --- a/src/gui/chat.h +++ b/src/gui/chat.h @@ -46,6 +46,7 @@ enum BY_PLAYER = 1, BY_OTHER = 2, BY_SERVER = 3, + BY_CHANNEL = 4, BY_LOGGER }; @@ -74,14 +75,27 @@ class ChatWindow : public Window, * the tabbed area. */ void widgetResized(const gcn::Event &event); + + /** + * Gets the focused tab's name + */ + const std::string& getFocused() const; + + /** + * Clear the tab with the given name + */ + void clearTab(const std::string &tab); /** * Adds a line of text to our message list. Parameters: * * @param line Text message. - * @parem own Type of message (usually the owner-type). + * @param own Type of message (usually the owner-type). + * @param channelName which channel to send the message to. */ - void chatLog(std::string line, int own, const std::string &channelName = "General"); + void chatLog(std::string line, + int own = BY_SERVER, + std::string channelName = "getFocused\""); /** * Performs action. @@ -99,31 +113,14 @@ class ChatWindow : public Window, bool isFocused(); /** - * Determines whether to send a command or an ordinary message, then - * contructs packets & sends them. + * Determines whether the message is a command or message, then + * sends the given message to the game server to be said, or to the + * command handler + * + * @param msg The message text which is to be sent. * - * @param nick The character's name to display in front. - * @param msg The message text which is to be send. - * - * NOTE: - * The nickname is required by the server, if not specified - * the message may not be sent unless a command was intended - * which requires another packet to be constructed! you can - * achieve this by putting a slash ("/") infront of the - * message followed by the command name and the message. - * of course all slash-commands need implemented handler- - * routines. ;-) - * remember, a line starting with "@" is not a command that needs - * to be parsed rather is sent using the normal chat-packet. - * - * EXAMPLE: - * // for an global announcement /- command - * chatlog.chat_send("", "/announce Hello to all logged in users!"); - * // for simple message by a user /- message - * chatlog.chat_send("Zaeiru", "Hello to all users on the screen!"); */ - void chatSend(std::string const &nick, std::string const &msg, - std::string const &channelName); + void chatSend(std::string const &msg); /** Called to remove the channel from the channel manager */ void @@ -139,10 +136,6 @@ class ChatWindow : public Window, void createNewChannelTab(const std::string &channelName); - /** Called to join channel */ - void - enterChannel(const std::string &channel, const std::string &password = "None"); - /** Called to output text to a specific channel */ void sendToChannel(short channel, const std::string &user, const std::string &msg); diff --git a/src/net/chathandler.cpp b/src/net/chathandler.cpp index aa090d64..ac91c553 100644 --- a/src/net/chathandler.cpp +++ b/src/net/chathandler.cpp @@ -122,12 +122,12 @@ void ChatHandler::handleGameChatMessage(MessageIn &msg) if (being) { chatWindow->chatLog(being->getName() + " : " + chatMsg, - being == player_node ? BY_PLAYER : BY_OTHER); + being == player_node ? BY_PLAYER : BY_OTHER, "General"); being->setSpeech(chatMsg, SPEECH_TIME); } else { - chatWindow->chatLog("Unknown : " + chatMsg, BY_OTHER); + chatWindow->chatLog("Unknown : " + chatMsg, BY_OTHER, "General"); } } @@ -139,7 +139,7 @@ void ChatHandler::handleRegisterChannelResponse(MessageIn &msg) short channelId = msg.readInt16(); std::string channelName = msg.readString(); std::string channelAnnouncement = msg.readString(); - chatWindow->chatLog("Registered Channel " + channelName, BY_SERVER); + chatWindow->chatLog("Registered Channel " + channelName); channelManager->addChannel(new Channel(channelId, channelName, channelAnnouncement)); @@ -166,17 +166,20 @@ void ChatHandler::handleEnterChannelResponse(MessageIn &msg) std::string channelName = msg.readString(); std::string announcement = msg.readString(); Channel *channel = new Channel(channelId, channelName, announcement); + channelManager->addChannel(channel); + chatWindow->createNewChannelTab(channelName); + chatWindow->chatLog("Announcement: " + announcement, BY_CHANNEL, channelName); + std::string user; + chatWindow->chatLog("Players in this channel:", BY_CHANNEL, channelName); while(msg.getUnreadLength()) { user = msg.readString(); if (user == "") return; - channel->addUser(user); + chatWindow->chatLog(user, BY_CHANNEL, channelName); } - channelManager->addChannel(channel); - chatWindow->createNewChannelTab(channelName); - chatWindow->chatLog(announcement, BY_SERVER, channelName); + } else { @@ -194,12 +197,9 @@ void ChatHandler::handleListChannelsResponse(MessageIn &msg) return; std::ostringstream numUsers; numUsers << msg.readInt16(); - if(channelName != "") - { - channelName += " - "; - channelName += numUsers.str(); - chatWindow->chatLog(channelName, BY_SERVER); - } + channelName += " - "; + channelName += numUsers.str(); + chatWindow->chatLog(channelName, BY_SERVER); } chatWindow->chatLog("End of channel list", BY_SERVER); } @@ -244,8 +244,9 @@ void ChatHandler::handleQuitChannelResponse(MessageIn &msg) void ChatHandler::handleListChannelUsersResponse(MessageIn &msg) { - std::string channelName = msg.readString(); + std::string channel = msg.readString(); std::string userNick; + chatWindow->chatLog("Players in this channel:", BY_CHANNEL, channel); while(msg.getUnreadLength()) { userNick = msg.readString(); @@ -253,7 +254,7 @@ void ChatHandler::handleListChannelUsersResponse(MessageIn &msg) { break; } - guildWindow->setOnline(channelName, userNick, true); + chatWindow->chatLog(userNick, BY_CHANNEL, channel); } } @@ -280,7 +281,7 @@ void ChatHandler::handleChannelEvent(MessageIn &msg) line = "Unknown channel event."; } - chatWindow->chatLog(line, BY_SERVER, channel->getName()); + chatWindow->chatLog(line, BY_CHANNEL, channel->getName()); } } diff --git a/src/net/guildhandler.cpp b/src/net/guildhandler.cpp index 10da5075..97453c39 100644 --- a/src/net/guildhandler.cpp +++ b/src/net/guildhandler.cpp @@ -117,7 +117,7 @@ void GuildHandler::handleMessage(MessageIn &msg) guildWindow->updateTab(); - Net::ChatServer::getUserList(guildName); + //Net::ChatServer::getUserList(guildName); } } break; @@ -131,8 +131,7 @@ void GuildHandler::handleMessage(MessageIn &msg) if (guild) { guild->addMember(guildMember); - guildWindow->setOnline(guild->getName(), guildMember, false); - Net::ChatServer::getUserList(guild->getName()); + guildWindow->setOnline(guild->getName(), guildMember, true); } guildWindow->updateTab(); @@ -196,5 +195,5 @@ void GuildHandler::joinedGuild(MessageIn &msg) Channel *channel = new Channel(channelId, guildName, announcement); channelManager->addChannel(channel); chatWindow->createNewChannelTab(guildName); - chatWindow->chatLog(announcement, BY_SERVER, guildName); + chatWindow->chatLog("Announcement: " + announcement, BY_CHANNEL, guildName); } |