Example #1
0
    def ABContactAdd(self, scenario, passport, messenger, type, 
                     callback, *callback_args):
        """call the ABContactAdd SOAP action

           @param scenario : the scenario to use for the action
           @param passport : the passport address of the contact to add
           @param messenger : True is this is a messenger contact, else False
           @param type : "Regular" or "LivePending" or "LiveAccepted" or "Messenger2"
        """
        self._scenario = scenario
        pending_contact = Contact()
        pending_contact.type = type
        pending_contact.account = passport
        pending_contact.display_name = passport
        self._contacts_queue.append(pending_contact)

        self._method("ABContactAdd", callback, callback_args, {})
        self.request.add_argument("abId", NS_ADDRESSBOOK, value="00000000-0000-0000-0000-000000000000")
        Contact = self.request.add_argument("contacts", NS_ADDRESSBOOK).\
                append("Contact", NS_ADDRESSBOOK)
        ContactInfo = Contact.append("contactInfo", NS_ADDRESSBOOK)
        ContactInfo.append("contactType", NS_ADDRESSBOOK, value=type)
        ContactInfo.append("passportName", NS_ADDRESSBOOK, value=passport)
        ContactInfo.append("isMessengerUser", NS_ADDRESSBOOK, value=SOAPUtils.bool_to_string(messenger))
        self.request.add_argument("options", NS_ADDRESSBOOK).\
                append("EnableAllowListManagement", NS_ADDRESSBOOK,
                        value=SOAPUtils.bool_to_string(True))
        self._send_request()
Example #2
0
    def __init__(self, xml_node):
        soap_utils = SOAPUtils(NS_SHORTHANDS)

        self.id = soap_utils.find_ex(xml_node, "./ab:groupId").text
        group_info = soap_utils.find_ex(xml_node, "./ab:groupInfo") 
        
        self.type = soap_utils.find_ex(group_info, "./ab:groupType").text
        self.name = soap_utils.find_ex(group_info, "./ab:name").text
Example #3
0
    def __init__(self, xml_node=None):
        if xml_node is None:
            self.id = ""
            self.type = ""
            self.account = ""
            self.display_name = ""
            self.network_id = NetworkID.MSN
            self.CID = ""
        else:
            soap_utils = SOAPUtils(NS_SHORTHANDS)

            self.id = soap_utils.find_ex(xml_node, "./ab:contactId").text
            contact_info = soap_utils.find_ex(xml_node, "./ab:contactInfo")

            self.type = soap_utils.find_ex(contact_info, "./ab:contactType").text

            passport = soap_utils.find_ex(contact_info, "./ab:passportName")
            if passport is not None:
                self.account = passport.text
                self.network_id = NetworkID.MSN
            else: # Yahoo user
                self.account = soap_utils.find_ex(contact_info,
                        "./ab:emails/ab:ContactEmail/ab:email").text
                self.network_id = NetworkID.EXTERNAL
            display_name = soap_utils.find_ex(xml_node, "./ab:DisplayName")
            if display_name is not None:
                self.display_name = display_name.text
            else:
                self.display_name = self.account.split("@", 1)[0]
            self.CID = soap_utils.find_ex(contact_info, "./ab:CID").text
Example #4
0
 def ABFindAll(self, scenario, deltas_only, callback, *callback_args):
     self._scenario = scenario
     self._simple_method("ABFindAll", callback, callback_args,
             ("abId", "00000000-0000-0000-0000-000000000000"),
             ("abView", "Full"), # add lastChanges to make deltasOnly usable
             ("deltasOnly", SOAPUtils.bool_to_string(deltas_only)),
             ("dynamicItemView", "Gleam"))
Example #5
0
    def UpdateDynamicItem(self, scenario, passport, last_changed, gleam,
                          callback, *callback_args):
        """call the UpdateDynamicItem SOAP action

           @param scenario : the scenario to use for the action
        """
        # WARNING : this method is not complete at all
        self._scenario = scenario
        self._method("UpdateDynamicItem", callback, callback_args, {})
        self.request.add_argument("abId", NS_ADDRESSBOOK, value="00000000-0000-0000-0000-000000000000")
        DynamicItem = self.request.add_argument("dynamicItems", NS_ADDRESSBOOK).\
            append("DynamicItem", NS_ADDRESSBOOK, type="PassportDynamicItem")
        DynamicItem.append("Type", NS_ADDRESSBOOK, value="Passport")
        DynamicItem.append("PassportName", NS_ADDRESSBOOK, value=passport)
        NotificationData = DynamicItem.append("Notifications", NS_ADDRESSBOOK).\
            append("NotificationData", NS_ADDRESSBOOK)
        StoreService = NotificationData.append("StoreService", NS_ADDRESSBOOK)
        Info = StoreService.append("Info", NS_ADDRESSBOOK)
        Handle = Info.append("Handle", NS_ADDRESSBOOK)
        Handle.append("Id", NS_ADDRESSBOOK, value="0")
        Handle.append("Type", NS_ADDRESSBOOK, value="Profile")
        Handle.append("ForeignId", NS_ADDRESSBOOK, value="MyProfile")
        Info.append("InverseRequired", NS_ADDRESSBOOK, value="false")
        Info.append("IsBot", NS_ADDRESSBOOK, value="false")
        StoreService.append("Changes", NS_ADDRESSBOOK)
        StoreService.append("LastChange", NS_ADDRESSBOOK, value="0001-01-01T00:00:00")
        StoreService.append("Deleted", NS_ADDRESSBOOK, value="false")
        NotificationData.append("Status", NS_ADDRESSBOOK, value="Exist Access")
        NotificationData.append("LastChanged", NS_ADDRESSBOOK, value=last_changed)
        NotificationData.append("Gleam", NS_ADDRESSBOOK, 
                                value=SOAPUtils.bool_to_string(gleam))
        NotificationData.append("InstanceId", NS_ADDRESSBOOK, value="0")
        DynamicItem.append("Changes", NS_ADDRESSBOOK, value="Notifications")
        self._send_request()
Example #6
0
    def __init__(self, xml_node):
        soap_utils = SOAPUtils(NS_SHORTHANDS)

        self.membership_id = soap_utils.find_ex(xml_node, "./ab:MembershipId").text
        self.type = soap_utils.find_ex(xml_node, "./ab:Type").text
        self.state = soap_utils.find_ex(xml_node, "./ab:State").text
        self.deleted = SOAPUtils.bool_type(soap_utils.find_ex(xml_node, "./ab:Deleted").text)
        self.last_changed = iso8601.parse(soap_utils.find_ex(xml_node, "./ab:LastChanged").text)
        
        passport = soap_utils.find_ex(xml_node, "./ab:PassportName")
        if passport is not None:
            self.account = passport.text
            self.network_id = NetworkID.MSN
        else:
            self.account = soap_utils.find_ex(xml_node, "./ab:Email").text
            self.network_id = NetworkID.EXTERNAL

        display_name = soap_utils.find_ex(xml_node, "./ab:DisplayName")
        if display_name is not None:
            self.display_name = display_name.text
        else:
            self.display_name = self.account.split("@", 1)[0]