Compare commits

...
10 Commits
31 changed files with 385 additions and 42 deletions
+13 -1
View File
@@ -54,6 +54,9 @@
## 野火开发文档
[在线文档](https://docs.wildfirechat.cn/)
## 野火IM论坛
[野火IM论坛](https://bbs.wildfirechat.cn)
## 野火性能测试报告及测试方法
[Github](https://github.com/wildfirechat/Performance_Test), [码云](https://gitee.com/wfchat/Performance_Test)。
@@ -70,7 +73,7 @@ PC客户端点[这里](https://github.com/wildfirechat/vue-pc-chat/releases)下
![野火IM](http://static.wildfirechat.net/wx.jpg)
## 快速使用
## 快速开始
可以按照[快速开始](https://docs.wildfirechat.cn/quick_start/)来部署应用服务和IM服务,然后打包移动端,就可以完成聊天和通话功能。
之后再部署开放平台服务、频道(公众号)服务、机器人服务、推送服务、Turn服务(音视频服务)来实现完整的应用功能,详情可以详细阅读文档。
@@ -128,6 +131,15 @@ mvn clean package
9. 从0.79 版本起把log4j升级到log4j2,因为log4j已经不再维护而且还有已知的漏洞,建议所有客户都升级,升级时注意更新log4j2的配置文件
10. 0.97版本更改了启动脚本```wildfirechat.sh```,如果是升级服务,请注意更新启动脚本。
## 维护说明
野火设计理念当中,IM服务和客户端协议栈构成个管道工具,数据在人和人或者人和服务或者服务和服务之间传递,可以通过Server API和自定义消息来对接和开发业务。业务系统把IM系统当作一个工具来使用,是不需要把任何业务逻辑写在IM服务中的。
如果修改了IM服务可能会引起跟客户端协议栈的不兼容,以后也没有可能从社区版IM服务迁移到专业版IM服务,还有一旦修改就跟我们代码不一样了,如果出了问题我们就无法分析和解决。所以 ***我们强烈不推荐在IM服务修改代码,如果修改过就不再提供任何技术支持和服务了***。除了IM服务以外的所有代码可以任意修改。
现有接口足够对接和二开任何业务了,如果发现无法实现你们的业务需求,可以在[论坛](https://bbs.wildfirechat.cn)来咨询,我们会分析如何实现,如果需要添加新接口,我们会及时免费添加。请切记:***不要修改IM服务的代码!*** ***不要修改IM服务的代码!*** ***不要修改IM服务的代码!***
详细维护说明请参考 [野火维护说明](https://docs.wildfirechat.cn/base_knowledge/maintain.html)。
## 应用截图
登录界面
+12
View File
@@ -145,6 +145,9 @@ friend.disable_search false
##禁止按照昵称搜索用户。
friend.disable_nick_name_search false
##禁止按照用户id搜索用户,默认为true。
friend.disable_user_id_search true
##禁止发送好友邀请,通过server api添加好友不受此限制(force参数需要为true)
friend.disable_friend_request false
@@ -169,6 +172,12 @@ chatroom.rejoin_when_active true
## 当一个聊天室不存在时,如果有用户加入就自动创建
chatroom.create_when_not_exist true
## 一个用户同一时刻只能加入一个聊天室。
## 当一个客户端加入一个聊天室时,如果这个客户端已经加入另外一个聊天室了,会自动退出之前的聊天室。
## 当一个客户端加入一个聊天室时,如果这个用户的其他端已经加入一个聊天室了,kickoff_other_platform为true时会自动退出之前的聊天室,为false时会返回225的错误码。
## 当自动退出聊天室时,客户端不会收到任何通知,只是不会再收到消息。
chatroom.kickoff_other_platform true
## 是否允许群主不受限制地撤回自己发送的消息。false可以${message.recall_time_limit}撤回自己的消息;true可以撤回任意时间自己的消息。默认为true。
group.allow_owner_recall_self_msg true
@@ -201,6 +210,9 @@ user.keep_display_name_when_destroy true
# 因此需要分段多次同步,此开关定义了每次同步的数据的条数。此需要客户端支持,客户端SDK在2021.5.25日后支持此功能。如果确认所有客户端都在这个日志之后才可以打开此设置。
#sync.data_part_size 1000
## 是否关闭api/version接口。api/version方法可以用来检查IM服务版本,上线确认无问题后,可以关掉这个接口。
#http.close_api_version false
#*********************************************************************
# 限频配置
#*********************************************************************
+1 -1
View File
@@ -5,7 +5,7 @@
<relativePath>../</relativePath>
<artifactId>wildfirechat-parent</artifactId>
<groupId>cn.wildfirechat</groupId>
<version>1.1.9</version>
<version>1.2.0</version>
</parent>
<artifactId>moquette-broker</artifactId>
@@ -47,6 +47,8 @@ abstract public class Action {
protected static RateLimiter robotLimiter = null;
protected static RateLimiter channelLimiter = null;
protected static boolean closeApiVersion = false;
public static void init(IConfig config) {
int adminRate = 10000;
int robotRate = 1000;
@@ -70,6 +72,11 @@ abstract public class Action {
adminLimiter = new RateLimiter(10, adminRate);
robotLimiter = new RateLimiter(10, robotRate);
channelLimiter = new RateLimiter(10, channelRate);
try {
closeApiVersion = Boolean.parseBoolean(config.getProperty(HTTP_CLOSE_API_VERSION, "false"));
} catch (Exception e) {
}
}
protected class Result {
@@ -31,6 +31,11 @@ public class CheckTokenAction extends Action {
@Override
public boolean action(Request request, Response response) {
if (request.getNettyRequest() instanceof FullHttpRequest) {
if(closeApiVersion) {
response.sendError(HttpResponseStatus.NOT_FOUND, "404 Not found!");
return true;
}
response.setStatus(HttpResponseStatus.OK);
String userId = request.getParam("userId");
String clientId = request.getParam("clientId");
@@ -30,8 +30,12 @@ public class VersionAction extends Action {
@Override
public boolean action(Request request, Response response) {
if (request.getNettyRequest() instanceof FullHttpRequest) {
response.setStatus(HttpResponseStatus.OK);
if(closeApiVersion) {
response.sendError(HttpResponseStatus.NOT_FOUND, "404 Not found!");
return true;
}
response.setStatus(HttpResponseStatus.OK);
try {
response.setContent(Utility.formatJson(gson.toJson(GitRepositoryState.getGitRepositoryState())));
@@ -0,0 +1,61 @@
/*
* This file is part of the Wildfire Chat package.
* (c) Heavyrain2012 <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
package com.xiaoleilu.loServer.action.admin;
import cn.wildfirechat.common.APIPath;
import cn.wildfirechat.common.ErrorCode;
import cn.wildfirechat.pojos.InputGetChatroomInfo;
import cn.wildfirechat.pojos.InputUserId;
import cn.wildfirechat.pojos.OutputStringList;
import cn.wildfirechat.pojos.OutputUserChatroom;
import com.xiaoleilu.loServer.RestResult;
import com.xiaoleilu.loServer.annotation.HttpMethod;
import com.xiaoleilu.loServer.annotation.Route;
import com.xiaoleilu.loServer.handler.Request;
import com.xiaoleilu.loServer.handler.Response;
import io.moquette.persistence.UserClientEntry;
import io.netty.handler.codec.http.FullHttpRequest;
import io.netty.util.internal.StringUtil;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@Route(APIPath.Chatroom_GetUserChatroom)
@HttpMethod("POST")
public class GetUserChatroomAction extends AdminAction {
@Override
public boolean isTransactionAction() {
return true;
}
@Override
public boolean action(Request request, Response response) {
if (request.getNettyRequest() instanceof FullHttpRequest) {
InputUserId inputUserId = getRequestBody(request.getNettyRequest(), InputUserId.class);
String userId = inputUserId.getUserId();
if (!StringUtil.isNullOrEmpty(userId)) {
OutputUserChatroom outputUserChatroom = messagesStore.getUserChatroom(userId);
RestResult result;
if (outputUserChatroom != null) {
result = RestResult.ok(outputUserChatroom);
} else {
result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST);
}
setResponseContent(result, response);
} else {
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response);
}
}
return true;
}
}
@@ -161,6 +161,7 @@ public final class BrokerConstants {
public static final String FRIEND_Disable_Search = "friend.disable_search";
public static final String FRIEND_Disable_NickName_Search = "friend.disable_nick_name_search";
public static final String FRIEND_Disable_UserId_Search = "friend.disable_user_id_search";
public static final String FRIEND_Disable_Friend_Request = "friend.disable_friend_request";
public static final String FRIEND_Repeat_Request_Duration = "friend.repeat_request_duration";
public static final String FRIEND_Reject_Request_Duration = "friend.reject_request_duration";
@@ -171,7 +172,7 @@ public final class BrokerConstants {
public static final String CHATROOM_Participant_Idle_Time = "chatroom.participant_idle_time";
public static final String CHATROOM_Rejoin_When_Active = "chatroom.rejoin_when_active";
public static final String CHATROOM_Create_When_Not_Exist = "chatroom.create_when_not_exist";
public static final String CHATROOM_Kickoff_Other_Platform = "chatroom.kickoff_other_platform";
public static final String GROUP_Allow_Owner_Recall_Self_Msg = "group.allow_owner_recall_self_msg";
public static final String GROUP_Allow_Manager_Recall_Self_Msg = "group.allow_manager_recall_self_msg";
@@ -203,6 +204,9 @@ public final class BrokerConstants {
public static final String HTTP_CHANNEL_RATE_LIMIT = "http.channel.rate_limit";
public static final String CLIENT_REQUEST_RATE_LIMIT = "client.request_rate_limit";
public static final String HTTP_CLOSE_API_VERSION = "http.close_api_version";
private BrokerConstants() {
}
}
@@ -12,7 +12,6 @@ import cn.wildfirechat.pojos.SystemSettingPojo;
import cn.wildfirechat.proto.ProtoConstants;
import cn.wildfirechat.proto.WFCMessage;
import cn.wildfirechat.server.ThreadPoolExecutorWrapper;
import com.google.protobuf.InvalidProtocolBufferException;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.MultiMap;
import com.hazelcast.util.StringUtil;
@@ -163,7 +162,7 @@ public class DatabaseStore {
return null;
}
List<WFCMessage.User> searchUserByNameMobile(String keyword, int searchType) {
List<WFCMessage.User> searchUserByNameMobileUserId(String keyword, int searchType) {
ArrayList<WFCMessage.User> out = new ArrayList<>();
Connection connection = null;
PreparedStatement statement = null;
@@ -182,26 +181,34 @@ public class DatabaseStore {
", `_extra`" +
", `_dt`, `_type` from t_user";
int sqlParaCount = 1;
if(searchType == SearchUserType_Name) {
sql += " where `_name` = ? ";
} else if(searchType == SearchUserType_Mobile) {
sql += " where `_mobile` = ? ";
} else {
} else if(searchType == SearchUserType_UserId) {
sql += " where `_uid` = ? ";
} else if(searchType == SearchUserType_Name_Mobile) {
sqlParaCount = 2;
sql += " where (`_name` = ? or `_mobile` = ?) ";
} else {
sqlParaCount = 3;
sql += " where (`_name` = ? or `_mobile` = ? or `_uid` = ?) ";
}
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 || searchType == SearchUserType_Mobile) {
if(searchType == SearchUserType_Name || searchType == SearchUserType_Mobile || searchType == SearchUserType_UserId) {
sql += " limit 1";
} else {
} else if(searchType == SearchUserType_Name_Mobile) {
sql += " limit 2";
} else {
sql += " limit 3";
}
statement = connection.prepareStatement(sql);
statement.setString(1, keyword);
if(searchType != SearchUserType_Name && searchType != SearchUserType_Mobile) {
statement.setString(2, keyword);
for (int i = 0; i < sqlParaCount; i++) {
statement.setString(i+1, keyword);
}
rs = statement.executeQuery();
@@ -284,7 +291,7 @@ public class DatabaseStore {
if (searchType == SearchUserType_Name) {
filter.add(user);
continue;
} else if(searchType != SearchUserType_Mobile) {
} else if(searchType == SearchUserType_Name_Mobile) {
if(keyword.equals(user.getName())) {
if(!keyword.equals(user.getMobile())) {
filter.add(user);
@@ -294,15 +301,96 @@ public class DatabaseStore {
continue;
}
}
} else if(searchType == SearchUserType_Name_Mobile_UserId) {
if(keyword.equals(user.getName())) {
if(keyword.equals(user.getMobile()) && keyword.equals(user.getUid())) {
if((value & ProtoConstants.DisableSearchMask.DisableSearchMobileMask) > 0 && (value & ProtoConstants.DisableSearchMask.DisableSearchUserIdMask) > 0) {
filter.add(user);
continue;
}
} else if(keyword.equals(user.getMobile())) {
if((value & ProtoConstants.DisableSearchMask.DisableSearchMobileMask) > 0) {
filter.add(user);
continue;
}
} else if(keyword.equals(user.getUid())) {
if((value & ProtoConstants.DisableSearchMask.DisableSearchUserIdMask) > 0) {
filter.add(user);
continue;
}
} else {
filter.add(user);
continue;
}
}
}
}
if ((value & ProtoConstants.DisableSearchMask.DisableSearchMobileMask) > 0) {
if((value & ProtoConstants.DisableSearchMask.DisableSearchMobileMask) > 0) {
if (searchType == SearchUserType_Mobile) {
filter.add(user);
} else if(searchType != SearchUserType_Name) {
if(keyword.equals(user.getMobile()) && !keyword.equals(user.getName())) {
filter.add(user);
continue;
} else if(searchType == SearchUserType_Name_Mobile) {
if(keyword.equals(user.getMobile())) {
if(!keyword.equals(user.getName())) {
filter.add(user);
continue;
} else if((value & ProtoConstants.DisableSearchMask.DisableSearchNameMask) > 0) {
filter.add(user);
continue;
}
}
} else if(searchType == SearchUserType_Name_Mobile_UserId) {
if(keyword.equals(user.getMobile())) {
if(keyword.equals(user.getName()) && keyword.equals(user.getUid())) {
if((value & ProtoConstants.DisableSearchMask.DisableSearchNameMask) > 0 && (value & ProtoConstants.DisableSearchMask.DisableSearchUserIdMask) > 0) {
filter.add(user);
continue;
}
} else if(keyword.equals(user.getName())) {
if((value & ProtoConstants.DisableSearchMask.DisableSearchNameMask) > 0) {
filter.add(user);
continue;
}
} else if(keyword.equals(user.getUid())) {
if((value & ProtoConstants.DisableSearchMask.DisableSearchUserIdMask) > 0) {
filter.add(user);
continue;
}
} else {
filter.add(user);
continue;
}
}
}
}
if((value & ProtoConstants.DisableSearchMask.DisableSearchUserIdMask) > 0) {
if (searchType == SearchUserType_UserId) {
filter.add(user);
continue;
} else if(searchType == SearchUserType_Name_Mobile_UserId) {
if(keyword.equals(user.getUid())) {
if(keyword.equals(user.getName()) && keyword.equals(user.getMobile())) {
if((value & ProtoConstants.DisableSearchMask.DisableSearchNameMask) > 0 && (value & ProtoConstants.DisableSearchMask.DisableSearchMobileMask) > 0) {
filter.add(user);
continue;
}
} else if(keyword.equals(user.getName())) {
if((value & ProtoConstants.DisableSearchMask.DisableSearchNameMask) > 0) {
filter.add(user);
continue;
}
} else if(keyword.equals(user.getMobile())) {
if((value & ProtoConstants.DisableSearchMask.DisableSearchMobileMask) > 0) {
filter.add(user);
continue;
}
} else {
filter.add(user);
continue;
}
}
}
}
@@ -423,7 +511,7 @@ public class DatabaseStore {
}
List<WFCMessage.User> searchUserFromDB(String keyword, int searchType, int page) {
List<WFCMessage.User> nameOrIdMatched = searchUserByNameMobile(keyword, searchType);
List<WFCMessage.User> nameOrIdMatched = searchUserByNameMobileUserId(keyword, searchType);
List<WFCMessage.User> out = new ArrayList<>();
if(page == 0) {
out.addAll(nameOrIdMatched);
@@ -146,6 +146,7 @@ public class MemoryMessagesStore implements IMessagesStore {
private boolean mDisableSearch = false;
private boolean mDisableNicknameSearch = false;
private boolean mDisableUserIdSearch = false;
private boolean mDisableFriendRequest = false;
private long mFriendRequestDuration = 7 * 24 * 60 * 60 * 1000;
private long mFriendRejectDuration = 30 * 24 * 60 * 60 * 1000;
@@ -165,6 +166,7 @@ public class MemoryMessagesStore implements IMessagesStore {
private long mChatroomParticipantIdleTime = 900000;
private boolean mChatroomRejoinWhenActive = true;
private boolean mChatroomCreateWhenNotExist = true;
private boolean mChatroomKickoffOtherPlatform = true;
private List<Integer> mForbiddenClientSendTypes = new ArrayList<>();
private List<Integer> mBlackListExceptionTypes = new ArrayList<>();
@@ -279,6 +281,12 @@ public class MemoryMessagesStore implements IMessagesStore {
Utility.printExecption(LOG, e);
printMissConfigLog(FRIEND_Disable_NickName_Search, mDisableNicknameSearch + "");
}
try {
mDisableUserIdSearch = Boolean.parseBoolean(m_Server.getConfig().getProperty(BrokerConstants.FRIEND_Disable_UserId_Search, "true"));
} catch (Exception e) {
}
try {
mDisableFriendRequest = Boolean.parseBoolean(m_Server.getConfig().getProperty(BrokerConstants.FRIEND_Disable_Friend_Request));
} catch (Exception e) {
@@ -339,6 +347,12 @@ public class MemoryMessagesStore implements IMessagesStore {
printMissConfigLog(CHATROOM_Create_When_Not_Exist, mChatroomCreateWhenNotExist + "");
}
try {
mChatroomKickoffOtherPlatform = Boolean.parseBoolean(m_Server.getConfig().getProperty(BrokerConstants.CHATROOM_Kickoff_Other_Platform, "true"));
} catch (Exception e) {
}
try {
mChatroomParticipantIdleTime = Long.parseLong(m_Server.getConfig().getProperty(CHATROOM_Participant_Idle_Time, "900000"));
} catch (Exception e) {
@@ -926,7 +940,29 @@ public class MemoryMessagesStore implements IMessagesStore {
Collection<UserClientEntry> members = chatroomMembers.get(chatroomId);
return members;
}
//Todo chatroom
@Override
public OutputUserChatroom getUserChatroom(String userId) {
String chatroomId = (String) m_Server.getHazelcastInstance().getMap(USER_CHATROOM).get(userId);
if(chatroomId != null) {
MultiMap<String, UserClientEntry> chatroomMembers = m_Server.getHazelcastInstance().getMultiMap(CHATROOM_MEMBER_IDS);
for (UserClientEntry userClientEntry : chatroomMembers.get(chatroomId)) {
if(userClientEntry.userId.equals(userId)) {
OutputUserChatroom outputUserChatroom = new OutputUserChatroom();
outputUserChatroom.userId = userId;
outputUserChatroom.chatroomId = chatroomId;
outputUserChatroom.clientId = userClientEntry.clientId;
MemorySessionStore.Session session = m_Server.getStore().sessionsStore().getSession(userClientEntry.clientId);
if(session != null) {
outputUserChatroom.platform = session.getPlatform();
}
return outputUserChatroom;
}
}
}
return null;
}
@Override
public WFCMessage.PullMessageResult fetchChatroomMessage(String fromUser, String chatroomId, String exceptClientId, long fromMessageId) {
WFCMessage.PullMessageResult.Builder builder = WFCMessage.PullMessageResult.newBuilder();
@@ -2838,6 +2874,10 @@ public class MemoryMessagesStore implements IMessagesStore {
}
if (mDisableNicknameSearch && searchType == ProtoConstants.SearchUserType.SearchUserType_General) {
searchType = ProtoConstants.SearchUserType.SearchUserType_Name_Mobile_UserId;
}
if(mDisableUserIdSearch && (searchType == ProtoConstants.SearchUserType.SearchUserType_General || searchType == ProtoConstants.SearchUserType.SearchUserType_Name_Mobile_UserId)) {
searchType = ProtoConstants.SearchUserType.SearchUserType_Name_Mobile;
}
@@ -2995,7 +3035,7 @@ public class MemoryMessagesStore implements IMessagesStore {
if (mDisableStrangerChat) {
//在禁止私聊时,是否是允许私聊的用户id
if(mAllowStrangerChatSet.contains(targetUser)) {
if(mAllowStrangerChatSet.contains(targetUser) || mAllowStrangerChatSet.contains(fromUser)) {
return ErrorCode.ERROR_CODE_SUCCESS;
}
@@ -3530,9 +3570,25 @@ public class MemoryMessagesStore implements IMessagesStore {
}
}
MultiMap<String, UserClientEntry> chatroomMembers = m_Server.getHazelcastInstance().getMultiMap(CHATROOM_MEMBER_IDS);
String alreadyInChatroom = (String) m_Server.getHazelcastInstance().getMap(USER_CHATROOM).get(userId);
if(alreadyInChatroom != null) {
for (UserClientEntry userClientEntry : chatroomMembers.get(alreadyInChatroom)) {
if(userClientEntry.userId.equals(userId)) {
if(!chatroomId.equals(alreadyInChatroom) || !userClientEntry.clientId.equals(clientId)) {
if(mChatroomKickoffOtherPlatform) {
handleQuitChatroom(userId, userClientEntry.clientId, chatroomId);
} else {
return ErrorCode.ERROR_CODE_OTHER_CLIENT_ALREADY_IN_CHATROOM;
}
}
}
}
}
m_Server.getStore().sessionsStore().getSession(clientId).refreshLastChatroomActiveTime();
m_Server.getHazelcastInstance().getMap(USER_CHATROOM).put(userId, chatroomId);
m_Server.getHazelcastInstance().getMultiMap(CHATROOM_MEMBER_IDS).put(chatroomId, new UserClientEntry(userId, clientId));
chatroomMembers.put(chatroomId, new UserClientEntry(userId, clientId));
mWriteLock.lock();
chatroomMessages.put(userId, new TreeMap<>());
@@ -357,7 +357,11 @@ public class Server {
private String getServerIp(IConfig config) {
String serverIp = config.getProperty(BrokerConstants.SERVER_IP_PROPERTY_NAME);
if (serverIp == null || serverIp.equals("0.0.0.0")) {
serverIp = Utility.getLocalAddress().getHostAddress();
if(Utility.getLocalAddress() != null) {
serverIp = Utility.getLocalAddress().getHostAddress();
} else {
serverIp = "0.0.0.0";
}
}
return serverIp;
}
@@ -17,6 +17,7 @@
package io.moquette.spi;
import cn.wildfirechat.pojos.InputOutputUserInfo;
import cn.wildfirechat.pojos.OutputUserChatroom;
import cn.wildfirechat.pojos.SystemSettingPojo;
import cn.wildfirechat.proto.ProtoConstants;
import cn.wildfirechat.proto.WFCMessage;
@@ -173,6 +174,7 @@ public interface IMessagesStore {
long insertChatroomMessages(String target, int line, long messageId);
Collection<UserClientEntry> getChatroomMembers(String chatroomId);
OutputUserChatroom getUserChatroom(String userId);
WFCMessage.PullMessageResult fetchChatroomMessage(String fromUser, String chatroomId, String exceptClientId, long fromMessageId);
ErrorCode verifyToken(String userId, String token, List<String> serverIPs, List<Integer> ports);
+1 -1
View File
@@ -5,7 +5,7 @@
<parent>
<artifactId>wildfirechat-parent</artifactId>
<groupId>cn.wildfirechat</groupId>
<version>1.1.9</version>
<version>1.2.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -5,6 +5,7 @@ public interface APIPath {
String Chatroom_Destroy = "/admin/chatroom/del";
String Chatroom_Info = "/admin/chatroom/info";
String Chatroom_GetMembers = "/admin/chatroom/members";
String Chatroom_GetUserChatroom = "/admin/chatroom/user_chatroom";
String Chatroom_SetBlacklist = "/admin/chatroom/set_black_status";
String Chatroom_GetBlacklist = "/admin/chatroom/get_black_status";
String Chatroom_SetManager = "/admin/chatroom/set_manager";
@@ -66,6 +66,8 @@ public enum ErrorCode {
ERROR_CODE_FUNCTION_DISABLED(220, "function disabled"),
ERROR_CODE_OTHER_CLIENT_ALREADY_IN_CHATROOM(225, "other client already in chatroom"),
ERROR_CODE_CHANNEL_NO_EXIST(236, "channel no exist"),
ERROR_CODE_CHANNEL_NO_SECRET(237, "channel no secret"),
ERROR_CODE_USER_NOT_PREPARED(238, "user not prepared"),
@@ -10,4 +10,9 @@ public class ConferenceCreateEvent {
public int bitrate;
public boolean advance;
public boolean recording;
public long timestamp;
public ConferenceCreateEvent() {
timestamp = System.currentTimeMillis();
}
}
@@ -3,4 +3,9 @@ package cn.wildfirechat.pojos;
public class ConferenceDestroyEvent {
public String userId;
public String roomId;
public long timestamp;
public ConferenceDestroyEvent() {
timestamp = System.currentTimeMillis();
}
}
@@ -4,4 +4,9 @@ public class ConferenceJoinEvent {
public String userId;
public String roomId;
public boolean screenSharing;
public long timestamp;
public ConferenceJoinEvent() {
timestamp = System.currentTimeMillis();
}
}
@@ -6,4 +6,9 @@ public class ConferenceLeaveEvent {
public boolean rejoin;
public boolean kicked;
public boolean screenSharing;
public long timestamp;
public ConferenceLeaveEvent() {
timestamp = System.currentTimeMillis();
}
}
@@ -5,4 +5,9 @@ public class ConferencePublishEvent {
public boolean video;
public String roomId;
public boolean screenSharing;
public long timestamp;
public ConferencePublishEvent() {
timestamp = System.currentTimeMillis();
}
}
@@ -4,4 +4,9 @@ public class ConferenceUnpublishEvent {
public String userId;
public String roomId;
public boolean screenSharing;
public long timestamp;
public ConferenceUnpublishEvent() {
timestamp = System.currentTimeMillis();
}
}
@@ -0,0 +1,16 @@
/*
* 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 OutputUserChatroom {
public String userId;
public String chatroomId;
public String clientId;
public int/*ProtoConstants.Platform*/ platform;
}
@@ -218,12 +218,15 @@ public class ProtoConstants {
int SearchUserType_Name_Mobile = 1;
int SearchUserType_Name = 2;
int SearchUserType_Mobile = 3;
int SearchUserType_UserId = 4;
int SearchUserType_Name_Mobile_UserId = 5;
}
public interface DisableSearchMask {
int DisableSearchDisplayNameMask = 1;
int DisableSearchNameMask = 2;
int DisableSearchMobileMask = 4;
int DisableSearchUserIdMask = 8;
}
public interface UserStatus {
+1 -1
View File
@@ -6,7 +6,7 @@
<!--<relativePath>../pom.xml</relativePath>-->
<artifactId>wildfirechat-parent</artifactId>
<groupId>cn.wildfirechat</groupId>
<version>1.1.9</version>
<version>1.2.0</version>
</parent>
<artifactId>distribution</artifactId>
@@ -143,6 +143,9 @@ friend.disable_search false
##禁止按照昵称搜索用户。
friend.disable_nick_name_search false
##禁止按照用户id搜索用户,默认为true。
friend.disable_user_id_search true
##禁止发送好友邀请,通过server api添加好友不受此限制(force参数需要为true)
friend.disable_friend_request false
@@ -167,6 +170,12 @@ chatroom.rejoin_when_active true
## 当一个聊天室不存在时,如果有用户加入就自动创建
chatroom.create_when_not_exist true
## 一个用户同一时刻只能加入一个聊天室。
## 当一个客户端加入一个聊天室时,如果这个客户端已经加入另外一个聊天室了,会自动退出之前的聊天室。
## 当一个客户端加入一个聊天室时,如果这个用户的其他端已经加入一个聊天室了,kickoff_other_platform为true时会自动退出之前的聊天室,为false时会返回225的错误码。
## 当自动退出聊天室时,客户端不会收到任何通知,只是不会再收到消息。
chatroom.kickoff_other_platform true
## 是否允许群主不受限制地撤回自己发送的消息。false可以${message.recall_time_limit}撤回自己的消息;true可以撤回任意时间自己的消息。默认为true。
group.allow_owner_recall_self_msg true
@@ -197,6 +206,9 @@ group.visible_quit_or_kickoff_notification 0
# 因此需要分段多次同步,此开关定义了每次同步的数据的条数。此需要客户端支持,客户端SDK在2021.5.25日后支持此功能。如果确认所有客户端都在这个日志之后才可以打开此设置。
#sync.data_part_size 1000
## 是否关闭api/version接口。api/version方法可以用来检查IM服务版本,上线确认无问题后,可以关掉这个接口。
#http.close_api_version false
#*********************************************************************
# 限频配置
#*********************************************************************
+1 -1
View File
@@ -12,7 +12,7 @@
<artifactId>wildfirechat-parent</artifactId>
<packaging>pom</packaging>
<version>1.1.9</version>
<version>1.2.0</version>
<name>Wildfire Chat</name>
<description>Wildfire Chat Server</description>
<inceptionYear>2019</inceptionYear>
+10
View File
@@ -12,6 +12,16 @@
# 更新记录
--------------
Release note 1.2.0:
1. 添加配置开关,可以关掉api/version检查接口。
2. Server SDK会议事件中添加时间戳。
3. 禁止私聊时,如果一方在允许私聊列表中,允许私聊。
4. 解决某些特殊情况下获取网卡信息失败导致启动失败的问题。
5. 支持按照用户ID来搜索用户。
6. 添加获取某个用户是否在聊天室的接口。
7. 优化多端加入聊天室的处理。
--------------
Release note 1.1.9:
1. 解决服务器时间误差太大引起的问题。
+1 -1
View File
@@ -3,7 +3,7 @@
<parent>
<artifactId>wildfirechat-parent</artifactId>
<groupId>cn.wildfirechat</groupId>
<version>1.1.9</version>
<version>1.2.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
+10 -4
View File
@@ -36,20 +36,26 @@
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>cn.wildfirechat</groupId>
<artifactId>sdk</artifactId>
<version>0.20</version>
<version>1.2.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/lib/sdk-0.20.jar</systemPath>
<systemPath>${project.basedir}/src/lib/sdk-1.1.9.jar</systemPath>
</dependency>
<dependency>
<groupId>cn.wildfirechat</groupId>
<artifactId>common</artifactId>
<version>0.20</version>
<version>1.2.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/lib/common-0.20.jar</systemPath>
<systemPath>${project.basedir}/src/lib/common-1.1.9.jar</systemPath>
</dependency>
</dependencies>
@@ -37,6 +37,12 @@ public class ChatroomAdmin {
return AdminHttpUtils.httpJsonPost(path, input, OutputStringList.class);
}
public static IMResult<OutputUserChatroom> getUserChatroom(String userId) throws Exception {
String path = APIPath.Chatroom_GetUserChatroom;
InputUserId input = new InputUserId(userId);
return AdminHttpUtils.httpJsonPost(path, input, OutputUserChatroom.class);
}
//仅专业版支持
//status:0,正常;1,禁言;2,禁止加入
public static IMResult<Void> setChatroomBlacklist(String chatroomId, String userId, int status) throws Exception {
+14 -12
View File
@@ -300,18 +300,12 @@ public class Main {
System.exit(-1);
}
int limit = 5;
for (int i = 0; i < 100; i++) {
IMResult<OutputGetUserList> getUserListIMResult = UserAdmin.getAllUsers(limit, i*limit);
if (getUserListIMResult != null && getUserListIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
System.out.println("getUserListIMResult success");
if(getUserListIMResult.getResult().userInfoList.size() < limit) {
break;
}
} else {
System.out.println("getUserListIMResult failure");
System.exit(-1);
}
IMResult<OutputGetUserList> getUserListIMResult = UserAdmin.getAllUsers(100, 0);
if (getUserListIMResult != null && getUserListIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
System.out.println("getUserListIMResult success");
} else {
System.out.println("getUserListIMResult failure");
System.exit(-1);
}
if (commercialServer) {
@@ -980,6 +974,14 @@ public class Main {
System.exit(-1);
}
IMResult<OutputUserChatroom> userChatroomIMResult = ChatroomAdmin.getUserChatroom("hygqmws2k");
if(userChatroomIMResult != null && (userChatroomIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS || userChatroomIMResult.getErrorCode() == ErrorCode.ERROR_CODE_NOT_EXIST)) {
System.out.println("get user chatroom success");
} else {
System.out.println("get user chatroom failure");
System.exit(-1);
}
//下面仅专业版支持
if(commercialServer) {
//设置用户聊天室黑名单。0正常;1禁言;2禁止加入。