Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a806aa10b | ||
|
|
6542b8ba55 | ||
|
|
c3bc62f1e1 | ||
|
|
8b649200d2 | ||
|
|
5f95b18e77 | ||
|
|
4d45aedc73 | ||
|
|
a038bedb12 | ||
|
|
43892dbe41 | ||
|
|
ad33abc424 | ||
|
|
290a3cea0e | ||
|
|
ca3bbb6435 | ||
|
|
704e6e0ec2 | ||
|
|
23871487e4 |
+1
-1
@@ -5,7 +5,7 @@
|
||||
<relativePath>../</relativePath>
|
||||
<artifactId>wildfirechat-parent</artifactId>
|
||||
<groupId>cn.wildfirechat</groupId>
|
||||
<version>1.1</version>
|
||||
<version>1.1.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>moquette-broker</artifactId>
|
||||
|
||||
@@ -257,6 +257,7 @@ public class UploadFileAction extends Action {
|
||||
if(!bFile) {
|
||||
bFile = dirFile.mkdirs();
|
||||
if (!bFile) {
|
||||
logger.error("create dirs error! {}", dir);
|
||||
response.setStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR);
|
||||
response.setContent("服务器错误:无法创建文件");
|
||||
return false;
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.List;
|
||||
public class GetGroupInfoHandler extends IMHandler<WFCMessage.PullUserRequest> {
|
||||
@Override
|
||||
public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.PullUserRequest request, Qos1PublishHandler.IMCallback callback) {
|
||||
List<WFCMessage.GroupInfo> infos = m_messagesStore.getGroupInfos(request.getRequestList());
|
||||
List<WFCMessage.GroupInfo> infos = m_messagesStore.getGroupInfos(request.getRequestList(), fromUser, requestSourceType == ProtoConstants.RequestSourceType.Request_From_Admin);
|
||||
|
||||
WFCMessage.PullGroupInfoResult result = WFCMessage.PullGroupInfoResult.newBuilder().addAllInfo(infos).build();
|
||||
byte[] data = result.toByteArray();
|
||||
|
||||
@@ -203,7 +203,7 @@ public class DatabaseStore {
|
||||
}
|
||||
|
||||
|
||||
sql += " and _type <> 2"; //can search normal user(0) and robot(1) and admin(100), can not search things
|
||||
sql += " and `_type` <> 2 and `_deleted` = 0"; //can search normal user(0) and robot(1) and admin(100), can not search things
|
||||
|
||||
if (searchType == SearchUserType_Name_Mobile || searchType == SearchUserType_Name || searchType == SearchUserType_Mobile) {
|
||||
sql += " limit 1";
|
||||
@@ -815,7 +815,7 @@ public class DatabaseStore {
|
||||
long beforeUid = before[0];
|
||||
String sql = "select `_mid`, `_from`, `_type`, `_target`, `_line`, `_data`, `_dt`, `_to` from " + table +" where";
|
||||
if (conversation.getType() == ProtoConstants.ConversationType.ConversationType_Private) {
|
||||
sql += " _type = ? and _line = ? and _mid < ? and ((_target = ? and _from = ?) or (_target = ? and _from = ?))";
|
||||
sql += " _type = ? and _line = ? and _mid < ? and ((_target = ? and _from = ?) or (_target = ? and _from = ?)) and (_to = '' or _to = ?)";
|
||||
} else if (conversation.getType() == ProtoConstants.ConversationType.ConversationType_Channel && !user.equals(channelOwner)) {
|
||||
sql += " _type = ? and _line = ? and _mid < ? and _target = ? and ((_from = ? and (_to = '' or _to = ?)) or (_from = ?))";
|
||||
} else {
|
||||
@@ -853,6 +853,7 @@ public class DatabaseStore {
|
||||
statement.setString(index++, user);
|
||||
statement.setString(index++, user);
|
||||
statement.setString(index++, conversation.getTarget());
|
||||
statement.setString(index++, user);
|
||||
} else if (conversation.getType() == ProtoConstants.ConversationType.ConversationType_Channel && !user.equals(channelOwner)) {
|
||||
statement.setString(index++, channelOwner);
|
||||
statement.setString(index++, user);
|
||||
@@ -914,7 +915,7 @@ public class DatabaseStore {
|
||||
return false;
|
||||
}
|
||||
|
||||
void persistUserMessage(final String userId, final long messageId, final long messageSeq, int type, String target, int line, boolean directing, final int messageContentType) {
|
||||
void persistUserMessage(final String userId, final String sender, final long messageId, final long messageSeq, int type, String target, int line, boolean directing, final int messageContentType) {
|
||||
mScheduler.execute(()->{
|
||||
Connection connection = null;
|
||||
PreparedStatement statement = null;
|
||||
@@ -929,7 +930,7 @@ public class DatabaseStore {
|
||||
statement.setString(index++, userId);
|
||||
statement.setLong(index++, messageSeq);
|
||||
statement.setInt(index++, type);
|
||||
statement.setString(index++, target);
|
||||
statement.setString(index++, getPrivateChatUserMessageTarget(type, target, sender));
|
||||
statement.setInt(index++, line);
|
||||
statement.setInt(index++, directing ? 1 :0);
|
||||
statement.setInt(index++, messageContentType);
|
||||
@@ -945,6 +946,14 @@ public class DatabaseStore {
|
||||
});
|
||||
}
|
||||
|
||||
String getPrivateChatUserMessageTarget(int conversationType, String target, String userId) {
|
||||
if(conversationType == ProtoConstants.ConversationType.ConversationType_Private) {
|
||||
return target.compareTo(userId) > 0 ? (userId + "|" + target) : (target + "|" + userId);
|
||||
} else {
|
||||
return target;
|
||||
}
|
||||
}
|
||||
|
||||
void clearUserMessage(final String userId) {
|
||||
mScheduler.execute(()->{
|
||||
String tableName = getUserMessageTable(userId);
|
||||
|
||||
@@ -467,21 +467,7 @@ public class MemoryMessagesStore implements IMessagesStore {
|
||||
s = s.toLowerCase();
|
||||
if(s.startsWith("0x")) {
|
||||
s = s.substring(2);
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
char ch = s.charAt(s.length()-1-i);
|
||||
mGroupForbiddenClientOperation <<= 4;
|
||||
if(ch <= 9) {
|
||||
mGroupForbiddenClientOperation += ch;
|
||||
} else {
|
||||
if(ch > 'f' || ch < 'a') {
|
||||
mGroupForbiddenClientOperation = 0;
|
||||
LOG.error("Invalid group.forbidden_client_operation {}", server.getConfig().getProperty(GROUP_Forbidden_Client_Operation, null));
|
||||
break;
|
||||
} else {
|
||||
mGroupForbiddenClientOperation += (ch - 'a' + 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
mGroupForbiddenClientOperation = Integer.parseInt(s, 16);
|
||||
} else {
|
||||
mGroupForbiddenClientOperation = Integer.parseInt(s);
|
||||
}
|
||||
@@ -599,21 +585,17 @@ public class MemoryMessagesStore implements IMessagesStore {
|
||||
int pullType = ProtoConstants.PullType.Pull_Normal;
|
||||
|
||||
if (type == ProtoConstants.ConversationType.ConversationType_Private) {
|
||||
notifyReceivers.add(fromUser);
|
||||
if(message.getToCount() > 0) {
|
||||
if(message.getToList().contains(fromUser)) {
|
||||
notifyReceivers.add(fromUser);
|
||||
}
|
||||
if(message.getToList().contains(message.getConversation().getTarget())) {
|
||||
notifyReceivers.add(message.getConversation().getTarget());
|
||||
}
|
||||
} else {
|
||||
notifyReceivers.add(fromUser);
|
||||
notifyReceivers.add(message.getConversation().getTarget());
|
||||
}
|
||||
pullType = ProtoConstants.PullType.Pull_Normal;
|
||||
} else if (type == ProtoConstants.ConversationType.ConversationType_Group) {
|
||||
notifyReceivers.add(fromUser);
|
||||
|
||||
if (!StringUtil.isNullOrEmpty(message.getToUser())) {
|
||||
notifyReceivers.add(message.getToUser());
|
||||
} else if(message.getToList()!=null && !message.getToList().isEmpty()) {
|
||||
@@ -639,9 +621,6 @@ public class MemoryMessagesStore implements IMessagesStore {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//如果是群助手的消息,返回pull type group,否则返回normal
|
||||
//群助手还没有实现
|
||||
pullType = ProtoConstants.PullType.Pull_Normal;
|
||||
} else if (type == ProtoConstants.ConversationType.ConversationType_ChatRoom) {
|
||||
boolean isDirect = !StringUtil.isNullOrEmpty(message.getToUser());
|
||||
@@ -847,6 +826,10 @@ public class MemoryMessagesStore implements IMessagesStore {
|
||||
mReadLock.unlock();
|
||||
}
|
||||
|
||||
if(current == 0) {
|
||||
current = 2;
|
||||
head = 2;
|
||||
}
|
||||
builder.setCurrent(current);
|
||||
builder.setHead(head);
|
||||
return builder.build();
|
||||
@@ -1000,7 +983,7 @@ public class MemoryMessagesStore implements IMessagesStore {
|
||||
messageSeq = maxPullSeq + 1;
|
||||
}
|
||||
|
||||
if (messageSeq == 0) {
|
||||
if (messageSeq < messageId) {
|
||||
messageSeq = messageId;
|
||||
}
|
||||
|
||||
@@ -1012,7 +995,7 @@ public class MemoryMessagesStore implements IMessagesStore {
|
||||
mWriteLock.unlock();
|
||||
}
|
||||
|
||||
databaseStore.persistUserMessage(user, messageId, messageSeq, conversationType, target, line, directing, messageContentType);
|
||||
databaseStore.persistUserMessage(user, sender, messageId, messageSeq, conversationType, target, line, directing, messageContentType);
|
||||
return messageSeq;
|
||||
}
|
||||
|
||||
@@ -1886,7 +1869,7 @@ public class MemoryMessagesStore implements IMessagesStore {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WFCMessage.GroupInfo> getGroupInfos(List<WFCMessage.UserRequest> requests) {
|
||||
public List<WFCMessage.GroupInfo> getGroupInfos(List<WFCMessage.UserRequest> requests, String fromUser, boolean isAdmin) {
|
||||
HazelcastInstance hzInstance = m_Server.getHazelcastInstance();
|
||||
IMap<String, WFCMessage.GroupInfo> mIMap = hzInstance.getMap(GROUPS_MAP);
|
||||
ArrayList<WFCMessage.GroupInfo> out = new ArrayList<>();
|
||||
@@ -1900,6 +1883,14 @@ public class MemoryMessagesStore implements IMessagesStore {
|
||||
}
|
||||
|
||||
if (groupInfo != null && groupInfo.getUpdateDt() > request.getUpdateDt()) {
|
||||
if(!isAdmin && !StringUtil.isNullOrEmpty(fromUser)) {
|
||||
WFCMessage.GroupMember gm = getGroupMember(groupInfo.getTargetId(), fromUser);
|
||||
if(gm == null) {
|
||||
groupInfo = groupInfo.toBuilder().setMemberUpdateDt(-1).build();
|
||||
} else if(gm.getType() == GroupMemberType_Removed) {
|
||||
groupInfo = groupInfo.toBuilder().setMemberUpdateDt(-groupInfo.getMemberUpdateDt()).build();
|
||||
}
|
||||
}
|
||||
out.add(groupInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ public interface IMessagesStore {
|
||||
ErrorCode modifyGroupInfo(String operator, String groupId, int modifyType, String value, boolean isAdmin);
|
||||
ErrorCode modifyGroupMemberAlias(String operator, String groupId, String alias, String memberId, boolean isAdmin);
|
||||
ErrorCode modifyGroupMemberExtra(String operator, String groupId, String extra, String memberId, boolean isAdmin);
|
||||
List<WFCMessage.GroupInfo> getGroupInfos(List<WFCMessage.UserRequest> requests);
|
||||
List<WFCMessage.GroupInfo> getGroupInfos(List<WFCMessage.UserRequest> requests, String fromUser, boolean isAdmin);
|
||||
WFCMessage.GroupInfo getGroupInfo(String groupId);
|
||||
Set<String> getUserGroupIds(String userId);
|
||||
Set<String> getCommonGroupIds(String userId1, String userId2);
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>wildfirechat-parent</artifactId>
|
||||
<groupId>cn.wildfirechat</groupId>
|
||||
<version>1.1</version>
|
||||
<version>1.1.2</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -90,6 +90,7 @@ public interface APIPath {
|
||||
String Health = "/admin/health";
|
||||
|
||||
String Conference_List = "/admin/conference/list";
|
||||
String Conference_Exist = "/admin/conference/exist";
|
||||
String Conference_List_Participant = "/admin/conference/list_participant";
|
||||
String Conference_Create = "/admin/conference/create";
|
||||
String Conference_Destroy = "/admin/conference/destroy";
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<!--<relativePath>../pom.xml</relativePath>-->
|
||||
<artifactId>wildfirechat-parent</artifactId>
|
||||
<groupId>cn.wildfirechat</groupId>
|
||||
<version>1.1</version>
|
||||
<version>1.1.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>distribution</artifactId>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<artifactId>wildfirechat-parent</artifactId>
|
||||
|
||||
<packaging>pom</packaging>
|
||||
<version>1.1</version>
|
||||
<version>1.1.2</version>
|
||||
<name>Wildfire Chat</name>
|
||||
<description>Wildfire Chat Server</description>
|
||||
<inceptionYear>2019</inceptionYear>
|
||||
|
||||
@@ -12,6 +12,19 @@
|
||||
|
||||
# 更新记录
|
||||
|
||||
--------------
|
||||
Release note 1.1.2:
|
||||
1. 会议SDK添加查询会议是否存在的接口
|
||||
2. 单聊会话定向消息分发包含发送者
|
||||
|
||||
--------------
|
||||
Release note 1.1.1:
|
||||
1. 当用户获取群组信息,可以根据返回信息判断是否在群中。
|
||||
2. 搜索用户时,过滤掉已删除用户
|
||||
3. 支持单聊消息的定向消息
|
||||
4. 解决关闭roaming,且message.compensate_time_limit配置为-1时,首次消息无法同步的问题
|
||||
5. 解决禁止客户端群操作flag 解析错误
|
||||
|
||||
--------------
|
||||
Release note 1.1:
|
||||
1. Channel API添加检查用户是否订阅接口
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>wildfirechat-parent</artifactId>
|
||||
<groupId>cn.wildfirechat</groupId>
|
||||
<version>1.1</version>
|
||||
<version>1.1.2</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -11,6 +11,12 @@ public class ConferenceAdmin {
|
||||
return AdminHttpUtils.httpJsonPost(path, null, PojoConferenceInfoList.class);
|
||||
}
|
||||
|
||||
public static IMResult<Boolean> existsConferences(String conferenceId) throws Exception {
|
||||
String path = APIPath.Conference_Exist;
|
||||
PojoConferenceRoomId data = new PojoConferenceRoomId(conferenceId, false);
|
||||
return AdminHttpUtils.httpJsonPost(path, data, Boolean.class);
|
||||
}
|
||||
|
||||
public static IMResult<PojoConferenceParticipantList> listParticipants(String roomId, boolean advance) throws Exception {
|
||||
String path = APIPath.Conference_List_Participant;
|
||||
PojoConferenceRoomId data = new PojoConferenceRoomId(roomId, advance);
|
||||
|
||||
@@ -1691,6 +1691,14 @@ public class Main {
|
||||
System.out.println("create conference");
|
||||
}
|
||||
|
||||
IMResult<Boolean> booleanIMResult = ConferenceAdmin.existsConferences("helloroomid2");
|
||||
if(booleanIMResult == null || booleanIMResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
System.out.println("exist conference failure");
|
||||
System.exit(-1);
|
||||
} else {
|
||||
System.out.println("exit conference success");
|
||||
}
|
||||
|
||||
voidIMResult = ConferenceAdmin.enableRecording("helloroomid2", true, true);
|
||||
if(voidIMResult == null || voidIMResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
System.out.println("recording conference failure");
|
||||
|
||||
Reference in New Issue
Block a user