refine member-added and member-removed plugin hooks to signal the sender (who added/removed a contact )

add ac_chat_modified hook event
add account.get_contact_by_addr (thanks @r10s)
This commit is contained in:
holger krekel
2020-04-17 21:32:27 +02:00
parent a87a2d0b71
commit 9eda710538
7 changed files with 133 additions and 76 deletions

View File

@@ -22,14 +22,16 @@ class GroupTrackingPlugin:
print("*** ac_configure_completed:", success)
@account_hookimpl
def ac_member_added(self, chat, contact):
print("*** ac_member_added", contact.addr, "from", chat)
def ac_member_added(self, chat, contact, sender):
print("*** ac_member_added {} to chat {} from {}".format(
contact.addr, chat.id, sender.addr))
for member in chat.get_contacts():
print("chat member: {}".format(member.addr))
@account_hookimpl
def ac_member_removed(self, chat, contact):
print("*** ac_member_removed", contact.addr, "from", chat)
def ac_member_removed(self, chat, contact, sender):
print("*** ac_member_removed {} from chat {} by {}".format(
contact.addr, chat.id, sender.addr))
def main(argv=None):