|
@@ -117,17 +117,17 @@ public class MsgProcessor {
|
117
|
117
|
}
|
118
|
118
|
if (channels != null) {
|
119
|
119
|
for (Channel channel : channels) {//向其他人发送消息
|
120
|
|
- if (channel != client) {
|
121
|
|
- if (username.equals(client.attr(AttributeKey.valueOf("username")).get())){
|
122
|
|
- client.attr(AttributeKey.valueOf("username"));
|
123
|
|
- }else{
|
124
|
|
- request.setSender(username);
|
125
|
|
- }
|
126
|
|
- }
|
127
|
|
- //向自己发送消息
|
128
|
|
- else {
|
129
|
|
- request.setSender("MY_SELF");
|
130
|
|
- }
|
|
120
|
+// if (channel != client) {
|
|
121
|
+// if (username.equals(client.attr(AttributeKey.valueOf("username")).get())){
|
|
122
|
+// client.attr(AttributeKey.valueOf("username"));
|
|
123
|
+// }else{
|
|
124
|
+// request.setSender(username);
|
|
125
|
+// }
|
|
126
|
+// }
|
|
127
|
+// //向自己发送消息
|
|
128
|
+// else {
|
|
129
|
+// request.setSender(username);
|
|
130
|
+// }
|
131
|
131
|
//自定义IM协议解码
|
132
|
132
|
String text = encoder.encode(request);
|
133
|
133
|
|
|
@@ -149,9 +149,6 @@ public class MsgProcessor {
|
149
|
149
|
historyList.forEach(x->{
|
150
|
150
|
//发送消息
|
151
|
151
|
IMMessage decode = decoder.decode(x);
|
152
|
|
- if (username.equals(decode.getSender())){
|
153
|
|
- decode.setSender("MY_SELF");
|
154
|
|
- }
|
155
|
152
|
String texthis = encoder.encode(decode);
|
156
|
153
|
channel.writeAndFlush(new TextWebSocketFrame(texthis));
|
157
|
154
|
});
|