com.akaxin.proto.site.ImCtsMessageProto Java Examples

The following examples show how to use com.akaxin.proto.site.ImCtsMessageProto. 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 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 #2
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 #3
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 #4
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 #5
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 #6
Source File: MessageManageService.java    From wind-im 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 #7
Source File: MessageManageService.java    From wind-im 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 #8
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 #9
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 #10
Source File: GroupMessageVoiceHandler.java    From wind-im with Apache License 2.0 5 votes vote down vote up
public Boolean handle(Command command) {
	try {
		int type = command.getMsgType();

		if (CoreProto.MsgType.GROUP_VOICE_VALUE == type) {
			ImCtsMessageProto.ImCtsMessageRequest request = ImCtsMessageProto.ImCtsMessageRequest
					.parseFrom(command.getParams());
			String siteUserId = command.getSiteUserId();
			String deviceId = command.getDeviceId();

			String proxySiteUserId = request.getGroupVoice().getSiteUserId();
			String gmsgId = request.getGroupVoice().getMsgId();
			String groupId = request.getGroupVoice().getSiteGroupId();
			String groupVoiceId = request.getGroupVoice().getVoiceId();

			long msgTime = System.currentTimeMillis();
			GroupMessageBean gmsgBean = new GroupMessageBean();
			gmsgBean.setMsgId(gmsgId);
			gmsgBean.setSendUserId(siteUserId);
			gmsgBean.setSendUserId(command.isProxy() ? proxySiteUserId : siteUserId);
			gmsgBean.setSiteGroupId(groupId);
			gmsgBean.setSendDeviceId(deviceId);
			gmsgBean.setContent(groupVoiceId);
			gmsgBean.setMsgType(type);
			gmsgBean.setMsgTime(msgTime);

			LogUtils.requestDebugLog(logger, command, gmsgBean.toString());

			boolean success = messageDao.saveGroupMessage(gmsgBean);
			msgStatusResponse(command, gmsgId, msgTime, success);
			return success;
		}
		return true;
	} catch (Exception e) {
		LogUtils.requestErrorLog(logger, command, this.getClass(), e);
	}

	return false;
}
 
Example #11
Source File: GroupMessageVoiceHandler.java    From openzaly with Apache License 2.0 5 votes vote down vote up
public Boolean handle(Command command) {
	try {
		int type = command.getMsgType();

		if (CoreProto.MsgType.GROUP_VOICE_VALUE == type) {
			ImCtsMessageProto.ImCtsMessageRequest request = ImCtsMessageProto.ImCtsMessageRequest
					.parseFrom(command.getParams());
			String siteUserId = command.getSiteUserId();
			String deviceId = command.getDeviceId();

			String proxySiteUserId = request.getGroupVoice().getSiteUserId();
			String gmsgId = request.getGroupVoice().getMsgId();
			String groupId = request.getGroupVoice().getSiteGroupId();
			String groupVoiceId = request.getGroupVoice().getVoiceId();

			long msgTime = System.currentTimeMillis();
			GroupMessageBean gmsgBean = new GroupMessageBean();
			gmsgBean.setMsgId(gmsgId);
			gmsgBean.setSendUserId(siteUserId);
			gmsgBean.setSendUserId(command.isProxy() ? proxySiteUserId : siteUserId);
			gmsgBean.setSiteGroupId(groupId);
			gmsgBean.setSendDeviceId(deviceId);
			gmsgBean.setContent(groupVoiceId);
			gmsgBean.setMsgType(type);
			gmsgBean.setMsgTime(msgTime);

			LogUtils.requestDebugLog(logger, command, gmsgBean.toString());

			boolean success = messageDao.saveGroupMessage(gmsgBean);
			msgStatusResponse(command, gmsgId, msgTime, success);
			return success;
		}
		return true;
	} catch (Exception e) {
		LogUtils.requestErrorLog(logger, command, this.getClass(), e);
	}

	return false;
}
 
Example #12
Source File: GroupMessageImageSecretHandler.java    From wind-im with Apache License 2.0 5 votes vote down vote up
public Boolean handle(Command command) {
	ChannelSession channelSession = command.getChannelSession();

	try {
		ImCtsMessageProto.ImCtsMessageRequest request = ImCtsMessageProto.ImCtsMessageRequest
				.parseFrom(command.getParams());

		int type = request.getType().getNumber();

		if (CoreProto.MsgType.GROUP_SECRET_TEXT_VALUE == type) {
			String siteUserId = command.getSiteUserId();
			String deviceId = command.getDeviceId();
			// String group_user_id = request.getGroupSecretText().getSiteUserId();
			String gmsg_id = request.getGroupSecretText().getMsgId();
			String group_id = request.getGroupSecretText().getSiteGroupId();
			String group_text = request.getGroupSecretText().getText().toStringUtf8();

			command.setSiteGroupId(group_id);
			// command.setField("group_id", group_id);

			System.out.println(
					"GroupMsg = id=" + gmsg_id + "," + siteUserId + "," + group_id + "," + group_text + ",");

			long msgTime = System.currentTimeMillis();
			GroupMessageBean gmsgBean = new GroupMessageBean();
			gmsgBean.setSendDeviceId(deviceId);
			gmsgBean.setMsgTime(msgTime);
			messageDao.saveGroupMessage(gmsgBean);

			msgResponse(channelSession.getChannel(), command, siteUserId, group_id, gmsg_id, msgTime);

			return true;
		}
		return true;
	} catch (Exception e) {
		e.printStackTrace();
	}

	return false;
}
 
Example #13
Source File: GroupMessageTextHandler.java    From wind-im with Apache License 2.0 5 votes vote down vote up
public Boolean handle(Command command) {
	try {
		int type = command.getMsgType();

		if (CoreProto.MsgType.GROUP_TEXT_VALUE == type) {
			ImCtsMessageProto.ImCtsMessageRequest request = ImCtsMessageProto.ImCtsMessageRequest
					.parseFrom(command.getParams());
			String siteUserId = command.getSiteUserId();
			String deviceId = command.getDeviceId();

			String proxySiteUserId = request.getGroupText().getSiteUserId();
			String gmsgId = request.getGroupText().getMsgId();
			String groupId = request.getGroupText().getSiteGroupId();
			String groupText = request.getGroupText().getText().toStringUtf8();

			long msgTime = System.currentTimeMillis();
			GroupMessageBean gmsgBean = new GroupMessageBean();
			gmsgBean.setMsgId(gmsgId);
			gmsgBean.setSendUserId(siteUserId);
			gmsgBean.setSendUserId(command.isProxy() ? proxySiteUserId : siteUserId);
			gmsgBean.setSendDeviceId(deviceId);
			gmsgBean.setSiteGroupId(groupId);
			gmsgBean.setContent(groupText);
			gmsgBean.setMsgType(type);
			gmsgBean.setMsgTime(msgTime);

			LogUtils.requestDebugLog(logger, command, gmsgBean.toString());

			boolean success = messageDao.saveGroupMessage(gmsgBean);
			msgStatusResponse(command, gmsgId, msgTime, success);
			return success;
		}
		return true;
	} catch (Exception e) {
		LogUtils.requestErrorLog(logger, command, this.getClass(), e);
	}

	return false;
}
 
Example #14
Source File: GroupMessageTextHandler.java    From openzaly with Apache License 2.0 5 votes vote down vote up
public Boolean handle(Command command) {
	try {
		int type = command.getMsgType();

		if (CoreProto.MsgType.GROUP_TEXT_VALUE == type) {
			ImCtsMessageProto.ImCtsMessageRequest request = ImCtsMessageProto.ImCtsMessageRequest
					.parseFrom(command.getParams());
			String siteUserId = command.getSiteUserId();
			String deviceId = command.getDeviceId();

			String proxySiteUserId = request.getGroupText().getSiteUserId();
			String gmsgId = request.getGroupText().getMsgId();
			String groupId = request.getGroupText().getSiteGroupId();
			String groupText = request.getGroupText().getText().toStringUtf8();

			long msgTime = System.currentTimeMillis();
			GroupMessageBean gmsgBean = new GroupMessageBean();
			gmsgBean.setMsgId(gmsgId);
			gmsgBean.setSendUserId(siteUserId);
			gmsgBean.setSendUserId(command.isProxy() ? proxySiteUserId : siteUserId);
			gmsgBean.setSendDeviceId(deviceId);
			gmsgBean.setSiteGroupId(groupId);
			gmsgBean.setContent(groupText);
			gmsgBean.setMsgType(type);
			gmsgBean.setMsgTime(msgTime);

			LogUtils.requestDebugLog(logger, command, gmsgBean.toString());

			boolean success = messageDao.saveGroupMessage(gmsgBean);
			msgStatusResponse(command, gmsgId, msgTime, success);
			return success;
		}
		return true;
	} catch (Exception e) {
		LogUtils.requestErrorLog(logger, command, this.getClass(), e);
	}

	return false;
}
 
Example #15
Source File: GroupMessageNoticeHandler.java    From wind-im with Apache License 2.0 5 votes vote down vote up
@Override
public Boolean handle(Command command) {
	try {
		int type = command.getMsgType();

		if (CoreProto.MsgType.GROUP_NOTICE_VALUE == type) {
			ImCtsMessageProto.ImCtsMessageRequest request = ImCtsMessageProto.ImCtsMessageRequest
					.parseFrom(command.getParams());
			String siteUserId = command.getSiteUserId();
			String deviceId = command.getDeviceId();

			String proxySiteUserId = request.getGroupMsgNotice().getSiteUserId();
			String groupId = request.getGroupMsgNotice().getSiteGroupId();
			String groupNoticeText = request.getGroupMsgNotice().getText().toStringUtf8();
			String msgId = request.getGroupMsgNotice().getMsgId();

			GroupMessageBean bean = new GroupMessageBean();
			bean.setMsgId(msgId);
			// bean.setSendUserId(siteUserId);
			bean.setSendUserId(command.isProxy() ? proxySiteUserId : siteUserId);
			bean.setSendDeviceId(deviceId);
			bean.setSiteGroupId(groupId);
			bean.setContent(groupNoticeText);
			bean.setMsgType(type);
			bean.setMsgTime(System.currentTimeMillis());

			LogUtils.requestDebugLog(logger, command, bean.toString());

			return messageDao.saveGroupMessage(bean);
		}
		return true;
	} catch (Exception e) {
		LogUtils.requestErrorLog(logger, command, this.getClass(), e);
	}
	return false;
}
 
Example #16
Source File: GroupMessageVoiceSecretHandler.java    From openzaly with Apache License 2.0 5 votes vote down vote up
@Override
public Boolean handle(Command command) {
	try {
		ImCtsMessageProto.ImCtsMessageRequest request = ImCtsMessageProto.ImCtsMessageRequest
				.parseFrom(command.getParams());

		int type = request.getType().getNumber();

		if (CoreProto.MsgType.GROUP_SECRET_VOICE_VALUE == type) {

			// String gmsgId = request.getGroupSecretVoice().getMsgId();
			// String siteUserId =
			// request.getGroupSecretVoice().getSiteUserId();
			// String groupId =
			// request.getGroupSecretVoice().getSiteGroupId();
			// String groupVoiceId =
			// request.getGroupSecretVoice().getVoicdId();
			//
			//
			// GroupMessageBean gmsgBean = new GroupMessageBean();
			// messageDao.saveGroupMessage(gmsgBean);
			//
			// msgResponse(channelSession.getChannel(), command,
			// group_user_id, group_id, gmsg_id);

			return true;
		}
		return true;
	} catch (Exception e) {
		e.printStackTrace();
	}

	return false;
}
 
Example #17
Source File: GroupMessageImageHandler.java    From openzaly with Apache License 2.0 5 votes vote down vote up
public Boolean handle(Command command) {
	try {
		int type = command.getMsgType();

		if (CoreProto.MsgType.GROUP_IMAGE_VALUE == type) {
			ImCtsMessageProto.ImCtsMessageRequest request = ImCtsMessageProto.ImCtsMessageRequest
					.parseFrom(command.getParams());
			String siteUserId = command.getSiteUserId();
			String deviceId = command.getDeviceId();
			String proxySiteUserId = request.getGroupImage().getSiteUserId();
			String gmsgId = request.getGroupImage().getMsgId();
			String groupId = request.getGroupImage().getSiteGroupId();
			String groupImageId = request.getGroupImage().getImageId();

			long msgTime = System.currentTimeMillis();
			GroupMessageBean gmsgBean = new GroupMessageBean();
			gmsgBean.setMsgId(gmsgId);
			gmsgBean.setSendUserId(command.isProxy() ? proxySiteUserId : siteUserId);
			// gmsgBean.setSendUserId(siteUserId);
			gmsgBean.setSendDeviceId(deviceId);
			gmsgBean.setSiteGroupId(groupId);
			gmsgBean.setContent(groupImageId);
			gmsgBean.setMsgType(type);
			gmsgBean.setMsgTime(msgTime);

			LogUtils.requestDebugLog(logger, command, gmsgBean.toString());

			boolean success = messageDao.saveGroupMessage(gmsgBean);
			msgStatusResponse(command, gmsgId, msgTime, success);
			return success;
		}
		return true;
	} catch (Exception e) {
		LogUtils.requestErrorLog(logger, command, this.getClass(), e);
	}

	return false;
}
 
Example #18
Source File: GroupMessageVoiceSecretHandler.java    From wind-im with Apache License 2.0 5 votes vote down vote up
@Override
public Boolean handle(Command command) {
	try {
		ImCtsMessageProto.ImCtsMessageRequest request = ImCtsMessageProto.ImCtsMessageRequest
				.parseFrom(command.getParams());

		int type = request.getType().getNumber();

		if (CoreProto.MsgType.GROUP_SECRET_VOICE_VALUE == type) {

			// String gmsgId = request.getGroupSecretVoice().getMsgId();
			// String siteUserId =
			// request.getGroupSecretVoice().getSiteUserId();
			// String groupId =
			// request.getGroupSecretVoice().getSiteGroupId();
			// String groupVoiceId =
			// request.getGroupSecretVoice().getVoicdId();
			//
			//
			// GroupMessageBean gmsgBean = new GroupMessageBean();
			// messageDao.saveGroupMessage(gmsgBean);
			//
			// msgResponse(channelSession.getChannel(), command,
			// group_user_id, group_id, gmsg_id);

			return true;
		}
		return true;
	} catch (Exception e) {
		e.printStackTrace();
	}

	return false;
}
 
Example #19
Source File: WebChatReceiveMessageHandler.java    From wind-im with Apache License 2.0 5 votes vote down vote up
public Boolean handle(Command command) {
	try {
		int type = command.getMsgType();

		if (CoreProto.MsgType.GROUP_TEXT_VALUE == type) {
			ImCtsMessageProto.ImCtsMessageRequest request = ImCtsMessageProto.ImCtsMessageRequest
					.parseFrom(command.getParams());
			String siteUserId = command.getSiteUserId();
			String deviceId = command.getDeviceId();
			String gmsgId = request.getGroupText().getMsgId();
			String groupId = request.getGroupText().getSiteGroupId();
			String groupText = request.getGroupText().getText().toStringUtf8();

			long msgTime = System.currentTimeMillis();
			GroupMessageBean gmsgBean = new GroupMessageBean();
			gmsgBean.setMsgId(gmsgId);
			gmsgBean.setSendUserId(siteUserId);
			gmsgBean.setSendDeviceId(deviceId);
			gmsgBean.setSiteGroupId(groupId);
			gmsgBean.setContent(groupText);
			gmsgBean.setMsgType(type);
			gmsgBean.setMsgTime(msgTime);

			LogUtils.requestDebugLog(logger, command, gmsgBean.toString());

			boolean success = messageDao.saveGroupMessage(gmsgBean);
			// msgStatusResponse(command, gmsgId, msgTime, success);
			return success;
		}
		return true;
	} catch (Exception e) {
		LogUtils.requestErrorLog(logger, command, this.getClass(), e);
	}

	return false;
}
 
Example #20
Source File: WebChatReceiveMessageHandler.java    From openzaly with Apache License 2.0 5 votes vote down vote up
public Boolean handle(Command command) {
	try {
		int type = command.getMsgType();

		if (CoreProto.MsgType.GROUP_TEXT_VALUE == type) {
			ImCtsMessageProto.ImCtsMessageRequest request = ImCtsMessageProto.ImCtsMessageRequest
					.parseFrom(command.getParams());
			String siteUserId = command.getSiteUserId();
			String deviceId = command.getDeviceId();
			String gmsgId = request.getGroupText().getMsgId();
			String groupId = request.getGroupText().getSiteGroupId();
			String groupText = request.getGroupText().getText().toStringUtf8();

			long msgTime = System.currentTimeMillis();
			GroupMessageBean gmsgBean = new GroupMessageBean();
			gmsgBean.setMsgId(gmsgId);
			gmsgBean.setSendUserId(siteUserId);
			gmsgBean.setSendDeviceId(deviceId);
			gmsgBean.setSiteGroupId(groupId);
			gmsgBean.setContent(groupText);
			gmsgBean.setMsgType(type);
			gmsgBean.setMsgTime(msgTime);

			LogUtils.requestDebugLog(logger, command, gmsgBean.toString());

			boolean success = messageDao.saveGroupMessage(gmsgBean);
			// msgStatusResponse(command, gmsgId, msgTime, success);
			return success;
		}
		return true;
	} catch (Exception e) {
		LogUtils.requestErrorLog(logger, command, this.getClass(), e);
	}

	return false;
}
 
Example #21
Source File: WebChatReceiveMessageHandler.java    From openzaly with Apache License 2.0 5 votes vote down vote up
public Boolean handle(Command command) {
	try {
		int type = command.getMsgType();

		if (CoreProto.MsgType.GROUP_TEXT_VALUE == type) {
			ImCtsMessageProto.ImCtsMessageRequest request = ImCtsMessageProto.ImCtsMessageRequest
					.parseFrom(command.getParams());
			String siteUserId = command.getSiteUserId();
			String deviceId = command.getDeviceId();
			String gmsgId = request.getGroupText().getMsgId();
			String groupId = request.getGroupText().getSiteGroupId();
			String groupText = request.getGroupText().getText().toStringUtf8();

			long msgTime = System.currentTimeMillis();
			GroupMessageBean gmsgBean = new GroupMessageBean();
			gmsgBean.setMsgId(gmsgId);
			gmsgBean.setSendUserId(siteUserId);
			gmsgBean.setSendDeviceId(deviceId);
			gmsgBean.setSiteGroupId(groupId);
			gmsgBean.setContent(groupText);
			gmsgBean.setMsgType(type);
			gmsgBean.setMsgTime(msgTime);

			LogUtils.requestDebugLog(logger, command, gmsgBean.toString());

			boolean success = messageDao.saveGroupMessage(gmsgBean);
			// msgStatusResponse(command, gmsgId, msgTime, success);
			return success;
		}
		return true;
	} catch (Exception e) {
		LogUtils.requestErrorLog(logger, command, this.getClass(), e);
	}

	return false;
}
 
Example #22
Source File: GroupMessageImageSecretHandler.java    From openzaly with Apache License 2.0 5 votes vote down vote up
public Boolean handle(Command command) {
	ChannelSession channelSession = command.getChannelSession();

	try {
		ImCtsMessageProto.ImCtsMessageRequest request = ImCtsMessageProto.ImCtsMessageRequest
				.parseFrom(command.getParams());

		int type = request.getType().getNumber();

		if (CoreProto.MsgType.GROUP_SECRET_TEXT_VALUE == type) {
			String siteUserId = command.getSiteUserId();
			String deviceId = command.getDeviceId();
			// String group_user_id = request.getGroupSecretText().getSiteUserId();
			String gmsg_id = request.getGroupSecretText().getMsgId();
			String group_id = request.getGroupSecretText().getSiteGroupId();
			String group_text = request.getGroupSecretText().getText().toStringUtf8();

			command.setSiteGroupId(group_id);
			// command.setField("group_id", group_id);

			System.out.println(
					"GroupMsg = id=" + gmsg_id + "," + siteUserId + "," + group_id + "," + group_text + ",");

			long msgTime = System.currentTimeMillis();
			GroupMessageBean gmsgBean = new GroupMessageBean();
			gmsgBean.setSendDeviceId(deviceId);
			gmsgBean.setMsgTime(msgTime);
			messageDao.saveGroupMessage(gmsgBean);

			msgResponse(channelSession.getChannel(), command, siteUserId, group_id, gmsg_id, msgTime);

			return true;
		}
		return true;
	} catch (Exception e) {
		e.printStackTrace();
	}

	return false;
}
 
Example #23
Source File: GroupMessageImageSecretHandler.java    From openzaly with Apache License 2.0 5 votes vote down vote up
public Boolean handle(Command command) {
	ChannelSession channelSession = command.getChannelSession();

	try {
		ImCtsMessageProto.ImCtsMessageRequest request = ImCtsMessageProto.ImCtsMessageRequest
				.parseFrom(command.getParams());

		int type = request.getType().getNumber();

		if (CoreProto.MsgType.GROUP_SECRET_TEXT_VALUE == type) {
			String siteUserId = command.getSiteUserId();
			String deviceId = command.getDeviceId();
			// String group_user_id = request.getGroupSecretText().getSiteUserId();
			String gmsg_id = request.getGroupSecretText().getMsgId();
			String group_id = request.getGroupSecretText().getSiteGroupId();
			String group_text = request.getGroupSecretText().getText().toStringUtf8();

			command.setSiteGroupId(group_id);
			// command.setField("group_id", group_id);

			System.out.println(
					"GroupMsg = id=" + gmsg_id + "," + siteUserId + "," + group_id + "," + group_text + ",");

			long msgTime = System.currentTimeMillis();
			GroupMessageBean gmsgBean = new GroupMessageBean();
			gmsgBean.setSendDeviceId(deviceId);
			gmsgBean.setMsgTime(msgTime);
			messageDao.saveGroupMessage(gmsgBean);

			msgResponse(channelSession.getChannel(), command, siteUserId, group_id, gmsg_id, msgTime);

			return true;
		}
		return true;
	} catch (Exception e) {
		e.printStackTrace();
	}

	return false;
}
 
Example #24
Source File: GroupMessageVoiceHandler.java    From openzaly with Apache License 2.0 5 votes vote down vote up
public Boolean handle(Command command) {
	try {
		int type = command.getMsgType();

		if (CoreProto.MsgType.GROUP_VOICE_VALUE == type) {
			ImCtsMessageProto.ImCtsMessageRequest request = ImCtsMessageProto.ImCtsMessageRequest
					.parseFrom(command.getParams());
			String siteUserId = command.getSiteUserId();
			String deviceId = command.getDeviceId();

			String proxySiteUserId = request.getGroupVoice().getSiteUserId();
			String gmsgId = request.getGroupVoice().getMsgId();
			String groupId = request.getGroupVoice().getSiteGroupId();
			String groupVoiceId = request.getGroupVoice().getVoiceId();

			long msgTime = System.currentTimeMillis();
			GroupMessageBean gmsgBean = new GroupMessageBean();
			gmsgBean.setMsgId(gmsgId);
			gmsgBean.setSendUserId(siteUserId);
			gmsgBean.setSendUserId(command.isProxy() ? proxySiteUserId : siteUserId);
			gmsgBean.setSiteGroupId(groupId);
			gmsgBean.setSendDeviceId(deviceId);
			gmsgBean.setContent(groupVoiceId);
			gmsgBean.setMsgType(type);
			gmsgBean.setMsgTime(msgTime);

			LogUtils.requestDebugLog(logger, command, gmsgBean.toString());

			boolean success = messageDao.saveGroupMessage(gmsgBean);
			msgStatusResponse(command, gmsgId, msgTime, success);
			return success;
		}
		return true;
	} catch (Exception e) {
		LogUtils.requestErrorLog(logger, command, this.getClass(), e);
	}

	return false;
}
 
Example #25
Source File: GroupMessageTextSecretHandler.java    From openzaly with Apache License 2.0 5 votes vote down vote up
public Boolean handle(Command command) {
	ChannelSession channelSession = command.getChannelSession();

	try {
		ImCtsMessageProto.ImCtsMessageRequest request = ImCtsMessageProto.ImCtsMessageRequest
				.parseFrom(command.getParams());

		int type = request.getType().getNumber();

		if (CoreProto.MsgType.GROUP_SECRET_TEXT_VALUE == type) {

			String gmsg_id = request.getGroupSecretText().getMsgId();
			String group_user_id = request.getGroupSecretText().getSiteUserId();
			String group_id = request.getGroupSecretText().getSiteGroupId();
			String group_text = request.getGroupSecretText().getText().toStringUtf8();

			command.setSiteGroupId(group_id);
			// command.setField("group_id", group_id);

			System.out.println(
					"GroupMsg = id=" + gmsg_id + "," + group_user_id + "," + group_id + "," + group_text + ",");

			long msgTime = System.currentTimeMillis();
			GroupMessageBean gmsgBean = new GroupMessageBean();
			gmsgBean.setMsgTime(msgTime);
			messageDao.saveGroupMessage(gmsgBean);

			msgResponse(channelSession.getChannel(), command, group_user_id, group_id, gmsg_id, msgTime);

			return true;
		}
		return true;
	} catch (Exception e) {
		e.printStackTrace();
	}

	return false;
}
 
Example #26
Source File: GroupMessageImageHandler.java    From openzaly with Apache License 2.0 5 votes vote down vote up
public Boolean handle(Command command) {
	try {
		int type = command.getMsgType();

		if (CoreProto.MsgType.GROUP_IMAGE_VALUE == type) {
			ImCtsMessageProto.ImCtsMessageRequest request = ImCtsMessageProto.ImCtsMessageRequest
					.parseFrom(command.getParams());
			String siteUserId = command.getSiteUserId();
			String deviceId = command.getDeviceId();
			String proxySiteUserId = request.getGroupImage().getSiteUserId();
			String gmsgId = request.getGroupImage().getMsgId();
			String groupId = request.getGroupImage().getSiteGroupId();
			String groupImageId = request.getGroupImage().getImageId();

			long msgTime = System.currentTimeMillis();
			GroupMessageBean gmsgBean = new GroupMessageBean();
			gmsgBean.setMsgId(gmsgId);
			gmsgBean.setSendUserId(command.isProxy() ? proxySiteUserId : siteUserId);
			// gmsgBean.setSendUserId(siteUserId);
			gmsgBean.setSendDeviceId(deviceId);
			gmsgBean.setSiteGroupId(groupId);
			gmsgBean.setContent(groupImageId);
			gmsgBean.setMsgType(type);
			gmsgBean.setMsgTime(msgTime);

			LogUtils.requestDebugLog(logger, command, gmsgBean.toString());

			boolean success = messageDao.saveGroupMessage(gmsgBean);
			msgStatusResponse(command, gmsgId, msgTime, success);
			return success;
		}
		return true;
	} catch (Exception e) {
		LogUtils.requestErrorLog(logger, command, this.getClass(), e);
	}

	return false;
}
 
Example #27
Source File: GroupMessageVoiceSecretHandler.java    From openzaly with Apache License 2.0 5 votes vote down vote up
@Override
public Boolean handle(Command command) {
	try {
		ImCtsMessageProto.ImCtsMessageRequest request = ImCtsMessageProto.ImCtsMessageRequest
				.parseFrom(command.getParams());

		int type = request.getType().getNumber();

		if (CoreProto.MsgType.GROUP_SECRET_VOICE_VALUE == type) {

			// String gmsgId = request.getGroupSecretVoice().getMsgId();
			// String siteUserId =
			// request.getGroupSecretVoice().getSiteUserId();
			// String groupId =
			// request.getGroupSecretVoice().getSiteGroupId();
			// String groupVoiceId =
			// request.getGroupSecretVoice().getVoicdId();
			//
			//
			// GroupMessageBean gmsgBean = new GroupMessageBean();
			// messageDao.saveGroupMessage(gmsgBean);
			//
			// msgResponse(channelSession.getChannel(), command,
			// group_user_id, group_id, gmsg_id);

			return true;
		}
		return true;
	} catch (Exception e) {
		e.printStackTrace();
	}

	return false;
}
 
Example #28
Source File: GroupMessageTextHandler.java    From openzaly with Apache License 2.0 5 votes vote down vote up
public Boolean handle(Command command) {
	try {
		int type = command.getMsgType();

		if (CoreProto.MsgType.GROUP_TEXT_VALUE == type) {
			ImCtsMessageProto.ImCtsMessageRequest request = ImCtsMessageProto.ImCtsMessageRequest
					.parseFrom(command.getParams());
			String siteUserId = command.getSiteUserId();
			String deviceId = command.getDeviceId();

			String proxySiteUserId = request.getGroupText().getSiteUserId();
			String gmsgId = request.getGroupText().getMsgId();
			String groupId = request.getGroupText().getSiteGroupId();
			String groupText = request.getGroupText().getText().toStringUtf8();

			long msgTime = System.currentTimeMillis();
			GroupMessageBean gmsgBean = new GroupMessageBean();
			gmsgBean.setMsgId(gmsgId);
			gmsgBean.setSendUserId(siteUserId);
			gmsgBean.setSendUserId(command.isProxy() ? proxySiteUserId : siteUserId);
			gmsgBean.setSendDeviceId(deviceId);
			gmsgBean.setSiteGroupId(groupId);
			gmsgBean.setContent(groupText);
			gmsgBean.setMsgType(type);
			gmsgBean.setMsgTime(msgTime);

			LogUtils.requestDebugLog(logger, command, gmsgBean.toString());

			boolean success = messageDao.saveGroupMessage(gmsgBean);
			msgStatusResponse(command, gmsgId, msgTime, success);
			return success;
		}
		return true;
	} catch (Exception e) {
		LogUtils.requestErrorLog(logger, command, this.getClass(), e);
	}

	return false;
}
 
Example #29
Source File: GroupMessageTextSecretHandler.java    From openzaly with Apache License 2.0 5 votes vote down vote up
public Boolean handle(Command command) {
	ChannelSession channelSession = command.getChannelSession();

	try {
		ImCtsMessageProto.ImCtsMessageRequest request = ImCtsMessageProto.ImCtsMessageRequest
				.parseFrom(command.getParams());

		int type = request.getType().getNumber();

		if (CoreProto.MsgType.GROUP_SECRET_TEXT_VALUE == type) {

			String gmsg_id = request.getGroupSecretText().getMsgId();
			String group_user_id = request.getGroupSecretText().getSiteUserId();
			String group_id = request.getGroupSecretText().getSiteGroupId();
			String group_text = request.getGroupSecretText().getText().toStringUtf8();

			command.setSiteGroupId(group_id);
			// command.setField("group_id", group_id);

			System.out.println(
					"GroupMsg = id=" + gmsg_id + "," + group_user_id + "," + group_id + "," + group_text + ",");

			long msgTime = System.currentTimeMillis();
			GroupMessageBean gmsgBean = new GroupMessageBean();
			gmsgBean.setMsgTime(msgTime);
			messageDao.saveGroupMessage(gmsgBean);

			msgResponse(channelSession.getChannel(), command, group_user_id, group_id, gmsg_id, msgTime);

			return true;
		}
		return true;
	} catch (Exception e) {
		e.printStackTrace();
	}

	return false;
}
 
Example #30
Source File: GroupMessageNoticeHandler.java    From openzaly with Apache License 2.0 5 votes vote down vote up
@Override
public Boolean handle(Command command) {
	try {
		int type = command.getMsgType();

		if (CoreProto.MsgType.GROUP_NOTICE_VALUE == type) {
			ImCtsMessageProto.ImCtsMessageRequest request = ImCtsMessageProto.ImCtsMessageRequest
					.parseFrom(command.getParams());
			String siteUserId = command.getSiteUserId();
			String deviceId = command.getDeviceId();

			String proxySiteUserId = request.getGroupMsgNotice().getSiteUserId();
			String groupId = request.getGroupMsgNotice().getSiteGroupId();
			String groupNoticeText = request.getGroupMsgNotice().getText().toStringUtf8();
			String msgId = request.getGroupMsgNotice().getMsgId();

			GroupMessageBean bean = new GroupMessageBean();
			bean.setMsgId(msgId);
			// bean.setSendUserId(siteUserId);
			bean.setSendUserId(command.isProxy() ? proxySiteUserId : siteUserId);
			bean.setSendDeviceId(deviceId);
			bean.setSiteGroupId(groupId);
			bean.setContent(groupNoticeText);
			bean.setMsgType(type);
			bean.setMsgTime(System.currentTimeMillis());

			LogUtils.requestDebugLog(logger, command, bean.toString());

			return messageDao.saveGroupMessage(bean);
		}
		return true;
	} catch (Exception e) {
		LogUtils.requestErrorLog(logger, command, this.getClass(), e);
	}
	return false;
}