diff options
author | Roderic Morris <roderic@ccs.neu.edu> | 2008-06-10 00:45:21 +0000 |
---|---|---|
committer | Roderic Morris <roderic@ccs.neu.edu> | 2008-06-10 00:45:21 +0000 |
commit | f6f031fa4db6fa0ccd6e0b433f61479e9fd85477 (patch) | |
tree | f68634271d7e7f315c122ed7a3a08ad1d05b58b6 /src/net | |
parent | 2cf38d37f86c5e5d82d77713afd093735db0598a (diff) | |
download | mana-f6f031fa4db6fa0ccd6e0b433f61479e9fd85477.tar.gz mana-f6f031fa4db6fa0ccd6e0b433f61479e9fd85477.tar.bz2 mana-f6f031fa4db6fa0ccd6e0b433f61479e9fd85477.tar.xz mana-f6f031fa4db6fa0ccd6e0b433f61479e9fd85477.zip |
add commandhandler class and fix / add some commands
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/chathandler.cpp | 33 | ||||
-rw-r--r-- | src/net/guildhandler.cpp | 7 |
2 files changed, 20 insertions, 20 deletions
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); } |