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