Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1434dafd36 | ||
|
|
0d8a6e64ea | ||
|
|
d96c201aec | ||
|
|
d901707691 | ||
|
|
f456a4cc65 | ||
|
|
c4bd706272 | ||
|
|
503768c04b | ||
|
|
7ca3abe12d | ||
|
|
cb09026408 | ||
|
|
fab381a351 | ||
|
|
a3782b94a8 | ||
|
|
3c5ba7f1fa | ||
|
|
24e95ea4db | ||
|
|
f96f202b58 | ||
|
|
29a53955b6 | ||
|
|
bf081cd416 | ||
|
|
a074b9eac3 |
@@ -32,7 +32,8 @@ host 0.0.0.0
|
|||||||
##本地绑定端口
|
##本地绑定端口
|
||||||
local_port 80
|
local_port 80
|
||||||
|
|
||||||
##是否使用内置DB。0使用mysql;1使用h2db。
|
## 是否使用内置DB。0使用mysql;1使用h2db。
|
||||||
|
## MySQL需要把事物隔离级别改成"Read committed",使用命令来修改"set global transaction_isolation='read-committed';",其他数据库默认已经是这个级别不用修改
|
||||||
embed.db 1
|
embed.db 1
|
||||||
|
|
||||||
## 是否自动清理历史消息记录,当为true时,IM服务会定时扫描t_messages_x和t_user_messages_x表,清除掉3年前的历史消息。
|
## 是否自动清理历史消息记录,当为true时,IM服务会定时扫描t_messages_x和t_user_messages_x表,清除掉3年前的历史消息。
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
alter table `t_user_setting` modify column `_key` varchar(128) NOT NULL;
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
ALTER TABLE `t_read_report` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL;
|
||||||
|
ALTER TABLE `t_read_report` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL;
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
alter table `t_user_setting` modify column `_key` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL;
|
||||||
+26
-18
@@ -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.78</version>
|
<version>0.80</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>moquette-broker</artifactId>
|
<artifactId>moquette-broker</artifactId>
|
||||||
@@ -18,30 +18,38 @@
|
|||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
<artifactId>slf4j-api</artifactId>
|
|
||||||
<version>1.7.5</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
<artifactId>slf4j-log4j12</artifactId>
|
|
||||||
<version>1.7.5</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.wildfirechat</groupId>
|
<groupId>cn.wildfirechat</groupId>
|
||||||
<artifactId>common</artifactId>
|
<artifactId>common</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/log4j/log4j -->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>log4j</groupId>
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
<artifactId>log4j</artifactId>
|
<artifactId>log4j-core</artifactId>
|
||||||
<version>1.2.17</version>
|
<version>2.17.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
|
<artifactId>log4j-api</artifactId>
|
||||||
|
<version>2.17.1</version>
|
||||||
|
</dependency>
|
||||||
|
<!--用于与slf4j保持桥接-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
|
<artifactId>log4j-slf4j-impl</artifactId>
|
||||||
|
<version>2.17.1</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- slf4j核心包-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-api</artifactId>
|
||||||
|
<version>1.7.25</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.lmax</groupId>
|
||||||
|
<artifactId>disruptor</artifactId>
|
||||||
|
<version>3.4.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
|
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
|
||||||
|
|||||||
@@ -94,9 +94,13 @@ 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 || session.getPlatform() == ProtoConstants.Platform.Platform_Android) {
|
if (session.getPlatform() == ProtoConstants.Platform.Platform_iOS
|
||||||
|
|| 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();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ public class GetGroupMembersAction extends AdminAction {
|
|||||||
pm.setAlias(member.getAlias());
|
pm.setAlias(member.getAlias());
|
||||||
pm.setType(member.getType());
|
pm.setType(member.getType());
|
||||||
pm.setExtra(member.getExtra());
|
pm.setExtra(member.getExtra());
|
||||||
|
pm.setCreateDt(member.getCreateDt());
|
||||||
out.getMembers().add(pm);
|
out.getMembers().add(pm);
|
||||||
}
|
}
|
||||||
result = RestResult.ok(out);
|
result = RestResult.ok(out);
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ abstract public class ChannelAction extends Action {
|
|||||||
try {
|
try {
|
||||||
ts = Long.parseLong(timestamp);
|
ts = Long.parseLong(timestamp);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
LOG.error("Channel timestamp:{} invalid", timestamp);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Utility.printExecption(LOG, e, IMExceptionEvent.EventType.CHANNEL_API_Exception);
|
Utility.printExecption(LOG, e, IMExceptionEvent.EventType.CHANNEL_API_Exception);
|
||||||
return ErrorCode.ERROR_CODE_API_NOT_SIGNED;
|
return ErrorCode.ERROR_CODE_API_NOT_SIGNED;
|
||||||
@@ -81,7 +82,7 @@ abstract public class ChannelAction extends Action {
|
|||||||
|
|
||||||
channelInfo = messagesStore.getChannelInfo(cid);
|
channelInfo = messagesStore.getChannelInfo(cid);
|
||||||
if (channelInfo == null) {
|
if (channelInfo == null) {
|
||||||
return ErrorCode.INVALID_PARAMETER;
|
return ErrorCode.ERROR_CODE_CHANNEL_NO_EXIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StringUtil.isNullOrEmpty(channelInfo.getSecret())) {
|
if (StringUtil.isNullOrEmpty(channelInfo.getSecret())) {
|
||||||
|
|||||||
@@ -14,16 +14,12 @@ import cn.wildfirechat.pojos.InputGetUserInfo;
|
|||||||
import cn.wildfirechat.pojos.InputOutputUserInfo;
|
import cn.wildfirechat.pojos.InputOutputUserInfo;
|
||||||
import cn.wildfirechat.proto.ProtoConstants;
|
import cn.wildfirechat.proto.ProtoConstants;
|
||||||
import cn.wildfirechat.proto.WFCMessage;
|
import cn.wildfirechat.proto.WFCMessage;
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.xiaoleilu.loServer.RestResult;
|
import com.xiaoleilu.loServer.RestResult;
|
||||||
import com.xiaoleilu.loServer.action.admin.AdminAction;
|
|
||||||
import com.xiaoleilu.loServer.action.robot.RobotAction;
|
|
||||||
import com.xiaoleilu.loServer.annotation.HttpMethod;
|
import com.xiaoleilu.loServer.annotation.HttpMethod;
|
||||||
import com.xiaoleilu.loServer.annotation.Route;
|
import com.xiaoleilu.loServer.annotation.Route;
|
||||||
import com.xiaoleilu.loServer.handler.Request;
|
import com.xiaoleilu.loServer.handler.Request;
|
||||||
import com.xiaoleilu.loServer.handler.Response;
|
import com.xiaoleilu.loServer.handler.Response;
|
||||||
import io.netty.handler.codec.http.FullHttpRequest;
|
import io.netty.handler.codec.http.FullHttpRequest;
|
||||||
import io.netty.handler.codec.http.HttpResponseStatus;
|
|
||||||
import io.netty.util.internal.StringUtil;
|
import io.netty.util.internal.StringUtil;
|
||||||
|
|
||||||
@Route(APIPath.Channel_User_Info)
|
@Route(APIPath.Channel_User_Info)
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ package com.xiaoleilu.loServer.action.channel;
|
|||||||
import cn.wildfirechat.common.APIPath;
|
import cn.wildfirechat.common.APIPath;
|
||||||
import cn.wildfirechat.pojos.SendChannelMessageData;
|
import cn.wildfirechat.pojos.SendChannelMessageData;
|
||||||
import cn.wildfirechat.proto.ProtoConstants;
|
import cn.wildfirechat.proto.ProtoConstants;
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.xiaoleilu.loServer.RestResult;
|
import com.xiaoleilu.loServer.RestResult;
|
||||||
import com.xiaoleilu.loServer.annotation.HttpMethod;
|
import com.xiaoleilu.loServer.annotation.HttpMethod;
|
||||||
import com.xiaoleilu.loServer.annotation.Route;
|
import com.xiaoleilu.loServer.annotation.Route;
|
||||||
@@ -24,7 +23,6 @@ import cn.wildfirechat.pojos.SendMessageResult;
|
|||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.handler.codec.http.FullHttpRequest;
|
import io.netty.handler.codec.http.FullHttpRequest;
|
||||||
import io.netty.handler.codec.http.HttpResponseStatus;
|
|
||||||
import cn.wildfirechat.common.ErrorCode;
|
import cn.wildfirechat.common.ErrorCode;
|
||||||
import win.liyufan.im.IMTopic;
|
import win.liyufan.im.IMTopic;
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ public class GetGroupMembersAction extends RobotAction {
|
|||||||
pm.setAlias(member.getAlias());
|
pm.setAlias(member.getAlias());
|
||||||
pm.setType(member.getType());
|
pm.setType(member.getType());
|
||||||
pm.setExtra(member.getExtra());
|
pm.setExtra(member.getExtra());
|
||||||
|
pm.setCreateDt(member.getCreateDt());
|
||||||
out.getMembers().add(pm);
|
out.getMembers().add(pm);
|
||||||
}
|
}
|
||||||
if(!isInGroup) {
|
if(!isInGroup) {
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ abstract public class GroupHandler<T> extends IMHandler<T> {
|
|||||||
try {
|
try {
|
||||||
long messageId = MessageShardingUtil.generateId();
|
long messageId = MessageShardingUtil.generateId();
|
||||||
builder.setMessageId(messageId);
|
builder.setMessageId(messageId);
|
||||||
saveAndPublish(fromUser, null, builder.build());
|
saveAndPublish(fromUser, null, builder.build(), ProtoConstants.RequestSourceType.Request_From_User);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class HandleFriendRequestHandler extends IMHandler<WFCMessage.HandleFrien
|
|||||||
builder.setMessageId(messageId);
|
builder.setMessageId(messageId);
|
||||||
builder.setServerTimestamp(timestamp);
|
builder.setServerTimestamp(timestamp);
|
||||||
if(!StringUtil.isNullOrEmpty(builder.getContent().getSearchableContent())) {
|
if(!StringUtil.isNullOrEmpty(builder.getContent().getSearchableContent())) {
|
||||||
saveAndPublish(request.getTargetUid(), null, builder.build());
|
saveAndPublish(request.getTargetUid(), null, builder.build(), requestSourceType);
|
||||||
}
|
}
|
||||||
|
|
||||||
MemorySessionStore.Session session = m_sessionsStore.getSession(clientID);
|
MemorySessionStore.Session session = m_sessionsStore.getSession(clientID);
|
||||||
@@ -63,7 +63,7 @@ public class HandleFriendRequestHandler extends IMHandler<WFCMessage.HandleFrien
|
|||||||
|
|
||||||
messageId = MessageShardingUtil.generateId();
|
messageId = MessageShardingUtil.generateId();
|
||||||
builder.setMessageId(messageId);
|
builder.setMessageId(messageId);
|
||||||
saveAndPublish(request.getTargetUid(), null, builder.build());
|
saveAndPublish(request.getTargetUid(), null, builder.build(), requestSourceType);
|
||||||
|
|
||||||
if (m_messagesStore.isNewFriendWelcomeMessage()) {
|
if (m_messagesStore.isNewFriendWelcomeMessage()) {
|
||||||
contentBuilder.setType(93);
|
contentBuilder.setType(93);
|
||||||
@@ -75,7 +75,7 @@ public class HandleFriendRequestHandler extends IMHandler<WFCMessage.HandleFrien
|
|||||||
messageId = MessageShardingUtil.generateId();
|
messageId = MessageShardingUtil.generateId();
|
||||||
builder.setMessageId(messageId);
|
builder.setMessageId(messageId);
|
||||||
builder.setServerTimestamp(++timestamp);
|
builder.setServerTimestamp(++timestamp);
|
||||||
saveAndPublish(request.getTargetUid(), null, builder.build());
|
saveAndPublish(request.getTargetUid(), null, builder.build(), requestSourceType);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -246,21 +246,21 @@ abstract public class IMHandler<T> {
|
|||||||
public void afterAction(String clientID, String fromUser, String topic, Qos1PublishHandler.IMCallback callback) {
|
public void afterAction(String clientID, String fromUser, String topic, Qos1PublishHandler.IMCallback callback) {
|
||||||
|
|
||||||
}
|
}
|
||||||
protected long publish(String username, String clientID, WFCMessage.Message message) {
|
protected long publish(String username, String clientID, WFCMessage.Message message, ProtoConstants.RequestSourceType requestSourceType) {
|
||||||
Set<String> notifyReceivers = new LinkedHashSet<>();
|
Set<String> notifyReceivers = new LinkedHashSet<>();
|
||||||
|
|
||||||
WFCMessage.Message.Builder messageBuilder = message.toBuilder();
|
WFCMessage.Message.Builder messageBuilder = message.toBuilder();
|
||||||
int pullType = m_messagesStore.getNotifyReceivers(username, messageBuilder, notifyReceivers);
|
int pullType = m_messagesStore.getNotifyReceivers(username, messageBuilder, notifyReceivers, requestSourceType);
|
||||||
mServer.getImBusinessScheduler().execute(() -> this.publisher.publish2Receivers(messageBuilder.build(), notifyReceivers, clientID, pullType));
|
mServer.getImBusinessScheduler().execute(() -> this.publisher.publish2Receivers(messageBuilder.build(), notifyReceivers, clientID, pullType));
|
||||||
return notifyReceivers.size();
|
return notifyReceivers.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected long saveAndPublish(String username, String clientID, WFCMessage.Message message) {
|
protected long saveAndPublish(String username, String clientID, WFCMessage.Message message, ProtoConstants.RequestSourceType requestSourceType) {
|
||||||
Set<String> notifyReceivers = new LinkedHashSet<>();
|
Set<String> notifyReceivers = new LinkedHashSet<>();
|
||||||
|
|
||||||
message = m_messagesStore.storeMessage(username, clientID, message);
|
message = m_messagesStore.storeMessage(username, clientID, message);
|
||||||
WFCMessage.Message.Builder messageBuilder = message.toBuilder();
|
WFCMessage.Message.Builder messageBuilder = message.toBuilder();
|
||||||
int pullType = m_messagesStore.getNotifyReceivers(username, messageBuilder, notifyReceivers);
|
int pullType = m_messagesStore.getNotifyReceivers(username, messageBuilder, notifyReceivers, requestSourceType);
|
||||||
mServer.getImBusinessScheduler().execute(() -> this.publisher.publish2Receivers(messageBuilder.build(), notifyReceivers, clientID, pullType));
|
mServer.getImBusinessScheduler().execute(() -> this.publisher.publish2Receivers(messageBuilder.build(), notifyReceivers, clientID, pullType));
|
||||||
return notifyReceivers.size();
|
return notifyReceivers.size();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class LoadRemoteMessagesHandler extends IMHandler<WFCMessage.LoadRemoteMe
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (request.getConversation().getType() == ProtoConstants.ConversationType.ConversationType_Channel) {
|
if (request.getConversation().getType() == ProtoConstants.ConversationType.ConversationType_Channel) {
|
||||||
if (!m_messagesStore.checkUserInChannel(fromUser, request.getConversation().getTarget())) {
|
if (!m_messagesStore.canSendMessageInChannel(fromUser, request.getConversation().getTarget())) {
|
||||||
return ErrorCode.ERROR_CODE_NOT_IN_CHANNEL;
|
return ErrorCode.ERROR_CODE_NOT_IN_CHANNEL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class RecallMessageHandler extends IMHandler<WFCMessage.INT64Buf> {
|
|||||||
return ErrorCode.ERROR_CODE_NOT_EXIST;
|
return ErrorCode.ERROR_CODE_NOT_EXIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
publish(fromUser, clientID, message);
|
publish(fromUser, clientID, message, requestSourceType);
|
||||||
|
|
||||||
return errorCode;
|
return errorCode;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,11 @@ public class RouteHandler extends IMHandler<WFCMessage.RouteRequest> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (session == null || session.getDeleted() > 0) {
|
if (session == null || session.getDeleted() > 0) {
|
||||||
|
if(session == null) {
|
||||||
|
LOG.error("Session for <{}, {}> not exist", fromUser, clientID);
|
||||||
|
} else {
|
||||||
|
LOG.error("Session for <{}, {}> deleted", fromUser, clientID);
|
||||||
|
}
|
||||||
return ErrorCode.ERROR_CODE_SECRECT_KEY_MISMATCH;
|
return ErrorCode.ERROR_CODE_SECRECT_KEY_MISMATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ public class SendMessageHandler extends IMHandler<WFCMessage.Message> {
|
|||||||
}
|
}
|
||||||
} else if (message.getConversation().getType() == ProtoConstants.ConversationType.ConversationType_Channel) {
|
} else if (message.getConversation().getType() == ProtoConstants.ConversationType.ConversationType_Channel) {
|
||||||
if(!m_messagesStore.getGroupMuteExceptionTypes().contains(message.getContent().getType())) {
|
if(!m_messagesStore.getGroupMuteExceptionTypes().contains(message.getContent().getType())) {
|
||||||
if (!m_messagesStore.checkUserInChannel(fromUser, message.getConversation().getTarget())) {
|
if (!m_messagesStore.canSendMessageInChannel(fromUser, message.getConversation().getTarget())) {
|
||||||
return ErrorCode.ERROR_CODE_NOT_IN_CHANNEL;
|
return ErrorCode.ERROR_CODE_NOT_IN_CHANNEL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -203,15 +203,15 @@ public class SendMessageHandler extends IMHandler<WFCMessage.Message> {
|
|||||||
@Override
|
@Override
|
||||||
public void onSuccess(String content) {
|
public void onSuccess(String content) {
|
||||||
if(StringUtil.isNullOrEmpty(content)) {
|
if(StringUtil.isNullOrEmpty(content)) {
|
||||||
saveAndPublish(fromUser, clientID, finalMsg);
|
saveAndPublish(fromUser, clientID, finalMsg, requestSourceType);
|
||||||
} else {
|
} else {
|
||||||
MessagePayload payload = new Gson().fromJson(content, MessagePayload.class);
|
MessagePayload payload = new Gson().fromJson(content, MessagePayload.class);
|
||||||
if (payload != null && payload.getType() > 0) {
|
if (payload != null && payload.getType() > 0) {
|
||||||
WFCMessage.Message newMsg = finalMsg.toBuilder().setContent(payload.toProtoMessageContent()).build();
|
WFCMessage.Message newMsg = finalMsg.toBuilder().setContent(payload.toProtoMessageContent()).build();
|
||||||
saveAndPublish(fromUser, clientID, newMsg);
|
saveAndPublish(fromUser, clientID, newMsg, requestSourceType);
|
||||||
} else {
|
} else {
|
||||||
LOG.error("Response content {} from censor is invalid payload, ignore response and send original message", content);
|
LOG.error("Response content {} from censor is invalid payload, ignore response and send original message", content);
|
||||||
saveAndPublish(fromUser, clientID, finalMsg);
|
saveAndPublish(fromUser, clientID, finalMsg, requestSourceType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(mWaitRemoteSensitiveServerResponse) {
|
if(mWaitRemoteSensitiveServerResponse) {
|
||||||
@@ -236,7 +236,7 @@ public class SendMessageHandler extends IMHandler<WFCMessage.Message> {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOG.warn("Failed to censor message with status {}, errorMessage {}. Send the original message", statusCode, errorMessage);
|
LOG.warn("Failed to censor message with status {}, errorMessage {}. Send the original message", statusCode, errorMessage);
|
||||||
saveAndPublish(fromUser, clientID, finalMsg);
|
saveAndPublish(fromUser, clientID, finalMsg, requestSourceType);
|
||||||
|
|
||||||
if(mWaitRemoteSensitiveServerResponse) {
|
if(mWaitRemoteSensitiveServerResponse) {
|
||||||
errorCode = ERROR_CODE_SUCCESS;
|
errorCode = ERROR_CODE_SUCCESS;
|
||||||
@@ -268,7 +268,7 @@ public class SendMessageHandler extends IMHandler<WFCMessage.Message> {
|
|||||||
|
|
||||||
if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) {
|
if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
if(!ignoreMsg) {
|
if(!ignoreMsg) {
|
||||||
saveAndPublish(fromUser, clientID, message);
|
saveAndPublish(fromUser, clientID, message, requestSourceType);
|
||||||
}
|
}
|
||||||
ackPayload = ackPayload.capacity(20);
|
ackPayload = ackPayload.capacity(20);
|
||||||
ackPayload.writeLong(messageId);
|
ackPayload.writeLong(messageId);
|
||||||
|
|||||||
@@ -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.getPushType() == 2) {
|
if ((request.getPlatform() == ProtoConstants.Platform.Platform_iOS || request.getPlatform() == ProtoConstants.Platform.Platform_iPad) && request.getPushType() == 2) {
|
||||||
session.setVoipDeviceToken(request.getDeviceToken());
|
session.setVoipDeviceToken(request.getDeviceToken());
|
||||||
m_sessionsStore.updateSessionToken(session, true);
|
m_sessionsStore.updateSessionToken(session, true);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1573,6 +1573,8 @@ 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";
|
||||||
}
|
}
|
||||||
@@ -1594,6 +1596,9 @@ 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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
|
|||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import static cn.wildfirechat.common.IMExceptionEvent.EventType.EVENT_CALLBACK_Exception;
|
import static cn.wildfirechat.common.IMExceptionEvent.EventType.EVENT_CALLBACK_Exception;
|
||||||
import static cn.wildfirechat.proto.ProtoConstants.ChannelState.Channel_State_Mask_Deleted;
|
import static cn.wildfirechat.proto.ProtoConstants.ChannelState.*;
|
||||||
import static cn.wildfirechat.proto.ProtoConstants.ChannelUpdateEventType.*;
|
import static cn.wildfirechat.proto.ProtoConstants.ChannelUpdateEventType.*;
|
||||||
import static cn.wildfirechat.proto.ProtoConstants.ChatroomMemberUpdateEventType.Chatroom_Member_Event_Join;
|
import static cn.wildfirechat.proto.ProtoConstants.ChatroomMemberUpdateEventType.Chatroom_Member_Event_Join;
|
||||||
import static cn.wildfirechat.proto.ProtoConstants.ChatroomMemberUpdateEventType.Chatroom_Member_Event_Leave;
|
import static cn.wildfirechat.proto.ProtoConstants.ChatroomMemberUpdateEventType.Chatroom_Member_Event_Leave;
|
||||||
@@ -496,7 +496,7 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getNotifyReceivers(String fromUser, WFCMessage.Message.Builder messageBuilder, Set<String> notifyReceivers) {
|
public int getNotifyReceivers(String fromUser, WFCMessage.Message.Builder messageBuilder, Set<String> notifyReceivers, ProtoConstants.RequestSourceType requestSourceType) {
|
||||||
WFCMessage.Message message = messageBuilder.build();
|
WFCMessage.Message message = messageBuilder.build();
|
||||||
HazelcastInstance hzInstance = m_Server.getHazelcastInstance();
|
HazelcastInstance hzInstance = m_Server.getHazelcastInstance();
|
||||||
int type = message.getConversation().getType();
|
int type = message.getConversation().getType();
|
||||||
@@ -556,8 +556,15 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
} else if(type == ProtoConstants.ConversationType.ConversationType_Channel) {
|
} else if(type == ProtoConstants.ConversationType.ConversationType_Channel) {
|
||||||
WFCMessage.ChannelInfo channelInfo = getChannelInfo(message.getConversation().getTarget());
|
WFCMessage.ChannelInfo channelInfo = getChannelInfo(message.getConversation().getTarget());
|
||||||
if (channelInfo != null) {
|
if (channelInfo != null) {
|
||||||
notifyReceivers.add(fromUser);
|
|
||||||
if (channelInfo.getOwner().equals(fromUser)) {
|
if (channelInfo.getOwner().equals(fromUser)) {
|
||||||
|
if(requestSourceType == ProtoConstants.RequestSourceType.Request_From_Channel
|
||||||
|
&& !StringUtil.isNullOrEmpty(channelInfo.getCallback())
|
||||||
|
&& channelInfo.getAutomatic() == 1) {
|
||||||
|
LOG.info("Channel api message not send to the owner when automatic");
|
||||||
|
} else {
|
||||||
|
notifyReceivers.add(fromUser);
|
||||||
|
}
|
||||||
|
|
||||||
if((channelInfo.getStatus() & ProtoConstants.ChannelState.Channel_State_Mask_Global) > 0) {
|
if((channelInfo.getStatus() & ProtoConstants.ChannelState.Channel_State_Mask_Global) > 0) {
|
||||||
if((message.getToList() != null && !message.getToList().isEmpty())) {
|
if((message.getToList() != null && !message.getToList().isEmpty())) {
|
||||||
notifyReceivers.addAll(message.getToList());
|
notifyReceivers.addAll(message.getToList());
|
||||||
@@ -581,6 +588,7 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
notifyReceivers.add(fromUser);
|
||||||
if (StringUtil.isNullOrEmpty(channelInfo.getCallback()) || channelInfo.getAutomatic() == 0) {
|
if (StringUtil.isNullOrEmpty(channelInfo.getCallback()) || channelInfo.getAutomatic() == 0) {
|
||||||
notifyReceivers.add(channelInfo.getOwner());
|
notifyReceivers.add(channelInfo.getOwner());
|
||||||
}
|
}
|
||||||
@@ -772,6 +780,15 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clearChatroomMembers(String chatroomId) {
|
||||||
|
MultiMap<String, UserClientEntry> chatroomMembers = m_Server.getHazelcastInstance().getMultiMap(CHATROOM_MEMBER_IDS);
|
||||||
|
IMap<String, String> userChatroomMap = m_Server.getHazelcastInstance().getMap(USER_CHATROOM);
|
||||||
|
chatroomMembers.get(chatroomId).forEach(userClientEntry -> {
|
||||||
|
userChatroomMap.remove(userClientEntry.userId);
|
||||||
|
});
|
||||||
|
chatroomMembers.remove(chatroomId);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<UserClientEntry> getChatroomMembers(String chatroomId) {
|
public Collection<UserClientEntry> getChatroomMembers(String chatroomId) {
|
||||||
MultiMap<String, UserClientEntry> chatroomMembers = m_Server.getHazelcastInstance().getMultiMap(CHATROOM_MEMBER_IDS);
|
MultiMap<String, UserClientEntry> chatroomMembers = m_Server.getHazelcastInstance().getMultiMap(CHATROOM_MEMBER_IDS);
|
||||||
@@ -2309,39 +2326,47 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (session.getPlatform() == Platform_LINUX || session.getPlatform() == Platform_Windows || session.getPlatform() == Platform_OSX) {
|
String pcValue = null;
|
||||||
updateUserSettings(session.username, WFCMessage.ModifyUserSettingReq.newBuilder().setScope(kUserSettingPCOnline).setKey("PC").setValue(online ? (System.currentTimeMillis() + "|" + session.getPlatform() + "|" + session.getClientID() + "|" + session.getPhoneName()) : "").build(), session.clientID);
|
String padValue = null;
|
||||||
} else {
|
for (MemorySessionStore.Session s : m_Server.getStore().sessionsStore().sessionForUser(session.username)) {
|
||||||
String value = null;
|
if (s.getDeleted() != 0 || !m_Server.getConnectionsManager().isConnected(s.getClientID())) {
|
||||||
for (MemorySessionStore.Session s : m_Server.getStore().sessionsStore().sessionForUser(session.username)) {
|
continue;
|
||||||
if (s.getDeleted() != 0 || !m_Server.getConnectionsManager().isConnected(s.getClientID())) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (s.getPlatform()) {
|
|
||||||
case Platform_LINUX:
|
|
||||||
case Platform_Windows:
|
|
||||||
case Platform_OSX:
|
|
||||||
value = System.currentTimeMillis() + "|" + s.getPlatform() + "|" + s.getClientID() + "|" + s.getPhoneName();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (value != null) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WFCMessage.UserSettingEntry pcentry = getUserSetting(session.getUsername(), kUserSettingPCOnline, "PC");
|
switch (s.getPlatform()) {
|
||||||
if (value != null) {
|
case Platform_LINUX:
|
||||||
if (pcentry == null || StringUtil.isNullOrEmpty(pcentry.getValue())) {
|
case Platform_Windows:
|
||||||
updateUserSettings(session.username, WFCMessage.ModifyUserSettingReq.newBuilder().setScope(kUserSettingPCOnline).setKey("PC").setValue(value).build(), session.clientID);
|
case Platform_OSX:
|
||||||
}
|
pcValue = System.currentTimeMillis() + "|" + s.getPlatform() + "|" + s.getClientID() + "|" + s.getPhoneName();
|
||||||
} else {
|
break;
|
||||||
if (pcentry != null && !StringUtil.isNullOrEmpty(pcentry.getValue())) {
|
case Platform_iPad:
|
||||||
updateUserSettings(session.username, WFCMessage.ModifyUserSettingReq.newBuilder().setScope(kUserSettingPCOnline).setKey("PC").setValue("").build(), session.clientID);
|
case Platform_APad:
|
||||||
}
|
padValue = System.currentTimeMillis() + "|" + s.getPlatform() + "|" + s.getClientID() + "|" + s.getPhoneName();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
WFCMessage.UserSettingEntry pcentry = getUserSetting(session.getUsername(), kUserSettingPCOnline, "PC");
|
||||||
|
if (pcValue != null) {
|
||||||
|
if (pcentry == null || StringUtil.isNullOrEmpty(pcentry.getValue())) {
|
||||||
|
updateUserSettings(session.username, WFCMessage.ModifyUserSettingReq.newBuilder().setScope(kUserSettingPCOnline).setKey("PC").setValue(pcValue).build(), session.clientID);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (pcentry != null && !StringUtil.isNullOrEmpty(pcentry.getValue())) {
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2565,6 +2590,7 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
IMap<String, WFCMessage.ChatroomInfo> chatroomInfoMap = hzInstance.getMap(CHATROOMS);
|
IMap<String, WFCMessage.ChatroomInfo> chatroomInfoMap = hzInstance.getMap(CHATROOMS);
|
||||||
WFCMessage.ChatroomInfo room = chatroomInfoMap.get(chatroomId);
|
WFCMessage.ChatroomInfo room = chatroomInfoMap.get(chatroomId);
|
||||||
if (room != null) {
|
if (room != null) {
|
||||||
|
clearChatroomMembers(chatroomId);
|
||||||
room = room.toBuilder().setUpdateDt(System.currentTimeMillis()).setState(ProtoConstants.ChatroomState.Chatroom_State_End).build();
|
room = room.toBuilder().setUpdateDt(System.currentTimeMillis()).setState(ProtoConstants.ChatroomState.Chatroom_State_End).build();
|
||||||
chatroomInfoMap.put(chatroomId, room);
|
chatroomInfoMap.put(chatroomId, room);
|
||||||
callbackChatroomInfoUpdateEvent(chatroomId, Chatroom_Event_Destroy);
|
callbackChatroomInfoUpdateEvent(chatroomId, Chatroom_Event_Destroy);
|
||||||
@@ -3184,7 +3210,7 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
@Override
|
@Override
|
||||||
public ErrorCode handleJoinChatroom(String userId, String clientId, String chatroomId) {
|
public ErrorCode handleJoinChatroom(String userId, String clientId, String chatroomId) {
|
||||||
IMap<String, WFCMessage.ChatroomInfo> chatroomInfoMap = m_Server.getHazelcastInstance().getMap(CHATROOMS);
|
IMap<String, WFCMessage.ChatroomInfo> chatroomInfoMap = m_Server.getHazelcastInstance().getMap(CHATROOMS);
|
||||||
if (chatroomInfoMap == null || chatroomInfoMap.get(chatroomId) == null) {
|
if (chatroomInfoMap == null || chatroomInfoMap.get(chatroomId) == null || chatroomInfoMap.get(chatroomId).getState() == ProtoConstants.ChatroomState.Chatroom_State_End) {
|
||||||
if(mChatroomCreateWhenNotExist) {
|
if(mChatroomCreateWhenNotExist) {
|
||||||
WFCMessage.ChatroomInfo.Builder builder = WFCMessage.ChatroomInfo.newBuilder().setTitle(chatroomId);
|
WFCMessage.ChatroomInfo.Builder builder = WFCMessage.ChatroomInfo.newBuilder().setTitle(chatroomId);
|
||||||
createChatroom(chatroomId, builder.build());
|
createChatroom(chatroomId, builder.build());
|
||||||
@@ -3733,6 +3759,34 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
return mIMap.get(channelId);
|
return mIMap.get(channelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canSendMessageInChannel(String user, String channelId) {
|
||||||
|
IMap<String, WFCMessage.ChannelInfo> mIMap = m_Server.getHazelcastInstance().getMap(CHANNELS);
|
||||||
|
WFCMessage.ChannelInfo info = mIMap.get(channelId);
|
||||||
|
if(info == null || info.getStatus() == Channel_State_Mask_Deleted) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(user.equals(info.getOwner())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if((info.getStatus() & Channel_State_Mask_Global) > 0 || (info.getStatus() & Channel_State_Mask_Message_Unsubscribed) > 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Collection<String> channelMembers = getChannelListener(channelId);
|
||||||
|
if (channelMembers == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Collection<String> chatroomMembers = getChannelListener(channelId);
|
||||||
|
if (chatroomMembers == null || !chatroomMembers.contains(user)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkUserInChannel(String user, String channelId) {
|
public boolean checkUserInChannel(String user, String channelId) {
|
||||||
Collection<String> channelMembers = getChannelListener(channelId);
|
Collection<String> channelMembers = getChannelListener(channelId);
|
||||||
|
|||||||
@@ -407,6 +407,10 @@ 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;
|
||||||
@@ -723,16 +727,25 @@ public class MemorySessionStore implements ISessionsStore {
|
|||||||
public ErrorCode kickoffPCClient(String operator, String pcClientId) {
|
public ErrorCode kickoffPCClient(String operator, String pcClientId) {
|
||||||
Session session = sessions.get(pcClientId);
|
Session session = sessions.get(pcClientId);
|
||||||
if (session != null) {
|
if (session != null) {
|
||||||
|
if(!operator.equals(session.getUsername())) {
|
||||||
|
LOG.error("kickoffPCClient failure, user {} don't have client {}", operator, pcClientId);
|
||||||
|
return ErrorCode.ERROR_CODE_NOT_RIGHT;
|
||||||
|
}
|
||||||
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);
|
||||||
} else {
|
} else {
|
||||||
|
LOG.error("session {} is not pc client:{}", pcClientId, session.getPlatform());
|
||||||
return ErrorCode.ERROR_CODE_NOT_RIGHT;
|
return ErrorCode.ERROR_CODE_NOT_RIGHT;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
LOG.error("Can't find the session for client <{}>", pcClientId);
|
||||||
}
|
}
|
||||||
return ErrorCode.ERROR_CODE_SUCCESS;
|
return ErrorCode.ERROR_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package io.moquette.spi;
|
|||||||
|
|
||||||
import cn.wildfirechat.pojos.InputOutputUserInfo;
|
import cn.wildfirechat.pojos.InputOutputUserInfo;
|
||||||
import cn.wildfirechat.pojos.SystemSettingPojo;
|
import cn.wildfirechat.pojos.SystemSettingPojo;
|
||||||
|
import cn.wildfirechat.proto.ProtoConstants;
|
||||||
import cn.wildfirechat.proto.WFCMessage;
|
import cn.wildfirechat.proto.WFCMessage;
|
||||||
import com.xiaoleilu.loServer.model.FriendData;
|
import com.xiaoleilu.loServer.model.FriendData;
|
||||||
import cn.wildfirechat.pojos.InputOutputUserBlockStatus;
|
import cn.wildfirechat.pojos.InputOutputUserBlockStatus;
|
||||||
@@ -101,7 +102,7 @@ public interface IMessagesStore {
|
|||||||
DatabaseStore getDatabaseStore();
|
DatabaseStore getDatabaseStore();
|
||||||
WFCMessage.Message storeMessage(String fromUser, String fromClientId, WFCMessage.Message message);
|
WFCMessage.Message storeMessage(String fromUser, String fromClientId, WFCMessage.Message message);
|
||||||
void storeSensitiveMessage(WFCMessage.Message message);
|
void storeSensitiveMessage(WFCMessage.Message message);
|
||||||
int getNotifyReceivers(String fromUser, WFCMessage.Message.Builder message, Set<String> notifyReceivers);
|
int getNotifyReceivers(String fromUser, WFCMessage.Message.Builder message, Set<String> notifyReceivers, ProtoConstants.RequestSourceType requestSourceType);
|
||||||
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);
|
||||||
@@ -210,6 +211,7 @@ public interface IMessagesStore {
|
|||||||
List<WFCMessage.ChannelInfo> searchChannel(String keyword, boolean buzzy, int page);
|
List<WFCMessage.ChannelInfo> searchChannel(String keyword, boolean buzzy, int page);
|
||||||
ErrorCode listenChannel(String operator, String channelId, boolean listen);
|
ErrorCode listenChannel(String operator, String channelId, boolean listen);
|
||||||
WFCMessage.ChannelInfo getChannelInfo(String channelId);
|
WFCMessage.ChannelInfo getChannelInfo(String channelId);
|
||||||
|
boolean canSendMessageInChannel(String user, String channelId);
|
||||||
boolean checkUserInChannel(String user, String channelId);
|
boolean checkUserInChannel(String user, String channelId);
|
||||||
Collection<String> getChannelSubscriber(String channelId);
|
Collection<String> getChannelSubscriber(String channelId);
|
||||||
|
|
||||||
|
|||||||
@@ -213,7 +213,9 @@ 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;
|
||||||
@@ -604,6 +606,12 @@ public class MessagesPublisher {
|
|||||||
Utility.printExecption(LOG, e, EVENT_CALLBACK_Exception);
|
Utility.printExecption(LOG, e, EVENT_CALLBACK_Exception);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
if (channelInfo == null) {
|
||||||
|
LOG.info("Channel {} not exist", message.getConversation().getTarget());
|
||||||
|
} else {
|
||||||
|
LOG.info("Channel {} callback {}", message.getConversation().getTarget(), channelInfo.getCallback());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
long messageId = message.getMessageId();
|
long messageId = message.getMessageId();
|
||||||
|
|||||||
@@ -622,14 +622,15 @@ public class ProtocolProcessor {
|
|||||||
if(session != null) {
|
if(session != null) {
|
||||||
session.refreshLastActiveTime();
|
session.refreshLastActiveTime();
|
||||||
forwardOnlineStatusEvent(username, clientID, session.getPlatform(), clearSession ? UserOnlineStatus.LOGOUT : UserOnlineStatus.OFFLINE, session.getAppName());
|
forwardOnlineStatusEvent(username, clientID, session.getPlatform(), clearSession ? UserOnlineStatus.LOGOUT : UserOnlineStatus.OFFLINE, session.getAppName());
|
||||||
m_messagesStore.updateUserOnlineSetting(session, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ConnectionDescriptor oldConnDescr = new ConnectionDescriptor(clientID, channel);
|
ConnectionDescriptor oldConnDescr = new ConnectionDescriptor(clientID, channel);
|
||||||
if(connectionDescriptors.removeConnection(oldConnDescr)) {
|
if(connectionDescriptors.removeConnection(oldConnDescr)) {
|
||||||
m_interceptor.notifyClientConnectionLost(clientID, username);
|
m_interceptor.notifyClientConnectionLost(clientID, username);
|
||||||
}
|
}
|
||||||
|
if(session != null) {
|
||||||
|
m_messagesStore.updateUserOnlineSetting(session, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -25,6 +25,28 @@ public class SensitiveFilter {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getUrlLength(String text, int i) {
|
||||||
|
boolean startUrl = false;
|
||||||
|
if(text.charAt(i) == 'h') {
|
||||||
|
if(text.length() > i + 6 && text.substring(i, i+7).equals("http://")) {
|
||||||
|
startUrl = true;
|
||||||
|
} else if(text.length() > i + 7 && text.substring(i, i+8).equals("https://")) {
|
||||||
|
startUrl = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(startUrl) {
|
||||||
|
for (int j = i+1; j < text.length(); j++) {
|
||||||
|
char ch = text.charAt(j);
|
||||||
|
if(ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t') {
|
||||||
|
return j-i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return text.length() - i - 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
public Set<String> getSensitiveWords(String text,MatchType matchType){
|
public Set<String> getSensitiveWords(String text,MatchType matchType){
|
||||||
Set<String> sensitiveWords=new HashSet<>();
|
Set<String> sensitiveWords=new HashSet<>();
|
||||||
if(text==null||text.trim().length()==0){
|
if(text==null||text.trim().length()==0){
|
||||||
@@ -34,6 +56,11 @@ public class SensitiveFilter {
|
|||||||
String originalText = text;
|
String originalText = text;
|
||||||
text = text.toLowerCase();
|
text = text.toLowerCase();
|
||||||
for(int i=0;i<text.length();i++){
|
for(int i=0;i<text.length();i++){
|
||||||
|
int urlLength = getUrlLength(text, i);
|
||||||
|
if(urlLength > 0) {
|
||||||
|
i = i + urlLength;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
int sensitiveWordLength = getSensitiveWordLength(text, i, matchType);
|
int sensitiveWordLength = getSensitiveWordLength(text, i, matchType);
|
||||||
if(sensitiveWordLength>0){
|
if(sensitiveWordLength>0){
|
||||||
String sensitiveWord = originalText.substring(i, i + sensitiveWordLength);
|
String sensitiveWord = originalText.substring(i, i + sensitiveWordLength);
|
||||||
@@ -117,5 +144,29 @@ public class SensitiveFilter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Set<String> words = new HashSet<>();
|
||||||
|
words.add("sb");
|
||||||
|
words.add("xx");
|
||||||
|
SensitiveFilter sensitiveFilter = new SensitiveFilter(words);
|
||||||
|
String text1 = "u sb a";
|
||||||
|
Set<String> ss = sensitiveFilter.getSensitiveWords(text1, MatchType.MIN_MATCH);
|
||||||
|
System.out.println(ss.size());
|
||||||
|
|
||||||
|
text1 = "u xx";
|
||||||
|
ss = sensitiveFilter.getSensitiveWords(text1, MatchType.MIN_MATCH);
|
||||||
|
System.out.println(ss.size());
|
||||||
|
|
||||||
|
text1 = "a url is https://sdsbhe.com here";
|
||||||
|
ss = sensitiveFilter.getSensitiveWords(text1, MatchType.MIN_MATCH);
|
||||||
|
System.out.println(ss.size());
|
||||||
|
|
||||||
|
text1 = "a url is https://sdsbhe.com";
|
||||||
|
ss = sensitiveFilter.getSensitiveWords(text1, MatchType.MIN_MATCH);
|
||||||
|
System.out.println(ss.size());
|
||||||
|
|
||||||
|
text1 = "a url is https://sdsbhe.com\nsb";
|
||||||
|
ss = sensitiveFilter.getSensitiveWords(text1, MatchType.MIN_MATCH);
|
||||||
|
System.out.println(ss.size());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,73 +0,0 @@
|
|||||||
# Set root logger level to DEBUG and its only appender to A1.
|
|
||||||
#log4j.rootLogger=ERROR, A1
|
|
||||||
#log4j.rootLogger=INFO, stdout, file
|
|
||||||
log4j.rootLogger=INFO, file, messagelog
|
|
||||||
|
|
||||||
log4j.logger.io.moquette=INFO
|
|
||||||
log4j.logger.io.moquette.spi.impl.ProtocolProcessor=INFO
|
|
||||||
log4j.logger.io.moquette.spi.impl.ProtocolProcessorBootstrapper=WARN
|
|
||||||
|
|
||||||
#Protocol parsing
|
|
||||||
log4j.logger.io.moquette.server.netty.NettyMQTTHandler=WARN
|
|
||||||
#log4j.logger.io.moquette.server.netty.NettyMQTTHandler=DEBUG
|
|
||||||
log4j.logger.io.moquette.parser.netty=WARN
|
|
||||||
#Storage server
|
|
||||||
#log4j.logger.io.moquette.spi.impl.subscriptions.SubscriptionsDirectorytory=DEBUG
|
|
||||||
#log4j.logger.io.moquette.spi.impl.HawtDBStorageService=DEBUG
|
|
||||||
|
|
||||||
# stdout appender is set to be a ConsoleAppender.
|
|
||||||
#log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
|
||||||
#log4j.appender.stdout.Threshold=WARN
|
|
||||||
#log4j.appender.stdout.Threshold=INFO
|
|
||||||
#log4j.appender.stdout.Threshold=DEBUG
|
|
||||||
#log4j.appender.stdout.Threshold=TRACE
|
|
||||||
#log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
|
||||||
#log4j.appender.stdout.layout.ConversionPattern=%-4r [%t] %-5p %c{1} %x - %m%n
|
|
||||||
|
|
||||||
#file appender
|
|
||||||
log4j.appender.file=org.apache.log4j.RollingFileAppender
|
|
||||||
log4j.appender.file.Threshold=INFO
|
|
||||||
log4j.appender.file.File=logs/wildfirechat.log
|
|
||||||
log4j.appender.file.MaxFileSize=10MB
|
|
||||||
log4j.appender.file.MaxBackupIndex=20
|
|
||||||
log4j.appender.file.layout=org.apache.log4j.PatternLayout
|
|
||||||
#log4j.appender.file.layout.ConversionPattern=%-4r [%t] %-5p %c{1} %x - %m%n
|
|
||||||
log4j.appender.file.layout.ConversionPattern=%d{dd/MM/yyyy HH:mm:ss,SSS} [%t] %-5p %c{1} %L %x - %m%n
|
|
||||||
|
|
||||||
####################################
|
|
||||||
# Message Logger Configuration #
|
|
||||||
#####################################
|
|
||||||
log4j.appender.messagelog=org.apache.log4j.RollingFileAppender
|
|
||||||
log4j.appender.messagelog.Threshold=WARN
|
|
||||||
log4j.appender.messagelog.File=logs/wildfirechat_messages.log
|
|
||||||
log4j.appender.messagelog.MaxFileSize=100MB
|
|
||||||
log4j.appender.messagelog.MaxBackupIndex=1
|
|
||||||
log4j.appender.messagelog.layout=org.apache.log4j.PatternLayout
|
|
||||||
log4j.appender.messagelog.layout.ConversionPattern=%d{dd/MM/yyyy HH:mm:ss,SSS} [%t] %-5p %c{1} %L %x - %m%n
|
|
||||||
|
|
||||||
log4j.category.messageLogger=WARN, messagelog
|
|
||||||
|
|
||||||
|
|
||||||
log4j.logger.cn.wildfirechat.push=INFO, push_log
|
|
||||||
log4j.additivity.cn.wildfirechat.push=false
|
|
||||||
log4j.appender.push_log=org.apache.log4j.RollingFileAppender
|
|
||||||
log4j.appender.push_log.File=logs/push.log
|
|
||||||
log4j.appender.push_log.Append=true
|
|
||||||
log4j.appender.push_log.MaxFileSize=10MB
|
|
||||||
log4j.appender.push_log.MaxBackupIndex=5
|
|
||||||
log4j.appender.push_log.layout=org.apache.log4j.PatternLayout
|
|
||||||
log4j.appender.push_log.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%-5p][%c{1}] [%t] - %m%n
|
|
||||||
log4j.appender.push_log.encoding=UTF-8
|
|
||||||
|
|
||||||
|
|
||||||
log4j.logger.com.xiaoleilu.loServer=INFO, http_log
|
|
||||||
log4j.additivity.com.xiaoleilu.loServer=false
|
|
||||||
log4j.appender.http_log=org.apache.log4j.RollingFileAppender
|
|
||||||
log4j.appender.http_log.File=logs/http.log
|
|
||||||
log4j.appender.http_log.Append=true
|
|
||||||
log4j.appender.http_log.MaxFileSize=10MB
|
|
||||||
log4j.appender.http_log.MaxBackupIndex=5
|
|
||||||
log4j.appender.http_log.layout=org.apache.log4j.PatternLayout
|
|
||||||
log4j.appender.http_log.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%-5p][%c{1}] [%t] - %m%n
|
|
||||||
log4j.appender.http_log.encoding=UTF-8
|
|
||||||
|
|
||||||
Executable
+108
@@ -0,0 +1,108 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--日志级别以及优先级排序: OFF > FATAL > ERROR > WARN > INFO > DEBUG > TRACE > ALL -->
|
||||||
|
<!--status="WARN" :用于设置log4j2自身内部日志的信息输出级别,默认是OFF-->
|
||||||
|
<!--monitorInterval="30" :间隔秒数,自动检测配置文件的变更和重新配置本身-->
|
||||||
|
<configuration status="WARN" monitorInterval="60">
|
||||||
|
<Properties>
|
||||||
|
<!--自定义一些常量,之后使用${变量名}引用-->
|
||||||
|
<Property name="MSG_LOG_HOME">./logs</Property>
|
||||||
|
<Property name="logFileName">test.log</Property>
|
||||||
|
<property name="charset">UTF-8</property>
|
||||||
|
<!--自定义的输出格式-->
|
||||||
|
<property name="pattern">%d %-5p [%t] %C{2} (%F:%L) - %m%n</property>
|
||||||
|
</Properties>
|
||||||
|
<!--appenders:定义输出内容,输出格式,输出方式,日志保存策略等,常用其下三种标签[console,File,RollingFile]-->
|
||||||
|
<appenders>
|
||||||
|
<!--console :控制台输出的配置-->
|
||||||
|
<console name="Console" target="SYSTEM_OUT">
|
||||||
|
<!--PatternLayout :输出日志的格式,LOG4J2定义了输出代码,详见第二部分-->
|
||||||
|
<PatternLayout pattern="[%d{HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
|
||||||
|
</console>
|
||||||
|
|
||||||
|
<RollingRandomAccessFile name="RollingFileInfo" immediateFlush="false"
|
||||||
|
fileName="${MSG_LOG_HOME}/wildfirechat.log"
|
||||||
|
filePattern="${MSG_LOG_HOME}/backup/wildfirechat.%d{yyyyMMddHH}.zip">
|
||||||
|
<Filters>
|
||||||
|
<ThresholdFilter level="INFO" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
|
</Filters>
|
||||||
|
<PatternLayout pattern="${pattern}" />
|
||||||
|
<Policies>
|
||||||
|
<!-- TimeBasedTriggeringPolicy :时间滚动策略,默认0点小时产生新的文件,interval="6" : 自定义文件滚动时间间隔,每隔6小时产生新文件, modulate="true" : 产生文件是否以0点偏移时间,即6点,12点,18点,0点-->
|
||||||
|
<!-- <TimeBasedTriggeringPolicy interval="6" modulate="true"/>-->
|
||||||
|
<!-- SizeBasedTriggeringPolicy :文件大小滚动策略-->
|
||||||
|
<SizeBasedTriggeringPolicy size="100 MB"/>
|
||||||
|
</Policies>
|
||||||
|
|
||||||
|
<DefaultRolloverStrategy max="24">
|
||||||
|
<Delete basePath="${MSG_LOG_HOME}" maxDepth="2">
|
||||||
|
<IfFileName glob="*/wildfirechat.*.zip" />
|
||||||
|
<IfLastModified age="24H" />
|
||||||
|
</Delete>
|
||||||
|
</DefaultRolloverStrategy>
|
||||||
|
</RollingRandomAccessFile>
|
||||||
|
|
||||||
|
<RollingRandomAccessFile name="RollingFileWarn" immediateFlush="true"
|
||||||
|
fileName="${MSG_LOG_HOME}/wildfirechat_warn.log"
|
||||||
|
filePattern="${MSG_LOG_HOME}/backup/wildfirechat_warn.%d{yyyyMMddHH}.zip">
|
||||||
|
<Filters>
|
||||||
|
<ThresholdFilter level="WARN" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
|
</Filters>
|
||||||
|
<PatternLayout pattern="${pattern}" />
|
||||||
|
<Policies>
|
||||||
|
<!-- TimeBasedTriggeringPolicy :时间滚动策略,默认0点小时产生新的文件,interval="6" : 自定义文件滚动时间间隔,每隔6小时产生新文件, modulate="true" : 产生文件是否以0点偏移时间,即6点,12点,18点,0点-->
|
||||||
|
<TimeBasedTriggeringPolicy interval="6" modulate="true"/>
|
||||||
|
<!-- SizeBasedTriggeringPolicy :文件大小滚动策略-->
|
||||||
|
<SizeBasedTriggeringPolicy size="100 MB"/>
|
||||||
|
</Policies>
|
||||||
|
|
||||||
|
<DefaultRolloverStrategy max="24">
|
||||||
|
<Delete basePath="${MSG_LOG_HOME}" maxDepth="2">
|
||||||
|
<IfFileName glob="*/wildfirechat_warn.*.zip" />
|
||||||
|
<IfLastModified age="24H" />
|
||||||
|
</Delete>
|
||||||
|
</DefaultRolloverStrategy>
|
||||||
|
</RollingRandomAccessFile>
|
||||||
|
|
||||||
|
<RollingRandomAccessFile name="RollingFileError" immediateFlush="true"
|
||||||
|
fileName="${MSG_LOG_HOME}/wildfirechat_error.log"
|
||||||
|
filePattern="${MSG_LOG_HOME}/backup/wildfirechat_error.%d{yyyyMMddHH}.zip">
|
||||||
|
<Filters>
|
||||||
|
<ThresholdFilter level="ERROR" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
|
</Filters>
|
||||||
|
<PatternLayout pattern="${pattern}" />
|
||||||
|
<Policies>
|
||||||
|
<!-- TimeBasedTriggeringPolicy :时间滚动策略,默认0点小时产生新的文件,interval="6" : 自定义文件滚动时间间隔,每隔6小时产生新文件, modulate="true" : 产生文件是否以0点偏移时间,即6点,12点,18点,0点-->
|
||||||
|
<TimeBasedTriggeringPolicy interval="6" modulate="true"/>
|
||||||
|
<!-- SizeBasedTriggeringPolicy :文件大小滚动策略-->
|
||||||
|
<SizeBasedTriggeringPolicy size="100 MB"/>
|
||||||
|
</Policies>
|
||||||
|
|
||||||
|
<DefaultRolloverStrategy max="24">
|
||||||
|
<Delete basePath="${MSG_LOG_HOME}" maxDepth="2">
|
||||||
|
<IfFileName glob="*/wildfirechat_error.*.zip" />
|
||||||
|
<IfLastModified age="24H" />
|
||||||
|
</Delete>
|
||||||
|
</DefaultRolloverStrategy>
|
||||||
|
</RollingRandomAccessFile>
|
||||||
|
</appenders>
|
||||||
|
|
||||||
|
<!--然后定义logger,只有定义了logger并引入的appender,appender才会生效-->
|
||||||
|
<loggers>
|
||||||
|
<!--过滤掉spring和mybatis的一些无用的DEBUG信息-->
|
||||||
|
<!--Logger节点用来单独指定日志的形式,name为包路径,比如要为org.springframework包下所有日志指定为INFO级别等。 -->
|
||||||
|
<!-- <logger name="org.springframework" level="INFO"></logger>-->
|
||||||
|
<!-- <logger name="org.mybatis" level="INFO"></logger>-->
|
||||||
|
<!-- Root节点用来指定项目的根日志,如果没有单独指定Logger,那么就会默认使用该Root日志输出 -->
|
||||||
|
<root level="INFO">
|
||||||
|
<appender-ref ref="Console"/>
|
||||||
|
<appender-ref ref="RollingFileInfo"/>
|
||||||
|
<appender-ref ref="RollingFileWarn"/>
|
||||||
|
<appender-ref ref="RollingFileError"/>
|
||||||
|
</root>
|
||||||
|
<!--AsyncLogger :异步日志,LOG4J有三种日志模式,全异步日志,混合模式,同步日志,性能从高到底,线程越多效率越高,也可以避免日志卡死线程情况发生-->
|
||||||
|
<!--additivity="false" : additivity设置事件是否在root logger输出,为了避免重复输出,可以在Logger 标签下设置additivity为”false”-->
|
||||||
|
<AsyncLogger name="AsyncLogger" level="trace" includeLocation="true" additivity="false">
|
||||||
|
<appender-ref ref="RollingFileInfo"/>
|
||||||
|
</AsyncLogger>
|
||||||
|
</loggers>
|
||||||
|
</configuration>
|
||||||
+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.78</version>
|
<version>0.80</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ public enum ErrorCode {
|
|||||||
ERROR_CODE_WS_NOT_CONFIGURED_CORRECTLY(28, "ws not configured correctly"),
|
ERROR_CODE_WS_NOT_CONFIGURED_CORRECTLY(28, "ws not configured correctly"),
|
||||||
ERROR_CODE_CONFERENCE_ROOM_NOT_EXIST(60, "conference room not exist"),
|
ERROR_CODE_CONFERENCE_ROOM_NOT_EXIST(60, "conference room not exist"),
|
||||||
|
|
||||||
|
ERROR_CODE_CHANNEL_NO_EXIST(236, "channel no exist"),
|
||||||
ERROR_CODE_CHANNEL_NO_SECRET(237, "channel no secret"),
|
ERROR_CODE_CHANNEL_NO_SECRET(237, "channel no secret"),
|
||||||
ERROR_CODE_USER_NOT_PREPARED(238, "user not prepared"),
|
ERROR_CODE_USER_NOT_PREPARED(238, "user not prepared"),
|
||||||
ERROR_CODE_API_NOT_SIGNED(239, "api not signed or sign parameter not completion"),
|
ERROR_CODE_API_NOT_SIGNED(239, "api not signed or sign parameter not completion"),
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ public class PojoGroupMember {
|
|||||||
String alias;
|
String alias;
|
||||||
int type;
|
int type;
|
||||||
String extra;
|
String extra;
|
||||||
|
long createDt;
|
||||||
|
|
||||||
public String getMember_id() {
|
public String getMember_id() {
|
||||||
return member_id;
|
return member_id;
|
||||||
@@ -45,4 +46,12 @@ public class PojoGroupMember {
|
|||||||
public void setExtra(String extra) {
|
public void setExtra(String extra) {
|
||||||
this.extra = extra;
|
this.extra = extra;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getCreateDt() {
|
||||||
|
return createDt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateDt(long createDt) {
|
||||||
|
this.createDt = createDt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ public class ProtoConstants {
|
|||||||
int Platform_WEB = 5;
|
int Platform_WEB = 5;
|
||||||
int Platform_WX = 6;
|
int Platform_WX = 6;
|
||||||
int Platform_LINUX = 7;
|
int Platform_LINUX = 7;
|
||||||
|
int Platform_iPad = 8;
|
||||||
|
int Platform_APad = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
//message NotifyMessage & PullMessageRequest -> type
|
//message NotifyMessage & PullMessageRequest -> type
|
||||||
|
|||||||
@@ -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.78</version>
|
<version>0.80</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>distribution</artifactId>
|
<artifactId>distribution</artifactId>
|
||||||
|
|||||||
@@ -40,9 +40,9 @@
|
|||||||
</file>
|
</file>
|
||||||
|
|
||||||
<file>
|
<file>
|
||||||
<source>src/main/resources/log4j.properties</source>
|
<source>src/main/resources/log4j2.xml</source>
|
||||||
<outputDirectory>config/</outputDirectory>
|
<outputDirectory>config/</outputDirectory>
|
||||||
<destName>log4j.properties</destName>
|
<destName>log4j2.xml</destName>
|
||||||
</file>
|
</file>
|
||||||
|
|
||||||
<file>
|
<file>
|
||||||
|
|||||||
@@ -1,73 +0,0 @@
|
|||||||
# Set root logger level to DEBUG and its only appender to A1.
|
|
||||||
#log4j.rootLogger=ERROR, A1
|
|
||||||
#log4j.rootLogger=INFO, stdout, file
|
|
||||||
log4j.rootLogger=INFO, file, messagelog
|
|
||||||
|
|
||||||
log4j.logger.io.moquette=INFO
|
|
||||||
log4j.logger.io.moquette.spi.impl.ProtocolProcessor=INFO
|
|
||||||
log4j.logger.io.moquette.spi.impl.ProtocolProcessorBootstrapper=WARN
|
|
||||||
|
|
||||||
#Protocol parsing
|
|
||||||
log4j.logger.io.moquette.server.netty.NettyMQTTHandler=WARN
|
|
||||||
#log4j.logger.io.moquette.server.netty.NettyMQTTHandler=DEBUG
|
|
||||||
log4j.logger.io.moquette.parser.netty=WARN
|
|
||||||
#Storage server
|
|
||||||
#log4j.logger.io.moquette.spi.impl.subscriptions.SubscriptionsDirectorytory=DEBUG
|
|
||||||
#log4j.logger.io.moquette.spi.impl.HawtDBStorageService=DEBUG
|
|
||||||
|
|
||||||
# stdout appender is set to be a ConsoleAppender.
|
|
||||||
#log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
|
||||||
#log4j.appender.stdout.Threshold=WARN
|
|
||||||
#log4j.appender.stdout.Threshold=INFO
|
|
||||||
#log4j.appender.stdout.Threshold=DEBUG
|
|
||||||
#log4j.appender.stdout.Threshold=TRACE
|
|
||||||
#log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
|
||||||
#log4j.appender.stdout.layout.ConversionPattern=%-4r [%t] %-5p %c{1} %x - %m%n
|
|
||||||
|
|
||||||
#file appender
|
|
||||||
log4j.appender.file=org.apache.log4j.RollingFileAppender
|
|
||||||
log4j.appender.file.Threshold=INFO
|
|
||||||
log4j.appender.file.File=logs/wildfirechat.log
|
|
||||||
log4j.appender.file.MaxFileSize=20MB
|
|
||||||
log4j.appender.file.MaxBackupIndex=100
|
|
||||||
log4j.appender.file.layout=org.apache.log4j.PatternLayout
|
|
||||||
#log4j.appender.file.layout.ConversionPattern=%-4r [%t] %-5p %c{1} %x - %m%n
|
|
||||||
log4j.appender.file.layout.ConversionPattern=%d{dd/MM/yyyy HH:mm:ss,SSS} [%t] %-5p %c{1} %L %x - %m%n
|
|
||||||
|
|
||||||
####################################
|
|
||||||
# Message Logger Configuration #
|
|
||||||
#####################################
|
|
||||||
log4j.appender.messagelog=org.apache.log4j.RollingFileAppender
|
|
||||||
log4j.appender.messagelog.Threshold=WARN
|
|
||||||
log4j.appender.messagelog.File=logs/wildfirechat_messages.log
|
|
||||||
log4j.appender.messagelog.MaxFileSize=100MB
|
|
||||||
log4j.appender.messagelog.MaxBackupIndex=3
|
|
||||||
log4j.appender.messagelog.layout=org.apache.log4j.PatternLayout
|
|
||||||
log4j.appender.messagelog.layout.ConversionPattern=%d{dd/MM/yyyy HH:mm:ss,SSS} [%t] %-5p %c{1} %L %x - %m%n
|
|
||||||
|
|
||||||
log4j.category.messageLogger=WARN, messagelog
|
|
||||||
|
|
||||||
|
|
||||||
log4j.logger.cn.wildfirechat.push=INFO, push_log
|
|
||||||
log4j.additivity.cn.wildfirechat.push=false
|
|
||||||
log4j.appender.push_log=org.apache.log4j.RollingFileAppender
|
|
||||||
log4j.appender.push_log.File=logs/push.log
|
|
||||||
log4j.appender.push_log.Append=true
|
|
||||||
log4j.appender.push_log.MaxFileSize=10MB
|
|
||||||
log4j.appender.push_log.MaxBackupIndex=5
|
|
||||||
log4j.appender.push_log.layout=org.apache.log4j.PatternLayout
|
|
||||||
log4j.appender.push_log.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%-5p][%c{1}] [%t] - %m%n
|
|
||||||
log4j.appender.push_log.encoding=UTF-8
|
|
||||||
|
|
||||||
|
|
||||||
log4j.logger.com.xiaoleilu.loServer=INFO, http_log
|
|
||||||
log4j.additivity.com.xiaoleilu.loServer=false
|
|
||||||
log4j.appender.http_log=org.apache.log4j.RollingFileAppender
|
|
||||||
log4j.appender.http_log.File=logs/http.log
|
|
||||||
log4j.appender.http_log.Append=true
|
|
||||||
log4j.appender.http_log.MaxFileSize=10MB
|
|
||||||
log4j.appender.http_log.MaxBackupIndex=5
|
|
||||||
log4j.appender.http_log.layout=org.apache.log4j.PatternLayout
|
|
||||||
log4j.appender.http_log.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%-5p][%c{1}] [%t] - %m%n
|
|
||||||
log4j.appender.http_log.encoding=UTF-8
|
|
||||||
|
|
||||||
Executable
+108
@@ -0,0 +1,108 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--日志级别以及优先级排序: OFF > FATAL > ERROR > WARN > INFO > DEBUG > TRACE > ALL -->
|
||||||
|
<!--status="WARN" :用于设置log4j2自身内部日志的信息输出级别,默认是OFF-->
|
||||||
|
<!--monitorInterval="30" :间隔秒数,自动检测配置文件的变更和重新配置本身-->
|
||||||
|
<configuration status="WARN" monitorInterval="60">
|
||||||
|
<Properties>
|
||||||
|
<!--自定义一些常量,之后使用${变量名}引用-->
|
||||||
|
<Property name="MSG_LOG_HOME">./logs</Property>
|
||||||
|
<Property name="logFileName">test.log</Property>
|
||||||
|
<property name="charset">UTF-8</property>
|
||||||
|
<!--自定义的输出格式-->
|
||||||
|
<property name="pattern">%d %-5p [%t] %C{2} (%F:%L) - %m%n</property>
|
||||||
|
</Properties>
|
||||||
|
<!--appenders:定义输出内容,输出格式,输出方式,日志保存策略等,常用其下三种标签[console,File,RollingFile]-->
|
||||||
|
<appenders>
|
||||||
|
<!--console :控制台输出的配置-->
|
||||||
|
<console name="Console" target="SYSTEM_OUT">
|
||||||
|
<!--PatternLayout :输出日志的格式,LOG4J2定义了输出代码,详见第二部分-->
|
||||||
|
<PatternLayout pattern="[%d{HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
|
||||||
|
</console>
|
||||||
|
|
||||||
|
<RollingRandomAccessFile name="RollingFileInfo" immediateFlush="false"
|
||||||
|
fileName="${MSG_LOG_HOME}/wildfirechat.log"
|
||||||
|
filePattern="${MSG_LOG_HOME}/backup/wildfirechat.%d{yyyyMMddHH}.zip">
|
||||||
|
<Filters>
|
||||||
|
<ThresholdFilter level="INFO" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
|
</Filters>
|
||||||
|
<PatternLayout pattern="${pattern}" />
|
||||||
|
<Policies>
|
||||||
|
<!-- TimeBasedTriggeringPolicy :时间滚动策略,默认0点小时产生新的文件,interval="6" : 自定义文件滚动时间间隔,每隔6小时产生新文件, modulate="true" : 产生文件是否以0点偏移时间,即6点,12点,18点,0点-->
|
||||||
|
<!-- <TimeBasedTriggeringPolicy interval="6" modulate="true"/>-->
|
||||||
|
<!-- SizeBasedTriggeringPolicy :文件大小滚动策略-->
|
||||||
|
<SizeBasedTriggeringPolicy size="100 MB"/>
|
||||||
|
</Policies>
|
||||||
|
|
||||||
|
<DefaultRolloverStrategy max="24">
|
||||||
|
<Delete basePath="${MSG_LOG_HOME}" maxDepth="2">
|
||||||
|
<IfFileName glob="*/wildfirechat.*.zip" />
|
||||||
|
<IfLastModified age="24H" />
|
||||||
|
</Delete>
|
||||||
|
</DefaultRolloverStrategy>
|
||||||
|
</RollingRandomAccessFile>
|
||||||
|
|
||||||
|
<RollingRandomAccessFile name="RollingFileWarn" immediateFlush="true"
|
||||||
|
fileName="${MSG_LOG_HOME}/wildfirechat_warn.log"
|
||||||
|
filePattern="${MSG_LOG_HOME}/backup/wildfirechat_warn.%d{yyyyMMddHH}.zip">
|
||||||
|
<Filters>
|
||||||
|
<ThresholdFilter level="WARN" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
|
</Filters>
|
||||||
|
<PatternLayout pattern="${pattern}" />
|
||||||
|
<Policies>
|
||||||
|
<!-- TimeBasedTriggeringPolicy :时间滚动策略,默认0点小时产生新的文件,interval="6" : 自定义文件滚动时间间隔,每隔6小时产生新文件, modulate="true" : 产生文件是否以0点偏移时间,即6点,12点,18点,0点-->
|
||||||
|
<TimeBasedTriggeringPolicy interval="6" modulate="true"/>
|
||||||
|
<!-- SizeBasedTriggeringPolicy :文件大小滚动策略-->
|
||||||
|
<SizeBasedTriggeringPolicy size="100 MB"/>
|
||||||
|
</Policies>
|
||||||
|
|
||||||
|
<DefaultRolloverStrategy max="24">
|
||||||
|
<Delete basePath="${MSG_LOG_HOME}" maxDepth="2">
|
||||||
|
<IfFileName glob="*/wildfirechat_warn.*.zip" />
|
||||||
|
<IfLastModified age="24H" />
|
||||||
|
</Delete>
|
||||||
|
</DefaultRolloverStrategy>
|
||||||
|
</RollingRandomAccessFile>
|
||||||
|
|
||||||
|
<RollingRandomAccessFile name="RollingFileError" immediateFlush="true"
|
||||||
|
fileName="${MSG_LOG_HOME}/wildfirechat_error.log"
|
||||||
|
filePattern="${MSG_LOG_HOME}/backup/wildfirechat_error.%d{yyyyMMddHH}.zip">
|
||||||
|
<Filters>
|
||||||
|
<ThresholdFilter level="ERROR" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
|
</Filters>
|
||||||
|
<PatternLayout pattern="${pattern}" />
|
||||||
|
<Policies>
|
||||||
|
<!-- TimeBasedTriggeringPolicy :时间滚动策略,默认0点小时产生新的文件,interval="6" : 自定义文件滚动时间间隔,每隔6小时产生新文件, modulate="true" : 产生文件是否以0点偏移时间,即6点,12点,18点,0点-->
|
||||||
|
<TimeBasedTriggeringPolicy interval="6" modulate="true"/>
|
||||||
|
<!-- SizeBasedTriggeringPolicy :文件大小滚动策略-->
|
||||||
|
<SizeBasedTriggeringPolicy size="100 MB"/>
|
||||||
|
</Policies>
|
||||||
|
|
||||||
|
<DefaultRolloverStrategy max="24">
|
||||||
|
<Delete basePath="${MSG_LOG_HOME}" maxDepth="2">
|
||||||
|
<IfFileName glob="*/wildfirechat_error.*.zip" />
|
||||||
|
<IfLastModified age="24H" />
|
||||||
|
</Delete>
|
||||||
|
</DefaultRolloverStrategy>
|
||||||
|
</RollingRandomAccessFile>
|
||||||
|
</appenders>
|
||||||
|
|
||||||
|
<!--然后定义logger,只有定义了logger并引入的appender,appender才会生效-->
|
||||||
|
<loggers>
|
||||||
|
<!--过滤掉spring和mybatis的一些无用的DEBUG信息-->
|
||||||
|
<!--Logger节点用来单独指定日志的形式,name为包路径,比如要为org.springframework包下所有日志指定为INFO级别等。 -->
|
||||||
|
<!-- <logger name="org.springframework" level="INFO"></logger>-->
|
||||||
|
<!-- <logger name="org.mybatis" level="INFO"></logger>-->
|
||||||
|
<!-- Root节点用来指定项目的根日志,如果没有单独指定Logger,那么就会默认使用该Root日志输出 -->
|
||||||
|
<root level="INFO">
|
||||||
|
<!-- <appender-ref ref="Console"/>-->
|
||||||
|
<appender-ref ref="RollingFileInfo"/>
|
||||||
|
<appender-ref ref="RollingFileWarn"/>
|
||||||
|
<appender-ref ref="RollingFileError"/>
|
||||||
|
</root>
|
||||||
|
<!--AsyncLogger :异步日志,LOG4J有三种日志模式,全异步日志,混合模式,同步日志,性能从高到底,线程越多效率越高,也可以避免日志卡死线程情况发生-->
|
||||||
|
<!--additivity="false" : additivity设置事件是否在root logger输出,为了避免重复输出,可以在Logger 标签下设置additivity为”false”-->
|
||||||
|
<AsyncLogger name="AsyncLogger" level="trace" includeLocation="true" additivity="false">
|
||||||
|
<appender-ref ref="RollingFileInfo"/>
|
||||||
|
</AsyncLogger>
|
||||||
|
</loggers>
|
||||||
|
</configuration>
|
||||||
@@ -28,7 +28,8 @@ host 0.0.0.0
|
|||||||
##本地绑定端口
|
##本地绑定端口
|
||||||
local_port 80
|
local_port 80
|
||||||
|
|
||||||
##是否使用内置DB。0使用mysql;1使用h2db。
|
## 是否使用内置DB。0使用mysql;1使用h2db。
|
||||||
|
## MySQL需要把事物隔离级别改成"Read committed",使用命令来修改"set global transaction_isolation='read-committed';",其他数据库默认已经是这个级别不用修改
|
||||||
embed.db 1
|
embed.db 1
|
||||||
|
|
||||||
## 是否自动清理历史消息记录,当为true时,IM服务会定时扫描t_messages_x和t_user_messages_x表,清除掉3年前的历史消息。
|
## 是否自动清理历史消息记录,当为true时,IM服务会定时扫描t_messages_x和t_user_messages_x表,清除掉3年前的历史消息。
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ goto end
|
|||||||
rem Set JavaHome if it exists
|
rem Set JavaHome if it exists
|
||||||
if exist { "%JAVA_HOME%\bin\java" } (
|
if exist { "%JAVA_HOME%\bin\java" } (
|
||||||
set "JAVA="%JAVA_HOME%\bin\java""
|
set "JAVA="%JAVA_HOME%\bin\java""
|
||||||
) else (
|
) else {
|
||||||
set "JAVA="java""
|
set "JAVA="java""
|
||||||
)
|
}
|
||||||
|
|
||||||
echo Using JAVA_HOME: "%JAVA_HOME%"
|
echo Using JAVA_HOME: "%JAVA_HOME%"
|
||||||
echo Using WILDFIRECHAT_HOME: "%WILDFIRECHAT_HOME%"
|
echo Using WILDFIRECHAT_HOME: "%WILDFIRECHAT_HOME%"
|
||||||
@@ -28,7 +28,7 @@ rem set LOG_FILE_LEVEL=fine
|
|||||||
set JAVA_OPTS=
|
set JAVA_OPTS=
|
||||||
set JAVA_OPTS_SCRIPT=-XX:+HeapDumpOnOutOfMemoryError -Djava.awt.headless=true
|
set JAVA_OPTS_SCRIPT=-XX:+HeapDumpOnOutOfMemoryError -Djava.awt.headless=true
|
||||||
set WILDFIRECHAT_PATH=%WILDFIRECHAT_HOME%
|
set WILDFIRECHAT_PATH=%WILDFIRECHAT_HOME%
|
||||||
set LOG_FILE=%WILDFIRECHAT_HOME%\config\log4j.properties
|
set LOG_FILE=%WILDFIRECHAT_HOME%\config\log4j2.xml
|
||||||
set HZ_CONF_FILE=%WILDFIRECHAT_HOME%\config\hazelcast.xml
|
set HZ_CONF_FILE=%WILDFIRECHAT_HOME%\config\hazelcast.xml
|
||||||
set C3P0_CONF_FILE=%WILDFIRECHAT_HOME%\config\c3p0-config.xml
|
set C3P0_CONF_FILE=%WILDFIRECHAT_HOME%\config\c3p0-config.xml
|
||||||
|
|
||||||
@@ -72,8 +72,11 @@ rem set JAVA_OPTS=%JAVA_OPTS% -XX:+UseGCLogFileRotation
|
|||||||
rem set JAVA_OPTS=%JAVA_OPTS% -XX:NumberOfGCLogFiles=10
|
rem set JAVA_OPTS=%JAVA_OPTS% -XX:NumberOfGCLogFiles=10
|
||||||
rem set JAVA_OPTS=%JAVA_OPTS% -XX:GCLogFileSize=10M"
|
rem set JAVA_OPTS=%JAVA_OPTS% -XX:GCLogFileSize=10M"
|
||||||
|
|
||||||
|
echo
|
||||||
echo 请设置JVM参数Xmx和Xms!!!
|
echo 请设置JVM参数Xmx和Xms!!!
|
||||||
|
echo
|
||||||
|
|
||||||
rem set JAVA_OPTS=%JAVA_OPTS% -Xmx2G
|
rem set JAVA_OPTS=%JAVA_OPTS% -Xmx2G
|
||||||
rem set JAVA_OPTS=%JAVA_OPTS% -Xms2G
|
rem set JAVA_OPTS=%JAVA_OPTS% -Xms2G
|
||||||
|
|
||||||
%JAVA% -server %JAVA_OPTS% %JAVA_OPTS_SCRIPT% -Dlog4j.configuration=file:%LOG_FILE% -Dcom.mchange.v2.c3p0.cfg.xml=%C3P0_CONF_FILE% -Dhazelcast.configuration=file:%HZ_CONF_FILE% -Dwildfirechat.path=%WILDFIRECHAT_PATH% -cp %WILDFIRECHAT_HOME%\lib\* cn.wildfirechat.server.Server
|
%JAVA% -server %JAVA_OPTS% %JAVA_OPTS_SCRIPT% -Dlog4j.configurationFile=%LOG_FILE% -Dcom.mchange.v2.c3p0.cfg.xml=%C3P0_CONF_FILE% -Dhazelcast.configuration=file:%HZ_CONF_FILE% -Dwildfirechat.path=%WILDFIRECHAT_PATH% -cp %WILDFIRECHAT_HOME%\lib\* cn.wildfirechat.server.Server
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ else
|
|||||||
fi
|
fi
|
||||||
export JAVA
|
export JAVA
|
||||||
|
|
||||||
LOG_FILE=$WILDFIRECHAT_HOME/config/log4j.properties
|
LOG_FILE=$WILDFIRECHAT_HOME/config/log4j2.xml
|
||||||
HZ_CONF_FILE=$WILDFIRECHAT_HOME/config/hazelcast.xml
|
HZ_CONF_FILE=$WILDFIRECHAT_HOME/config/hazelcast.xml
|
||||||
C3P0_CONF_FILE=$WILDFIRECHAT_HOME/config/c3p0-config.xml
|
C3P0_CONF_FILE=$WILDFIRECHAT_HOME/config/c3p0-config.xml
|
||||||
|
|
||||||
@@ -83,11 +83,12 @@ JAVA_OPTS="$JAVA_OPTS -XX:MaxGCPauseMillis=500"
|
|||||||
#JAVA_OPTS="$JAVA_OPTS -XX:NumberOfGCLogFiles=10"
|
#JAVA_OPTS="$JAVA_OPTS -XX:NumberOfGCLogFiles=10"
|
||||||
#JAVA_OPTS="$JAVA_OPTS -XX:GCLogFileSize=10M"
|
#JAVA_OPTS="$JAVA_OPTS -XX:GCLogFileSize=10M"
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "请设置JVM参数Xmx和Xms!!!"
|
echo "警告:没有设置JVM内存参数!"
|
||||||
|
echo "请设置JVM参数Xmx和Xms,设置为您为IM服务预留的内存大小,注意需要刨除操作系统占用,如果有其它系统也需要相应去除占用。"
|
||||||
echo ""
|
echo ""
|
||||||
#JAVA_OPTS="$JAVA_OPTS -Xmx2G"
|
#JAVA_OPTS="$JAVA_OPTS -Xmx2G"
|
||||||
#JAVA_OPTS="$JAVA_OPTS -Xms2G"
|
#JAVA_OPTS="$JAVA_OPTS -Xms2G"
|
||||||
|
|
||||||
|
|
||||||
$JAVA -server $JAVA_OPTS $JAVA_OPTS_SCRIPT -Dlog4j.configuration="file:$LOG_FILE" -Dcom.mchange.v2.c3p0.cfg.xml="$C3P0_CONF_FILE" -Dhazelcast.configuration="file:$HZ_CONF_FILE" -Dwildfirechat.path="$WILDFIRECHAT_PATH" -cp "$WILDFIRECHAT_HOME/lib/*" cn.wildfirechat.server.Server
|
$JAVA -server $JAVA_OPTS $JAVA_OPTS_SCRIPT -Dlog4j.configurationFile="file:$LOG_FILE" -Dlog4j2.formatMsgNoLookups=true -Dcom.mchange.v2.c3p0.cfg.xml="$C3P0_CONF_FILE" -Dhazelcast.configuration="file:$HZ_CONF_FILE" -Dwildfirechat.path="$WILDFIRECHAT_PATH" -cp "$WILDFIRECHAT_HOME/lib/*" cn.wildfirechat.server.Server
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<artifactId>wildfirechat-parent</artifactId>
|
<artifactId>wildfirechat-parent</artifactId>
|
||||||
|
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<version>0.78</version>
|
<version>0.80</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.78</version>
|
<version>0.80</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user