Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1434dafd36 | ||
|
|
0d8a6e64ea | ||
|
|
d96c201aec | ||
|
|
d901707691 | ||
|
|
f456a4cc65 | ||
|
|
c4bd706272 | ||
|
|
503768c04b | ||
|
|
7ca3abe12d | ||
|
|
cb09026408 | ||
|
|
fab381a351 |
@@ -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年前的历史消息。
|
||||||
|
|||||||
+4
-4
@@ -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.79</version>
|
<version>0.80</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>moquette-broker</artifactId>
|
<artifactId>moquette-broker</artifactId>
|
||||||
@@ -27,18 +27,18 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
<artifactId>log4j-core</artifactId>
|
<artifactId>log4j-core</artifactId>
|
||||||
<version>2.17.0</version>
|
<version>2.17.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
<artifactId>log4j-api</artifactId>
|
<artifactId>log4j-api</artifactId>
|
||||||
<version>2.17.0</version>
|
<version>2.17.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--用于与slf4j保持桥接-->
|
<!--用于与slf4j保持桥接-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
<artifactId>log4j-slf4j-impl</artifactId>
|
<artifactId>log4j-slf4j-impl</artifactId>
|
||||||
<version>2.17.0</version>
|
<version>2.17.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- slf4j核心包-->
|
<!-- slf4j核心包-->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -2326,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3751,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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -211,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;
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+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.79</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.79</version>
|
<version>0.80</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>distribution</artifactId>
|
<artifactId>distribution</artifactId>
|
||||||
|
|||||||
@@ -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年前的历史消息。
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<artifactId>wildfirechat-parent</artifactId>
|
<artifactId>wildfirechat-parent</artifactId>
|
||||||
|
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<version>0.79</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.79</version>
|
<version>0.80</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user