fixed multi-session-nick renaming behaviour
This commit is contained in:
parent
c8b893780f
commit
76d0fdcc5a
2 changed files with 11 additions and 14 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Reference in a new issue