Search in sources :

Example 16 with ChannelSession

use of com.akaxin.common.channel.ChannelSession in project openzaly by akaxincom.

the class GroupMessageTextSecretHandler method handle.

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;
}
Also used : ChannelSession(com.akaxin.common.channel.ChannelSession) ImCtsMessageProto(com.akaxin.proto.site.ImCtsMessageProto) GroupMessageBean(com.akaxin.site.storage.bean.GroupMessageBean)

Aggregations

ChannelSession (com.akaxin.common.channel.ChannelSession)16 ImCtsMessageProto (com.akaxin.proto.site.ImCtsMessageProto)8 GroupMessageBean (com.akaxin.site.storage.bean.GroupMessageBean)6 InetSocketAddress (java.net.InetSocketAddress)4 U2MessageBean (com.akaxin.site.storage.bean.U2MessageBean)3 ByteString (com.google.protobuf.ByteString)3 RedisCommand (com.akaxin.common.command.RedisCommand)2 ImSyncMessageProto (com.akaxin.proto.site.ImSyncMessageProto)2 Command (com.akaxin.common.command.Command)1 CommandResponse (com.akaxin.common.command.CommandResponse)1 CoreProto (com.akaxin.proto.core.CoreProto)1 ImSiteHelloProto (com.akaxin.proto.site.ImSiteHelloProto)1 ImMessageService (com.akaxin.site.message.service.ImMessageService)1 ByteBuffer (java.nio.ByteBuffer)1 HashMap (java.util.HashMap)1