Files
IM-server-new/common/src/main/java/cn/wildfirechat/pojos/GroupNotificationBinaryContent.java
T

176 lines
5.4 KiB
Java
Raw Normal View History

2019-03-16 17:04:23 +08:00
/*
* 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.
*/
2019-05-22 07:23:09 +08:00
package cn.wildfirechat.pojos;
2019-03-16 17:04:23 +08:00
2019-05-22 07:23:09 +08:00
import cn.wildfirechat.proto.ProtoConstants;
2019-03-16 17:04:23 +08:00
import cn.wildfirechat.proto.WFCMessage;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
2019-03-16 17:04:23 +08:00
import com.google.protobuf.ByteString;
import java.util.List;
public class GroupNotificationBinaryContent {
2019-05-11 20:56:20 +08:00
//groupId
private String g;
2019-03-16 17:04:23 +08:00
//operator
private String o;
2019-06-29 08:27:04 +08:00
//value1(name or something)
2019-03-16 17:04:23 +08:00
private String n;
//members
private List<String> ms;
2019-06-29 08:27:04 +08:00
//value2(member or something)
2019-03-16 17:04:23 +08:00
private String m;
public GroupNotificationBinaryContent() {
}
2019-05-11 20:56:20 +08:00
public GroupNotificationBinaryContent(String g, String o, String n, String m) {
2019-05-12 11:21:42 +08:00
this.g = g;
2019-03-16 17:04:23 +08:00
this.o = o;
this.n = n;
this.m = m;
}
2019-05-11 20:56:20 +08:00
public GroupNotificationBinaryContent(String g, String operator, String name, List<String> members) {
2019-05-12 11:21:42 +08:00
this.g = g;
2019-03-16 17:04:23 +08:00
this.o = operator;
this.n = name;
this.ms = members;
}
2019-05-11 20:56:20 +08:00
public String getG() {
return g;
}
2019-03-16 17:04:23 +08:00
2019-05-11 20:56:20 +08:00
public void setG(String g) {
this.g = g;
}
public String getM() {
return m;
}
public void setM(String m) {
this.m = m;
}
2019-03-16 17:04:23 +08:00
public String getO() {
return o;
}
public void setO(String o) {
this.o = o;
}
public String getN() {
return n;
}
public void setN(String n) {
this.n = n;
}
public List<String> getMs() {
return ms;
}
public void setMs(List<String> ms) {
this.ms = ms;
}
public WFCMessage.MessageContent getGroupNotifyContent(int groupContentType) {
return WFCMessage.MessageContent.newBuilder().setType(groupContentType).setData(ByteString.copyFromUtf8(new GsonBuilder().disableHtmlEscaping().create().toJson(this))).build();
2019-03-16 17:04:23 +08:00
}
public WFCMessage.MessageContent getAddGroupNotifyContent() {
2019-05-22 07:23:09 +08:00
return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_ADD_GROUP_MEMBER);
2019-03-16 17:04:23 +08:00
}
public WFCMessage.MessageContent getCreateGroupNotifyContent() {
2019-05-22 07:23:09 +08:00
return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_CREATE_GROUP);
2019-03-16 17:04:23 +08:00
}
public WFCMessage.MessageContent getDismissGroupNotifyContent() {
2019-05-22 07:23:09 +08:00
return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_DISMISS_GROUP);
2019-03-16 17:04:23 +08:00
}
public WFCMessage.MessageContent getKickokfMemberGroupNotifyContent() {
2019-05-22 07:23:09 +08:00
return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_KICKOF_GROUP_MEMBER);
2019-03-16 17:04:23 +08:00
}
2020-12-10 18:03:41 +08:00
public WFCMessage.MessageContent getKickokfMemberVisibleGroupNotifyContent() {
return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_KICKOF_GROUP_MEMBER_VISIBLE);
}
2019-03-16 17:04:23 +08:00
public WFCMessage.MessageContent getQuitGroupNotifyContent() {
2019-05-22 07:23:09 +08:00
return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_QUIT_GROUP);
2019-03-16 17:04:23 +08:00
}
2020-12-10 18:03:41 +08:00
public WFCMessage.MessageContent getQuitVisibleGroupNotifyContent() {
return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_QUIT_GROUP_VISIBLE);
}
2019-03-16 17:04:23 +08:00
public WFCMessage.MessageContent getTransferGroupNotifyContent() {
2019-05-22 07:23:09 +08:00
return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_TRANSFER_GROUP_OWNER);
2019-03-16 17:04:23 +08:00
}
public WFCMessage.MessageContent getChangeGroupNameNotifyContent() {
2019-05-22 07:23:09 +08:00
return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_CHANGE_GROUP_NAME);
2019-03-16 17:04:23 +08:00
}
public WFCMessage.MessageContent getChangeGroupPortraitNotifyContent() {
2019-05-22 07:23:09 +08:00
return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_CHANGE_GROUP_PORTRAIT);
2019-03-16 17:04:23 +08:00
}
public WFCMessage.MessageContent getModifyGroupMemberAliasNotifyContent() {
2019-05-22 07:23:09 +08:00
return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_MODIFY_GROUP_ALIAS);
2019-03-16 17:04:23 +08:00
}
2019-06-29 08:27:04 +08:00
public WFCMessage.MessageContent getModifyGroupMemberExtraNotifyContent() {
return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_MODIFY_GROUP_MEMBER_EXTRA);
}
2019-06-29 08:27:04 +08:00
public WFCMessage.MessageContent getChangeGroupMuteNotifyContent() {
return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_CHANGE_MUTE);
}
public WFCMessage.MessageContent getChangeGroupJointypeNotifyContent() {
return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_CHANGE_JOINTYPE);
}
public WFCMessage.MessageContent getChangeGroupPrivatechatNotifyContent() {
return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_CHANGE_PRIVATECHAT);
}
public WFCMessage.MessageContent getChangeGroupSearchableNotifyContent() {
return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_CHANGE_SEARCHABLE);
}
2019-06-29 11:26:33 +08:00
public WFCMessage.MessageContent getSetGroupManagerNotifyContent() {
return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_SET_MANAGER);
}
2020-05-24 19:00:45 +08:00
public WFCMessage.MessageContent getMuteGroupMemberNotifyContent() {
return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_MUTE_MEMBER);
}
2019-06-29 11:26:33 +08:00
public WFCMessage.MessageContent getAllowGroupMemberNotifyContent() {
return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_ALLOW_MEMBER);
}
public WFCMessage.MessageContent getChangeGroupExtraNotifyContent() {
return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_MODIFY_GROUP_EXTRA);
}
2019-03-16 17:04:23 +08:00
}