summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/net/ea/chathandler.cpp17
-rw-r--r--src/net/ea/chathandler.h4
-rw-r--r--src/net/eathena/chathandler.cpp16
3 files changed, 36 insertions, 1 deletions
diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp
index 0f5ae0f36..4e5d2300b 100644
--- a/src/net/ea/chathandler.cpp
+++ b/src/net/ea/chathandler.cpp
@@ -82,7 +82,7 @@ void ChatHandler::talkPet(const std::string &restrict text,
talk(action, channel);
}
-void ChatHandler::processWhisperResponseContinue(const uint8_t type)
+std::string ChatHandler::getPopLastWhisperNick()
{
std::string nick;
if (mSentWhispers.empty())
@@ -94,7 +94,22 @@ void ChatHandler::processWhisperResponseContinue(const uint8_t type)
nick = mSentWhispers.front();
mSentWhispers.pop();
}
+ return nick;
+}
+
+std::string ChatHandler::getLastWhisperNick()
+{
+ std::string nick;
+ if (mSentWhispers.empty())
+ nick = "user";
+ else
+ nick = mSentWhispers.front();
+ return nick;
+}
+void ChatHandler::processWhisperResponseContinue(const uint8_t type)
+{
+ const std::string nick = getPopLastWhisperNick();
switch (type)
{
case 0x00:
diff --git a/src/net/ea/chathandler.h b/src/net/ea/chathandler.h
index 810ca7efa..80cf6afbb 100644
--- a/src/net/ea/chathandler.h
+++ b/src/net/ea/chathandler.h
@@ -62,6 +62,10 @@ class ChatHandler notfinal : public Net::ChatHandler
void processWhisperResponseContinue(const uint8_t type);
protected:
+ std::string getPopLastWhisperNick();
+
+ std::string getLastWhisperNick();
+
typedef std::queue<std::string> WhisperQueue;
WhisperQueue mSentWhispers;
int mMotdTime;
diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp
index dd4618482..0a5029b6e 100644
--- a/src/net/eathena/chathandler.cpp
+++ b/src/net/eathena/chathandler.cpp
@@ -37,6 +37,7 @@
#include "resources/chatobject.h"
+#include "utils/gettext.h"
#include "utils/stringutils.h"
#include <string>
@@ -503,6 +504,21 @@ void ChatHandler::processWhisperResponse(Net::MessageIn &msg)
const uint8_t type = msg.readUInt8("response");
msg.readInt32("unknown");
+ if (type == 1 && chatWindow)
+ {
+ const std::string nick = getLastWhisperNick();
+ if (nick.size() > 1 && nick[0] == '#')
+ {
+ chatWindow->channelChatLog(nick,
+ // TRANSLATORS: chat message
+ strprintf(_("Message could not be sent, channel "
+ "%s is not exists."), nick.c_str()),
+ ChatMsgType::BY_SERVER, false, false);
+ if (!mSentWhispers.empty())
+ mSentWhispers.pop();
+ return;
+ }
+ }
processWhisperResponseContinue(type);
}