@@ -84,45 +84,78 @@ pub enum EventType {
84
84
/// - Messages sent, received or removed
85
85
/// - Chats created, deleted or archived
86
86
/// - A draft has been set
87
- ///
88
- /// `chatId` is set if only a single chat is affected by the changes, otherwise 0.
89
- /// `msgId` is set if only a single message is affected by the changes, otherwise 0.
90
87
#[ serde( rename_all = "camelCase" ) ]
91
- MsgsChanged { chat_id : u32 , msg_id : u32 } ,
88
+ MsgsChanged {
89
+ /// Set if only a single chat is affected by the changes, otherwise 0.
90
+ chat_id : u32 ,
91
+
92
+ /// Set if only a single message is affected by the changes, otherwise 0.
93
+ msg_id : u32 ,
94
+ } ,
92
95
93
96
/// Reactions for the message changed.
94
97
#[ serde( rename_all = "camelCase" ) ]
95
98
ReactionsChanged {
99
+ /// ID of the chat which the message belongs to.
96
100
chat_id : u32 ,
101
+
102
+ /// ID of the message for which reactions were changed.
97
103
msg_id : u32 ,
104
+
105
+ /// ID of the contact whose reaction set is changed.
98
106
contact_id : u32 ,
99
107
} ,
100
108
101
- /// Incoming reaction, should be notified.
109
+ /// A reaction to one's own sent message received.
110
+ /// Typically, the UI will show a notification for that.
111
+ ///
112
+ /// In addition to this event, ReactionsChanged is emitted.
102
113
#[ serde( rename_all = "camelCase" ) ]
103
114
IncomingReaction {
115
+ /// ID of the chat which the message belongs to.
104
116
chat_id : u32 ,
117
+
118
+ /// ID of the contact whose reaction set is changed.
105
119
contact_id : u32 ,
120
+
121
+ /// ID of the message for which reactions were changed.
106
122
msg_id : u32 ,
123
+
124
+ /// The reaction.
107
125
reaction : String ,
108
126
} ,
109
127
110
128
/// Incoming webxdc info or summary update, should be notified.
111
129
#[ serde( rename_all = "camelCase" ) ]
112
130
IncomingWebxdcNotify {
131
+ /// ID of the chat.
113
132
chat_id : u32 ,
133
+
134
+ /// ID of the contact sending.
114
135
contact_id : u32 ,
136
+
137
+ /// ID of the added info message or webxdc instance in case of summary change.
115
138
msg_id : u32 ,
139
+
140
+ /// Text to notify.
116
141
text : String ,
142
+
143
+ /// Link assigned to this notification, if any.
117
144
href : Option < String > ,
118
145
} ,
119
146
120
- /// There is a fresh message. Typically, the user will show an notification
147
+ /// There is a fresh message. Typically, the user will show a notification
121
148
/// when receiving this message.
122
149
///
123
150
/// There is no extra #DC_EVENT_MSGS_CHANGED event sent together with this event.
124
151
#[ serde( rename_all = "camelCase" ) ]
125
- IncomingMsg { chat_id : u32 , msg_id : u32 } ,
152
+ IncomingMsg {
153
+ /// ID of the chat where the message is assigned.
154
+ chat_id : u32 ,
155
+
156
+ /// ID of the message.
157
+ msg_id : u32 ,
158
+ } ,
126
159
127
160
/// Downloading a bunch of messages just finished. This is an
128
161
/// event to allow the UI to only show one notification per message bunch,
@@ -138,21 +171,57 @@ pub enum EventType {
138
171
/// A single message is sent successfully. State changed from DC_STATE_OUT_PENDING to
139
172
/// DC_STATE_OUT_DELIVERED, see `Message.state`.
140
173
#[ serde( rename_all = "camelCase" ) ]
141
- MsgDelivered { chat_id : u32 , msg_id : u32 } ,
174
+ MsgDelivered {
175
+ /// ID of the chat which the message belongs to.
176
+ chat_id : u32 ,
177
+
178
+ /// ID of the message that was successfully sent.
179
+ msg_id : u32 ,
180
+ } ,
142
181
143
182
/// A single message could not be sent. State changed from DC_STATE_OUT_PENDING or DC_STATE_OUT_DELIVERED to
144
183
/// DC_STATE_OUT_FAILED, see `Message.state`.
145
184
#[ serde( rename_all = "camelCase" ) ]
146
- MsgFailed { chat_id : u32 , msg_id : u32 } ,
185
+ MsgFailed {
186
+ /// ID of the chat which the message belongs to.
187
+ chat_id : u32 ,
188
+
189
+ /// ID of the message that could not be sent.
190
+ msg_id : u32 ,
191
+ } ,
147
192
148
193
/// A single message is read by the receiver. State changed from DC_STATE_OUT_DELIVERED to
149
194
/// DC_STATE_OUT_MDN_RCVD, see `Message.state`.
150
195
#[ serde( rename_all = "camelCase" ) ]
151
- MsgRead { chat_id : u32 , msg_id : u32 } ,
196
+ MsgRead {
197
+ /// ID of the chat which the message belongs to.
198
+ chat_id : u32 ,
199
+
200
+ /// ID of the message that was read.
201
+ msg_id : u32 ,
202
+ } ,
152
203
153
- /// A single message is deleted.
204
+ /// A single message was deleted.
205
+ ///
206
+ /// This event means that the message will no longer appear in the messagelist.
207
+ /// UI should remove the message from the messagelist
208
+ /// in response to this event if the message is currently displayed.
209
+ ///
210
+ /// The message may have been explicitly deleted by the user or expired.
211
+ /// Internally the message may have been removed from the database,
212
+ /// moved to the trash chat or hidden.
213
+ ///
214
+ /// This event does not indicate the message
215
+ /// deletion from the server.
154
216
#[ serde( rename_all = "camelCase" ) ]
155
- MsgDeleted { chat_id : u32 , msg_id : u32 } ,
217
+ MsgDeleted {
218
+ /// ID of the chat where the message was prior to deletion.
219
+ /// Never 0.
220
+ chat_id : u32 ,
221
+
222
+ /// ID of the deleted message. Never 0.
223
+ msg_id : u32 ,
224
+ } ,
156
225
157
226
/// Chat changed. The name or the image of a chat group was changed or members were added or removed.
158
227
/// Or the verify state of a chat has changed.
@@ -166,21 +235,29 @@ pub enum EventType {
166
235
167
236
/// Chat ephemeral timer changed.
168
237
#[ serde( rename_all = "camelCase" ) ]
169
- ChatEphemeralTimerModified { chat_id : u32 , timer : u32 } ,
238
+ ChatEphemeralTimerModified {
239
+ /// Chat ID.
240
+ chat_id : u32 ,
241
+
242
+ /// New ephemeral timer value.
243
+ timer : u32 ,
244
+ } ,
170
245
171
246
/// Contact(s) created, renamed, blocked or deleted.
172
- ///
173
- /// @param data1 (int) If set, this is the contact_id of an added contact that should be selected.
174
247
#[ serde( rename_all = "camelCase" ) ]
175
- ContactsChanged { contact_id : Option < u32 > } ,
248
+ ContactsChanged {
249
+ /// If set, this is the contact_id of an added contact that should be selected.
250
+ contact_id : Option < u32 > ,
251
+ } ,
176
252
177
253
/// Location of one or more contact has changed.
178
- ///
179
- /// @param data1 (u32) contact_id of the contact for which the location has changed.
180
- /// If the locations of several contacts have been changed,
181
- /// this parameter is set to `None`.
182
254
#[ serde( rename_all = "camelCase" ) ]
183
- LocationChanged { contact_id : Option < u32 > } ,
255
+ LocationChanged {
256
+ /// contact_id of the contact for which the location has changed.
257
+ /// If the locations of several contacts have been changed,
258
+ /// this parameter is set to `None`.
259
+ contact_id : Option < u32 > ,
260
+ } ,
184
261
185
262
/// Inform about the configuration progress started by configure().
186
263
ConfigureProgress {
@@ -195,10 +272,11 @@ pub enum EventType {
195
272
196
273
/// Inform about the import/export progress started by imex().
197
274
///
198
- /// @param data1 (usize) 0=error, 1-999=progress in permille, 1000=success and done
199
- /// @param data2 0
200
275
#[ serde( rename_all = "camelCase" ) ]
201
- ImexProgress { progress : usize } ,
276
+ ImexProgress {
277
+ /// 0=error, 1-999=progress in permille, 1000=success and done
278
+ progress : usize ,
279
+ } ,
202
280
203
281
/// A file has been exported. A file has been written by imex().
204
282
/// This event may be sent multiple times by a single call to imex().
@@ -215,26 +293,34 @@ pub enum EventType {
215
293
///
216
294
/// These events are typically sent after a joiner has scanned the QR code
217
295
/// generated by getChatSecurejoinQrCodeSvg().
218
- ///
219
- /// @param data1 (int) ID of the contact that wants to join.
220
- /// @param data2 (int) Progress as:
221
- /// 300=vg-/vc-request received, typically shown as "bob@addr joins".
222
- /// 600=vg-/vc-request-with-auth received, vg-member-added/vc-contact-confirm sent, typically shown as "bob@addr verified".
223
- /// 800=vg-member-added-received received, shown as "bob@addr securely joined GROUP", only sent for the verified-group-protocol.
224
- /// 1000=Protocol finished for this contact.
225
296
#[ serde( rename_all = "camelCase" ) ]
226
- SecurejoinInviterProgress { contact_id : u32 , progress : usize } ,
297
+ SecurejoinInviterProgress {
298
+ /// ID of the contact that wants to join.
299
+ contact_id : u32 ,
300
+
301
+ /// Progress as:
302
+ /// 300=vg-/vc-request received, typically shown as "bob@addr joins".
303
+ /// 600=vg-/vc-request-with-auth received, vg-member-added/vc-contact-confirm sent, typically shown as "bob@addr verified".
304
+ /// 800=contact added to chat, shown as "bob@addr securely joined GROUP". Only for the verified-group-protocol.
305
+ /// 1000=Protocol finished for this contact.
306
+ progress : usize ,
307
+ } ,
227
308
228
309
/// Progress information of a secure-join handshake from the view of the joiner
229
310
/// (Bob, the person who scans the QR code).
230
311
/// The events are typically sent while secureJoin(), which
231
312
/// may take some time, is executed.
232
- /// @param data1 (int) ID of the inviting contact.
233
- /// @param data2 (int) Progress as:
234
- /// 400=vg-/vc-request-with-auth sent, typically shown as "alice@addr verified, introducing myself."
235
- /// (Bob has verified alice and waits until Alice does the same for him)
236
313
#[ serde( rename_all = "camelCase" ) ]
237
- SecurejoinJoinerProgress { contact_id : u32 , progress : usize } ,
314
+ SecurejoinJoinerProgress {
315
+ /// ID of the inviting contact.
316
+ contact_id : u32 ,
317
+
318
+ /// Progress as:
319
+ /// 400=vg-/vc-request-with-auth sent, typically shown as "alice@addr verified, introducing myself."
320
+ /// (Bob has verified alice and waits until Alice does the same for him)
321
+ /// 1000=vg-member-added/vc-contact-confirm received
322
+ progress : usize ,
323
+ } ,
238
324
239
325
/// The connectivity to the server changed.
240
326
/// This means that you should refresh the connectivity view
@@ -255,22 +341,37 @@ pub enum EventType {
255
341
256
342
#[ serde( rename_all = "camelCase" ) ]
257
343
WebxdcStatusUpdate {
344
+ /// Message ID.
258
345
msg_id : u32 ,
346
+
347
+ /// Status update ID.
259
348
status_update_serial : u32 ,
260
349
} ,
261
350
262
351
/// Data received over an ephemeral peer channel.
263
352
#[ serde( rename_all = "camelCase" ) ]
264
- WebxdcRealtimeData { msg_id : u32 , data : Vec < u8 > } ,
353
+ WebxdcRealtimeData {
354
+ /// Message ID.
355
+ msg_id : u32 ,
356
+
357
+ /// Realtime data.
358
+ data : Vec < u8 > ,
359
+ } ,
265
360
266
361
/// Advertisement received over an ephemeral peer channel.
267
362
/// This can be used by bots to initiate peer-to-peer communication from their side.
268
363
#[ serde( rename_all = "camelCase" ) ]
269
- WebxdcRealtimeAdvertisementReceived { msg_id : u32 } ,
364
+ WebxdcRealtimeAdvertisementReceived {
365
+ /// Message ID of the webxdc instance.
366
+ msg_id : u32 ,
367
+ } ,
270
368
271
369
/// Inform that a message containing a webxdc instance has been deleted
272
370
#[ serde( rename_all = "camelCase" ) ]
273
- WebxdcInstanceDeleted { msg_id : u32 } ,
371
+ WebxdcInstanceDeleted {
372
+ /// ID of the deleted message.
373
+ msg_id : u32 ,
374
+ } ,
274
375
275
376
/// Tells that the Background fetch was completed (or timed out).
276
377
/// This event acts as a marker, when you reach this event you can be sure
@@ -286,7 +387,10 @@ pub enum EventType {
286
387
/// Inform that a single chat list item changed and needs to be rerendered.
287
388
/// If `chat_id` is set to None, then all currently visible chats need to be rerendered, and all not-visible items need to be cleared from cache if the UI has a cache.
288
389
#[ serde( rename_all = "camelCase" ) ]
289
- ChatlistItemChanged { chat_id : Option < u32 > } ,
390
+ ChatlistItemChanged {
391
+ /// ID of the changed chat
392
+ chat_id : Option < u32 > ,
393
+ } ,
290
394
291
395
/// Inform that the list of accounts has changed (an account removed or added or (not yet implemented) the account order changes)
292
396
///
@@ -303,7 +407,10 @@ pub enum EventType {
303
407
AccountsItemChanged ,
304
408
305
409
/// Inform than some events have been skipped due to event channel overflow.
306
- EventChannelOverflow { n : u64 } ,
410
+ EventChannelOverflow {
411
+ /// Number of events skipped.
412
+ n : u64 ,
413
+ } ,
307
414
}
308
415
309
416
impl From < CoreEventType > for EventType {
0 commit comments