Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88d764fb6d | ||
|
|
08b3886238 | ||
|
|
7e73c2880b | ||
|
|
1359ce5250 | ||
|
|
56eaf938a8 | ||
|
|
6ef6ed2906 | ||
|
|
63f37e8984 | ||
|
|
337302c551 | ||
|
|
721f27a58a | ||
|
|
ced74280d8 | ||
|
|
18617c67f4 | ||
|
|
883866ce39 | ||
|
|
2e135d4794 | ||
|
|
1d6faa5796 | ||
|
|
731fa00cc9 | ||
|
|
4da9173c5f | ||
|
|
94e430cc83 | ||
|
|
7e92d1e0c5 | ||
|
|
4fa79bfeac | ||
|
|
98388a5129 | ||
|
|
1a89714df9 | ||
|
|
a855652c26 | ||
|
|
21aadd9c0b | ||
|
|
5522a8689d | ||
|
|
bf52a00304 | ||
|
|
3349e2a4e5 | ||
|
|
70f3f96f7a | ||
|
|
5e9d411f1b | ||
|
|
e74fd0c660 | ||
|
|
d1232abe39 | ||
|
|
1df192f730 | ||
|
|
f897e640fc | ||
|
|
ee6e4f96fb | ||
|
|
d14dc74566 | ||
|
|
ff75379779 |
@@ -44,7 +44,8 @@
|
|||||||
| [organization-platform](https://github.com/wildfirechat/organization-platform) | [organization-platform](https://gitee.com/wfchat/organization-platform) | 野火组织通讯录服务。 |
|
| [organization-platform](https://github.com/wildfirechat/organization-platform) | [organization-platform](https://gitee.com/wfchat/organization-platform) | 野火组织通讯录服务。 |
|
||||||
| [android-chat](https://github.com/wildfirechat/android-chat) | [android-chat](https://gitee.com/wfchat/android-chat) | 野火IM Android SDK源码和App源码。 |
|
| [android-chat](https://github.com/wildfirechat/android-chat) | [android-chat](https://gitee.com/wfchat/android-chat) | 野火IM Android SDK源码和App源码。 |
|
||||||
| [ios-chat](https://github.com/wildfirechat/ios-chat) | [ios-chat](https://gitee.com/wfchat/ios-chat) | 野火IM iOS SDK源码和App源码。|
|
| [ios-chat](https://github.com/wildfirechat/ios-chat) | [ios-chat](https://gitee.com/wfchat/ios-chat) | 野火IM iOS SDK源码和App源码。|
|
||||||
| [pc-chat](https://github.com/wildfirechat/vue-pc-chat) | [pc-chat](https://gitee.com/wfchat/vue-pc-chat) | 基于[Electron](https://electronjs.org/)的PC 端,支持Windows、Mac、Linux(包括国产化linux系统和CPU)。 |
|
| [pc-chat(electron)](https://github.com/wildfirechat/vue-pc-chat) | [pc-chat(electron)](https://gitee.com/wfchat/vue-pc-chat) | 基于[Electron](https://electronjs.org/)开发的PC 端 | |
|
||||||
|
| [pc-chat(Qt)](https://github.com/wildfirechat/qt-pc-chat) | [pc-chat(Qt)](https://gitee.com/wfchat/qt-pc-chat) | 基于Qt开发的PC 端 | |
|
||||||
| [web-chat](https://github.com/wildfirechat/vue-chat) | [web-chat](https://gitee.com/wfchat/vue-chat) | 野火IM Web 端, [体验地址](https://web.wildfirechat.cn)。 |
|
| [web-chat](https://github.com/wildfirechat/vue-chat) | [web-chat](https://gitee.com/wfchat/vue-chat) | 野火IM Web 端, [体验地址](https://web.wildfirechat.cn)。 |
|
||||||
| [wx-chat](https://github.com/wildfirechat/wx-chat) | [wx-chat](https://gitee.com/wfchat/wx-chat) | 小程序平台的Demo(支持微信、百度、阿里、字节、QQ 等小程序平台)。 |
|
| [wx-chat](https://github.com/wildfirechat/wx-chat) | [wx-chat](https://gitee.com/wfchat/wx-chat) | 小程序平台的Demo(支持微信、百度、阿里、字节、QQ 等小程序平台)。 |
|
||||||
| [uni-chat](https://github.com/wildfirechat/uni-chat) | [uni-chat](https://gitee.com/wfchat/uni-chat) | UniApp平台移动端应用(使用原生插件)。 |
|
| [uni-chat](https://github.com/wildfirechat/uni-chat) | [uni-chat](https://gitee.com/wfchat/uni-chat) | UniApp平台移动端应用(使用原生插件)。 |
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ message.disable_remote_search false
|
|||||||
##如果要避免数据库中明文存储消息内容,请打开这个开关和message.disable_remote_search开关
|
##如果要避免数据库中明文存储消息内容,请打开这个开关和message.disable_remote_search开关
|
||||||
message.encrypt_message_content false
|
message.encrypt_message_content false
|
||||||
|
|
||||||
##允许客户端撤回用户自己发送的消息时限,单位是秒。
|
##允许客户端撤回用户自己发送的消息时限,单位是秒。0是不允许撤回;-1是无限制撤回。
|
||||||
##Server API不受此限制,可以撤回任意时限内的消息
|
##Server API不受此限制,可以撤回任意时限内的消息
|
||||||
##群组管理员或群主撤回群成员消息不受此限制,可以撤回任意时限内的消息。但管理员或群主撤回自己的消息还是需要准守此时间限制。
|
##群组管理员或群主撤回群成员消息不受此限制,可以撤回任意时限内的消息。但管理员或群主撤回自己的消息还是需要准守此时间限制。
|
||||||
##修改此参数需要同步修改客户端UI,客户端UI代码有判断撤回是否显示的逻辑。
|
##修改此参数需要同步修改客户端UI,客户端UI代码有判断撤回是否显示的逻辑。
|
||||||
@@ -152,12 +152,33 @@ message.no_forward_admin_message false
|
|||||||
## 消息转发功能开启时,转发信息是否带上用户clientId和平台类型。
|
## 消息转发功能开启时,转发信息是否带上用户clientId和平台类型。
|
||||||
message.forward_with_client_info false
|
message.forward_with_client_info false
|
||||||
|
|
||||||
|
## 消息转发功能开启时,转发信息是否带上发送者的用户信息
|
||||||
|
message.forward_with_sender_info false
|
||||||
|
|
||||||
|
## 消息转发功能开启时,转发信息是否带上目标的信息,单聊时是对方用户信息,群聊时是群组信息,频道时是频道信息
|
||||||
|
message.forward_with_target_info false
|
||||||
|
|
||||||
|
## 允许发送单聊消息给被封禁用户
|
||||||
|
message.allow_send_to_forbidden_user false
|
||||||
|
|
||||||
## 机器人回调信息是否带上用户clientId和平台类型。
|
## 机器人回调信息是否带上用户clientId和平台类型。
|
||||||
robot.callback_with_client_info false
|
robot.callback_with_client_info false
|
||||||
|
|
||||||
|
## 机器人回调信息是否带上发送者的用户信息
|
||||||
|
robot.callback_with_sender_info false
|
||||||
|
|
||||||
|
## 机器人回调信息是否带上目标的信息,单聊时是对方用户信息,群聊时是群组信息,频道时是频道信息
|
||||||
|
robot.callback_with_target_info false
|
||||||
|
|
||||||
## 频道回调信息是否带上用户clientId和平台类型。
|
## 频道回调信息是否带上用户clientId和平台类型。
|
||||||
channel.callback_with_client_info false
|
channel.callback_with_client_info false
|
||||||
|
|
||||||
|
## 频道回调信息是否带上发送者的用户信息。
|
||||||
|
channel.callback_with_sender_info false
|
||||||
|
|
||||||
|
## 频道回调信息是否带上频道信息
|
||||||
|
channel.callback_with_target_info false
|
||||||
|
|
||||||
## 频道回调新方式,在新方式下,如果有callback地址就会总是回调客户端发送的消息(包括owner和订阅者)。automatic属性控制订阅者发送的消息是否发给owner, 0发,1不发。
|
## 频道回调新方式,在新方式下,如果有callback地址就会总是回调客户端发送的消息(包括owner和订阅者)。automatic属性控制订阅者发送的消息是否发给owner, 0发,1不发。
|
||||||
## 旧的方式是,automatic为0时,订阅者的消息发给owner,不转发消息到callback地址。为1时,把订阅者的消息转发给callback地址,不发给owner。
|
## 旧的方式是,automatic为0时,订阅者的消息发给owner,不转发消息到callback地址。为1时,把订阅者的消息转发给callback地址,不发给owner。
|
||||||
channel.new_callback_feature true
|
channel.new_callback_feature true
|
||||||
@@ -227,6 +248,10 @@ group.visible_quit_or_kickoff_notification 0
|
|||||||
## 是否禁止陌生人拉人入群,默认为false
|
## 是否禁止陌生人拉人入群,默认为false
|
||||||
group.disable_stranger_invite false
|
group.disable_stranger_invite false
|
||||||
|
|
||||||
|
## 创建群组或者加人时。可能会有成员加入失败(黑名单,或者不允许陌生人拉入群)。当出现有成员失败时,如果此开关为关,操作会失败。
|
||||||
|
## 如果此开关打开,操作会返回成功,另外在群里发送一条通知消息 XXX 拒绝加入群组。默认为开。
|
||||||
|
group.add_member_allow_part_success true
|
||||||
|
|
||||||
## 群组信息是否标记删除
|
## 群组信息是否标记删除
|
||||||
group.enable_mark_deletion true
|
group.enable_mark_deletion true
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
CREATE INDEX `user_gid_mid_dt_index` ON `t_group_member` (`_gid`, `_mid`, `_dt`);
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
CREATE INDEX `user_gid_mid_dt_index` ON `t_group_member` (`_gid`, `_mid`, `_dt`);
|
||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
<relativePath>../</relativePath>
|
<relativePath>../</relativePath>
|
||||||
<artifactId>wildfirechat-parent</artifactId>
|
<artifactId>wildfirechat-parent</artifactId>
|
||||||
<groupId>cn.wildfirechat</groupId>
|
<groupId>cn.wildfirechat</groupId>
|
||||||
<version>1.3.3</version>
|
<version>1.3.7</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>moquette-broker</artifactId>
|
<artifactId>moquette-broker</artifactId>
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ public class PushMessage {
|
|||||||
public String language;
|
public String language;
|
||||||
public boolean republish;
|
public boolean republish;
|
||||||
public long messageId;
|
public long messageId;
|
||||||
|
public long callStartUid;
|
||||||
|
public int existBadgeNumber;
|
||||||
|
|
||||||
public PushMessage(String sender, int conversationType, String target, int line, int messageContentType, long serverTime, String senderName, String senderPortrait, String targetName, String targetPortrait, int unReceivedMsg, int mentionedType, boolean isHiddenDetail, String language) {
|
public PushMessage(String sender, int conversationType, String target, int line, int messageContentType, long serverTime, String senderName, String senderPortrait, String targetName, String targetPortrait, int unReceivedMsg, int mentionedType, boolean isHiddenDetail, String language) {
|
||||||
this.sender = sender;
|
this.sender = sender;
|
||||||
|
|||||||
@@ -81,10 +81,6 @@ public class PushServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MemorySessionStore.Session session = sessionsStore.getSession(deviceId);
|
MemorySessionStore.Session session = sessionsStore.getSession(deviceId);
|
||||||
int badge = session.getUnReceivedMsgs();
|
|
||||||
if (badge <= 0) {
|
|
||||||
badge = 1;
|
|
||||||
}
|
|
||||||
if (StringUtil.isNullOrEmpty(session.getDeviceToken())) {
|
if (StringUtil.isNullOrEmpty(session.getDeviceToken())) {
|
||||||
LOG.warn("Device token is empty for device {}", deviceId);
|
LOG.warn("Device token is empty for device {}", deviceId);
|
||||||
return;
|
return;
|
||||||
@@ -94,7 +90,6 @@ public class PushServer {
|
|||||||
pushMessage.pushType = session.getPushType();
|
pushMessage.pushType = session.getPushType();
|
||||||
pushMessage.pushContent = pushContent;
|
pushMessage.pushContent = pushContent;
|
||||||
pushMessage.deviceToken = session.getDeviceToken();
|
pushMessage.deviceToken = session.getDeviceToken();
|
||||||
pushMessage.unReceivedMsg = badge;
|
|
||||||
pushMessage.userId = session.getUsername();
|
pushMessage.userId = session.getUsername();
|
||||||
if (session.getPlatform() == ProtoConstants.Platform.Platform_iOS ||
|
if (session.getPlatform() == ProtoConstants.Platform.Platform_iOS ||
|
||||||
session.getPlatform() == ProtoConstants.Platform.Platform_iPad ||
|
session.getPlatform() == ProtoConstants.Platform.Platform_iPad ||
|
||||||
|
|||||||
@@ -8,9 +8,13 @@
|
|||||||
|
|
||||||
package com.xiaoleilu.loServer.action;
|
package com.xiaoleilu.loServer.action;
|
||||||
|
|
||||||
|
import cn.wildfirechat.common.IMExceptionEvent;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
|
import com.google.gson.JsonSyntaxException;
|
||||||
import com.xiaoleilu.loServer.RestResult;
|
import com.xiaoleilu.loServer.RestResult;
|
||||||
|
import com.xiaoleilu.loServer.action.channel.ChannelAction;
|
||||||
|
import com.xiaoleilu.loServer.action.robot.RobotAction;
|
||||||
import com.xiaoleilu.loServer.annotation.RequireAuthentication;
|
import com.xiaoleilu.loServer.annotation.RequireAuthentication;
|
||||||
import com.xiaoleilu.loServer.handler.Request;
|
import com.xiaoleilu.loServer.handler.Request;
|
||||||
import com.xiaoleilu.loServer.handler.Response;
|
import com.xiaoleilu.loServer.handler.Response;
|
||||||
@@ -23,7 +27,10 @@ import io.netty.handler.codec.http.FullHttpRequest;
|
|||||||
import io.netty.handler.codec.http.HttpRequest;
|
import io.netty.handler.codec.http.HttpRequest;
|
||||||
import io.netty.handler.codec.http.HttpResponseStatus;
|
import io.netty.handler.codec.http.HttpResponseStatus;
|
||||||
import cn.wildfirechat.common.ErrorCode;
|
import cn.wildfirechat.common.ErrorCode;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import win.liyufan.im.RateLimiter;
|
import win.liyufan.im.RateLimiter;
|
||||||
|
import win.liyufan.im.Utility;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
@@ -38,6 +45,7 @@ import static io.moquette.BrokerConstants.*;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
abstract public class Action {
|
abstract public class Action {
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(Action.class);
|
||||||
public static IMessagesStore messagesStore = null;
|
public static IMessagesStore messagesStore = null;
|
||||||
public static ISessionsStore sessionsStore = null;
|
public static ISessionsStore sessionsStore = null;
|
||||||
protected static final Gson gson = new GsonBuilder().disableHtmlEscaping().create();
|
protected static final Gson gson = new GsonBuilder().disableHtmlEscaping().create();
|
||||||
@@ -153,9 +161,22 @@ abstract public class Action {
|
|||||||
FullHttpRequest fullHttpRequest = (FullHttpRequest) request;
|
FullHttpRequest fullHttpRequest = (FullHttpRequest) request;
|
||||||
byte[] bytes = Utils.readBytesAndRewind(fullHttpRequest.content());
|
byte[] bytes = Utils.readBytesAndRewind(fullHttpRequest.content());
|
||||||
String content = new String(bytes, StandardCharsets.UTF_8);//contribute by JiaRG from github
|
String content = new String(bytes, StandardCharsets.UTF_8);//contribute by JiaRG from github
|
||||||
|
|
||||||
T t = gson.fromJson(content, cls);
|
try {
|
||||||
return t;
|
T t = gson.fromJson(content, cls);
|
||||||
|
return t;
|
||||||
|
} catch (JsonSyntaxException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
LOG.error("Object {} from json {} failure", cls.getName(), content);
|
||||||
|
int exception = IMExceptionEvent.EventType.ADMIN_API_Exception;
|
||||||
|
if (this instanceof RobotAction) {
|
||||||
|
exception = IMExceptionEvent.EventType.ROBOT_API_Exception;
|
||||||
|
} else if (this instanceof ChannelAction) {
|
||||||
|
exception = IMExceptionEvent.EventType.CHANNEL_API_Exception;
|
||||||
|
}
|
||||||
|
Utility.printExecption(LOG, e, exception);
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
package com.xiaoleilu.loServer.action;
|
package com.xiaoleilu.loServer.action;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.nio.file.Files;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@@ -13,6 +16,7 @@ import cn.hutool.core.io.FileUtil;
|
|||||||
import cn.hutool.core.util.ReUtil;
|
import cn.hutool.core.util.ReUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.hazelcast.core.HazelcastInstance;
|
import com.hazelcast.core.HazelcastInstance;
|
||||||
|
import com.hazelcast.util.StringUtil;
|
||||||
import com.xiaoleilu.loServer.ServerSetting;
|
import com.xiaoleilu.loServer.ServerSetting;
|
||||||
import com.xiaoleilu.loServer.handler.Request;
|
import com.xiaoleilu.loServer.handler.Request;
|
||||||
import com.xiaoleilu.loServer.handler.Response;
|
import com.xiaoleilu.loServer.handler.Response;
|
||||||
@@ -90,11 +94,26 @@ public class FileAction extends Action {
|
|||||||
}
|
}
|
||||||
|
|
||||||
response.setContent(file);
|
response.setContent(file);
|
||||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + file.getName() + "\"");
|
if (isAudioOrVideoFile(file.getName())) {
|
||||||
|
response.setHeader("Accept-Ranges", "bytes");
|
||||||
|
} else {
|
||||||
|
response.setHeader("Content-Disposition", "attachment; filename=\"" + file.getName() + "\"");
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isAudioOrVideoFile(String name) {
|
||||||
|
try {
|
||||||
|
if (StringUtil.isNullOrEmpty(name)) return false;
|
||||||
|
|
||||||
|
String mimeType = Files.probeContentType(new File(name).toPath());
|
||||||
|
return mimeType != null && (mimeType.startsWith("audio/") || mimeType.startsWith("video/"));
|
||||||
|
} catch (IOException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static final Pattern INSECURE_URI = Pattern.compile(".*[<>&\"].*");
|
private static final Pattern INSECURE_URI = Pattern.compile(".*[<>&\"].*");
|
||||||
private static final SimpleDateFormat HTTP_DATE_FORMATER = new SimpleDateFormat(HTTP_DATETIME_PATTERN, Locale.US);
|
private static final SimpleDateFormat HTTP_DATE_FORMATER = new SimpleDateFormat(HTTP_DATETIME_PATTERN, Locale.US);
|
||||||
|
|
||||||
|
|||||||
@@ -284,9 +284,10 @@ public class UploadFileAction extends Action {
|
|||||||
|
|
||||||
savedThunkSize += readableBytesSize;
|
savedThunkSize += readableBytesSize;
|
||||||
offset += readableBytesSize;
|
offset += readableBytesSize;
|
||||||
|
byteBuf.release();
|
||||||
|
byteBuf = null;
|
||||||
|
|
||||||
if (savedThunkSize >= remoteFileSize) {
|
if (savedThunkSize >= remoteFileSize) {
|
||||||
byteBuf.release();
|
|
||||||
fileUpload.release();
|
fileUpload.release();
|
||||||
|
|
||||||
response.setStatus(HttpResponseStatus.OK);
|
response.setStatus(HttpResponseStatus.OK);
|
||||||
|
|||||||
@@ -51,14 +51,7 @@ public class AliasPutAction extends AdminAction {
|
|||||||
ByteBuf byteBuf = Unpooled.buffer();
|
ByteBuf byteBuf = Unpooled.buffer();
|
||||||
byteBuf.writeBytes(result);
|
byteBuf.writeBytes(result);
|
||||||
ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte());
|
ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte());
|
||||||
if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) {
|
return new Result(errorCode);
|
||||||
byte[] data = new byte[byteBuf.readableBytes()];
|
|
||||||
byteBuf.readBytes(data);
|
|
||||||
String channelId = new String(data);
|
|
||||||
return new Result(ErrorCode.ERROR_CODE_SUCCESS, new OutputCreateChannel(channelId));
|
|
||||||
} else {
|
|
||||||
return new Result(errorCode);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -53,8 +53,11 @@ public class CreateChannelAction extends AdminAction {
|
|||||||
if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) {
|
if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
byte[] data = new byte[byteBuf.readableBytes()];
|
byte[] data = new byte[byteBuf.readableBytes()];
|
||||||
byteBuf.readBytes(data);
|
byteBuf.readBytes(data);
|
||||||
String channelId = new String(data);
|
String str = new String(data);
|
||||||
return new Result(ErrorCode.ERROR_CODE_SUCCESS, new OutputCreateChannel(channelId));
|
String[] ss = str.split("\\|");
|
||||||
|
String channelId = ss[0];
|
||||||
|
String secret = ss[1];
|
||||||
|
return new Result(ErrorCode.ERROR_CODE_SUCCESS, new OutputCreateChannel(channelId, secret));
|
||||||
} else {
|
} else {
|
||||||
return new Result(errorCode);
|
return new Result(errorCode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import io.netty.handler.codec.http.FullHttpRequest;
|
|||||||
import cn.wildfirechat.common.ErrorCode;
|
import cn.wildfirechat.common.ErrorCode;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import win.liyufan.im.GitRepositoryState;
|
||||||
import win.liyufan.im.IMTopic;
|
import win.liyufan.im.IMTopic;
|
||||||
|
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
@@ -53,7 +54,7 @@ public class GetIMTokenAction extends AdminAction {
|
|||||||
|
|
||||||
LOG.info("get im token success {},{},{}", userId, input.getClientId(), token.substring(0, Math.min(10, token.length())));
|
LOG.info("get im token success {},{},{}", userId, input.getClientId(), token.substring(0, Math.min(10, token.length())));
|
||||||
|
|
||||||
return new Result(errorCode1, new OutputGetIMTokenData(userId, token));
|
return new Result(errorCode1, new OutputGetIMTokenData(userId, token, GitRepositoryState.globalLabel));
|
||||||
} else {
|
} else {
|
||||||
return new Result(errorCode1);
|
return new Result(errorCode1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,18 +105,6 @@ abstract public class ChannelAction extends Action {
|
|||||||
response.send();
|
response.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected <T> T getRequestBody(HttpRequest request, Class<T> cls) {
|
|
||||||
if (request instanceof FullHttpRequest) {
|
|
||||||
FullHttpRequest fullHttpRequest = (FullHttpRequest) request;
|
|
||||||
byte[] bytes = Utils.readBytesAndRewind(fullHttpRequest.content());
|
|
||||||
String content = new String(bytes, StandardCharsets.UTF_8);
|
|
||||||
|
|
||||||
T t = gson.fromJson(content, cls);
|
|
||||||
return t;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void sendApiMessage(Response response, String topic, byte[] message, Callback callback) {
|
protected void sendApiMessage(Response response, String topic, byte[] message, Callback callback) {
|
||||||
sendApiMessage(response, channelInfo.getOwner(), topic, message, callback);
|
sendApiMessage(response, channelInfo.getOwner(), topic, message, callback);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,24 +106,6 @@ abstract public class RobotAction extends Action {
|
|||||||
response.send();
|
response.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected <T> T getRequestBody(HttpRequest request, Class<T> cls) {
|
|
||||||
if (request instanceof FullHttpRequest) {
|
|
||||||
FullHttpRequest fullHttpRequest = (FullHttpRequest) request;
|
|
||||||
byte[] bytes = Utils.readBytesAndRewind(fullHttpRequest.content());
|
|
||||||
String content = null;
|
|
||||||
try {
|
|
||||||
content = new String(bytes, "UTF-8");
|
|
||||||
|
|
||||||
T t = gson.fromJson(content, cls);
|
|
||||||
return t;
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
Utility.printExecption(LOG, e, IMExceptionEvent.EventType.ROBOT_API_Exception);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void sendApiRequest(Response response, String topic, byte[] message, Callback callback) {
|
protected void sendApiRequest(Response response, String topic, byte[] message, Callback callback) {
|
||||||
ServerAPIHelper.sendRequest(robot.getUid(), null, topic, message, new ServerAPIHelper.Callback() {
|
ServerAPIHelper.sendRequest(robot.getUid(), null, topic, message, new ServerAPIHelper.Callback() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -163,11 +163,20 @@ public final class BrokerConstants {
|
|||||||
public static final String MESSAGE_Force_Push_Types = "message.force_push_types";
|
public static final String MESSAGE_Force_Push_Types = "message.force_push_types";
|
||||||
|
|
||||||
public static final String MESSAGE_Forward_With_Client_Info = "message.forward_with_client_info";
|
public static final String MESSAGE_Forward_With_Client_Info = "message.forward_with_client_info";
|
||||||
|
public static final String MESSAGE_Forward_With_Sender_Info = "message.forward_with_sender_info";
|
||||||
|
public static final String MESSAGE_Forward_With_Target_Info = "message.forward_with_target_info";
|
||||||
|
|
||||||
public static final String BROADCAST_Target_From_User_Table = "message.broadcast.target_from_user_table";
|
public static final String BROADCAST_Target_From_User_Table = "message.broadcast.target_from_user_table";
|
||||||
|
|
||||||
|
public static final String MESSAGES_ALLOW_SEND_TO_FORBIDDEN_USER = "message.allow_send_to_forbidden_user";
|
||||||
|
|
||||||
public static final String ROBOT_Callback_With_Client_Info = "robot.callback_with_client_info";
|
public static final String ROBOT_Callback_With_Client_Info = "robot.callback_with_client_info";
|
||||||
|
public static final String ROBOT_Callback_With_Sender_Info = "robot.callback_with_sender_info";
|
||||||
|
public static final String ROBOT_Callback_With_Target_Info = "robot.callback_with_target_info";
|
||||||
|
|
||||||
public static final String CHANNEL_Callback_With_Client_Info = "channel.callback_with_client_info";
|
public static final String CHANNEL_Callback_With_Client_Info = "channel.callback_with_client_info";
|
||||||
|
public static final String CHANNEL_Callback_With_Sender_Info = "channel.callback_with_sender_info";
|
||||||
|
public static final String CHANNEL_Callback_With_Target_Info = "channel.callback_with_target_info";
|
||||||
public static final String CHANNEL_New_Callback_Feature = "channel.new_callback_feature";
|
public static final String CHANNEL_New_Callback_Feature = "channel.new_callback_feature";
|
||||||
|
|
||||||
|
|
||||||
@@ -196,6 +205,7 @@ public final class BrokerConstants {
|
|||||||
public static final String GROUP_Forbidden_Client_Operation = "group.forbidden_client_operation";
|
public static final String GROUP_Forbidden_Client_Operation = "group.forbidden_client_operation";
|
||||||
|
|
||||||
public static final String GROUP_Disable_Stranger_Invite = "group.disable_stranger_invite";
|
public static final String GROUP_Disable_Stranger_Invite = "group.disable_stranger_invite";
|
||||||
|
public static final String GROUP_ADD_MEMBER_ALLOW_PART_SUCCESS = "group.add_member_allow_part_success";
|
||||||
|
|
||||||
public static final String GROUP_INFO_MARK_DELETION = "group.enable_mark_deletion";
|
public static final String GROUP_INFO_MARK_DELETION = "group.enable_mark_deletion";
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ import io.netty.buffer.ByteBuf;
|
|||||||
import cn.wildfirechat.common.ErrorCode;
|
import cn.wildfirechat.common.ErrorCode;
|
||||||
import win.liyufan.im.IMTopic;
|
import win.liyufan.im.IMTopic;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import static cn.wildfirechat.common.ErrorCode.ERROR_CODE_SUCCESS;
|
import static cn.wildfirechat.common.ErrorCode.ERROR_CODE_SUCCESS;
|
||||||
|
|
||||||
@Handler(value = IMTopic.AddGroupMemberTopic)
|
@Handler(value = IMTopic.AddGroupMemberTopic)
|
||||||
@@ -38,16 +42,34 @@ public class AddGroupMember extends GroupHandler<WFCMessage.AddGroupMemberReques
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorCode errorCode = m_messagesStore.addGroupMembers(fromUser, isAdmin, request.getGroupId(), request.getAddedMemberList(), request.getExtra());
|
Map<String, Integer> failedMembers = new HashMap<>();
|
||||||
|
if(requestSourceType == ProtoConstants.RequestSourceType.Request_From_User) {
|
||||||
|
ErrorCode errorCode = m_messagesStore.canAddGroupMembers(fromUser, request.getAddedMemberList(), failedMembers);
|
||||||
|
if (errorCode != ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
|
return errorCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ErrorCode errorCode = m_messagesStore.addGroupMembers(fromUser, isAdmin, request.getGroupId(), request.getAddedMemberList(), request.getExtra(), failedMembers);
|
||||||
if (errorCode == ERROR_CODE_SUCCESS) {
|
if (errorCode == ERROR_CODE_SUCCESS) {
|
||||||
if (request.hasNotifyContent() && request.getNotifyContent().getType() > 0) {
|
if (request.hasNotifyContent() && request.getNotifyContent().getType() > 0) {
|
||||||
sendGroupNotification(fromUser, request.getGroupId(), request.getToLineList(), request.getNotifyContent());
|
sendGroupNotification(fromUser, request.getGroupId(), request.getToLineList(), request.getNotifyContent());
|
||||||
} else {
|
} else {
|
||||||
WFCMessage.MessageContent content = new GroupNotificationBinaryContent(request.getGroupId(), fromUser, null, getMemberIdList(request.getAddedMemberList())).setExtra(request.getExtra()).getAddGroupNotifyContent();
|
List<String> added = getMemberIdList(request.getAddedMemberList());
|
||||||
|
added.removeAll(failedMembers.keySet());
|
||||||
|
WFCMessage.MessageContent content = new GroupNotificationBinaryContent(request.getGroupId(), fromUser, null, added).setExtra(request.getExtra()).getAddGroupNotifyContent();
|
||||||
sendGroupNotification(fromUser, request.getGroupId(), request.getToLineList(), content);
|
sendGroupNotification(fromUser, request.getGroupId(), request.getToLineList(), content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (errorCode == ERROR_CODE_SUCCESS && !failedMembers.isEmpty()) {
|
||||||
|
WFCMessage.MessageContent content = new GroupNotificationBinaryContent(request.getGroupId(), fromUser, null, "").setMi(failedMembers).getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_REJECT_JOIN_GROUP);
|
||||||
|
sendGroupNotification(fromUser, request.getGroupId(), request.getToLineList(), content);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(errorCode == ERROR_CODE_SUCCESS && !failedMembers.isEmpty()) {
|
||||||
|
return ErrorCode.ERROR_CODE_PARTLY_SUCCESS;
|
||||||
|
}
|
||||||
return errorCode;
|
return errorCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import io.netty.buffer.ByteBuf;
|
|||||||
import cn.wildfirechat.common.ErrorCode;
|
import cn.wildfirechat.common.ErrorCode;
|
||||||
import win.liyufan.im.IMTopic;
|
import win.liyufan.im.IMTopic;
|
||||||
|
|
||||||
|
import static cn.wildfirechat.proto.ProtoConstants.RequestSourceType.Request_From_Admin;
|
||||||
import static win.liyufan.im.IMTopic.PutUserSettingTopic;
|
import static win.liyufan.im.IMTopic.PutUserSettingTopic;
|
||||||
import static win.liyufan.im.UserSettingScope.kUserSettingMyChannels;
|
import static win.liyufan.im.UserSettingScope.kUserSettingMyChannels;
|
||||||
|
|
||||||
@@ -42,7 +43,13 @@ public class CreateChannelHandler extends GroupHandler<WFCMessage.ChannelInfo> {
|
|||||||
if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) {
|
if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
WFCMessage.ModifyUserSettingReq modifyUserSettingReq = WFCMessage.ModifyUserSettingReq.newBuilder().setScope(kUserSettingMyChannels).setKey(request.getTargetId()).setValue("1").build();
|
WFCMessage.ModifyUserSettingReq modifyUserSettingReq = WFCMessage.ModifyUserSettingReq.newBuilder().setScope(kUserSettingMyChannels).setKey(request.getTargetId()).setValue("1").build();
|
||||||
mServer.onApiMessage(fromUser, null, modifyUserSettingReq.toByteArray(), 0, fromUser, PutUserSettingTopic, requestSourceType);
|
mServer.onApiMessage(fromUser, null, modifyUserSettingReq.toByteArray(), 0, fromUser, PutUserSettingTopic, requestSourceType);
|
||||||
byte[] data = request.getTargetId().getBytes();
|
byte[] data;
|
||||||
|
if (requestSourceType == Request_From_Admin) {
|
||||||
|
//When server api create channel, need return channelId and secret together.
|
||||||
|
data = (request.getTargetId() + "|" + request.getSecret()).getBytes();
|
||||||
|
} else {
|
||||||
|
data = request.getTargetId().getBytes();
|
||||||
|
}
|
||||||
ackPayload.ensureWritable(data.length).writeBytes(data);
|
ackPayload.ensureWritable(data.length).writeBytes(data);
|
||||||
return ErrorCode.ERROR_CODE_SUCCESS;
|
return ErrorCode.ERROR_CODE_SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ import io.netty.buffer.ByteBuf;
|
|||||||
import cn.wildfirechat.common.ErrorCode;
|
import cn.wildfirechat.common.ErrorCode;
|
||||||
import win.liyufan.im.IMTopic;
|
import win.liyufan.im.IMTopic;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Handler(value = IMTopic.CreateGroupTopic)
|
@Handler(value = IMTopic.CreateGroupTopic)
|
||||||
public class CreateGroupHandler extends GroupHandler<WFCMessage.CreateGroupRequest> {
|
public class CreateGroupHandler extends GroupHandler<WFCMessage.CreateGroupRequest> {
|
||||||
@Override
|
@Override
|
||||||
@@ -51,14 +54,21 @@ public class CreateGroupHandler extends GroupHandler<WFCMessage.CreateGroupReque
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, Integer> failedMembers = new HashMap<>();
|
||||||
if(requestSourceType == ProtoConstants.RequestSourceType.Request_From_User) {
|
if(requestSourceType == ProtoConstants.RequestSourceType.Request_From_User) {
|
||||||
ErrorCode errorCode = m_messagesStore.canAddGroupMembers(fromUser, request.getGroup().getMembersList());
|
ErrorCode errorCode = m_messagesStore.canAddGroupMembers(fromUser, request.getGroup().getMembersList(), failedMembers);
|
||||||
if (errorCode != ErrorCode.ERROR_CODE_SUCCESS) {
|
if (errorCode != ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
return errorCode;
|
return errorCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WFCMessage.GroupInfo groupInfo = m_messagesStore.createGroup(fromUser, request.getGroup().getGroupInfo(), request.getGroup().getMembersList(), request.getMemberExtra(), isAdmin);
|
if (request.getGroup().getGroupInfo().getTargetId().length() > 64
|
||||||
|
|| request.getGroup().getGroupInfo().getName().length() > 64
|
||||||
|
|| request.getGroup().getGroupInfo().getPortrait().length() > 1024) {
|
||||||
|
return ErrorCode.INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
WFCMessage.GroupInfo groupInfo = m_messagesStore.createGroup(fromUser, request.getGroup().getGroupInfo(), request.getGroup().getMembersList(), request.getMemberExtra(), isAdmin, failedMembers);
|
||||||
if (groupInfo != null && groupInfo.getDeleted() == 0) {
|
if (groupInfo != null && groupInfo.getDeleted() == 0) {
|
||||||
if(request.hasNotifyContent() && request.getNotifyContent().getType() > 0) {
|
if(request.hasNotifyContent() && request.getNotifyContent().getType() > 0) {
|
||||||
sendGroupNotification(fromUser, groupInfo.getTargetId(), request.getToLineList(), request.getNotifyContent());
|
sendGroupNotification(fromUser, groupInfo.getTargetId(), request.getToLineList(), request.getNotifyContent());
|
||||||
@@ -66,9 +76,19 @@ public class CreateGroupHandler extends GroupHandler<WFCMessage.CreateGroupReque
|
|||||||
WFCMessage.MessageContent content = new GroupNotificationBinaryContent(groupInfo.getTargetId(), fromUser, groupInfo.getName(), "").setExtra(request.getMemberExtra()).getCreateGroupNotifyContent();
|
WFCMessage.MessageContent content = new GroupNotificationBinaryContent(groupInfo.getTargetId(), fromUser, groupInfo.getName(), "").setExtra(request.getMemberExtra()).getCreateGroupNotifyContent();
|
||||||
sendGroupNotification(fromUser, groupInfo.getTargetId(), request.getToLineList(), content);
|
sendGroupNotification(fromUser, groupInfo.getTargetId(), request.getToLineList(), content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!failedMembers.isEmpty()) {
|
||||||
|
WFCMessage.MessageContent content = new GroupNotificationBinaryContent(groupInfo.getTargetId(), fromUser, null, "").setMi(failedMembers).getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_REJECT_JOIN_GROUP);
|
||||||
|
sendGroupNotification(fromUser, groupInfo.getTargetId(), request.getToLineList(), content);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] data = groupInfo.getTargetId().getBytes();
|
byte[] data = groupInfo.getTargetId().getBytes();
|
||||||
ackPayload.ensureWritable(data.length).writeBytes(data);
|
ackPayload.ensureWritable(data.length).writeBytes(data);
|
||||||
return ErrorCode.ERROR_CODE_SUCCESS;
|
if(failedMembers.isEmpty()) {
|
||||||
|
return ErrorCode.ERROR_CODE_SUCCESS;
|
||||||
|
} else {
|
||||||
|
return ErrorCode.ERROR_CODE_PARTLY_SUCCESS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ public class SendMessageHandler extends IMHandler<WFCMessage.Message> {
|
|||||||
private int mBlacklistStrategy = 0; //黑名单中时,0失败,1吞掉。
|
private int mBlacklistStrategy = 0; //黑名单中时,0失败,1吞掉。
|
||||||
private boolean mBlacklistAllowSend2Black = true;
|
private boolean mBlacklistAllowSend2Black = true;
|
||||||
private boolean mNoForwardAdminMessage = false;
|
private boolean mNoForwardAdminMessage = false;
|
||||||
|
private boolean mAllowSend2ForbiddenUser = false;
|
||||||
|
|
||||||
private String mRemoteSensitiveServerUrl = null;
|
private String mRemoteSensitiveServerUrl = null;
|
||||||
private Set<Integer> mRemoteSensitiveMessageTypes;
|
private Set<Integer> mRemoteSensitiveMessageTypes;
|
||||||
@@ -101,6 +102,9 @@ public class SendMessageHandler extends IMHandler<WFCMessage.Message> {
|
|||||||
Utility.printExecption(LOG, e);
|
Utility.printExecption(LOG, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
mAllowSend2ForbiddenUser = Boolean.parseBoolean(mServer.getConfig().getProperty(BrokerConstants.MESSAGES_ALLOW_SEND_TO_FORBIDDEN_USER, "false"));
|
||||||
|
} catch (Exception e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parseTypes(Collection<Integer> collection, String types) {
|
private void parseTypes(Collection<Integer> collection, String types) {
|
||||||
@@ -170,9 +174,11 @@ public class SendMessageHandler extends IMHandler<WFCMessage.Message> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
userStatus = m_messagesStore.getUserStatus(message.getConversation().getTarget());
|
if (!mAllowSend2ForbiddenUser) {
|
||||||
if (userStatus == ProtoConstants.UserStatus.Forbidden) {
|
userStatus = m_messagesStore.getUserStatus(message.getConversation().getTarget());
|
||||||
return ErrorCode.ERROR_CODE_USER_FORBIDDEN;
|
if (userStatus == ProtoConstants.UserStatus.Forbidden) {
|
||||||
|
return ErrorCode.ERROR_CODE_USER_FORBIDDEN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,20 +223,13 @@ public class SendMessageHandler extends IMHandler<WFCMessage.Message> {
|
|||||||
}
|
}
|
||||||
message = message.toBuilder().setFromUser(fromUser).setMessageId(messageId).setServerTimestamp(timestamp).build();
|
message = message.toBuilder().setFromUser(fromUser).setMessageId(messageId).setServerTimestamp(timestamp).build();
|
||||||
|
|
||||||
OutputClient outputClient = null;
|
|
||||||
if(m_messagesStore.isForwardMessageWithClientInfo() && requestSourceType == ProtoConstants.RequestSourceType.Request_From_User && !StringUtil.isNullOrEmpty(clientID)) {
|
|
||||||
MemorySessionStore.Session session = m_sessionsStore.getSession(clientID);
|
|
||||||
if(session != null && session.getUsername().equals(fromUser)) {
|
|
||||||
outputClient = new OutputClient(session.getPlatform(), clientID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!StringUtil.isNullOrEmpty(mForwardUrl) && (mForwardMessageTypes.isEmpty() || mForwardMessageTypes.contains(message.getContent().getType())) && !(isAdmin && mNoForwardAdminMessage) && !mForwardExcludeMessageTypes.contains(message.getContent().getType())) {
|
if (!StringUtil.isNullOrEmpty(mForwardUrl) && (mForwardMessageTypes.isEmpty() || mForwardMessageTypes.contains(message.getContent().getType())) && !(isAdmin && mNoForwardAdminMessage) && !mForwardExcludeMessageTypes.contains(message.getContent().getType())) {
|
||||||
publisher.forwardMessage(message, mForwardUrl, outputClient);
|
publisher.forwardMessage(message, mForwardUrl, clientID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!StringUtil.isNullOrEmpty(mMentionForwardUrl) && message.hasContent() && message.getContent().getMentionedType() != 0 && !(isAdmin && mNoForwardAdminMessage)) {
|
if(!StringUtil.isNullOrEmpty(mMentionForwardUrl) && message.hasContent() && message.getContent().getMentionedType() != 0 && !(isAdmin && mNoForwardAdminMessage)) {
|
||||||
publisher.forwardMessage(message, mMentionForwardUrl, outputClient);
|
publisher.forwardMessage(message, mMentionForwardUrl, clientID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isAdmin) {
|
if (!isAdmin) {
|
||||||
@@ -239,7 +238,7 @@ public class SendMessageHandler extends IMHandler<WFCMessage.Message> {
|
|||||||
if (matched != null && !matched.isEmpty()) {
|
if (matched != null && !matched.isEmpty()) {
|
||||||
m_messagesStore.storeSensitiveMessage(message);
|
m_messagesStore.storeSensitiveMessage(message);
|
||||||
if (!StringUtil.isNullOrEmpty(mSensitiveMessageForwardUrl)) {
|
if (!StringUtil.isNullOrEmpty(mSensitiveMessageForwardUrl)) {
|
||||||
publisher.forwardMessage(message, mSensitiveMessageForwardUrl, outputClient);
|
publisher.forwardMessage(message, mSensitiveMessageForwardUrl, clientID);
|
||||||
}
|
}
|
||||||
if (mSensitiveType == 0) {
|
if (mSensitiveType == 0) {
|
||||||
errorCode = ErrorCode.ERROR_CODE_SENSITIVE_MATCHED;
|
errorCode = ErrorCode.ERROR_CODE_SENSITIVE_MATCHED;
|
||||||
@@ -256,7 +255,7 @@ public class SendMessageHandler extends IMHandler<WFCMessage.Message> {
|
|||||||
} else {
|
} else {
|
||||||
if(mRemoteSensitiveMessageTypes.contains(message.getContent().getType())) {
|
if(mRemoteSensitiveMessageTypes.contains(message.getContent().getType())) {
|
||||||
final WFCMessage.Message finalMsg = message;
|
final WFCMessage.Message finalMsg = message;
|
||||||
publisher.forwardMessageWithCallback(message, mRemoteSensitiveServerUrl, new HttpUtils.HttpCallback() {
|
publisher.forwardMessageWithCallback(message, clientID, mRemoteSensitiveServerUrl, new HttpUtils.HttpCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(String content) {
|
public void onSuccess(String content) {
|
||||||
if(StringUtil.isNullOrEmpty(content)) {
|
if(StringUtil.isNullOrEmpty(content)) {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import java.util.List;
|
|||||||
public class UserSearchHandler extends IMHandler<WFCMessage.SearchUserRequest> {
|
public class UserSearchHandler extends IMHandler<WFCMessage.SearchUserRequest> {
|
||||||
@Override
|
@Override
|
||||||
public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.SearchUserRequest request, Qos1PublishHandler.IMCallback callback) {
|
public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.SearchUserRequest request, Qos1PublishHandler.IMCallback callback) {
|
||||||
List<WFCMessage.User> users = m_messagesStore.searchUser(request.getKeyword(), request.getFuzzy(), request.getPage());
|
List<WFCMessage.User> users = m_messagesStore.searchUser(request.getKeyword(), request.getFuzzy(), request.getType(), request.getPage());
|
||||||
WFCMessage.SearchUserResult.Builder builder = WFCMessage.SearchUserResult.newBuilder();
|
WFCMessage.SearchUserResult.Builder builder = WFCMessage.SearchUserResult.newBuilder();
|
||||||
builder.addAllEntry(users);
|
builder.addAllEntry(users);
|
||||||
byte[] data = builder.build().toByteArray();
|
byte[] data = builder.build().toByteArray();
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ import java.util.function.Function;
|
|||||||
|
|
||||||
import static cn.wildfirechat.common.IMExceptionEvent.EventType.RDBS_Exception;
|
import static cn.wildfirechat.common.IMExceptionEvent.EventType.RDBS_Exception;
|
||||||
import static cn.wildfirechat.proto.ProtoConstants.PersistFlag.Transparent;
|
import static cn.wildfirechat.proto.ProtoConstants.PersistFlag.Transparent;
|
||||||
|
import static cn.wildfirechat.proto.ProtoConstants.UserSearchUserType.UserSearchUserType_ONLY_ROBOT;
|
||||||
|
import static cn.wildfirechat.proto.ProtoConstants.UserSearchUserType.UserSearchUserType_ONLY_USER;
|
||||||
import static io.moquette.BrokerConstants.GROUP_INFO_MARK_DELETION;
|
import static io.moquette.BrokerConstants.GROUP_INFO_MARK_DELETION;
|
||||||
import static io.moquette.server.Constants.MAX_MESSAGE_QUEUE;
|
import static io.moquette.server.Constants.MAX_MESSAGE_QUEUE;
|
||||||
import static cn.wildfirechat.proto.ProtoConstants.SearchUserType.*;
|
import static cn.wildfirechat.proto.ProtoConstants.SearchUserType.*;
|
||||||
@@ -169,7 +171,7 @@ public class DatabaseStore {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<WFCMessage.User> searchUserByNameMobileUserId(String keyword, int searchType) {
|
List<WFCMessage.User> searchUserByNameMobileUserId(String keyword, int searchType, int userType) {
|
||||||
ArrayList<WFCMessage.User> out = new ArrayList<>();
|
ArrayList<WFCMessage.User> out = new ArrayList<>();
|
||||||
Connection connection = null;
|
Connection connection = null;
|
||||||
PreparedStatement statement = null;
|
PreparedStatement statement = null;
|
||||||
@@ -203,7 +205,15 @@ public class DatabaseStore {
|
|||||||
sql += " where (`_name` = ? or `_mobile` = ? or `_uid` = ?) ";
|
sql += " where (`_name` = ? or `_mobile` = ? or `_uid` = ?) ";
|
||||||
}
|
}
|
||||||
|
|
||||||
sql += " and `_type` <> 2 and `_deleted` = 0"; //can search normal user(0) and robot(1) and admin(100), can not search things
|
if(userType == UserSearchUserType_ONLY_USER) {
|
||||||
|
sql += " and _type <> 2 "; //can not search device
|
||||||
|
sql += " and _type <> 1 ";
|
||||||
|
} else if(userType == UserSearchUserType_ONLY_ROBOT) {
|
||||||
|
sql += " and _type = 1 ";
|
||||||
|
} else {
|
||||||
|
sql += " and _type <> 2 "; //can not search device
|
||||||
|
}
|
||||||
|
sql += " and _deleted = 0 ";
|
||||||
|
|
||||||
if(searchType == SearchUserType_Name || searchType == SearchUserType_Mobile || searchType == SearchUserType_UserId) {
|
if(searchType == SearchUserType_Name || searchType == SearchUserType_Mobile || searchType == SearchUserType_UserId) {
|
||||||
sql += " limit 1";
|
sql += " limit 1";
|
||||||
@@ -408,7 +418,7 @@ public class DatabaseStore {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<WFCMessage.User> searchUserByDisplayName(String keyword, int page, List<WFCMessage.User> nameOrIdMatched) {
|
List<WFCMessage.User> searchUserByDisplayName(String keyword, int userType, int page, List<WFCMessage.User> nameOrIdMatched) {
|
||||||
Connection connection = null;
|
Connection connection = null;
|
||||||
PreparedStatement statement = null;
|
PreparedStatement statement = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
@@ -419,7 +429,18 @@ public class DatabaseStore {
|
|||||||
connection = DBUtil.getConnection();
|
connection = DBUtil.getConnection();
|
||||||
String sql = "select u._uid, u._name, u._display_name, u._portrait, u._mobile, u._gender, u._email, u._address, u._company, u._social, u._extra, u._dt, u._type " +
|
String sql = "select u._uid, u._name, u._display_name, u._portrait, u._mobile, u._gender, u._email, u._address, u._company, u._social, u._extra, u._dt, u._type " +
|
||||||
" from t_user u left join (select _uid, _value from t_user_setting where _scope = 27) s on u._uid = s._uid " +
|
" from t_user u left join (select _uid, _value from t_user_setting where _scope = 27) s on u._uid = s._uid " +
|
||||||
" where u._display_name like ? ESCAPE '!' and u._type <> 2 and u._deleted = 0 ";
|
" where u._display_name like ? ESCAPE '!' ";
|
||||||
|
|
||||||
|
if(userType == UserSearchUserType_ONLY_USER) {
|
||||||
|
sql += " and u._type <> 2 ";
|
||||||
|
sql += " and u._type <> 1 ";
|
||||||
|
} else if(userType == UserSearchUserType_ONLY_ROBOT) {
|
||||||
|
sql += " and u._type = 1 ";
|
||||||
|
} else {
|
||||||
|
sql += " and u._type <> 2 ";
|
||||||
|
}
|
||||||
|
sql += " and u._deleted = 0 ";
|
||||||
|
|
||||||
if(nameOrIdMatched.size() == 1) {
|
if(nameOrIdMatched.size() == 1) {
|
||||||
sql += " and u._uid <> ? and u._name <> ?";
|
sql += " and u._uid <> ? and u._name <> ?";
|
||||||
} else if(nameOrIdMatched.size() == 2) {
|
} else if(nameOrIdMatched.size() == 2) {
|
||||||
@@ -523,15 +544,15 @@ public class DatabaseStore {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<WFCMessage.User> searchUserFromDB(String keyword, int searchType, int page) {
|
List<WFCMessage.User> searchUserFromDB(String keyword, int searchType, int userType, int page) {
|
||||||
List<WFCMessage.User> nameOrIdMatched = searchUserByNameMobileUserId(keyword, searchType);
|
List<WFCMessage.User> nameOrIdMatched = searchUserByNameMobileUserId(keyword, searchType, userType);
|
||||||
List<WFCMessage.User> out = new ArrayList<>();
|
List<WFCMessage.User> out = new ArrayList<>();
|
||||||
if(page == 0) {
|
if(page == 0) {
|
||||||
out.addAll(nameOrIdMatched);
|
out.addAll(nameOrIdMatched);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(searchType == SearchUserType_General || searchType == SearchUserType_Name_Mobile_DisplayName) {
|
if(searchType == SearchUserType_General || searchType == SearchUserType_Name_Mobile_DisplayName) {
|
||||||
List<WFCMessage.User> general = searchUserByDisplayName(keyword, page, nameOrIdMatched);
|
List<WFCMessage.User> general = searchUserByDisplayName(keyword, userType, page, nameOrIdMatched);
|
||||||
general.removeAll(nameOrIdMatched);
|
general.removeAll(nameOrIdMatched);
|
||||||
out.addAll(general);
|
out.addAll(general);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ import java.util.concurrent.locks.Lock;
|
|||||||
import java.util.concurrent.locks.ReadWriteLock;
|
import java.util.concurrent.locks.ReadWriteLock;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||||
|
import java.util.function.BiFunction;
|
||||||
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;
|
||||||
@@ -167,6 +168,7 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
private Set<String> mAllowStrangerChatSet = new HashSet<>();
|
private Set<String> mAllowStrangerChatSet = new HashSet<>();
|
||||||
private Set<Integer> mAllowStrangerLineSet = new HashSet<>();
|
private Set<Integer> mAllowStrangerLineSet = new HashSet<>();
|
||||||
private boolean mDisableStrangerAddGroup = false;
|
private boolean mDisableStrangerAddGroup = false;
|
||||||
|
private boolean mGroupAllowPartSuccess = false;
|
||||||
|
|
||||||
private boolean mIDUseUUID = true;
|
private boolean mIDUseUUID = true;
|
||||||
|
|
||||||
@@ -205,8 +207,16 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
private boolean mBroadcastTargetFromUserTable = false;
|
private boolean mBroadcastTargetFromUserTable = false;
|
||||||
|
|
||||||
private boolean mForwardMessageWithClientInfo = false;
|
private boolean mForwardMessageWithClientInfo = false;
|
||||||
|
private boolean mForwardMessageWithSenderInfo = false;
|
||||||
|
private boolean mForwardMessageWithTargetInfo = false;
|
||||||
|
|
||||||
private boolean mRobotCallbackWithClientInfo = false;
|
private boolean mRobotCallbackWithClientInfo = false;
|
||||||
|
private boolean mRobotCallbackWithSenderInfo = false;
|
||||||
|
private boolean mRobotCallbackWithTargetInfo = false;
|
||||||
|
|
||||||
private boolean mChannelCallbackWithClientInfo = false;
|
private boolean mChannelCallbackWithClientInfo = false;
|
||||||
|
private boolean mChannelCallbackWithSenderInfo = false;
|
||||||
|
private boolean mChannelCallbackWithTargetInfo = false;
|
||||||
private boolean mChannelNewCallbackFeature = true;
|
private boolean mChannelNewCallbackFeature = true;
|
||||||
|
|
||||||
private Set<Integer> mUserHideProperties = new HashSet<>();
|
private Set<Integer> mUserHideProperties = new HashSet<>();
|
||||||
@@ -608,9 +618,13 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
mForwardMessageWithClientInfo = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.MESSAGE_Forward_With_Client_Info, "false"));
|
mForwardMessageWithClientInfo = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.MESSAGE_Forward_With_Client_Info, "false"));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {}
|
||||||
|
try {
|
||||||
}
|
mForwardMessageWithSenderInfo = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.MESSAGE_Forward_With_Sender_Info, "false"));
|
||||||
|
} catch (Exception e) {}
|
||||||
|
try {
|
||||||
|
mForwardMessageWithTargetInfo = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.MESSAGE_Forward_With_Target_Info, "false"));
|
||||||
|
} catch (Exception e) {}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mBroadcastTargetFromUserTable = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.BROADCAST_Target_From_User_Table, "false"));
|
mBroadcastTargetFromUserTable = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.BROADCAST_Target_From_User_Table, "false"));
|
||||||
@@ -619,18 +633,33 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mRobotCallbackWithClientInfo = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.ROBOT_Callback_With_Client_Info, "false"));
|
mGroupAllowPartSuccess = "true".equals(server.getConfig().getProperty(BrokerConstants.GROUP_ADD_MEMBER_ALLOW_PART_SUCCESS, "false"));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
mRobotCallbackWithClientInfo = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.ROBOT_Callback_With_Client_Info, "false"));
|
||||||
|
} catch (Exception e) {}
|
||||||
|
try {
|
||||||
|
mRobotCallbackWithSenderInfo = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.ROBOT_Callback_With_Sender_Info, "false"));
|
||||||
|
} catch (Exception e) {}
|
||||||
|
try {
|
||||||
|
mRobotCallbackWithTargetInfo = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.ROBOT_Callback_With_Target_Info, "false"));
|
||||||
|
} catch (Exception e) {}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mChannelCallbackWithClientInfo = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.CHANNEL_Callback_With_Client_Info, "false"));
|
mChannelCallbackWithClientInfo = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.CHANNEL_Callback_With_Client_Info, "false"));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {}
|
||||||
}
|
try {
|
||||||
|
mChannelCallbackWithSenderInfo = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.CHANNEL_Callback_With_Sender_Info, "false"));
|
||||||
|
} catch (Exception e) {}
|
||||||
|
try {
|
||||||
|
mChannelCallbackWithTargetInfo = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.CHANNEL_Callback_With_Target_Info, "false"));
|
||||||
|
} catch (Exception e) {}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mChannelNewCallbackFeature = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.CHANNEL_New_Callback_Feature, "true"));
|
mChannelNewCallbackFeature = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.CHANNEL_New_Callback_Feature, "true"));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {}
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mRecallForwardUrl = server.getConfig().getProperty(BrokerConstants.MESSAGE_RecallMsg_Forward_Url);
|
mRecallForwardUrl = server.getConfig().getProperty(BrokerConstants.MESSAGE_RecallMsg_Forward_Url);
|
||||||
@@ -816,6 +845,18 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
return pullType;
|
return pullType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final Map<String, Integer> unreceivedMsgCount = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void increaseUnreceivedMsgCount(String user) {
|
||||||
|
unreceivedMsgCount.compute(user, (s, integer) -> integer == null ? 1 : integer+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getUnreceivedMsgCount(String user) {
|
||||||
|
return unreceivedMsgCount.getOrDefault(user, 0);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<String> getAllEnds() {
|
public Set<String> getAllEnds() {
|
||||||
return databaseStore.getAllEnds(mBroadcastTargetFromUserTable);
|
return databaseStore.getAllEnds(mBroadcastTargetFromUserTable);
|
||||||
@@ -830,7 +871,7 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
MemorySessionStore.Session session = m_Server.getStore().sessionsStore().getSession(exceptClientId);
|
MemorySessionStore.Session session = m_Server.getStore().sessionsStore().getSession(exceptClientId);
|
||||||
session.refreshLastActiveTime();
|
session.refreshLastActiveTime();
|
||||||
if (pullType != ProtoConstants.PullType.Pull_ChatRoom) {
|
if (pullType != ProtoConstants.PullType.Pull_ChatRoom) {
|
||||||
session.setUnReceivedMsgs(0);
|
unreceivedMsgCount.put(user, 0);
|
||||||
} else {
|
} else {
|
||||||
session.refreshLastChatroomActiveTime();
|
session.refreshLastChatroomActiveTime();
|
||||||
}
|
}
|
||||||
@@ -900,11 +941,13 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
session.setPullHistoryMsg(true);
|
session.setPullHistoryMsg(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long previousCurrent;
|
||||||
while (true) {
|
while (true) {
|
||||||
Map.Entry<Long, Long> entry = maps.higherEntry(current);
|
Map.Entry<Long, Long> entry = maps.higherEntry(current);
|
||||||
if (entry == null) {
|
if (entry == null) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
previousCurrent = current;
|
||||||
current = entry.getKey();
|
current = entry.getKey();
|
||||||
long targetMessageId = entry.getValue();
|
long targetMessageId = entry.getValue();
|
||||||
|
|
||||||
@@ -933,6 +976,8 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
if (size >= 512 * 1024) { //3M
|
if (size >= 512 * 1024) { //3M
|
||||||
if(builder.getMessageCount() == 0){
|
if(builder.getMessageCount() == 0){
|
||||||
builder.addMessage(bundle.getMessage());
|
builder.addMessage(bundle.getMessage());
|
||||||
|
} else {
|
||||||
|
current = previousCurrent;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1256,7 +1301,7 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ErrorCode canAddGroupMembers(String fromUser, List<WFCMessage.GroupMember> memberList) {
|
public ErrorCode canAddGroupMembers(String fromUser, List<WFCMessage.GroupMember> memberList, Map<String, Integer> failedMembers) {
|
||||||
HazelcastInstance hzInstance = m_Server.getHazelcastInstance();
|
HazelcastInstance hzInstance = m_Server.getHazelcastInstance();
|
||||||
MultiMap<String, FriendData> friendsMap = hzInstance.getMultiMap(USER_FRIENDS);
|
MultiMap<String, FriendData> friendsMap = hzInstance.getMultiMap(USER_FRIENDS);
|
||||||
IMap<String, WFCMessage.User> mUserMap = hzInstance.getMap(USERS);
|
IMap<String, WFCMessage.User> mUserMap = hzInstance.getMap(USERS);
|
||||||
@@ -1282,7 +1327,12 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
for (FriendData friendData : friendDatas) {
|
for (FriendData friendData : friendDatas) {
|
||||||
if (friendData.getFriendUid().equals(fromUser)) {
|
if (friendData.getFriendUid().equals(fromUser)) {
|
||||||
if (friendData.getBlacked() == 1) {
|
if (friendData.getBlacked() == 1) {
|
||||||
return ErrorCode.ERROR_CODE_IN_BLACK_LIST;
|
LOG.error("Add group member failure, because inviter {} is blocked by invitee {}", fromUser, targetUser);
|
||||||
|
if(isGroupAllowPartSuccess()) {
|
||||||
|
failedMembers.put(targetUser, 1); //black
|
||||||
|
} else {
|
||||||
|
return ErrorCode.ERROR_CODE_IN_BLACK_LIST;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (friendData.getState() == 0) {
|
if (friendData.getState() == 0) {
|
||||||
allow = true;
|
allow = true;
|
||||||
@@ -1306,7 +1356,11 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ErrorCode.ERROR_CODE_NOT_RIGHT;
|
if(isGroupAllowPartSuccess()) {
|
||||||
|
failedMembers.put(targetUser, 2);//stranger
|
||||||
|
} else {
|
||||||
|
return ErrorCode.ERROR_CODE_NOT_RIGHT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (WFCMessage.GroupMember groupMember : memberList) {
|
for (WFCMessage.GroupMember groupMember : memberList) {
|
||||||
@@ -1323,7 +1377,12 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
for (FriendData friendData : friendDatas) {
|
for (FriendData friendData : friendDatas) {
|
||||||
if (friendData.getFriendUid().equals(fromUser)) {
|
if (friendData.getFriendUid().equals(fromUser)) {
|
||||||
if (friendData.getBlacked() == 1) {
|
if (friendData.getBlacked() == 1) {
|
||||||
return ErrorCode.ERROR_CODE_IN_BLACK_LIST;
|
LOG.error("Add group member failure, because inviter {} is blocked by invitee {}", fromUser, targetUser);
|
||||||
|
if(isGroupAllowPartSuccess()) {
|
||||||
|
failedMembers.put(targetUser, 1); //black
|
||||||
|
} else {
|
||||||
|
return ErrorCode.ERROR_CODE_IN_BLACK_LIST;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1335,7 +1394,7 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WFCMessage.GroupInfo createGroup(String fromUser, WFCMessage.GroupInfo groupInfo, List<WFCMessage.GroupMember> memberList, String memberExtra, boolean isAdmin) {
|
public WFCMessage.GroupInfo createGroup(String fromUser, WFCMessage.GroupInfo groupInfo, List<WFCMessage.GroupMember> memberList, String memberExtra, boolean isAdmin, Map<String, Integer> failedMembers) {
|
||||||
HazelcastInstance hzInstance = m_Server.getHazelcastInstance();
|
HazelcastInstance hzInstance = m_Server.getHazelcastInstance();
|
||||||
IMap<String, WFCMessage.GroupInfo> mIMap = hzInstance.getMap(GROUPS_MAP);
|
IMap<String, WFCMessage.GroupInfo> mIMap = hzInstance.getMap(GROUPS_MAP);
|
||||||
|
|
||||||
@@ -1357,6 +1416,9 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
List<WFCMessage.GroupMember> updatedMemberList = new ArrayList<>();
|
List<WFCMessage.GroupMember> updatedMemberList = new ArrayList<>();
|
||||||
boolean hasOwnerMember = false;
|
boolean hasOwnerMember = false;
|
||||||
for (WFCMessage.GroupMember member : memberList) {
|
for (WFCMessage.GroupMember member : memberList) {
|
||||||
|
if(failedMembers.containsKey(member.getMemberId())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
WFCMessage.GroupMember.Builder builder = member.toBuilder();
|
WFCMessage.GroupMember.Builder builder = member.toBuilder();
|
||||||
builder.setUpdateDt(dt).setCreateDt(dt);
|
builder.setUpdateDt(dt).setCreateDt(dt);
|
||||||
if (member.getMemberId().equals(owner)) {
|
if (member.getMemberId().equals(owner)) {
|
||||||
@@ -1551,7 +1613,7 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ErrorCode addGroupMembers(String operator, boolean isAdmin, String groupId, List<WFCMessage.GroupMember> memberList, String extra) {
|
public ErrorCode addGroupMembers(String operator, boolean isAdmin, String groupId, List<WFCMessage.GroupMember> memberList, String extra, Map<String, Integer> failedMembers) {
|
||||||
HazelcastInstance hzInstance = m_Server.getHazelcastInstance();
|
HazelcastInstance hzInstance = m_Server.getHazelcastInstance();
|
||||||
IMap<String, WFCMessage.GroupInfo> mIMap = hzInstance.getMap(GROUPS_MAP);
|
IMap<String, WFCMessage.GroupInfo> mIMap = hzInstance.getMap(GROUPS_MAP);
|
||||||
|
|
||||||
@@ -1624,6 +1686,10 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
List<WFCMessage.GroupMember> tmp = new ArrayList<>();
|
List<WFCMessage.GroupMember> tmp = new ArrayList<>();
|
||||||
int newMemberCount = 0;
|
int newMemberCount = 0;
|
||||||
for (WFCMessage.GroupMember member : memberList) {
|
for (WFCMessage.GroupMember member : memberList) {
|
||||||
|
if(failedMembers.containsKey(member.getMemberId())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (existMemberIds.contains(member.getMemberId()) && member.getType() != GroupMemberType_Removed) {
|
if (existMemberIds.contains(member.getMemberId()) && member.getType() != GroupMemberType_Removed) {
|
||||||
if(!isAdmin)
|
if(!isAdmin)
|
||||||
continue;
|
continue;
|
||||||
@@ -1656,7 +1722,11 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
|
|
||||||
if (memberList.size() == 0) {
|
if (memberList.size() == 0) {
|
||||||
if (!isAdmin) {
|
if (!isAdmin) {
|
||||||
return ErrorCode.ERROR_CODE_ALREADY_IN_GROUP;
|
if(failedMembers.isEmpty()) {
|
||||||
|
return ErrorCode.ERROR_CODE_ALREADY_IN_GROUP;
|
||||||
|
} else {
|
||||||
|
return ErrorCode.ERROR_CODE_SUCCESS;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return ErrorCode.ERROR_CODE_SUCCESS;
|
return ErrorCode.ERROR_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
@@ -1675,6 +1745,10 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
|
|
||||||
List<String> memberIds = new ArrayList<>();
|
List<String> memberIds = new ArrayList<>();
|
||||||
for (WFCMessage.GroupMember member : memberList) {
|
for (WFCMessage.GroupMember member : memberList) {
|
||||||
|
if(failedMembers.containsKey(member.getMemberId())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (member.getType() != GroupMemberType_Removed) {
|
if (member.getType() != GroupMemberType_Removed) {
|
||||||
memberIds.add(member.getMemberId());
|
memberIds.add(member.getMemberId());
|
||||||
}
|
}
|
||||||
@@ -1937,6 +2011,14 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
newInfoBuilder.setPrivateChat(Integer.parseInt(value));
|
newInfoBuilder.setPrivateChat(Integer.parseInt(value));
|
||||||
else if(modifyType == Modify_Group_Searchable)
|
else if(modifyType == Modify_Group_Searchable)
|
||||||
newInfoBuilder.setSearchable(Integer.parseInt(value));
|
newInfoBuilder.setSearchable(Integer.parseInt(value));
|
||||||
|
else if(modifyType == Modify_Group_Type) {
|
||||||
|
int newType = Integer.parseInt(value);
|
||||||
|
if(newType < 0 || newType > ProtoConstants.GroupType.GroupType_Organization) {
|
||||||
|
LOG.error("modify group type failure, invalid group type {}", newType);
|
||||||
|
return ErrorCode.INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
newInfoBuilder.setType(newType);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return ErrorCode.INVALID_PARAMETER;
|
return ErrorCode.INVALID_PARAMETER;
|
||||||
|
|
||||||
@@ -2454,7 +2536,7 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
}
|
}
|
||||||
boolean isExpired = false;
|
boolean isExpired = false;
|
||||||
if (!canRecall && message.getFromUser().equals(operatorId)) {
|
if (!canRecall && message.getFromUser().equals(operatorId)) {
|
||||||
if (now - message.getServerTimestamp() > mRecallTimeLimit * 1000) {
|
if (mRecallTimeLimit >= 0 && now - message.getServerTimestamp() > mRecallTimeLimit * 1000) {
|
||||||
isExpired = true;
|
isExpired = true;
|
||||||
} else {
|
} else {
|
||||||
canRecall = true;
|
canRecall = true;
|
||||||
@@ -3075,7 +3157,7 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<WFCMessage.User> searchUser(String keyword, int searchType, int page) {
|
public List<WFCMessage.User> searchUser(String keyword, int searchType, int userType, int page) {
|
||||||
if (mDisableSearch) {
|
if (mDisableSearch) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
@@ -3096,7 +3178,7 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
return databaseStore.searchUserFromDB(keyword, searchType, page);
|
return databaseStore.searchUserFromDB(keyword, searchType, userType, page);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -4458,7 +4540,7 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
} else if(modifyType == Modify_Channel_Menu) {
|
} else if(modifyType == Modify_Channel_Menu) {
|
||||||
OutputGetChannelInfo.OutputMenuList outputMenuButtons = GsonUtil.gson.fromJson(value, OutputGetChannelInfo.OutputMenuList.class);
|
OutputGetChannelInfo.OutputMenuList outputMenuButtons = GsonUtil.gson.fromJson(value, OutputGetChannelInfo.OutputMenuList.class);
|
||||||
if (!outputMenuButtons.isEmpty()) {
|
if (!outputMenuButtons.isEmpty()) {
|
||||||
for (OutputGetChannelInfo.OutputMenu outputMenuButton : outputMenuButtons) {
|
for (PojoChannelMenu outputMenuButton : outputMenuButtons) {
|
||||||
newInfoBuilder.addMenu(outputMenuButton.toPbInfo());
|
newInfoBuilder.addMenu(outputMenuButton.toPbInfo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4714,6 +4796,11 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
return mGroupVisibleQuitKickoffNotification;
|
return mGroupVisibleQuitKickoffNotification;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isGroupAllowPartSuccess() {
|
||||||
|
return mGroupAllowPartSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getGroupForbiddenClientOperation() {
|
public int getGroupForbiddenClientOperation() {
|
||||||
return mGroupForbiddenClientOperation;
|
return mGroupForbiddenClientOperation;
|
||||||
@@ -4724,16 +4811,46 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
return mForwardMessageWithClientInfo;
|
return mForwardMessageWithClientInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isForwardMessageWithSenderInfo() {
|
||||||
|
return mForwardMessageWithSenderInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isForwardMessageWithTargetInfo() {
|
||||||
|
return mForwardMessageWithTargetInfo;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isRobotCallbackWithClientInfo() {
|
public boolean isRobotCallbackWithClientInfo() {
|
||||||
return mRobotCallbackWithClientInfo;
|
return mRobotCallbackWithClientInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRobotCallbackWithSenderInfo() {
|
||||||
|
return mRobotCallbackWithSenderInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRobotCallbackWithTargetInfo() {
|
||||||
|
return mRobotCallbackWithTargetInfo;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isChannelCallbackWithClientInfo() {
|
public boolean isChannelCallbackWithClientInfo() {
|
||||||
return mChannelCallbackWithClientInfo;
|
return mChannelCallbackWithClientInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isChannelCallbackWithSenderInfo() {
|
||||||
|
return mChannelCallbackWithSenderInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isChannelCallbackWithTargetInfo() {
|
||||||
|
return mChannelCallbackWithTargetInfo;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isChannelNewCallbackFeature() {
|
public boolean isChannelNewCallbackFeature() {
|
||||||
return mChannelNewCallbackFeature;
|
return mChannelNewCallbackFeature;
|
||||||
|
|||||||
@@ -92,10 +92,6 @@ public class MemorySessionStore implements ISessionsStore {
|
|||||||
return unReceivedMsgs;
|
return unReceivedMsgs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUnReceivedMsgs(int unReceivedMsgs) {
|
|
||||||
this.unReceivedMsgs = unReceivedMsgs;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPushType() {
|
public int getPushType() {
|
||||||
return pushType;
|
return pushType;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,9 +102,9 @@ public interface IMessagesStore {
|
|||||||
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);
|
||||||
long insertUserMessages(String sender, int conversationType, String target, int line, int messageContentType, String userId, long messageId, boolean directing);
|
long insertUserMessages(String sender, int conversationType, String target, int line, int messageContentType, String userId, long messageId, boolean directing);
|
||||||
ErrorCode canAddGroupMembers(String operator, List<WFCMessage.GroupMember> memberList);
|
ErrorCode canAddGroupMembers(String operator, List<WFCMessage.GroupMember> memberList, Map<String, Integer> failedMembers);
|
||||||
WFCMessage.GroupInfo createGroup(String operator, WFCMessage.GroupInfo groupInfo, List<WFCMessage.GroupMember> memberList, String memberExtra, boolean isAdmin);
|
WFCMessage.GroupInfo createGroup(String operator, WFCMessage.GroupInfo groupInfo, List<WFCMessage.GroupMember> memberList, String memberExtra, boolean isAdmin, Map<String, Integer> failedMembers);
|
||||||
ErrorCode addGroupMembers(String operator, boolean isAdmin, String groupId, List<WFCMessage.GroupMember> memberList, String extra);
|
ErrorCode addGroupMembers(String operator, boolean isAdmin, String groupId, List<WFCMessage.GroupMember> memberList, String extra, Map<String, Integer> failedMembers);
|
||||||
ErrorCode kickoffGroupMembers(String operator, boolean isAdmin, String groupId, List<String> memberList);
|
ErrorCode kickoffGroupMembers(String operator, boolean isAdmin, String groupId, List<String> memberList);
|
||||||
ErrorCode quitGroup(String operator, String groupId, boolean admin);
|
ErrorCode quitGroup(String operator, String groupId, boolean admin);
|
||||||
void clearUserGroups(String userId);
|
void clearUserGroups(String userId);
|
||||||
@@ -154,7 +154,7 @@ public interface IMessagesStore {
|
|||||||
WFCMessage.User getUserInfoByName(String name);
|
WFCMessage.User getUserInfoByName(String name);
|
||||||
WFCMessage.User getUserInfoByMobile(String mobile);
|
WFCMessage.User getUserInfoByMobile(String mobile);
|
||||||
List<WFCMessage.User> getUserInfosByEmail(String email);
|
List<WFCMessage.User> getUserInfosByEmail(String email);
|
||||||
List<WFCMessage.User> searchUser(String keyword, int searchType, int page);
|
List<WFCMessage.User> searchUser(String keyword, int searchType, int userType, int page);
|
||||||
|
|
||||||
List<WFCMessage.User> getUserInfoList(int count, int offset);
|
List<WFCMessage.User> getUserInfoList(int count, int offset);
|
||||||
|
|
||||||
@@ -235,6 +235,9 @@ public interface IMessagesStore {
|
|||||||
|
|
||||||
WFCMessage.Message getMessage(long messageId);
|
WFCMessage.Message getMessage(long messageId);
|
||||||
|
|
||||||
|
void increaseUnreceivedMsgCount(String user);
|
||||||
|
int getUnreceivedMsgCount(String user);
|
||||||
|
|
||||||
boolean isAllowClientCustomGroupNotification();
|
boolean isAllowClientCustomGroupNotification();
|
||||||
boolean isAllowRobotCustomGroupNotification();
|
boolean isAllowRobotCustomGroupNotification();
|
||||||
int getVisibleQuitKickoffNotification();
|
int getVisibleQuitKickoffNotification();
|
||||||
@@ -242,10 +245,18 @@ public interface IMessagesStore {
|
|||||||
int getGroupForbiddenClientOperation();
|
int getGroupForbiddenClientOperation();
|
||||||
|
|
||||||
boolean isForwardMessageWithClientInfo();
|
boolean isForwardMessageWithClientInfo();
|
||||||
boolean isRobotCallbackWithClientInfo();
|
boolean isForwardMessageWithSenderInfo();
|
||||||
boolean isChannelCallbackWithClientInfo();
|
boolean isForwardMessageWithTargetInfo();
|
||||||
boolean isChannelNewCallbackFeature();
|
|
||||||
|
|
||||||
|
boolean isRobotCallbackWithClientInfo();
|
||||||
|
boolean isRobotCallbackWithSenderInfo();
|
||||||
|
boolean isRobotCallbackWithTargetInfo();
|
||||||
|
|
||||||
|
boolean isChannelCallbackWithClientInfo();
|
||||||
|
boolean isChannelCallbackWithSenderInfo();
|
||||||
|
boolean isChannelCallbackWithTargetInfo();
|
||||||
|
boolean isChannelNewCallbackFeature();
|
||||||
|
boolean isGroupAllowPartSuccess();
|
||||||
boolean isRobotAutoAcceptFriendRequest();
|
boolean isRobotAutoAcceptFriendRequest();
|
||||||
|
|
||||||
long getPushExpiredTimes();
|
long getPushExpiredTimes();
|
||||||
|
|||||||
@@ -16,14 +16,13 @@
|
|||||||
|
|
||||||
package io.moquette.spi.impl;
|
package io.moquette.spi.impl;
|
||||||
|
|
||||||
import cn.wildfirechat.pojos.OutputClient;
|
import org.json.simple.JSONObject;
|
||||||
import cn.wildfirechat.pojos.OutputMessageData;
|
import cn.wildfirechat.pojos.*;
|
||||||
import cn.wildfirechat.proto.ProtoConstants;
|
import cn.wildfirechat.proto.ProtoConstants;
|
||||||
import cn.wildfirechat.proto.WFCMessage;
|
import cn.wildfirechat.proto.WFCMessage;
|
||||||
import cn.wildfirechat.push.PushServer;
|
import cn.wildfirechat.push.PushServer;
|
||||||
import com.hazelcast.core.HazelcastInstance;
|
import com.hazelcast.core.HazelcastInstance;
|
||||||
import com.hazelcast.util.StringUtil;
|
import com.hazelcast.util.StringUtil;
|
||||||
import cn.wildfirechat.pojos.OutputNotifyChannelSubscribeStatus;
|
|
||||||
import com.xiaoleilu.loServer.model.FriendData;
|
import com.xiaoleilu.loServer.model.FriendData;
|
||||||
import io.moquette.persistence.*;
|
import io.moquette.persistence.*;
|
||||||
import io.moquette.persistence.MemorySessionStore.Session;
|
import io.moquette.persistence.MemorySessionStore.Session;
|
||||||
@@ -34,12 +33,14 @@ import io.moquette.spi.ISessionsStore;
|
|||||||
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.mqtt.*;
|
import io.netty.handler.codec.mqtt.*;
|
||||||
|
import org.json.simple.parser.JSONParser;
|
||||||
import win.liyufan.im.*;
|
import win.liyufan.im.*;
|
||||||
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
@@ -47,6 +48,7 @@ import java.util.concurrent.Executors;
|
|||||||
import java.util.function.BiFunction;
|
import java.util.function.BiFunction;
|
||||||
|
|
||||||
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.ConversationType.*;
|
||||||
import static cn.wildfirechat.proto.ProtoConstants.PersistFlag.Transparent;
|
import static cn.wildfirechat.proto.ProtoConstants.PersistFlag.Transparent;
|
||||||
|
|
||||||
public class MessagesPublisher {
|
public class MessagesPublisher {
|
||||||
@@ -157,7 +159,7 @@ public class MessagesPublisher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void publish2Receivers(String sender, int conversationType, String target, int line, long messageId, Collection<String> receivers, String pushContent, String pushData, String exceptClientId, int pullType, int messageContentType, long serverTime, int mentionType, List<String> mentionTargets, int persistFlag, boolean directing) {
|
private void publish2Receivers(String sender, int conversationType, String target, int line, long messageId, Collection<String> receivers, String pushContent, String pushData, long callStartUid, String exceptClientId, int pullType, int messageContentType, long serverTime, int mentionType, List<String> mentionTargets, int persistFlag, boolean directing) {
|
||||||
if (persistFlag == Transparent) {
|
if (persistFlag == Transparent) {
|
||||||
publishTransparentMessage2Receivers(messageId, receivers, pullType, exceptClientId);
|
publishTransparentMessage2Receivers(messageId, receivers, pullType, exceptClientId);
|
||||||
return;
|
return;
|
||||||
@@ -176,19 +178,10 @@ public class MessagesPublisher {
|
|||||||
if (message == null) {
|
if (message == null) {
|
||||||
message = m_messagesStore.getMessage(messageId);
|
message = m_messagesStore.getMessage(messageId);
|
||||||
}
|
}
|
||||||
OutputClient outputClient = null;
|
OutputMessageData outputMessageData = getOutputMessageWithExtraInfo(message, exceptClientId, m_messagesStore.isRobotCallbackWithClientInfo() , m_messagesStore.isRobotCallbackWithSenderInfo(), m_messagesStore.isRobotCallbackWithTargetInfo());
|
||||||
if(m_messagesStore.isRobotCallbackWithClientInfo() && !StringUtil.isNullOrEmpty(exceptClientId)) {
|
|
||||||
Session session = m_sessionsStore.getSession(exceptClientId);
|
|
||||||
if(session != null && session.getUsername().equals(sender)) {
|
|
||||||
outputClient = new OutputClient(session.getPlatform(), exceptClientId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final WFCMessage.Message finalMsg = message;
|
|
||||||
OutputClient finalOutputClient = outputClient;
|
|
||||||
Server.getServer().getCallbackScheduler().execute(() -> {
|
Server.getServer().getCallbackScheduler().execute(() -> {
|
||||||
try {
|
try {
|
||||||
HttpUtils.httpJsonPost(robot.getCallback(), GsonUtil.gson.toJson(OutputMessageData.fromProtoMessage(finalMsg, finalOutputClient), OutputMessageData.class), HttpUtils.HttpPostType.POST_TYPE_Robot_Message_Callback);
|
HttpUtils.httpJsonPost(robot.getCallback(), GsonUtil.gson.toJson(outputMessageData, OutputMessageData.class), HttpUtils.HttpPostType.POST_TYPE_Robot_Message_Callback);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Utility.printExecption(LOG, e, EVENT_CALLBACK_Exception);
|
Utility.printExecption(LOG, e, EVENT_CALLBACK_Exception);
|
||||||
@@ -283,7 +276,7 @@ public class MessagesPublisher {
|
|||||||
|
|
||||||
if (!user.equals(sender)) {
|
if (!user.equals(sender)) {
|
||||||
WFCMessage.Conversation conversation;
|
WFCMessage.Conversation conversation;
|
||||||
if (conversationType == ProtoConstants.ConversationType.ConversationType_Private) {
|
if (conversationType == ConversationType_Private) {
|
||||||
conversation = WFCMessage.Conversation.newBuilder().setType(conversationType).setLine(line).setTarget(sender).build();
|
conversation = WFCMessage.Conversation.newBuilder().setType(conversationType).setLine(line).setTarget(sender).build();
|
||||||
} else {
|
} else {
|
||||||
conversation = WFCMessage.Conversation.newBuilder().setType(conversationType).setLine(line).setTarget(target).build();
|
conversation = WFCMessage.Conversation.newBuilder().setType(conversationType).setLine(line).setTarget(target).build();
|
||||||
@@ -322,7 +315,7 @@ public class MessagesPublisher {
|
|||||||
|
|
||||||
if (!StringUtil.isNullOrEmpty(pushContent) || messageContentType == 400) {
|
if (!StringUtil.isNullOrEmpty(pushContent) || messageContentType == 400) {
|
||||||
if (!isConvSilent && (persistFlag & 0x02) > 0) {
|
if (!isConvSilent && (persistFlag & 0x02) > 0) {
|
||||||
targetSession.setUnReceivedMsgs(targetSession.getUnReceivedMsgs() + 1);
|
m_messagesStore.increaseUnreceivedMsgCount(user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -398,7 +391,7 @@ public class MessagesPublisher {
|
|||||||
|
|
||||||
if(!sendNameLoaded) {
|
if(!sendNameLoaded) {
|
||||||
List<String> list = new ArrayList<>();
|
List<String> list = new ArrayList<>();
|
||||||
senderName = getUserDisplayName(sender, conversationType == ProtoConstants.ConversationType.ConversationType_Group ? target : null, list);
|
senderName = getUserDisplayName(sender, conversationType == ConversationType_Group ? target : null, list);
|
||||||
if(!list.isEmpty()) {
|
if(!list.isEmpty()) {
|
||||||
senderPortrait = list.get(0);
|
senderPortrait = list.get(0);
|
||||||
}
|
}
|
||||||
@@ -421,13 +414,25 @@ public class MessagesPublisher {
|
|||||||
name = fd.getAlias();
|
name = fd.getAlias();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.messageSender.sendPush(sender, conversationType, target, line, messageId, targetSession.getClientID(), pushContent, pushData, messageContentType, serverTime, name, senderPortrait, targetName, targetPortrait, targetSession.getUnReceivedMsgs(), curMentionType, isHiddenDetail, targetSession.getLanguage());
|
|
||||||
|
this.messageSender.sendPush(sender, conversationType, target, line, messageId, targetSession.getClientID(), pushContent, pushData, callStartUid, messageContentType, serverTime, name, senderPortrait, targetName, targetPortrait, m_messagesStore.getUnreceivedMsgCount(user), curMentionType, isHiddenDetail, targetSession.getLanguage(), getExistBadgeNumber(user));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getExistBadgeNumber(String user) {
|
||||||
|
int existBadgeNumber = 0;
|
||||||
|
WFCMessage.UserSettingEntry userSettingData = m_messagesStore.getUserSetting(user, UserSettingScope.kUserSettingScopeSyncBadge, "");
|
||||||
|
if(userSettingData != null && !StringUtil.isNullOrEmpty(userSettingData.getValue())) {
|
||||||
|
try {
|
||||||
|
existBadgeNumber = Integer.parseInt(userSettingData.getValue());
|
||||||
|
} catch (NumberFormatException e) {}
|
||||||
|
}
|
||||||
|
return existBadgeNumber;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean sendOfflineNotify(String clientId) {
|
public boolean sendOfflineNotify(String clientId) {
|
||||||
boolean targetIsActive = this.connectionDescriptors.isConnected(clientId);
|
boolean targetIsActive = this.connectionDescriptors.isConnected(clientId);
|
||||||
if (targetIsActive) {
|
if (targetIsActive) {
|
||||||
@@ -486,19 +491,10 @@ public class MessagesPublisher {
|
|||||||
if (userInfo != null && userInfo.getType() == ProtoConstants.UserType.UserType_Robot) {
|
if (userInfo != null && userInfo.getType() == ProtoConstants.UserType.UserType_Robot) {
|
||||||
WFCMessage.Robot robot = m_messagesStore.getRobot(user);
|
WFCMessage.Robot robot = m_messagesStore.getRobot(user);
|
||||||
if (robot != null && !StringUtil.isNullOrEmpty(robot.getCallback())) {
|
if (robot != null && !StringUtil.isNullOrEmpty(robot.getCallback())) {
|
||||||
OutputClient outputClient = null;
|
OutputMessageData outputMessageData = getOutputMessageWithExtraInfo(message, exceptClientId, m_messagesStore.isRobotCallbackWithClientInfo() , m_messagesStore.isRobotCallbackWithSenderInfo(), m_messagesStore.isRobotCallbackWithTargetInfo());
|
||||||
if(m_messagesStore.isRobotCallbackWithClientInfo() && !StringUtil.isNullOrEmpty(exceptClientId)) {
|
|
||||||
Session session = m_sessionsStore.getSession(exceptClientId);
|
|
||||||
if(session != null && session.getUsername().equals(message.getFromUser())) {
|
|
||||||
outputClient = new OutputClient(session.getPlatform(), exceptClientId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final WFCMessage.Message finalMsg = message;
|
|
||||||
OutputClient finalOutputClient = outputClient;
|
|
||||||
Server.getServer().getCallbackScheduler().execute(() -> {
|
Server.getServer().getCallbackScheduler().execute(() -> {
|
||||||
try {
|
try {
|
||||||
HttpUtils.httpJsonPost(robot.getCallback(), GsonUtil.gson.toJson(OutputMessageData.fromProtoMessage(finalMsg, finalOutputClient), OutputMessageData.class), HttpUtils.HttpPostType.POST_TYPE_Robot_Message_Callback);
|
HttpUtils.httpJsonPost(robot.getCallback(), GsonUtil.gson.toJson(outputMessageData, OutputMessageData.class), HttpUtils.HttpPostType.POST_TYPE_Robot_Message_Callback);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Utility.printExecption(LOG, e, EVENT_CALLBACK_Exception);
|
Utility.printExecption(LOG, e, EVENT_CALLBACK_Exception);
|
||||||
@@ -530,9 +526,9 @@ public class MessagesPublisher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String getTargetName(String targetId, int cnvType, String fromUser, List<String> portraitList) {
|
String getTargetName(String targetId, int cnvType, String fromUser, List<String> portraitList) {
|
||||||
if (cnvType == ProtoConstants.ConversationType.ConversationType_Private) {
|
if (cnvType == ConversationType_Private) {
|
||||||
return getUserDisplayName(targetId, null, portraitList);
|
return getUserDisplayName(targetId, null, portraitList);
|
||||||
} else if(cnvType == ProtoConstants.ConversationType.ConversationType_Group) {
|
} else if(cnvType == ConversationType_Group) {
|
||||||
WFCMessage.GroupInfo group = m_messagesStore.getGroupInfo(targetId);
|
WFCMessage.GroupInfo group = m_messagesStore.getGroupInfo(targetId);
|
||||||
if(group != null) {
|
if(group != null) {
|
||||||
if(!StringUtil.isNullOrEmpty(group.getPortrait())) {
|
if(!StringUtil.isNullOrEmpty(group.getPortrait())) {
|
||||||
@@ -545,7 +541,7 @@ public class MessagesPublisher {
|
|||||||
}
|
}
|
||||||
return group.getName();
|
return group.getName();
|
||||||
}
|
}
|
||||||
} else if(cnvType == ProtoConstants.ConversationType.ConversationType_Channel) {
|
} else if(cnvType == ConversationType_Channel) {
|
||||||
WFCMessage.ChannelInfo channelInfo = m_messagesStore.getChannelInfo(targetId);
|
WFCMessage.ChannelInfo channelInfo = m_messagesStore.getChannelInfo(targetId);
|
||||||
if (channelInfo != null) {
|
if (channelInfo != null) {
|
||||||
if(!StringUtil.isNullOrEmpty(channelInfo.getPortrait())) {
|
if(!StringUtil.isNullOrEmpty(channelInfo.getPortrait())) {
|
||||||
@@ -602,7 +598,7 @@ public class MessagesPublisher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (IMTopic.NotifyFriendRequestTopic.equals(topic)) {
|
if (IMTopic.NotifyFriendRequestTopic.equals(topic)) {
|
||||||
messageSender.sendPush(fromUser, receiver, targetSession.getClientID(), pushContent, PushServer.PushMessageType.PUSH_MESSAGE_TYPE_FRIEND_REQUEST, System.currentTimeMillis(), fromUserName, targetSession.getUnReceivedMsgs() + 1, targetSession.getLanguage());
|
messageSender.sendPush(fromUser, receiver, targetSession.getClientID(), pushContent, PushServer.PushMessageType.PUSH_MESSAGE_TYPE_FRIEND_REQUEST, System.currentTimeMillis(), fromUserName, m_messagesStore.getUnreceivedMsgCount(receiver) + 1, targetSession.getLanguage(), getExistBadgeNumber(receiver));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -667,7 +663,7 @@ public class MessagesPublisher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void publish2Receivers(WFCMessage.Message message, Set<String> receivers, String exceptClientId, int pullType) {
|
public void publish2Receivers(WFCMessage.Message message, Set<String> receivers, String exceptClientId, int pullType) {
|
||||||
if (message.getConversation().getType() == ProtoConstants.ConversationType.ConversationType_Channel) {
|
if (message.getConversation().getType() == ConversationType_Channel) {
|
||||||
WFCMessage.ChannelInfo channelInfo = m_messagesStore.getChannelInfo(message.getConversation().getTarget());
|
WFCMessage.ChannelInfo channelInfo = m_messagesStore.getChannelInfo(message.getConversation().getTarget());
|
||||||
|
|
||||||
boolean forwardMsg;
|
boolean forwardMsg;
|
||||||
@@ -678,18 +674,10 @@ public class MessagesPublisher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (forwardMsg) {
|
if (forwardMsg) {
|
||||||
OutputClient outputClient = null;
|
OutputMessageData outputMessageData = getOutputMessageWithExtraInfo(message, exceptClientId, m_messagesStore.isChannelCallbackWithClientInfo() , m_messagesStore.isChannelCallbackWithSenderInfo(), m_messagesStore.isChannelCallbackWithTargetInfo());
|
||||||
if(m_messagesStore.isChannelCallbackWithClientInfo() && !StringUtil.isNullOrEmpty(exceptClientId)) {
|
|
||||||
Session session = m_sessionsStore.getSession(exceptClientId);
|
|
||||||
if(session != null && session.getUsername().equals(message.getFromUser())) {
|
|
||||||
outputClient = new OutputClient(session.getPlatform(), exceptClientId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
OutputClient finalOutputClient = outputClient;
|
|
||||||
Server.getServer().getCallbackScheduler().execute(() -> {
|
Server.getServer().getCallbackScheduler().execute(() -> {
|
||||||
try {
|
try {
|
||||||
HttpUtils.httpJsonPost(channelInfo.getCallback() + "/message", GsonUtil.gson.toJson(OutputMessageData.fromProtoMessage(message, finalOutputClient), OutputMessageData.class), HttpUtils.HttpPostType.POST_TYPE_Channel_Message_Callback);
|
HttpUtils.httpJsonPost(channelInfo.getCallback() + "/message", GsonUtil.gson.toJson(outputMessageData, OutputMessageData.class), HttpUtils.HttpPostType.POST_TYPE_Channel_Message_Callback);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Utility.printExecption(LOG, e, EVENT_CALLBACK_Exception);
|
Utility.printExecption(LOG, e, EVENT_CALLBACK_Exception);
|
||||||
@@ -733,18 +721,92 @@ public class MessagesPublisher {
|
|||||||
pushContent = null;
|
pushContent = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long callStartUid = 0;
|
||||||
|
if (message.getContent().getType() == 402) {
|
||||||
|
try {
|
||||||
|
String str = new String(message.getContent().getData().toByteArray(), StandardCharsets.UTF_8);
|
||||||
|
JSONObject jsonObject = (JSONObject)(new JSONParser().parse(str));
|
||||||
|
if (jsonObject.containsKey("u")) {
|
||||||
|
callStartUid = (Long)jsonObject.get("u");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
publish2Receivers(message.getFromUser(),
|
publish2Receivers(message.getFromUser(),
|
||||||
message.getConversation().getType(), message.getConversation().getTarget(), message.getConversation().getLine(),
|
message.getConversation().getType(), message.getConversation().getTarget(), message.getConversation().getLine(),
|
||||||
messageId,
|
messageId,
|
||||||
receivers,
|
receivers,
|
||||||
pushContent, message.getContent().getPushData(), exceptClientId, pullType, message.getContent().getType(), message.getServerTimestamp(), message.getContent().getMentionedType(), message.getContent().getMentionedTargetList(), message.getContent().getPersistFlag(), message.hasToUser() || !message.getToList().isEmpty());
|
pushContent, message.getContent().getPushData(), callStartUid, exceptClientId, pullType, message.getContent().getType(), message.getServerTimestamp(), message.getContent().getMentionedType(), message.getContent().getMentionedTargetList(), message.getContent().getPersistFlag(), message.hasToUser() || !message.getToList().isEmpty());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void forwardMessage(final WFCMessage.Message message, String forwardUrl, OutputClient outputClient) {
|
private OutputMessageData getOutputMessageWithExtraInfo(WFCMessage.Message message, String clientId, boolean withClient, boolean withSender, boolean withTarget) {
|
||||||
|
if (message == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
OutputClient outputClient = null;
|
||||||
|
if (withClient && !StringUtil.isNullOrEmpty(clientId)) {
|
||||||
|
Session session = m_sessionsStore.getSession(clientId);
|
||||||
|
if(session != null && session.getUsername().equals(message.getFromUser())) {
|
||||||
|
outputClient = new OutputClient(session.getPlatform(), clientId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
OutputMessageData outputMessageData = OutputMessageData.fromProtoMessage(message, outputClient);
|
||||||
|
if (withSender) {
|
||||||
|
WFCMessage.User senderInfo = m_messagesStore.getUserInfo(message.getFromUser());
|
||||||
|
outputMessageData.setSenderUserInfo(InputOutputUserInfo.fromPbUser(senderInfo));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (withTarget) {
|
||||||
|
if (message.getConversation().getType() == ConversationType_Private) {
|
||||||
|
WFCMessage.User targetInfo = m_messagesStore.getUserInfo(message.getConversation().getTarget());
|
||||||
|
if (targetInfo != null) {
|
||||||
|
outputMessageData.setTargetUserInfo(InputOutputUserInfo.fromPbUser(targetInfo));
|
||||||
|
}
|
||||||
|
} else if(message.getConversation().getType() == ConversationType_Group) {
|
||||||
|
WFCMessage.GroupInfo groupInfo = m_messagesStore.getGroupInfo(message.getConversation().getTarget());
|
||||||
|
if (groupInfo != null) {
|
||||||
|
PojoGroupInfo pojoGroupInfo = new PojoGroupInfo();
|
||||||
|
pojoGroupInfo.setExtra(groupInfo.getExtra());
|
||||||
|
pojoGroupInfo.setName(groupInfo.getName());
|
||||||
|
pojoGroupInfo.setOwner(groupInfo.getOwner());
|
||||||
|
pojoGroupInfo.setPortrait(groupInfo.getPortrait());
|
||||||
|
pojoGroupInfo.setTarget_id(groupInfo.getTargetId());
|
||||||
|
pojoGroupInfo.setType(groupInfo.getType());
|
||||||
|
pojoGroupInfo.setMember_count(groupInfo.getMemberCount());
|
||||||
|
pojoGroupInfo.setMute(groupInfo.getMute());
|
||||||
|
pojoGroupInfo.setJoin_type(groupInfo.getJoinType());
|
||||||
|
pojoGroupInfo.setPrivate_chat(groupInfo.getPrivateChat());
|
||||||
|
pojoGroupInfo.setSearchable(groupInfo.getSearchable());
|
||||||
|
pojoGroupInfo.setMax_member_count(groupInfo.getMemberCount());
|
||||||
|
pojoGroupInfo.setHistory_message(groupInfo.getHistoryMessage());
|
||||||
|
pojoGroupInfo.setSuper_group(groupInfo.getSuperGroup()>0);
|
||||||
|
pojoGroupInfo.setDeleted(groupInfo.getDeleted()>0);
|
||||||
|
pojoGroupInfo.setUpdate_dt(groupInfo.getUpdateDt());
|
||||||
|
pojoGroupInfo.setMember_update_dt(groupInfo.getMemberUpdateDt());
|
||||||
|
outputMessageData.setTargetGroupInfo(pojoGroupInfo);
|
||||||
|
}
|
||||||
|
} else if(message.getConversation().getType() == ConversationType_Channel) {
|
||||||
|
WFCMessage.ChannelInfo targetInfo = m_messagesStore.getChannelInfo(message.getConversation().getTarget());
|
||||||
|
if (targetInfo != null) {
|
||||||
|
outputMessageData.setTargetChannelInfo(OutputGetChannelInfo.fromPbInfo(targetInfo));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return outputMessageData;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void forwardMessage(final WFCMessage.Message message, String forwardUrl, String fromClientId) {
|
||||||
|
OutputMessageData outputMessageData = getOutputMessageWithExtraInfo(message, fromClientId, m_messagesStore.isForwardMessageWithClientInfo() , m_messagesStore.isForwardMessageWithSenderInfo(), m_messagesStore.isForwardMessageWithTargetInfo());
|
||||||
Server.getServer().getCallbackScheduler().execute(() -> {
|
Server.getServer().getCallbackScheduler().execute(() -> {
|
||||||
try {
|
try {
|
||||||
HttpUtils.httpJsonPost(forwardUrl, GsonUtil.gson.toJson(OutputMessageData.fromProtoMessage(message, outputClient), OutputMessageData.class), HttpUtils.HttpPostType.POST_TYPE_Forward_Message_Callback);
|
HttpUtils.httpJsonPost(forwardUrl, GsonUtil.gson.toJson(outputMessageData), HttpUtils.HttpPostType.POST_TYPE_Forward_Message_Callback);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Utility.printExecption(LOG, e, EVENT_CALLBACK_Exception);
|
Utility.printExecption(LOG, e, EVENT_CALLBACK_Exception);
|
||||||
@@ -752,9 +814,10 @@ public class MessagesPublisher {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void forwardMessageWithCallback(final WFCMessage.Message message, String forwardUrl, HttpUtils.HttpCallback callback) {
|
public void forwardMessageWithCallback(final WFCMessage.Message message, String fromClientId, String forwardUrl, HttpUtils.HttpCallback callback) {
|
||||||
|
OutputMessageData outputMessageData = getOutputMessageWithExtraInfo(message, fromClientId, m_messagesStore.isForwardMessageWithClientInfo() , m_messagesStore.isForwardMessageWithSenderInfo(), m_messagesStore.isForwardMessageWithTargetInfo());
|
||||||
try {
|
try {
|
||||||
HttpUtils.httpJsonPost(forwardUrl, GsonUtil.gson.toJson(OutputMessageData.fromProtoMessage(message), OutputMessageData.class), new HttpUtils.HttpCallback() {
|
HttpUtils.httpJsonPost(forwardUrl, GsonUtil.gson.toJson(outputMessageData), new HttpUtils.HttpCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(String content) {
|
public void onSuccess(String content) {
|
||||||
Server.getServer().getImBusinessScheduler().execute(()->{
|
Server.getServer().getImBusinessScheduler().execute(()->{
|
||||||
|
|||||||
@@ -37,16 +37,18 @@ class PersistentQueueMessageSender {
|
|||||||
this.connectionDescriptorStore = connectionDescriptorStore;
|
this.connectionDescriptorStore = connectionDescriptorStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendPush(String sender, int conversationType, String target, int line, long messageId, String deviceId, String pushContent, String pushData, int messageContentType, long serverTime, String senderName, String senderPortrait, String targetName, String targetPortrait, int unReceivedMsg, int mentionType, boolean isHiddenDetail, String language) {
|
void sendPush(String sender, int conversationType, String target, int line, long messageId, String deviceId, String pushContent, String pushData, long callStartUid, int messageContentType, long serverTime, String senderName, String senderPortrait, String targetName, String targetPortrait, int unReceivedMsg, int mentionType, boolean isHiddenDetail, String language, int existBadgeNumber) {
|
||||||
LOG.info("Send push to {}, message from {}", deviceId, sender);
|
LOG.info("Send push to {}, message from {}", deviceId, sender);
|
||||||
PushMessage pushMessage = new PushMessage(sender, conversationType, target, line, messageContentType, serverTime, senderName, senderPortrait, targetName, targetPortrait, unReceivedMsg, mentionType, isHiddenDetail, language);
|
PushMessage pushMessage = new PushMessage(sender, conversationType, target, line, messageContentType, serverTime, senderName, senderPortrait, targetName, targetPortrait, unReceivedMsg, mentionType, isHiddenDetail, language);
|
||||||
pushMessage.pushContent = pushContent;
|
pushMessage.pushContent = pushContent;
|
||||||
pushMessage.pushData = pushData;
|
pushMessage.pushData = pushData;
|
||||||
pushMessage.messageId = messageId;
|
pushMessage.messageId = messageId;
|
||||||
|
pushMessage.callStartUid = callStartUid;
|
||||||
|
pushMessage.existBadgeNumber = existBadgeNumber;
|
||||||
PushServer.getServer().pushMessage(pushMessage, deviceId, pushContent);
|
PushServer.getServer().pushMessage(pushMessage, deviceId, pushContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendPush(String sender, String target, String deviceId, String pushContent, int pushContentType, long serverTime, String senderName, int unReceivedMsg, String language) {
|
void sendPush(String sender, String target, String deviceId, String pushContent, int pushContentType, long serverTime, String senderName, int unReceivedMsg, String language, int existBadgeNumber) {
|
||||||
LOG.info("Send push to {}, message from {}", deviceId, sender);
|
LOG.info("Send push to {}, message from {}", deviceId, sender);
|
||||||
PushMessage pushMessage = new PushMessage(sender, target, serverTime, senderName, unReceivedMsg, language, pushContentType);
|
PushMessage pushMessage = new PushMessage(sender, target, serverTime, senderName, unReceivedMsg, language, pushContentType);
|
||||||
pushMessage.pushContent = pushContent;
|
pushMessage.pushContent = pushContent;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import io.moquette.server.Server;
|
|||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class GitRepositoryState {
|
public class GitRepositoryState {
|
||||||
public final String tags;
|
public final String tags;
|
||||||
@@ -28,6 +29,8 @@ public class GitRepositoryState {
|
|||||||
public final String commitMessageFull;
|
public final String commitMessageFull;
|
||||||
public final String commitMessageShort;
|
public final String commitMessageShort;
|
||||||
public final String commitTime;
|
public final String commitTime;
|
||||||
|
public static final String globalLabel = UUID.randomUUID().toString();
|
||||||
|
public String label;
|
||||||
public final String closestTagName;
|
public final String closestTagName;
|
||||||
public final String closestTagCommitCount;
|
public final String closestTagCommitCount;
|
||||||
|
|
||||||
@@ -63,6 +66,7 @@ public class GitRepositoryState {
|
|||||||
this.buildHost = String.valueOf(properties.get("git.build.host"));
|
this.buildHost = String.valueOf(properties.get("git.build.host"));
|
||||||
this.buildVersion = String.valueOf(properties.get("git.build.version"));
|
this.buildVersion = String.valueOf(properties.get("git.build.version"));
|
||||||
this.runTime = Server.getServer().getRunTime();
|
this.runTime = Server.getServer().getRunTime();
|
||||||
|
this.label = globalLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GitRepositoryState getGitRepositoryState() throws IOException {
|
public static GitRepositoryState getGitRepositoryState() throws IOException {
|
||||||
|
|||||||
@@ -21,4 +21,5 @@ public interface UserSettingScope {
|
|||||||
int kUserSettingGroupRemark = 26;
|
int kUserSettingGroupRemark = 26;
|
||||||
int kUserSettingPrivacySearchable = 27;
|
int kUserSettingPrivacySearchable = 27;
|
||||||
int kUserSettingAddFriendStrategy = 28;
|
int kUserSettingAddFriendStrategy = 28;
|
||||||
|
int kUserSettingScopeSyncBadge = 29;
|
||||||
}
|
}
|
||||||
|
|||||||
+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>1.3.3</version>
|
<version>1.3.7</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -61,6 +61,8 @@ public interface APIPath {
|
|||||||
|
|
||||||
String Handle_Friend_Send_Request = "/admin/friend/handle_send_request";
|
String Handle_Friend_Send_Request = "/admin/friend/handle_send_request";
|
||||||
|
|
||||||
|
String Admin_Moments_Post_Feed = "/admin/moments/feed/post";
|
||||||
|
|
||||||
String Msg_Send = "/admin/message/send";
|
String Msg_Send = "/admin/message/send";
|
||||||
String Msg_Publish = "/admin/message/publish";
|
String Msg_Publish = "/admin/message/publish";
|
||||||
String Msg_Recall = "/admin/message/recall";
|
String Msg_Recall = "/admin/message/recall";
|
||||||
|
|||||||
@@ -65,6 +65,8 @@ public enum ErrorCode {
|
|||||||
ERROR_CODE_CONFERENCE_ERROR(90, "Conference server response error"),
|
ERROR_CODE_CONFERENCE_ERROR(90, "Conference server response error"),
|
||||||
|
|
||||||
ERROR_CODE_FUNCTION_DISABLED(220, "function disabled"),
|
ERROR_CODE_FUNCTION_DISABLED(220, "function disabled"),
|
||||||
|
ERROR_CODE_SERVER_BUSY(221, "Server busy"),
|
||||||
|
ERROR_CODE_PARTLY_SUCCESS(222, "Partly success"),
|
||||||
|
|
||||||
ERROR_CODE_OTHER_CLIENT_ALREADY_IN_CHATROOM(225, "other client already in chatroom"),
|
ERROR_CODE_OTHER_CLIENT_ALREADY_IN_CHATROOM(225, "other client already in chatroom"),
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import com.google.protobuf.ByteString;
|
|||||||
import io.netty.util.internal.StringUtil;
|
import io.netty.util.internal.StringUtil;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class GroupNotificationBinaryContent {
|
public class GroupNotificationBinaryContent {
|
||||||
//groupId
|
//groupId
|
||||||
@@ -33,6 +34,8 @@ public class GroupNotificationBinaryContent {
|
|||||||
//value2(member or something)
|
//value2(member or something)
|
||||||
private String m;
|
private String m;
|
||||||
|
|
||||||
|
private Map<String, Integer> mi;
|
||||||
|
|
||||||
private String extra;
|
private String extra;
|
||||||
|
|
||||||
public GroupNotificationBinaryContent() {
|
public GroupNotificationBinaryContent() {
|
||||||
@@ -92,6 +95,11 @@ public class GroupNotificationBinaryContent {
|
|||||||
this.ms = ms;
|
this.ms = ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GroupNotificationBinaryContent setMi(Map<String, Integer> mi) {
|
||||||
|
this.mi = mi;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public GroupNotificationBinaryContent setExtra(String extra) {
|
public GroupNotificationBinaryContent setExtra(String extra) {
|
||||||
this.extra = extra;
|
this.extra = extra;
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ package cn.wildfirechat.pojos;
|
|||||||
import cn.wildfirechat.proto.WFCMessage;
|
import cn.wildfirechat.proto.WFCMessage;
|
||||||
import io.netty.util.internal.StringUtil;
|
import io.netty.util.internal.StringUtil;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class InputCreateChannel {
|
public class InputCreateChannel {
|
||||||
private String owner;
|
private String owner;
|
||||||
private String name;
|
private String name;
|
||||||
@@ -24,6 +27,7 @@ public class InputCreateChannel {
|
|||||||
private int state;
|
private int state;
|
||||||
private String extra;
|
private String extra;
|
||||||
private long updateDt;
|
private long updateDt;
|
||||||
|
public List<PojoChannelMenu> menus;
|
||||||
|
|
||||||
public WFCMessage.ChannelInfo toProtoChannelInfo() {
|
public WFCMessage.ChannelInfo toProtoChannelInfo() {
|
||||||
WFCMessage.ChannelInfo.Builder builder = WFCMessage.ChannelInfo.newBuilder().setOwner(owner);
|
WFCMessage.ChannelInfo.Builder builder = WFCMessage.ChannelInfo.newBuilder().setOwner(owner);
|
||||||
@@ -48,6 +52,12 @@ public class InputCreateChannel {
|
|||||||
else
|
else
|
||||||
builder = builder.setUpdateDt(System.currentTimeMillis());
|
builder = builder.setUpdateDt(System.currentTimeMillis());
|
||||||
|
|
||||||
|
if (menus != null && !menus.isEmpty()) {
|
||||||
|
for (PojoChannelMenu menu : menus) {
|
||||||
|
builder.addMenu(menu.toPbInfo());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,9 +13,11 @@ import cn.wildfirechat.proto.WFCMessage;
|
|||||||
|
|
||||||
public class OutputCreateChannel {
|
public class OutputCreateChannel {
|
||||||
private String targetId;
|
private String targetId;
|
||||||
|
private String secret;
|
||||||
|
|
||||||
public OutputCreateChannel(String targetId) {
|
public OutputCreateChannel(String targetId, String secret) {
|
||||||
this.targetId = targetId;
|
this.targetId = targetId;
|
||||||
|
this.secret = secret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTargetId() {
|
public String getTargetId() {
|
||||||
@@ -25,4 +27,12 @@ public class OutputCreateChannel {
|
|||||||
public void setTargetId(String targetId) {
|
public void setTargetId(String targetId) {
|
||||||
this.targetId = targetId;
|
this.targetId = targetId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSecret() {
|
||||||
|
return secret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSecret(String secret) {
|
||||||
|
this.secret = secret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,61 +16,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class OutputGetChannelInfo {
|
public class OutputGetChannelInfo {
|
||||||
public static class OutputMenu {
|
public static class OutputMenuList extends ArrayList<PojoChannelMenu> {
|
||||||
public String menuId;
|
|
||||||
public String type;
|
|
||||||
public String name;
|
|
||||||
public String key;
|
|
||||||
public String url;
|
|
||||||
public String mediaId;
|
|
||||||
public String articleId;
|
|
||||||
public String appId;
|
|
||||||
public String appPage;
|
|
||||||
public String extra;
|
|
||||||
public List<OutputMenu> subMenus;
|
|
||||||
|
|
||||||
public static OutputMenu fromPbInfo(WFCMessage.ChannelMenu channelMenuMenu) {
|
|
||||||
OutputMenu out = new OutputMenu();
|
|
||||||
out.menuId = channelMenuMenu.getMenuId();
|
|
||||||
out.type = channelMenuMenu.getType();
|
|
||||||
out.name = channelMenuMenu.getName();
|
|
||||||
out.key = channelMenuMenu.getKey();
|
|
||||||
out.url = channelMenuMenu.getUrl();
|
|
||||||
out.mediaId = channelMenuMenu.getMediaId();
|
|
||||||
out.articleId = channelMenuMenu.getArticleId();
|
|
||||||
out.appId = channelMenuMenu.getAppId();
|
|
||||||
out.appPage = channelMenuMenu.getAppPage();
|
|
||||||
out.extra = channelMenuMenu.getExtra();
|
|
||||||
if (channelMenuMenu.getSubMenuCount() > 0) {
|
|
||||||
out.subMenus = new ArrayList<>();
|
|
||||||
for (WFCMessage.ChannelMenu menuMenu : channelMenuMenu.getSubMenuList()) {
|
|
||||||
out.subMenus.add(fromPbInfo(menuMenu));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
public WFCMessage.ChannelMenu.Builder toPbInfo() {
|
|
||||||
WFCMessage.ChannelMenu.Builder builder = WFCMessage.ChannelMenu.newBuilder();
|
|
||||||
builder.setType(type);
|
|
||||||
builder.setName(name);
|
|
||||||
if (!StringUtil.isNullOrEmpty(menuId)) builder.setMenuId(menuId);
|
|
||||||
if (!StringUtil.isNullOrEmpty(key)) builder.setKey(key);
|
|
||||||
if (!StringUtil.isNullOrEmpty(url)) builder.setUrl(url);
|
|
||||||
if (!StringUtil.isNullOrEmpty(mediaId)) builder.setMediaId(mediaId);
|
|
||||||
if (!StringUtil.isNullOrEmpty(articleId)) builder.setArticleId(articleId);
|
|
||||||
if (!StringUtil.isNullOrEmpty(appId)) builder.setAppId(appId);
|
|
||||||
if (!StringUtil.isNullOrEmpty(appPage)) builder.setAppPage(appPage);
|
|
||||||
if (!StringUtil.isNullOrEmpty(extra)) builder.setExtra(extra);
|
|
||||||
if (subMenus != null && !subMenus.isEmpty()) {
|
|
||||||
subMenus.forEach(menuMenu -> builder.addSubMenu(menuMenu.toPbInfo()));
|
|
||||||
}
|
|
||||||
return builder;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class OutputMenuList extends ArrayList<OutputMenu> {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String channelId;
|
private String channelId;
|
||||||
@@ -85,7 +31,7 @@ public class OutputGetChannelInfo {
|
|||||||
private String callback;
|
private String callback;
|
||||||
private int automatic;
|
private int automatic;
|
||||||
private String secret;
|
private String secret;
|
||||||
public List<OutputMenu> menus;
|
public List<PojoChannelMenu> menus;
|
||||||
|
|
||||||
public String getChannelId() {
|
public String getChannelId() {
|
||||||
return channelId;
|
return channelId;
|
||||||
@@ -200,7 +146,7 @@ public class OutputGetChannelInfo {
|
|||||||
if (channelInfo.getMenuCount() > 0) {
|
if (channelInfo.getMenuCount() > 0) {
|
||||||
out.menus = new ArrayList<>();
|
out.menus = new ArrayList<>();
|
||||||
for (WFCMessage.ChannelMenu channelMenuMenu : channelInfo.getMenuList()) {
|
for (WFCMessage.ChannelMenu channelMenuMenu : channelInfo.getMenuList()) {
|
||||||
out.menus.add(OutputMenu.fromPbInfo(channelMenuMenu));
|
out.menus.add(PojoChannelMenu.fromPbInfo(channelMenuMenu));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
|
|||||||
@@ -3,13 +3,15 @@ package cn.wildfirechat.pojos;
|
|||||||
public class OutputGetIMTokenData {
|
public class OutputGetIMTokenData {
|
||||||
private String userId;
|
private String userId;
|
||||||
private String token;
|
private String token;
|
||||||
|
private String serverLabel;
|
||||||
|
|
||||||
public OutputGetIMTokenData() {
|
public OutputGetIMTokenData() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public OutputGetIMTokenData(String userId, String imToken) {
|
public OutputGetIMTokenData(String userId, String imToken, String label) {
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
this.token = imToken;
|
this.token = imToken;
|
||||||
|
this.serverLabel = label;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserId() {
|
public String getUserId() {
|
||||||
@@ -27,4 +29,12 @@ public class OutputGetIMTokenData {
|
|||||||
public void setToken(String token) {
|
public void setToken(String token) {
|
||||||
this.token = token;
|
this.token = token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getServerLabel() {
|
||||||
|
return serverLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setServerLabel(String serverLabel) {
|
||||||
|
this.serverLabel = serverLabel;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,11 @@ public class OutputMessageData {
|
|||||||
private long timestamp;
|
private long timestamp;
|
||||||
private OutputClient client;
|
private OutputClient client;
|
||||||
|
|
||||||
|
private InputOutputUserInfo senderUserInfo;
|
||||||
|
private InputOutputUserInfo targetUserInfo;
|
||||||
|
private PojoGroupInfo targetGroupInfo;
|
||||||
|
private OutputGetChannelInfo targetChannelInfo;
|
||||||
|
|
||||||
public String getSender() {
|
public String getSender() {
|
||||||
return sender;
|
return sender;
|
||||||
}
|
}
|
||||||
@@ -78,6 +83,38 @@ public class OutputMessageData {
|
|||||||
this.client = client;
|
this.client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public InputOutputUserInfo getSenderUserInfo() {
|
||||||
|
return senderUserInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSenderUserInfo(InputOutputUserInfo senderUserInfo) {
|
||||||
|
this.senderUserInfo = senderUserInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public InputOutputUserInfo getTargetUserInfo() {
|
||||||
|
return targetUserInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTargetUserInfo(InputOutputUserInfo targetUserInfo) {
|
||||||
|
this.targetUserInfo = targetUserInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PojoGroupInfo getTargetGroupInfo() {
|
||||||
|
return targetGroupInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTargetGroupInfo(PojoGroupInfo targetGroupInfo) {
|
||||||
|
this.targetGroupInfo = targetGroupInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OutputGetChannelInfo getTargetChannelInfo() {
|
||||||
|
return targetChannelInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTargetChannelInfo(OutputGetChannelInfo targetChannelInfo) {
|
||||||
|
this.targetChannelInfo = targetChannelInfo;
|
||||||
|
}
|
||||||
|
|
||||||
public static OutputMessageData fromProtoMessage(WFCMessage.Message protoMessage) {
|
public static OutputMessageData fromProtoMessage(WFCMessage.Message protoMessage) {
|
||||||
return fromProtoMessage(protoMessage, null);
|
return fromProtoMessage(protoMessage, null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package cn.wildfirechat.pojos;
|
||||||
|
|
||||||
|
import cn.wildfirechat.proto.WFCMessage;
|
||||||
|
import io.netty.util.internal.StringUtil;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class PojoChannelMenu {
|
||||||
|
public String menuId;
|
||||||
|
public String type;
|
||||||
|
public String name;
|
||||||
|
public String key;
|
||||||
|
public String url;
|
||||||
|
public String mediaId;
|
||||||
|
public String articleId;
|
||||||
|
public String appId;
|
||||||
|
public String appPage;
|
||||||
|
public String extra;
|
||||||
|
public List<PojoChannelMenu> subMenus;
|
||||||
|
|
||||||
|
public static PojoChannelMenu fromPbInfo(WFCMessage.ChannelMenu channelMenuMenu) {
|
||||||
|
PojoChannelMenu out = new PojoChannelMenu();
|
||||||
|
out.menuId = channelMenuMenu.getMenuId();
|
||||||
|
out.type = channelMenuMenu.getType();
|
||||||
|
out.name = channelMenuMenu.getName();
|
||||||
|
out.key = channelMenuMenu.getKey();
|
||||||
|
out.url = channelMenuMenu.getUrl();
|
||||||
|
out.mediaId = channelMenuMenu.getMediaId();
|
||||||
|
out.articleId = channelMenuMenu.getArticleId();
|
||||||
|
out.appId = channelMenuMenu.getAppId();
|
||||||
|
out.appPage = channelMenuMenu.getAppPage();
|
||||||
|
out.extra = channelMenuMenu.getExtra();
|
||||||
|
if (channelMenuMenu.getSubMenuCount() > 0) {
|
||||||
|
out.subMenus = new ArrayList<>();
|
||||||
|
for (WFCMessage.ChannelMenu menuMenu : channelMenuMenu.getSubMenuList()) {
|
||||||
|
out.subMenus.add(fromPbInfo(menuMenu));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WFCMessage.ChannelMenu.Builder toPbInfo() {
|
||||||
|
WFCMessage.ChannelMenu.Builder builder = WFCMessage.ChannelMenu.newBuilder();
|
||||||
|
builder.setType(type);
|
||||||
|
builder.setName(name);
|
||||||
|
if (!StringUtil.isNullOrEmpty(menuId)) builder.setMenuId(menuId);
|
||||||
|
if (!StringUtil.isNullOrEmpty(key)) builder.setKey(key);
|
||||||
|
if (!StringUtil.isNullOrEmpty(url)) builder.setUrl(url);
|
||||||
|
if (!StringUtil.isNullOrEmpty(mediaId)) builder.setMediaId(mediaId);
|
||||||
|
if (!StringUtil.isNullOrEmpty(articleId)) builder.setArticleId(articleId);
|
||||||
|
if (!StringUtil.isNullOrEmpty(appId)) builder.setAppId(appId);
|
||||||
|
if (!StringUtil.isNullOrEmpty(appPage)) builder.setAppPage(appPage);
|
||||||
|
if (!StringUtil.isNullOrEmpty(extra)) builder.setExtra(extra);
|
||||||
|
if (subMenus != null && !subMenus.isEmpty()) {
|
||||||
|
subMenus.forEach(menuMenu -> builder.addSubMenu(menuMenu.toPbInfo()));
|
||||||
|
}
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package cn.wildfirechat.pojos.mesh;
|
|||||||
public class PojoSearchUserReq {
|
public class PojoSearchUserReq {
|
||||||
public String keyword;
|
public String keyword;
|
||||||
public int searchType;
|
public int searchType;
|
||||||
|
public int userType;
|
||||||
public int page;
|
public int page;
|
||||||
public String domainId;
|
public String domainId;
|
||||||
|
|
||||||
@@ -22,6 +23,14 @@ public class PojoSearchUserReq {
|
|||||||
this.searchType = searchType;
|
this.searchType = searchType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getUserType() {
|
||||||
|
return userType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserType(int userType) {
|
||||||
|
this.userType = userType;
|
||||||
|
}
|
||||||
|
|
||||||
public int getPage() {
|
public int getPage() {
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,6 +172,7 @@ public class ProtoConstants {
|
|||||||
int Modify_Group_Max_Member_Count = 8;
|
int Modify_Group_Max_Member_Count = 8;
|
||||||
//仅专业版的server api支持
|
//仅专业版的server api支持
|
||||||
int Modify_Group_Super_Group = 9;
|
int Modify_Group_Super_Group = 9;
|
||||||
|
int Modify_Group_Type = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
//ModifyGroupInfoRequest -> type
|
//ModifyGroupInfoRequest -> type
|
||||||
@@ -237,6 +238,12 @@ public class ProtoConstants {
|
|||||||
int SearchUserType_Name_Mobile_DisplayName = 100;
|
int SearchUserType_Name_Mobile_DisplayName = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface UserSearchUserType {
|
||||||
|
int UserSearchUserType_ALL = 0;
|
||||||
|
int UserSearchUserType_ONLY_USER = 1;
|
||||||
|
int UserSearchUserType_ONLY_ROBOT = 2;
|
||||||
|
}
|
||||||
|
|
||||||
public interface DisableSearchMask {
|
public interface DisableSearchMask {
|
||||||
int DisableSearchDisplayNameMask = 1;
|
int DisableSearchDisplayNameMask = 1;
|
||||||
int DisableSearchNameMask = 2;
|
int DisableSearchNameMask = 2;
|
||||||
@@ -389,5 +396,7 @@ public class ProtoConstants {
|
|||||||
|
|
||||||
public static final int MESSAGE_CONTENT_TYPE_MODIFY_GROUP_EXTRA = 122;
|
public static final int MESSAGE_CONTENT_TYPE_MODIFY_GROUP_EXTRA = 122;
|
||||||
public static final int MESSAGE_CONTENT_TYPE_MODIFY_GROUP_MEMBER_EXTRA = 123;
|
public static final int MESSAGE_CONTENT_TYPE_MODIFY_GROUP_MEMBER_EXTRA = 123;
|
||||||
|
public static final int MESSAGE_CONTENT_TYPE_MODIFY_GROUP_SETTINGS = 124;
|
||||||
|
public static final int MESSAGE_CONTENT_TYPE_REJECT_JOIN_GROUP = 125;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54041,6 +54041,31 @@ public final class WFCMessage {
|
|||||||
* <code>optional int32 page = 3;</code>
|
* <code>optional int32 page = 3;</code>
|
||||||
*/
|
*/
|
||||||
int getPage();
|
int getPage();
|
||||||
|
|
||||||
|
// optional string domain_id = 4;
|
||||||
|
/**
|
||||||
|
* <code>optional string domain_id = 4;</code>
|
||||||
|
*/
|
||||||
|
boolean hasDomainId();
|
||||||
|
/**
|
||||||
|
* <code>optional string domain_id = 4;</code>
|
||||||
|
*/
|
||||||
|
java.lang.String getDomainId();
|
||||||
|
/**
|
||||||
|
* <code>optional string domain_id = 4;</code>
|
||||||
|
*/
|
||||||
|
com.google.protobuf.ByteString
|
||||||
|
getDomainIdBytes();
|
||||||
|
|
||||||
|
// optional int32 type = 5;
|
||||||
|
/**
|
||||||
|
* <code>optional int32 type = 5;</code>
|
||||||
|
*/
|
||||||
|
boolean hasType();
|
||||||
|
/**
|
||||||
|
* <code>optional int32 type = 5;</code>
|
||||||
|
*/
|
||||||
|
int getType();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Protobuf type {@code SearchUserRequest}
|
* Protobuf type {@code SearchUserRequest}
|
||||||
@@ -54108,6 +54133,16 @@ public final class WFCMessage {
|
|||||||
page_ = input.readInt32();
|
page_ = input.readInt32();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 34: {
|
||||||
|
bitField0_ |= 0x00000008;
|
||||||
|
domainId_ = input.readBytes();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 40: {
|
||||||
|
bitField0_ |= 0x00000010;
|
||||||
|
type_ = input.readInt32();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
|
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
|
||||||
@@ -54223,10 +54258,71 @@ public final class WFCMessage {
|
|||||||
return page_;
|
return page_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// optional string domain_id = 4;
|
||||||
|
public static final int DOMAIN_ID_FIELD_NUMBER = 4;
|
||||||
|
private java.lang.Object domainId_;
|
||||||
|
/**
|
||||||
|
* <code>optional string domain_id = 4;</code>
|
||||||
|
*/
|
||||||
|
public boolean hasDomainId() {
|
||||||
|
return ((bitField0_ & 0x00000008) == 0x00000008);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* <code>optional string domain_id = 4;</code>
|
||||||
|
*/
|
||||||
|
public java.lang.String getDomainId() {
|
||||||
|
java.lang.Object ref = domainId_;
|
||||||
|
if (ref instanceof java.lang.String) {
|
||||||
|
return (java.lang.String) ref;
|
||||||
|
} else {
|
||||||
|
com.google.protobuf.ByteString bs =
|
||||||
|
(com.google.protobuf.ByteString) ref;
|
||||||
|
java.lang.String s = bs.toStringUtf8();
|
||||||
|
if (bs.isValidUtf8()) {
|
||||||
|
domainId_ = s;
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* <code>optional string domain_id = 4;</code>
|
||||||
|
*/
|
||||||
|
public com.google.protobuf.ByteString
|
||||||
|
getDomainIdBytes() {
|
||||||
|
java.lang.Object ref = domainId_;
|
||||||
|
if (ref instanceof java.lang.String) {
|
||||||
|
com.google.protobuf.ByteString b =
|
||||||
|
com.google.protobuf.ByteString.copyFromUtf8(
|
||||||
|
(java.lang.String) ref);
|
||||||
|
domainId_ = b;
|
||||||
|
return b;
|
||||||
|
} else {
|
||||||
|
return (com.google.protobuf.ByteString) ref;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// optional int32 type = 5;
|
||||||
|
public static final int TYPE_FIELD_NUMBER = 5;
|
||||||
|
private int type_;
|
||||||
|
/**
|
||||||
|
* <code>optional int32 type = 5;</code>
|
||||||
|
*/
|
||||||
|
public boolean hasType() {
|
||||||
|
return ((bitField0_ & 0x00000010) == 0x00000010);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* <code>optional int32 type = 5;</code>
|
||||||
|
*/
|
||||||
|
public int getType() {
|
||||||
|
return type_;
|
||||||
|
}
|
||||||
|
|
||||||
private void initFields() {
|
private void initFields() {
|
||||||
keyword_ = "";
|
keyword_ = "";
|
||||||
fuzzy_ = 0;
|
fuzzy_ = 0;
|
||||||
page_ = 0;
|
page_ = 0;
|
||||||
|
domainId_ = "";
|
||||||
|
type_ = 0;
|
||||||
}
|
}
|
||||||
private byte memoizedIsInitialized = -1;
|
private byte memoizedIsInitialized = -1;
|
||||||
public final boolean isInitialized() {
|
public final boolean isInitialized() {
|
||||||
@@ -54253,6 +54349,12 @@ public final class WFCMessage {
|
|||||||
if (((bitField0_ & 0x00000004) == 0x00000004)) {
|
if (((bitField0_ & 0x00000004) == 0x00000004)) {
|
||||||
output.writeInt32(3, page_);
|
output.writeInt32(3, page_);
|
||||||
}
|
}
|
||||||
|
if (((bitField0_ & 0x00000008) == 0x00000008)) {
|
||||||
|
output.writeBytes(4, getDomainIdBytes());
|
||||||
|
}
|
||||||
|
if (((bitField0_ & 0x00000010) == 0x00000010)) {
|
||||||
|
output.writeInt32(5, type_);
|
||||||
|
}
|
||||||
getUnknownFields().writeTo(output);
|
getUnknownFields().writeTo(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54274,6 +54376,14 @@ public final class WFCMessage {
|
|||||||
size += com.google.protobuf.CodedOutputStream
|
size += com.google.protobuf.CodedOutputStream
|
||||||
.computeInt32Size(3, page_);
|
.computeInt32Size(3, page_);
|
||||||
}
|
}
|
||||||
|
if (((bitField0_ & 0x00000008) == 0x00000008)) {
|
||||||
|
size += com.google.protobuf.CodedOutputStream
|
||||||
|
.computeBytesSize(4, getDomainIdBytes());
|
||||||
|
}
|
||||||
|
if (((bitField0_ & 0x00000010) == 0x00000010)) {
|
||||||
|
size += com.google.protobuf.CodedOutputStream
|
||||||
|
.computeInt32Size(5, type_);
|
||||||
|
}
|
||||||
size += getUnknownFields().getSerializedSize();
|
size += getUnknownFields().getSerializedSize();
|
||||||
memoizedSerializedSize = size;
|
memoizedSerializedSize = size;
|
||||||
return size;
|
return size;
|
||||||
@@ -54396,6 +54506,10 @@ public final class WFCMessage {
|
|||||||
bitField0_ = (bitField0_ & ~0x00000002);
|
bitField0_ = (bitField0_ & ~0x00000002);
|
||||||
page_ = 0;
|
page_ = 0;
|
||||||
bitField0_ = (bitField0_ & ~0x00000004);
|
bitField0_ = (bitField0_ & ~0x00000004);
|
||||||
|
domainId_ = "";
|
||||||
|
bitField0_ = (bitField0_ & ~0x00000008);
|
||||||
|
type_ = 0;
|
||||||
|
bitField0_ = (bitField0_ & ~0x00000010);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54436,6 +54550,14 @@ public final class WFCMessage {
|
|||||||
to_bitField0_ |= 0x00000004;
|
to_bitField0_ |= 0x00000004;
|
||||||
}
|
}
|
||||||
result.page_ = page_;
|
result.page_ = page_;
|
||||||
|
if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
|
||||||
|
to_bitField0_ |= 0x00000008;
|
||||||
|
}
|
||||||
|
result.domainId_ = domainId_;
|
||||||
|
if (((from_bitField0_ & 0x00000010) == 0x00000010)) {
|
||||||
|
to_bitField0_ |= 0x00000010;
|
||||||
|
}
|
||||||
|
result.type_ = type_;
|
||||||
result.bitField0_ = to_bitField0_;
|
result.bitField0_ = to_bitField0_;
|
||||||
onBuilt();
|
onBuilt();
|
||||||
return result;
|
return result;
|
||||||
@@ -54463,6 +54585,14 @@ public final class WFCMessage {
|
|||||||
if (other.hasPage()) {
|
if (other.hasPage()) {
|
||||||
setPage(other.getPage());
|
setPage(other.getPage());
|
||||||
}
|
}
|
||||||
|
if (other.hasDomainId()) {
|
||||||
|
bitField0_ |= 0x00000008;
|
||||||
|
domainId_ = other.domainId_;
|
||||||
|
onChanged();
|
||||||
|
}
|
||||||
|
if (other.hasType()) {
|
||||||
|
setType(other.getType());
|
||||||
|
}
|
||||||
this.mergeUnknownFields(other.getUnknownFields());
|
this.mergeUnknownFields(other.getUnknownFields());
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -54634,6 +54764,113 @@ public final class WFCMessage {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// optional string domain_id = 4;
|
||||||
|
private java.lang.Object domainId_ = "";
|
||||||
|
/**
|
||||||
|
* <code>optional string domain_id = 4;</code>
|
||||||
|
*/
|
||||||
|
public boolean hasDomainId() {
|
||||||
|
return ((bitField0_ & 0x00000008) == 0x00000008);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* <code>optional string domain_id = 4;</code>
|
||||||
|
*/
|
||||||
|
public java.lang.String getDomainId() {
|
||||||
|
java.lang.Object ref = domainId_;
|
||||||
|
if (!(ref instanceof java.lang.String)) {
|
||||||
|
java.lang.String s = ((com.google.protobuf.ByteString) ref)
|
||||||
|
.toStringUtf8();
|
||||||
|
domainId_ = s;
|
||||||
|
return s;
|
||||||
|
} else {
|
||||||
|
return (java.lang.String) ref;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* <code>optional string domain_id = 4;</code>
|
||||||
|
*/
|
||||||
|
public com.google.protobuf.ByteString
|
||||||
|
getDomainIdBytes() {
|
||||||
|
java.lang.Object ref = domainId_;
|
||||||
|
if (ref instanceof String) {
|
||||||
|
com.google.protobuf.ByteString b =
|
||||||
|
com.google.protobuf.ByteString.copyFromUtf8(
|
||||||
|
(java.lang.String) ref);
|
||||||
|
domainId_ = b;
|
||||||
|
return b;
|
||||||
|
} else {
|
||||||
|
return (com.google.protobuf.ByteString) ref;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* <code>optional string domain_id = 4;</code>
|
||||||
|
*/
|
||||||
|
public Builder setDomainId(
|
||||||
|
java.lang.String value) {
|
||||||
|
if (value == null) {
|
||||||
|
throw new NullPointerException();
|
||||||
|
}
|
||||||
|
bitField0_ |= 0x00000008;
|
||||||
|
domainId_ = value;
|
||||||
|
onChanged();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* <code>optional string domain_id = 4;</code>
|
||||||
|
*/
|
||||||
|
public Builder clearDomainId() {
|
||||||
|
bitField0_ = (bitField0_ & ~0x00000008);
|
||||||
|
domainId_ = getDefaultInstance().getDomainId();
|
||||||
|
onChanged();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* <code>optional string domain_id = 4;</code>
|
||||||
|
*/
|
||||||
|
public Builder setDomainIdBytes(
|
||||||
|
com.google.protobuf.ByteString value) {
|
||||||
|
if (value == null) {
|
||||||
|
throw new NullPointerException();
|
||||||
|
}
|
||||||
|
bitField0_ |= 0x00000008;
|
||||||
|
domainId_ = value;
|
||||||
|
onChanged();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// optional int32 type = 5;
|
||||||
|
private int type_ ;
|
||||||
|
/**
|
||||||
|
* <code>optional int32 type = 5;</code>
|
||||||
|
*/
|
||||||
|
public boolean hasType() {
|
||||||
|
return ((bitField0_ & 0x00000010) == 0x00000010);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* <code>optional int32 type = 5;</code>
|
||||||
|
*/
|
||||||
|
public int getType() {
|
||||||
|
return type_;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* <code>optional int32 type = 5;</code>
|
||||||
|
*/
|
||||||
|
public Builder setType(int value) {
|
||||||
|
bitField0_ |= 0x00000010;
|
||||||
|
type_ = value;
|
||||||
|
onChanged();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* <code>optional int32 type = 5;</code>
|
||||||
|
*/
|
||||||
|
public Builder clearType() {
|
||||||
|
bitField0_ = (bitField0_ & ~0x00000010);
|
||||||
|
type_ = 0;
|
||||||
|
onChanged();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
// @@protoc_insertion_point(builder_scope:SearchUserRequest)
|
// @@protoc_insertion_point(builder_scope:SearchUserRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67604,44 +67841,45 @@ public final class WFCMessage {
|
|||||||
"ead\030\004 \001(\003\022\021\n\tnode_addr\030\005 \001(\t\022\021\n\tnode_por" +
|
"ead\030\004 \001(\003\022\021\n\tnode_addr\030\005 \001(\t\022\021\n\tnode_por" +
|
||||||
"t\030\006 \001(\005\022\023\n\013server_time\030\007 \001(\003\"P\n\rIMHttpWr",
|
"t\030\006 \001(\005\022\023\n\013server_time\030\007 \001(\003\"P\n\rIMHttpWr",
|
||||||
"apper\022\r\n\005token\030\001 \002(\t\022\021\n\tclient_id\030\002 \002(\t\022" +
|
"apper\022\r\n\005token\030\001 \002(\t\022\021\n\tclient_id\030\002 \002(\t\022" +
|
||||||
"\017\n\007request\030\003 \002(\t\022\014\n\004data\030\004 \001(\014\"A\n\021Search" +
|
"\017\n\007request\030\003 \002(\t\022\014\n\004data\030\004 \001(\014\"b\n\021Search" +
|
||||||
"UserRequest\022\017\n\007keyword\030\001 \002(\t\022\r\n\005fuzzy\030\002 " +
|
"UserRequest\022\017\n\007keyword\030\001 \002(\t\022\r\n\005fuzzy\030\002 " +
|
||||||
"\001(\005\022\014\n\004page\030\003 \001(\005\"(\n\020SearchUserResult\022\024\n" +
|
"\001(\005\022\014\n\004page\030\003 \001(\005\022\021\n\tdomain_id\030\004 \001(\t\022\014\n\004" +
|
||||||
"\005entry\030\001 \003(\0132\005.User\"@\n\026GetChatroomInfoRe" +
|
"type\030\005 \001(\005\"(\n\020SearchUserResult\022\024\n\005entry\030" +
|
||||||
"quest\022\023\n\013chatroom_id\030\001 \002(\t\022\021\n\tupdate_dt\030" +
|
"\001 \003(\0132\005.User\"@\n\026GetChatroomInfoRequest\022\023" +
|
||||||
"\002 \001(\003\"\227\001\n\014ChatroomInfo\022\r\n\005title\030\001 \002(\t\022\014\n" +
|
"\n\013chatroom_id\030\001 \002(\t\022\021\n\tupdate_dt\030\002 \001(\003\"\227" +
|
||||||
"\004desc\030\002 \001(\t\022\020\n\010portrait\030\003 \001(\t\022\024\n\014member_" +
|
"\001\n\014ChatroomInfo\022\r\n\005title\030\001 \002(\t\022\014\n\004desc\030\002" +
|
||||||
"count\030\004 \001(\005\022\021\n\tcreate_dt\030\005 \001(\003\022\021\n\tupdate" +
|
" \001(\t\022\020\n\010portrait\030\003 \001(\t\022\024\n\014member_count\030\004" +
|
||||||
"_dt\030\006 \001(\003\022\r\n\005extra\030\007 \001(\t\022\r\n\005state\030\010 \001(\005\"",
|
" \001(\005\022\021\n\tcreate_dt\030\005 \001(\003\022\021\n\tupdate_dt\030\006 \001",
|
||||||
"F\n\034GetChatroomMemberInfoRequest\022\023\n\013chatr" +
|
"(\003\022\r\n\005extra\030\007 \001(\t\022\r\n\005state\030\010 \001(\005\"F\n\034GetC" +
|
||||||
"oom_id\030\001 \002(\t\022\021\n\tmax_count\030\002 \001(\005\";\n\022Chatr" +
|
"hatroomMemberInfoRequest\022\023\n\013chatroom_id\030" +
|
||||||
"oomMemberInfo\022\024\n\014member_count\030\001 \001(\005\022\017\n\007m" +
|
"\001 \002(\t\022\021\n\tmax_count\030\002 \001(\005\";\n\022ChatroomMemb" +
|
||||||
"embers\030\002 \003(\t\"\026\n\010INT64Buf\022\n\n\002id\030\001 \002(\003\"4\n\023" +
|
"erInfo\022\024\n\014member_count\030\001 \001(\005\022\017\n\007members\030" +
|
||||||
"NotifyRecallMessage\022\n\n\002id\030\001 \002(\003\022\021\n\tfrom_" +
|
"\002 \003(\t\"\026\n\010INT64Buf\022\n\n\002id\030\001 \002(\003\"4\n\023NotifyR" +
|
||||||
"user\030\002 \002(\t\"/\n\020BlackUserRequest\022\013\n\003uid\030\001 " +
|
"ecallMessage\022\n\n\002id\030\001 \002(\003\022\021\n\tfrom_user\030\002 " +
|
||||||
"\002(\t\022\016\n\006status\030\002 \002(\005\"\323\001\n\014RouteRequest\022\013\n\003" +
|
"\002(\t\"/\n\020BlackUserRequest\022\013\n\003uid\030\001 \002(\t\022\016\n\006" +
|
||||||
"app\030\001 \001(\t\022\020\n\010platform\030\002 \001(\005\022\021\n\tpush_type" +
|
"status\030\002 \002(\005\"\323\001\n\014RouteRequest\022\013\n\003app\030\001 \001" +
|
||||||
"\030\003 \001(\005\022\023\n\013device_name\030\004 \001(\t\022\026\n\016device_ve" +
|
"(\t\022\020\n\010platform\030\002 \001(\005\022\021\n\tpush_type\030\003 \001(\005\022" +
|
||||||
"rsion\030\005 \001(\t\022\022\n\nphone_name\030\006 \001(\t\022\020\n\010langu",
|
"\023\n\013device_name\030\004 \001(\t\022\026\n\016device_version\030\005",
|
||||||
"age\030\007 \001(\t\022\024\n\014carrier_name\030\010 \001(\t\022\023\n\013app_v" +
|
" \001(\t\022\022\n\nphone_name\030\006 \001(\t\022\020\n\010language\030\007 \001" +
|
||||||
"ersion\030\t \001(\t\022\023\n\013sdk_version\030\n \001(\t\"D\n\rRou" +
|
"(\t\022\024\n\014carrier_name\030\010 \001(\t\022\023\n\013app_version\030" +
|
||||||
"teResponse\022\014\n\004host\030\001 \002(\t\022\021\n\tlong_port\030\002 " +
|
"\t \001(\t\022\023\n\013sdk_version\030\n \001(\t\"D\n\rRouteRespo" +
|
||||||
"\002(\005\022\022\n\nshort_port\030\003 \002(\005\"G\n\017GetTokenReque" +
|
"nse\022\014\n\004host\030\001 \002(\t\022\021\n\tlong_port\030\002 \002(\005\022\022\n\n" +
|
||||||
"st\022\017\n\007user_id\030\001 \002(\t\022\021\n\tclient_id\030\002 \002(\t\022\020" +
|
"short_port\030\003 \002(\005\"G\n\017GetTokenRequest\022\017\n\007u" +
|
||||||
"\n\010platform\030\003 \001(\005\"r\n\022LoadRemoteMessages\022#" +
|
"ser_id\030\001 \002(\t\022\021\n\tclient_id\030\002 \002(\t\022\020\n\010platf" +
|
||||||
"\n\014conversation\030\001 \002(\0132\r.Conversation\022\022\n\nb" +
|
"orm\030\003 \001(\005\"r\n\022LoadRemoteMessages\022#\n\014conve" +
|
||||||
"efore_uid\030\002 \002(\003\022\r\n\005count\030\003 \002(\005\022\024\n\014conten" +
|
"rsation\030\001 \002(\0132\r.Conversation\022\022\n\nbefore_u" +
|
||||||
"t_type\030\004 \003(\005\"a\n\020MultiCastMessage\022\021\n\tfrom" +
|
"id\030\002 \002(\003\022\r\n\005count\030\003 \002(\005\022\024\n\014content_type\030" +
|
||||||
"_user\030\001 \002(\t\022 \n\007content\030\002 \002(\0132\017.MessageCo",
|
"\004 \003(\005\"a\n\020MultiCastMessage\022\021\n\tfrom_user\030\001",
|
||||||
"ntent\022\n\n\002to\030\003 \003(\t\022\014\n\004line\030\004 \002(\005\"E\n\035Recal" +
|
" \002(\t\022 \n\007content\030\002 \002(\0132\017.MessageContent\022\n" +
|
||||||
"lMultiCastMessageRequest\022\022\n\nmessage_id\030\001" +
|
"\n\002to\030\003 \003(\t\022\014\n\004line\030\004 \002(\005\"E\n\035RecallMultiC" +
|
||||||
" \002(\003\022\020\n\010receiver\030\002 \003(\t\"@\n\017AuthCodeReques" +
|
"astMessageRequest\022\022\n\nmessage_id\030\001 \002(\003\022\020\n" +
|
||||||
"t\022\021\n\ttarget_id\030\001 \002(\t\022\014\n\004type\030\002 \002(\005\022\014\n\004ho" +
|
"\010receiver\030\002 \003(\t\"@\n\017AuthCodeRequest\022\021\n\tta" +
|
||||||
"st\030\003 \002(\t\"o\n\030ApplicationConfigRequest\022\r\n\005" +
|
"rget_id\030\001 \002(\t\022\014\n\004type\030\002 \002(\005\022\014\n\004host\030\003 \002(" +
|
||||||
"appId\030\001 \002(\t\022\017\n\007appType\030\002 \002(\005\022\021\n\ttimestam" +
|
"\t\"o\n\030ApplicationConfigRequest\022\r\n\005appId\030\001" +
|
||||||
"p\030\003 \002(\003\022\r\n\005nonce\030\004 \002(\t\022\021\n\tsignature\030\005 \002(" +
|
" \002(\t\022\017\n\007appType\030\002 \002(\005\022\021\n\ttimestamp\030\003 \002(\003" +
|
||||||
"\tB/\n\025cn.wildfirechat.protoB\nWFCMessageZ\n" +
|
"\022\r\n\005nonce\030\004 \002(\t\022\021\n\tsignature\030\005 \002(\tB/\n\025cn" +
|
||||||
"./go;proto"
|
".wildfirechat.protoB\nWFCMessageZ\n./go;pr" +
|
||||||
|
"oto"
|
||||||
};
|
};
|
||||||
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
||||||
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
|
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
|
||||||
@@ -68007,7 +68245,7 @@ public final class WFCMessage {
|
|||||||
internal_static_SearchUserRequest_fieldAccessorTable = new
|
internal_static_SearchUserRequest_fieldAccessorTable = new
|
||||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||||
internal_static_SearchUserRequest_descriptor,
|
internal_static_SearchUserRequest_descriptor,
|
||||||
new java.lang.String[] { "Keyword", "Fuzzy", "Page", });
|
new java.lang.String[] { "Keyword", "Fuzzy", "Page", "DomainId", "Type", });
|
||||||
internal_static_SearchUserResult_descriptor =
|
internal_static_SearchUserResult_descriptor =
|
||||||
getDescriptor().getMessageTypes().get(60);
|
getDescriptor().getMessageTypes().get(60);
|
||||||
internal_static_SearchUserResult_fieldAccessorTable = new
|
internal_static_SearchUserResult_fieldAccessorTable = new
|
||||||
|
|||||||
@@ -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>1.3.3</version>
|
<version>1.3.7</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>distribution</artifactId>
|
<artifactId>distribution</artifactId>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
部署IM服务后,可以使用Server SDK通过API来检查服务的部署情况,可以执行:
|
部署IM服务后,可以使用Server SDK通过API来检查服务的部署情况,可以执行:
|
||||||
```shell
|
```shell
|
||||||
java -jar checker.jar http://127.0.0.1:18080 123456 http://127.0.0.1 true false
|
java -jar checker.jar http://127.0.0.1:18080 123456 http://127.0.0.1 false false
|
||||||
```
|
```
|
||||||
来检查。检查之后会产生垃圾数据,请在检查之后停掉IM服务后,再删除掉IM服务数据库。此检查仅检查API,检查通过并不代表部署肯定成功,还需要客户端来验证。
|
来检查。检查之后会产生垃圾数据,请在检查之后停掉IM服务后,再删除掉IM服务数据库。此检查仅检查API,检查通过并不代表部署肯定成功,还需要客户端来验证。
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ local_port 80
|
|||||||
## MySQL需要把事物隔离级别改成"Read committed",使用命令来修改"set global transaction_isolation='read-committed';",其他数据库默认已经是这个级别不用修改
|
## MySQL需要把事物隔离级别改成"Read committed",使用命令来修改"set global transaction_isolation='read-committed';",其他数据库默认已经是这个级别不用修改
|
||||||
## 如果使用MySQL,请在c3p0.xml文件中配置JDBC信息。
|
## 如果使用MySQL,请在c3p0.xml文件中配置JDBC信息。
|
||||||
## 如果是MySQL5.7,需要开启长索引的支持,在数据库中执行命令:"set global innodb_large_prefix=on;"。其他版本默认支持,不用修改。
|
## 如果是MySQL5.7,需要开启长索引的支持,在数据库中执行命令:"set global innodb_large_prefix=on;"。其他版本默认支持,不用修改。
|
||||||
|
## 如果使用MySQL 8.0.30以上版本,有个特性是创建表时如果没有主键将会自动创建一个主键"my_key_id",如果此功能打开,在执行mysql脚本V19__add_id_for_sensitive_word.sql时将会报错,提示不能2个主键。
|
||||||
|
## 解决办法就是运行出错后删除掉系统自动创建的主键"my_key_id",然后继续执行。
|
||||||
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年前的历史消息。
|
||||||
@@ -106,7 +108,7 @@ message.disable_remote_search false
|
|||||||
##如果要避免数据库中明文存储消息内容,请打开这个开关和message.disable_remote_search开关
|
##如果要避免数据库中明文存储消息内容,请打开这个开关和message.disable_remote_search开关
|
||||||
message.encrypt_message_content false
|
message.encrypt_message_content false
|
||||||
|
|
||||||
##允许客户端撤回用户自己发送的消息时限,单位是秒。
|
##允许客户端撤回用户自己发送的消息时限,单位是秒。0是不允许撤回;-1是无限制撤回。
|
||||||
##Server API不受此限制,可以撤回任意时限内的消息
|
##Server API不受此限制,可以撤回任意时限内的消息
|
||||||
##群组管理员或群主撤回群成员消息不受此限制,可以撤回任意时限内的消息。但管理员或群主撤回自己的消息还是需要准守此时间限制。
|
##群组管理员或群主撤回群成员消息不受此限制,可以撤回任意时限内的消息。但管理员或群主撤回自己的消息还是需要准守此时间限制。
|
||||||
##修改此参数需要同步修改客户端UI,客户端UI代码有判断撤回是否显示的逻辑。
|
##修改此参数需要同步修改客户端UI,客户端UI代码有判断撤回是否显示的逻辑。
|
||||||
@@ -147,12 +149,33 @@ message.no_forward_admin_message false
|
|||||||
## 消息转发功能开启时,转发信息是否带上用户clientId和平台类型。
|
## 消息转发功能开启时,转发信息是否带上用户clientId和平台类型。
|
||||||
message.forward_with_client_info false
|
message.forward_with_client_info false
|
||||||
|
|
||||||
|
## 消息转发功能开启时,转发信息是否带上发送者的用户信息
|
||||||
|
message.forward_with_sender_info false
|
||||||
|
|
||||||
|
## 消息转发功能开启时,转发信息是否带上目标的信息,单聊时是对方用户信息,群聊时是群组信息,频道时是频道信息
|
||||||
|
message.forward_with_target_info false
|
||||||
|
|
||||||
|
## 允许发送单聊消息给被封禁用户
|
||||||
|
message.allow_send_to_forbidden_user false
|
||||||
|
|
||||||
## 机器人回调信息是否带上用户clientId和平台类型。
|
## 机器人回调信息是否带上用户clientId和平台类型。
|
||||||
robot.callback_with_client_info false
|
robot.callback_with_client_info false
|
||||||
|
|
||||||
|
## 机器人回调信息是否带上发送者的用户信息
|
||||||
|
robot.callback_with_sender_info false
|
||||||
|
|
||||||
|
## 机器人回调信息是否带上目标的信息,单聊时是对方用户信息,群聊时是群组信息,频道时是频道信息
|
||||||
|
robot.callback_with_target_info false
|
||||||
|
|
||||||
## 频道回调信息是否带上用户clientId和平台类型。
|
## 频道回调信息是否带上用户clientId和平台类型。
|
||||||
channel.callback_with_client_info false
|
channel.callback_with_client_info false
|
||||||
|
|
||||||
|
## 频道回调信息是否带上发送者的用户信息。
|
||||||
|
channel.callback_with_sender_info false
|
||||||
|
|
||||||
|
## 频道回调信息是否带上频道信息
|
||||||
|
channel.callback_with_target_info false
|
||||||
|
|
||||||
## 频道回调新方式,在新方式下,如果有callback地址就会总是回调客户端发送的消息(包括owner和订阅者)。automatic属性控制订阅者发送的消息是否发给owner, 0发,1不发。
|
## 频道回调新方式,在新方式下,如果有callback地址就会总是回调客户端发送的消息(包括owner和订阅者)。automatic属性控制订阅者发送的消息是否发给owner, 0发,1不发。
|
||||||
## 旧的方式是,automatic为0时,订阅者的消息发给owner,不转发消息到callback地址。为1时,把订阅者的消息转发给callback地址,不发给owner。
|
## 旧的方式是,automatic为0时,订阅者的消息发给owner,不转发消息到callback地址。为1时,把订阅者的消息转发给callback地址,不发给owner。
|
||||||
channel.new_callback_feature true
|
channel.new_callback_feature true
|
||||||
@@ -223,8 +246,12 @@ group.visible_quit_or_kickoff_notification 0
|
|||||||
## 是否禁止陌生人拉人入群,默认为false
|
## 是否禁止陌生人拉人入群,默认为false
|
||||||
group.disable_stranger_invite false
|
group.disable_stranger_invite false
|
||||||
|
|
||||||
|
## 创建群组或者加人时。可能会有成员加入失败(黑名单,或者不允许陌生人拉入群)。当出现有成员失败时,如果此开关为关,操作会失败。
|
||||||
|
## 如果此开关打开,操作会返回成功,另外在群里发送一条通知消息 XXX 拒绝加入群组。默认为开。
|
||||||
|
group.add_member_allow_part_success true
|
||||||
|
|
||||||
## 群组信息是否标记删除
|
## 群组信息是否标记删除
|
||||||
group.enable_mark_deletion false
|
group.enable_mark_deletion true
|
||||||
|
|
||||||
## 隐藏用户信息属性类型,2是性别,3是电话号码,4是邮箱,5是地址,6是公司信息,7是社交账号,8是Extra信息。当需要隐藏多个时以英文逗号分开;
|
## 隐藏用户信息属性类型,2是性别,3是电话号码,4是邮箱,5是地址,6是公司信息,7是社交账号,8是Extra信息。当需要隐藏多个时以英文逗号分开;
|
||||||
## 本配置是为了提高安全性,避免把对应信息同步到客户端,这样就能防止程序被破解从而拿到用户关键信息。仅对客户端有效,server api不受影响。
|
## 本配置是为了提高安全性,避免把对应信息同步到客户端,这样就能防止程序被破解从而拿到用户关键信息。仅对客户端有效,server api不受影响。
|
||||||
|
|||||||
@@ -75,11 +75,9 @@ rem set JAVA_OPTS=%JAVA_OPTS% -XX:GCLogFileSize=10M"
|
|||||||
rem If the JDK version is 9 or above, please open this configuration.
|
rem If the JDK version is 9 or above, please open this configuration.
|
||||||
rem set JAVA_OPTS=%JAVA_OPTS% --add-modules java.se --add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.management/sun.management=ALL-UNNAMED --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED
|
rem set JAVA_OPTS=%JAVA_OPTS% --add-modules java.se --add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.management/sun.management=ALL-UNNAMED --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED
|
||||||
|
|
||||||
echo
|
|
||||||
echo "Please set Xmx and Xms parameters!"
|
echo "Please set Xmx and Xms parameters!"
|
||||||
echo "Please set Xmx and Xms parameters!"
|
echo "Please set Xmx and Xms parameters!"
|
||||||
echo "Please set Xmx and Xms parameters!"
|
echo "Please set Xmx and Xms parameters!"
|
||||||
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
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<artifactId>wildfirechat-parent</artifactId>
|
<artifactId>wildfirechat-parent</artifactId>
|
||||||
|
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<version>1.3.3</version>
|
<version>1.3.7</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>
|
||||||
|
|||||||
+32
-1
@@ -8,9 +8,40 @@
|
|||||||
7. *** 从0.68 版本起添加了pc在线是否默认手机接收推送的开关,默认为开,与以前版本作用相反,请注意兼容(可以关掉与之前保持一致或者升级客户端) ***
|
7. *** 从0.68 版本起添加了pc在线是否默认手机接收推送的开关,默认为开,与以前版本作用相反,请注意兼容(可以关掉与之前保持一致或者升级客户端) ***
|
||||||
8. *** 从0.78 版本起把MySQL数据库中关键字都改为大小写敏感,另外生成id的方法也做了改变,只生成小写的id,避免出现id重复的问题,建议所有客户都升级 ***
|
8. *** 从0.78 版本起把MySQL数据库中关键字都改为大小写敏感,另外生成id的方法也做了改变,只生成小写的id,避免出现id重复的问题,建议所有客户都升级 ***
|
||||||
9. *** 从0.79 版本起把log4j升级到log4j2,因为log4j已经不再维护而且还有已知的漏洞,建议所有客户都升级,升级时注意更新log4j2的配置文件 ***
|
9. *** 从0.79 版本起把log4j升级到log4j2,因为log4j已经不再维护而且还有已知的漏洞,建议所有客户都升级,升级时注意更新log4j2的配置文件 ***
|
||||||
10. *** 5. 0.97版本更改了启动脚本```wildfirechat.sh```,如果是升级服务,请注意更新启动脚本。***
|
10. *** 0.97版本更改了启动脚本```wildfirechat.sh```,如果是升级服务,请注意更新启动脚本。***
|
||||||
|
|
||||||
# 更新记录
|
# 更新记录
|
||||||
|
--------------
|
||||||
|
Release note 1.3.7:
|
||||||
|
1. 搜索用户可以指定搜索机器人、普通用户或者所有。
|
||||||
|
2. 添加群组成员时,允许部分失败。
|
||||||
|
3. 解决内置存储上传文件时可能内存泄漏。
|
||||||
|
4. 支持客户端上传本地角标,用于推送得到较为精确的角标数字。
|
||||||
|
5. 解决机器人回调配置携带发送者用户信息无效的问题。
|
||||||
|
|
||||||
|
--------------
|
||||||
|
Release note 1.3.6:
|
||||||
|
1. Server API创建频道时,返回频道ID和频道密钥。
|
||||||
|
2. 解决外置审核替换内容没有成功的问题。
|
||||||
|
3. 修改撤回消息限制,可以运行不限制撤回。
|
||||||
|
4. 创建/更新频道接口可以传菜单参数。
|
||||||
|
5. Server API支持修改群组类型。
|
||||||
|
|
||||||
|
--------------
|
||||||
|
Release note 1.3.5:
|
||||||
|
1. 转发消息回调中可以配置带上发送者和目标信息。
|
||||||
|
2. Server SDK中添加撤回和删除消息。
|
||||||
|
3. Server SDK中添加发送朋友圈接口。
|
||||||
|
4. 添加配置是否允许发送消息给被封禁用户。
|
||||||
|
5. 音视频通话挂断推送中带上发起消息的ID
|
||||||
|
|
||||||
|
--------------
|
||||||
|
Release note 1.3.4:
|
||||||
|
1. 优化Server SDK中消息内容的处理方式。
|
||||||
|
2. Server SDK中添加注册消息接口,在使用自定义消息时,不需要修改Server SDK源码。
|
||||||
|
3. 用户撤回时间配置允许为负数,为负数时可以任意时间撤回。
|
||||||
|
4. Server SDK添加超时参数。
|
||||||
|
5. 解决当分段拉取消息时,可能丢失消息的问题。
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
Release note 1.3.3:
|
Release note 1.3.3:
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>wildfirechat-parent</artifactId>
|
<artifactId>wildfirechat-parent</artifactId>
|
||||||
<groupId>cn.wildfirechat</groupId>
|
<groupId>cn.wildfirechat</groupId>
|
||||||
<version>1.3.3</version>
|
<version>1.3.7</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public class ChannelServiceApi {
|
|||||||
return channelHttpUtils.httpJsonPost(path, null, OutputGetChannelInfo.class);
|
return channelHttpUtils.httpJsonPost(path, null, OutputGetChannelInfo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IMResult<Void> modifyChannelMenu(List<OutputGetChannelInfo.OutputMenu> menus) throws Exception {
|
public IMResult<Void> modifyChannelMenu(List<PojoChannelMenu> menus) throws Exception {
|
||||||
String menuStr = new Gson().toJson(menus);
|
String menuStr = new Gson().toJson(menus);
|
||||||
return modifyChannelInfo(ProtoConstants.ModifyChannelInfoType.Modify_Channel_Menu, menuStr);
|
return modifyChannelInfo(ProtoConstants.ModifyChannelInfoType.Modify_Channel_Menu, menuStr);
|
||||||
}
|
}
|
||||||
@@ -59,7 +59,7 @@ public class ChannelServiceApi {
|
|||||||
public IMResult<SendMessageResult> sendMessage(int line, List<String> targets, MessagePayload payload) throws Exception {
|
public IMResult<SendMessageResult> sendMessage(int line, List<String> targets, MessagePayload payload) throws Exception {
|
||||||
String path = APIPath.Channel_Message_Send;
|
String path = APIPath.Channel_Message_Send;
|
||||||
SendChannelMessageData messageData = new SendChannelMessageData();
|
SendChannelMessageData messageData = new SendChannelMessageData();
|
||||||
messageData.setLine(0);
|
messageData.setLine(line);
|
||||||
messageData.setTargets(targets);
|
messageData.setTargets(targets);
|
||||||
messageData.setPayload(payload);
|
messageData.setPayload(payload);
|
||||||
return channelHttpUtils.httpJsonPost(path, messageData, SendMessageResult.class);
|
return channelHttpUtils.httpJsonPost(path, messageData, SendMessageResult.class);
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -39,12 +39,13 @@ public class MeshAdmin {
|
|||||||
return AdminHttpUtils.httpJsonPost(path, getUserInfo, OutputUserInfoList.class);
|
return AdminHttpUtils.httpJsonPost(path, getUserInfo, OutputUserInfoList.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IMResult<PojoSearchUserRes> searchUser(String keyword, int searchType, int page) throws Exception {
|
public static IMResult<PojoSearchUserRes> searchUser(String keyword, int searchType, int userType, int page) throws Exception {
|
||||||
String path = APIPath.Search_User;
|
String path = APIPath.Search_User;
|
||||||
PojoSearchUserReq req = new PojoSearchUserReq();
|
PojoSearchUserReq req = new PojoSearchUserReq();
|
||||||
req.keyword = keyword;
|
req.keyword = keyword;
|
||||||
req.searchType = searchType;
|
req.searchType = searchType;
|
||||||
req.page = page;
|
req.page = page;
|
||||||
|
req.userType = userType;
|
||||||
return AdminHttpUtils.httpJsonPost(path, req, PojoSearchUserRes.class);
|
return AdminHttpUtils.httpJsonPost(path, req, PojoSearchUserRes.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package cn.wildfirechat.sdk;
|
||||||
|
|
||||||
|
import cn.wildfirechat.common.APIPath;
|
||||||
|
import cn.wildfirechat.pojos.*;
|
||||||
|
import cn.wildfirechat.pojos.moments.FeedPojo;
|
||||||
|
import cn.wildfirechat.sdk.model.IMResult;
|
||||||
|
import cn.wildfirechat.sdk.utilities.AdminHttpUtils;
|
||||||
|
|
||||||
|
|
||||||
|
public class MomentsAdmin {
|
||||||
|
public static IMResult<SendMessageResult> postFeeds(FeedPojo feedPojo) throws Exception {
|
||||||
|
String path = APIPath.Admin_Moments_Post_Feed;
|
||||||
|
return AdminHttpUtils.httpJsonPost(path, feedPojo, SendMessageResult.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -32,7 +32,7 @@ public class ArticlesMessageContent extends MessageContent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MessagePayload encode() {
|
public MessagePayload encode() {
|
||||||
MessagePayload payload = super.encodeBase();
|
MessagePayload payload = super.encode();
|
||||||
payload.setSearchableContent(topArticle.title);
|
payload.setSearchableContent(topArticle.title);
|
||||||
JSONObject object = new JSONObject();
|
JSONObject object = new JSONObject();
|
||||||
|
|
||||||
@@ -53,6 +53,7 @@ public class ArticlesMessageContent extends MessageContent {
|
|||||||
@Override
|
@Override
|
||||||
public void decode(MessagePayload payload) {
|
public void decode(MessagePayload payload) {
|
||||||
try {
|
try {
|
||||||
|
super.decode(payload);
|
||||||
JSONObject object = (JSONObject) new JSONParser().parse(new String(Base64.getDecoder().decode(payload.getBase64edData())));
|
JSONObject object = (JSONObject) new JSONParser().parse(new String(Base64.getDecoder().decode(payload.getBase64edData())));
|
||||||
JSONObject topObj = (JSONObject) object.get("top");
|
JSONObject topObj = (JSONObject) object.get("top");
|
||||||
this.topArticle = Article.fromJson(topObj);
|
this.topArticle = Article.fromJson(topObj);
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ public class CallStartMessageContent extends MessageContent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MessagePayload encode() {
|
public MessagePayload encode() {
|
||||||
MessagePayload payload = super.encodeBase();
|
MessagePayload payload = super.encode();
|
||||||
payload.setContent(callId);
|
payload.setContent(callId);
|
||||||
payload.setPushContent("音视频通话邀请");
|
payload.setPushContent("音视频通话邀请");
|
||||||
|
|
||||||
@@ -175,6 +175,7 @@ public class CallStartMessageContent extends MessageContent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decode(MessagePayload payload) {
|
public void decode(MessagePayload payload) {
|
||||||
|
super.decode(payload);
|
||||||
callId = payload.getContent();
|
callId = payload.getContent();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ public class CardMessageContent extends MessageContent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MessagePayload encode() {
|
public MessagePayload encode() {
|
||||||
MessagePayload payload = super.encodeBase();
|
MessagePayload payload = super.encode();
|
||||||
payload.setContent(target);
|
payload.setContent(target);
|
||||||
JSONObject objWrite = new JSONObject();
|
JSONObject objWrite = new JSONObject();
|
||||||
objWrite.put("t", type);
|
objWrite.put("t", type);
|
||||||
@@ -116,6 +116,7 @@ public class CardMessageContent extends MessageContent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decode(MessagePayload payload) {
|
public void decode(MessagePayload payload) {
|
||||||
|
super.decode(payload);
|
||||||
target = payload.getContent();
|
target = payload.getContent();
|
||||||
try {
|
try {
|
||||||
if (!StringUtil.isNullOrEmpty(payload.getBase64edData())) {
|
if (!StringUtil.isNullOrEmpty(payload.getBase64edData())) {
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package cn.wildfirechat.sdk.messagecontent;
|
||||||
|
|
||||||
|
import cn.wildfirechat.pojos.MessagePayload;
|
||||||
|
import cn.wildfirechat.proto.ProtoConstants;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Base64;
|
||||||
|
|
||||||
|
public class DeleteMessageContent extends MessageContent {
|
||||||
|
private long messageId;
|
||||||
|
private String operatorId;
|
||||||
|
|
||||||
|
//必须有个空的构造函数
|
||||||
|
public DeleteMessageContent() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getMessageId() {
|
||||||
|
return messageId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOperatorId() {
|
||||||
|
return operatorId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getContentType() {
|
||||||
|
return ProtoConstants.ContentType.Delete;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getPersistFlag() {
|
||||||
|
return ProtoConstants.PersistFlag.Not_Persist;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MessagePayload encode() {
|
||||||
|
throw new RuntimeException("Delete message cannot encode");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void decode(MessagePayload payload) {
|
||||||
|
super.decode(payload);
|
||||||
|
operatorId = payload.getContent();
|
||||||
|
messageId = Long.parseLong(new String(Base64.getDecoder().decode(payload.getBase64edData()), StandardCharsets.UTF_8));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -26,7 +26,7 @@ public class FileMessageContent extends MediaMessageContent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MessagePayload encode() {
|
public MessagePayload encode() {
|
||||||
MessagePayload payload = super.encodeBase();
|
MessagePayload payload = super.encode();
|
||||||
payload.setSearchableContent(name);
|
payload.setSearchableContent(name);
|
||||||
payload.setContent(size + "");
|
payload.setContent(size + "");
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ public class FileMessageContent extends MediaMessageContent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decode(MessagePayload payload) {
|
public void decode(MessagePayload payload) {
|
||||||
super.decodeBase(payload);
|
super.decode(payload);
|
||||||
|
|
||||||
if (payload.getSearchableContent().startsWith(FILE_NAME_PREFIX)) {
|
if (payload.getSearchableContent().startsWith(FILE_NAME_PREFIX)) {
|
||||||
name = payload.getSearchableContent().substring(payload.getSearchableContent().indexOf(FILE_NAME_PREFIX) + FILE_NAME_PREFIX.length());
|
name = payload.getSearchableContent().substring(payload.getSearchableContent().indexOf(FILE_NAME_PREFIX) + FILE_NAME_PREFIX.length());
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class ImageMessageContent extends MediaMessageContent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MessagePayload encode() {
|
public MessagePayload encode() {
|
||||||
MessagePayload payload = super.encodeBase();
|
MessagePayload payload = super.encode();
|
||||||
payload.setSearchableContent("[图片]");
|
payload.setSearchableContent("[图片]");
|
||||||
payload.setBase64edData(Base64.getEncoder().encodeToString(thumbnailBytes));
|
payload.setBase64edData(Base64.getEncoder().encodeToString(thumbnailBytes));
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ public class ImageMessageContent extends MediaMessageContent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decode(MessagePayload payload) {
|
public void decode(MessagePayload payload) {
|
||||||
super.decodeBase(payload);
|
super.decode(payload);
|
||||||
thumbnailBytes = Base64.getDecoder().decode(payload.getBase64edData());
|
thumbnailBytes = Base64.getDecoder().decode(payload.getBase64edData());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,9 +72,7 @@ public class LinkMessageContent extends MessageContent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MessagePayload encode() {
|
public MessagePayload encode() {
|
||||||
MessagePayload payload = super.encodeBase();
|
MessagePayload payload = super.encode();
|
||||||
|
|
||||||
|
|
||||||
payload.setSearchableContent(title);
|
payload.setSearchableContent(title);
|
||||||
JSONObject objWrite = new JSONObject();
|
JSONObject objWrite = new JSONObject();
|
||||||
objWrite.put("d", contentDigest);
|
objWrite.put("d", contentDigest);
|
||||||
@@ -88,9 +86,8 @@ public class LinkMessageContent extends MessageContent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decode(MessagePayload payload) {
|
public void decode(MessagePayload payload) {
|
||||||
|
super.decode(payload);
|
||||||
title = payload.getSearchableContent();
|
title = payload.getSearchableContent();
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!StringUtil.isNullOrEmpty(payload.getBase64edData())) {
|
if (!StringUtil.isNullOrEmpty(payload.getBase64edData())) {
|
||||||
JSONObject jsonObject = (JSONObject) new JSONParser().parse(new String(Base64.getDecoder().decode(payload.getBase64edData())));
|
JSONObject jsonObject = (JSONObject) new JSONParser().parse(new String(Base64.getDecoder().decode(payload.getBase64edData())));
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public class LocationMessageContent extends MessageContent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MessagePayload encode() {
|
public MessagePayload encode() {
|
||||||
MessagePayload payload = super.encodeBase();
|
MessagePayload payload = super.encode();
|
||||||
payload.setSearchableContent(title);
|
payload.setSearchableContent(title);
|
||||||
payload.setBase64edData(Base64.getEncoder().encodeToString(this.thumbnailByte));
|
payload.setBase64edData(Base64.getEncoder().encodeToString(this.thumbnailByte));
|
||||||
|
|
||||||
@@ -82,6 +82,7 @@ public class LocationMessageContent extends MessageContent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decode(MessagePayload payload) {
|
public void decode(MessagePayload payload) {
|
||||||
|
super.decode(payload);
|
||||||
if (!StringUtil.isNullOrEmpty(payload.getBase64edData())) {
|
if (!StringUtil.isNullOrEmpty(payload.getBase64edData())) {
|
||||||
this.thumbnailByte = Base64.getDecoder().decode(payload.getBase64edData());
|
this.thumbnailByte = Base64.getDecoder().decode(payload.getBase64edData());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,12 +14,18 @@ abstract public class MediaMessageContent extends MessageContent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected MessagePayload encodeBase() {
|
public MessagePayload encode() {
|
||||||
MessagePayload payload = super.encodeBase();
|
MessagePayload payload = super.encode();
|
||||||
payload.setRemoteMediaUrl(remoteMediaUrl);
|
payload.setRemoteMediaUrl(remoteMediaUrl);
|
||||||
payload.setMediaType(getMediaType());
|
payload.setMediaType(getMediaType());
|
||||||
return payload;
|
return payload;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void decode(MessagePayload payload) {
|
||||||
|
super.decode(payload);
|
||||||
|
remoteMediaUrl = payload.getRemoteMediaUrl();
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract int getMediaType();
|
protected abstract int getMediaType();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public abstract class MessageContent {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MessagePayload encodeBase() {
|
public MessagePayload encode() {
|
||||||
MessagePayload payload = new MessagePayload();
|
MessagePayload payload = new MessagePayload();
|
||||||
payload.setType(getContentType());
|
payload.setType(getContentType());
|
||||||
payload.setPersistFlag(getPersistFlag());
|
payload.setPersistFlag(getPersistFlag());
|
||||||
@@ -32,13 +32,11 @@ public abstract class MessageContent {
|
|||||||
return payload;
|
return payload;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void decodeBase(MessagePayload payload) {
|
protected void decode(MessagePayload payload) {
|
||||||
this.mentionedType = payload.getMentionedType();
|
this.mentionedType = payload.getMentionedType();
|
||||||
this.mentionedTargets = payload.getMentionedTarget();
|
this.mentionedTargets = payload.getMentionedTarget();
|
||||||
this.extra = payload.getExtra();
|
this.extra = payload.getExtra();
|
||||||
}
|
}
|
||||||
abstract public int getContentType();
|
abstract public int getContentType();
|
||||||
abstract public int getPersistFlag();
|
abstract public int getPersistFlag();
|
||||||
abstract public MessagePayload encode();
|
|
||||||
abstract public void decode(MessagePayload payload);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import java.util.Map;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public class MessageContentFactory {
|
public class MessageContentFactory {
|
||||||
private static final Map<Integer, Class<MessageContent>> contentClassMap = new ConcurrentHashMap<>();
|
private static final Map<Integer, Class<? extends MessageContent>> contentClassMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
registerAllMessageContent();
|
registerAllMessageContent();
|
||||||
@@ -36,7 +36,7 @@ public class MessageContentFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static MessageContent decodeMessageContent(MessagePayload messagePayload) {
|
public static MessageContent decodeMessageContent(MessagePayload messagePayload) {
|
||||||
Class<MessageContent> cls = contentClassMap.get(messagePayload.getType());
|
Class<? extends MessageContent> cls = contentClassMap.get(messagePayload.getType());
|
||||||
MessageContent messageContent;
|
MessageContent messageContent;
|
||||||
if(cls != null) {
|
if(cls != null) {
|
||||||
try {
|
try {
|
||||||
@@ -49,11 +49,15 @@ public class MessageContentFactory {
|
|||||||
} else {
|
} else {
|
||||||
messageContent = new UnknownMessageContent();
|
messageContent = new UnknownMessageContent();
|
||||||
}
|
}
|
||||||
messageContent.decodeBase(messagePayload);
|
|
||||||
messageContent.decode(messagePayload);
|
messageContent.decode(messagePayload);
|
||||||
return messageContent;
|
return messageContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void registerCustomMessageContent(Class<? extends MessageContent> cls) throws Exception {
|
||||||
|
MessageContent content = cls.newInstance();
|
||||||
|
contentClassMap.put(content.getContentType(), cls);
|
||||||
|
}
|
||||||
|
|
||||||
private static void registerAllMessageContent() {
|
private static void registerAllMessageContent() {
|
||||||
try {
|
try {
|
||||||
for (Class cls : ClassUtil.getAllAssignedClass(MessageContent.class)) {
|
for (Class cls : ClassUtil.getAllAssignedClass(MessageContent.class)) {
|
||||||
|
|||||||
+2
-1
@@ -43,7 +43,7 @@ public class MultiCallOngoingMessageContent extends MessageContent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MessagePayload encode() {
|
public MessagePayload encode() {
|
||||||
MessagePayload payload = super.encodeBase();
|
MessagePayload payload = super.encode();
|
||||||
payload.setContent(callId);
|
payload.setContent(callId);
|
||||||
JSONObject object = new JSONObject();
|
JSONObject object = new JSONObject();
|
||||||
object.put("initiator", this.initiator);
|
object.put("initiator", this.initiator);
|
||||||
@@ -60,6 +60,7 @@ public class MultiCallOngoingMessageContent extends MessageContent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decode(MessagePayload payload) {
|
public void decode(MessagePayload payload) {
|
||||||
|
super.decode(payload);
|
||||||
this.callId = payload.getContent();
|
this.callId = payload.getContent();
|
||||||
try {
|
try {
|
||||||
JSONObject object = (JSONObject) new JSONParser().parse(new String(Base64.getDecoder().decode(payload.getBase64edData())));
|
JSONObject object = (JSONObject) new JSONParser().parse(new String(Base64.getDecoder().decode(payload.getBase64edData())));
|
||||||
|
|||||||
+2
-2
@@ -57,7 +57,7 @@ public class NotDeliveredMessageContent extends MessageContent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MessagePayload encode() {
|
public MessagePayload encode() {
|
||||||
MessagePayload payload = super.encodeBase();
|
MessagePayload payload = super.encode();
|
||||||
JSONObject obj = new JSONObject();
|
JSONObject obj = new JSONObject();
|
||||||
obj.put("mid", this.messageUid);
|
obj.put("mid", this.messageUid);
|
||||||
obj.put("all", this.allFailure);
|
obj.put("all", this.allFailure);
|
||||||
@@ -74,7 +74,7 @@ public class NotDeliveredMessageContent extends MessageContent {
|
|||||||
@Override
|
@Override
|
||||||
public void decode(MessagePayload payload) {
|
public void decode(MessagePayload payload) {
|
||||||
try {
|
try {
|
||||||
|
super.decode(payload);
|
||||||
JSONObject obj = (JSONObject) new JSONParser().parse(new String(Base64.getDecoder().decode(payload.getBase64edData())));
|
JSONObject obj = (JSONObject) new JSONParser().parse(new String(Base64.getDecoder().decode(payload.getBase64edData())));
|
||||||
this.messageUid = (long) obj.get("mid");
|
this.messageUid = (long) obj.get("mid");
|
||||||
this.allFailure = (boolean) obj.get("all");
|
this.allFailure = (boolean) obj.get("all");
|
||||||
|
|||||||
@@ -0,0 +1,122 @@
|
|||||||
|
package cn.wildfirechat.sdk.messagecontent;
|
||||||
|
|
||||||
|
import cn.wildfirechat.pojos.MessagePayload;
|
||||||
|
import cn.wildfirechat.proto.ProtoConstants;
|
||||||
|
import org.apache.http.util.TextUtils;
|
||||||
|
import org.json.simple.JSONObject;
|
||||||
|
import org.json.simple.parser.JSONParser;
|
||||||
|
import org.json.simple.parser.ParseException;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Base64;
|
||||||
|
|
||||||
|
public class RecallMessageContent extends MessageContent {
|
||||||
|
private long messageId;
|
||||||
|
private String operatorId;
|
||||||
|
|
||||||
|
|
||||||
|
private String originalSender;
|
||||||
|
|
||||||
|
private int originalContentType;
|
||||||
|
private String originalSearchableContent;
|
||||||
|
private String originalContent;
|
||||||
|
private String originalExtra;
|
||||||
|
private byte[] originalBinaryContent;
|
||||||
|
private int originalMediaType;
|
||||||
|
private String originalMediaUrl;
|
||||||
|
private long originalMessageTimestamp;
|
||||||
|
|
||||||
|
//必须有个空的构造函数
|
||||||
|
public RecallMessageContent() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getMessageId() {
|
||||||
|
return messageId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOperatorId() {
|
||||||
|
return operatorId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOriginalSender() {
|
||||||
|
return originalSender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getOriginalContentType() {
|
||||||
|
return originalContentType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOriginalSearchableContent() {
|
||||||
|
return originalSearchableContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOriginalContent() {
|
||||||
|
return originalContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOriginalExtra() {
|
||||||
|
return originalExtra;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getOriginalMessageTimestamp() {
|
||||||
|
return originalMessageTimestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] getOriginalBinaryContent() {
|
||||||
|
return originalBinaryContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getOriginalMediaType() {
|
||||||
|
return originalMediaType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOriginalMediaUrl() {
|
||||||
|
return originalMediaUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getContentType() {
|
||||||
|
return ProtoConstants.ContentType.Recall;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getPersistFlag() {
|
||||||
|
return ProtoConstants.PersistFlag.Persist;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MessagePayload encode() {
|
||||||
|
throw new RuntimeException("Recall message cannot encode");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void decode(MessagePayload payload) {
|
||||||
|
super.decode(payload);
|
||||||
|
operatorId = payload.getContent();
|
||||||
|
messageId = Long.parseLong(new String(Base64.getDecoder().decode(payload.getBase64edData()), StandardCharsets.UTF_8));
|
||||||
|
if(!TextUtils.isEmpty(payload.getExtra())) {
|
||||||
|
try {
|
||||||
|
JSONObject dictionary = (JSONObject) new JSONParser().parse(payload.getExtra());
|
||||||
|
originalSender = (String) dictionary.get("s");
|
||||||
|
if (dictionary.containsKey("t")) {
|
||||||
|
originalContentType = ((Number) dictionary.get("t")).intValue();
|
||||||
|
}
|
||||||
|
originalSearchableContent = (String) dictionary.get("sc");
|
||||||
|
originalContent = (String) dictionary.get("c");
|
||||||
|
originalExtra = (String) dictionary.get("e");
|
||||||
|
if (dictionary.containsKey("ts")) {
|
||||||
|
originalMessageTimestamp = ((Number) dictionary.get("ts")).longValue();
|
||||||
|
}
|
||||||
|
if (dictionary.containsKey("mt")) {
|
||||||
|
originalMediaType = ((Number) dictionary.get("mt")).intValue();
|
||||||
|
}
|
||||||
|
originalMediaUrl = (String) dictionary.get("mu");
|
||||||
|
if (dictionary.containsKey("mb")) {
|
||||||
|
originalBinaryContent = Base64.getDecoder().decode((String) dictionary.get("mb"));
|
||||||
|
}
|
||||||
|
} catch (ParseException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-1
@@ -89,7 +89,7 @@ public class RichNotificationMessageContent extends MessageContent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MessagePayload encode() {
|
public MessagePayload encode() {
|
||||||
MessagePayload payload = encodeBase();
|
MessagePayload payload = super.encode();
|
||||||
payload.setPushContent(title);
|
payload.setPushContent(title);
|
||||||
payload.setContent(desc);
|
payload.setContent(desc);
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
@@ -113,5 +113,6 @@ public class RichNotificationMessageContent extends MessageContent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decode(MessagePayload payload) {
|
public void decode(MessagePayload payload) {
|
||||||
|
super.decode(payload);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,11 +35,12 @@ public class SoundMessageContent extends MediaMessageContent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decode(MessagePayload payload) {
|
public void decode(MessagePayload payload) {
|
||||||
|
super.decode(payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MessagePayload encode() {
|
public MessagePayload encode() {
|
||||||
MessagePayload payload = encodeBase();
|
MessagePayload payload = super.encode();
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("duration", duration);
|
jsonObject.put("duration", duration);
|
||||||
payload.setContent(jsonObject.toJSONString());
|
payload.setContent(jsonObject.toJSONString());
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class StickerMessageContent extends MediaMessageContent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MessagePayload encode() {
|
public MessagePayload encode() {
|
||||||
MessagePayload payload = super.encodeBase();
|
MessagePayload payload = super.encode();
|
||||||
payload.setSearchableContent("[动态表情]");
|
payload.setSearchableContent("[动态表情]");
|
||||||
JSONObject objWrite = new JSONObject();
|
JSONObject objWrite = new JSONObject();
|
||||||
objWrite.put("x", width);
|
objWrite.put("x", width);
|
||||||
@@ -47,8 +47,7 @@ public class StickerMessageContent extends MediaMessageContent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decode(MessagePayload payload) {
|
public void decode(MessagePayload payload) {
|
||||||
super.decodeBase(payload);
|
super.decode(payload);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
JSONObject jsonObject = (JSONObject) new JSONParser().parse(new String(Base64.getDecoder().decode(payload.getBase64edData())));
|
JSONObject jsonObject = (JSONObject) new JSONParser().parse(new String(Base64.getDecoder().decode(payload.getBase64edData())));
|
||||||
width = (int) jsonObject.get("x");
|
width = (int) jsonObject.get("x");
|
||||||
|
|||||||
+2
-1
@@ -38,13 +38,14 @@ public class StreamTextGeneratedMessageContent extends MessageContent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decode(MessagePayload payload) {
|
public void decode(MessagePayload payload) {
|
||||||
|
super.decode(payload);
|
||||||
this.streamId = payload.getContent();
|
this.streamId = payload.getContent();
|
||||||
this.text = payload.getSearchableContent();
|
this.text = payload.getSearchableContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MessagePayload encode() {
|
public MessagePayload encode() {
|
||||||
MessagePayload payload = encodeBase();
|
MessagePayload payload = super.encode();
|
||||||
payload.setSearchableContent(text);
|
payload.setSearchableContent(text);
|
||||||
payload.setContent(streamId);
|
payload.setContent(streamId);
|
||||||
return payload;
|
return payload;
|
||||||
|
|||||||
+2
-1
@@ -38,13 +38,14 @@ public class StreamTextGeneratingMessageContent extends MessageContent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decode(MessagePayload payload) {
|
public void decode(MessagePayload payload) {
|
||||||
|
super.decode(payload);
|
||||||
streamId = payload.getContent();
|
streamId = payload.getContent();
|
||||||
text = payload.getSearchableContent();
|
text = payload.getSearchableContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MessagePayload encode() {
|
public MessagePayload encode() {
|
||||||
MessagePayload payload = encodeBase();
|
MessagePayload payload = super.encode();
|
||||||
payload.setSearchableContent(text);
|
payload.setSearchableContent(text);
|
||||||
payload.setContent(streamId);
|
payload.setContent(streamId);
|
||||||
return payload;
|
return payload;
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class TextMessageContent extends MessageContent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MessagePayload encode() {
|
public MessagePayload encode() {
|
||||||
MessagePayload payload = encodeBase();
|
MessagePayload payload = super.encode();
|
||||||
payload.setSearchableContent(text);
|
payload.setSearchableContent(text);
|
||||||
if(quoteInfo != null) {
|
if(quoteInfo != null) {
|
||||||
payload.setBase64edData(Base64.getEncoder().encodeToString(quoteInfo.encode().toJSONString().getBytes(StandardCharsets.UTF_8)));
|
payload.setBase64edData(Base64.getEncoder().encodeToString(quoteInfo.encode().toJSONString().getBytes(StandardCharsets.UTF_8)));
|
||||||
@@ -66,6 +66,7 @@ public class TextMessageContent extends MessageContent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decode(MessagePayload payload) {
|
public void decode(MessagePayload payload) {
|
||||||
|
super.decode(payload);
|
||||||
text = payload.getSearchableContent();
|
text = payload.getSearchableContent();
|
||||||
if(!TextUtils.isEmpty(payload.getBase64edData())) {
|
if(!TextUtils.isEmpty(payload.getBase64edData())) {
|
||||||
String jsonStr = new String(Base64.getDecoder().decode(payload.getBase64edData()), StandardCharsets.UTF_8);
|
String jsonStr = new String(Base64.getDecoder().decode(payload.getBase64edData()), StandardCharsets.UTF_8);
|
||||||
|
|||||||
+2
-2
@@ -24,7 +24,7 @@ public class TipNotificationMessageContent extends MessageContent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MessagePayload encode() {
|
public MessagePayload encode() {
|
||||||
MessagePayload payload = super.encodeBase();
|
MessagePayload payload = super.encode();
|
||||||
payload.setContent(tip);
|
payload.setContent(tip);
|
||||||
|
|
||||||
return payload;
|
return payload;
|
||||||
@@ -32,7 +32,7 @@ public class TipNotificationMessageContent extends MessageContent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decode(MessagePayload payload) {
|
public void decode(MessagePayload payload) {
|
||||||
super.decodeBase(payload);
|
super.decode(payload);
|
||||||
tip = payload.getContent();
|
tip = payload.getContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,14 +43,14 @@ public class TypingMessageContent extends MessageContent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MessagePayload encode() {
|
public MessagePayload encode() {
|
||||||
MessagePayload payload = super.encodeBase();
|
MessagePayload payload = super.encode();
|
||||||
payload.setContent(typingType + "");
|
payload.setContent(typingType + "");
|
||||||
return payload;
|
return payload;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decode(MessagePayload payload) {
|
public void decode(MessagePayload payload) {
|
||||||
super.decodeBase(payload);
|
super.decode(payload);
|
||||||
typingType = Integer.parseInt(payload.getContent());
|
typingType = Integer.parseInt(payload.getContent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public class VideoMessageContent extends MediaMessageContent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MessagePayload encode() {
|
public MessagePayload encode() {
|
||||||
MessagePayload payload = super.encodeBase();
|
MessagePayload payload = super.encode();
|
||||||
payload.setSearchableContent("[视频]");
|
payload.setSearchableContent("[视频]");
|
||||||
|
|
||||||
payload.setBase64edData(Base64.getEncoder().encodeToString(thumbnailBytes));
|
payload.setBase64edData(Base64.getEncoder().encodeToString(thumbnailBytes));
|
||||||
@@ -73,7 +73,7 @@ public class VideoMessageContent extends MediaMessageContent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decode(MessagePayload payload) {
|
public void decode(MessagePayload payload) {
|
||||||
super.decodeBase(payload);
|
super.decode(payload);
|
||||||
thumbnailBytes = Base64.getDecoder().decode(payload.getBase64edData());
|
thumbnailBytes = Base64.getDecoder().decode(payload.getBase64edData());
|
||||||
try {
|
try {
|
||||||
JSONObject jsonObject = (JSONObject) new JSONParser().parse(payload.getContent());
|
JSONObject jsonObject = (JSONObject) new JSONParser().parse(payload.getContent());
|
||||||
|
|||||||
@@ -38,11 +38,24 @@ public class AdminHttpUtils extends JsonUtils {
|
|||||||
private static CloseableHttpClient httpClient;
|
private static CloseableHttpClient httpClient;
|
||||||
|
|
||||||
public static void init(String url, String secret) {
|
public static void init(String url, String secret) {
|
||||||
|
init(url, secret, 15000);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void init(String url, String secret, int timeout) {
|
||||||
adminUrl = url.trim();
|
adminUrl = url.trim();
|
||||||
adminSecret = secret.trim();
|
adminSecret = secret.trim();
|
||||||
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
|
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
|
||||||
cm.setValidateAfterInactivity(1000);
|
cm.setValidateAfterInactivity(1000);
|
||||||
|
int connectTimeout = 15000; // 连接超时时间
|
||||||
|
int connectionRequestTimeout = 3000; // 从连接池获取连接的超时时间
|
||||||
|
RequestConfig requestConfig = RequestConfig.custom()
|
||||||
|
.setConnectTimeout(connectTimeout)
|
||||||
|
.setSocketTimeout(timeout)
|
||||||
|
.setConnectionRequestTimeout(connectionRequestTimeout)
|
||||||
|
.build();
|
||||||
|
|
||||||
httpClient = HttpClients.custom()
|
httpClient = HttpClients.custom()
|
||||||
|
.setDefaultRequestConfig(requestConfig)
|
||||||
.setConnectionManager(cm)
|
.setConnectionManager(cm)
|
||||||
.evictExpiredConnections()
|
.evictExpiredConnections()
|
||||||
.evictIdleConnections(60L, TimeUnit.SECONDS)
|
.evictIdleConnections(60L, TimeUnit.SECONDS)
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import org.apache.commons.codec.digest.DigestUtils;
|
|||||||
import org.apache.http.HttpResponse;
|
import org.apache.http.HttpResponse;
|
||||||
import org.apache.http.HttpStatus;
|
import org.apache.http.HttpStatus;
|
||||||
import org.apache.http.client.HttpClient;
|
import org.apache.http.client.HttpClient;
|
||||||
|
import org.apache.http.client.config.RequestConfig;
|
||||||
import org.apache.http.client.methods.HttpPost;
|
import org.apache.http.client.methods.HttpPost;
|
||||||
import org.apache.http.entity.StringEntity;
|
import org.apache.http.entity.StringEntity;
|
||||||
import org.apache.http.impl.client.CloseableHttpClient;
|
import org.apache.http.impl.client.CloseableHttpClient;
|
||||||
@@ -21,6 +22,8 @@ import org.slf4j.LoggerFactory;
|
|||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URL;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@@ -34,13 +37,41 @@ public class ChannelHttpUtils extends JsonUtils {
|
|||||||
private String channelSecret;
|
private String channelSecret;
|
||||||
private final CloseableHttpClient httpClient;
|
private final CloseableHttpClient httpClient;
|
||||||
|
|
||||||
|
private final int port;
|
||||||
|
|
||||||
|
private void checkPort() {
|
||||||
|
if (port != 80 && port != 443) {
|
||||||
|
if (port == 18080) {
|
||||||
|
LOG.warn("您传入的频道API地址中的端口是18080,18080端口默认为管理API端口,频道API端口应该为IM服务的HTTP端口,默认为80,请确认是否使用错误!");
|
||||||
|
} else {
|
||||||
|
LOG.warn("您传入的频道API地址中的端口不是80/443,频道API的端口和客户端使用端口一样,都应该为IM服务的HTTP端口,默认为80,请确实是否正确?如果您定制化了IM服务端口或者使用其他端口反向代理IM服务的HTTP端口请忽略此提示。");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ChannelHttpUtils(String imurl, String channelId, String secret) {
|
public ChannelHttpUtils(String imurl, String channelId, String secret) {
|
||||||
this.imurl = imurl.trim();
|
this.imurl = imurl.trim();
|
||||||
this.channelId = channelId.trim();
|
this.channelId = channelId.trim();
|
||||||
this.channelSecret = secret.trim();
|
this.channelSecret = secret.trim();
|
||||||
|
try {
|
||||||
|
URL url = new URL(this.imurl);
|
||||||
|
this.port = url.getPort();
|
||||||
|
} catch (MalformedURLException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
checkPort();
|
||||||
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
|
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
|
||||||
cm.setValidateAfterInactivity(1000);
|
cm.setValidateAfterInactivity(1000);
|
||||||
|
int connectTimeout = 5000; // 连接超时时间
|
||||||
|
int socketTimeout = 15000; // 请求超时时间
|
||||||
|
int connectionRequestTimeout = 3000; // 从连接池获取连接的超时时间
|
||||||
|
RequestConfig requestConfig = RequestConfig.custom()
|
||||||
|
.setConnectTimeout(connectTimeout)
|
||||||
|
.setSocketTimeout(socketTimeout)
|
||||||
|
.setConnectionRequestTimeout(connectionRequestTimeout)
|
||||||
|
.build();
|
||||||
httpClient = HttpClients.custom()
|
httpClient = HttpClients.custom()
|
||||||
|
.setDefaultRequestConfig(requestConfig)
|
||||||
.setConnectionManager(cm)
|
.setConnectionManager(cm)
|
||||||
.evictExpiredConnections()
|
.evictExpiredConnections()
|
||||||
.evictIdleConnections(60L, TimeUnit.SECONDS)
|
.evictIdleConnections(60L, TimeUnit.SECONDS)
|
||||||
@@ -108,6 +139,7 @@ public class ChannelHttpUtils extends JsonUtils {
|
|||||||
return fromJsonObject(content, clazz);
|
return fromJsonObject(content, clazz);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
checkPort();
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw e;
|
throw e;
|
||||||
}finally{
|
}finally{
|
||||||
|
|||||||
@@ -3,17 +3,15 @@ package cn.wildfirechat.sdk.utilities;
|
|||||||
import cn.wildfirechat.sdk.model.IMResult;
|
import cn.wildfirechat.sdk.model.IMResult;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import ikidou.reflect.TypeBuilder;
|
|
||||||
import io.netty.util.internal.StringUtil;
|
import io.netty.util.internal.StringUtil;
|
||||||
import org.apache.commons.codec.digest.DigestUtils;
|
import org.apache.commons.codec.digest.DigestUtils;
|
||||||
import org.apache.http.HttpResponse;
|
import org.apache.http.HttpResponse;
|
||||||
import org.apache.http.HttpStatus;
|
import org.apache.http.HttpStatus;
|
||||||
import org.apache.http.client.HttpClient;
|
import org.apache.http.client.config.RequestConfig;
|
||||||
import org.apache.http.client.methods.HttpPost;
|
import org.apache.http.client.methods.HttpPost;
|
||||||
import org.apache.http.entity.StringEntity;
|
import org.apache.http.entity.StringEntity;
|
||||||
import org.apache.http.impl.client.CloseableHttpClient;
|
import org.apache.http.impl.client.CloseableHttpClient;
|
||||||
import org.apache.http.impl.client.DefaultHttpRequestRetryHandler;
|
import org.apache.http.impl.client.DefaultHttpRequestRetryHandler;
|
||||||
import org.apache.http.impl.client.HttpClientBuilder;
|
|
||||||
import org.apache.http.impl.client.HttpClients;
|
import org.apache.http.impl.client.HttpClients;
|
||||||
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -21,7 +19,8 @@ import org.slf4j.LoggerFactory;
|
|||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.lang.reflect.Type;
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URL;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@@ -35,13 +34,41 @@ public class RobotHttpUtils extends JsonUtils {
|
|||||||
private final String robotSecret;
|
private final String robotSecret;
|
||||||
private final CloseableHttpClient httpClient;
|
private final CloseableHttpClient httpClient;
|
||||||
|
|
||||||
|
private final int port;
|
||||||
|
|
||||||
|
private void checkPort() {
|
||||||
|
if (port != 80 && port != 443) {
|
||||||
|
if (port == 18080) {
|
||||||
|
LOG.warn("您传入的机器人API地址中的端口是18080,18080端口默认为管理API端口,机器人API端口应该为IM服务的HTTP端口,默认为80,请确认是否使用错误!");
|
||||||
|
} else {
|
||||||
|
LOG.warn("您传入的机器人API地址中的端口不是80/443,机器人API的端口和客户端使用端口一样,都应该为IM服务的HTTP端口,默认为80,请确实是否正确?如果您定制化了IM服务端口或者使用其他端口反向代理IM服务的HTTP端口请忽略此提示。");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public RobotHttpUtils(String url, String robotId, String robotSecret) {
|
public RobotHttpUtils(String url, String robotId, String robotSecret) {
|
||||||
this.url = url.trim();
|
this.url = url.trim();
|
||||||
this.robotId = robotId.trim();
|
this.robotId = robotId.trim();
|
||||||
this.robotSecret = robotSecret.trim();
|
this.robotSecret = robotSecret.trim();
|
||||||
|
try {
|
||||||
|
URL u = new URL(this.url);
|
||||||
|
this.port = u.getPort();
|
||||||
|
} catch (MalformedURLException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
checkPort();
|
||||||
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
|
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
|
||||||
cm.setValidateAfterInactivity(1000);
|
cm.setValidateAfterInactivity(1000);
|
||||||
|
int connectTimeout = 5000; // 连接超时时间
|
||||||
|
int socketTimeout = 15000; // 请求超时时间
|
||||||
|
int connectionRequestTimeout = 3000; // 从连接池获取连接的超时时间
|
||||||
|
RequestConfig requestConfig = RequestConfig.custom()
|
||||||
|
.setConnectTimeout(connectTimeout)
|
||||||
|
.setSocketTimeout(socketTimeout)
|
||||||
|
.setConnectionRequestTimeout(connectionRequestTimeout)
|
||||||
|
.build();
|
||||||
httpClient = HttpClients.custom()
|
httpClient = HttpClients.custom()
|
||||||
|
.setDefaultRequestConfig(requestConfig)
|
||||||
.setConnectionManager(cm)
|
.setConnectionManager(cm)
|
||||||
.evictExpiredConnections()
|
.evictExpiredConnections()
|
||||||
.evictIdleConnections(60L, TimeUnit.SECONDS)
|
.evictIdleConnections(60L, TimeUnit.SECONDS)
|
||||||
@@ -51,7 +78,6 @@ public class RobotHttpUtils extends JsonUtils {
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public <T> IMResult<T> httpJsonPost(String path, Object object, Class<T> clazz) throws Exception{
|
public <T> IMResult<T> httpJsonPost(String path, Object object, Class<T> clazz) throws Exception{
|
||||||
if (isNullOrEmpty(url) || isNullOrEmpty(path)) {
|
if (isNullOrEmpty(url) || isNullOrEmpty(path)) {
|
||||||
LOG.error("Not init IM SDK correctly. Do you forget init it?");
|
LOG.error("Not init IM SDK correctly. Do you forget init it?");
|
||||||
@@ -111,6 +137,7 @@ public class RobotHttpUtils extends JsonUtils {
|
|||||||
return fromJsonObject(content, clazz);
|
return fromJsonObject(content, clazz);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
checkPort();
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw e;
|
throw e;
|
||||||
}finally{
|
}finally{
|
||||||
|
|||||||
Reference in New Issue
Block a user