Introducing new features.emoji support success
正在显示
4 个修改的文件
包含
9 行增加
和
5 行删除
| @@ -198,9 +198,9 @@ public class CIMClient { | @@ -198,9 +198,9 @@ public class CIMClient { | ||
| 198 | //首先清除路由信息,下线 | 198 | //首先清除路由信息,下线 |
| 199 | routeRequest.offLine(); | 199 | routeRequest.offLine(); |
| 200 | 200 | ||
| 201 | - LOGGER.info("开始重连。。"); | 201 | + LOGGER.info("reconnect...."); |
| 202 | start(); | 202 | start(); |
| 203 | - LOGGER.info("重连成功!!"); | 203 | + LOGGER.info("reconnect success"); |
| 204 | } | 204 | } |
| 205 | 205 | ||
| 206 | /** | 206 | /** |
| @@ -7,6 +7,7 @@ import com.crossoverjie.cim.common.constant.Constants; | @@ -7,6 +7,7 @@ import com.crossoverjie.cim.common.constant.Constants; | ||
| 7 | import com.crossoverjie.cim.common.protocol.CIMRequestProto; | 7 | import com.crossoverjie.cim.common.protocol.CIMRequestProto; |
| 8 | import com.crossoverjie.cim.common.protocol.CIMResponseProto; | 8 | import com.crossoverjie.cim.common.protocol.CIMResponseProto; |
| 9 | import com.crossoverjie.cim.common.util.NettyAttrUtil; | 9 | import com.crossoverjie.cim.common.util.NettyAttrUtil; |
| 10 | +import com.vdurmont.emoji.EmojiParser; | ||
| 10 | import io.netty.channel.ChannelFutureListener; | 11 | import io.netty.channel.ChannelFutureListener; |
| 11 | import io.netty.channel.ChannelHandler; | 12 | import io.netty.channel.ChannelHandler; |
| 12 | import io.netty.channel.ChannelHandlerContext; | 13 | import io.netty.channel.ChannelHandlerContext; |
| @@ -105,7 +106,9 @@ public class CIMClientHandle extends SimpleChannelInboundHandler<CIMResponseProt | @@ -105,7 +106,9 @@ public class CIMClientHandle extends SimpleChannelInboundHandler<CIMResponseProt | ||
| 105 | //回调消息 | 106 | //回调消息 |
| 106 | callBackMsg(msg.getResMsg()); | 107 | callBackMsg(msg.getResMsg()); |
| 107 | 108 | ||
| 108 | - LOGGER.info(msg.getResMsg()); | 109 | + //将消息中的 emoji 表情格式化为 Unicode 编码以便在终端可以显示 |
| 110 | + String response = EmojiParser.parseToUnicode(msg.getResMsg()); | ||
| 111 | + System.out.println(response); | ||
| 109 | } | 112 | } |
| 110 | 113 | ||
| 111 | 114 |
| @@ -4,6 +4,7 @@ import com.crossoverjie.cim.client.config.AppConfiguration; | @@ -4,6 +4,7 @@ import com.crossoverjie.cim.client.config.AppConfiguration; | ||
| 4 | import com.crossoverjie.cim.client.service.MsgHandle; | 4 | import com.crossoverjie.cim.client.service.MsgHandle; |
| 5 | import com.crossoverjie.cim.client.service.MsgLogger; | 5 | import com.crossoverjie.cim.client.service.MsgLogger; |
| 6 | import com.crossoverjie.cim.client.util.SpringBeanFactory; | 6 | import com.crossoverjie.cim.client.util.SpringBeanFactory; |
| 7 | +import com.vdurmont.emoji.EmojiParser; | ||
| 7 | import org.slf4j.Logger; | 8 | import org.slf4j.Logger; |
| 8 | import org.slf4j.LoggerFactory; | 9 | import org.slf4j.LoggerFactory; |
| 9 | 10 | ||
| @@ -57,7 +58,7 @@ public class Scan implements Runnable { | @@ -57,7 +58,7 @@ public class Scan implements Runnable { | ||
| 57 | //写入聊天记录 | 58 | //写入聊天记录 |
| 58 | msgLogger.log(msg) ; | 59 | msgLogger.log(msg) ; |
| 59 | 60 | ||
| 60 | - LOGGER.info("{}:【{}】", configuration.getUserName(), msg); | 61 | + System.out.println(configuration.getUserName() + ":" + EmojiParser.parseToUnicode(msg)); |
| 61 | } | 62 | } |
| 62 | } | 63 | } |
| 63 | 64 |
cim-forward-route/src/main/java/com/crossoverjie/cim/route/service/impl/AccountServiceRedisImpl.java
| @@ -153,7 +153,7 @@ public class AccountServiceRedisImpl implements AccountService { | @@ -153,7 +153,7 @@ public class AccountServiceRedisImpl implements AccountService { | ||
| 153 | CIMUserInfo cimUserInfo = userInfoCacheService.loadUserInfoByUserId(sendUserId); | 153 | CIMUserInfo cimUserInfo = userInfoCacheService.loadUserInfoByUserId(sendUserId); |
| 154 | 154 | ||
| 155 | JSONObject jsonObject = new JSONObject(); | 155 | JSONObject jsonObject = new JSONObject(); |
| 156 | - jsonObject.put("msg", cimUserInfo.getUserName() + ":【" + groupReqVO.getMsg() + "】"); | 156 | + jsonObject.put("msg", cimUserInfo.getUserName() + ":" + groupReqVO.getMsg()); |
| 157 | jsonObject.put("userId", groupReqVO.getUserId()); | 157 | jsonObject.put("userId", groupReqVO.getUserId()); |
| 158 | RequestBody requestBody = RequestBody.create(mediaType, jsonObject.toString()); | 158 | RequestBody requestBody = RequestBody.create(mediaType, jsonObject.toString()); |
| 159 | 159 |
-
请 注册 或 登录 后发表评论