com.akaxin.proto.core.CoreProto.MsgType Java Examples

The following examples show how to use com.akaxin.proto.core.CoreProto.MsgType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MessageManageService.java    From openzaly with Apache License 2.0 6 votes vote down vote up
@Override
public boolean sendGroupWebMessage(WebMessageBean bean) {
	CoreProto.GroupWeb groupWeb = CoreProto.GroupWeb.newBuilder().setMsgId(bean.getMsgId())
			.setSiteUserId(bean.getSiteUserId()).setSiteGroupId(bean.getSiteGroupId()).setWebCode(bean.getWebCode())
			.setHeight(bean.getHeight()).setHrefUrl(bean.getHrefUrl()).setWidth(bean.getWidth())
			.setTime(System.currentTimeMillis()).build();
	ImCtsMessageProto.ImCtsMessageRequest request = ImCtsMessageProto.ImCtsMessageRequest.newBuilder()
			.setType(MsgType.GROUP_WEB).setGroupWeb(groupWeb).build();

	Command command = new Command();
	command.setSiteUserId(bean.getSiteUserId());
	command.setAction(RequestAction.IM_CTS_MESSAGE.getName());
	command.setParams(request.toByteArray());
	boolean result = imService.execute(command);

	logger.info("send group web message result={} bean={}", result, bean.toString());
	return result;
}
 
Example #2
Source File: AbstractU2Handler.java    From openzaly with Apache License 2.0 6 votes vote down vote up
protected void msgStatusResponse(Command command, String msgId, long msgTime, int statusValue) {
	if (command == null || StringUtils.isAnyEmpty(command.getDeviceId(), msgId)) {
		return;
	}
	CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgStatus(statusValue)
			.setMsgServerTime(msgTime).build();

	ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder()
			.setType(MsgType.MSG_STATUS).setStatus(status).build();

	ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder()
			.addList(statusMsg).build();

	CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder()
			.setData(request.toByteString()).build();

	ChannelWriter.writeByDeviceId(command.getDeviceId(), new RedisCommand().add(CommandConst.PROTOCOL_VERSION)
			.add(CommandConst.IM_MSG_TOCLIENT).add(data.toByteArray()));
}
 
Example #3
Source File: AbstractU2Handler.java    From openzaly with Apache License 2.0 6 votes vote down vote up
/**
 * 通过channel回执消息状态
 */
@Deprecated
protected void msgStatusResponse(Channel channel, Command command, String from, String to, String msgId,
		long msgTime) {
	CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgServerTime(msgTime)
			.setMsgStatus(1).build();

	ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder()
			.setType(MsgType.MSG_STATUS).setStatus(status).build();

	ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder()
			.addList(statusMsg).build();

	CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder()
			.setData(request.toByteString()).build();

	channel.writeAndFlush(new RedisCommand().add(CommandConst.PROTOCOL_VERSION).add(CommandConst.IM_MSG_TOCLIENT)
			.add(data.toByteArray()));

}
 
Example #4
Source File: AbstractGroupHandler.java    From openzaly with Apache License 2.0 6 votes vote down vote up
protected void msgStatusResponse(Command command, String msgId, long msgTime, boolean success) {
	if (command == null || StringUtils.isEmpty(command.getDeviceId())) {
		return;
	}

	int statusValue = success ? 1 : 0;
	CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgServerTime(msgTime)
			.setMsgStatus(statusValue).build();

	ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder()
			.setType(MsgType.MSG_STATUS).setStatus(status).build();

	ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder()
			.addList(statusMsg).build();

	CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder()
			.setData(request.toByteString()).build();

	ChannelWriter.writeByDeviceId(command.getDeviceId(), new RedisCommand().add(CommandConst.PROTOCOL_VERSION)
			.add(CommandConst.IM_MSG_TOCLIENT).add(data.toByteArray()));

}
 
Example #5
Source File: AbstractGroupHandler.java    From openzaly with Apache License 2.0 6 votes vote down vote up
protected void msgStatusResponse(Command command, String msgId, long msgTime, int statusValue) {
	if (command == null || StringUtils.isEmpty(command.getDeviceId())) {
		return;
	}

	CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgStatus(statusValue)
			.setMsgServerTime(msgTime).build();

	ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder()
			.setType(MsgType.MSG_STATUS).setStatus(status).build();

	ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder()
			.addList(statusMsg).build();

	CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder()
			.setData(request.toByteString()).build();

	ChannelWriter.writeByDeviceId(command.getDeviceId(), new RedisCommand().add(CommandConst.PROTOCOL_VERSION)
			.add(CommandConst.IM_MSG_TOCLIENT).add(data.toByteArray()));
}
 
Example #6
Source File: GroupMessageTextSecretHandler.java    From openzaly with Apache License 2.0 6 votes vote down vote up
private void msgResponse(Channel channel, Command command, String from, String to, String msgId, long msgTime) {
	CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgServerTime(msgTime)
			.setMsgStatus(1).build();

	ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder()
			.setType(MsgType.MSG_STATUS).setStatus(status).build();

	ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder()
			.addList(0, statusMsg).build();

	CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder()
			.setData(request.toByteString()).build();

	channel.writeAndFlush(new RedisCommand().add(CommandConst.PROTOCOL_VERSION).add(CommandConst.IM_MSG_TOCLIENT)
			.add(data.toByteArray()));

}
 
Example #7
Source File: GroupMessageImageSecretHandler.java    From openzaly with Apache License 2.0 6 votes vote down vote up
private void msgResponse(Channel channel, Command command, String from, String to, String msgId, long msgTime) {
	CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgServerTime(msgTime)
			.setMsgStatus(1).build();

	ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder()
			.setType(MsgType.MSG_STATUS).setStatus(status).build();

	ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder()
			.addList(0, statusMsg).build();

	CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder()
			.setData(request.toByteString()).build();

	channel.writeAndFlush(new RedisCommand().add(CommandConst.PROTOCOL_VERSION).add(CommandConst.IM_MSG_TOCLIENT)
			.add(data.toByteArray()));

}
 
Example #8
Source File: AbstractSyncHandler.java    From openzaly with Apache License 2.0 6 votes vote down vote up
/**
 * <pre>
 * 	status=1:发送成功
 * 	status=0:默认发送失败状态
 * 	status=-1:非好友,不能发送
 * 	status=-2:非群成员,发送失败
 * </pre>
 */
protected void msgStatusResponse(Command command, String msgId, long msgTime, boolean success) {
	if (command == null || StringUtils.isEmpty(command.getDeviceId())) {
		return;
	}
	int statusValue = success ? 1 : 0;

	CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgServerTime(msgTime)
			.setMsgStatus(statusValue).build();

	ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder()
			.setType(MsgType.MSG_STATUS).setStatus(status).build();

	ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder()
			.addList(statusMsg).build();

	CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder()
			.setData(request.toByteString()).build();

	ChannelWriter.writeByDeviceId(command.getDeviceId(), new RedisCommand().add(CommandConst.PROTOCOL_VERSION)
			.add(CommandConst.IM_MSG_TOCLIENT).add(data.toByteArray()));

}
 
Example #9
Source File: AbstractSyncHandler.java    From openzaly with Apache License 2.0 6 votes vote down vote up
protected void msgStatusResponse(Command command, String msgId, long msgTime, int statusValue) {
	if (command == null || StringUtils.isEmpty(command.getDeviceId())) {
		return;
	}
	CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgStatus(statusValue)
			.setMsgServerTime(msgTime).build();

	ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder()
			.setType(MsgType.MSG_STATUS).setStatus(status).build();

	ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder()
			.addList(statusMsg).build();

	CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder()
			.setData(request.toByteString()).build();

	ChannelWriter.writeByDeviceId(command.getDeviceId(), new RedisCommand().add(CommandConst.PROTOCOL_VERSION)
			.add(CommandConst.IM_MSG_TOCLIENT).add(data.toByteArray()));
}
 
Example #10
Source File: MessageManageService.java    From openzaly with Apache License 2.0 6 votes vote down vote up
@Override
public boolean sendU2WebMessage(WebMessageBean bean) {
	CoreProto.U2Web u2Web = CoreProto.U2Web.newBuilder().setMsgId(bean.getMsgId())
			.setSiteUserId(bean.getSiteUserId()).setSiteFriendId(bean.getSiteFriendId())
			.setWebCode(bean.getWebCode()).setHeight(bean.getHeight()).setWidth(bean.getWidth())
			.setTime(System.currentTimeMillis()).setHrefUrl(bean.getHrefUrl()).build();
	ImCtsMessageProto.ImCtsMessageRequest request = ImCtsMessageProto.ImCtsMessageRequest.newBuilder()
			.setType(MsgType.U2_WEB).setU2Web(u2Web).build();

	Command command = new Command();
	command.setSiteUserId(bean.getSiteUserId());
	command.setSiteFriendId(bean.getSiteFriendId());
	command.setAction(RequestAction.IM_CTS_MESSAGE.getName());
	command.setParams(request.toByteArray());
	boolean result = imService.execute(command);

	logger.info("send u2 web message result={} bean={}", result, bean.toString());
	return result;
}
 
Example #11
Source File: MessageManageService.java    From openzaly with Apache License 2.0 6 votes vote down vote up
@Override
public boolean sendU2WebNoticeMessage(WebMessageBean bean) {
	CoreProto.U2WebNotice u2WebNotice = CoreProto.U2WebNotice.newBuilder().setMsgId(bean.getMsgId())
			.setSiteUserId(bean.getSiteUserId()).setSiteFriendId(bean.getSiteFriendId())
			.setWebCode(bean.getWebCode()).setHrefUrl(bean.getHrefUrl()).setTime(System.currentTimeMillis())
			.build();
	ImCtsMessageProto.ImCtsMessageRequest request = ImCtsMessageProto.ImCtsMessageRequest.newBuilder()
			.setType(MsgType.U2_WEB_NOTICE).setU2WebNotice(u2WebNotice).build();

	Command command = new Command();
	command.setAction(RequestAction.IM_CTS_MESSAGE.getName());
	command.setSiteUserId(bean.getSiteUserId());
	command.setSiteFriendId(bean.getSiteFriendId());
	command.setParams(request.toByteArray());
	boolean result = imService.execute(command);

	logger.info("send u2 web notice message result={} bean={}", result, bean.toString());
	return result;
}
 
Example #12
Source File: AbstractU2Handler.java    From wind-im with Apache License 2.0 6 votes vote down vote up
protected void msgStatusResponse(Command command, String msgId, long msgTime, int statusValue) {
	if (command == null || StringUtils.isAnyEmpty(command.getDeviceId(), msgId)) {
		return;
	}
	CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgStatus(statusValue)
			.setMsgServerTime(msgTime).build();

	ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder()
			.setType(MsgType.MSG_STATUS).setStatus(status).build();

	ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder()
			.addList(statusMsg).build();

	CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder()
			.setData(request.toByteString()).build();

	ChannelWriter.writeByDeviceId(command.getDeviceId(), new RedisCommand().add(CommandConst.PROTOCOL_VERSION)
			.add(CommandConst.IM_MSG_TOCLIENT).add(data.toByteArray()));
}
 
Example #13
Source File: MessageManageService.java    From openzaly with Apache License 2.0 6 votes vote down vote up
@Override
public boolean sendGroupWebNoticeMessage(WebMessageBean bean) {
	CoreProto.GroupWebNotice groupWebNotice = CoreProto.GroupWebNotice.newBuilder().setMsgId(bean.getMsgId())
			.setSiteUserId(bean.getSiteUserId()).setSiteGroupId(bean.getSiteGroupId()).setWebCode(bean.getWebCode())
			.setTime(System.currentTimeMillis()).setHrefUrl(bean.getHrefUrl()).build();
	ImCtsMessageProto.ImCtsMessageRequest request = ImCtsMessageProto.ImCtsMessageRequest.newBuilder()
			.setType(MsgType.GROUP_WEB_NOTICE).setGroupWebNotice(groupWebNotice).build();

	Command command = new Command();
	command.setSiteUserId(bean.getSiteUserId());
	command.setAction(RequestAction.IM_CTS_MESSAGE.getName());
	command.setParams(request.toByteArray());
	boolean result = imService.execute(command);

	logger.info("send group web message result={} bean={}", result, bean.toString());
	return result;
}
 
Example #14
Source File: AbstractU2Handler.java    From openzaly with Apache License 2.0 6 votes vote down vote up
/**
 * <pre>
 * 	status=1:发送成功
 * 	status=0:默认发送失败状态
 * 	status=-1:非好友,不能发送
 * 	status=-2:非群成员,发送失败
 * </pre>
 */
protected void msgStatusResponse(Command command, String msgId, long msgTime, boolean success) {
	if (command == null || StringUtils.isEmpty(command.getDeviceId())) {
		return;
	}
	int statusValue = success ? 1 : 0;

	CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgServerTime(msgTime)
			.setMsgStatus(statusValue).build();

	ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder()
			.setType(MsgType.MSG_STATUS).setStatus(status).build();

	ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder()
			.addList(statusMsg).build();

	CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder()
			.setData(request.toByteString()).build();

	ChannelWriter.writeByDeviceId(command.getDeviceId(), new RedisCommand().add(CommandConst.PROTOCOL_VERSION)
			.add(CommandConst.IM_MSG_TOCLIENT).add(data.toByteArray()));

}
 
Example #15
Source File: AbstractU2Handler.java    From openzaly with Apache License 2.0 6 votes vote down vote up
protected void msgStatusResponse(Command command, String msgId, long msgTime, int statusValue) {
	if (command == null || StringUtils.isAnyEmpty(command.getDeviceId(), msgId)) {
		return;
	}
	CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgStatus(statusValue)
			.setMsgServerTime(msgTime).build();

	ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder()
			.setType(MsgType.MSG_STATUS).setStatus(status).build();

	ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder()
			.addList(statusMsg).build();

	CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder()
			.setData(request.toByteString()).build();

	ChannelWriter.writeByDeviceId(command.getDeviceId(), new RedisCommand().add(CommandConst.PROTOCOL_VERSION)
			.add(CommandConst.IM_MSG_TOCLIENT).add(data.toByteArray()));
}
 
Example #16
Source File: AbstractU2Handler.java    From openzaly with Apache License 2.0 6 votes vote down vote up
/**
 * 通过channel回执消息状态
 */
@Deprecated
protected void msgStatusResponse(Channel channel, Command command, String from, String to, String msgId,
		long msgTime) {
	CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgServerTime(msgTime)
			.setMsgStatus(1).build();

	ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder()
			.setType(MsgType.MSG_STATUS).setStatus(status).build();

	ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder()
			.addList(statusMsg).build();

	CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder()
			.setData(request.toByteString()).build();

	channel.writeAndFlush(new RedisCommand().add(CommandConst.PROTOCOL_VERSION).add(CommandConst.IM_MSG_TOCLIENT)
			.add(data.toByteArray()));

}
 
Example #17
Source File: AbstractGroupHandler.java    From openzaly with Apache License 2.0 6 votes vote down vote up
protected void msgStatusResponse(Command command, String msgId, long msgTime, boolean success) {
	if (command == null || StringUtils.isEmpty(command.getDeviceId())) {
		return;
	}

	int statusValue = success ? 1 : 0;
	CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgServerTime(msgTime)
			.setMsgStatus(statusValue).build();

	ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder()
			.setType(MsgType.MSG_STATUS).setStatus(status).build();

	ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder()
			.addList(statusMsg).build();

	CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder()
			.setData(request.toByteString()).build();

	ChannelWriter.writeByDeviceId(command.getDeviceId(), new RedisCommand().add(CommandConst.PROTOCOL_VERSION)
			.add(CommandConst.IM_MSG_TOCLIENT).add(data.toByteArray()));

}
 
Example #18
Source File: AbstractGroupHandler.java    From openzaly with Apache License 2.0 6 votes vote down vote up
protected void msgStatusResponse(Command command, String msgId, long msgTime, int statusValue) {
	if (command == null || StringUtils.isEmpty(command.getDeviceId())) {
		return;
	}

	CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgStatus(statusValue)
			.setMsgServerTime(msgTime).build();

	ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder()
			.setType(MsgType.MSG_STATUS).setStatus(status).build();

	ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder()
			.addList(statusMsg).build();

	CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder()
			.setData(request.toByteString()).build();

	ChannelWriter.writeByDeviceId(command.getDeviceId(), new RedisCommand().add(CommandConst.PROTOCOL_VERSION)
			.add(CommandConst.IM_MSG_TOCLIENT).add(data.toByteArray()));
}
 
Example #19
Source File: GroupMessageTextSecretHandler.java    From openzaly with Apache License 2.0 6 votes vote down vote up
private void msgResponse(Channel channel, Command command, String from, String to, String msgId, long msgTime) {
	CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgServerTime(msgTime)
			.setMsgStatus(1).build();

	ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder()
			.setType(MsgType.MSG_STATUS).setStatus(status).build();

	ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder()
			.addList(0, statusMsg).build();

	CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder()
			.setData(request.toByteString()).build();

	channel.writeAndFlush(new RedisCommand().add(CommandConst.PROTOCOL_VERSION).add(CommandConst.IM_MSG_TOCLIENT)
			.add(data.toByteArray()));

}
 
Example #20
Source File: GroupMessageImageSecretHandler.java    From openzaly with Apache License 2.0 6 votes vote down vote up
private void msgResponse(Channel channel, Command command, String from, String to, String msgId, long msgTime) {
	CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgServerTime(msgTime)
			.setMsgStatus(1).build();

	ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder()
			.setType(MsgType.MSG_STATUS).setStatus(status).build();

	ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder()
			.addList(0, statusMsg).build();

	CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder()
			.setData(request.toByteString()).build();

	channel.writeAndFlush(new RedisCommand().add(CommandConst.PROTOCOL_VERSION).add(CommandConst.IM_MSG_TOCLIENT)
			.add(data.toByteArray()));

}
 
Example #21
Source File: AbstractSyncHandler.java    From openzaly with Apache License 2.0 6 votes vote down vote up
/**
 * <pre>
 * 	status=1:发送成功
 * 	status=0:默认发送失败状态
 * 	status=-1:非好友,不能发送
 * 	status=-2:非群成员,发送失败
 * </pre>
 */
protected void msgStatusResponse(Command command, String msgId, long msgTime, boolean success) {
	if (command == null || StringUtils.isEmpty(command.getDeviceId())) {
		return;
	}
	int statusValue = success ? 1 : 0;

	CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgServerTime(msgTime)
			.setMsgStatus(statusValue).build();

	ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder()
			.setType(MsgType.MSG_STATUS).setStatus(status).build();

	ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder()
			.addList(statusMsg).build();

	CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder()
			.setData(request.toByteString()).build();

	ChannelWriter.writeByDeviceId(command.getDeviceId(), new RedisCommand().add(CommandConst.PROTOCOL_VERSION)
			.add(CommandConst.IM_MSG_TOCLIENT).add(data.toByteArray()));

}
 
Example #22
Source File: AbstractSyncHandler.java    From openzaly with Apache License 2.0 6 votes vote down vote up
protected void msgStatusResponse(Command command, String msgId, long msgTime, int statusValue) {
	if (command == null || StringUtils.isEmpty(command.getDeviceId())) {
		return;
	}
	CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgStatus(statusValue)
			.setMsgServerTime(msgTime).build();

	ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder()
			.setType(MsgType.MSG_STATUS).setStatus(status).build();

	ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder()
			.addList(statusMsg).build();

	CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder()
			.setData(request.toByteString()).build();

	ChannelWriter.writeByDeviceId(command.getDeviceId(), new RedisCommand().add(CommandConst.PROTOCOL_VERSION)
			.add(CommandConst.IM_MSG_TOCLIENT).add(data.toByteArray()));
}
 
Example #23
Source File: MessageManageService.java    From openzaly with Apache License 2.0 6 votes vote down vote up
@Override
public boolean sendGroupWebNoticeMessage(WebMessageBean bean) {
	CoreProto.GroupWebNotice groupWebNotice = CoreProto.GroupWebNotice.newBuilder().setMsgId(bean.getMsgId())
			.setSiteUserId(bean.getSiteUserId()).setSiteGroupId(bean.getSiteGroupId()).setWebCode(bean.getWebCode())
			.setTime(System.currentTimeMillis()).setHrefUrl(bean.getHrefUrl()).build();
	ImCtsMessageProto.ImCtsMessageRequest request = ImCtsMessageProto.ImCtsMessageRequest.newBuilder()
			.setType(MsgType.GROUP_WEB_NOTICE).setGroupWebNotice(groupWebNotice).build();

	Command command = new Command();
	command.setSiteUserId(bean.getSiteUserId());
	command.setAction(RequestAction.IM_CTS_MESSAGE.getName());
	command.setParams(request.toByteArray());
	boolean result = imService.execute(command);

	logger.info("send group web message result={} bean={}", result, bean.toString());
	return result;
}
 
Example #24
Source File: AbstractU2Handler.java    From wind-im with Apache License 2.0 6 votes vote down vote up
/**
 * <pre>
 * 	status=1:发送成功
 * 	status=0:默认发送失败状态
 * 	status=-1:非好友,不能发送
 * 	status=-2:非群成员,发送失败
 * </pre>
 */
protected void msgStatusResponse(Command command, String msgId, long msgTime, boolean success) {
	if (command == null || StringUtils.isEmpty(command.getDeviceId())) {
		return;
	}
	int statusValue = success ? 1 : 0;

	CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgServerTime(msgTime)
			.setMsgStatus(statusValue).build();

	ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder()
			.setType(MsgType.MSG_STATUS).setStatus(status).build();

	ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder()
			.addList(statusMsg).build();

	CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder()
			.setData(request.toByteString()).build();

	ChannelWriter.writeByDeviceId(command.getDeviceId(), new RedisCommand().add(CommandConst.PROTOCOL_VERSION)
			.add(CommandConst.IM_MSG_TOCLIENT).add(data.toByteArray()));

}
 
Example #25
Source File: AbstractU2Handler.java    From wind-im with Apache License 2.0 6 votes vote down vote up
/**
 * 通过channel回执消息状态
 */
@Deprecated
protected void msgStatusResponse(Channel channel, Command command, String from, String to, String msgId,
		long msgTime) {
	CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgServerTime(msgTime)
			.setMsgStatus(1).build();

	ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder()
			.setType(MsgType.MSG_STATUS).setStatus(status).build();

	ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder()
			.addList(statusMsg).build();

	CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder()
			.setData(request.toByteString()).build();

	channel.writeAndFlush(new RedisCommand().add(CommandConst.PROTOCOL_VERSION).add(CommandConst.IM_MSG_TOCLIENT)
			.add(data.toByteArray()));

}
 
Example #26
Source File: AbstractGroupHandler.java    From wind-im with Apache License 2.0 6 votes vote down vote up
protected void msgStatusResponse(Command command, String msgId, long msgTime, boolean success) {
	if (command == null || StringUtils.isEmpty(command.getDeviceId())) {
		return;
	}

	int statusValue = success ? 1 : 0;
	CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgServerTime(msgTime)
			.setMsgStatus(statusValue).build();

	ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder()
			.setType(MsgType.MSG_STATUS).setStatus(status).build();

	ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder()
			.addList(statusMsg).build();

	CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder()
			.setData(request.toByteString()).build();

	ChannelWriter.writeByDeviceId(command.getDeviceId(), new RedisCommand().add(CommandConst.PROTOCOL_VERSION)
			.add(CommandConst.IM_MSG_TOCLIENT).add(data.toByteArray()));

}
 
Example #27
Source File: AbstractGroupHandler.java    From wind-im with Apache License 2.0 6 votes vote down vote up
protected void msgStatusResponse(Command command, String msgId, long msgTime, int statusValue) {
	if (command == null || StringUtils.isEmpty(command.getDeviceId())) {
		return;
	}

	CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgStatus(statusValue)
			.setMsgServerTime(msgTime).build();

	ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder()
			.setType(MsgType.MSG_STATUS).setStatus(status).build();

	ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder()
			.addList(statusMsg).build();

	CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder()
			.setData(request.toByteString()).build();

	ChannelWriter.writeByDeviceId(command.getDeviceId(), new RedisCommand().add(CommandConst.PROTOCOL_VERSION)
			.add(CommandConst.IM_MSG_TOCLIENT).add(data.toByteArray()));
}
 
Example #28
Source File: GroupMessageTextSecretHandler.java    From wind-im with Apache License 2.0 6 votes vote down vote up
private void msgResponse(Channel channel, Command command, String from, String to, String msgId, long msgTime) {
	CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgServerTime(msgTime)
			.setMsgStatus(1).build();

	ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder()
			.setType(MsgType.MSG_STATUS).setStatus(status).build();

	ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder()
			.addList(0, statusMsg).build();

	CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder()
			.setData(request.toByteString()).build();

	channel.writeAndFlush(new RedisCommand().add(CommandConst.PROTOCOL_VERSION).add(CommandConst.IM_MSG_TOCLIENT)
			.add(data.toByteArray()));

}
 
Example #29
Source File: GroupMessageImageSecretHandler.java    From wind-im with Apache License 2.0 6 votes vote down vote up
private void msgResponse(Channel channel, Command command, String from, String to, String msgId, long msgTime) {
	CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgServerTime(msgTime)
			.setMsgStatus(1).build();

	ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder()
			.setType(MsgType.MSG_STATUS).setStatus(status).build();

	ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder()
			.addList(0, statusMsg).build();

	CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder()
			.setData(request.toByteString()).build();

	channel.writeAndFlush(new RedisCommand().add(CommandConst.PROTOCOL_VERSION).add(CommandConst.IM_MSG_TOCLIENT)
			.add(data.toByteArray()));

}
 
Example #30
Source File: AbstractSyncHandler.java    From wind-im with Apache License 2.0 6 votes vote down vote up
/**
 * <pre>
 * 	status=1:发送成功
 * 	status=0:默认发送失败状态
 * 	status=-1:非好友,不能发送
 * 	status=-2:非群成员,发送失败
 * </pre>
 */
protected void msgStatusResponse(Command command, String msgId, long msgTime, boolean success) {
	if (command == null || StringUtils.isEmpty(command.getDeviceId())) {
		return;
	}
	int statusValue = success ? 1 : 0;

	CoreProto.MsgStatus status = CoreProto.MsgStatus.newBuilder().setMsgId(msgId).setMsgServerTime(msgTime)
			.setMsgStatus(statusValue).build();

	ImStcMessageProto.MsgWithPointer statusMsg = ImStcMessageProto.MsgWithPointer.newBuilder()
			.setType(MsgType.MSG_STATUS).setStatus(status).build();

	ImStcMessageProto.ImStcMessageRequest request = ImStcMessageProto.ImStcMessageRequest.newBuilder()
			.addList(statusMsg).build();

	CoreProto.TransportPackageData data = CoreProto.TransportPackageData.newBuilder()
			.setData(request.toByteString()).build();

	ChannelWriter.writeByDeviceId(command.getDeviceId(), new RedisCommand().add(CommandConst.PROTOCOL_VERSION)
			.add(CommandConst.IM_MSG_TOCLIENT).add(data.toByteArray()));

}