Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d6f5614f49 | ||
|
|
9ed4ab7e08 | ||
|
|
4da3d3421d | ||
|
|
40ef9abd35 |
+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.81</version>
|
<version>0.82</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>moquette-broker</artifactId>
|
<artifactId>moquette-broker</artifactId>
|
||||||
|
|||||||
@@ -2488,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) {
|
||||||
|
|||||||
+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.81</version>
|
<version>0.82</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;
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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.81</version>
|
<version>0.82</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.81</version>
|
<version>0.82</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.81</version>
|
<version>0.82</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -269,6 +269,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 +682,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");
|
||||||
|
|||||||
@@ -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