summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--src/gui/chat.cpp3
-rw-r--r--src/net/chathandler.cpp75
3 files changed, 16 insertions, 68 deletions
diff --git a/ChangeLog b/ChangeLog
index b44d0185..add6d288 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-05-30 Roderic Morris <roderic@ccs.neu.edu>
+
+ * src/gui/chat.cpp, src/net/chathandler.cpp: Fixed handling of
+ announce messages and private messages. Don't cut off the last
+ character from pm recipient's name. Got rid of old eAthena code.
+
2008-05-22 Roderic Morris <roderic@ccs.neu.edu>
* src/gui/widgets/tab.cpp, src/utils/sha256.cpp: Fix compile errors
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index a7248b3f..3748b31c 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -338,9 +338,8 @@ void ChatWindow::chatSend(std::string const &nick, std::string const &msg,
else if (command == "msg")
{
std::string::size_type pos = arg.find(' ', 1);
- std::string recipient(arg, 0, pos-1);
+ std::string recipient(arg, 0, pos);
std::string text(arg, pos+1);
- chatLog("* " + text, BY_SERVER);
Net::ChatServer::privMsg(recipient, text);
}
else if (command == "register")
diff --git a/src/net/chathandler.cpp b/src/net/chathandler.cpp
index dac6bb86..824d6e8c 100644
--- a/src/net/chathandler.cpp
+++ b/src/net/chathandler.cpp
@@ -49,15 +49,10 @@ ChatHandler::ChatHandler()
CPMSG_ENTER_CHANNEL_RESPONSE,
CPMSG_LIST_CHANNELS_RESPONSE,
CPMSG_PUBMSG,
+ CPMSG_ANNOUNCEMENT,
+ CPMSG_PRIVMSG,
CPMSG_QUIT_CHANNEL_RESPONSE,
CPMSG_LIST_CHANNELUSERS_RESPONSE,
- /*
- SMSG_BEING_CHAT,
- SMSG_PLAYER_CHAT,
- SMSG_GM_CHAT,
- SMSG_WHO_ANSWER,
- 0x10c, // MVP
- */
0
};
handledMessages = _messages;
@@ -167,8 +162,14 @@ void ChatHandler::handleMessage(MessageIn &msg)
if (!chatWindow->tabExists(userNick))
{
chatWindow->createNewChannelTab(userNick);
- chatWindow->chatLog(userNick + ": " + chatMsg, BY_OTHER, userNick);
+
}
+ chatWindow->chatLog(userNick + ": " + chatMsg, BY_OTHER, userNick);
+ break;
+
+ case CPMSG_ANNOUNCEMENT:
+ chatMsg = msg.readString();
+ chatWindow->chatLog(chatMsg, BY_GM);
break;
case CPMSG_PUBMSG:
@@ -200,63 +201,5 @@ void ChatHandler::handleMessage(MessageIn &msg)
guildWindow->setOnline(channelName, userNick, true);
}
break;
- /*
- // Received speech from being
- case SMSG_BEING_CHAT:
- chatMsgLength = msg.readInt16() - 8;
- being = beingManager->findBeing(msg.readInt32());
-
- if (!being || chatMsgLength <= 0)
- {
- break;
- }
-
- chatMsg = msg.readString(chatMsgLength);
- chatWindow->chatLog(chatMsg, BY_OTHER);
- chatMsg.erase(0, chatMsg.find(" : ", 0) + 3);
- trim(chatMsg);
- being->setSpeech(chatMsg, SPEECH_TIME);
- break;
-
- case SMSG_PLAYER_CHAT:
- case SMSG_GM_CHAT:
- chatMsgLength = msg.readInt16() - 4;
-
- if (chatMsgLength <= 0)
- {
- break;
- }
-
- chatMsg = msg.readString(chatMsgLength);
-
- if (msg.getId() == SMSG_PLAYER_CHAT)
- {
- chatWindow->chatLog(chatMsg, BY_PLAYER);
-
- std::string::size_type pos = chatMsg.find(" : ", 0);
- if (pos != std::string::npos)
- {
- chatMsg.erase(0, pos + 3);
- }
- trim(chatMsg);
- player_node->setSpeech(chatMsg, SPEECH_TIME);
- }
- else
- {
- chatWindow->chatLog(chatMsg, BY_GM);
- }
- break;
-
- case SMSG_WHO_ANSWER:
- chatWindow->chatLog("Online users: " + toString(msg.readInt32()),
- BY_SERVER);
- break;
-
- case 0x010c:
- // Display MVP player
- msg.readInt32(); // id
- chatWindow->chatLog("MVP player", BY_SERVER);
- break;
- */
}
}