wildfire chat server source initial submit

This commit is contained in:
heavyrain2012
2019-03-16 17:04:23 +08:00
parent e59217bd10
commit cab3ca0916
1466 changed files with 528862 additions and 15919 deletions
@@ -0,0 +1,39 @@
/*
* 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.pojos;
public class Conversation {
private int type;
private String target;
private int line;
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getTarget() {
return target;
}
public void setTarget(String target) {
this.target = target;
}
public int getLine() {
return line;
}
public void setLine(int line) {
this.line = line;
}
}
@@ -0,0 +1,108 @@
/*
* 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.pojos;
import cn.wildfirechat.proto.WFCMessage;
import com.google.gson.Gson;
import com.google.protobuf.ByteString;
import io.moquette.BrokerConstants;
import java.util.List;
public class GroupNotificationBinaryContent {
//operator
private String o;
//name
private String n;
//members
private List<String> ms;
//members
private String m;
public GroupNotificationBinaryContent(String o, String n, String m) {
this.o = o;
this.n = n;
this.m = m;
}
public GroupNotificationBinaryContent(String operator, String name, List<String> members) {
this.o = operator;
this.n = name;
this.ms = members;
}
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 Gson().toJson(this))).build();
}
public WFCMessage.MessageContent getAddGroupNotifyContent() {
return getGroupNotifyContent(BrokerConstants.MESSAGE_CONTENT_TYPE_ADD_GROUP_MEMBER);
}
public WFCMessage.MessageContent getCreateGroupNotifyContent() {
return getGroupNotifyContent(BrokerConstants.MESSAGE_CONTENT_TYPE_CREATE_GROUP);
}
public WFCMessage.MessageContent getDismissGroupNotifyContent() {
return getGroupNotifyContent(BrokerConstants.MESSAGE_CONTENT_TYPE_DISMISS_GROUP);
}
public WFCMessage.MessageContent getKickokfMemberGroupNotifyContent() {
return getGroupNotifyContent(BrokerConstants.MESSAGE_CONTENT_TYPE_KICKOF_GROUP_MEMBER);
}
public WFCMessage.MessageContent getQuitGroupNotifyContent() {
return getGroupNotifyContent(BrokerConstants.MESSAGE_CONTENT_TYPE_QUIT_GROUP);
}
public WFCMessage.MessageContent getTransferGroupNotifyContent() {
return getGroupNotifyContent(BrokerConstants.MESSAGE_CONTENT_TYPE_TRANSFER_GROUP_OWNER);
}
public WFCMessage.MessageContent getChangeGroupNameNotifyContent() {
return getGroupNotifyContent(BrokerConstants.MESSAGE_CONTENT_TYPE_CHANGE_GROUP_NAME);
}
public WFCMessage.MessageContent getChangeGroupPortraitNotifyContent() {
return getGroupNotifyContent(BrokerConstants.MESSAGE_CONTENT_TYPE_CHANGE_GROUP_PORTRAIT);
}
public WFCMessage.MessageContent getModifyGroupMemberAliasNotifyContent() {
return getGroupNotifyContent(BrokerConstants.MESSAGE_CONTENT_TYPE_MODIFY_GROUP_ALIAS);
}
}
@@ -0,0 +1,62 @@
/*
* 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.pojos;
import cn.wildfirechat.proto.WFCMessage;
import io.netty.util.internal.StringUtil;
import java.util.List;
public class InputAddGroupMember extends InputGroupBase {
private String group_id;
private List<PojoGroupMember> members;
public String getGroup_id() {
return group_id;
}
public void setGroup_id(String group_id) {
this.group_id = group_id;
}
public List<PojoGroupMember> getMembers() {
return members;
}
public void setMembers(List<PojoGroupMember> members) {
this.members = members;
}
public boolean isValide() {
return true;
}
public WFCMessage.AddGroupMemberRequest toProtoGroupRequest() {
WFCMessage.AddGroupMemberRequest.Builder addGroupBuilder = WFCMessage.AddGroupMemberRequest.newBuilder();
addGroupBuilder.setGroupId(group_id);
for (PojoGroupMember pojoGroupMember : getMembers()) {
WFCMessage.GroupMember.Builder groupMemberBuilder = WFCMessage.GroupMember.newBuilder().setMemberId(pojoGroupMember.getMember_id());
if (!StringUtil.isNullOrEmpty(pojoGroupMember.getAlias())) {
groupMemberBuilder.setAlias(pojoGroupMember.getAlias());
}
groupMemberBuilder.setType(pojoGroupMember.getType());
addGroupBuilder.addAddedMember(groupMemberBuilder);
}
for (Integer line : to_lines
) {
addGroupBuilder.addToLine(line);
}
addGroupBuilder.setNotifyContent(notify_message.toProtoMessageContent());
return addGroupBuilder.build();
}
}
@@ -0,0 +1,101 @@
/*
* 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.pojos;
import cn.wildfirechat.proto.ProtoConstants;
import cn.wildfirechat.proto.WFCMessage;
import io.netty.util.internal.StringUtil;
public class InputCreateChatroom {
private String chatroomId;
private String title;
private String desc;
private String portrait;
private String extra;
private Integer state;
public WFCMessage.ChatroomInfo toChatroomInfo() {
WFCMessage.ChatroomInfo.Builder builder = WFCMessage.ChatroomInfo.newBuilder().setTitle(title);
if (!StringUtil.isNullOrEmpty(desc)) {
builder.setDesc(desc);
}
if (!StringUtil.isNullOrEmpty(portrait)) {
builder.setPortrait(portrait);
}
long current = System.currentTimeMillis();
builder.setCreateDt(current).setUpdateDt(current).setMemberCount(0);
if (!StringUtil.isNullOrEmpty(extra)) {
builder.setExtra(extra);
}
if (state == null || state == 0) {
builder.setState(ProtoConstants.ChatroomState.Chatroom_State_Normal);
} else if(state == 1) {
builder.setState(ProtoConstants.ChatroomState.Chatroom_State_NotStart);
} else {
builder.setState(ProtoConstants.ChatroomState.Chatroom_State_End);
}
return builder.build();
}
public InputCreateChatroom() {
}
public Integer getState() {
return state;
}
public void setState(Integer state) {
this.state = state;
}
public String getChatroomId() {
return chatroomId;
}
public void setChatroomId(String chatroomId) {
this.chatroomId = chatroomId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getPortrait() {
return portrait;
}
public void setPortrait(String portrait) {
this.portrait = portrait;
}
public String getExtra() {
return extra;
}
public void setExtra(String extra) {
this.extra = extra;
}
}
@@ -0,0 +1,77 @@
/*
* 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.pojos;
import cn.wildfirechat.proto.WFCMessage;
import io.netty.util.internal.StringUtil;
import java.util.List;
public class InputCreateGroup extends InputGroupBase {
private PojoGroup group;
public boolean isValide() {
return true;
}
public WFCMessage.CreateGroupRequest toProtoGroupRequest() {
WFCMessage.Group.Builder groupBuilder = WFCMessage.Group.newBuilder();
WFCMessage.GroupInfo.Builder groupInfoBuilder = WFCMessage.GroupInfo.newBuilder();
if (!StringUtil.isNullOrEmpty(group.getGroup_info().target_id)) {
groupInfoBuilder.setTargetId(group.getGroup_info().getTarget_id());
}
if (!StringUtil.isNullOrEmpty(group.getGroup_info().name)) {
groupInfoBuilder.setName(group.getGroup_info().getName());
}
if (!StringUtil.isNullOrEmpty(group.getGroup_info().portrait)) {
groupInfoBuilder.setPortrait(group.getGroup_info().getPortrait());
}
if (!StringUtil.isNullOrEmpty(group.getGroup_info().owner)) {
groupInfoBuilder.setOwner(group.getGroup_info().getOwner());
}
groupInfoBuilder.setType(group.getGroup_info().getType());
if (!StringUtil.isNullOrEmpty(group.getGroup_info().extra)) {
groupInfoBuilder.setExtra(group.getGroup_info().getExtra());
}
groupBuilder.setGroupInfo(groupInfoBuilder);
for (PojoGroupMember pojoGroupMember : group.getMembers()) {
WFCMessage.GroupMember.Builder groupMemberBuilder = WFCMessage.GroupMember.newBuilder().setMemberId(pojoGroupMember.getMember_id());
if (!StringUtil.isNullOrEmpty(pojoGroupMember.getAlias())) {
groupMemberBuilder.setAlias(pojoGroupMember.getAlias());
}
groupMemberBuilder.setType(pojoGroupMember.getType());
groupBuilder.addMembers(groupMemberBuilder);
}
WFCMessage.CreateGroupRequest.Builder createGroupReqBuilder = WFCMessage.CreateGroupRequest.newBuilder();
createGroupReqBuilder.setGroup(groupBuilder);
for (Integer line : to_lines
) {
createGroupReqBuilder.addToLine(line);
}
createGroupReqBuilder.setNotifyContent(notify_message.toProtoMessageContent());
return createGroupReqBuilder.build();
}
public PojoGroup getGroup() {
return group;
}
public void setGroup(PojoGroup group) {
this.group = group;
}
}
@@ -0,0 +1,217 @@
/*
* 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.pojos;
import cn.wildfirechat.proto.ProtoConstants;
import cn.wildfirechat.proto.WFCMessage;
import io.netty.util.internal.StringUtil;
public class InputCreateRobot {
private String userId;
private String name;
private String password;
private String displayName;
private String portrait;
private int gender;
private String mobile;
private String email;
private String address;
private String company;
private String social;
private String extra;
private long updateDt;
private String owner;
private String secret;
private String callback;
private String robotExtra;
public String getSocial() {
return social;
}
public void setSocial(String social) {
this.social = social;
}
public WFCMessage.Robot toRobot() {
WFCMessage.Robot.Builder builder = WFCMessage.Robot.newBuilder();
if (!StringUtil.isNullOrEmpty(userId))
builder.setUid(userId);
if (!StringUtil.isNullOrEmpty(owner))
builder.setOwner(owner);
if (!StringUtil.isNullOrEmpty(secret))
builder.setSecret(secret);
if (!StringUtil.isNullOrEmpty(callback))
builder.setCallback(callback);
if (!StringUtil.isNullOrEmpty(robotExtra))
builder.setExtra(robotExtra);
builder.setState(0);
return builder.build();
}
public WFCMessage.User toUser() {
WFCMessage.User.Builder newUserBuilder = WFCMessage.User.newBuilder()
.setUid(userId);
if (name != null)
newUserBuilder.setName(name);
if (displayName != null)
newUserBuilder.setDisplayName(displayName);
if (getPortrait() != null)
newUserBuilder.setPortrait(getPortrait());
if (getEmail() != null)
newUserBuilder.setEmail(getEmail());
if (getAddress() != null)
newUserBuilder.setAddress(getAddress());
if (getCompany() != null)
newUserBuilder.setCompany(getCompany());
if (getSocial() != null)
newUserBuilder.setSocial(getSocial());
if (getMobile() != null)
newUserBuilder.setMobile(getMobile());
if (getExtra() != null)
newUserBuilder.setExtra(getExtra());
newUserBuilder.setType(ProtoConstants.UserType.UserType_Robot);
newUserBuilder.setGender(gender);
newUserBuilder.setUpdateDt(System.currentTimeMillis());
return newUserBuilder.build();
}
public long getUpdateDt() {
return updateDt;
}
public void setUpdateDt(long updateDt) {
this.updateDt = updateDt;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public String getPortrait() {
return portrait;
}
public void setPortrait(String portrait) {
this.portrait = portrait;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getCompany() {
return company;
}
public void setCompany(String company) {
this.company = company;
}
public String getExtra() {
return extra;
}
public void setExtra(String extra) {
this.extra = extra;
}
public int getGender() {
return gender;
}
public void setGender(int gender) {
this.gender = gender;
}
public String getOwner() {
return owner;
}
public void setOwner(String owner) {
this.owner = owner;
}
public String getSecret() {
return secret;
}
public void setSecret(String secret) {
this.secret = secret;
}
public String getCallback() {
return callback;
}
public void setCallback(String callback) {
this.callback = callback;
}
public String getRobotExtra() {
return robotExtra;
}
public void setRobotExtra(String robotExtra) {
this.robotExtra = robotExtra;
}
}
@@ -0,0 +1,177 @@
/*
* 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.pojos;
import cn.wildfirechat.proto.WFCMessage;
public class InputCreateUser {
private String userId;
private String name;
private String password;
private String displayName;
private String portrait;
private int gender;
private String mobile;
private String email;
private String address;
private String company;
private String social;
private String extra;
private long updateDt;
public static InputCreateUser fromPbUser(WFCMessage.User pbUser) {
InputCreateUser inputCreateUser = new InputCreateUser();
inputCreateUser.userId = pbUser.getUid();
inputCreateUser.name = pbUser.getName();
inputCreateUser.displayName = pbUser.getDisplayName();
inputCreateUser.portrait = pbUser.getPortrait();
inputCreateUser.gender = pbUser.getGender();
inputCreateUser.mobile = pbUser.getMobile();
inputCreateUser.email = pbUser.getEmail();
inputCreateUser.address = pbUser.getAddress();
inputCreateUser.company = pbUser.getCompany();
inputCreateUser.social = pbUser.getSocial();
inputCreateUser.extra = pbUser.getExtra();
inputCreateUser.updateDt = pbUser.getUpdateDt();
return inputCreateUser;
}
public String getSocial() {
return social;
}
public void setSocial(String social) {
this.social = social;
}
public WFCMessage.User toUser() {
WFCMessage.User.Builder newUserBuilder = WFCMessage.User.newBuilder()
.setUid(userId);
if (name != null)
newUserBuilder.setName(name);
if (displayName != null)
newUserBuilder.setDisplayName(displayName);
if (getPortrait() != null)
newUserBuilder.setPortrait(getPortrait());
if (getEmail() != null)
newUserBuilder.setEmail(getEmail());
if (getAddress() != null)
newUserBuilder.setAddress(getAddress());
if (getCompany() != null)
newUserBuilder.setCompany(getCompany());
if (getSocial() != null)
newUserBuilder.setSocial(getSocial());
if (getMobile() != null)
newUserBuilder.setMobile(getMobile());
if (getExtra() != null)
newUserBuilder.setExtra(getExtra());
newUserBuilder.setGender(gender);
newUserBuilder.setUpdateDt(System.currentTimeMillis());
return newUserBuilder.build();
}
public long getUpdateDt() {
return updateDt;
}
public void setUpdateDt(long updateDt) {
this.updateDt = updateDt;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public String getPortrait() {
return portrait;
}
public void setPortrait(String portrait) {
this.portrait = portrait;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getCompany() {
return company;
}
public void setCompany(String company) {
this.company = company;
}
public String getExtra() {
return extra;
}
public void setExtra(String extra) {
this.extra = extra;
}
public int getGender() {
return gender;
}
public void setGender(int gender) {
this.gender = gender;
}
}
@@ -0,0 +1,25 @@
/*
* 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.pojos;
public class InputDestoryChatroom {
private String chatroomId;
public InputDestoryChatroom() {
}
public String getChatroomId() {
return chatroomId;
}
public void setChatroomId(String chatroomId) {
this.chatroomId = chatroomId;
}
}
@@ -0,0 +1,46 @@
/*
* 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.pojos;
import cn.wildfirechat.proto.WFCMessage;
import io.netty.util.internal.StringUtil;
import java.util.List;
public class InputDismissGroupMember extends InputGroupBase {
private String group_id;
public String getGroup_id() {
return group_id;
}
public void setGroup_id(String group_id) {
this.group_id = group_id;
}
public boolean isValide() {
return true;
}
public WFCMessage.DismissGroupRequest toProtoGroupRequest() {
WFCMessage.DismissGroupRequest.Builder dismissGroupBuilder = WFCMessage.DismissGroupRequest.newBuilder();
dismissGroupBuilder.setGroupId(group_id);
for (Integer line : to_lines
) {
dismissGroupBuilder.addToLine(line);
}
dismissGroupBuilder.setNotifyContent(notify_message.toProtoMessageContent());
return dismissGroupBuilder.build();
}
}
@@ -0,0 +1,44 @@
/*
* 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.pojos;
public class InputGetUserInfo {
private String userId;
private String name;
private String mobile;
public InputGetUserInfo(String userId, String name) {
this.userId = userId;
this.name = name;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
@@ -0,0 +1,38 @@
/*
* 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.pojos;
import java.util.List;
public class InputGroupBase {
public String operator;
public List<Integer> to_lines;
public MessagePayload notify_message;
public String getOperator() {
return operator;
}
public List<Integer> getTo_lines() {
return to_lines;
}
public void setTo_lines(List<Integer> to_lines) {
this.to_lines = to_lines;
}
public MessagePayload getNotify_message() {
return notify_message;
}
public void setNotify_message(MessagePayload notify_message) {
this.notify_message = notify_message;
}
}
@@ -0,0 +1,55 @@
/*
* 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.pojos;
import cn.wildfirechat.proto.WFCMessage;
import io.netty.util.internal.StringUtil;
import java.util.List;
public class InputKickoffGroupMember extends InputGroupBase {
private String group_id;
private List<String> members;
public String getGroup_id() {
return group_id;
}
public void setGroup_id(String group_id) {
this.group_id = group_id;
}
public List<String> getMembers() {
return members;
}
public void setMembers(List<String> members) {
this.members = members;
}
public boolean isValide() {
return true;
}
public WFCMessage.RemoveGroupMemberRequest toProtoGroupRequest() {
WFCMessage.RemoveGroupMemberRequest.Builder removedGroupBuilder = WFCMessage.RemoveGroupMemberRequest.newBuilder();
removedGroupBuilder.setGroupId(group_id);
removedGroupBuilder.addAllRemovedMember(members);
for (Integer line : to_lines
) {
removedGroupBuilder.addToLine(line);
}
removedGroupBuilder.setNotifyContent(notify_message.toProtoMessageContent());
return removedGroupBuilder.build();
}
}
@@ -0,0 +1,24 @@
/*
* 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.pojos;
import java.util.List;
public class InputOutputSensitiveWords {
private List<String> words;
public List<String> getWords() {
return words;
}
public void setWords(List<String> words) {
this.words = words;
}
}
@@ -0,0 +1,36 @@
/*
* 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.pojos;
public class InputOutputUserBlockStatus {
private String userId;
private int status;
public InputOutputUserBlockStatus(String userId, int status) {
this.userId = userId;
this.status = status;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}
@@ -0,0 +1,53 @@
/*
* 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.pojos;
import cn.wildfirechat.proto.WFCMessage;
import io.netty.util.internal.StringUtil;
public class InputTransferGroup extends InputGroupBase {
private String group_id;
private String new_owner;
public boolean isValide() {
return true;
}
public WFCMessage.TransferGroupRequest toProtoGroupRequest() {
WFCMessage.TransferGroupRequest.Builder groupBuilder = WFCMessage.TransferGroupRequest.newBuilder();
groupBuilder.setGroupId(group_id);
groupBuilder.setNewOwner(new_owner);
for (Integer line : to_lines
) {
groupBuilder.addToLine(line);
}
groupBuilder.setNotifyContent(notify_message.toProtoMessageContent());
return groupBuilder.build();
}
public String getGroup_id() {
return group_id;
}
public void setGroup_id(String group_id) {
this.group_id = group_id;
}
public String getNew_owner() {
return new_owner;
}
public void setNew_owner(String new_owner) {
this.new_owner = new_owner;
}
}
@@ -0,0 +1,40 @@
/*
* 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.pojos;
public class InputUserLogin {
private String name;
private String password;
private String clientId;
public String getClientId() {
return clientId;
}
public void setClientId(String clientId) {
this.clientId = clientId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
@@ -0,0 +1,164 @@
/*
* 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.pojos;
import cn.wildfirechat.proto.WFCMessage;
import com.google.protobuf.ByteString;
import com.hazelcast.util.StringUtil;
import java.util.ArrayList;
import java.util.Base64;
import java.util.List;
public class MessagePayload {
private int type;
private String searchableContent;
private String pushContent;
private String content;
private String base64edData;
private int mediaType;
private String remoteMediaUrl;
private int persistFlag;
private int expireDuration;
private int mentionedType;
private List<String> mentionedTarget;
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getSearchableContent() {
return searchableContent;
}
public void setSearchableContent(String searchableContent) {
this.searchableContent = searchableContent;
}
public String getPushContent() {
return pushContent;
}
public void setPushContent(String pushContent) {
this.pushContent = pushContent;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getBase64edData() {
return base64edData;
}
public void setBase64edData(String base64edData) {
this.base64edData = base64edData;
}
public int getMediaType() {
return mediaType;
}
public void setMediaType(int mediaType) {
this.mediaType = mediaType;
}
public String getRemoteMediaUrl() {
return remoteMediaUrl;
}
public void setRemoteMediaUrl(String remoteMediaUrl) {
this.remoteMediaUrl = remoteMediaUrl;
}
public int getPersistFlag() {
return persistFlag;
}
public void setPersistFlag(int persistFlag) {
this.persistFlag = persistFlag;
}
public int getExpireDuration() {
return expireDuration;
}
public void setExpireDuration(int expireDuration) {
this.expireDuration = expireDuration;
}
public int getMentionedType() {
return mentionedType;
}
public void setMentionedType(int mentionedType) {
this.mentionedType = mentionedType;
}
public List<String> getMentionedTarget() {
return mentionedTarget;
}
public void setMentionedTarget(List<String> mentionedTarget) {
this.mentionedTarget = mentionedTarget;
}
public WFCMessage.MessageContent toProtoMessageContent() {
WFCMessage.MessageContent.Builder builder = WFCMessage.MessageContent.newBuilder()
.setType(type)
.setMediaType(mediaType)
.setPersistFlag(persistFlag)
.setExpireDuration(expireDuration)
.setMentionedType(mentionedType);
if (!StringUtil.isNullOrEmpty(searchableContent))
builder.setSearchableContent(searchableContent);
if (!StringUtil.isNullOrEmpty(pushContent))
builder.setPushContent(pushContent);
if (!StringUtil.isNullOrEmpty(searchableContent))
builder.setContent(searchableContent);
if (!StringUtil.isNullOrEmpty(base64edData))
builder.setData(ByteString.copyFrom(Base64.getDecoder().decode(base64edData)));
if (!StringUtil.isNullOrEmpty(remoteMediaUrl))
builder.setRemoteMediaUrl(remoteMediaUrl);
if (mentionedTarget != null && mentionedTarget.size() > 0)
builder.addAllMentionedTarget(mentionedTarget);
return builder.build();
}
public static MessagePayload fromProtoMessageContent(WFCMessage.MessageContent protoContent) {
if (protoContent == null)
return null;
MessagePayload payload = new MessagePayload();
payload.type = protoContent.getType();
payload.searchableContent = protoContent.getSearchableContent();
payload.pushContent = protoContent.getPushContent();
payload.content = protoContent.getContent();
if (protoContent.getData() != null && protoContent.getData().size() > 0)
payload.base64edData = Base64.getEncoder().encodeToString(protoContent.getData().toByteArray());
payload.mediaType = protoContent.getMediaType();
payload.remoteMediaUrl = protoContent.getRemoteMediaUrl();
payload.persistFlag = protoContent.getPersistFlag();
payload.expireDuration = protoContent.getExpireDuration();
payload.mentionedType = protoContent.getMentionedType();
payload.mentionedTarget = new ArrayList<>();
payload.mentionedTarget.addAll(protoContent.getMentionedTargetList());
return payload;
}
}
@@ -0,0 +1,21 @@
/*
* 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.pojos;
public class OutputCheckUserOnline {
private int status; //0 online, 1 have session offline, 2 no session
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}
@@ -0,0 +1,29 @@
/*
* 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.pojos;
public class OutputCreateChatroom {
private String chatroomId;
public OutputCreateChatroom() {
}
public OutputCreateChatroom(String chatroomId) {
this.chatroomId = chatroomId;
}
public String getChatroomId() {
return chatroomId;
}
public void setChatroomId(String chatroomId) {
this.chatroomId = chatroomId;
}
}
@@ -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 com.xiaoleilu.loServer.pojos;
import cn.wildfirechat.proto.WFCMessage;
import io.netty.util.internal.StringUtil;
import java.util.List;
public class OutputCreateGroupResult {
private String group_id;
public OutputCreateGroupResult(String group_id) {
this.group_id = group_id;
}
public String getGroup_id() {
return group_id;
}
public void setGroup_id(String group_id) {
this.group_id = group_id;
}
}
@@ -0,0 +1,35 @@
/*
* 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.pojos;
public class OutputCreateRobot {
private String userId;
private String secret;
public OutputCreateRobot(String userId, String secret) {
this.userId = userId;
this.secret = secret;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getSecret() {
return secret;
}
public void setSecret(String secret) {
this.secret = secret;
}
}
@@ -0,0 +1,35 @@
/*
* 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.pojos;
public class OutputCreateUser {
private String userId;
private String name;
public OutputCreateUser(String userId, String name) {
this.userId = userId;
this.name = name;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
@@ -0,0 +1,101 @@
/*
* 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.pojos;
import cn.wildfirechat.proto.WFCMessage;
import io.netty.util.internal.StringUtil;
public class OutputGetChatroomInfo {
private String chatroomId;
private String title;
private String desc;
private String portrait;
private String extra;
private int memberCount;
private long createDt;
private long updateDt;
public OutputGetChatroomInfo(String chatroomId, int memberCount, WFCMessage.ChatroomInfo chatroomInfo) {
this.chatroomId = chatroomId;
this.title = chatroomInfo.getTitle();
this.desc = chatroomInfo.getDesc();
this.portrait = chatroomInfo.getPortrait();
this.memberCount = memberCount;
this.createDt = chatroomInfo.getCreateDt();
this.updateDt = chatroomInfo.getUpdateDt();
}
public OutputGetChatroomInfo() {
}
public int getMemberCount() {
return memberCount;
}
public void setMemberCount(int memberCount) {
this.memberCount = memberCount;
}
public long getCreateDt() {
return createDt;
}
public void setCreateDt(long createDt) {
this.createDt = createDt;
}
public long getUpdateDt() {
return updateDt;
}
public void setUpdateDt(long updateDt) {
this.updateDt = updateDt;
}
public String getChatroomId() {
return chatroomId;
}
public void setChatroomId(String chatroomId) {
this.chatroomId = chatroomId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getPortrait() {
return portrait;
}
public void setPortrait(String portrait) {
this.portrait = portrait;
}
public String getExtra() {
return extra;
}
public void setExtra(String extra) {
this.extra = extra;
}
}
@@ -0,0 +1,38 @@
/*
* 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.pojos;
import java.util.List;
public class OutputLoginData {
private String userId;
private String token;
public OutputLoginData(String userId, String token) {
this.userId = userId;
this.token = token;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
}
@@ -0,0 +1,45 @@
/*
* 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.pojos;
public class OutputNotifyChannelSubscribeStatus {
private String userId;
private String channelId;
private int status;
public OutputNotifyChannelSubscribeStatus(String userId, String channelId, boolean subscirbed) {
this.userId = userId;
this.channelId = channelId;
this.status = subscirbed ? 1 : 0;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getChannelId() {
return channelId;
}
public void setChannelId(String channelId) {
this.channelId = channelId;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}
@@ -0,0 +1,57 @@
/*
* 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.pojos;
import java.util.List;
public class OutputRouteData { ;
private List<String> serverIPs;
private int longPort;
private int shortPort;
private String secret;
public OutputRouteData(List<String> serverIPs, int longPort, int shortPort, String secret) {
this.serverIPs = serverIPs;
this.longPort = longPort;
this.shortPort = shortPort;
this.secret = secret;
}
public int getLongPort() {
return longPort;
}
public void setLongPort(int longPort) {
this.longPort = longPort;
}
public int getShortPort() {
return shortPort;
}
public void setShortPort(int shortPort) {
this.shortPort = shortPort;
}
public List<String> getServerIPs() {
return serverIPs;
}
public void setServerIPs(List<String> serverIPs) {
this.serverIPs = serverIPs;
}
public String getSecret() {
return secret;
}
public void setSecret(String secret) {
this.secret = secret;
}
}
@@ -0,0 +1,28 @@
/*
* 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.pojos;
public class OutputUserStatus {
private int status;
public OutputUserStatus() {
}
public OutputUserStatus(int status) {
this.status = status;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}
@@ -0,0 +1,32 @@
/*
* 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.pojos;
import java.util.List;
public class PojoGroup {
private PojoGroupInfo group_info;
private List<PojoGroupMember> members;
public PojoGroupInfo getGroup_info() {
return group_info;
}
public void setGroup_info(PojoGroupInfo group_info) {
this.group_info = group_info;
}
public List<PojoGroupMember> getMembers() {
return members;
}
public void setMembers(List<PojoGroupMember> members) {
this.members = members;
}
}
@@ -0,0 +1,66 @@
/*
* 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.pojos;
public class PojoGroupInfo {
String target_id;
String name;
String portrait;
String owner;
int type;
String extra;
public String getTarget_id() {
return target_id;
}
public void setTarget_id(String target_id) {
this.target_id = target_id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPortrait() {
return portrait;
}
public void setPortrait(String portrait) {
this.portrait = portrait;
}
public String getOwner() {
return owner;
}
public void setOwner(String owner) {
this.owner = owner;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getExtra() {
return extra;
}
public void setExtra(String extra) {
this.extra = extra;
}
}
@@ -0,0 +1,39 @@
/*
* 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.pojos;
public class PojoGroupMember {
String member_id;
String alias;
int type;
public String getMember_id() {
return member_id;
}
public void setMember_id(String member_id) {
this.member_id = member_id;
}
public String getAlias() {
return alias;
}
public void setAlias(String alias) {
this.alias = alias;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
}
@@ -0,0 +1,33 @@
/*
* 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.pojos;
import cn.wildfirechat.proto.WFCMessage;
import io.netty.util.internal.StringUtil;
public class RecallMessageData {
private String operator;
private long messageUid;
public String getOperator() {
return operator;
}
public void setOperator(String operator) {
this.operator = operator;
}
public long getMessageUid() {
return messageUid;
}
public void setMessageUid(long messageUid) {
this.messageUid = messageUid;
}
}
@@ -0,0 +1,75 @@
/*
* 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.pojos;
import cn.wildfirechat.proto.ProtoConstants;
import cn.wildfirechat.proto.WFCMessage;
import io.netty.util.internal.StringUtil;
public class SendMessageData {
private String sender;
private Conversation conv;
private MessagePayload payload;
public String getSender() {
return sender;
}
public void setSender(String sender) {
this.sender = sender;
}
public Conversation getConv() {
return conv;
}
public void setConv(Conversation conv) {
this.conv = conv;
}
public MessagePayload getPayload() {
return payload;
}
public void setPayload(MessagePayload payload) {
this.payload = payload;
}
public static boolean isValide(SendMessageData sendMessageData) {
if(sendMessageData == null ||
sendMessageData.getConv() == null ||
sendMessageData.getConv().getType() < 0 ||
sendMessageData.getConv().getType() > 6 ||
StringUtil.isNullOrEmpty(sendMessageData.getConv().getTarget()) ||
StringUtil.isNullOrEmpty(sendMessageData.getSender()) ||
sendMessageData.getPayload() == null) {
return false;
}
return true;
}
public WFCMessage.Message toProtoMessage() {
return WFCMessage.Message.newBuilder().setFromUser(sender)
.setConversation(WFCMessage.Conversation.newBuilder().setType(conv.getType()).setTarget(conv.getTarget()).setLine(conv.getLine()))
.setContent(payload.toProtoMessageContent())
.build();
}
public static SendMessageData fromProtoMessage(WFCMessage.Message protoMessage) {
SendMessageData data = new SendMessageData();
data.sender = protoMessage.getFromUser();
data.conv = new Conversation();
data.conv.setTarget(protoMessage.getConversation().getTarget());
data.conv.setType(protoMessage.getConversation().getType());
data.conv.setLine(protoMessage.getConversation().getLine());
data.payload = MessagePayload.fromProtoMessageContent(protoMessage.getContent());
return data;
}
}
@@ -0,0 +1,41 @@
/*
* 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.pojos;
import cn.wildfirechat.proto.WFCMessage;
import io.netty.util.internal.StringUtil;
public class SendMessageResult {
private long messageUid;
private long timestamp;
public SendMessageResult() {
}
public SendMessageResult(long messageUid, long timestamp) {
this.messageUid = messageUid;
this.timestamp = timestamp;
}
public long getMessageUid() {
return messageUid;
}
public void setMessageUid(long messageUid) {
this.messageUid = messageUid;
}
public long getTimestamp() {
return timestamp;
}
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
}