ManaPlus
Functions | Variables
Ea::ChatRecv Namespace Reference

Functions

void processMVPEffect (Net::MessageIn &msg)
 
void processIgnoreAllResponse (Net::MessageIn &msg)
 
void processWhisperResponseContinue (Net::MessageIn &msg, const uint8_t type)
 
std::string getPopLastWhisperNick ()
 
std::string getLastWhisperNick ()
 

Variables

WhisperQueue mSentWhispers
 
time_t mMotdTime = 0
 
bool mShowAllLang = false
 
bool mShowMotd = false
 
bool mSkipping = true
 

Function Documentation

◆ getLastWhisperNick()

std::string Ea::ChatRecv::getLastWhisperNick ( )

Definition at line 71 of file chatrecv.cpp.

72 {
73  std::string nick;
74  if (mSentWhispers.empty())
75  nick = "user";
76  else
77  nick = mSentWhispers.front();
78  return nick;
79 }
WhisperQueue mSentWhispers
Definition: chatrecv.cpp:49

References mSentWhispers.

Referenced by EAthena::ChatRecv::processColorChat(), and EAthena::ChatRecv::processWhisperResponse().

◆ getPopLastWhisperNick()

std::string Ea::ChatRecv::getPopLastWhisperNick ( )

Definition at line 56 of file chatrecv.cpp.

57 {
58  std::string nick;
59  if (mSentWhispers.empty())
60  {
61  nick = "user";
62  }
63  else
64  {
65  nick = mSentWhispers.front();
66  mSentWhispers.pop();
67  }
68  return nick;
69 }

References mSentWhispers.

Referenced by processWhisperResponseContinue().

◆ processIgnoreAllResponse()

void Ea::ChatRecv::processIgnoreAllResponse ( Net::MessageIn msg)

Definition at line 145 of file chatrecv.cpp.

146 {
147  BLOCK_START("ChatRecv::processIgnoreAllResponse")
148  const uint8_t action = msg.readUInt8("action");
149  const uint8_t fail = msg.readUInt8("result");
150  if (localChatTab == nullptr)
151  {
152  BLOCK_END("ChatRecv::processIgnoreAllResponse")
153  return;
154  }
155 
156  switch (action)
157  {
158  case 0:
159  {
160  switch (fail)
161  {
162  case 0:
164  break;
165  default:
168  break;
169  }
170  break;
171  }
172  case 1:
173  {
174  switch (fail)
175  {
176  case 0:
178  break;
179  default:
182  break;
183  }
184  break;
185  }
186  default:
187  // unknown result
188  break;
189  }
190  BLOCK_END("ChatRecv::processIgnoreAllResponse")
191 }
ChatTab * localChatTab
Definition: chattab.cpp:62
if(!vert) return
bool msg(InputEvent &event)
Definition: chat.cpp:39
void notify(const unsigned int message)
@ WHISPERS_IGNORE_FAILED
Definition: notifytypes.h:104
@ WHISPERS_UNIGNORE_FAILED
Definition: notifytypes.h:106
@ WHISPERS_UNIGNORED
Definition: notifytypes.h:105
#define BLOCK_END(name)
Definition: perfomance.h:80
#define BLOCK_START(name)
Definition: perfomance.h:79

References BLOCK_END, BLOCK_START, localChatTab, Actions::msg(), NotifyManager::notify(), NotifyTypes::WHISPERS_IGNORE_FAILED, NotifyTypes::WHISPERS_IGNORED, NotifyTypes::WHISPERS_UNIGNORE_FAILED, and NotifyTypes::WHISPERS_UNIGNORED.

◆ processMVPEffect()

void Ea::ChatRecv::processMVPEffect ( Net::MessageIn msg)

Definition at line 127 of file chatrecv.cpp.

128 {
129  BLOCK_START("ChatRecv::processMVPEffect")
130  // Display MVP player
131  const BeingId id = msg.readBeingId("being id");
132  if (localChatTab != nullptr &&
133  actorManager != nullptr &&
134  config.getBoolValue("showMVP"))
135  {
136  const Being *const being = actorManager->findBeing(id);
137  if (being == nullptr)
139  else
141  }
142  BLOCK_END("ChatRecv::processMVPEffect")
143 }
ActorManager * actorManager
int BeingId
Definition: beingid.h:30
Being * findBeing(const BeingId id) const
Definition: being.h:96
const std::string & getName() const
Definition: being.h:232
Configuration config

References actorManager, BLOCK_END, BLOCK_START, config, ActorManager::findBeing(), Configuration::getBoolValue(), Being::getName(), localChatTab, Actions::msg(), NotifyTypes::MVP_PLAYER, and NotifyManager::notify().

◆ processWhisperResponseContinue()

void Ea::ChatRecv::processWhisperResponseContinue ( Net::MessageIn msg,
const uint8_t  type 
)

Definition at line 81 of file chatrecv.cpp.

83 {
84  const std::string nick = getPopLastWhisperNick();
85  switch (type)
86  {
87  case 0x00:
88  // Success (don't need to report)
89  break;
90  case 0x01:
91  if (chatWindow != nullptr)
92  {
93  chatWindow->addWhisper(nick,
94  // TRANSLATORS: chat message
95  strprintf(_("Whisper could not be sent, %s is offline."),
96  nick.c_str()),
98  }
99  break;
100  case 0x02:
101  if (chatWindow != nullptr)
102  {
103  chatWindow->addWhisper(nick,
104  // TRANSLATORS: chat message
105  strprintf(_("Whisper could not "
106  "be sent, ignored by %s."), nick.c_str()),
108  }
109  break;
110  case 0x03:
111  if (chatWindow != nullptr)
112  {
113  chatWindow->addWhisper(nick,
114  // TRANSLATORS: chat message
115  _("Whisper could not "
116  "be sent, you ignored by all players."),
118  }
119  break;
120  default:
122  break;
123  }
124  BLOCK_END("ChatRecv::processWhisperResponse")
125 }
ChatWindow * chatWindow
Definition: chatwindow.cpp:94
void addWhisper(const std::string &nick, const std::string &mes, const ChatMsgTypeT own)
#define _(s)
Definition: gettext.h:35
#define UNIMPLEMENTEDPACKETFIELD(field)
Definition: logger.h:59
std::string getPopLastWhisperNick()
Definition: chatrecv.cpp:56
std::string strprintf(const char *const format,...)

References _, ChatWindow::addWhisper(), BLOCK_END, ChatMsgType::BY_SERVER, chatWindow, getPopLastWhisperNick(), strprintf(), and UNIMPLEMENTEDPACKETFIELD.

Referenced by EAthena::ChatRecv::processWhisperResponse(), and TmwAthena::ChatRecv::processWhisperResponse().

Variable Documentation

◆ mMotdTime

time_t Ea::ChatRecv::mMotdTime = 0

◆ mSentWhispers

WhisperQueue Ea::ChatRecv::mSentWhispers

◆ mShowAllLang

bool Ea::ChatRecv::mShowAllLang = false

Definition at line 51 of file chatrecv.cpp.

Referenced by Ea::ChatHandler::ChatHandler().

◆ mShowMotd

bool Ea::ChatRecv::mShowMotd = false

◆ mSkipping

bool Ea::ChatRecv::mSkipping = true