Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
acb4cf81de | ||
|
|
ace676d215 | ||
|
|
1170c4209b | ||
|
|
57e8814d9c | ||
|
|
e3d9e0d183 | ||
|
|
d6f5614f49 | ||
|
|
9ed4ab7e08 | ||
|
|
4da3d3421d | ||
|
|
40ef9abd35 | ||
|
|
6f5b021c89 | ||
|
|
f8f225d741 | ||
|
|
546110f6d3 | ||
|
|
c7dbf45af6 |
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
<relativePath>../</relativePath>
|
<relativePath>../</relativePath>
|
||||||
<artifactId>wildfirechat-parent</artifactId>
|
<artifactId>wildfirechat-parent</artifactId>
|
||||||
<groupId>cn.wildfirechat</groupId>
|
<groupId>cn.wildfirechat</groupId>
|
||||||
<version>0.80</version>
|
<version>0.83</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>moquette-broker</artifactId>
|
<artifactId>moquette-broker</artifactId>
|
||||||
|
|||||||
@@ -94,13 +94,9 @@ public class PushServer {
|
|||||||
pushMessage.deviceToken = session.getDeviceToken();
|
pushMessage.deviceToken = session.getDeviceToken();
|
||||||
pushMessage.unReceivedMsg = badge;
|
pushMessage.unReceivedMsg = badge;
|
||||||
pushMessage.userId = session.getUsername();
|
pushMessage.userId = session.getUsername();
|
||||||
if (session.getPlatform() == ProtoConstants.Platform.Platform_iOS
|
if (session.getPlatform() == ProtoConstants.Platform.Platform_iOS || session.getPlatform() == ProtoConstants.Platform.Platform_Android) {
|
||||||
|| session.getPlatform() == ProtoConstants.Platform.Platform_Android
|
|
||||||
|| session.getPlatform() == ProtoConstants.Platform.Platform_iPad
|
|
||||||
|| session.getPlatform() == ProtoConstants.Platform.Platform_APad) {
|
|
||||||
String url = androidPushServerUrl;
|
String url = androidPushServerUrl;
|
||||||
if (session.getPlatform() == ProtoConstants.Platform.Platform_iOS
|
if (session.getPlatform() == ProtoConstants.Platform.Platform_iOS) {
|
||||||
|| session.getPlatform() == ProtoConstants.Platform.Platform_iPad) {
|
|
||||||
url = iOSPushServerUrl;
|
url = iOSPushServerUrl;
|
||||||
pushMessage.voipDeviceToken = session.getVoipDeviceToken();
|
pushMessage.voipDeviceToken = session.getVoipDeviceToken();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class HandleFriendRequestHandler extends IMHandler<WFCMessage.HandleFrien
|
|||||||
public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.HandleFriendRequest request, Qos1PublishHandler.IMCallback callback) {
|
public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.HandleFriendRequest request, Qos1PublishHandler.IMCallback callback) {
|
||||||
WFCMessage.Message.Builder builder = WFCMessage.Message.newBuilder();
|
WFCMessage.Message.Builder builder = WFCMessage.Message.newBuilder();
|
||||||
builder.setFromUser(request.getTargetUid());
|
builder.setFromUser(request.getTargetUid());
|
||||||
long[] heads = new long[2];
|
long[] heads = new long[4];
|
||||||
boolean isAdmin = requestSourceType == ProtoConstants.RequestSourceType.Request_From_Admin;
|
boolean isAdmin = requestSourceType == ProtoConstants.RequestSourceType.Request_From_Admin;
|
||||||
ErrorCode errorCode = m_messagesStore.handleFriendRequest(fromUser, request, builder, heads, isAdmin);
|
ErrorCode errorCode = m_messagesStore.handleFriendRequest(fromUser, request, builder, heads, isAdmin);
|
||||||
|
|
||||||
@@ -84,6 +84,14 @@ public class HandleFriendRequestHandler extends IMHandler<WFCMessage.HandleFrien
|
|||||||
publisher.publishNotification(IMTopic.NotifyFriendTopic, request.getTargetUid(), heads[0]);
|
publisher.publishNotification(IMTopic.NotifyFriendTopic, request.getTargetUid(), heads[0]);
|
||||||
publisher.publishNotification(IMTopic.NotifyFriendTopic, fromUser, heads[1]);
|
publisher.publishNotification(IMTopic.NotifyFriendTopic, fromUser, heads[1]);
|
||||||
}
|
}
|
||||||
|
if(!isAdmin) {
|
||||||
|
if(heads[2] > 0) {
|
||||||
|
publisher.publishNotification(IMTopic.NotifyFriendRequestTopic, request.getTargetUid(), heads[2], fromUser, null);
|
||||||
|
}
|
||||||
|
if(heads[3] > 0) {
|
||||||
|
publisher.publishNotification(IMTopic.NotifyFriendRequestTopic, fromUser, heads[3], fromUser, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(errorCode == ERROR_CODE_ALREADY_FRIENDS) {
|
if(errorCode == ERROR_CODE_ALREADY_FRIENDS) {
|
||||||
errorCode = ERROR_CODE_SUCCESS;
|
errorCode = ERROR_CODE_SUCCESS;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class UploadDeviceTokenHandler extends IMHandler<WFCMessage.UploadDeviceT
|
|||||||
MemorySessionStore.Session session = m_sessionsStore.getSession(clientID);
|
MemorySessionStore.Session session = m_sessionsStore.getSession(clientID);
|
||||||
session.setPlatform(request.getPlatform());
|
session.setPlatform(request.getPlatform());
|
||||||
session.setAppName(request.getAppName());
|
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());
|
session.setVoipDeviceToken(request.getDeviceToken());
|
||||||
m_sessionsStore.updateSessionToken(session, true);
|
m_sessionsStore.updateSessionToken(session, true);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -914,20 +914,24 @@ public class DatabaseStore {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void persistUserMessage(final String userId, final long messageId, final long messageSeq, final int messageContentType) {
|
void persistUserMessage(final String userId, final long messageId, final long messageSeq, int type, String target, int line, boolean directing, final int messageContentType) {
|
||||||
mScheduler.execute(()->{
|
mScheduler.execute(()->{
|
||||||
Connection connection = null;
|
Connection connection = null;
|
||||||
PreparedStatement statement = null;
|
PreparedStatement statement = null;
|
||||||
try {
|
try {
|
||||||
connection = DBUtil.getConnection();
|
connection = DBUtil.getConnection();
|
||||||
|
|
||||||
String sql = "insert into " + getUserMessageTable(userId) + " (`_mid`, `_uid`, `_seq`, `_cont_type`) values(?, ?, ?, ?)";
|
String sql = "insert into " + getUserMessageTable(userId) + " (`_mid`, `_uid`, `_seq`, `_type`, `_target`, `_line`, `_directing`, `_cont_type`) values(?, ?, ?, ?, ?, ?, ?, ?)";
|
||||||
|
|
||||||
statement = connection.prepareStatement(sql);
|
statement = connection.prepareStatement(sql);
|
||||||
int index = 1;
|
int index = 1;
|
||||||
statement.setLong(index++, messageId);
|
statement.setLong(index++, messageId);
|
||||||
statement.setString(index++, userId);
|
statement.setString(index++, userId);
|
||||||
statement.setLong(index++, messageSeq);
|
statement.setLong(index++, messageSeq);
|
||||||
|
statement.setInt(index++, type);
|
||||||
|
statement.setString(index++, target);
|
||||||
|
statement.setInt(index++, line);
|
||||||
|
statement.setInt(index++, directing ? 1 :0);
|
||||||
statement.setInt(index++, messageContentType);
|
statement.setInt(index++, messageContentType);
|
||||||
int count = statement.executeUpdate();
|
int count = statement.executeUpdate();
|
||||||
LOG.info("Update rows {}", count);
|
LOG.info("Update rows {}", count);
|
||||||
@@ -1573,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";
|
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) {
|
} 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";
|
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 {
|
} else {
|
||||||
sql = "update t_user_session set `_deleted` = ?, `_token` = ?, `_voip_token` = ?, `_dt` = ? where `_uid`=? and `_platform` = ? and `_cid` <> ? and `_deleted` = 0";
|
sql = "update t_user_session set `_deleted` = ?, `_token` = ?, `_voip_token` = ?, `_dt` = ? where `_uid`=? and `_platform` = ? and `_cid` <> ? and `_deleted` = 0";
|
||||||
}
|
}
|
||||||
@@ -1596,9 +1598,6 @@ public class DatabaseStore {
|
|||||||
} else if(platform == ProtoConstants.Platform.Platform_iOS || platform == ProtoConstants.Platform.Platform_Android) {
|
} 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_iOS);
|
||||||
statement.setInt(index++, ProtoConstants.Platform.Platform_Android);
|
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 {
|
} else {
|
||||||
statement.setInt(index++, platform);
|
statement.setInt(index++, platform);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -866,7 +866,7 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long insertUserMessages(String sender, int conversationType, String target, int line, int messageContentType, String user, long messageId) {
|
public long insertUserMessages(String sender, int conversationType, String target, int line, int messageContentType, String user, long messageId, boolean directing) {
|
||||||
// messageId是全局的,messageSeq是跟个人相关的,理论上messageId的增长数度远远大于seq。
|
// messageId是全局的,messageSeq是跟个人相关的,理论上messageId的增长数度远远大于seq。
|
||||||
// 考虑到一种情况,当服务器发生变化,用户发生迁移后,messageSeq还需要保持有序。 要么把Seq持久化,要么在迁移后Seq取一个肯定比以前更大的数字(这个数字就是messageId)
|
// 考虑到一种情况,当服务器发生变化,用户发生迁移后,messageSeq还需要保持有序。 要么把Seq持久化,要么在迁移后Seq取一个肯定比以前更大的数字(这个数字就是messageId)
|
||||||
// 这里选择使用后面一种情况
|
// 这里选择使用后面一种情况
|
||||||
@@ -906,7 +906,7 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
mWriteLock.unlock();
|
mWriteLock.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
databaseStore.persistUserMessage(user, messageId, messageSeq, messageContentType);
|
databaseStore.persistUserMessage(user, messageId, messageSeq, conversationType, target, line, directing, messageContentType);
|
||||||
return messageSeq;
|
return messageSeq;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2313,6 +2313,24 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void forceCleanOnlineStatus(String userId, String clientId) {
|
||||||
|
if (m_Server.isShutdowning()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!mMultiPlatformNotification || m_Server.getStore().sessionsStore().isMultiEndpointSupported()) {
|
||||||
|
WFCMessage.UserSettingEntry pcentry = getUserSetting(userId, kUserSettingPCOnline, "PC");
|
||||||
|
if (pcentry != null && !StringUtil.isNullOrEmpty(pcentry.getValue()) && pcentry.getValue().contains(clientId)) {
|
||||||
|
updateUserSettings(userId, WFCMessage.ModifyUserSettingReq.newBuilder().setScope(kUserSettingPCOnline).setKey("PC").setValue("").build(), clientId);
|
||||||
|
}
|
||||||
|
|
||||||
|
WFCMessage.UserSettingEntry padentry = getUserSetting(userId, kUserSettingPCOnline, "Pad");
|
||||||
|
if (padentry != null && !StringUtil.isNullOrEmpty(padentry.getValue()) && padentry.getValue().contains(clientId)) {
|
||||||
|
updateUserSettings(userId, WFCMessage.ModifyUserSettingReq.newBuilder().setScope(kUserSettingPCOnline).setKey("Pad").setValue("").build(), clientId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateUserOnlineSetting(MemorySessionStore.Session session, boolean online) {
|
public void updateUserOnlineSetting(MemorySessionStore.Session session, boolean online) {
|
||||||
if(!mMultiPlatformNotification) {
|
if(!mMultiPlatformNotification) {
|
||||||
@@ -2327,7 +2345,6 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String pcValue = null;
|
String pcValue = null;
|
||||||
String padValue = null;
|
|
||||||
for (MemorySessionStore.Session s : m_Server.getStore().sessionsStore().sessionForUser(session.username)) {
|
for (MemorySessionStore.Session s : m_Server.getStore().sessionsStore().sessionForUser(session.username)) {
|
||||||
if (s.getDeleted() != 0 || !m_Server.getConnectionsManager().isConnected(s.getClientID())) {
|
if (s.getDeleted() != 0 || !m_Server.getConnectionsManager().isConnected(s.getClientID())) {
|
||||||
continue;
|
continue;
|
||||||
@@ -2339,10 +2356,6 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
case Platform_OSX:
|
case Platform_OSX:
|
||||||
pcValue = System.currentTimeMillis() + "|" + s.getPlatform() + "|" + s.getClientID() + "|" + s.getPhoneName();
|
pcValue = System.currentTimeMillis() + "|" + s.getPlatform() + "|" + s.getClientID() + "|" + s.getPhoneName();
|
||||||
break;
|
break;
|
||||||
case Platform_iPad:
|
|
||||||
case Platform_APad:
|
|
||||||
padValue = System.currentTimeMillis() + "|" + s.getPlatform() + "|" + s.getClientID() + "|" + s.getPhoneName();
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2358,17 +2371,6 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
updateUserSettings(session.username, WFCMessage.ModifyUserSettingReq.newBuilder().setScope(kUserSettingPCOnline).setKey("PC").setValue("").build(), session.clientID);
|
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
|
@Override
|
||||||
@@ -2486,7 +2488,21 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
IMap<String, WFCMessage.User> mUserMap = hzInstance.getMap(USERS);
|
IMap<String, WFCMessage.User> mUserMap = hzInstance.getMap(USERS);
|
||||||
WFCMessage.User us = mUserMap.get(userId);
|
WFCMessage.User us = mUserMap.get(userId);
|
||||||
if (us != null) {
|
if (us != null) {
|
||||||
us = WFCMessage.User.newBuilder().setUid(userId).setUpdateDt(System.currentTimeMillis()).setDisplayName("").setName(userId).setDeleted(1).build();
|
us = WFCMessage.User.newBuilder()
|
||||||
|
.setUid(userId)
|
||||||
|
.setUpdateDt(System.currentTimeMillis())
|
||||||
|
.setName(userId)
|
||||||
|
.setDeleted(1)
|
||||||
|
.clearDisplayName()
|
||||||
|
.clearAddress()
|
||||||
|
.clearCompany()
|
||||||
|
.clearEmail()
|
||||||
|
.clearExtra()
|
||||||
|
.clearMobile()
|
||||||
|
.clearPortrait()
|
||||||
|
.clearSocial()
|
||||||
|
.build();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
databaseStore.updateUser(us);
|
databaseStore.updateUser(us);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -3017,6 +3033,8 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
return ErrorCode.ERROR_CODE_FRIEND_REQUEST_EXPIRED;
|
return ErrorCode.ERROR_CODE_FRIEND_REQUEST_EXPIRED;
|
||||||
} else {
|
} else {
|
||||||
existRequest = existRequest.toBuilder().setStatus(request.getStatus()).setUpdateDt(System.currentTimeMillis()).build();
|
existRequest = existRequest.toBuilder().setStatus(request.getStatus()).setUpdateDt(System.currentTimeMillis()).build();
|
||||||
|
heads[2] = existRequest.getUpdateDt();
|
||||||
|
heads[3] = existRequest.getUpdateDt();
|
||||||
databaseStore.persistOrUpdateFriendRequest(existRequest);
|
databaseStore.persistOrUpdateFriendRequest(existRequest);
|
||||||
|
|
||||||
if (request.getStatus() == ProtoConstants.FriendRequestStatus.RequestStatus_Accepted) {
|
if (request.getStatus() == ProtoConstants.FriendRequestStatus.RequestStatus_Accepted) {
|
||||||
|
|||||||
@@ -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) {
|
if (s.getPlatform() == ProtoConstants.Platform.Platform_OSX || s.getPlatform() == ProtoConstants.Platform.Platform_Windows || platform == ProtoConstants.Platform.Platform_LINUX) {
|
||||||
remove = true;
|
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 {
|
} else {
|
||||||
if (s.getPlatform() ==platform) {
|
if (s.getPlatform() ==platform) {
|
||||||
remove = true;
|
remove = true;
|
||||||
@@ -729,14 +725,13 @@ public class MemorySessionStore implements ISessionsStore {
|
|||||||
if (session != null) {
|
if (session != null) {
|
||||||
if(!operator.equals(session.getUsername())) {
|
if(!operator.equals(session.getUsername())) {
|
||||||
LOG.error("kickoffPCClient failure, user {} don't have client {}", operator, pcClientId);
|
LOG.error("kickoffPCClient failure, user {} don't have client {}", operator, pcClientId);
|
||||||
return ErrorCode.ERROR_CODE_NOT_RIGHT;
|
mServer.getProcessor().getMessagesStore().forceCleanOnlineStatus(operator, pcClientId);
|
||||||
|
return ErrorCode.ERROR_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
if (session.getPlatform() == ProtoConstants.Platform.Platform_LINUX
|
if (session.getPlatform() == ProtoConstants.Platform.Platform_LINUX
|
||||||
|
|| session.getPlatform() == ProtoConstants.Platform.Platform_WEB
|
||||||
|| session.getPlatform() == ProtoConstants.Platform.Platform_Windows
|
|| session.getPlatform() == ProtoConstants.Platform.Platform_Windows
|
||||||
|| session.getPlatform() == ProtoConstants.Platform.Platform_OSX
|
|| session.getPlatform() == ProtoConstants.Platform.Platform_OSX) {
|
||||||
|| session.getPlatform() == ProtoConstants.Platform.Platform_iPad
|
|
||||||
|| session.getPlatform() == ProtoConstants.Platform.Platform_APad
|
|
||||||
) {
|
|
||||||
databaseStore.updateSessionDeleted(operator, pcClientId, 1);
|
databaseStore.updateSessionDeleted(operator, pcClientId, 1);
|
||||||
sessions.remove(pcClientId);
|
sessions.remove(pcClientId);
|
||||||
mServer.getProcessor().kickoffSession(session);
|
mServer.getProcessor().kickoffSession(session);
|
||||||
@@ -746,6 +741,7 @@ public class MemorySessionStore implements ISessionsStore {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOG.error("Can't find the session for client <{}>", pcClientId);
|
LOG.error("Can't find the session for client <{}>", pcClientId);
|
||||||
|
mServer.getProcessor().getMessagesStore().forceCleanOnlineStatus(operator, pcClientId);
|
||||||
}
|
}
|
||||||
return ErrorCode.ERROR_CODE_SUCCESS;
|
return ErrorCode.ERROR_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ public interface IMessagesStore {
|
|||||||
Set<String> getAllEnds();
|
Set<String> getAllEnds();
|
||||||
WFCMessage.PullMessageResult fetchMessage(String user, String exceptClientId, long fromMessageId, int pullType);
|
WFCMessage.PullMessageResult fetchMessage(String user, String exceptClientId, long fromMessageId, int pullType);
|
||||||
WFCMessage.PullMessageResult loadRemoteMessages(String user, WFCMessage.Conversation conversation, long beforeUid, int count, Collection<Integer> contentTypes);
|
WFCMessage.PullMessageResult loadRemoteMessages(String user, WFCMessage.Conversation conversation, long beforeUid, int count, Collection<Integer> contentTypes);
|
||||||
long insertUserMessages(String sender, int conversationType, String target, int line, int messageContentType, String userId, long messageId);
|
long insertUserMessages(String sender, int conversationType, String target, int line, int messageContentType, String userId, long messageId, boolean directing);
|
||||||
WFCMessage.GroupInfo createGroup(String operator, WFCMessage.GroupInfo groupInfo, List<WFCMessage.GroupMember> memberList, String memberExtra, boolean isAdmin);
|
WFCMessage.GroupInfo createGroup(String operator, WFCMessage.GroupInfo groupInfo, List<WFCMessage.GroupMember> memberList, String memberExtra, boolean isAdmin);
|
||||||
ErrorCode addGroupMembers(String operator, boolean isAdmin, String groupId, List<WFCMessage.GroupMember> memberList, String extra);
|
ErrorCode addGroupMembers(String operator, boolean isAdmin, String groupId, List<WFCMessage.GroupMember> memberList, String extra);
|
||||||
ErrorCode kickoffGroupMembers(String operator, boolean isAdmin, String groupId, List<String> memberList);
|
ErrorCode kickoffGroupMembers(String operator, boolean isAdmin, String groupId, List<String> memberList);
|
||||||
@@ -140,6 +140,8 @@ public interface IMessagesStore {
|
|||||||
|
|
||||||
ErrorCode modifyUserInfo(String userId, WFCMessage.ModifyMyInfoRequest request) throws Exception;
|
ErrorCode modifyUserInfo(String userId, WFCMessage.ModifyMyInfoRequest request) throws Exception;
|
||||||
|
|
||||||
|
void forceCleanOnlineStatus(String userId, String clientId);
|
||||||
|
|
||||||
void updateUserOnlineSetting(MemorySessionStore.Session session, boolean online);
|
void updateUserOnlineSetting(MemorySessionStore.Session session, boolean online);
|
||||||
|
|
||||||
ErrorCode modifyUserStatus(String userId, int status);
|
ErrorCode modifyUserStatus(String userId, int status);
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ public class MessagesPublisher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void publish2Receivers(String sender, int conversationType, String target, int line, long messageId, Collection<String> receivers, String pushContent, String pushData, String exceptClientId, int pullType, int messageContentType, long serverTime, int mentionType, List<String> mentionTargets, int persistFlag) {
|
private void publish2Receivers(String sender, int conversationType, String target, int line, long messageId, Collection<String> receivers, String pushContent, String pushData, String exceptClientId, int pullType, int messageContentType, long serverTime, int mentionType, List<String> mentionTargets, int persistFlag, boolean directing) {
|
||||||
if (persistFlag == Transparent) {
|
if (persistFlag == Transparent) {
|
||||||
publishTransparentMessage2Receivers(messageId, receivers, pullType, exceptClientId);
|
publishTransparentMessage2Receivers(messageId, receivers, pullType, exceptClientId);
|
||||||
return;
|
return;
|
||||||
@@ -191,7 +191,7 @@ public class MessagesPublisher {
|
|||||||
}
|
}
|
||||||
long messageSeq;
|
long messageSeq;
|
||||||
if (pullType != ProtoConstants.PullType.Pull_ChatRoom) {
|
if (pullType != ProtoConstants.PullType.Pull_ChatRoom) {
|
||||||
messageSeq = m_messagesStore.insertUserMessages(sender, conversationType, target, line, messageContentType, user, messageId);
|
messageSeq = m_messagesStore.insertUserMessages(sender, conversationType, target, line, messageContentType, user, messageId, directing);
|
||||||
} else {
|
} else {
|
||||||
messageSeq = m_messagesStore.insertChatroomMessages(user, line, messageId);
|
messageSeq = m_messagesStore.insertChatroomMessages(user, line, messageId);
|
||||||
}
|
}
|
||||||
@@ -213,9 +213,7 @@ public class MessagesPublisher {
|
|||||||
if (targetSession.getPlatform() == ProtoConstants.Platform.Platform_WEB
|
if (targetSession.getPlatform() == ProtoConstants.Platform.Platform_WEB
|
||||||
|| targetSession.getPlatform() == ProtoConstants.Platform.Platform_Windows
|
|| targetSession.getPlatform() == ProtoConstants.Platform.Platform_Windows
|
||||||
|| targetSession.getPlatform() == ProtoConstants.Platform.Platform_LINUX
|
|| targetSession.getPlatform() == ProtoConstants.Platform.Platform_LINUX
|
||||||
|| targetSession.getPlatform() == ProtoConstants.Platform.Platform_OSX
|
|| targetSession.getPlatform() == ProtoConstants.Platform.Platform_OSX) {
|
||||||
|| targetSession.getPlatform() == ProtoConstants.Platform.Platform_iPad
|
|
||||||
|| targetSession.getPlatform() == ProtoConstants.Platform.Platform_APad) {
|
|
||||||
boolean targetIsActive = this.connectionDescriptors.isConnected(targetSession.getClientSession().clientID);
|
boolean targetIsActive = this.connectionDescriptors.isConnected(targetSession.getClientSession().clientID);
|
||||||
if (targetIsActive) {
|
if (targetIsActive) {
|
||||||
isPcOnline = true;
|
isPcOnline = true;
|
||||||
@@ -646,7 +644,7 @@ public class MessagesPublisher {
|
|||||||
message.getConversation().getType(), message.getConversation().getTarget(), message.getConversation().getLine(),
|
message.getConversation().getType(), message.getConversation().getTarget(), message.getConversation().getLine(),
|
||||||
messageId,
|
messageId,
|
||||||
receivers,
|
receivers,
|
||||||
pushContent, message.getContent().getPushData(), exceptClientId, pullType, message.getContent().getType(), message.getServerTimestamp(), message.getContent().getMentionedType(), message.getContent().getMentionedTargetList(), message.getContent().getPersistFlag());
|
pushContent, message.getContent().getPushData(), exceptClientId, pullType, message.getContent().getType(), message.getServerTimestamp(), message.getContent().getMentionedType(), message.getContent().getMentionedTargetList(), message.getContent().getPersistFlag(), message.hasToUser() || !message.getToList().isEmpty());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>wildfirechat-parent</artifactId>
|
<artifactId>wildfirechat-parent</artifactId>
|
||||||
<groupId>cn.wildfirechat</groupId>
|
<groupId>cn.wildfirechat</groupId>
|
||||||
<version>0.80</version>
|
<version>0.83</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ public interface APIPath {
|
|||||||
String User_Put_Setting = "/admin/user/put_setting";
|
String User_Put_Setting = "/admin/user/put_setting";
|
||||||
String User_Get_Setting = "/admin/user/get_setting";
|
String User_Get_Setting = "/admin/user/get_setting";
|
||||||
String User_Kickoff_Client = "/admin/user/kickoff_client";
|
String User_Kickoff_Client = "/admin/user/kickoff_client";
|
||||||
|
String User_Online_Count = "/admin/user/online_count";
|
||||||
|
String User_Online_List = "/admin/user/online_list";
|
||||||
|
|
||||||
String Friend_Update_Status = "/admin/friend/status";
|
String Friend_Update_Status = "/admin/friend/status";
|
||||||
String Friend_Get_List = "/admin/friend/list";
|
String Friend_Get_List = "/admin/friend/list";
|
||||||
@@ -47,6 +49,7 @@ public interface APIPath {
|
|||||||
String Msg_Send = "/admin/message/send";
|
String Msg_Send = "/admin/message/send";
|
||||||
String Msg_Recall = "/admin/message/recall";
|
String Msg_Recall = "/admin/message/recall";
|
||||||
String Msg_Delete = "/admin/message/delete";
|
String Msg_Delete = "/admin/message/delete";
|
||||||
|
String Msg_Update = "/admin/message/update";
|
||||||
String Msg_Broadcast = "/admin/message/broadcast";
|
String Msg_Broadcast = "/admin/message/broadcast";
|
||||||
String Msg_Multicast = "/admin/message/multicast";
|
String Msg_Multicast = "/admin/message/multicast";
|
||||||
String Msg_RecallBroadCast = "/admin/message/recall_broadcast";
|
String Msg_RecallBroadCast = "/admin/message/recall_broadcast";
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package cn.wildfirechat.pojos;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class GetOnlineUserCountResult extends ArrayList<GetOnlineUserCountResult.Node> {
|
||||||
|
public static class Node {
|
||||||
|
public int node;
|
||||||
|
public int count;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package cn.wildfirechat.pojos;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class GetOnlineUserRequest {
|
||||||
|
public int nodeId;
|
||||||
|
public int offset;
|
||||||
|
public int count;
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package cn.wildfirechat.pojos;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class GetOnlineUserResult {
|
||||||
|
public static class UserClient {
|
||||||
|
public String userId;
|
||||||
|
public String clientId;
|
||||||
|
public int platform;
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList<GetOnlineUserResult.UserClient> userClients;
|
||||||
|
public int totalCount;
|
||||||
|
public int offset;
|
||||||
|
}
|
||||||
@@ -19,12 +19,11 @@ public class OutputGetChannelInfo {
|
|||||||
private String extra;
|
private String extra;
|
||||||
private String owner;
|
private String owner;
|
||||||
private int state;
|
private int state;
|
||||||
//此字段已经废弃,为了兼容旧的SDK版本,以后会移除
|
|
||||||
@Deprecated()
|
|
||||||
private int status;
|
private int status;
|
||||||
private long updateDt;
|
private long updateDt;
|
||||||
private String callback;
|
private String callback;
|
||||||
private int automatic;
|
private int automatic;
|
||||||
|
private String secret;
|
||||||
|
|
||||||
|
|
||||||
public String getChannelId() {
|
public String getChannelId() {
|
||||||
@@ -115,6 +114,14 @@ public class OutputGetChannelInfo {
|
|||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSecret() {
|
||||||
|
return secret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSecret(String secret) {
|
||||||
|
this.secret = secret;
|
||||||
|
}
|
||||||
|
|
||||||
public static OutputGetChannelInfo fromPbInfo(WFCMessage.ChannelInfo channelInfo) {
|
public static OutputGetChannelInfo fromPbInfo(WFCMessage.ChannelInfo channelInfo) {
|
||||||
OutputGetChannelInfo out = new OutputGetChannelInfo();
|
OutputGetChannelInfo out = new OutputGetChannelInfo();
|
||||||
out.automatic = channelInfo.getAutomatic();
|
out.automatic = channelInfo.getAutomatic();
|
||||||
@@ -126,8 +133,9 @@ public class OutputGetChannelInfo {
|
|||||||
out.owner = channelInfo.getOwner();
|
out.owner = channelInfo.getOwner();
|
||||||
out.portrait = channelInfo.getPortrait();
|
out.portrait = channelInfo.getPortrait();
|
||||||
out.state = channelInfo.getStatus();
|
out.state = channelInfo.getStatus();
|
||||||
out.status = out.state;
|
out.status = channelInfo.getStatus();;
|
||||||
out.updateDt = channelInfo.getUpdateDt();
|
out.updateDt = channelInfo.getUpdateDt();
|
||||||
|
out.secret = channelInfo.getSecret();
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,4 +8,5 @@ public class PojoConferenceCreate {
|
|||||||
public int bitrate;
|
public int bitrate;
|
||||||
public boolean advance;
|
public boolean advance;
|
||||||
public boolean recording;
|
public boolean recording;
|
||||||
|
public boolean permanent;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Wildfire Chat package.
|
||||||
|
* (c) Heavyrain2012 <heavyrain.lee@gmail.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package cn.wildfirechat.pojos;
|
||||||
|
|
||||||
|
public class UpdateMessageContentData {
|
||||||
|
private String operator;
|
||||||
|
private long messageUid;
|
||||||
|
private MessagePayload payload;
|
||||||
|
private int distribute;
|
||||||
|
private int updateTimestamp;
|
||||||
|
|
||||||
|
public String getOperator() {
|
||||||
|
return operator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOperator(String operator) {
|
||||||
|
this.operator = operator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getMessageUid() {
|
||||||
|
return messageUid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessageUid(long messageUid) {
|
||||||
|
this.messageUid = messageUid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MessagePayload getPayload() {
|
||||||
|
return payload;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPayload(MessagePayload payload) {
|
||||||
|
this.payload = payload;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDistribute() {
|
||||||
|
return distribute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDistribute(int distribute) {
|
||||||
|
this.distribute = distribute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getUpdateTimestamp() {
|
||||||
|
return updateTimestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdateTimestamp(int updateTimestamp) {
|
||||||
|
this.updateTimestamp = updateTimestamp;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -129,7 +129,7 @@ public class ProtoConstants {
|
|||||||
//第3位表示是否允许给非订阅用户发送消息
|
//第3位表示是否允许给非订阅用户发送消息
|
||||||
//第4位表示是否私有,不可以被用户搜索和主动订阅
|
//第4位表示是否私有,不可以被用户搜索和主动订阅
|
||||||
//第6位表示是否删除
|
//第6位表示是否删除
|
||||||
//第8位表示是否是全局频道,全局频道没有订阅关系,会发送给系统内所有成员。
|
//第8位表示是否是全局频道,全局频道没有订阅关系,会发送给系统内所有成员。可以给非订阅用户单独发消息。
|
||||||
public interface ChannelState {
|
public interface ChannelState {
|
||||||
int Channel_State_Mask_FullInfo = 0x01;
|
int Channel_State_Mask_FullInfo = 0x01;
|
||||||
int Channel_State_Mask_Unsubscribed_User_Access = 0x02;
|
int Channel_State_Mask_Unsubscribed_User_Access = 0x02;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<!--<relativePath>../pom.xml</relativePath>-->
|
<!--<relativePath>../pom.xml</relativePath>-->
|
||||||
<artifactId>wildfirechat-parent</artifactId>
|
<artifactId>wildfirechat-parent</artifactId>
|
||||||
<groupId>cn.wildfirechat</groupId>
|
<groupId>cn.wildfirechat</groupId>
|
||||||
<version>0.80</version>
|
<version>0.83</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>distribution</artifactId>
|
<artifactId>distribution</artifactId>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<artifactId>wildfirechat-parent</artifactId>
|
<artifactId>wildfirechat-parent</artifactId>
|
||||||
|
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<version>0.80</version>
|
<version>0.83</version>
|
||||||
<name>Wildfire Chat</name>
|
<name>Wildfire Chat</name>
|
||||||
<description>Wildfire Chat Server</description>
|
<description>Wildfire Chat Server</description>
|
||||||
<inceptionYear>2019</inceptionYear>
|
<inceptionYear>2019</inceptionYear>
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>wildfirechat-parent</artifactId>
|
<artifactId>wildfirechat-parent</artifactId>
|
||||||
<groupId>cn.wildfirechat</groupId>
|
<groupId>cn.wildfirechat</groupId>
|
||||||
<version>0.80</version>
|
<version>0.83</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class ConferenceAdmin {
|
|||||||
return AdminHttpUtils.httpJsonPost(path, data, PojoConferenceParticipantList.class);
|
return AdminHttpUtils.httpJsonPost(path, data, PojoConferenceParticipantList.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IMResult<Void> createRoom(String roomId, String description, String pin, int maxPublisher, boolean advance, int bitrate, boolean recording) throws Exception {
|
public static IMResult<Void> createRoom(String roomId, String description, String pin, int maxPublisher, boolean advance, int bitrate, boolean recording, boolean permanent) throws Exception {
|
||||||
String path = APIPath.Conference_Create;
|
String path = APIPath.Conference_Create;
|
||||||
PojoConferenceCreate create = new PojoConferenceCreate();
|
PojoConferenceCreate create = new PojoConferenceCreate();
|
||||||
create.roomId = roomId;
|
create.roomId = roomId;
|
||||||
@@ -27,6 +27,7 @@ public class ConferenceAdmin {
|
|||||||
create.advance = advance;
|
create.advance = advance;
|
||||||
create.bitrate = bitrate;
|
create.bitrate = bitrate;
|
||||||
create.recording = recording;
|
create.recording = recording;
|
||||||
|
create.permanent = permanent;
|
||||||
return AdminHttpUtils.httpJsonPost(path, create, Void.class);
|
return AdminHttpUtils.httpJsonPost(path, create, Void.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import static cn.wildfirechat.proto.ProtoConstants.SystemSettingType.Group_Max_M
|
|||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
private static boolean commercialServer = false;
|
private static boolean commercialServer = false;
|
||||||
|
private static boolean advanceVoip = false;
|
||||||
//管理端口是8080
|
//管理端口是8080
|
||||||
private static String AdminUrl = "http://localhost:18080";
|
private static String AdminUrl = "http://localhost:18080";
|
||||||
private static String AdminSecret = "123456";
|
private static String AdminSecret = "123456";
|
||||||
@@ -51,6 +52,8 @@ public class Main {
|
|||||||
testSensitiveApi();
|
testSensitiveApi();
|
||||||
if (commercialServer) {
|
if (commercialServer) {
|
||||||
testDevice();
|
testDevice();
|
||||||
|
}
|
||||||
|
if(advanceVoip) {
|
||||||
testConference();
|
testConference();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -269,6 +272,24 @@ public class Main {
|
|||||||
System.out.println("destroy user failure");
|
System.out.println("destroy user failure");
|
||||||
System.exit(-1);
|
System.exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (commercialServer) {
|
||||||
|
IMResult<GetOnlineUserCountResult> getOnlineUserCountResultIMResult = UserAdmin.getOnlineUserCount();
|
||||||
|
if (getOnlineUserCountResultIMResult != null && getOnlineUserCountResultIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
|
System.out.println("get user online count success");
|
||||||
|
} else {
|
||||||
|
System.out.println("get user online count failure");
|
||||||
|
System.exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMResult<GetOnlineUserResult> getOnlineUserResultIMResult = UserAdmin.getOnlineUser(1, 0, 100);
|
||||||
|
if (getOnlineUserResultIMResult != null && getOnlineUserResultIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
|
System.out.println("get user online success");
|
||||||
|
} else {
|
||||||
|
System.out.println("get user online failure");
|
||||||
|
System.exit(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//***********************************************
|
//***********************************************
|
||||||
@@ -664,6 +685,24 @@ public class Main {
|
|||||||
System.exit(-1);
|
System.exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
payload.setSearchableContent("hello world2");
|
||||||
|
resultSendMessage = MessageAdmin.sendMessage("user1", conversation, payload, null);
|
||||||
|
if (resultSendMessage != null && resultSendMessage.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
|
System.out.println("send message success");
|
||||||
|
} else {
|
||||||
|
System.out.println("send message failure");
|
||||||
|
System.exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
payload.setSearchableContent("hello world3");
|
||||||
|
voidIMResult = MessageAdmin.updateMessageContent("user1", resultSendMessage.getResult().getMessageUid(), payload, true);
|
||||||
|
if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
|
System.out.println("update message success");
|
||||||
|
} else {
|
||||||
|
System.out.println("update message failure");
|
||||||
|
System.exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
IMResult<BroadMessageResult> resultBroadcastMessage = MessageAdmin.broadcastMessage("user1", 0, payload);
|
IMResult<BroadMessageResult> resultBroadcastMessage = MessageAdmin.broadcastMessage("user1", 0, payload);
|
||||||
if (resultBroadcastMessage != null && resultBroadcastMessage.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
if (resultBroadcastMessage != null && resultBroadcastMessage.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
System.out.println("broad message success, send message to " + resultBroadcastMessage.getResult().getCount() + " users");
|
System.out.println("broad message success, send message to " + resultBroadcastMessage.getResult().getCount() + " users");
|
||||||
@@ -821,6 +860,7 @@ public class Main {
|
|||||||
System.exit(-1);
|
System.exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Thread.sleep(1000);
|
||||||
getChatroomInfoIMResult = ChatroomAdmin.getChatroomInfo(chatroomId);
|
getChatroomInfoIMResult = ChatroomAdmin.getChatroomInfo(chatroomId);
|
||||||
if (getChatroomInfoIMResult != null && getChatroomInfoIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && getChatroomInfoIMResult.getResult().getState() == ProtoConstants.ChatroomState.Chatroom_State_End) {
|
if (getChatroomInfoIMResult != null && getChatroomInfoIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && getChatroomInfoIMResult.getResult().getState() == ProtoConstants.ChatroomState.Chatroom_State_End) {
|
||||||
System.out.println("chatroom destroyed!");
|
System.out.println("chatroom destroyed!");
|
||||||
@@ -1486,7 +1526,7 @@ public class Main {
|
|||||||
System.out.println("conference list " + listResult.getResult().conferenceInfoList);
|
System.out.println("conference list " + listResult.getResult().conferenceInfoList);
|
||||||
}
|
}
|
||||||
|
|
||||||
IMResult<Void> createResult = ConferenceAdmin.createRoom("helloroomid", "hello room description", "123456", 9, false, 0, false);
|
IMResult<Void> createResult = ConferenceAdmin.createRoom("helloroomid", "hello room description", "123456", 9, false, 0, false, true);
|
||||||
if(createResult == null || createResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) {
|
if(createResult == null || createResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
System.out.println("create conference failure");
|
System.out.println("create conference failure");
|
||||||
System.exit(-1);
|
System.exit(-1);
|
||||||
@@ -1494,7 +1534,7 @@ public class Main {
|
|||||||
System.out.println("create conference");
|
System.out.println("create conference");
|
||||||
}
|
}
|
||||||
|
|
||||||
createResult = ConferenceAdmin.createRoom("helloroomid2", "hello room description advanced", "123456", 20, true, 0, false);
|
createResult = ConferenceAdmin.createRoom("helloroomid2", "hello room description advanced", "123456", 20, true, 0, false, true);
|
||||||
if(createResult == null || createResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) {
|
if(createResult == null || createResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
System.out.println("create conference failure");
|
System.out.println("create conference failure");
|
||||||
System.exit(-1);
|
System.exit(-1);
|
||||||
|
|||||||
@@ -37,6 +37,17 @@ public class MessageAdmin {
|
|||||||
return AdminHttpUtils.httpJsonPost(path, deleteMessageData, Void.class);
|
return AdminHttpUtils.httpJsonPost(path, deleteMessageData, Void.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IMResult<Void> updateMessageContent(String operator, long messageUid, MessagePayload payload, boolean distribute) throws Exception {
|
||||||
|
String path = APIPath.Msg_Update;
|
||||||
|
UpdateMessageContentData updateMessageContentData = new UpdateMessageContentData();
|
||||||
|
updateMessageContentData.setOperator(operator);
|
||||||
|
updateMessageContentData.setMessageUid(messageUid);
|
||||||
|
updateMessageContentData.setPayload(payload);
|
||||||
|
updateMessageContentData.setDistribute(distribute?1:0);
|
||||||
|
updateMessageContentData.setUpdateTimestamp(0);
|
||||||
|
return AdminHttpUtils.httpJsonPost(path, updateMessageContentData, Void.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -117,4 +117,16 @@ public class UserAdmin {
|
|||||||
inputUserId.setUserId(userId);
|
inputUserId.setUserId(userId);
|
||||||
return AdminHttpUtils.httpJsonPost(path, inputUserId, OutputDeviceList.class);
|
return AdminHttpUtils.httpJsonPost(path, inputUserId, OutputDeviceList.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IMResult<GetOnlineUserCountResult> getOnlineUserCount() throws Exception {
|
||||||
|
return AdminHttpUtils.httpJsonPost(APIPath.User_Online_Count, null, GetOnlineUserCountResult.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IMResult<GetOnlineUserResult> getOnlineUser(int nodeId, int offset, int count) throws Exception {
|
||||||
|
GetOnlineUserRequest request = new GetOnlineUserRequest();
|
||||||
|
request.nodeId = nodeId;
|
||||||
|
request.offset = offset;
|
||||||
|
request.count = count;
|
||||||
|
return AdminHttpUtils.httpJsonPost(APIPath.User_Online_List, request, GetOnlineUserResult.class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user