コード例 #1
0
ファイル: store.py プロジェクト: nagyistge/kopano-core
    def favorites(self):
        """Returns all favorite folders"""

        table = self.common_views.mapiobj.GetContentsTable(MAPI_ASSOCIATED)
        table.SetColumns([
            PR_MESSAGE_CLASS, PR_SUBJECT, PR_WLINK_ENTRYID, PR_WLINK_FLAGS,
            PR_WLINK_ORDINAL, PR_WLINK_STORE_ENTRYID, PR_WLINK_TYPE
        ], 0)
        table.Restrict(
            SPropertyRestriction(
                RELOP_EQ, PR_MESSAGE_CLASS,
                SPropValue(PR_MESSAGE_CLASS, "IPM.Microsoft.WunderBar.Link")),
            TBL_BATCH)

        for row in table.QueryRows(-1, 0):
            store_entryid = bin2hex(row[5].Value)

            try:
                if store_entryid == self.entryid:  # XXX: Handle favorites from public stores
                    yield self.folder(entryid=bin2hex(row[2].Value))
                else:
                    store = Store(entryid=store_entryid, server=self.server)
                    yield store.folder(entryid=bin2hex(row[2].Value))
            except NotFoundError:
                pass
コード例 #2
0
    def __init__(self, parent_mapiobj,
                 mapiobj):  # XXX rethink attributes, names.. add guidname..?
        self._parent_mapiobj = parent_mapiobj
        #: Property tag, e.g. 0x37001f for PR_SUBJECT
        self.proptag = mapiobj.ulPropTag

        if PROP_TYPE(
                mapiobj.ulPropTag
        ) == PT_ERROR and mapiobj.Value == MAPI_E_NOT_ENOUGH_MEMORY:
            if PROP_ID(
                    self.proptag) == PROP_ID(PR_BODY_W):  # avoid slow guessing
                self.proptag = PR_BODY_W
                mapiobj = SPropDelayedValue(parent_mapiobj, self.proptag)
            elif PROP_ID(self.proptag) in (PROP_ID(PR_RTF_COMPRESSED),
                                           PROP_ID(PR_HTML)):
                self.proptag = PROP_TAG(PT_BINARY, PROP_ID(self.proptag))
                mapiobj = SPropDelayedValue(parent_mapiobj, self.proptag)
            else:  # XXX possible to use above trick to infer all proptags?
                for proptype in (PT_BINARY,
                                 PT_UNICODE):  # XXX slow, incomplete?
                    proptag = (mapiobj.ulPropTag & 0xffff0000) | proptype
                    try:
                        HrGetOneProp(
                            parent_mapiobj, proptag
                        )  # XXX: Unicode issue?? calls GetProps([proptag], 0)
                        self.proptag = proptag  # XXX isn't it strange we can get here
                    except MAPIErrorNotEnoughMemory:
                        mapiobj = SPropDelayedValue(parent_mapiobj, proptag)
                        self.proptag = proptag
                        break
                    except MAPIErrorNotFound:
                        pass

        self.id_ = self.proptag >> 16
        self.mapiobj = mapiobj
        self._value = None

        self.idname = REV_TAG.get(self.proptag)
        self.type_ = PROP_TYPE(self.proptag)
        self.typename = REV_TYPE.get(self.type_)
        self.named = False
        self.kind = None
        self.kindname = None
        self.guid = None
        self.name = None
        self.namespace = None

        if self.id_ >= 0x8000:  # possible named prop
            try:
                lpname = self._parent_mapiobj.GetNamesFromIDs([self.proptag],
                                                              None, 0)[0]
                if lpname:
                    self.guid = bin2hex(lpname.guid)
                    self.namespace = GUID_NAMESPACE.get(lpname.guid)
                    self.name = lpname.id
                    self.kind = lpname.kind
                    self.kindname = 'MNID_STRING' if lpname.kind == MNID_STRING else 'MNID_ID'
                    self.named = True
            except MAPIErrorNoSupport:  # XXX user.props()?
                pass
コード例 #3
0
ファイル: item.py プロジェクト: nagyistge/kopano-core
    def sourcekey(self):
        """ Item sourcekey """

        if not hasattr(self,
                       '_sourcekey'):  # XXX more general caching solution
            self._sourcekey = bin2hex(
                HrGetOneProp(self.mapiobj, PR_SOURCE_KEY).Value)
        return self._sourcekey
コード例 #4
0
ファイル: company.py プロジェクト: nagyistge/kopano-core
 def companyid(self):  # XXX single-tenant case
     if self._name != u'Default':
         return bin2hex(self._eccompany.CompanyID)
コード例 #5
0
ファイル: user.py プロジェクト: nagyistge/kopano-core
 def local(self):
     store = self.store
     return bool(store and (self.server.guid == bin2hex(
         HrGetOneProp(store.mapiobj, PR_MAPPING_SIGNATURE).Value)))
コード例 #6
0
ファイル: user.py プロジェクト: nagyistge/kopano-core
    def userid(self):
        """ Userid """

        return bin2hex(self._ecuser.UserID)
コード例 #7
0
 def guid(self):
     """Server GUID."""
     return bin2hex(HrGetOneProp(self.mapistore, PR_MAPPING_SIGNATURE).Value)
コード例 #8
0
    def groupid(self):
        """Group identifier."""

        return bin2hex(self._ecgroup.GroupID)
コード例 #9
0
ファイル: store.py プロジェクト: nagyistge/kopano-core
    def entryid(self):
        """ Store entryid """

        return bin2hex(self.prop(PR_ENTRYID).value)
コード例 #10
0
ファイル: store.py プロジェクト: nagyistge/kopano-core
    def guid(self):
        """ Store GUID """

        return bin2hex(self.prop(PR_STORE_RECORD_KEY).value)
コード例 #11
0
ファイル: item.py プロジェクト: nagyistge/kopano-core
    def entryid(self):
        """ Item entryid """

        return bin2hex(HrGetOneProp(self.mapiobj, PR_ENTRYID).Value)