Commit c6bc9ed0 authored by Grigory Fedorov's avatar Grigory Fedorov

Smack: MUCManager and RoomChat migration completed. #502

parent e3b0f3d2
...@@ -40,6 +40,7 @@ import org.jivesoftware.smack.XMPPConnection; ...@@ -40,6 +40,7 @@ import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Stanza; import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.packet.XMPPError;
import org.jivesoftware.smackx.muc.MultiUserChat; import org.jivesoftware.smackx.muc.MultiUserChat;
import org.jivesoftware.smackx.muc.MultiUserChatManager; import org.jivesoftware.smackx.muc.MultiUserChatManager;
import org.jivesoftware.smackx.muc.packet.MUCUser; import org.jivesoftware.smackx.muc.packet.MUCUser;
...@@ -335,13 +336,15 @@ public class MUCManager implements OnLoadListener, OnPacketListener { ...@@ -335,13 +336,15 @@ public class MUCManager implements OnLoadListener, OnPacketListener {
roomChat.setState(RoomState.error); roomChat.setState(RoomState.error);
addAuthorizationError(account, room); addAuthorizationError(account, room);
// if (e.getXMPPError() != null && e.getXMPPError().getCode() == 409) { XMPPError xmppError = e.getXMPPError();
// Application.getInstance().onError(R.string.NICK_ALREADY_USED);
// } else if (e.getXMPPError() != null && e.getXMPPError().getCode() == 401) { if (xmppError != null && xmppError.getCondition() == XMPPError.Condition.conflict) {
// Application.getInstance().onError(R.string.AUTHENTICATION_FAILED); Application.getInstance().onError(R.string.NICK_ALREADY_USED);
// } else { } else if (xmppError != null && xmppError.getCondition() == XMPPError.Condition.not_authorized) {
// Application.getInstance().onError(R.string.NOT_CONNECTED); Application.getInstance().onError(R.string.AUTHENTICATION_FAILED);
// } } else {
Application.getInstance().onError(R.string.NOT_CONNECTED);
}
RosterManager.getInstance().onContactChanged(account, room); RosterManager.getInstance().onContactChanged(account, room);
} }
}); });
......
...@@ -279,22 +279,21 @@ public class RoomChat extends AbstractChat { ...@@ -279,22 +279,21 @@ public class RoomChat extends AbstractChat {
occupants.remove(stringPrep); occupants.remove(stringPrep);
MUCUser mucUser = MUC.getMUCUserExtension(presence); MUCUser mucUser = MUC.getMUCUserExtension(presence);
if (mucUser != null && mucUser.getStatus() != null) { if (mucUser != null && mucUser.getStatus() != null) {
// String code = mucUser.getStatus().getCode(); if (mucUser.getStatus().contains(MUCUser.Status.KICKED_307)) {
// if ("307".equals(code)) { onKick(resource, mucUser.getItem().getActor());
// onKick(resource, mucUser.getItem().getActor()); } else if (mucUser.getStatus().contains(MUCUser.Status.BANNED_301)){
// } else if ("301".equals(code)) { onBan(resource, mucUser.getItem().getActor());
// onBan(resource, mucUser.getItem().getActor()); } else if (mucUser.getStatus().contains(MUCUser.Status.NEW_NICKNAME_303)) {
// } else if ("303".equals(code)) { String newNick = mucUser.getItem().getNick();
// String newNick = mucUser.getItem().getNick(); if (newNick == null) {
// if (newNick == null) { return true;
// return true; }
// } onRename(resource, newNick);
// onRename(resource, newNick); Occupant occupant = createOccupant(newNick, presence);
// Occupant occupant = createOccupant(newNick, presence); occupants.put(Jid.getStringPrep(newNick), occupant);
// occupants.put(Jid.getStringPrep(newNick), occupant); } else if (mucUser.getStatus().contains(MUCUser.Status.REMOVED_AFFIL_CHANGE_321)) {
// } else if ("321".equals(code)) { onRevoke(resource, mucUser.getItem().getActor());
// onRevoke(resource, mucUser.getItem().getActor()); }
// }
} else { } else {
onLeave(resource); onLeave(resource);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment