diff options
author | Roderic Morris <roderic@ccs.neu.edu> | 2008-06-25 21:12:44 +0000 |
---|---|---|
committer | Roderic Morris <roderic@ccs.neu.edu> | 2008-06-25 21:12:44 +0000 |
commit | a34a4692200eaf5b3ec8a7de75699a46aefd8b98 (patch) | |
tree | d73f15d55e7f784e99d92672f9ccbe69d64d7e69 /src/net/guildhandler.cpp | |
parent | a0b6e09737b7b416a38c08d8e1d6744a4cc12f7d (diff) | |
download | mana-a34a4692200eaf5b3ec8a7de75699a46aefd8b98.tar.gz mana-a34a4692200eaf5b3ec8a7de75699a46aefd8b98.tar.bz2 mana-a34a4692200eaf5b3ec8a7de75699a46aefd8b98.tar.xz mana-a34a4692200eaf5b3ec8a7de75699a46aefd8b98.zip |
handle topic changes and guild events
Diffstat (limited to 'src/net/guildhandler.cpp')
-rw-r--r-- | src/net/guildhandler.cpp | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/src/net/guildhandler.cpp b/src/net/guildhandler.cpp index 97453c39..151abe03 100644 --- a/src/net/guildhandler.cpp +++ b/src/net/guildhandler.cpp @@ -94,6 +94,7 @@ void GuildHandler::handleMessage(MessageIn &msg) if(msg.readInt8() == ERRMSG_OK) { std::string guildMember; + bool online; std::string guildName; Guild *guild; @@ -108,16 +109,15 @@ void GuildHandler::handleMessage(MessageIn &msg) while(msg.getUnreadLength()) { guildMember = msg.readString(); + online = msg.readInt8(); if(guildMember != "") { guild->addMember(guildMember); - guildWindow->setOnline(guildName, guildMember, false); + guildWindow->setOnline(guildName, guildMember, online); } } guildWindow->updateTab(); - - //Net::ChatServer::getUserList(guildName); } } break; @@ -126,12 +126,33 @@ void GuildHandler::handleMessage(MessageIn &msg) logger->log("Received CPMSG_GUILD_UPDATE_LIST"); short guildId = msg.readInt16(); std::string guildMember = msg.readString(); + char eventId = msg.readInt8(); Guild *guild = player_node->getGuild(guildId); if (guild) { - guild->addMember(guildMember); - guildWindow->setOnline(guild->getName(), guildMember, true); + switch(eventId) + { + case GUILD_EVENT_NEW_PLAYER: + guild->addMember(guildMember); + guildWindow->setOnline(guild->getName(), guildMember, true); + break; + + case GUILD_EVENT_LEAVING_PLAYER: + guild->removeMember(guildMember); + break; + + case GUILD_EVENT_ONLINE_PLAYER: + guildWindow->setOnline(guild->getName(), guildMember, true); + break; + + case GUILD_EVENT_OFFLINE_PLAYER: + guildWindow->setOnline(guild->getName(), guildMember, false); + break; + + default: + logger->log("Invalid guild event"); + } } guildWindow->updateTab(); @@ -195,5 +216,5 @@ void GuildHandler::joinedGuild(MessageIn &msg) Channel *channel = new Channel(channelId, guildName, announcement); channelManager->addChannel(channel); chatWindow->createNewChannelTab(guildName); - chatWindow->chatLog("Announcement: " + announcement, BY_CHANNEL, guildName); + chatWindow->chatLog("Topic: " + announcement, BY_CHANNEL, guildName); } |