rename hooks to use "ac_" (account) and "dc_" (global)

This commit is contained in:
holger krekel
2020-03-29 07:34:48 +02:00
parent 7e1470ea46
commit ca88c5b41c
11 changed files with 67 additions and 67 deletions

View File

@@ -6,7 +6,7 @@ from deltachat import account_hookimpl, run_cmdline
class EchoPlugin:
@account_hookimpl
def process_incoming_message(self, message):
def ac_incoming_message(self, message):
print("process_incoming message", message)
if message.text.strip() == "/quit":
message.account.shutdown()
@@ -18,8 +18,8 @@ class EchoPlugin:
message.chat.send_text("echoing from {}:\n{}".format(addr, text))
@account_hookimpl
def process_message_delivered(self, message):
print("process_message_delivered", message)
def ac_message_delivered(self, message):
print("ac_message_delivered", message)
def main(argv=None):

View File

@@ -6,7 +6,7 @@ from deltachat import account_hookimpl, run_cmdline
class GroupTrackingPlugin:
@account_hookimpl
def process_incoming_message(self, message):
def ac_incoming_message(self, message):
print("process_incoming message", message)
if message.text.strip() == "/quit":
message.account.shutdown()
@@ -18,18 +18,18 @@ class GroupTrackingPlugin:
message.chat.send_text("echoing from {}:\n{}".format(addr, text))
@account_hookimpl
def configure_completed(self, success):
print("*** configure_completed:", success)
def ac_configure_completed(self, success):
print("*** ac_configure_completed:", success)
@account_hookimpl
def member_added(self, chat, contact):
print("*** member_added", contact.addr, "from", chat)
def ac_member_added(self, chat, contact):
print("*** ac_member_added", contact.addr, "from", chat)
for member in chat.get_contacts():
print("chat member: {}".format(member.addr))
@account_hookimpl
def member_removed(self, chat, contact):
print("*** member_removed", contact.addr, "from", chat)
def ac_member_removed(self, chat, contact):
print("*** ac_member_removed", contact.addr, "from", chat)
def main(argv=None):

View File

@@ -38,7 +38,7 @@ def test_group_tracking_plugin(acfactory, lp):
ac1, ac2 = acfactory.get_two_online_accounts(quiet=True)
botproc.fnmatch_lines("""
*configure_completed: True*
*ac_configure_completed: True*
""")
ac1.add_account_plugin(FFIEventLogger(ac1, "ac1"))
ac2.add_account_plugin(FFIEventLogger(ac2, "ac2"))
@@ -50,7 +50,7 @@ def test_group_tracking_plugin(acfactory, lp):
ch.send_text("hello")
botproc.fnmatch_lines("""
*member_added {}*
*ac_member_added {}*
""".format(ac1.get_config("addr")))
lp.sec("adding third member {}".format(ac2.get_config("addr")))
@@ -62,11 +62,11 @@ def test_group_tracking_plugin(acfactory, lp):
lp.sec("now looking at what the bot received")
botproc.fnmatch_lines("""
*member_added {}*
*ac_member_added {}*
""".format(contact3.addr))
lp.sec("contact successfully added, now removing")
ch.remove_contact(contact3)
botproc.fnmatch_lines("""
*member_removed {}*
*ac_member_removed {}*
""".format(contact3.addr))