|
|
@ -959,6 +959,7 @@ export default class PeerClient { |
|
|
|
/** @type Long[] */ |
|
|
|
const channelIds = [] |
|
|
|
const channelList = this.#getUser(req.mxid).talkClient.channelList |
|
|
|
// TODO channelList.all() doesn't really return *all* channels...
|
|
|
|
for (const channel of channelList.all()) { |
|
|
|
if (channel.info.type == "MemoChat") { |
|
|
|
channelIds.push(channel.channelId) |
|
|
@ -1128,6 +1129,20 @@ export default class PeerClient { |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param {Object} req |
|
|
|
* @param {string} req.mxid |
|
|
|
* @param {Long} req.user_id |
|
|
|
*/ |
|
|
|
createDirectChat = async (req) => { |
|
|
|
const channelList = this.#getUser(req.mxid).talkClient.channelList.normal |
|
|
|
const res = await channelList.createChannel({ |
|
|
|
userList: [{ userId: req.user_id }], |
|
|
|
}) |
|
|
|
if (!res.success) return res |
|
|
|
return makeCommandResult(res.result.channelId) |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param {Object} req |
|
|
|
* @param {string} req.mxid |
|
|
@ -1236,6 +1251,7 @@ export default class PeerClient { |
|
|
|
set_channel_name: this.setChannelName, |
|
|
|
set_channel_description: this.setChannelDescription, |
|
|
|
set_channel_photo: this.setChannelPhoto, |
|
|
|
create_direct_chat: this.createDirectChat, |
|
|
|
leave_channel: this.leaveChannel, |
|
|
|
}[req.command] || this.handleUnknownCommand |
|
|
|
} |
|
|
|