diff options
Diffstat (limited to 'src/gui/socialwindow.cpp')
-rw-r--r-- | src/gui/socialwindow.cpp | 73 |
1 files changed, 35 insertions, 38 deletions
diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp index d52e073c..b4321b25 100644 --- a/src/gui/socialwindow.cpp +++ b/src/gui/socialwindow.cpp @@ -20,22 +20,19 @@ #include "gui/socialwindow.h" -#include "beingmanager.h" +#include "event.h" #include "guild.h" #include "localplayer.h" #include "party.h" -#include "player.h" #include "gui/confirmdialog.h" #include "gui/okdialog.h" #include "gui/setup.h" #include "gui/textdialog.h" -#include "gui/theme.h" #include "gui/widgets/avatarlistbox.h" #include "gui/widgets/browserbox.h" #include "gui/widgets/button.h" -#include "gui/widgets/chattab.h" #include "gui/widgets/container.h" #include "gui/widgets/label.h" #include "gui/widgets/layouthelper.h" @@ -49,6 +46,8 @@ #include "net/guildhandler.h" #include "net/partyhandler.h" +#include "resources/theme.h" + #include "utils/dtor.h" #include "utils/gettext.h" #include "utils/stringutils.h" @@ -124,13 +123,10 @@ public: if (!name.empty()) { - Net::getGuildHandler()->invite(mGuild->getId(), name); - localChatTab->chatLog(strprintf(_("Invited user %s to guild %s."), - name.c_str(), - mGuild->getName().c_str()), - BY_SERVER); + SERVER_NOTICE(strprintf(_("Invited user %s to guild %s."), + name.c_str(), + mGuild->getName().c_str())) } - mInviteDialog = NULL; } else if (event.getId() == "~do invite") @@ -140,8 +136,8 @@ public: else if (event.getId() == "yes") { Net::getGuildHandler()->leave(mGuild->getId()); - localChatTab->chatLog(strprintf(_("Guild %s quit requested."), - mGuild->getName().c_str()), BY_SERVER); + SERVER_NOTICE(strprintf(_("Guild %s quit requested."), + mGuild->getName().c_str())) mConfirmDialog = NULL; } else if (event.getId() == "no") @@ -208,8 +204,8 @@ public: std::string name = mInviteDialog->getText(); if (!name.empty()) - Net::getPartyHandler()->invite(name); - + SERVER_NOTICE(strprintf(_("Invited user %s to party."), + name.c_str())) mInviteDialog = NULL; } else if (event.getId() == "~do invite") @@ -219,8 +215,8 @@ public: else if (event.getId() == "yes") { Net::getPartyHandler()->leave(); - localChatTab->chatLog(strprintf(_("Party %s quit requested."), - mParty->getName().c_str()), BY_SERVER); + SERVER_NOTICE(strprintf(_("Party %s quit requested."), + mParty->getName().c_str())) mConfirmDialog = NULL; } else if (event.getId() == "no") @@ -444,14 +440,14 @@ void SocialWindow::action(const gcn::ActionEvent &event) // check if they accepted the invite if (eventId == "yes") { - localChatTab->chatLog(strprintf(_("Accepted party invite from %s."), - mPartyInviter.c_str())); + SERVER_NOTICE(strprintf(_("Accepted party invite from %s."), + mPartyInviter.c_str())) Net::getPartyHandler()->inviteResponse(mPartyInviter, true); } else if (eventId == "no") { - localChatTab->chatLog(strprintf(_("Rejected party invite from %s."), - mPartyInviter.c_str())); + SERVER_NOTICE(strprintf(_("Rejected party invite from %s."), + mPartyInviter.c_str())) Net::getPartyHandler()->inviteResponse(mPartyInviter, false); } @@ -463,14 +459,14 @@ void SocialWindow::action(const gcn::ActionEvent &event) // check if they accepted the invite if (eventId == "yes") { - localChatTab->chatLog(strprintf(_("Accepted guild invite from %s."), - mPartyInviter.c_str())); + SERVER_NOTICE(strprintf(_("Accepted guild invite from %s."), + mPartyInviter.c_str())) Net::getGuildHandler()->inviteResponse(mGuildInvited, true); } else if (eventId == "no") { - localChatTab->chatLog(strprintf(_("Rejected guild invite from %s."), - mPartyInviter.c_str())); + SERVER_NOTICE(strprintf(_("Rejected guild invite from %s."), + mPartyInviter.c_str())) Net::getGuildHandler()->inviteResponse(mGuildInvited, false); } @@ -498,14 +494,15 @@ void SocialWindow::action(const gcn::ActionEvent &event) if (name.size() > 16) { - localChatTab->chatLog(_("Creating guild failed, please choose a " - "shorter name."), BY_SERVER); + SERVER_NOTICE(_("Creating guild failed, please choose a " + "shorter name.")); + return; } else if (!name.empty()) { Net::getGuildHandler()->create(name); - localChatTab->chatLog(strprintf(_("Creating guild called %s."), - name.c_str()), BY_SERVER); + SERVER_NOTICE(strprintf(_("Creating guild called %s."), + name.c_str())); } mGuildCreateDialog = NULL; @@ -520,14 +517,15 @@ void SocialWindow::action(const gcn::ActionEvent &event) if (name.size() > 16) { - localChatTab->chatLog(_("Creating party failed, please choose a " - "shorter name."), BY_SERVER); + SERVER_NOTICE(_("Creating party failed, please choose a " + "shorter name.")); + return; } else if (!name.empty()) { Net::getPartyHandler()->create(name); - localChatTab->chatLog(strprintf(_("Creating party called %s."), - name.c_str()), BY_SERVER); + SERVER_NOTICE(strprintf(_("Creating party called %s."), + name.c_str())); } mPartyCreateDialog = NULL; @@ -553,14 +551,14 @@ void SocialWindow::showGuildInvite(const std::string &guildName, // check there isnt already an invite showing if (mGuildInvited != 0) { - localChatTab->chatLog(_("Received guild request, but one already " - "exists."), BY_SERVER); + SERVER_NOTICE(_("Received guild request, but one already " + "exists.")) return; } std::string msg = strprintf(_("%s has invited you to join the guild %s."), inviterName.c_str(), guildName.c_str()); - localChatTab->chatLog(msg, BY_SERVER); + SERVER_NOTICE(msg) // show invite mGuildAcceptDialog = new ConfirmDialog(_("Accept Guild Invite"), msg, this); @@ -575,8 +573,7 @@ void SocialWindow::showPartyInvite(const std::string &partyName, // check there isnt already an invite showing if (mPartyInviter != "") { - localChatTab->chatLog(_("Received party request, but one already " - "exists."), BY_SERVER); + SERVER_NOTICE(_("Received party request, but one already exists.")) return; } @@ -607,7 +604,7 @@ void SocialWindow::showPartyInvite(const std::string &partyName, } } - localChatTab->chatLog(msg, BY_SERVER); + SERVER_NOTICE(msg) // show invite mPartyAcceptDialog = new ConfirmDialog(_("Accept Party Invite"), msg, this); |