summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-03-09 02:10:02 +0300
committerAndrei Karas <akaras@inbox.ru>2013-03-09 14:39:29 +0300
commit29c0c9e731694a40a6f2e41c6bdedb4b78e2b952 (patch)
treee944129f98e652f2bd9adbcf5cd273a8bbb9e528 /src
parent0aca242db52695fa0804ac180fc7961b281b422a (diff)
downloadplus-29c0c9e731694a40a6f2e41c6bdedb4b78e2b952.tar.gz
plus-29c0c9e731694a40a6f2e41c6bdedb4b78e2b952.tar.bz2
plus-29c0c9e731694a40a6f2e41c6bdedb4b78e2b952.tar.xz
plus-29c0c9e731694a40a6f2e41c6bdedb4b78e2b952.zip
Add new notifications to guildhandler, guildmanager, inventoryhandler and partyhandler.
Diffstat (limited to 'src')
-rw-r--r--src/guildmanager.cpp8
-rw-r--r--src/guildmanager.h3
-rw-r--r--src/net/ea/guildhandler.cpp43
-rw-r--r--src/net/ea/guildhandler.h2
-rw-r--r--src/net/ea/inventoryhandler.cpp5
-rw-r--r--src/net/ea/partyhandler.cpp93
-rw-r--r--src/net/ea/partyhandler.h2
-rw-r--r--src/net/eathena/partyhandler.cpp7
-rw-r--r--src/net/guildhandler.h4
-rw-r--r--src/net/partyhandler.h4
-rw-r--r--src/net/tmwa/partyhandler.cpp7
-rw-r--r--src/notifications.h75
-rw-r--r--src/notifymanager.cpp78
-rw-r--r--src/notifymanager.h3
14 files changed, 229 insertions, 105 deletions
diff --git a/src/guildmanager.cpp b/src/guildmanager.cpp
index 180758cf7..7e096a276 100644
--- a/src/guildmanager.cpp
+++ b/src/guildmanager.cpp
@@ -25,6 +25,7 @@
#include "configuration.h"
#include "guild.h"
#include "localplayer.h"
+#include "notifymanager.h"
#include "gui/socialwindow.h"
@@ -508,7 +509,7 @@ bool GuildManager::afterRemove()
player_node->setGuildName("");
player_node->clearGuilds();
}
- SERVER_NOTICE(_("You have left the guild."))
+ NotifyManager::notify(NotifyManager::GUILD_LEFT);
delete mTab;
mTab = nullptr;
@@ -522,3 +523,8 @@ bool GuildManager::afterRemove()
reload();
return true;
}
+
+ChatTab *GuildManager::getTab()
+{
+ return mTab;
+}
diff --git a/src/guildmanager.h b/src/guildmanager.h
index c01ee6078..1a7098058 100644
--- a/src/guildmanager.h
+++ b/src/guildmanager.h
@@ -27,6 +27,7 @@
#include "localconsts.h"
+class ChatTab;
class Guild;
class GuildChatTab;
@@ -81,6 +82,8 @@ class GuildManager final
bool havePower() const A_WARN_UNUSED
{ return mHavePower; }
+ ChatTab *getTab();
+
private:
bool process(std::string msg);
diff --git a/src/net/ea/guildhandler.cpp b/src/net/ea/guildhandler.cpp
index 129ba931d..b521e313a 100644
--- a/src/net/ea/guildhandler.cpp
+++ b/src/net/ea/guildhandler.cpp
@@ -24,6 +24,7 @@
#include "actorspritemanager.h"
#include "configuration.h"
#include "localplayer.h"
+#include "notifymanager.h"
#include "gui/socialwindow.h"
@@ -78,27 +79,27 @@ void GuildHandler::processGuildCreateResponse(Net::MessageIn &msg)
{
case 0:
// Success
- SERVER_NOTICE(_("Guild created."))
+ NotifyManager::notify(NotifyManager::GUILD_CREATED);
break;
case 1:
// Already in a guild
- SERVER_NOTICE(_("You are already in guild."))
+ NotifyManager::notify(NotifyManager::GUILD_ALREADY);
break;
case 2:
// Unable to make (likely name already in use)
- SERVER_NOTICE(_("You are already in guild."))
+ NotifyManager::notify(NotifyManager::GUILD_ALREADY);
break;
case 3:
// Emperium check failed
- SERVER_NOTICE(_("Emperium check failed."))
+ NotifyManager::notify(NotifyManager::GUILD_EMPERIUM_CHECK_FAILED);
break;
default:
// Unknown response
- SERVER_NOTICE(_("Unknown server response."))
+ NotifyManager::notify(NotifyManager::GUILD_ERROR);
break;
}
}
@@ -406,23 +407,23 @@ void GuildHandler::processGuildInviteAck(Net::MessageIn &msg)
switch (flag)
{
case 0:
- guildTab->chatLog(_("Could not inivte user to guild."), BY_SERVER);
+ NotifyManager::notify(NotifyManager::GUILD_INVITE_FAILED);
break;
case 1:
- guildTab->chatLog(_("User rejected guild invite."), BY_SERVER);
+ NotifyManager::notify(NotifyManager::GUILD_INVITE_REJECTED);
break;
case 2:
- guildTab->chatLog(_("User is now part of your guild."), BY_SERVER);
+ NotifyManager::notify(NotifyManager::GUILD_INVITE_JOINED);
break;
case 3:
- guildTab->chatLog(_("Your guild is full."), BY_SERVER);
+ NotifyManager::notify(NotifyManager::GUILD_INVITE_FULL);
break;
default:
- guildTab->chatLog(_("Unknown guild invite response."), BY_SERVER);
+ NotifyManager::notify(NotifyManager::GUILD_INVITE_ERROR);
break;
}
}
@@ -445,7 +446,7 @@ void GuildHandler::processGuildLeave(Net::MessageIn &msg)
taGuild->removeFromMembers();
taGuild->clearMembers();
}
- SERVER_NOTICE(_("You have left the guild."))
+ NotifyManager::notify(NotifyManager::GUILD_LEFT);
delete guildTab;
guildTab = nullptr;
@@ -456,11 +457,7 @@ void GuildHandler::processGuildLeave(Net::MessageIn &msg)
}
else
{
- if (guildTab)
- {
- guildTab->chatLog(strprintf(_("%s has left your guild."),
- nick.c_str()), BY_SERVER);
- }
+ NotifyManager::notify(NotifyManager::GUILD_USER_LEFT, nick);
if (actorSpriteManager)
{
Being *const b = actorSpriteManager->findBeingByName(
@@ -493,7 +490,7 @@ void GuildHandler::processGuildExpulsion(Net::MessageIn &msg)
taGuild->removeFromMembers();
taGuild->clearMembers();
}
- SERVER_NOTICE(_("You were kicked from guild."));
+ NotifyManager::notify(NotifyManager::GUILD_KICKED);
delete guildTab;
guildTab = nullptr;
@@ -504,12 +501,7 @@ void GuildHandler::processGuildExpulsion(Net::MessageIn &msg)
}
else
{
- if (guildTab)
- {
- guildTab->chatLog(strprintf(_("%s has kicked from your guild."),
- nick.c_str()), BY_SERVER);
- }
-
+ NotifyManager::notify(NotifyManager::GUILD_USER_KICKED, nick);
if (actorSpriteManager)
{
Being *const b = actorSpriteManager->findBeingByName(
@@ -605,4 +597,9 @@ void GuildHandler::clear()
taGuild = nullptr;
}
+ChatTab *GuildHandler::getTab()
+{
+ return guildTab;
+}
+
} // namespace Ea
diff --git a/src/net/ea/guildhandler.h b/src/net/ea/guildhandler.h
index 128bf368d..65a6973ca 100644
--- a/src/net/ea/guildhandler.h
+++ b/src/net/ea/guildhandler.h
@@ -102,6 +102,8 @@ class GuildHandler : public Net::GuildHandler
void clear();
+ ChatTab *getTab();
+
protected:
bool showBasicInfo;
};
diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp
index eceb194f9..9e751f27c 100644
--- a/src/net/ea/inventoryhandler.cpp
+++ b/src/net/ea/inventoryhandler.cpp
@@ -23,6 +23,7 @@
#include "net/ea/inventoryhandler.h"
#include "localplayer.h"
+#include "notifymanager.h"
#include "gui/ministatuswindow.h"
@@ -399,7 +400,7 @@ void InventoryHandler::processItemUseResponse(Net::MessageIn &msg)
if (msg.readInt8() == 0)
{
- SERVER_NOTICE(_("Failed to use item."))
+ NotifyManager::notify(NotifyManager::USE_FAILED);
}
else
{
@@ -565,7 +566,7 @@ void InventoryHandler::processPlayerEquip(Net::MessageIn &msg)
const int flag = msg.readInt8();
if (!flag)
- SERVER_NOTICE(_("Unable to equip."))
+ NotifyManager::notify(NotifyManager::EQUIP_FAILED);
else
mEquips.setEquipment(getSlot(equipType), index);
}
diff --git a/src/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp
index 41d0bdf00..7ab8ae5e8 100644
--- a/src/net/ea/partyhandler.cpp
+++ b/src/net/ea/partyhandler.cpp
@@ -24,6 +24,7 @@
#include "actorspritemanager.h"
#include "configuration.h"
#include "localplayer.h"
+#include "notifymanager.h"
#include "gui/socialwindow.h"
@@ -74,9 +75,9 @@ void PartyHandler::clear()
void PartyHandler::processPartyCreate(Net::MessageIn &msg)
{
if (msg.readInt8())
- SERVER_NOTICE(_("Could not create party."))
+ NotifyManager::notify(NotifyManager::PARTY_CREATE_FAILED);
else
- SERVER_NOTICE(_("Party successfully created."))
+ NotifyManager::notify(NotifyManager::PARTY_CREATED);
}
void PartyHandler::processPartyInfo(Net::MessageIn &msg)
@@ -128,11 +129,10 @@ void PartyHandler::processPartyInfo(Net::MessageIn &msg)
if (oldParty)
{
//member = Ea::taParty->getMember(id);
- if (Ea::partyTab && names.find(nick) == names.end())
+ if (names.find(nick) == names.end())
{
- Ea::partyTab->chatLog(strprintf(
- _("%s has joined your party."),
- nick.c_str()), BY_SERVER);
+ NotifyManager::notify(NotifyManager::PARTY_USER_JOINED,
+ nick);
}
}
PartyMember *member = Ea::taParty->addMember(id, nick);
@@ -166,29 +166,21 @@ void PartyHandler::processPartyInviteResponse(Net::MessageIn &msg)
switch (msg.readInt8())
{
case 0:
- Ea::partyTab->chatLog(strprintf(
- _("%s is already a member of a party."),
- nick.c_str()), BY_SERVER);
+ NotifyManager::notify(NotifyManager::PARTY_INVITE_ALREADY_MEMBER,
+ nick);
break;
case 1:
- Ea::partyTab->chatLog(strprintf(
- _("%s refused your invitation."),
- nick.c_str()), BY_SERVER);
+ NotifyManager::notify(NotifyManager::PARTY_INVITE_REFUSED, nick);
break;
case 2:
- Ea::partyTab->chatLog(strprintf(
- _("%s is now a member of your party."),
- nick.c_str()), BY_SERVER);
+ NotifyManager::notify(NotifyManager::PARTY_INVITE_DONE, nick);
break;
case 3:
- Ea::partyTab->chatLog(strprintf(
- _("%s can't join your party because party is "
- "full."), nick.c_str()), BY_SERVER);
+ NotifyManager::notify(NotifyManager::PARTY_INVITE_PARTY_FULL,
+ nick);
break;
default:
- Ea::partyTab->chatLog(strprintf(
- _("QQQ Unknown invite response for %s."),
- nick.c_str()), BY_SERVER);
+ NotifyManager::notify(NotifyManager::PARTY_INVITE_ERROR, nick);
break;
}
}
@@ -238,32 +230,19 @@ void PartyHandler::processPartySettings(Net::MessageIn &msg)
if (mShareExp == PARTY_SHARE)
break;
mShareExp = PARTY_SHARE;
- if (Ea::partyTab)
- {
- Ea::partyTab->chatLog(
- _("Experience sharing enabled."), BY_SERVER);
- }
+ NotifyManager::notify(NotifyManager::PARTY_EXP_SHARE_ON);
break;
case PARTY_SHARE_NO:
if (mShareExp == PARTY_SHARE_NO)
break;
mShareExp = PARTY_SHARE_NO;
- if (Ea::partyTab)
- {
- Ea::partyTab->chatLog(
- _("Experience sharing disabled."), BY_SERVER);
- }
+ NotifyManager::notify(NotifyManager::PARTY_EXP_SHARE_OFF);
break;
case PARTY_SHARE_NOT_POSSIBLE:
if (mShareExp == PARTY_SHARE_NOT_POSSIBLE)
break;
mShareExp = PARTY_SHARE_NOT_POSSIBLE;
- if (Ea::partyTab)
- {
- Ea::partyTab->chatLog(
- _("Experience sharing not possible."),
- BY_SERVER);
- }
+ NotifyManager::notify(NotifyManager::PARTY_EXP_SHARE_ERROR);
break;
default:
logger->log("QQQ Unknown party exp option: %d\n", exp);
@@ -276,35 +255,22 @@ void PartyHandler::processPartySettings(Net::MessageIn &msg)
if (mShareItems == PARTY_SHARE)
break;
mShareItems = PARTY_SHARE;
- if (Ea::partyTab)
- {
- Ea::partyTab->chatLog(
- _("Item sharing enabled."), BY_SERVER);
- }
+ NotifyManager::notify(NotifyManager::PARTY_ITEM_SHARE_ON);
break;
case PARTY_SHARE_NO:
if (mShareItems == PARTY_SHARE_NO)
break;
mShareItems = PARTY_SHARE_NO;
- if (Ea::partyTab)
- {
- Ea::partyTab->chatLog(
- _("Item sharing disabled."), BY_SERVER);
- }
+ NotifyManager::notify(NotifyManager::PARTY_ITEM_SHARE_OFF);
break;
case PARTY_SHARE_NOT_POSSIBLE:
if (mShareItems == PARTY_SHARE_NOT_POSSIBLE)
break;
mShareItems = PARTY_SHARE_NOT_POSSIBLE;
- if (Ea::partyTab)
- {
- Ea::partyTab->chatLog(
- _("Item sharing not possible."), BY_SERVER);
- }
+ NotifyManager::notify(NotifyManager::PARTY_ITEM_SHARE_ERROR);
break;
default:
- logger->log("QQQ Unknown party item option: %d\n",
- exp);
+ logger->log("QQQ Unknown party item option: %d\n", exp);
break;
}
}
@@ -352,7 +318,7 @@ void PartyHandler::processPartyLeave(Net::MessageIn &msg)
Ea::taParty->removeFromMembers();
Ea::taParty->clearMembers();
}
- SERVER_NOTICE(_("You have left the party."))
+ NotifyManager::notify(NotifyManager::PARTY_LEFT);
delete Ea::partyTab;
Ea::partyTab = nullptr;
@@ -362,12 +328,7 @@ void PartyHandler::processPartyLeave(Net::MessageIn &msg)
}
else
{
- if (Ea::partyTab)
- {
- Ea::partyTab->chatLog(strprintf(
- _("%s has left your party."),
- nick.c_str()), BY_SERVER);
- }
+ NotifyManager::notify(NotifyManager::PARTY_USER_LEFT, nick);
if (actorSpriteManager)
{
Being *const b = actorSpriteManager->findBeing(id);
@@ -441,11 +402,15 @@ void PartyHandler::processPartyMessage(Net::MessageIn &msg)
}
else
{
- Ea::partyTab->chatLog(strprintf(
- _("An unknown member tried to say: %s"),
- chatMsg.c_str()), BY_SERVER);
+ NotifyManager::notify(NotifyManager::PARTY_UNKNOWN_USER_MSG,
+ chatMsg);
}
}
}
+ChatTab *PartyHandler::getTab()
+{
+ return partyTab;
+}
+
} // namespace Ea
diff --git a/src/net/ea/partyhandler.h b/src/net/ea/partyhandler.h
index f9dde62b0..c113a6a3b 100644
--- a/src/net/ea/partyhandler.h
+++ b/src/net/ea/partyhandler.h
@@ -56,6 +56,8 @@ class PartyHandler : public Net::PartyHandler
void clear();
+ ChatTab *getTab();
+
virtual void processPartyCreate(Net::MessageIn &msg);
virtual void processPartyInfo(Net::MessageIn &msg);
diff --git a/src/net/eathena/partyhandler.cpp b/src/net/eathena/partyhandler.cpp
index 72b0beaf2..264b2bd26 100644
--- a/src/net/eathena/partyhandler.cpp
+++ b/src/net/eathena/partyhandler.cpp
@@ -23,6 +23,7 @@
#include "actorspritemanager.h"
#include "localplayer.h"
+#include "notifymanager.h"
#include "net/eathena/protocol.h"
@@ -166,11 +167,7 @@ void PartyHandler::kick(const std::string &name)
const PartyMember *const m = Ea::taParty->getMember(name);
if (!m)
{
- if (Ea::partyTab)
- {
- Ea::partyTab->chatLog(strprintf(_("%s is not in your party!"),
- name.c_str()), BY_SERVER);
- }
+ NotifyManager::notify(NotifyManager::PARTY_USER_NOT_IN_PARTY, name);
return;
}
diff --git a/src/net/guildhandler.h b/src/net/guildhandler.h
index 86873b7fb..b1f6bd7bf 100644
--- a/src/net/guildhandler.h
+++ b/src/net/guildhandler.h
@@ -25,6 +25,8 @@
#include "guild.h"
+#include "gui/widgets/chattab.h"
+
#include <iosfwd>
class Being;
@@ -72,6 +74,8 @@ class GuildHandler
std::string msg2) = 0;
virtual void clear() = 0;
+
+ virtual ChatTab *getTab() = 0;
};
}
diff --git a/src/net/partyhandler.h b/src/net/partyhandler.h
index 7e4923586..cd75e51fe 100644
--- a/src/net/partyhandler.h
+++ b/src/net/partyhandler.h
@@ -25,6 +25,8 @@
#include "localconsts.h"
+#include "gui/widgets/chattab.h"
+
#include <string>
class Being;
@@ -76,6 +78,8 @@ class PartyHandler
virtual void setShareItems(PartyShare share) = 0;
virtual void clear() = 0;
+
+ virtual ChatTab *getTab() = 0;
};
} // namespace Net
diff --git a/src/net/tmwa/partyhandler.cpp b/src/net/tmwa/partyhandler.cpp
index 2b3ac78d6..44fca8a6f 100644
--- a/src/net/tmwa/partyhandler.cpp
+++ b/src/net/tmwa/partyhandler.cpp
@@ -23,6 +23,7 @@
#include "actorspritemanager.h"
#include "localplayer.h"
+#include "notifymanager.h"
#include "net/tmwa/protocol.h"
@@ -168,11 +169,7 @@ void PartyHandler::kick(const std::string &name)
const PartyMember *const m = Ea::taParty->getMember(name);
if (!m)
{
- if (Ea::partyTab)
- {
- Ea::partyTab->chatLog(strprintf(_("%s is not in your party!"),
- name.c_str()), BY_SERVER);
- }
+ NotifyManager::notify(NotifyManager::PARTY_USER_NOT_IN_PARTY, name);
return;
}
diff --git a/src/notifications.h b/src/notifications.h
index b5c622c76..26d9ef745 100644
--- a/src/notifications.h
+++ b/src/notifications.h
@@ -35,13 +35,51 @@ namespace NotifyManager
SELL_TRADE_FAILED,
SELL_UNSELLABLE_FAILED,
ONLINE_USERS,
+ GUILD_CREATED,
+ GUILD_ALREADY,
+ GUILD_EMPERIUM_CHECK_FAILED,
+ GUILD_ERROR,
+ GUILD_LEFT,
+ GUILD_INVITE_FAILED,
+ GUILD_INVITE_REJECTED,
+ GUILD_INVITE_JOINED,
+ GUILD_INVITE_FULL,
+ GUILD_INVITE_ERROR,
+ GUILD_USER_LEFT,
+ GUILD_KICKED,
+ GUILD_USER_KICKED,
+ USE_FAILED,
+ EQUIP_FAILED,
+ PARTY_CREATE_FAILED,
+ PARTY_CREATED,
+ PARTY_LEFT,
+ PARTY_USER_JOINED,
+ PARTY_INVITE_ALREADY_MEMBER,
+ PARTY_INVITE_REFUSED,
+ PARTY_INVITE_DONE,
+ PARTY_INVITE_PARTY_FULL,
+ PARTY_INVITE_ERROR,
+ PARTY_EXP_SHARE_ON,
+ PARTY_EXP_SHARE_OFF,
+ PARTY_EXP_SHARE_ERROR,
+ PARTY_ITEM_SHARE_ON,
+ PARTY_ITEM_SHARE_OFF,
+ PARTY_ITEM_SHARE_ERROR,
+ PARTY_USER_LEFT,
+ PARTY_UNKNOWN_USER_MSG,
+ PARTY_USER_NOT_IN_PARTY,
+
TYPE_END
};
enum NotifyFlags
{
EMPTY,
- INT
+ INT,
+ GUILD,
+ GUILD_STRING,
+ PARTY,
+ PARTY_STRING
};
struct NotificationInfo
@@ -59,7 +97,40 @@ namespace NotifyManager
{N_("Unable to sell."), EMPTY},
{N_("Unable to sell while trading."), EMPTY},
{N_("Unable to sell unsellable item."), EMPTY},
- {N_("Online users: %d"), INT}
+ {N_("Online users: %d"), INT},
+ {N_("Guild created."), EMPTY},
+ {N_("You are already in guild."), EMPTY},
+ {N_("Emperium check failed."), EMPTY},
+ {N_("Unknown server response."), EMPTY},
+ {N_("You have left the guild."), EMPTY},
+ {N_("Could not invite user to guild."), GUILD},
+ {N_("User rejected guild invite."), GUILD},
+ {N_("User is now part of your guild."), GUILD},
+ {N_("Your guild is full."), GUILD},
+ {N_("Unknown guild invite response."), GUILD},
+ {N_("%s has left your guild."), GUILD_STRING},
+ {N_("You were kicked from guild."), EMPTY},
+ {N_("%s has kicked from your guild."), GUILD_STRING},
+ {N_("Failed to use item."), EMPTY},
+ {N_("Unable to equip."), EMPTY},
+ {N_("Could not create party."), EMPTY},
+ {N_("Party successfully created."), EMPTY},
+ {N_("You have left the party."), EMPTY},
+ {N_("%s has joined your party."), PARTY_STRING},
+ {N_("%s is already a member of a party."), PARTY_STRING},
+ {N_("%s refused your invitation."), PARTY_STRING},
+ {N_("%s is now a member of your party."), PARTY_STRING},
+ {N_("%s can't join your party because party is full."), PARTY_STRING},
+ {N_("QQQ Unknown invite response for %s."), PARTY_STRING},
+ {N_("Experience sharing enabled."), PARTY},
+ {N_("Experience sharing disabled."), PARTY},
+ {N_("Experience sharing not possible."), PARTY},
+ {N_("Item sharing enabled."), PARTY},
+ {N_("Item sharing disabled."), PARTY},
+ {N_("Item sharing not possible."), PARTY},
+ {N_("%s has left your party."), PARTY_STRING},
+ {N_("An unknown member tried to say: %s"), PARTY_STRING},
+ {N_("%s is not in your party!"), PARTY_STRING},
};
}
#endif
diff --git a/src/notifymanager.cpp b/src/notifymanager.cpp
index 2dae7d280..dcbd18c8f 100644
--- a/src/notifymanager.cpp
+++ b/src/notifymanager.cpp
@@ -20,21 +20,69 @@
#include "notifymanager.h"
+#include "guildmanager.h"
+#include "localplayer.h"
+
#include "gui/widgets/chattab.h"
+#include "net/guildhandler.h"
+#include "net/net.h"
+#include "net/partyhandler.h"
+
#include "utils/gettext.h"
namespace NotifyManager
{
+ static ChatTab *getGuildTab()
+ {
+ const Guild *const guild = player_node->getGuild();
+ if (guild)
+ {
+ if (guild->getServerGuild())
+ return Net::getGuildHandler()->getTab();
+ else if (guildManager)
+ return guildManager->getTab();
+ }
+ return nullptr;
+ }
+
+ static void chatLog(ChatTab *const tab, const std::string &str)
+ {
+ if (tab)
+ tab->chatLog(str, BY_SERVER);
+ else if (debugChatTab)
+ debugChatTab->chatLog(str, BY_SERVER);
+ }
+
void notify(const unsigned int message)
{
if (message >= TYPE_END || !localChatTab)
return;
const NotificationInfo &info = notifications[message];
- if (info.flags == EMPTY)
+ switch (info.flags)
{
- localChatTab->chatLog(gettext(info.text),
- BY_SERVER);
+ case EMPTY:
+ localChatTab->chatLog(gettext(info.text),
+ BY_SERVER);
+ break;
+
+ case GUILD:
+ {
+ if (!player_node)
+ return;
+ ChatTab *const tab = getGuildTab();
+ chatLog(tab, gettext(info.text));
+ break;
+ }
+
+ case PARTY:
+ {
+ ChatTab *const tab = Net::getPartyHandler()->getTab();
+ chatLog(tab, gettext(info.text));
+ }
+
+ default:
+ break;
}
}
@@ -49,4 +97,28 @@ namespace NotifyManager
num), BY_SERVER);
}
}
+
+ void notify(const unsigned int message, const std::string &str)
+ {
+ if (message >= TYPE_END || !localChatTab)
+ return;
+ const NotificationInfo &info = notifications[message];
+ switch (info.flags)
+ {
+ case GUILD_STRING:
+ {
+ ChatTab *const tab = getGuildTab();
+ chatLog(tab, strprintf(gettext(info.text), str.c_str()));
+ break;
+ }
+ case PARTY_STRING:
+ {
+ ChatTab *const tab = Net::getPartyHandler()->getTab();
+ chatLog(tab, strprintf(gettext(info.text), str.c_str()));
+ break;
+ }
+ default:
+ break;
+ }
+ }
}
diff --git a/src/notifymanager.h b/src/notifymanager.h
index 9c24f5890..59f3251c7 100644
--- a/src/notifymanager.h
+++ b/src/notifymanager.h
@@ -23,9 +23,12 @@
#include "notifications.h"
+#include <string>
+
namespace NotifyManager
{
void notify(const unsigned int message);
void notify(const unsigned int message, const int num);
+ void notify(const unsigned int message, const std::string &str);
}
#endif