diff --git a/broker/migrate/h2/V52__modify_message_target.sql b/broker/migrate/h2/V52__modify_message_target.sql new file mode 100755 index 00000000..16704122 --- /dev/null +++ b/broker/migrate/h2/V52__modify_message_target.sql @@ -0,0 +1 @@ +alter table `t_messages` modify column `_target` varchar(129) NOT NULL; diff --git a/broker/migrate/mysql/V60__modify_messages_target.sql b/broker/migrate/mysql/V60__modify_messages_target.sql new file mode 100755 index 00000000..c8b0ded2 --- /dev/null +++ b/broker/migrate/mysql/V60__modify_messages_target.sql @@ -0,0 +1,37 @@ +alter table `t_messages` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_0` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_1` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_2` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_3` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_4` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_5` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_6` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_7` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_8` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_9` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_10` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_11` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_12` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_13` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_14` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_15` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_16` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_17` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_18` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_19` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_20` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_21` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_22` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_23` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_24` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_25` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_26` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_27` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_28` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_29` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_30` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_31` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_32` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_33` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_34` modify column `_target` varchar(129) NOT NULL; +alter table `t_messages_35` modify column `_target` varchar(129) NOT NULL; diff --git a/common/src/main/java/cn/wildfirechat/common/APIPath.java b/common/src/main/java/cn/wildfirechat/common/APIPath.java index e472e914..01a30774 100644 --- a/common/src/main/java/cn/wildfirechat/common/APIPath.java +++ b/common/src/main/java/cn/wildfirechat/common/APIPath.java @@ -139,6 +139,7 @@ public interface APIPath { String Robot_User_Info = "/robot/user_info"; String Robot_Get_Profile = "/robot/profile"; String Robot_Message_Send = "/robot/message/send"; + String Robot_Message_Reply = "/robot/message/reply"; String Robot_Message_Recall = "/robot/message/recall"; String Robot_Message_Update = "/robot/message/update"; String Robot_Set_Callback = "/robot/set_callback"; diff --git a/common/src/main/java/cn/wildfirechat/pojos/ReplyMessageData.java b/common/src/main/java/cn/wildfirechat/pojos/ReplyMessageData.java new file mode 100644 index 00000000..3a215c78 --- /dev/null +++ b/common/src/main/java/cn/wildfirechat/pojos/ReplyMessageData.java @@ -0,0 +1,52 @@ +/* + * This file is part of the Wildfire Chat package. + * (c) Heavyrain2012 + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +package cn.wildfirechat.pojos; + +import cn.wildfirechat.proto.WFCMessage; +import io.netty.util.internal.StringUtil; + +import java.util.List; + +public class ReplyMessageData { + private long messageUid; + private MessagePayload payload; + private boolean only2Sender; + + public long getMessageUid() { + return messageUid; + } + + public void setMessageUid(long messageUid) { + this.messageUid = messageUid; + } + + public MessagePayload getPayload() { + return payload; + } + + public void setPayload(MessagePayload payload) { + this.payload = payload; + } + + public boolean isOnly2Sender() { + return only2Sender; + } + + public void setOnly2Sender(boolean only2Sender) { + this.only2Sender = only2Sender; + } + + public static boolean isValide(ReplyMessageData sendMessageData) { + if(sendMessageData.messageUid <=0 || + sendMessageData.getPayload() == null) { + return false; + } + return true; + } +} diff --git a/sdk/src/main/java/cn/wildfirechat/sdk/RobotService.java b/sdk/src/main/java/cn/wildfirechat/sdk/RobotService.java index 91abc61a..e17a8d15 100644 --- a/sdk/src/main/java/cn/wildfirechat/sdk/RobotService.java +++ b/sdk/src/main/java/cn/wildfirechat/sdk/RobotService.java @@ -39,6 +39,15 @@ public class RobotService implements Closeable { return robotHttpUtils.httpJsonPost(path, messageData, SendMessageResult.class); } + public IMResult replyMessage(long messageUid, MessagePayload payload, boolean only2Sender) throws Exception { + String path = APIPath.Robot_Message_Reply; + ReplyMessageData messageData = new ReplyMessageData(); + messageData.setMessageUid(messageUid); + messageData.setOnly2Sender(only2Sender); + messageData.setPayload(payload); + return robotHttpUtils.httpJsonPost(path, messageData, SendMessageResult.class); + } + public IMResult recallMessage(long messageUid) throws Exception { String path = APIPath.Robot_Message_Recall; RecallMessageData messageData = new RecallMessageData();