holger krekel
a1d5120e58
sipmlify plugins and tests and remove superflous core event
2020-04-13 17:39:31 +02:00
holger krekel
f38386d164
fix member_added/member_removed event with tests and and provide a group-tracking example
2020-04-13 17:39:31 +02:00
holger krekel
d66829702f
fix #164 add MEMBER_REMOVED event and member_removed plugin python hook
2020-04-13 17:39:31 +02:00
holger krekel
84f17b7539
emit "DC_EVENT_MEMBER_ADDED" and python plugin event "member_added" for securejoin or non-securejoin additions of a contact to a chat. also fixup some docs
2020-04-13 17:39:31 +02:00
Alexander Krotov
e9967c32e6
chat: filter parent messages by state instead of UID
...
Since introduction of server message deletion, message may not have
server UID even when it is not a draft or pending message. To handle
such messages correctly, we explicitly check message state.
2020-04-13 17:38:42 +02:00
Alexander Krotov
f65dbee74b
Add basic test for ChatId.parent_is_encrypted()
2020-04-13 17:38:42 +02:00
Alexander Krotov
f51fd1267f
chat: move parent_query() and related methods from Chat to ChatId
2020-04-13 17:38:42 +02:00
Friedel Ziegelmayer
24f4cbbb27
refactor: replace failure
...
- failure is deprecated
- thiserror for deriving Error impl
- anyhow for highlevel error handling
2020-04-10 22:39:28 +02:00
Alexander Krotov
916fab7d4b
hide_device_expired_messages: allow missing self or device chat
2020-04-03 12:12:56 +03:00
Alexander Krotov
4e0a08106d
ChatId.get_param: remove unnecessary type annotation
2020-04-01 20:06:27 +03:00
Alexander Krotov
fc57cbfb49
Refactor hiding of expired messages
...
Now there is only one function: hide_device_expired_messages().
If any messages are hidden event DC_EVENT_MSGS_CHANGED(0,0) is emitted
now, which is more correct than DC_EVENT_CHAT_MODIFIED and also triggers
chatlist reload.
2020-04-01 20:06:27 +03:00
Alexander Krotov
7522fec044
Do not emit "chat modified" events when loading chatlist
...
Otherwise chatlist will be loaded twice, once right after hiding expired
messages, and once in response to event emitted by try_load().
2020-04-01 20:06:27 +03:00
Alexander Krotov
237dabb907
Do not hide hidden messages in ChatId.delete_device_expired_messages()
...
This prevents infinite event loop, when chatlist is reloaded in response
to event, and event is emitted by hiding messages before chatlist reload.
2020-04-01 20:06:27 +03:00
Alexander Krotov
3686048ab6
chatlist: hide all expired messages before loading
2020-04-01 20:06:27 +03:00
Alexander Krotov
2bf4c5d7e7
Emit "chat modified" event when messages expire
2020-04-01 20:06:27 +03:00
Alexander Krotov
051d80b2f3
Move delete_device_expired_messages() to ChatId
...
This allows to check if chat is a self-talk or device chat.
Messages are deleted only in viewed chats now.
2020-04-01 20:06:27 +03:00
Alexander Krotov
adaa1e856c
chat: add ChatId.is_self_talk() and ChatId.is_device_talk()
2020-04-01 20:06:27 +03:00
Alexander Krotov
4daa57c98e
delete_device_expired_messages: set text to DELETED for hidden messages
...
This makes debugging easier: DELETED messages should never be shown.
2020-04-01 20:06:27 +03:00
Alexander Krotov
7e67b2cbb3
Do not delete messages from special chats
2020-04-01 20:06:27 +03:00
Alexander Krotov
270d18a88a
Move prune_tombstones() to sql:: and call from housekeeping()
2020-04-01 20:06:27 +03:00
Alexander Krotov
25f8a735a9
get_chat_msgs: remove locally expired messages
...
Expired messages are hidden right before retrieving messages from the
database, so expired messages are not shown to the user.
2020-04-01 20:06:27 +03:00
Alexander Krotov
9eb672ea17
Move removal of chat message tombstones to a separate function
...
DELETE operation may be slow compared to UPDATE. It is better to do in
a separate job.
2020-04-01 20:06:27 +03:00
Alexander Krotov
9febc762da
Add chat::delete_device_expired_messages() function
2020-04-01 20:06:27 +03:00
Alexander Krotov
f2aa17c9d0
Resultify MsgId.delete_from_db()
2020-04-01 20:06:27 +03:00
Alexander Krotov
4452cab987
Turn Message::Delete_from_db into MsgId method
2020-04-01 20:06:27 +03:00
Alexander Krotov
958802a233
Add system message only if contact was removed successfully
2020-03-31 18:08:19 +02:00
Alexander Krotov
508b8ef2e2
Improve documentation, mostly by hiding behind pub(crate)
2020-02-20 23:37:13 +03:00
B. Petersen
fa3d98a492
add a function to delete records from the chats_contacts table
2020-02-18 17:51:28 +01:00
Alexander Krotov
8ed08f701d
Do not use grpid to find last inserted row in chats table
...
Instead, use last_insert_rowid() function to find the row.
There is no race condition in using last_insert_rowid(), because
last_insert_rowid() returns row id last inserted in this connection. As
we hold the connection during the whole transaction, it is impossible
that some other thread will execute INSERT statement in parallel.
This commit is part of the effort to get rid of sql::get_rowid hack and
use transactions more for related SQL statements.
2020-02-17 01:35:56 +03:00
B. Petersen
a9ac69fe9c
fix pinning test by forcing a reliable order
2020-02-16 00:55:13 +01:00
B. Petersen
1f9520dc78
target comments from @flub
2020-02-14 13:43:48 +01:00
B. Petersen
a177df32b7
omit values in ChatVisibility enum as suggested by @dignifiedquire and @flub
2020-02-14 13:43:48 +01:00
B. Petersen
f25d5dd123
do not unpin chats on sending/receiving messages
2020-02-14 13:43:48 +01:00
B. Petersen
4cfa9e6165
send event as before, uis depend on that
2020-02-14 13:43:48 +01:00
B. Petersen
0303ea7f57
rename to ChatVisibility, simplify ffi
2020-02-14 13:43:48 +01:00
B. Petersen
2813e01e61
remove unneeded sql-roundtrip on getting archived state
2020-02-14 11:28:55 +01:00
B. Petersen
60493d30f6
target comment from @dignifiedquire, use ArchiveState inside core
2020-02-14 11:28:55 +01:00
Simon Laux
6efe8e7d7c
change ChatInfo.archived to tri-state
...
and add to the changelog
2020-02-14 11:28:55 +01:00
Simon Laux
2e8409f146
address some of flubs comments
2020-02-14 11:28:55 +01:00
Simon Laux
23b6178e78
add rust test for pin chat
2020-02-14 11:28:55 +01:00
Simon Laux
5e5d45fb0a
better fallbacks
2020-02-14 11:28:54 +01:00
Simon Laux
1765b8f2cf
show pinned chats again and order them to the top
2020-02-14 11:28:54 +01:00
Simon Laux
5678562ce2
represent archivestate as enum
...
before it was a boolean, even though it is a 3 state
2020-02-14 11:28:54 +01:00
dignifiedquire
e440d8503a
fixup
2020-02-12 19:12:22 +01:00
dignifiedquire
9cc99ffcd6
add more ser and de impls
2020-02-12 19:12:22 +01:00
Floris Bruynooghe
4aebd678c3
Use SystemTime instead of i64
...
This clarifies some behaviour with negative times and propagates
errors a bit better around places.
2020-02-09 13:35:37 +01:00
Simon Laux
d73d021e3c
cargo fmt
2020-02-09 12:25:47 +01:00
Simon Laux
621f1df913
rename MutedUntilTimestamp to Until
2020-02-09 12:01:09 +01:00
Simon Laux
e04d28c885
use from- and to-sql traits
2020-02-08 13:29:24 +01:00
Simon Laux
6d80b3675a
dtransform mute chat to use relative durations
...
instead of absolute timestamps
2020-02-08 13:26:48 +01:00