Skip to content

Address.email: Why not use _email? #33

Description

@hoffie

When handling Zarafa-internal addresses, python-zarafa explicitly looks up the user name from the known entryid using OpenEntry.
Is there a reason why this is necessary?
As far as I can see, the username is stored in the email property (Address._email) if addrtype is ZARAFA. Am I missing something?

If not, the following patch gives a performance boost on my system:

diff --git a/zarafa/__init__.py b/zarafa/__init__.py
index f742f52..5992ede 100644
--- a/zarafa/__init__.py
+++ b/zarafa/__init__.py
@@ -2539,8 +2539,8 @@ class Address:

         if self.addrtype == 'ZARAFA':
             try:
-                mailuser = self.server.mapisession.OpenEntry(self.entryid, None, 0)
-                return self.server.user(HrGetOneProp(mailuser, PR_ACCOUNT).Value).email # XXX PR_SMTP_ADDRESS_W from mailuser?
+                # with type ZARAFA, the email property contains the username.
+                return self.server.user(self._email).email # XXX PR_SMTP_ADDRESS_W from mailuser?
             except (ZarafaException, MAPIErrorNotFound): # XXX deleted user
                 return None # XXX 'Support Delft'??
         else:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions