Files
IM-server-new/broker/src/main/java/io/moquette/imhandler/SetFriendAliasRequestHandler.java
T

31 lines
1.2 KiB
Java
Raw Normal View History

2019-05-02 21:43:01 +08:00
/*
* This file is part of the Wildfire Chat package.
* (c) Heavyrain2012 <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
package io.moquette.imhandler;
import cn.wildfirechat.proto.WFCMessage;
import io.moquette.spi.impl.Qos1PublishHandler;
import io.netty.buffer.ByteBuf;
2019-05-22 08:38:55 +08:00
import common.cn.wildfirechat.ErrorCode;
2019-05-02 21:43:01 +08:00
import win.liyufan.im.IMTopic;
2019-05-22 08:38:55 +08:00
import static common.cn.wildfirechat.ErrorCode.ERROR_CODE_SUCCESS;
2019-05-02 21:43:01 +08:00
@Handler(IMTopic.SetFriendAliasTopic)
public class SetFriendAliasRequestHandler extends GroupHandler<WFCMessage.AddFriendRequest> {
@Override
2019-05-02 21:45:27 +08:00
public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, boolean isAdmin, WFCMessage.AddFriendRequest request, Qos1PublishHandler.IMCallback callback) {
2019-05-02 21:43:01 +08:00
long[] head = new long[1];
2019-05-02 21:45:27 +08:00
ErrorCode errorCode = m_messagesStore.setFriendAliasRequest(fromUser, request.getTargetUid(), request.getReason(), head);
2019-05-02 21:43:01 +08:00
if (errorCode == ERROR_CODE_SUCCESS) {
publisher.publishNotification(IMTopic.NotifyFriendTopic, fromUser, head[0]);
}
return errorCode;
}
}