|
@@ -44,7 +44,7 @@ def copy_contact(p_from: Contact, p_to: Contact):
|
|
|
p_to.save()
|
|
|
|
|
|
|
|
|
-def main():
|
|
|
+def sync_contacts():
|
|
|
account.authenticate()
|
|
|
shared = account.address_book(resource='adressbuch@global-cube.net', address_book='personal')
|
|
|
shared_contacts = {p.display_name: p for p in shared.get_contacts(limit=None)}
|
|
@@ -67,8 +67,23 @@ def main():
|
|
|
copy_contact(p, p_existing)
|
|
|
|
|
|
|
|
|
+def delete_contacts(delete_candidates):
|
|
|
+ account.authenticate()
|
|
|
+
|
|
|
+ for mailbox in mailboxes:
|
|
|
+ print(mailbox)
|
|
|
+ personal = account.address_book(resource=mailbox, address_book='personal')
|
|
|
+ personal_contacts = {p.display_name: p for p in personal.get_contacts(limit=None)}
|
|
|
+
|
|
|
+ selected_contacts = set(delete_candidates).intersection(personal_contacts.keys())
|
|
|
+ print(selected_contacts)
|
|
|
+ for c in selected_contacts:
|
|
|
+ personal_contacts[c].delete()
|
|
|
+
|
|
|
+
|
|
|
if __name__ == '__main__':
|
|
|
- main()
|
|
|
+ # sync_contacts()
|
|
|
+ delete_contacts(['Kia Kia Hotline', 'Marcel J.G. Kamps', 'Kevin Baumann (next motion)', 'Marius kling', 'Herr Haase', 'Birgit Dingfeldt'])
|
|
|
# gal = account.directory()
|
|
|
# mails = [p.mail for p in gal.get_users()]
|
|
|
# print(mails)
|