mirror of
https://github.com/chatmail/core.git
synced 2026-04-05 23:22:11 +03:00
refine handling of accepted contacts in example
This commit is contained in:
@@ -11,10 +11,11 @@ class EchoPlugin:
|
||||
if message.text.strip() == "/quit":
|
||||
message.account.shutdown()
|
||||
else:
|
||||
ch = message.get_sender_chat()
|
||||
# unconditionally accept the chat
|
||||
message.accept_sender_contact()
|
||||
addr = message.get_sender_contact().addr
|
||||
text = message.text
|
||||
ch.send_text("echoing from {}:\n{}".format(addr, text))
|
||||
message.chat.send_text("echoing from {}:\n{}".format(addr, text))
|
||||
|
||||
@deltachat.hookspec.account_hookimpl
|
||||
def process_message_delivered(self, message):
|
||||
|
||||
@@ -22,7 +22,6 @@ def test_echo_quit_plugin(acfactory):
|
||||
|
||||
def run_bot():
|
||||
print("*"*20 + " starting bot")
|
||||
print("*"*20 + " bot_ac.dbpath", bot_ac.db_path)
|
||||
echo_and_quit.main([
|
||||
"echo",
|
||||
"--show-ffi",
|
||||
@@ -40,6 +39,7 @@ def test_echo_quit_plugin(acfactory):
|
||||
ch1.send_text("hello")
|
||||
reply = ac1._evtracker.wait_next_incoming_message()
|
||||
assert "hello" in reply.text
|
||||
assert reply.chat == ch1
|
||||
ch1.send_text("/quit")
|
||||
t.join()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user