File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,10 @@ def mark_seen(self) -> None:
6060 """Mark the message as seen."""
6161 self ._rpc .markseen_msgs (self .account .id , [self .id ])
6262
63+ def exists (self ) -> bool :
64+ """Return True if the message exists."""
65+ return bool (self ._rpc .get_existing_msg_ids (self .account .id , [self .id ]))
66+
6367 def continue_autocrypt_key_transfer (self , setup_code : str ) -> None :
6468 """Continue the Autocrypt Setup Message key transfer.
6569
Original file line number Diff line number Diff line change @@ -993,3 +993,22 @@ def test_background_fetch(acfactory, dc):
993993 snapshot = messages [- 1 ].get_snapshot ()
994994 if snapshot .text == "Hello again!" :
995995 break
996+
997+
998+ def test_message_exists (acfactory ):
999+ ac1 , ac2 = acfactory .get_online_accounts (2 )
1000+ chat = ac1 .create_chat (ac2 )
1001+ message1 = chat .send_text ("Hello!" )
1002+ message2 = chat .send_text ("Hello again!" )
1003+ assert message1 .exists ()
1004+ assert message2 .exists ()
1005+
1006+ ac1 .delete_messages ([message1 ])
1007+ assert not message1 .exists ()
1008+ assert message2 .exists ()
1009+
1010+ # There is no error when checking if
1011+ # the message exists for deleted account.
1012+ ac1 .remove ()
1013+ assert not message1 .exists ()
1014+ assert not message2 .exists ()
You can’t perform that action at this time.
0 commit comments