From f1cab9c5ab1d36586ae1e0d1dae3f3d1483522b5 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Sun, 9 May 2010 18:21:14 -0600 Subject: Make whisper responses from tmwAthena show up in correct tabs Reviewed-by: Bertram --- src/net/tmwa/chathandler.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'src/net/tmwa/chathandler.cpp') diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp index 493df0e5..53af2e6b 100644 --- a/src/net/tmwa/chathandler.cpp +++ b/src/net/tmwa/chathandler.cpp @@ -70,19 +70,28 @@ void ChatHandler::handleMessage(Net::MessageIn &msg) switch (msg.getId()) { case SMSG_WHISPER_RESPONSE: + if (mSentWhispers.empty()) + nick = "user"; + else + { + nick = mSentWhispers.front(); + mSentWhispers.pop(); + } + switch (msg.readInt8()) { case 0x00: - // comment out since we'll local echo in chat.cpp instead, then only report failures - //localChatTab->chatLog("Whisper sent", BY_SERVER); + // Success (don't need to report) break; case 0x01: - localChatTab->chatLog(_("Whisper could not be sent, user " - "is offline."), BY_SERVER); + chatWindow->whisper(nick, strprintf(_("Whisper could not " + "be sent, %s is offline."), nick.c_str()), + BY_SERVER); break; case 0x02: - localChatTab->chatLog(_("Whisper could not be sent, " - "ignored by user."), BY_SERVER); + chatWindow->whisper(nick, strprintf(_("Whisper could not " + "be sent, ignored by %s."), nick.c_str()), + BY_SERVER); break; } break; @@ -197,6 +206,8 @@ void ChatHandler::privateMessage(const std::string &recipient, outMsg.writeInt16(text.length() + 28); outMsg.writeString(recipient, 24); outMsg.writeString(text, text.length()); + + mSentWhispers.push(recipient); } void ChatHandler::channelList() -- cgit v1.2.3-70-g09d2