コード例 #1
0
ファイル: SmartForward.py プロジェクト: tirsott/activesync
 def build(client_id,
           source,
           mime,
           replace_mime=False,
           save_in_sent_items=True,
           template_id=None):
     smartforward_xmldoc_req = wapxmltree()
     xmlrootnode = wapxmlnode("SmartForward")
     smartforward_xmldoc_req.set_root(xmlrootnode, "composemail")
     xml_clientid_node = wapxmlnode("ClientId", xmlrootnode, client_id)
     xml_source_node = wapxmlnode("Source", xmlrootnode)
     if source.has_key("FolderId"):
         wapxmlnode("FolderId", xml_source_node, source["FolderId"])
     if source.has_key("ItemId"):
         wapxmlnode("ItemId", xml_source_node, source["ItemId"])
     if source.has_key("LongId"):
         wapxmlnode("LongId", xml_source_node, source["LongId"])
     if source.has_key("InstanceId"):
         wapxmlnode("InstanceId", xml_source_node, source["InstanceId"])
     xml_accountid_node = wapxmlnode("AccountId", xmlrootnode, display_name)
     xml_saveinsentiems_node = wapxmlnode("SaveInSentItems", xmlrootnode,
                                          str(int(save_in_sent_items)))
     if replace_mime:
         xml_replacemime_node = wapxmlnode("ReplaceMime", xmlrootnode)
     xml_mime_node = wapxmlnode("Mime", xmlrootnode, mime)
     xml_templateid_node = wapxmlnode("rm:TemplateID", xmlrootnode,
                                      template_id)
     return smartforward_xmldoc_req
コード例 #2
0
 def build(synckey, server_id):
     folderdelete_xmldoc_req = wapxmltree()
     xmlrootnode = wapxmlnode("FolderDelete")
     folderdelete_xmldoc_req.set_root(xmlrootnode, "folderhierarchy")
     xmlsynckeynode = wapxmlnode("SyncKey", xmlrootnode, synckey)
     xmlserveridnode = wapxmlnode("ServerId", xmlrootnode, server_id)
     return folderdelete_xmldoc_req
コード例 #3
0
ファイル: Provision.py プロジェクト: appscluster/pyActiveSync
    def build(policykey, settings=None):
        provision_xmldoc_req = wapxmltree()
        xmlrootnode = wapxmlnode("Provision")
        provision_xmldoc_req.set_root(xmlrootnode, "provision")

        if policykey == "0":
            xml_settings_deviceinformation_node = wapxmlnode("settings:DeviceInformation", xmlrootnode)
            xml_settings_set_node = wapxmlnode("settings:Set", xml_settings_deviceinformation_node)
            xml_settings_model_node = wapxmlnode("settings:Model", xml_settings_set_node, settings["Model"])
            xml_settings_model_node = wapxmlnode("settings:IMEI", xml_settings_set_node, settings["IMEI"])
            xml_settings_model_node = wapxmlnode("settings:FriendlyName", xml_settings_set_node, settings["FriendlyName"])
            xml_settings_model_node = wapxmlnode("settings:OS", xml_settings_set_node, settings["OS"])
            xml_settings_model_node = wapxmlnode("settings:OSLanguage", xml_settings_set_node, settings["OSLanguage"])
            xml_settings_model_node = wapxmlnode("settings:PhoneNumber", xml_settings_set_node, settings["PhoneNumber"])
            xml_settings_model_node = wapxmlnode("settings:MobileOperator", xml_settings_set_node, settings["MobileOperator"])
            xml_settings_model_node = wapxmlnode("settings:UserAgent", xml_settings_set_node, settings["UserAgent"])

            xml_policies_node = wapxmlnode("Policies", xmlrootnode)
            xml_policy_node = wapxmlnode("Policy", xml_policies_node)
            xml_policytype_node = wapxmlnode("PolicyType", xml_policy_node, "MS-EAS-Provisioning-WBXML")
        else:
            xml_policies_node = wapxmlnode("Policies", xmlrootnode)
            xml_policy_node = wapxmlnode("Policy", xml_policies_node)
            xml_policytype_node = wapxmlnode("PolicyType", xml_policy_node, "MS-EAS-Provisioning-WBXML")
            xml_policytype_node = wapxmlnode("PolicyKey", xml_policy_node, policykey)
            xml_policytype_node = wapxmlnode("Status", xml_policy_node, "1")

        return provision_xmldoc_req
コード例 #4
0
ファイル: FolderDelete.py プロジェクト: tirsott/activesync
 def build(synckey, server_id):
     folderdelete_xmldoc_req = wapxmltree()
     xmlrootnode = wapxmlnode("FolderDelete")
     folderdelete_xmldoc_req.set_root(xmlrootnode, "folderhierarchy")
     xmlsynckeynode = wapxmlnode("SyncKey", xmlrootnode, synckey)
     xmlserveridnode = wapxmlnode("ServerId", xmlrootnode, server_id)
     return folderdelete_xmldoc_req
コード例 #5
0
 def build(synckey, server_id, parent_id, display_name):
     folderupdate_xmldoc_req = wapxmltree()
     xmlrootnode = wapxmlnode("FolderUpdate")
     folderupdate_xmldoc_req.set_root(xmlrootnode, "folderhierarchy")
     xmlsynckeynode = wapxmlnode("SyncKey", xmlrootnode, synckey)
     xmlserveridnode = wapxmlnode("ServerId", xmlrootnode, server_id)
     xmlparentidnode = wapxmlnode("ParentId", xmlrootnode, parent_id)
     xmldisplaynamenode = wapxmlnode("DisplayName", xmlrootnode, display_name)
     return folderupdate_xmldoc_req
コード例 #6
0
 def build(synckey, parent_id, display_name, _type):
     foldercreate_xmldoc_req = wapxmltree()
     xmlrootnode = wapxmlnode("FolderCreate")
     foldercreate_xmldoc_req.set_root(xmlrootnode, "folderhierarchy")
     xmlsynckeynode = wapxmlnode("SyncKey", xmlrootnode, synckey)
     xmlparentidnode = wapxmlnode("ParentId", xmlrootnode, parent_id)
     xmldisplaynamenode = wapxmlnode("DisplayName", xmlrootnode, display_name)
     xmltypenode = wapxmlnode("Type", xmlrootnode, _type) #See objects.MSASCMD.FolderHierarchy.FolderCreate.Type
     return foldercreate_xmldoc_req
コード例 #7
0
 def build(synckey, server_id, parent_id, display_name):
     folderupdate_xmldoc_req = wapxmltree()
     xmlrootnode = wapxmlnode("FolderUpdate")
     folderupdate_xmldoc_req.set_root(xmlrootnode, "folderhierarchy")
     xmlsynckeynode = wapxmlnode("SyncKey", xmlrootnode, synckey)
     xmlserveridnode = wapxmlnode("ServerId", xmlrootnode, server_id)
     xmlparentidnode = wapxmlnode("ParentId", xmlrootnode, parent_id)
     xmldisplaynamenode = wapxmlnode("DisplayName", xmlrootnode, display_name)
     return folderupdate_xmldoc_req
コード例 #8
0
ファイル: SendMail.py プロジェクト: appscluster/pyActiveSync
 def build(client_id, mime, account_id=None, save_in_sent_items=True, template_id=None):
     sendmail_xmldoc_req = wapxmltree()
     xmlrootnode = wapxmlnode("SendMail")
     sendmail_xmldoc_req.set_root(xmlrootnode, "composemail")
     xml_clientid_node = wapxmlnode("ClientId", xmlrootnode, client_id)
     if account_id:
         xml_accountid_node = wapxmlnode("AccountId", xmlrootnode, account_id)
     xml_saveinsentiems_node = wapxmlnode("SaveInSentItems", xmlrootnode, str(int(save_in_sent_items)))
     xml_mime_node = wapxmlnode("Mime", xmlrootnode, None, mime)
     #xml_templateid_node = wapxmlnode("rm:TemplateID", xmlrootnode, template_id)
     return sendmail_xmldoc_req
コード例 #9
0
ファイル: FolderCreate.py プロジェクト: tirsott/activesync
 def build(synckey, parent_id, display_name, _type):
     foldercreate_xmldoc_req = wapxmltree()
     xmlrootnode = wapxmlnode("FolderCreate")
     foldercreate_xmldoc_req.set_root(xmlrootnode, "folderhierarchy")
     xmlsynckeynode = wapxmlnode("SyncKey", xmlrootnode, synckey)
     xmlparentidnode = wapxmlnode("ParentId", xmlrootnode, parent_id)
     xmldisplaynamenode = wapxmlnode("DisplayName", xmlrootnode,
                                     display_name)
     xmltypenode = wapxmlnode(
         "Type", xmlrootnode,
         _type)  #See objects.MSASCMD.FolderHierarchy.FolderCreate.Type
     return foldercreate_xmldoc_req
コード例 #10
0
 def build(moves):
     if len(moves) < 1:
         raise AttributeError("MoveItems builder: No moves supplied to MoveItems request builder.")
     moveitems_xmldoc_req = wapxmltree()
     xmlrootnode = wapxmlnode("MoveItems")
     moveitems_xmldoc_req.set_root(xmlrootnode, "move")
     for move in moves:
         xmlmovenode = wapxmlnode("Move", xmlrootnode)
         src_msg_id, src_fld_id, dst_fld_id = move
         xmlsrcmsgidnode = wapxmlnode("SrcMsgId", xmlmovenode, src_msg_id)
         xmlsrcfldidnode = wapxmlnode("SrcFldId", xmlmovenode, src_fld_id)
         xmldstfldidnode = wapxmlnode("DstFldId", xmlmovenode, dst_fld_id)
     return moveitems_xmldoc_req
コード例 #11
0
ファイル: Ping.py プロジェクト: appscluster/pyActiveSync
 def build(heatbeat_interval="30", folders=None):
     if not folders:
         raise AttributeError("Ping builder: No folders included in ping request builder. Must ping at least one folder.")
     ping_xmldoc_req = wapxmltree()
     xmlrootnode = wapxmlnode("Ping")
     ping_xmldoc_req.set_root(xmlrootnode, "ping")
     xmlheartbeatintervalnode = wapxmlnode("HeartbeatInterval", xmlrootnode, heatbeat_interval)
     xmlfoldersnode = wapxmlnode("Folders", xmlrootnode)
     for folder in folders:
         xmlfoldernode = wapxmlnode("Folder", xmlfoldersnode)
         xmlidnode = wapxmlnode("Id", xmlfoldernode, folder[0])
         xmlclassnode = wapxmlnode("Class", xmlfoldernode, folder[1])
     return ping_xmldoc_req
コード例 #12
0
ファイル: Provision.py プロジェクト: tirsott/activesync
    def build(policykey, settings=None):
        provision_xmldoc_req = wapxmltree()
        xmlrootnode = wapxmlnode("Provision")
        provision_xmldoc_req.set_root(xmlrootnode, "provision")

        if policykey == "0":
            xml_settings_deviceinformation_node = wapxmlnode(
                "settings:DeviceInformation", xmlrootnode)
            xml_settings_set_node = wapxmlnode(
                "settings:Set", xml_settings_deviceinformation_node)
            xml_settings_model_node = wapxmlnode("settings:Model",
                                                 xml_settings_set_node,
                                                 settings["Model"])
            xml_settings_model_node = wapxmlnode("settings:IMEI",
                                                 xml_settings_set_node,
                                                 settings["IMEI"])
            xml_settings_model_node = wapxmlnode("settings:FriendlyName",
                                                 xml_settings_set_node,
                                                 settings["FriendlyName"])
            xml_settings_model_node = wapxmlnode("settings:OS",
                                                 xml_settings_set_node,
                                                 settings["OS"])
            xml_settings_model_node = wapxmlnode("settings:OSLanguage",
                                                 xml_settings_set_node,
                                                 settings["OSLanguage"])
            xml_settings_model_node = wapxmlnode("settings:PhoneNumber",
                                                 xml_settings_set_node,
                                                 settings["PhoneNumber"])
            xml_settings_model_node = wapxmlnode("settings:MobileOperator",
                                                 xml_settings_set_node,
                                                 settings["MobileOperator"])
            xml_settings_model_node = wapxmlnode("settings:UserAgent",
                                                 xml_settings_set_node,
                                                 settings["UserAgent"])

            xml_policies_node = wapxmlnode("Policies", xmlrootnode)
            xml_policy_node = wapxmlnode("Policy", xml_policies_node)
            xml_policytype_node = wapxmlnode("PolicyType", xml_policy_node,
                                             "MS-EAS-Provisioning-WBXML")
        else:
            xml_policies_node = wapxmlnode("Policies", xmlrootnode)
            xml_policy_node = wapxmlnode("Policy", xml_policies_node)
            xml_policytype_node = wapxmlnode("PolicyType", xml_policy_node,
                                             "MS-EAS-Provisioning-WBXML")
            xml_policytype_node = wapxmlnode("PolicyKey", xml_policy_node,
                                             policykey)
            xml_policytype_node = wapxmlnode("Status", xml_policy_node, "1")

        return provision_xmldoc_req
コード例 #13
0
 def build(to, cert_retrieval=0, max_certs=9999, max_recipients=9999, start_time=None, end_time=None, max_picture_size=100, max_pictures=9999):
     resolverecipients_xmldoc_req = wapxmltree()
     xmlrootnode = wapxmlnode("ResolveRecipients")
     resolverecipients_xmldoc_req.set_root(xmlrootnode, "resolverecipients")
     xmltonode = wapxmlnode("To", xmlrootnode, to)
     #xmloptionsnode = wapxmlnode("Options", xmlrootnode)
     #xmlcertificateretrievalnode = wapxmlnode("CertificateRetrieval", xmloptionsnode, cert_retrieveal)
     #xmlmaxcertificatesnode = wapxmlnode("MaxCertificates", xmloptionsnode, max_certs)                       #0-9999
     #xmlmaxambiguousrecipientsnode = wapxmlnode("MaxAmbiguousRecipients", xmloptionsnode, max_recipients)    #0-9999
     #xmlavailabilitynode = wapxmlnode("Availability", xmloptionsnode)
     #xmlstarttimenode = wapxmlnode("StartTime", xmlavailabilitynode, start_time) #datetime
     #xmlendtimenode = wapxmlnode("EndTime", xmlavailabilitynode, end_time) #datetime
     #xmlpicturenode = wapxmlnode("Picture", xmloptionsnode)
     #xmlmaxsizenode = wapxmlnode("MaxSize", xmlpicturenode, max_size) #must be > 100KB
     #xmlmaxpicturesnode = wapxmlnode("MaxPictures", xmlpicturenode, max_pictures)
     return resolverecipients_xmldoc_req
コード例 #14
0
 def build(heatbeat_interval="30", folders=None):
     if not folders:
         raise AttributeError(
             "Ping builder: No folders included in ping request builder. Must ping at least one folder."
         )
     ping_xmldoc_req = wapxmltree()
     xmlrootnode = wapxmlnode("Ping")
     ping_xmldoc_req.set_root(xmlrootnode, "ping")
     xmlheartbeatintervalnode = wapxmlnode("HeartbeatInterval", xmlrootnode,
                                           heatbeat_interval)
     xmlfoldersnode = wapxmlnode("Folders", xmlrootnode)
     for folder in folders:
         xmlfoldernode = wapxmlnode("Folder", xmlfoldersnode)
         xmlidnode = wapxmlnode("Id", xmlfoldernode, folder[0])
         xmlclassnode = wapxmlnode("Class", xmlfoldernode, folder[1])
     return ping_xmldoc_req
コード例 #15
0
 def build(responses):
     meetingresponse_xmldoc_req = wapxmltree()
     xmlrootnode = wapxmlnode("MeetingResponse")
     meetingresponse_xmldoc_req.set_root(xmlrootnode, "meetingresponse")
     for response in responses:
         xmlrequestnode = wapxmlnode("Request", xmlrootnode)
         xmluserresponsenode = wapxmlnode("UserResponse", xmlrequestnode, response["UserResponse"])
         if response.has_Key("CollectionId"):
             xmlcollectionidnode = wapxmlnode("CollectionId", xmlrequestnode, response["CollectionId"])
             xmlrequestidnode = wapxmlnode("RequestId", xmlrequestnode, response["RequestId"])
         elif response.has_Key("LongId"):
             xmllongidnode = wapxmlnode("search:LongId", xmlrequestnode, response["LongId"])
         else:
             raise AttributeError("MeetingResponse missing meeting id")
         xmlinstanceidnode = wapxmlnode("InstanceId", xmlrequestnode, response["InstanceId"])
     return meetingresponse_xmldoc_req
コード例 #16
0
ファイル: SendMail.py プロジェクト: tirsott/activesync
 def build(client_id,
           mime,
           account_id=None,
           save_in_sent_items=True,
           template_id=None):
     sendmail_xmldoc_req = wapxmltree()
     xmlrootnode = wapxmlnode("SendMail")
     sendmail_xmldoc_req.set_root(xmlrootnode, "composemail")
     xml_clientid_node = wapxmlnode("ClientId", xmlrootnode, client_id)
     if account_id:
         xml_accountid_node = wapxmlnode("AccountId", xmlrootnode,
                                         account_id)
     xml_saveinsentiems_node = wapxmlnode("SaveInSentItems", xmlrootnode,
                                          str(int(save_in_sent_items)))
     xml_mime_node = wapxmlnode("Mime", xmlrootnode, None, mime)
     #xml_templateid_node = wapxmlnode("rm:TemplateID", xmlrootnode, template_id)
     return sendmail_xmldoc_req
コード例 #17
0
 def build(certificate, certificate_chain_list=[], pre_encoded = False, check_crl = True):
     validatecert_xmldoc_req = wapxmltree()
     xmlrootnode = wapxmlnode("ValidateCert")
     validatecert_xmldoc_req.set_root(xmlrootnode, "validatecert")
     if len(certificate_chain_list) > 0:
         xmlcertchainnode = wapxmlnode("CertificateChain", xmlrootnode)
         for cert in certificate_chain_list:
             if pre_encoded:
                 wapxmlnode("Certificate", xmlcertchainnode, cert)
             else:
                 wapxmlnode("Certificate", xmlcertchainnode, base64.b64encode(cert))
     xmlcertsnode = wapxmlnode("Certificates", xmlrootnode)
     if pre_encoded:
         xmlcertnode = wapxmlnode("Certificate", xmlcertsnode, certificate)
     else:
         xmlcertnode = wapxmlnode("Certificate", xmlcertsnode, base64.b64encode(certificate))
     if check_crl:
         xmlcertsnode = wapxmlnode("CheckCRL", xmlrootnode, "1")
     return validatecert_xmldoc_req
コード例 #18
0
ファイル: GetItemEstimate.py プロジェクト: tirsott/activesync
    def build(synckeys, collection_ids, options):
        getitemestimate_xmldoc_req = wapxmltree()
        xmlrootgetitemestimatenode = wapxmlnode("GetItemEstimate")
        getitemestimate_xmldoc_req.set_root(xmlrootgetitemestimatenode,
                                            "getitemestimate")

        xmlcollectionsnode = wapxmlnode("Collections",
                                        xmlrootgetitemestimatenode)

        for collection_id in collection_ids:
            xml_Collection_node = wapxmlnode("Collection", xmlcollectionsnode)
            try:
                xml_gie_airsyncSyncKey_node = wapxmlnode(
                    "airsync:SyncKey", xml_Collection_node,
                    synckeys[collection_id])
            except KeyError:
                xml_gie_airsyncSyncKey_node = wapxmlnode(
                    "airsync:SyncKey", xml_Collection_node, "0")
            xml_gie_CollectionId_node = wapxmlnode("CollectionId",
                                                   xml_Collection_node,
                                                   collection_id)  #?
            if options[collection_id].has_key("ConversationMode"):
                xml_gie_ConverationMode_node = wapxmlnode(
                    "airsync:ConversationMode", xml_Collection_node,
                    options[collection_id]["ConversationMode"])  #?
            xml_gie_airsyncOptions_node = wapxmlnode("airsync:Options",
                                                     xml_Collection_node)
            xml_gie_airsyncClass_node = wapxmlnode(
                "airsync:Class", xml_gie_airsyncOptions_node,
                options[collection_id]["Class"]
            )  #STR #http://msdn.microsoft.com/en-us/library/gg675489(v=exchg.80).aspx
            if options[collection_id].has_key("FilterType"):
                xml_gie_airsyncFilterType_node = wapxmlnode(
                    "airsync:FilterType", xml_gie_airsyncOptions_node,
                    options[collection_id]["FilterType"]
                )  #INT #http://msdn.microsoft.com/en-us/library/gg663562(v=exchg.80).aspx
            if options[collection_id].has_key("MaxItems"):
                xml_gie_airsyncMaxItems_node = wapxmlnode(
                    "airsync:MaxItems", xml_gie_airsyncMaxItems_node,
                    options[collection_id]["MaxItems"]
                )  #OPTIONAL  #INT   #http://msdn.microsoft.com/en-us/library/gg675531(v=exchg.80).aspx
        return getitemestimate_xmldoc_req
コード例 #19
0
 def build(client_id, source, mime, replace_mime=False, save_in_sent_items=True, template_id=None):
     smartforward_xmldoc_req = wapxmltree()
     xmlrootnode = wapxmlnode("SmartForward")
     smartforward_xmldoc_req.set_root(xmlrootnode, "composemail")
     xml_clientid_node = wapxmlnode("ClientId", xmlrootnode, client_id)
     xml_source_node = wapxmlnode("Source", xmlrootnode)
     if source.has_key("FolderId"):
         wapxmlnode("FolderId", xml_source_node, source["FolderId"])
     if source.has_key("ItemId"):
         wapxmlnode("ItemId", xml_source_node, source["ItemId"])
     if source.has_key("LongId"):
         wapxmlnode("LongId", xml_source_node, source["LongId"]) 
     if source.has_key("InstanceId"):
         wapxmlnode("InstanceId", xml_source_node, source["InstanceId"])        
     xml_accountid_node = wapxmlnode("AccountId", xmlrootnode, display_name)
     xml_saveinsentiems_node = wapxmlnode("SaveInSentItems", xmlrootnode, str(int(save_in_sent_items)))
     if replace_mime:
         xml_replacemime_node = wapxmlnode("ReplaceMime", xmlrootnode)
     xml_mime_node = wapxmlnode("Mime", xmlrootnode, mime)
     xml_templateid_node = wapxmlnode("rm:TemplateID", xmlrootnode, template_id)
     return smartforward_xmldoc_req
コード例 #20
0
 def build(responses):
     meetingresponse_xmldoc_req = wapxmltree()
     xmlrootnode = wapxmlnode("MeetingResponse")
     meetingresponse_xmldoc_req.set_root(xmlrootnode, "meetingresponse")
     for response in responses:
         xmlrequestnode = wapxmlnode("Request", xmlrootnode)
         xmluserresponsenode = wapxmlnode("UserResponse", xmlrequestnode,
                                          response["UserResponse"])
         if response.has_Key("CollectionId"):
             xmlcollectionidnode = wapxmlnode("CollectionId",
                                              xmlrequestnode,
                                              response["CollectionId"])
             xmlrequestidnode = wapxmlnode("RequestId", xmlrequestnode,
                                           response["RequestId"])
         elif response.has_Key("LongId"):
             xmllongidnode = wapxmlnode("search:LongId", xmlrequestnode,
                                        response["LongId"])
         else:
             raise AttributeError("MeetingResponse missing meeting id")
         xmlinstanceidnode = wapxmlnode("InstanceId", xmlrequestnode,
                                        response["InstanceId"])
     return meetingresponse_xmldoc_req
コード例 #21
0
    def build(synckeys, collection_ids, options):
        getitemestimate_xmldoc_req = wapxmltree()
        xmlrootgetitemestimatenode = wapxmlnode("GetItemEstimate")
        getitemestimate_xmldoc_req.set_root(xmlrootgetitemestimatenode, "getitemestimate")

        xmlcollectionsnode = wapxmlnode("Collections", xmlrootgetitemestimatenode)

        for collection_id in collection_ids:
            xml_Collection_node = wapxmlnode("Collection", xmlcollectionsnode)
            try:
                xml_gie_airsyncSyncKey_node = wapxmlnode("airsync:SyncKey", xml_Collection_node, synckeys[collection_id])
            except KeyError:
                xml_gie_airsyncSyncKey_node = wapxmlnode("airsync:SyncKey", xml_Collection_node, "0") 
            xml_gie_CollectionId_node = wapxmlnode("CollectionId", xml_Collection_node, collection_id)#?
            if options[collection_id].has_key("ConversationMode"):
                xml_gie_ConverationMode_node = wapxmlnode("airsync:ConversationMode", xml_Collection_node, options[collection_id]["ConversationMode"])#?
            xml_gie_airsyncOptions_node = wapxmlnode("airsync:Options", xml_Collection_node)
            xml_gie_airsyncClass_node = wapxmlnode("airsync:Class", xml_gie_airsyncOptions_node, options[collection_id]["Class"]) #STR #http://msdn.microsoft.com/en-us/library/gg675489(v=exchg.80).aspx
            if options[collection_id].has_key("FilterType"):
                xml_gie_airsyncFilterType_node = wapxmlnode("airsync:FilterType", xml_gie_airsyncOptions_node, options[collection_id]["FilterType"])   #INT #http://msdn.microsoft.com/en-us/library/gg663562(v=exchg.80).aspx
            if options[collection_id].has_key("MaxItems"):
                xml_gie_airsyncMaxItems_node = wapxmlnode("airsync:MaxItems", xml_gie_airsyncMaxItems_node, options[collection_id]["MaxItems"]) #OPTIONAL  #INT   #http://msdn.microsoft.com/en-us/library/gg675531(v=exchg.80).aspx
        return getitemestimate_xmldoc_req
コード例 #22
0
 def build(to,
           cert_retrieval=0,
           max_certs=9999,
           max_recipients=9999,
           start_time=None,
           end_time=None,
           max_picture_size=100,
           max_pictures=9999):
     resolverecipients_xmldoc_req = wapxmltree()
     xmlrootnode = wapxmlnode("ResolveRecipients")
     resolverecipients_xmldoc_req.set_root(xmlrootnode, "resolverecipients")
     xmltonode = wapxmlnode("To", xmlrootnode, to)
     #xmloptionsnode = wapxmlnode("Options", xmlrootnode)
     #xmlcertificateretrievalnode = wapxmlnode("CertificateRetrieval", xmloptionsnode, cert_retrieveal)
     #xmlmaxcertificatesnode = wapxmlnode("MaxCertificates", xmloptionsnode, max_certs)                       #0-9999
     #xmlmaxambiguousrecipientsnode = wapxmlnode("MaxAmbiguousRecipients", xmloptionsnode, max_recipients)    #0-9999
     #xmlavailabilitynode = wapxmlnode("Availability", xmloptionsnode)
     #xmlstarttimenode = wapxmlnode("StartTime", xmlavailabilitynode, start_time) #datetime
     #xmlendtimenode = wapxmlnode("EndTime", xmlavailabilitynode, end_time) #datetime
     #xmlpicturenode = wapxmlnode("Picture", xmloptionsnode)
     #xmlmaxsizenode = wapxmlnode("MaxSize", xmlpicturenode, max_size) #must be > 100KB
     #xmlmaxpicturesnode = wapxmlnode("MaxPictures", xmlpicturenode, max_pictures)
     return resolverecipients_xmldoc_req
コード例 #23
0
 def build(certificate,
           certificate_chain_list=[],
           pre_encoded=False,
           check_crl=True):
     validatecert_xmldoc_req = wapxmltree()
     xmlrootnode = wapxmlnode("ValidateCert")
     validatecert_xmldoc_req.set_root(xmlrootnode, "validatecert")
     if len(certificate_chain_list) > 0:
         xmlcertchainnode = wapxmlnode("CertificateChain", xmlrootnode)
         for cert in certificate_chain_list:
             if pre_encoded:
                 wapxmlnode("Certificate", xmlcertchainnode, cert)
             else:
                 wapxmlnode("Certificate", xmlcertchainnode,
                            base64.b64encode(cert))
     xmlcertsnode = wapxmlnode("Certificates", xmlrootnode)
     if pre_encoded:
         xmlcertnode = wapxmlnode("Certificate", xmlcertsnode, certificate)
     else:
         xmlcertnode = wapxmlnode("Certificate", xmlcertsnode,
                                  base64.b64encode(certificate))
     if check_crl:
         xmlcertsnode = wapxmlnode("CheckCRL", xmlrootnode, "1")
     return validatecert_xmldoc_req
コード例 #24
0
ファイル: Sync.py プロジェクト: appscluster/pyActiveSync
    def build(synckeys, collections):
        as_sync_xmldoc_req = wapxmltree()
        xml_as_sync_rootnode = wapxmlnode("Sync")
        as_sync_xmldoc_req.set_root(xml_as_sync_rootnode, "airsync")

        xml_as_collections_node = wapxmlnode("Collections", xml_as_sync_rootnode)

        for collection_id in collections.keys():
            xml_as_Collection_node = wapxmlnode("Collection", xml_as_collections_node)  #http://msdn.microsoft.com/en-us/library/gg650891(v=exchg.80).aspx
            try:
                xml_as_SyncKey_node = wapxmlnode("SyncKey", xml_as_Collection_node, synckeys[collection_id])    #http://msdn.microsoft.com/en-us/library/gg663426(v=exchg.80).aspx
            except KeyError:
                xml_as_SyncKey_node = wapxmlnode("SyncKey", xml_as_Collection_node, "0")
                
            xml_as_CollectionId_node = wapxmlnode("CollectionId", xml_as_Collection_node, collection_id) #http://msdn.microsoft.com/en-us/library/gg650886(v=exchg.80).aspx

            for parameter in collections[collection_id].keys():
                if parameter == "Options":
                    xml_as_Options_node = wapxmlnode(parameter, xml_as_Collection_node)
                    for option_parameter in collections[collection_id][parameter].keys():
                        if option_parameter.startswith("airsync"):
                            for airsyncpref_node in collections[collection_id][parameter][option_parameter]:
                                xml_as_Options_airsyncpref_node = wapxmlnode(option_parameter.replace("_",":"), xml_as_Options_node)
                                wapxmlnode("airsyncbase:Type", xml_as_Options_airsyncpref_node, airsyncpref_node["Type"])
                                tmp = airsyncpref_node["Type"]
                                del airsyncpref_node["Type"]
                                for airsyncpref_parameter in airsyncpref_node.keys():
                                    wapxmlnode("airsyncbase:%s" % airsyncpref_parameter, xml_as_Options_airsyncpref_node, airsyncpref_node[airsyncpref_parameter])
                                airsyncpref_node["Type"] = tmp
                        elif option_parameter.startswith("rm"):
                            wapxmlnode(option_parameter.replace("_",":"), xml_as_Options_node, collections[collection_id][parameter][option_parameter])
                        else:
                            wapxmlnode(option_parameter, xml_as_Options_node, collections[collection_id][parameter][option_parameter])
                else:
                    wapxmlnode(parameter, xml_as_Collection_node, collections[collection_id][parameter])
        return as_sync_xmldoc_req
コード例 #25
0
ファイル: FolderSync.py プロジェクト: tirsott/activesync
 def build(synckey):
     foldersync_xmldoc_req = wapxmltree()
     xmlrootnode = wapxmlnode("FolderSync")
     foldersync_xmldoc_req.set_root(xmlrootnode, "folderhierarchy")
     xmlsynckeynode = wapxmlnode("SyncKey", xmlrootnode, synckey)
     return foldersync_xmldoc_req
コード例 #26
0
ファイル: ItemOperations.py プロジェクト: tirsott/activesync
    def build(operations):
        itemoperations_xmldoc_req = wapxmltree()
        xmlrootnode = wapxmlnode("ItemOperations")
        itemoperations_xmldoc_req.set_root(xmlrootnode, "itemoperations")

        for operation in range(0, len(operations)):
            if operations[operation]["Name"] == "EmptyFolderContents":
                xmlemptyfoldercontentsnode = wapxmlnode(
                    "EmptyFolderContents", xmlrootnode)
                xmlcollectionidnode = wapxmlnode(
                    "airsync:CollectionId", xmlemptyfoldercontentsnode,
                    operations[operation]["CollectionId"])
                if operations[operation].has_key("DeleteSubFolders"):
                    xmloptionsnode = wapxmlnode("Options",
                                                xmlemptyfoldercontentsnode)
                    xmldeletesubfoldersnode = wapxmlnode(
                        "DeleteSubFolders", xmloptionsnode,
                        operations[operation]["DeleteSubFolders"])

            elif operations[operation]["Name"] == "Fetch":
                xmlfetchnode = wapxmlnode("Fetch", xmlrootnode)
                xmloptionsnode = wapxmlnode("Store", xmlfetchnode,
                                            operations[operation]["Store"])
                if operations[operation].has_key("LinkId"):
                    xmllinkidnode = wapxmlnode(
                        "documentlibrary:LinkId", xmlfetchnode,
                        operations[operation]["LinkId"])  #URI of document
                if operations[operation].has_key("LongId"):
                    xmllongidnode = wapxmlnode("search:LongId", xmlfetchnode,
                                               operations[operation]["LongId"])
                if operations[operation].has_key("CollectionId"):
                    xmlcollectionidnode = wapxmlnode(
                        "airsync:CollectionId", xmlfetchnode,
                        operations[operation]["CollectionId"])
                if operations[operation].has_key("ServerId"):
                    xmlserveridnode = wapxmlnode(
                        "airsync:ServerId", xmlfetchnode,
                        operations[operation]["ServerId"])
                if operations[operation].has_key("FileReference"):
                    xmlfilereferencenode = wapxmlnode(
                        "airsyncbase:FileReference", xmlfetchnode,
                        operations[operation]
                        ["FileReference"])  #only range option can be specified
                if operations[operation].has_key(
                        "RemoveRightsManagementProtection"):
                    xmlremovermnode = wapxmlnode(
                        "rm:RemoveRightsManagementProtection",
                        xmlfetchnode)  #Empty element
                if len(
                        xmlfetchnode.get_children()
                ) < 2:  #let's make sure one of the above item locations was supplied
                    raise AttributeError(
                        "ItemOperations Fetch: No item to be fetched supplied."
                    )

                xmloptionsnode = wapxmlnode("Options")
                if operations[operation].has_key("Schema"):
                    xmlschemanode = wapxmlnode(
                        "Schema", xmloptionsnode,
                        operations[operation]["Schema"]
                    )  #fetch only specific properties of an item. mailbox store only. cannot use for attachments.
                if operations[operation].has_key("Range"):
                    xmlrangenode = wapxmlnode(
                        "Range", xmloptionsnode, operations[operation]["Range"]
                    )  #select bytes is only for documents and attachments
                if operations[operation].has_key(
                        "UserName"
                ):  #select username and password to use for fetch. i imagine this is  only for documents.
                    if not operations[operation].has_key("Password"):
                        raise AttributeError(
                            "ItemOperations Fetch: Username supplied for fetch operation, but no password supplied. Aborting."
                        )
                        return
                    xmlusernamenode = wapxmlnode(
                        "UserName", xmloptionsnode, operations[operation]
                        ["UserName"])  #username to use for fetch
                    xmlpasswordnode = wapxmlnode(
                        "Password", xmloptionsnode, operations[operation]
                        ["Password"])  #password to use for fetch
                if operations[operation].has_key("MIMESupport"):
                    xmlmimesupportnode = wapxmlnode(
                        "airsync:MIMESupport", xmloptionsnode,
                        operations[operation]
                        ["MIMESupport"])  #objects.MSASAIRS.airsync_MIMESupport
                if operations[operation].has_key("BodyPreference"):
                    xmlbodypreferencenode = wapxmlnode(
                        "airsyncbase:BodyPreference", xmloptionsnode,
                        operations[operation]["BodyPreference"])
                if operations[operation].has_key("BodyPartPreference"):
                    xmlbodypartpreferencenode = wapxmlnode(
                        "airsyncbase:BodyPartPreference", xmloptionsnode,
                        operations[operation]["BodyPartPreference"])
                if operations[operation].has_key("RightsManagementSupport"):
                    xmlrmsupportnode = wapxmlnode(
                        "rm:RightsManagementSupport", xmloptionsnode,
                        operations[operation]["RightsManagementSupport"]
                    )  #1=Supports RM. Decrypt message before send. 2=Do not decrypt message before send
                if len(xmloptionsnode.get_children()) > 0:
                    xmloptionsnode.set_parent(xmlfetchnode)

            elif operations[operation]["Name"] == "Move":
                xmlmovenode = wapxmlnode("Move", xmlrootnode)
                xmlconversationidnode = wapxmlnode(
                    "ConversationId", xmlmovenode,
                    operations[operation]["ConversationId"])
                xmldstfldidnode = wapxmlnode("DstFldId", xmlmovenode,
                                             operations[operation]["DstFldId"])
                if operations[operation].has_key("MoveAlways"):
                    xmloptionsnode = wapxmlnode("Options", xmlmovenode)
                    xmlmovealwaysnode = wapxmlnode(
                        "MoveAlways", xmloptionsnode,
                        operations[operation]["MoveAlways"]
                    )  #also move future emails in this conversation to selected folder.
            else:
                raise AttributeError(
                    "Unknown operation %s submitted to ItemOperations wapxml builder."
                    % operation)

        return itemoperations_xmldoc_req
コード例 #27
0
ファイル: Sync.py プロジェクト: tirsott/activesync
    def build(synckeys, collections):
        as_sync_xmldoc_req = wapxmltree()
        xml_as_sync_rootnode = wapxmlnode("Sync")
        as_sync_xmldoc_req.set_root(xml_as_sync_rootnode, "airsync")

        xml_as_collections_node = wapxmlnode("Collections",
                                             xml_as_sync_rootnode)

        for collection_id in collections.keys():
            xml_as_Collection_node = wapxmlnode(
                "Collection", xml_as_collections_node
            )  #http://msdn.microsoft.com/en-us/library/gg650891(v=exchg.80).aspx
            try:
                xml_as_SyncKey_node = wapxmlnode(
                    "SyncKey", xml_as_Collection_node, synckeys[collection_id]
                )  #http://msdn.microsoft.com/en-us/library/gg663426(v=exchg.80).aspx
            except KeyError:
                xml_as_SyncKey_node = wapxmlnode("SyncKey",
                                                 xml_as_Collection_node, "0")

            xml_as_CollectionId_node = wapxmlnode(
                "CollectionId", xml_as_Collection_node, collection_id
            )  #http://msdn.microsoft.com/en-us/library/gg650886(v=exchg.80).aspx

            for parameter in collections[collection_id].keys():
                if parameter == "Options":
                    xml_as_Options_node = wapxmlnode(parameter,
                                                     xml_as_Collection_node)
                    for option_parameter in collections[collection_id][
                            parameter].keys():
                        if option_parameter.startswith("airsync"):
                            for airsyncpref_node in collections[collection_id][
                                    parameter][option_parameter]:
                                xml_as_Options_airsyncpref_node = wapxmlnode(
                                    option_parameter.replace("_", ":"),
                                    xml_as_Options_node)
                                wapxmlnode("airsyncbase:Type",
                                           xml_as_Options_airsyncpref_node,
                                           airsyncpref_node["Type"])
                                tmp = airsyncpref_node["Type"]
                                del airsyncpref_node["Type"]
                                for airsyncpref_parameter in airsyncpref_node.keys(
                                ):
                                    wapxmlnode(
                                        "airsyncbase:%s" %
                                        airsyncpref_parameter,
                                        xml_as_Options_airsyncpref_node,
                                        airsyncpref_node[airsyncpref_parameter]
                                    )
                                airsyncpref_node["Type"] = tmp
                        elif option_parameter.startswith("rm"):
                            wapxmlnode(
                                option_parameter.replace("_", ":"),
                                xml_as_Options_node, collections[collection_id]
                                [parameter][option_parameter])
                        else:
                            wapxmlnode(
                                option_parameter, xml_as_Options_node,
                                collections[collection_id][parameter]
                                [option_parameter])
                else:
                    wapxmlnode(parameter, xml_as_Collection_node,
                               collections[collection_id][parameter])
        return as_sync_xmldoc_req
コード例 #28
0
    def build(operations):
        itemoperations_xmldoc_req = wapxmltree()
        xmlrootnode = wapxmlnode("ItemOperations")
        itemoperations_xmldoc_req.set_root(xmlrootnode, "itemoperations")

        for operation in range(0,len(operations)):
            if operations[operation]["Name"] == "EmptyFolderContents":
                xmlemptyfoldercontentsnode = wapxmlnode("EmptyFolderContents", xmlrootnode)
                xmlcollectionidnode = wapxmlnode("airsync:CollectionId", xmlemptyfoldercontentsnode, operations[operation]["CollectionId"])
                if operations[operation].has_key("DeleteSubFolders"):
                    xmloptionsnode = wapxmlnode("Options", xmlemptyfoldercontentsnode)
                    xmldeletesubfoldersnode = wapxmlnode("DeleteSubFolders", xmloptionsnode, operations[operation]["DeleteSubFolders"])

            elif operations[operation]["Name"] == "Fetch":
                xmlfetchnode = wapxmlnode("Fetch", xmlrootnode)
                xmloptionsnode = wapxmlnode("Store", xmlfetchnode, operations[operation]["Store"])
                if operations[operation].has_key("LinkId"):
                    xmllinkidnode = wapxmlnode("documentlibrary:LinkId", xmlfetchnode, operations[operation]["LinkId"]) #URI of document
                if operations[operation].has_key("LongId"):
                    xmllongidnode = wapxmlnode("search:LongId", xmlfetchnode, operations[operation]["LongId"])
                if operations[operation].has_key("CollectionId"):
                    xmlcollectionidnode = wapxmlnode("airsync:CollectionId", xmlfetchnode, operations[operation]["CollectionId"])
                if operations[operation].has_key("ServerId"):
                    xmlserveridnode = wapxmlnode("airsync:ServerId", xmlfetchnode, operations[operation]["ServerId"])
                if operations[operation].has_key("FileReference"):
                    xmlfilereferencenode = wapxmlnode("airsyncbase:FileReference", xmlfetchnode, operations[operation]["FileReference"]) #only range option can be specified
                if operations[operation].has_key("RemoveRightsManagementProtection"):
                    xmlremovermnode = wapxmlnode("rm:RemoveRightsManagementProtection", xmlfetchnode) #Empty element
                if len(xmlfetchnode.get_children()) < 2: #let's make sure one of the above item locations was supplied
                    raise AttributeError("ItemOperations Fetch: No item to be fetched supplied.")

                xmloptionsnode = wapxmlnode("Options")
                if operations[operation].has_key("Schema"):
                    xmlschemanode = wapxmlnode("Schema", xmloptionsnode, operations[operation]["Schema"]) #fetch only specific properties of an item. mailbox store only. cannot use for attachments.
                if operations[operation].has_key("Range"):
                    xmlrangenode = wapxmlnode("Range", xmloptionsnode, operations[operation]["Range"]) #select bytes is only for documents and attachments
                if operations[operation].has_key("UserName"): #select username and password to use for fetch. i imagine this is  only for documents.
                    if not operations[operation].has_key("Password"):
                        raise AttributeError("ItemOperations Fetch: Username supplied for fetch operation, but no password supplied. Aborting.")
                        return
                    xmlusernamenode = wapxmlnode("UserName", xmloptionsnode, operations[operation]["UserName"]) #username to use for fetch
                    xmlpasswordnode = wapxmlnode("Password", xmloptionsnode, operations[operation]["Password"]) #password to use for fetch
                if operations[operation].has_key("MIMESupport"):
                    xmlmimesupportnode = wapxmlnode("airsync:MIMESupport", xmloptionsnode, operations[operation]["MIMESupport"]) #objects.MSASAIRS.airsync_MIMESupport
                if operations[operation].has_key("BodyPreference"):
                    xmlbodypreferencenode = wapxmlnode("airsyncbase:BodyPreference", xmloptionsnode, operations[operation]["BodyPreference"])
                if operations[operation].has_key("BodyPartPreference"):
                    xmlbodypartpreferencenode = wapxmlnode("airsyncbase:BodyPartPreference", xmloptionsnode, operations[operation]["BodyPartPreference"])
                if operations[operation].has_key("RightsManagementSupport"):
                    xmlrmsupportnode = wapxmlnode("rm:RightsManagementSupport", xmloptionsnode, operations[operation]["RightsManagementSupport"])#1=Supports RM. Decrypt message before send. 2=Do not decrypt message before send 
                if len(xmloptionsnode.get_children()) > 0:
                    xmloptionsnode.set_parent(xmlfetchnode)

            elif operations[operation]["Name"] == "Move":
                xmlmovenode = wapxmlnode("Move", xmlrootnode)
                xmlconversationidnode = wapxmlnode("ConversationId", xmlmovenode, operations[operation]["ConversationId"])
                xmldstfldidnode = wapxmlnode("DstFldId", xmlmovenode, operations[operation]["DstFldId"])
                if operations[operation].has_key("MoveAlways"):
                    xmloptionsnode = wapxmlnode("Options", xmlmovenode)
                    xmlmovealwaysnode = wapxmlnode("MoveAlways", xmloptionsnode, operations[operation]["MoveAlways"]) #also move future emails in this conversation to selected folder.
            else:
               raise AttributeError("Unknown operation %s submitted to ItemOperations wapxml builder." % operation)

        return itemoperations_xmldoc_req
コード例 #29
0
 def build(synckey):
     foldersync_xmldoc_req = wapxmltree()
     xmlrootnode = wapxmlnode("FolderSync")
     foldersync_xmldoc_req.set_root(xmlrootnode, "folderhierarchy")
     xmlsynckeynode = wapxmlnode("SyncKey", xmlrootnode, synckey)
     return foldersync_xmldoc_req