handle THREAD_CREATE

also fix compilation
also change channel_create signal to emit ChannelData
This commit is contained in:
ouwou
2021-07-28 03:34:36 -04:00
parent 9d2d13a389
commit 014e176e0a
8 changed files with 99 additions and 29 deletions

View File

@@ -1,13 +1,20 @@
#include "../abaddon.hpp"
#include "channel.hpp"
void from_json(const nlohmann::json &j, ThreadMetadata &m) {
void from_json(const nlohmann::json &j, ThreadMetadataData &m) {
JS_D("archived", m.IsArchived);
JS_D("auto_archive_duration", m.AutoArchiveDuration);
JS_D("archive_timestamp", m.ArchiveTimestamp);
JS_O("locked", m.IsLocked);
}
void from_json(const nlohmann::json &j, ThreadMemberObject &m) {
JS_O("id", m.ThreadID);
JS_O("user_id", m.ThreadID);
JS_D("join_timestamp", m.JoinTimestamp);
JS_D("flags", m.Flags);
}
void from_json(const nlohmann::json &j, ChannelData &m) {
JS_D("id", m.ID);
JS_D("type", m.Type);
@@ -29,6 +36,7 @@ void from_json(const nlohmann::json &j, ChannelData &m) {
JS_ON("parent_id", m.ParentID);
JS_ON("last_pin_timestamp", m.LastPinTimestamp);
JS_O("thread_metadata", m.ThreadMetadata);
JS_O("member", m.ThreadMember);
}
void ChannelData::update_from_json(const nlohmann::json &j) {