-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
heavyrian2012
committed
Jul 20, 2023
1 parent
45b1b9c
commit 15f7777
Showing
5 changed files
with
39 additions
and
14 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
broker/src/main/java/io/moquette/imhandler/ChannelListenedListHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package io.moquette.imhandler; | ||
|
||
import cn.wildfirechat.common.ErrorCode; | ||
import cn.wildfirechat.proto.ProtoConstants; | ||
import cn.wildfirechat.proto.WFCMessage; | ||
import io.moquette.spi.impl.Qos1PublishHandler; | ||
import io.netty.buffer.ByteBuf; | ||
import win.liyufan.im.IMTopic; | ||
|
||
import java.util.List; | ||
|
||
@Handler(IMTopic.ListenedChannelListTopic) | ||
public class ChannelListenedListHandler extends IMHandler<Void> { | ||
@Override | ||
public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, Void request, Qos1PublishHandler.IMCallback callback) { | ||
List<String> channelInfoList = m_messagesStore.getListenedChannels(fromUser); | ||
WFCMessage.IDListBuf.Builder builder = WFCMessage.IDListBuf.newBuilder(); | ||
builder.addAllId(channelInfoList); | ||
byte[] data = builder.build().toByteArray(); | ||
ackPayload.ensureWritable(data.length).writeBytes(data); | ||
return ErrorCode.ERROR_CODE_SUCCESS; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters