talk_loco_client/talk/stream/
command.rs

1use serde::Deserialize;
2
3use crate::talk::{channel::ChannelMeta, chat::Chatlog, session::channel::info::ChannelInfo};
4
5/// Send before server disconnect connection
6#[derive(Debug, Clone, Deserialize, PartialEq)]
7pub struct Kickout {
8    /// Kicked reasoon
9    ///
10    /// * Change server = 2
11    /// * Login another = 0
12    /// * Account deleted = 1
13    pub reason: i32,
14}
15
16/// Message sent from chatroom
17#[derive(Debug, Clone, Deserialize, PartialEq)]
18pub struct Msg {
19    /// Sent chatroom id
20    #[serde(rename = "chatId")]
21    pub chat_id: i64,
22
23    #[serde(rename = "chatLog")]
24    pub chatlog: Chatlog,
25
26    /// Sender nickname
27    #[serde(rename = "authorNickname")]
28    pub author_nickname: Option<String>,
29
30    /// false If sender sent message without reading.
31    ///
32    /// If it's false, sent message doesn't decrease read count of last chat.
33    #[serde(rename = "noSeen")]
34    pub no_seen: bool,
35
36    #[serde(rename = "li")]
37    pub link_id: Option<i64>,
38
39    /// Act like no_seen.(?)
40    /// Only appears on openchat
41    #[serde(rename = "notiRead")]
42    pub noti_read: Option<bool>,
43}
44
45/// Message read by someone
46#[derive(Debug, Clone, Deserialize, PartialEq)]
47pub struct DecunRead {
48    /// Chatroom id
49    #[serde(rename = "chatId")]
50    pub chat_id: i64,
51
52    /// Read user id
53    #[serde(rename = "userId")]
54    pub user_id: i64,
55
56    /// Read message log id
57    ///
58    /// Official client decrease every unread chat read count till this chat.
59    pub watermark: i64,
60}
61
62/// Sync Chatroom meta update
63#[derive(Debug, Clone, Deserialize, PartialEq)]
64pub struct ChgMeta {
65    /// Chatroom id
66    #[serde(rename = "chatId")]
67    pub chat_id: i64,
68
69    /// Chatroom meta item. Update same type meta.
70    pub meta: ChannelMeta,
71}
72
73/// Sync Chatroom join
74#[derive(Debug, Clone, Deserialize, PartialEq)]
75pub struct SyncJoin {
76    /// Chatroom id
77    #[serde(rename = "c")]
78    pub chat_id: i64,
79
80    /// Last chat
81    #[serde(rename = "chatLog")]
82    pub chatlog: Option<Chatlog>,
83}
84
85/// Sync chat delete
86#[derive(Debug, Clone, Deserialize, PartialEq)]
87pub struct SyncDlMsg {
88    /// Deleted chat
89    #[serde(rename = "chatLog")]
90    pub chatlog: Chatlog,
91}
92
93/// Sync openlink creation
94#[derive(Debug, Clone, Deserialize, PartialEq)]
95pub struct SyncLinkCr {
96    /// Openlink id
97    #[serde(rename = "ol")]
98    pub link_id: i64,
99
100    /// Only presents if the openlink is openchat.
101    #[serde(rename = "chatRoom")]
102    pub chat_room: Option<ChannelInfo>,
103}
104
105/// Sync openchat member type
106#[derive(Debug, Clone, Deserialize, PartialEq)]
107pub struct SyncMemT {
108    /// Chatroom id
109    #[serde(rename = "c")]
110    pub chat_id: i64,
111
112    /// Chatroom Openlink id
113    #[serde(rename = "li")]
114    pub link_id: i64,
115
116    /// User id list
117    #[serde(rename = "mids")]
118    pub member_ids: Vec<i64>,
119
120    /// User member type list.
121    /// Check `src/structs/openlink.rs` OpenMemberType for predefined types.
122    #[serde(rename = "mts")]
123    pub mem_types: Vec<i32>,
124}
125
126/// Sync openchat user profile
127#[derive(Debug, Clone, Deserialize, PartialEq)]
128pub struct SyncLinkPf {
129    /// Chatroom id
130    #[serde(rename = "c")]
131    pub chat_id: i64,
132
133    /// Chatroom Openlink id
134    #[serde(rename = "li")]
135    pub link_id: i64,
136}
137
138/// Sync openchat chat hide
139#[derive(Debug, Clone, Deserialize, PartialEq)]
140pub struct SyncRewr {
141    /// Chatlog
142    #[serde(rename = "chatLog")]
143    pub chat_log: Chatlog,
144}
145
146#[derive(Debug, Clone, Deserialize, PartialEq)]
147pub struct Left {
148    #[serde(rename = "chatId")]
149    pub chat_id: i64,
150
151    #[serde(rename = "lastTokenId")]
152    pub last_token_id: i64,
153}