正在查看: Housing v14.7.8 应用的 QBPresence.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Housing v14.7.8 应用的 QBPresence.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.quickblox.chat.model;
import com.quickblox.chat.JIDHelper;
import kotlin.jvm.internal.q;
import org.jivesoftware.smack.packet.Presence;
public class QBPresence {
public static final String X_ELEMENT_NAME = "x";
public static final String X_ELEMENT_NAMESPACE = "http://jabber.org/protocol/muc#user";
private Mode mode;
private int priority;
private String resource;
private String status;
private Type type;
private Integer userId;
public static class AnonymousClass1 {
static final int[] $SwitchMap$com$quickblox$chat$model$QBPresence$Type;
static final int[] $SwitchMap$org$jivesoftware$smack$packet$Presence$Type;
static {
int[] iArr = new int[Presence.Type.values().length];
$SwitchMap$org$jivesoftware$smack$packet$Presence$Type = iArr;
try {
iArr[Presence.Type.available.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$org$jivesoftware$smack$packet$Presence$Type[Presence.Type.unavailable.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
int[] iArr2 = new int[Type.values().length];
$SwitchMap$com$quickblox$chat$model$QBPresence$Type = iArr2;
try {
iArr2[Type.online.ordinal()] = 1;
} catch (NoSuchFieldError unused3) {
}
try {
$SwitchMap$com$quickblox$chat$model$QBPresence$Type[Type.offline.ordinal()] = 2;
} catch (NoSuchFieldError unused4) {
}
}
}
public enum Mode {
chat,
available,
away,
xa,
dnd
}
public enum Type {
online,
offline,
error;
public static Type fromSmackPresenceType(Presence.Type type) {
int i = AnonymousClass1.$SwitchMap$org$jivesoftware$smack$packet$Presence$Type[type.ordinal()];
return i != 1 ? i != 2 ? error : offline : online;
}
public static Presence.Type toSmackPresenceType(Type type) {
int i = AnonymousClass1.$SwitchMap$com$quickblox$chat$model$QBPresence$Type[type.ordinal()];
return i != 1 ? i != 2 ? Presence.Type.error : Presence.Type.unavailable : Presence.Type.available;
}
}
public QBPresence(Type type) {
Type type2 = Type.online;
this.priority = q.MIN_VALUE;
this.type = type;
}
public static Presence toSmackPresence(QBPresence qBPresence) {
Presence.Type smackPresenceType = Type.toSmackPresenceType(qBPresence.getType());
if (qBPresence.getMode() == null && qBPresence.getStatus() == null && qBPresence.getPriority() == Integer.MIN_VALUE) {
return new Presence(smackPresenceType);
}
return new Presence(smackPresenceType, qBPresence.getStatus(), qBPresence.getPriority(), qBPresence.getMode() != null ? Presence.Mode.valueOf(qBPresence.getMode().toString()) : null);
}
public Mode getMode() {
return this.mode;
}
public int getPriority() {
return this.priority;
}
public String getResource() {
return this.resource;
}
public String getStatus() {
return this.status;
}
public Type getType() {
return this.type;
}
public Integer getUserId() {
return this.userId;
}
public void setMode(Mode mode) {
this.mode = mode;
}
public void setPriority(int i) {
this.priority = i;
}
public void setStatus(String str) {
this.status = str;
}
public void setType(Type type) {
this.type = type;
}
public String toString() {
if (getUserId() == null) {
return getClass().getSimpleName();
}
StringBuilder sb = new StringBuilder("{type=");
sb.append(getType());
sb.append(", user=");
sb.append(getUserId() == null ? "null" : getUserId());
sb.append(", status=");
return a.r(sb, getStatus() != null ? getStatus() : "null", "}");
}
public QBPresence(Type type, String str, int i, Mode mode) {
Type type2 = Type.online;
this.type = type;
this.status = str;
this.priority = i;
this.mode = mode;
}
public QBPresence(Presence presence) {
this.type = Type.online;
this.priority = q.MIN_VALUE;
String from = presence.getFrom();
JIDHelper jIDHelper = JIDHelper.INSTANCE;
if (jIDHelper.isChatJid(from)) {
this.userId = Integer.valueOf(jIDHelper.parseUserId(from));
this.resource = jIDHelper.parseResource(from);
} else {
this.userId = jIDHelper.parseRoomOccupant(from);
}
this.type = Type.fromSmackPresenceType(presence.getType());
this.status = presence.getStatus();
Presence.Mode mode = presence.getMode();
if (mode != null) {
this.mode = Mode.valueOf(mode.name());
}
}
}