解决在线逻辑错误问题

This commit is contained in:
heavyrian2012
2022-01-06 09:56:46 +08:00
parent f8f225d741
commit 6f5b021c89
6 changed files with 6 additions and 39 deletions
@@ -24,7 +24,7 @@ public class UploadDeviceTokenHandler extends IMHandler<WFCMessage.UploadDeviceT
MemorySessionStore.Session session = m_sessionsStore.getSession(clientID);
session.setPlatform(request.getPlatform());
session.setAppName(request.getAppName());
if ((request.getPlatform() == ProtoConstants.Platform.Platform_iOS || request.getPlatform() == ProtoConstants.Platform.Platform_iPad) && request.getPushType() == 2) {
if (request.getPlatform() == ProtoConstants.Platform.Platform_iOS && request.getPushType() == 2) {
session.setVoipDeviceToken(request.getDeviceToken());
m_sessionsStore.updateSessionToken(session, true);
} else {
@@ -1577,8 +1577,6 @@ public class DatabaseStore {
sql = "update t_user_session set `_deleted` = ?, `_token` = ?, `_voip_token` = ?, `_dt` = ? where `_uid`=? and (`_platform` = ? or `_platform` = ? or `_platform` = ?) and `_cid` <> ? and `_deleted` = 0";
} else if(platform == ProtoConstants.Platform.Platform_iOS || platform == ProtoConstants.Platform.Platform_Android) {
sql = "update t_user_session set `_deleted` = ?, `_token` = ?, `_voip_token` = ?, `_dt` = ? where `_uid`=? and (`_platform` = ? or `_platform` = ?) and `_cid` <> ? and `_deleted` = 0";
} else if(platform == ProtoConstants.Platform.Platform_iPad || platform == ProtoConstants.Platform.Platform_APad) {
sql = "update t_user_session set `_deleted` = ?, `_token` = ?, `_voip_token` = ?, `_dt` = ? where `_uid`=? and (`_platform` = ? or `_platform` = ?) and `_cid` <> ? and `_deleted` = 0";
} else {
sql = "update t_user_session set `_deleted` = ?, `_token` = ?, `_voip_token` = ?, `_dt` = ? where `_uid`=? and `_platform` = ? and `_cid` <> ? and `_deleted` = 0";
}
@@ -1600,9 +1598,6 @@ public class DatabaseStore {
} else if(platform == ProtoConstants.Platform.Platform_iOS || platform == ProtoConstants.Platform.Platform_Android) {
statement.setInt(index++, ProtoConstants.Platform.Platform_iOS);
statement.setInt(index++, ProtoConstants.Platform.Platform_Android);
} else if(platform == ProtoConstants.Platform.Platform_iPad || platform == ProtoConstants.Platform.Platform_APad) {
statement.setInt(index++, ProtoConstants.Platform.Platform_iPad);
statement.setInt(index++, ProtoConstants.Platform.Platform_APad);
} else {
statement.setInt(index++, platform);
}
@@ -2345,7 +2345,6 @@ public class MemoryMessagesStore implements IMessagesStore {
}
String pcValue = null;
String padValue = null;
for (MemorySessionStore.Session s : m_Server.getStore().sessionsStore().sessionForUser(session.username)) {
if (s.getDeleted() != 0 || !m_Server.getConnectionsManager().isConnected(s.getClientID())) {
continue;
@@ -2357,10 +2356,6 @@ public class MemoryMessagesStore implements IMessagesStore {
case Platform_OSX:
pcValue = System.currentTimeMillis() + "|" + s.getPlatform() + "|" + s.getClientID() + "|" + s.getPhoneName();
break;
case Platform_iPad:
case Platform_APad:
padValue = System.currentTimeMillis() + "|" + s.getPlatform() + "|" + s.getClientID() + "|" + s.getPhoneName();
break;
default:
break;
}
@@ -2376,17 +2371,6 @@ public class MemoryMessagesStore implements IMessagesStore {
updateUserSettings(session.username, WFCMessage.ModifyUserSettingReq.newBuilder().setScope(kUserSettingPCOnline).setKey("PC").setValue("").build(), session.clientID);
}
}
WFCMessage.UserSettingEntry padentry = getUserSetting(session.getUsername(), kUserSettingPCOnline, "Pad");
if (padValue != null) {
if (padentry == null || StringUtil.isNullOrEmpty(padentry.getValue())) {
updateUserSettings(session.username, WFCMessage.ModifyUserSettingReq.newBuilder().setScope(kUserSettingPCOnline).setKey("Pad").setValue(padValue).build(), session.clientID);
}
} else {
if (padentry != null && !StringUtil.isNullOrEmpty(padentry.getValue())) {
updateUserSettings(session.username, WFCMessage.ModifyUserSettingReq.newBuilder().setScope(kUserSettingPCOnline).setKey("Pad").setValue("").build(), session.clientID);
}
}
}
@Override
@@ -407,10 +407,6 @@ public class MemorySessionStore implements ISessionsStore {
if (s.getPlatform() == ProtoConstants.Platform.Platform_OSX || s.getPlatform() == ProtoConstants.Platform.Platform_Windows || platform == ProtoConstants.Platform.Platform_LINUX) {
remove = true;
}
} else if(platform == ProtoConstants.Platform.Platform_iPad || platform == ProtoConstants.Platform.Platform_APad) {
if (s.getPlatform() == ProtoConstants.Platform.Platform_iPad || s.getPlatform() == ProtoConstants.Platform.Platform_APad) {
remove = true;
}
} else {
if (s.getPlatform() ==platform) {
remove = true;
@@ -733,11 +729,9 @@ public class MemorySessionStore implements ISessionsStore {
return ErrorCode.ERROR_CODE_SUCCESS;
}
if (session.getPlatform() == ProtoConstants.Platform.Platform_LINUX
|| session.getPlatform() == ProtoConstants.Platform.Platform_WEB
|| session.getPlatform() == ProtoConstants.Platform.Platform_Windows
|| session.getPlatform() == ProtoConstants.Platform.Platform_OSX
|| session.getPlatform() == ProtoConstants.Platform.Platform_iPad
|| session.getPlatform() == ProtoConstants.Platform.Platform_APad
) {
|| session.getPlatform() == ProtoConstants.Platform.Platform_OSX) {
databaseStore.updateSessionDeleted(operator, pcClientId, 1);
sessions.remove(pcClientId);
mServer.getProcessor().kickoffSession(session);
@@ -213,9 +213,7 @@ public class MessagesPublisher {
if (targetSession.getPlatform() == ProtoConstants.Platform.Platform_WEB
|| targetSession.getPlatform() == ProtoConstants.Platform.Platform_Windows
|| targetSession.getPlatform() == ProtoConstants.Platform.Platform_LINUX
|| targetSession.getPlatform() == ProtoConstants.Platform.Platform_OSX
|| targetSession.getPlatform() == ProtoConstants.Platform.Platform_iPad
|| targetSession.getPlatform() == ProtoConstants.Platform.Platform_APad) {
|| targetSession.getPlatform() == ProtoConstants.Platform.Platform_OSX) {
boolean targetIsActive = this.connectionDescriptors.isConnected(targetSession.getClientSession().clientID);
if (targetIsActive) {
isPcOnline = true;