aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-03-09 19:40:09 +0100
committerChristian Schneppe <christian@pix-art.de>2017-03-09 19:40:09 +0100
commit76d0fdcc5af795b02eb871f31f323436c7e19cdc (patch)
treefe66970fa646c1dd946be38b58d25fdc0306eb74
parentc8b893780f9f7c931eb4ff1b4fbff2d840fcad27 (diff)
fixed multi-session-nick renaming behaviour
-rw-r--r--src/main/java/de/pixart/messenger/entities/MucOptions.java5
-rw-r--r--src/main/java/de/pixart/messenger/parser/PresenceParser.java20
2 files changed, 11 insertions, 14 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/MucOptions.java b/src/main/java/de/pixart/messenger/entities/MucOptions.java
index 068e2f95b..77fd1189c 100644
--- a/src/main/java/de/pixart/messenger/entities/MucOptions.java
+++ b/src/main/java/de/pixart/messenger/entities/MucOptions.java
@@ -332,7 +332,6 @@ public class MucOptions {
private User self;
private String subject = null;
private String password = null;
- public boolean mNickChangingInProgress = false;
public MucOptions(Conversation conversation) {
this.account = conversation.getAccount();
@@ -446,8 +445,10 @@ public class MucOptions {
if (old != null) {
users.remove(old);
}
+ boolean fullJidIsSelf = isOnline && user.getFullJid() != null && user.getFullJid().equals(self.getFullJid());
if ((!membersOnly() || user.getAffiliation().ranks(Affiliation.MEMBER))
- && user.getAffiliation().outranks(Affiliation.OUTCAST)) {
+ && user.getAffiliation().outranks(Affiliation.OUTCAST)
+ && !fullJidIsSelf) {
this.users.add(user);
}
}
diff --git a/src/main/java/de/pixart/messenger/parser/PresenceParser.java b/src/main/java/de/pixart/messenger/parser/PresenceParser.java
index 9ba45b201..41dfa61e9 100644
--- a/src/main/java/de/pixart/messenger/parser/PresenceParser.java
+++ b/src/main/java/de/pixart/messenger/parser/PresenceParser.java
@@ -64,18 +64,15 @@ public class PresenceParser extends AbstractParser implements
if (item != null && !from.isBareJid()) {
mucOptions.setError(MucOptions.Error.NONE);
MucOptions.User user = parseItem(conversation, item, from);
- if (codes.contains(MucOptions.STATUS_CODE_SELF_PRESENCE) || packet.getFrom().equals(mucOptions.getConversation().getJid())) {
+ if (codes.contains(MucOptions.STATUS_CODE_SELF_PRESENCE)) {
mucOptions.setOnline();
mucOptions.setSelf(user);
- if (mucOptions.mNickChangingInProgress) {
- if (mucOptions.onRenameListener != null) {
- mucOptions.onRenameListener.onSuccess();
- }
- mucOptions.mNickChangingInProgress = false;
+ if (mucOptions.onRenameListener != null) {
+ mucOptions.onRenameListener.onSuccess();
+ mucOptions.onRenameListener = null;
}
- } else {
- mucOptions.updateUser(user);
}
+ mucOptions.updateUser(user);
if (codes.contains(MucOptions.STATUS_CODE_ROOM_CREATED) && mucOptions.autoPushConfiguration()) {
Log.d(Config.LOGTAG, mucOptions.getAccount().getJid().toBareJid()
+ ": room '"
@@ -111,8 +108,7 @@ public class PresenceParser extends AbstractParser implements
} else if (type.equals("unavailable")) {
if (codes.contains(MucOptions.STATUS_CODE_SELF_PRESENCE) ||
packet.getFrom().equals(mucOptions.getConversation().getJid())) {
- if (codes.contains(MucOptions.STATUS_CODE_CHANGED_NICK)) {
- mucOptions.mNickChangingInProgress = true;
+ if (codes.contains(MucOptions.STATUS_CODE_KICKED)) {
} else if (codes.contains(MucOptions.STATUS_CODE_KICKED)) {
mucOptions.setError(MucOptions.Error.KICKED);
} else if (codes.contains(MucOptions.STATUS_CODE_BANNED)) {
@@ -123,7 +119,7 @@ public class PresenceParser extends AbstractParser implements
mucOptions.setError(MucOptions.Error.MEMBERS_ONLY);
} else if (codes.contains(MucOptions.STATUS_CODE_SHUTDOWN)) {
mucOptions.setError(MucOptions.Error.SHUTDOWN);
- } else {
+ } else if (!codes.contains(MucOptions.STATUS_CODE_CHANGED_NICK)) {
mucOptions.setError(MucOptions.Error.UNKNOWN);
Log.d(Config.LOGTAG, "unknown error in conference: " + packet);
}
@@ -142,7 +138,7 @@ public class PresenceParser extends AbstractParser implements
if (error != null && error.hasChild("conflict")) {
if (mucOptions.online()) {
if (mucOptions.onRenameListener != null) {
- mucOptions.onRenameListener.onFailure();
+ mucOptions.onRenameListener = null;
}
} else {
mucOptions.setError(MucOptions.Error.NICK_IN_USE);