Compare commits

..
6 Commits
Author SHA1 Message Date
heavyrian2012 52b624f25e update version and release note 2026-02-03 11:30:46 +08:00
heavyrian2012 d90bab53ad 添加配置在机器人获取用户信息时指定获取字段 2026-02-03 11:24:28 +08:00
heavyrian2012 4d60231c8c 1,添加获取用户机器人列表ID的接口。
2,机器人回调消息中添加回调的机器人ID。
3,mesh服务添加加群申请相关接口
2026-02-02 13:48:04 +08:00
heavyrian2012 d08d6f0c49 解决创建用户没有传昵称参数时使用了账户的问题 2026-01-27 20:30:02 +08:00
heavyrian2012 effa30b546 添加修改好友extra接口 2026-01-26 13:09:22 +08:00
heavyrian2012 0f688ff1df mesh发布消息时添加messageId参数 2026-01-25 11:24:48 +08:00
25 changed files with 897 additions and 17 deletions
+6
View File
@@ -174,6 +174,12 @@ robot.callback_with_target_info false
## 如果为false,不能@不在会话中的机器人。机器人不在会话中时,也不能回复消息。
robot.mention_external_robot true
## 机器人获取信息允许的字段,可以获取userId/displayName/portrait,其他需要这里配置允许。
## 第一位(1)是name, 第二位(2)是mobile,第三(4)位是email,第四位(8)是address,第五位(16)是company,第六位(32)是extra,
## 第七位(64)是updateDt,第八位(128)是gender,第九位(256)是social,第十位(512)是type。
## 比如允许获取name和email就是5(1+4),允许获取name和mobile和company和type就是531(1+2+16+512),允许全部是1023(1+2+...+512)
#robot.get_user_info_mask 1023
## 频道回调信息是否带上用户clientId和平台类型。
channel.callback_with_client_info false
+1 -1
View File
@@ -5,7 +5,7 @@
<relativePath>../</relativePath>
<artifactId>wildfirechat-parent</artifactId>
<groupId>cn.wildfirechat</groupId>
<version>1.4.3</version>
<version>1.4.4</version>
</parent>
<artifactId>moquette-broker</artifactId>
@@ -56,7 +56,7 @@ public class CreateUserAction extends AdminAction {
if (inputCreateUser.getName() != null)
newUserBuilder.setName(inputCreateUser.getName());
if (inputCreateUser.getDisplayName() != null)
newUserBuilder.setDisplayName(StringUtil.isNullOrEmpty(inputCreateUser.getDisplayName()) ? inputCreateUser.getName() : inputCreateUser.getDisplayName());
newUserBuilder.setDisplayName(inputCreateUser.getDisplayName());
if (inputCreateUser.getPortrait() != null)
newUserBuilder.setPortrait(inputCreateUser.getPortrait());
if (inputCreateUser.getEmail() != null)
@@ -65,11 +65,8 @@ public class CreateUserAction extends AdminAction {
newUserBuilder.setAddress(inputCreateUser.getAddress());
if (inputCreateUser.getCompany() != null)
newUserBuilder.setCompany(inputCreateUser.getCompany());
if (inputCreateUser.getSocial() != null)
newUserBuilder.setSocial(inputCreateUser.getSocial());
if (inputCreateUser.getMobile() != null)
newUserBuilder.setMobile(inputCreateUser.getMobile());
newUserBuilder.setGender(inputCreateUser.getGender());
@@ -11,12 +11,17 @@ package com.xiaoleilu.loServer.action.admin;
import cn.wildfirechat.common.APIPath;
import cn.wildfirechat.common.ErrorCode;
import cn.wildfirechat.pojos.InputUpdateFriendExtra;
import cn.wildfirechat.proto.WFCMessage;
import com.xiaoleilu.loServer.RestResult;
import com.xiaoleilu.loServer.annotation.HttpMethod;
import com.xiaoleilu.loServer.annotation.Route;
import com.xiaoleilu.loServer.handler.Request;
import com.xiaoleilu.loServer.handler.Response;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.handler.codec.http.FullHttpRequest;
import io.netty.util.internal.StringUtil;
import win.liyufan.im.IMTopic;
@Route(APIPath.Friend_Set_Extra)
@HttpMethod("POST")
@@ -31,8 +36,17 @@ public class FriendExtraPutAction extends AdminAction {
public boolean action(Request request, Response response) {
if (request.getNettyRequest() instanceof FullHttpRequest) {
InputUpdateFriendExtra input = getRequestBody(request.getNettyRequest(), InputUpdateFriendExtra.class);
ErrorCode errorCode = messagesStore.setFriendExtraRequest(input.getOperator(), input.getTargetId(), input.getExtra(), new long[1]);
setResponseContent(RestResult.resultOf(errorCode), response);
if (input != null && !StringUtil.isNullOrEmpty(input.getOperator()) && !StringUtil.isNullOrEmpty(input.getTargetId())) {
sendApiMessage(response, input.getOperator(), IMTopic.SetFriendExtraTopic, WFCMessage.StringPair.newBuilder().setKey(input.getTargetId()).setValue(input.getExtra()==null?"":input.getExtra()).build().toByteArray(), result -> {
ByteBuf byteBuf = Unpooled.buffer();
byteBuf.writeBytes(result);
ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte());
return new Result(errorCode);
});
return false;
} else {
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response);
}
}
return true;
}
@@ -0,0 +1,49 @@
/*
* This file is part of the Wildfire Chat package.
* (c) Heavyrain2012 <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
package com.xiaoleilu.loServer.action.admin;
import cn.wildfirechat.common.APIPath;
import cn.wildfirechat.common.ErrorCode;
import cn.wildfirechat.pojos.InputRobotId;
import cn.wildfirechat.pojos.InputUserId;
import cn.wildfirechat.pojos.OutputRobot;
import cn.wildfirechat.pojos.OutputStringList;
import cn.wildfirechat.proto.WFCMessage;
import com.xiaoleilu.loServer.RestResult;
import com.xiaoleilu.loServer.annotation.HttpMethod;
import com.xiaoleilu.loServer.annotation.Route;
import com.xiaoleilu.loServer.handler.Request;
import com.xiaoleilu.loServer.handler.Response;
import io.netty.handler.codec.http.FullHttpRequest;
import io.netty.util.internal.StringUtil;
@Route(APIPath.User_Get_User_Robots)
@HttpMethod("POST")
public class GetUserRobotsAction extends AdminAction {
@Override
public boolean isTransactionAction() {
return true;
}
@Override
public boolean action(Request request, Response response) {
if (request.getNettyRequest() instanceof FullHttpRequest) {
InputUserId inputUserId = getRequestBody(request.getNettyRequest(), InputUserId.class);
if (inputUserId != null
&& (!StringUtil.isNullOrEmpty(inputUserId.getUserId()))) {
RestResult result = RestResult.ok(new OutputStringList(messagesStore.getUserRobotIds(inputUserId.getUserId())));
setResponseContent(result, response);
} else {
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response);
}
}
return true;
}
}
@@ -47,7 +47,39 @@ public class GetUserAction extends RobotAction {
if (user == null || user.getDeleted() > 0) {
result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST);
} else {
result = RestResult.ok(InputOutputUserInfo.fromPbUser(user));
InputOutputUserInfo outputUserInfo = InputOutputUserInfo.fromPbUser(user);
int mask = messagesStore.getRobotGetUserInfoMask();
if((mask & 1) == 0) {
outputUserInfo.setName(null);
}
if((mask & 2) == 0) {
outputUserInfo.setMobile(null);
}
if((mask & 4) == 0) {
outputUserInfo.setEmail(null);
}
if((mask & 8) == 0) {
outputUserInfo.setAddress(null);
}
if((mask & 16) == 0) {
outputUserInfo.setCompany(null);
}
if((mask & 32) == 0) {
outputUserInfo.setExtra(null);
}
if((mask & 64) == 0) {
outputUserInfo.setUpdateDt(0);
}
if((mask & 128) == 0) {
outputUserInfo.setGender(0);
}
if((mask & 256) == 0) {
outputUserInfo.setSocial(null);
}
if((mask & 512) == 0) {
outputUserInfo.setType(0);
}
result = RestResult.ok(outputUserInfo);
}
setResponseContent(result, response);
} else {
@@ -181,7 +181,7 @@ public final class BrokerConstants {
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 ROBOT_Mention_External_Robot = "robot.mention_external_robot";
public static final String ROBOT_Get_User_Info_Mask = "robot.get_user_info_mask";
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";
@@ -0,0 +1,31 @@
/*
* This file is part of the Wildfire Chat package.
* (c) Heavyrain2012 <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
package io.moquette.imhandler;
import cn.wildfirechat.common.ErrorCode;
import cn.wildfirechat.proto.ProtoConstants;
import cn.wildfirechat.proto.WFCMessage;
import io.moquette.spi.impl.Qos1PublishHandler;
import io.netty.buffer.ByteBuf;
import win.liyufan.im.IMTopic;
import static cn.wildfirechat.common.ErrorCode.ERROR_CODE_SUCCESS;
@Handler(IMTopic.SetFriendExtraTopic)
public class SetFriendExtraHandler extends IMHandler<WFCMessage.StringPair> {
@Override
public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.StringPair request, Qos1PublishHandler.IMCallback callback) {
long[] heads = new long[1];
ErrorCode errorCode = m_messagesStore.setFriendExtraRequest(fromUser, request.getKey(), request.getValue(), heads);
if (errorCode == ERROR_CODE_SUCCESS) {
publisher.publishNotification(IMTopic.NotifyFriendTopic, fromUser, heads[0], clientID);
}
return errorCode;
}
}
@@ -3177,6 +3177,34 @@ public class DatabaseStore {
return outList;
}
List<String> getUserRobotIds(String userId) {
Connection connection = null;
PreparedStatement statement = null;
ResultSet rs = null;
List<String> outList = new ArrayList<>();
try {
connection = DBUtil.getConnection();
String sql = "select _uid from t_robot where _owner = ? and _state = 0";
statement = connection.prepareStatement(sql);
int index = 1;
statement.setString(1, userId);
rs = statement.executeQuery();
while (rs.next()) {
outList.add(rs.getString(1));
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Utility.printExecption(LOG, e, RDBS_Exception);
} finally {
DBUtil.closeDB(connection, statement, rs);
}
return outList;
}
Set<String> getAllEnds(boolean fromUserTable) {
Connection connection = null;
PreparedStatement statement = null;
@@ -222,6 +222,7 @@ public class MemoryMessagesStore implements IMessagesStore {
private boolean mRobotCallbackWithSenderInfo = false;
private boolean mRobotCallbackWithTargetInfo = false;
private boolean mRobotMentionExternalRobot = false;
private int mRobotGetUserInfoMask = 0;
private boolean mChannelCallbackWithClientInfo = false;
private boolean mChannelCallbackWithSenderInfo = false;
@@ -684,6 +685,9 @@ public class MemoryMessagesStore implements IMessagesStore {
try {
mRobotMentionExternalRobot = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.ROBOT_Mention_External_Robot, "false"));
} catch (Exception e) {}
try {
mRobotGetUserInfoMask = Integer.parseInt(server.getConfig().getProperty(BrokerConstants.ROBOT_Get_User_Info_Mask, "0"));
} catch (Exception e) {}
try {
mChannelCallbackWithClientInfo = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.CHANNEL_Callback_With_Client_Info, "false"));
@@ -3249,6 +3253,11 @@ public class MemoryMessagesStore implements IMessagesStore {
return databaseStore.getAllUsers(count, offset);
}
@Override
public List<String> getUserRobotIds(String userId) {
return databaseStore.getUserRobotIds(userId);
}
// 电话号码校验正则表达式(支持中国大陆手机号和固话)
private static final String PHONE_REGEX = "^\\s*" + // 允许开头空白
"(?:" +
@@ -5009,6 +5018,11 @@ public class MemoryMessagesStore implements IMessagesStore {
return mRobotMentionExternalRobot;
}
@Override
public int getRobotGetUserInfoMask() {
return mRobotGetUserInfoMask;
}
@Override
public boolean isChannelCallbackWithClientInfo() {
return mChannelCallbackWithClientInfo;
@@ -157,6 +157,7 @@ public interface IMessagesStore {
ErrorCode searchUser(String userId, String keyword, int searchType, int userType, int page, List<WFCMessage.User> users);
List<WFCMessage.User> getUserInfoList(int count, int offset);
List<String> getUserRobotIds(String userId);
boolean updateSystemSetting(int id, String value, String desc);
SystemSettingPojo getSystemSetting(int id);
@@ -255,6 +256,7 @@ public interface IMessagesStore {
boolean isRobotCallbackWithSenderInfo();
boolean isRobotCallbackWithTargetInfo();
boolean isRobotMentionExternalRobot();
int getRobotGetUserInfoMask();
boolean isChannelCallbackWithClientInfo();
boolean isChannelCallbackWithSenderInfo();
@@ -179,6 +179,7 @@ public class MessagesPublisher {
message = m_messagesStore.getMessage(messageId);
}
OutputMessageData outputMessageData = getOutputMessageWithExtraInfo(message, exceptClientId, m_messagesStore.isRobotCallbackWithClientInfo() , m_messagesStore.isRobotCallbackWithSenderInfo(), m_messagesStore.isRobotCallbackWithTargetInfo());
outputMessageData.setToRobotId(robot.getUid());
Server.getServer().getCallbackScheduler().execute(() -> {
try {
HttpUtils.httpJsonPost(robot.getCallback(), GsonUtil.gson.toJson(outputMessageData, OutputMessageData.class), HttpUtils.HttpPostType.POST_TYPE_Robot_Message_Callback);
@@ -52,6 +52,7 @@ public interface IMTopic {
String FriendRequestPullTopic = "FRP";
String NotifyFriendRequestTopic = "FRN";
String RriendRequestUnreadSyncTopic = "FRUS";
String SetFriendExtraTopic = "FES";
String DeleteFriendTopic = "FDL";
String FriendPullTopic = "FP";
+1 -1
View File
@@ -5,7 +5,7 @@
<parent>
<artifactId>wildfirechat-parent</artifactId>
<groupId>cn.wildfirechat</groupId>
<version>1.4.3</version>
<version>1.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -38,6 +38,7 @@ public interface APIPath {
String User_Get_Email_Info = "/admin/user/get_info_by_email";
String User_Get_All = "/admin/user/all";
String User_Get_Robot_Info = "/admin/user/get_robot_info";
String User_Get_User_Robots = "/admin/user/get_user_robots";
String User_Get_Blocked_List = "/admin/user/get_blocked_list";
String User_Check_Block_Status = "/admin/user/check_block_status";
String User_Get_Online_Status = "/admin/user/onlinestatus";
@@ -95,6 +96,7 @@ public interface APIPath {
String Group_Set_Manager = "/admin/group/manager/set";
String Group_Mute_Member = "/admin/group/manager/mute";
String Group_Allow_Member = "/admin/group/manager/allow";
String Group_Join_Request_Add = "/admin/group/join_request/add";
String Get_User_Groups = "/admin/group/of_user";
String Get_User_Groups_By_Type = "/admin/group/of_user_by_type";
String Group_Set_Member_Alias = "/admin/group/member/set_alias";
@@ -27,6 +27,8 @@ public class OutputMessageData {
private PojoGroupInfo targetGroupInfo;
private OutputGetChannelInfo targetChannelInfo;
private String toRobotId;
public String getSender() {
return sender;
}
@@ -119,6 +121,14 @@ public class OutputMessageData {
return fromProtoMessage(protoMessage, null);
}
public String getToRobotId() {
return toRobotId;
}
public void setToRobotId(String toRobotId) {
this.toRobotId = toRobotId;
}
public static OutputMessageData fromProtoMessage(WFCMessage.Message protoMessage, OutputClient fromClient) {
OutputMessageData data = new OutputMessageData();
data.messageId = protoMessage.getMessageId();
@@ -0,0 +1,12 @@
package cn.wildfirechat.pojos.mesh;
import java.util.List;
public class PojoAddJoinGroupRequest {
public String domainId;
public String operator;
public String group_id;
public List<String> userIds;
public String reason;
public String extra;
}
@@ -67311,6 +67311,641 @@ public final class WFCMessage {
// @@protoc_insertion_point(class_scope:ApplicationConfigRequest)
}
public interface StringPairOrBuilder
extends com.google.protobuf.MessageOrBuilder {
// required string key = 1;
/**
* <code>required string key = 1;</code>
*/
boolean hasKey();
/**
* <code>required string key = 1;</code>
*/
java.lang.String getKey();
/**
* <code>required string key = 1;</code>
*/
com.google.protobuf.ByteString
getKeyBytes();
// optional string value = 2;
/**
* <code>optional string value = 2;</code>
*/
boolean hasValue();
/**
* <code>optional string value = 2;</code>
*/
java.lang.String getValue();
/**
* <code>optional string value = 2;</code>
*/
com.google.protobuf.ByteString
getValueBytes();
}
/**
* Protobuf type {@code StringPair}
*/
public static final class StringPair extends
com.google.protobuf.GeneratedMessage
implements StringPairOrBuilder {
// Use StringPair.newBuilder() to construct.
private StringPair(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private StringPair(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final StringPair defaultInstance;
public static StringPair getDefaultInstance() {
return defaultInstance;
}
public StringPair getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private StringPair(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
bitField0_ |= 0x00000001;
key_ = input.readBytes();
break;
}
case 18: {
bitField0_ |= 0x00000002;
value_ = input.readBytes();
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return cn.wildfirechat.proto.WFCMessage.internal_static_StringPair_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return cn.wildfirechat.proto.WFCMessage.internal_static_StringPair_fieldAccessorTable
.ensureFieldAccessorsInitialized(
cn.wildfirechat.proto.WFCMessage.StringPair.class, cn.wildfirechat.proto.WFCMessage.StringPair.Builder.class);
}
public static com.google.protobuf.Parser<StringPair> PARSER =
new com.google.protobuf.AbstractParser<StringPair>() {
public StringPair parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new StringPair(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<StringPair> getParserForType() {
return PARSER;
}
private int bitField0_;
// required string key = 1;
public static final int KEY_FIELD_NUMBER = 1;
private java.lang.Object key_;
/**
* <code>required string key = 1;</code>
*/
public boolean hasKey() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required string key = 1;</code>
*/
public java.lang.String getKey() {
java.lang.Object ref = key_;
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()) {
key_ = s;
}
return s;
}
}
/**
* <code>required string key = 1;</code>
*/
public com.google.protobuf.ByteString
getKeyBytes() {
java.lang.Object ref = key_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
key_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
// optional string value = 2;
public static final int VALUE_FIELD_NUMBER = 2;
private java.lang.Object value_;
/**
* <code>optional string value = 2;</code>
*/
public boolean hasValue() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>optional string value = 2;</code>
*/
public java.lang.String getValue() {
java.lang.Object ref = value_;
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()) {
value_ = s;
}
return s;
}
}
/**
* <code>optional string value = 2;</code>
*/
public com.google.protobuf.ByteString
getValueBytes() {
java.lang.Object ref = value_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
value_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
private void initFields() {
key_ = "";
value_ = "";
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized != -1) return isInitialized == 1;
if (!hasKey()) {
memoizedIsInitialized = 0;
return false;
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBytes(1, getKeyBytes());
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeBytes(2, getValueBytes());
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(1, getKeyBytes());
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(2, getValueBytes());
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static cn.wildfirechat.proto.WFCMessage.StringPair parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static cn.wildfirechat.proto.WFCMessage.StringPair parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static cn.wildfirechat.proto.WFCMessage.StringPair parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static cn.wildfirechat.proto.WFCMessage.StringPair parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static cn.wildfirechat.proto.WFCMessage.StringPair parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static cn.wildfirechat.proto.WFCMessage.StringPair parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static cn.wildfirechat.proto.WFCMessage.StringPair parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static cn.wildfirechat.proto.WFCMessage.StringPair parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static cn.wildfirechat.proto.WFCMessage.StringPair parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static cn.wildfirechat.proto.WFCMessage.StringPair parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.StringPair prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code StringPair}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder>
implements cn.wildfirechat.proto.WFCMessage.StringPairOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return cn.wildfirechat.proto.WFCMessage.internal_static_StringPair_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return cn.wildfirechat.proto.WFCMessage.internal_static_StringPair_fieldAccessorTable
.ensureFieldAccessorsInitialized(
cn.wildfirechat.proto.WFCMessage.StringPair.class, cn.wildfirechat.proto.WFCMessage.StringPair.Builder.class);
}
// Construct using cn.wildfirechat.proto.WFCMessage.StringPair.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
key_ = "";
bitField0_ = (bitField0_ & ~0x00000001);
value_ = "";
bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return cn.wildfirechat.proto.WFCMessage.internal_static_StringPair_descriptor;
}
public cn.wildfirechat.proto.WFCMessage.StringPair getDefaultInstanceForType() {
return cn.wildfirechat.proto.WFCMessage.StringPair.getDefaultInstance();
}
public cn.wildfirechat.proto.WFCMessage.StringPair build() {
cn.wildfirechat.proto.WFCMessage.StringPair result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public cn.wildfirechat.proto.WFCMessage.StringPair buildPartial() {
cn.wildfirechat.proto.WFCMessage.StringPair result = new cn.wildfirechat.proto.WFCMessage.StringPair(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.key_ = key_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.value_ = value_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof cn.wildfirechat.proto.WFCMessage.StringPair) {
return mergeFrom((cn.wildfirechat.proto.WFCMessage.StringPair)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.StringPair other) {
if (other == cn.wildfirechat.proto.WFCMessage.StringPair.getDefaultInstance()) return this;
if (other.hasKey()) {
bitField0_ |= 0x00000001;
key_ = other.key_;
onChanged();
}
if (other.hasValue()) {
bitField0_ |= 0x00000002;
value_ = other.value_;
onChanged();
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
if (!hasKey()) {
return false;
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
cn.wildfirechat.proto.WFCMessage.StringPair parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (cn.wildfirechat.proto.WFCMessage.StringPair) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
// required string key = 1;
private java.lang.Object key_ = "";
/**
* <code>required string key = 1;</code>
*/
public boolean hasKey() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required string key = 1;</code>
*/
public java.lang.String getKey() {
java.lang.Object ref = key_;
if (!(ref instanceof java.lang.String)) {
java.lang.String s = ((com.google.protobuf.ByteString) ref)
.toStringUtf8();
key_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>required string key = 1;</code>
*/
public com.google.protobuf.ByteString
getKeyBytes() {
java.lang.Object ref = key_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
key_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>required string key = 1;</code>
*/
public Builder setKey(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
key_ = value;
onChanged();
return this;
}
/**
* <code>required string key = 1;</code>
*/
public Builder clearKey() {
bitField0_ = (bitField0_ & ~0x00000001);
key_ = getDefaultInstance().getKey();
onChanged();
return this;
}
/**
* <code>required string key = 1;</code>
*/
public Builder setKeyBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
key_ = value;
onChanged();
return this;
}
// optional string value = 2;
private java.lang.Object value_ = "";
/**
* <code>optional string value = 2;</code>
*/
public boolean hasValue() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>optional string value = 2;</code>
*/
public java.lang.String getValue() {
java.lang.Object ref = value_;
if (!(ref instanceof java.lang.String)) {
java.lang.String s = ((com.google.protobuf.ByteString) ref)
.toStringUtf8();
value_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>optional string value = 2;</code>
*/
public com.google.protobuf.ByteString
getValueBytes() {
java.lang.Object ref = value_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
value_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>optional string value = 2;</code>
*/
public Builder setValue(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000002;
value_ = value;
onChanged();
return this;
}
/**
* <code>optional string value = 2;</code>
*/
public Builder clearValue() {
bitField0_ = (bitField0_ & ~0x00000002);
value_ = getDefaultInstance().getValue();
onChanged();
return this;
}
/**
* <code>optional string value = 2;</code>
*/
public Builder setValueBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000002;
value_ = value;
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:StringPair)
}
static {
defaultInstance = new StringPair(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:StringPair)
}
private static com.google.protobuf.Descriptors.Descriptor
internal_static_AddFriendRequest_descriptor;
private static
@@ -67691,6 +68326,11 @@ public final class WFCMessage {
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_ApplicationConfigRequest_fieldAccessorTable;
private static com.google.protobuf.Descriptors.Descriptor
internal_static_StringPair_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_StringPair_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
@@ -67877,9 +68517,10 @@ public final class WFCMessage {
"rget_id\030\001 \002(\t\022\014\n\004type\030\002 \002(\005\022\014\n\004host\030\003 \002(" +
"\t\"o\n\030ApplicationConfigRequest\022\r\n\005appId\030\001" +
" \002(\t\022\017\n\007appType\030\002 \002(\005\022\021\n\ttimestamp\030\003 \002(\003" +
"\022\r\n\005nonce\030\004 \002(\t\022\021\n\tsignature\030\005 \002(\tB/\n\025cn" +
".wildfirechat.protoB\nWFCMessageZ\n./go;pr" +
"oto"
"\022\r\n\005nonce\030\004 \002(\t\022\021\n\tsignature\030\005 \002(\t\"(\n\nSt" +
"ringPair\022\013\n\003key\030\001 \002(\t\022\r\n\005value\030\002 \001(\tB/\n\025" +
"cn.wildfirechat.protoB\nWFCMessageZ\n./go;",
"proto"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
@@ -68342,6 +68983,12 @@ public final class WFCMessage {
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_ApplicationConfigRequest_descriptor,
new java.lang.String[] { "AppId", "AppType", "Timestamp", "Nonce", "Signature", });
internal_static_StringPair_descriptor =
getDescriptor().getMessageTypes().get(76);
internal_static_StringPair_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_StringPair_descriptor,
new java.lang.String[] { "Key", "Value", });
return null;
}
};
+1 -1
View File
@@ -6,7 +6,7 @@
<!--<relativePath>../pom.xml</relativePath>-->
<artifactId>wildfirechat-parent</artifactId>
<groupId>cn.wildfirechat</groupId>
<version>1.4.3</version>
<version>1.4.4</version>
</parent>
<artifactId>distribution</artifactId>
@@ -171,6 +171,12 @@ robot.callback_with_target_info false
## 如果为false,不能@不在会话中的机器人。机器人不在会话中时,也不能回复消息。
robot.mention_external_robot true
## 机器人获取信息允许的字段,可以获取userId/displayName/portrait,其他需要这里配置允许。
## 第一位(1)是name, 第二位(2)是mobile,第三(4)位是email,第四位(8)是address,第五位(16)是company,第六位(32)是extra,
## 第七位(64)是updateDt,第八位(128)是gender,第九位(256)是social,第十位(512)是type。
## 比如允许获取name和email就是5(1+4),允许获取name和mobile和company和type就是531(1+2+16+512),允许全部是1023(1+2+...+512)
#robot.get_user_info_mask 1023
## 频道回调信息是否带上用户clientId和平台类型。
channel.callback_with_client_info false
+1 -1
View File
@@ -12,7 +12,7 @@
<artifactId>wildfirechat-parent</artifactId>
<packaging>pom</packaging>
<version>1.4.3</version>
<version>1.4.4</version>
<name>Wildfire Chat</name>
<description>Wildfire Chat Server</description>
<inceptionYear>2019</inceptionYear>
+9
View File
@@ -12,6 +12,15 @@
11. *** 1.3.8版本添加了server api发送消息的限制,限制消息体最大内容不能超过64KB,如果升级请注意业务系统发送消息大小。***
# 更新记录
--------------
Release note 1.4.4:
1. Server SDK添加mesh相关修改
2. 添加设置好友Extra的接口。
3. 解决创建账户时,没有传昵称使用了账户的问题。
4. 添加获取用户机器人列表的Server API。
5. 机器人回调消息中加上目标机器人ID。
6. 机器人获取用户信息添加配置确定能获取哪些字段。
--------------
Release note 1.4.3:
1. 添加内置存储上传文件文件名有效性检查。
+1 -1
View File
@@ -3,7 +3,7 @@
<parent>
<artifactId>wildfirechat-parent</artifactId>
<groupId>cn.wildfirechat</groupId>
<version>1.4.3</version>
<version>1.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -82,11 +82,12 @@ public class MeshAdmin {
return AdminHttpUtils.httpJsonPost(path, messageData, SendMessageResult.class);
}
public static IMResult<SendMessageResult> publishMessage(SendMessageData messageData, List<String> receivers) throws Exception {
public static IMResult<SendMessageResult> publishMessage(SendMessageData messageData, List<String> receivers, long messageId) throws Exception {
String path = APIPath.Msg_Publish;
PojoPublishMessageReq req = new PojoPublishMessageReq();
req.messageData = messageData;
req.receivers = receivers;
req.messageId = messageId;
return AdminHttpUtils.httpJsonPost(path, req, SendMessageResult.class);
}
@@ -140,6 +141,17 @@ public class MeshAdmin {
return AdminHttpUtils.httpJsonPost(path, addGroupMember, Void.class);
}
public static IMResult<Void> addJoinGroupRequest(String operator, String groupId, List<String> userIds, String reason, String extra) throws Exception {
String path = APIPath.Group_Join_Request_Add;
PojoAddJoinGroupRequest addGroupMember = new PojoAddJoinGroupRequest();
addGroupMember.operator = operator;
addGroupMember.group_id = groupId;
addGroupMember.userIds = userIds;
addGroupMember.reason = reason;
addGroupMember.extra = extra;
return AdminHttpUtils.httpJsonPost(path, addGroupMember, Void.class);
}
public static IMResult<PojoGroupInfoList> batchGroupInfos(List<String> groupIds) throws Exception {
return GroupAdmin.batchGroupInfos(groupIds);
}
@@ -81,6 +81,13 @@ public class UserAdmin {
return AdminHttpUtils.httpJsonPost(path, getRobotInfo, OutputRobot.class);
}
public static IMResult<OutputStringList> getUserRobots(String userId) throws Exception {
String path = APIPath.User_Get_User_Robots;
InputUserId getRobotInfo = new InputUserId();
getRobotInfo.setUserId(userId);
return AdminHttpUtils.httpJsonPost(path, getRobotInfo, OutputStringList.class);
}
public static IMResult<OutputGetIMTokenData> getUserToken(String userId, String clientId, int platform) throws Exception {
String path = APIPath.User_Get_Token;
InputGetToken getToken = new InputGetToken(userId, clientId, platform);