diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-08-28 16:45:10 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-08-28 16:45:10 +0300 |
commit | 6b6fbd4eb1c0122a1c5346f29d54f2aca9b11009 (patch) | |
tree | 5a8aa4a48c48ea9d2cbace32e45dffa4acdedf3f | |
parent | 69f9daf9fe44bb43bd9112be428438512deca14b (diff) | |
download | manaplus-6b6fbd4eb1c0122a1c5346f29d54f2aca9b11009.tar.gz manaplus-6b6fbd4eb1c0122a1c5346f29d54f2aca9b11009.tar.bz2 manaplus-6b6fbd4eb1c0122a1c5346f29d54f2aca9b11009.tar.xz manaplus-6b6fbd4eb1c0122a1c5346f29d54f2aca9b11009.zip |
Add support for guild invitation in guild bot integration.
-rw-r--r-- | src/gui/socialwindow.cpp | 11 | ||||
-rw-r--r-- | src/guildmanager.cpp | 18 | ||||
-rw-r--r-- | src/guildmanager.h | 2 |
3 files changed, 28 insertions, 3 deletions
diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp index b517911ba..789d98b73 100644 --- a/src/gui/socialwindow.cpp +++ b/src/gui/socialwindow.cpp @@ -23,6 +23,7 @@ #include "actorspritemanager.h" #include "guild.h" +#include "guildmanager.h" #include "keyboardconfig.h" #include "localplayer.h" #include "logger.h" @@ -1310,7 +1311,10 @@ void SocialWindow::action(const gcn::ActionEvent &event) strprintf(_("Accepted guild invite from %s."), mPartyInviter.c_str())); } - Net::getGuildHandler()->inviteResponse(mGuildInvited, true); + if (!guildManager || !guildManager->getEnableGuildBot()) + Net::getGuildHandler()->inviteResponse(mGuildInvited, true); + else + guildManager->inviteResponse(true); } else if (eventId == "no") { @@ -1320,7 +1324,10 @@ void SocialWindow::action(const gcn::ActionEvent &event) strprintf(_("Rejected guild invite from %s."), mPartyInviter.c_str())); } - Net::getGuildHandler()->inviteResponse(mGuildInvited, false); + if (!guildManager || !guildManager->getEnableGuildBot()) + Net::getGuildHandler()->inviteResponse(mGuildInvited, false); + else + guildManager->inviteResponse(false); } mGuildInvited = 0; diff --git a/src/guildmanager.cpp b/src/guildmanager.cpp index 624193698..12bcf717a 100644 --- a/src/guildmanager.cpp +++ b/src/guildmanager.cpp @@ -318,6 +318,14 @@ bool GuildManager::process(std::string msg) mRequest = true; return true; } + else if (findCutFirst(msg, "You have been invited to the ") + && findCutLast(msg, " guild chat. If you would like to accept " + "this invitation please reply \"yes\" and if not then \"no\" .")) + { + if (socialWindow) + socialWindow->showGuildInvite(msg, 1, ""); + return true; + } else { Guild *guild = createGuild(); @@ -388,4 +396,12 @@ void GuildManager::clear() if (guild) socialWindow->removeTab(guild); } -}
\ No newline at end of file +} + +void GuildManager::inviteResponse(bool response) +{ + if (response) + send("yes"); + else + send("no"); +} diff --git a/src/guildmanager.h b/src/guildmanager.h index c89cba0a6..b95583192 100644 --- a/src/guildmanager.h +++ b/src/guildmanager.h @@ -70,6 +70,8 @@ class GuildManager void reload(); + void inviteResponse(bool response); + bool havePower() { return mHavePower; } |