fixed multi-session-nick renaming behaviour
This commit is contained in:
parent
aa24a057fc
commit
6088913fb6
|
@ -332,7 +332,6 @@ public class MucOptions {
|
||||||
private User self;
|
private User self;
|
||||||
private String subject = null;
|
private String subject = null;
|
||||||
private String password = null;
|
private String password = null;
|
||||||
public boolean mNickChangingInProgress = false;
|
|
||||||
|
|
||||||
public MucOptions(Conversation conversation) {
|
public MucOptions(Conversation conversation) {
|
||||||
this.account = conversation.getAccount();
|
this.account = conversation.getAccount();
|
||||||
|
@ -448,8 +447,10 @@ public class MucOptions {
|
||||||
if (old != null) {
|
if (old != null) {
|
||||||
users.remove(old);
|
users.remove(old);
|
||||||
}
|
}
|
||||||
|
boolean fullJidIsSelf = isOnline && user.getFullJid() != null && user.getFullJid().equals(self.getFullJid());
|
||||||
if ((!membersOnly() || user.getAffiliation().ranks(Affiliation.MEMBER))
|
if ((!membersOnly() || user.getAffiliation().ranks(Affiliation.MEMBER))
|
||||||
&& user.getAffiliation().outranks(Affiliation.OUTCAST)){
|
&& user.getAffiliation().outranks(Affiliation.OUTCAST)
|
||||||
|
&& !fullJidIsSelf){
|
||||||
this.users.add(user);
|
this.users.add(user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,18 +65,15 @@ public class PresenceParser extends AbstractParser implements
|
||||||
if (item != null && !from.isBareJid()) {
|
if (item != null && !from.isBareJid()) {
|
||||||
mucOptions.setError(MucOptions.Error.NONE);
|
mucOptions.setError(MucOptions.Error.NONE);
|
||||||
MucOptions.User user = parseItem(conversation, item, from);
|
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.setOnline();
|
||||||
mucOptions.setSelf(user);
|
mucOptions.setSelf(user);
|
||||||
if (mucOptions.mNickChangingInProgress) {
|
if (mucOptions.onRenameListener != null) {
|
||||||
if (mucOptions.onRenameListener != null) {
|
mucOptions.onRenameListener.onSuccess();
|
||||||
mucOptions.onRenameListener.onSuccess();
|
mucOptions.onRenameListener = null;
|
||||||
}
|
|
||||||
mucOptions.mNickChangingInProgress = false;
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
mucOptions.updateUser(user);
|
|
||||||
}
|
}
|
||||||
|
mucOptions.updateUser(user);
|
||||||
if (codes.contains(MucOptions.STATUS_CODE_ROOM_CREATED) && mucOptions.autoPushConfiguration()) {
|
if (codes.contains(MucOptions.STATUS_CODE_ROOM_CREATED) && mucOptions.autoPushConfiguration()) {
|
||||||
Log.d(Config.LOGTAG,mucOptions.getAccount().getJid().toBareJid()
|
Log.d(Config.LOGTAG,mucOptions.getAccount().getJid().toBareJid()
|
||||||
+": room '"
|
+": room '"
|
||||||
|
@ -112,9 +109,7 @@ public class PresenceParser extends AbstractParser implements
|
||||||
} else if (type.equals("unavailable")) {
|
} else if (type.equals("unavailable")) {
|
||||||
if (codes.contains(MucOptions.STATUS_CODE_SELF_PRESENCE) ||
|
if (codes.contains(MucOptions.STATUS_CODE_SELF_PRESENCE) ||
|
||||||
packet.getFrom().equals(mucOptions.getConversation().getJid())) {
|
packet.getFrom().equals(mucOptions.getConversation().getJid())) {
|
||||||
if (codes.contains(MucOptions.STATUS_CODE_CHANGED_NICK)) {
|
if (codes.contains(MucOptions.STATUS_CODE_KICKED)) {
|
||||||
mucOptions.mNickChangingInProgress = true;
|
|
||||||
} else if (codes.contains(MucOptions.STATUS_CODE_KICKED)) {
|
|
||||||
mucOptions.setError(MucOptions.Error.KICKED);
|
mucOptions.setError(MucOptions.Error.KICKED);
|
||||||
} else if (codes.contains(MucOptions.STATUS_CODE_BANNED)) {
|
} else if (codes.contains(MucOptions.STATUS_CODE_BANNED)) {
|
||||||
mucOptions.setError(MucOptions.Error.BANNED);
|
mucOptions.setError(MucOptions.Error.BANNED);
|
||||||
|
@ -124,7 +119,7 @@ public class PresenceParser extends AbstractParser implements
|
||||||
mucOptions.setError(MucOptions.Error.MEMBERS_ONLY);
|
mucOptions.setError(MucOptions.Error.MEMBERS_ONLY);
|
||||||
} else if (codes.contains(MucOptions.STATUS_CODE_SHUTDOWN)) {
|
} else if (codes.contains(MucOptions.STATUS_CODE_SHUTDOWN)) {
|
||||||
mucOptions.setError(MucOptions.Error.SHUTDOWN);
|
mucOptions.setError(MucOptions.Error.SHUTDOWN);
|
||||||
} else {
|
} else if (!codes.contains(MucOptions.STATUS_CODE_CHANGED_NICK)) {
|
||||||
mucOptions.setError(MucOptions.Error.UNKNOWN);
|
mucOptions.setError(MucOptions.Error.UNKNOWN);
|
||||||
Log.d(Config.LOGTAG, "unknown error in conference: " + packet);
|
Log.d(Config.LOGTAG, "unknown error in conference: " + packet);
|
||||||
}
|
}
|
||||||
|
@ -144,6 +139,7 @@ public class PresenceParser extends AbstractParser implements
|
||||||
if (mucOptions.online()) {
|
if (mucOptions.online()) {
|
||||||
if (mucOptions.onRenameListener != null) {
|
if (mucOptions.onRenameListener != null) {
|
||||||
mucOptions.onRenameListener.onFailure();
|
mucOptions.onRenameListener.onFailure();
|
||||||
|
mucOptions.onRenameListener = null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mucOptions.setError(MucOptions.Error.NICK_IN_USE);
|
mucOptions.setError(MucOptions.Error.NICK_IN_USE);
|
||||||
|
|
Loading…
Reference in a new issue