summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-08-28 22:42:21 +0300
committerAndrei Karas <akaras@inbox.ru>2011-08-28 22:42:21 +0300
commit09eb9b1ca997c3a6489f37bdaa3c590aeeb1501b (patch)
tree6ea0a8109fa0c6bba31a2681493ea659965ba3e8
parenta9345c0e74408538488b0a329202ce611a4a0072 (diff)
downloadplus-09eb9b1ca997c3a6489f37bdaa3c590aeeb1501b.tar.gz
plus-09eb9b1ca997c3a6489f37bdaa3c590aeeb1501b.tar.bz2
plus-09eb9b1ca997c3a6489f37bdaa3c590aeeb1501b.tar.xz
plus-09eb9b1ca997c3a6489f37bdaa3c590aeeb1501b.zip
Impliment correct removing from guild self and other players on kick.
-rw-r--r--src/guildmanager.cpp53
-rw-r--r--src/guildmanager.h2
2 files changed, 53 insertions, 2 deletions
diff --git a/src/guildmanager.cpp b/src/guildmanager.cpp
index 12bcf717a..1ce8b9a74 100644
--- a/src/guildmanager.cpp
+++ b/src/guildmanager.cpp
@@ -33,6 +33,7 @@
#include "net/chathandler.h"
#include "net/net.h"
+#include "utils/gettext.h"
#include "utils/stringutils.h"
#include "debug.h"
@@ -204,7 +205,9 @@ bool GuildManager::process(std::string msg)
if (msg.size() > 4 && msg[0] == '#' && msg[1] == '#')
msg = msg.substr(3);
- if (findCutLast(msg, " is now Offline."))
+ bool haveNick = (msg.find(": ") != std::string::npos);
+
+ if (!haveNick && findCutLast(msg, " is now Offline."))
{
Guild *guild = createGuild();
if (!guild)
@@ -221,7 +224,7 @@ bool GuildManager::process(std::string msg)
mRequest = false;
return true;
}
- else if (findCutLast(msg, " is now Online."))
+ else if (!haveNick && findCutLast(msg, " is now Online."))
{
Guild *guild = createGuild();
if (!guild)
@@ -326,6 +329,33 @@ bool GuildManager::process(std::string msg)
socialWindow->showGuildInvite(msg, 1, "");
return true;
}
+ else if (!haveNick && findCutLast(msg,
+ " has been removed from the Guild."))
+ {
+ Guild *guild = createGuild();
+ if (!guild)
+ return false;
+ if (msg.size() < 4)
+ return false;
+ if (msg[0] == '#' && msg[1] == '#')
+ msg = msg.substr(3);
+
+ if (actorSpriteManager)
+ {
+ Being *b = actorSpriteManager->findBeingByName(
+ msg, Being::PLAYER);
+
+ if (b)
+ b->clearGuilds();
+ }
+
+ guild->removeMember(msg);
+ return true;
+ }
+ else if (msg == "You have been removed from the Guild")
+ {
+ return afterRemove();
+ }
else
{
Guild *guild = createGuild();
@@ -405,3 +435,22 @@ void GuildManager::inviteResponse(bool response)
else
send("no");
}
+
+bool GuildManager::afterRemove()
+{
+ Guild *guild = createGuild();
+ if (!guild)
+ return false;
+ guild->removeFromMembers();
+ guild->clearMembers();
+ SERVER_NOTICE(_("You have left the guild."))
+ delete mTab;
+ mTab = 0;
+
+ if (socialWindow)
+ socialWindow->removeTab(guild);
+ if (actorSpriteManager)
+ actorSpriteManager->updatePlayerColors();
+ reload();
+ return true;
+}
diff --git a/src/guildmanager.h b/src/guildmanager.h
index b95583192..d0ee7fb62 100644
--- a/src/guildmanager.h
+++ b/src/guildmanager.h
@@ -72,6 +72,8 @@ class GuildManager
void inviteResponse(bool response);
+ bool afterRemove();
+
bool havePower()
{ return mHavePower; }