コード例 #1
0
    def __init__(self, sharing, callback, errback, scenario,
                 account, network, state, old_membership, new_membership):
        """Updates contact memberships.

           @type scenario: L{Scenario<papyon.service.AddressBook.scenario.base.Scenario>}
           @type network: L{NetworkID<papyon.profile.NetworkID>}
           @type old_membership: bitmask of L{Membership<papyon.profile.Membership>}
           @type new_membership: bitmask of L{Membership<papyon.profile.Membership>}
        """
        BaseScenario.__init__(self, scenario, callback, errback)
        self.__sharing = sharing

        self.account = account
        self.contact_type = UpdateMembershipsScenario.__contact_type[network]
        self.old = old_membership
        self.new = new_membership
        self.state = state

        # We keep a trace of what changes are actually done to pass it through
        # the callback or the errback so that the executor of the scenario can
        # update the memberships property of the contact.
        self.__done = old_membership

        # Subscription to the REVERSE or ALLOW lists can only occur when the
        # contact is member of the PENDING list, so when a subscription to the
        # REVERSE or ALLOW membership is detected, we delay the eventual deletion
        # from the PENDING membership list.
        self.__late_pending_delete = False
コード例 #2
0
    def __init__(self,
                 ab,
                 callback,
                 errback,
                 account='',
                 network_id=NetworkID.MSN,
                 memberships=Membership.NONE,
                 contact_type=ContactType.REGULAR,
                 contact_info={},
                 invite_display_name='',
                 invite_message=''):
        """Adds a messenger contact and updates the address book.

            @param ab: the address book service
            @param callback: tuple(callable, *args)
            @param errback: tuple(callable, *args)"""
        BaseScenario.__init__(self, Scenario.CONTACT_SAVE, callback, errback)

        self._ab = ab

        self.account = account
        self.network_id = network_id

        self.contact_type = contact_type
        self.contact_info = contact_info

        self.invite_display_name = invite_display_name
        self.invite_message = invite_message
        self.auto_manage_allow_list = True
        self.memberships = memberships
コード例 #3
0
    def __init__(self, ab, callback, errback,
                 account='',
                 network_id=NetworkID.MSN,
                 memberships=Membership.NONE,
                 contact_type=ContactType.REGULAR,
                 contact_info={},
                 invite_display_name='',
                 invite_message=''):
        """Adds a messenger contact and updates the address book.

            @param ab: the address book service
            @param callback: tuple(callable, *args)
            @param errback: tuple(callable, *args)"""
        BaseScenario.__init__(self, Scenario.CONTACT_SAVE, callback, errback)

        self._ab = ab

        self.account = account
        self.network_id = network_id

        self.contact_type = contact_type
        self.contact_info = contact_info

        self.invite_display_name = invite_display_name
        self.invite_message = invite_message
        self.auto_manage_allow_list = True
        self.memberships = memberships
コード例 #4
0
    def __init__(self, sharing, callback, errback):
        """Checks the pending invitations.

            @param sharing: the membership service
            @param callback: tuple(callable, *args)
            @param errback: tuple(callable, *args)
        """
        BaseScenario.__init__(self, Scenario.MESSENGER_PENDING_LIST, callback, errback)
        self.__sharing = sharing
コード例 #5
0
ファイル: contact_find.py プロジェクト: lppedd/papyon
    def __init__(self, ab, callback, errback, scenario, id=''):
        """Updates contact memberships.

           @type scenario: L{Scenario<papyon.service.AddressBook.scenario.base.Scenario>}
           @type account: account name of the contact to find
        """
        BaseScenario.__init__(self, scenario, callback, errback)
        self.__ab = ab

        self.id = id
コード例 #6
0
ファイル: check_pending_invite.py プロジェクト: lppedd/papyon
    def __init__(self, sharing, callback, errback):
        """Checks the pending invitations.

            @param sharing: the membership service
            @param callback: tuple(callable, *args)
            @param errback: tuple(callable, *args)
        """
        BaseScenario.__init__(self, Scenario.MESSENGER_PENDING_LIST, callback,
                              errback)
        self.__sharing = sharing
コード例 #7
0
    def __init__(self, ab, callback, errback, email_address="", contact_info={}):
        """Adds a mail contact and updates the address book.

            @param ab: the adress book service
            @param callback: tuple(callable, *args)
            @param errback: tuple(callable, *args)"""
        BaseScenario.__init__(self, Scenario.CONTACT_SAVE, callback, errback)
        self.__ab = ab

        self.__email_address = email_address
        self.__contact_info = contact_info
コード例 #8
0
ファイル: group_add.py プロジェクト: snowpunk/papyon
    def __init__(self, ab, callback, errback, group_name=''):
        """Adds a group to the address book.

            @param ab: the address book service
            @param callback: tuple(callable, *args)
            @param errback: tuple(callable, *args)
            @param group_name: the name of the new group"""
        BaseScenario.__init__(self, 'GroupSave', callback, errback)
        self.__ab = ab

        self.group_name = group_name
コード例 #9
0
    def __init__(self, ab, callback, errback, group_name=''):
        """Adds a group to the address book.

            @param ab: the address book service
            @param callback: tuple(callable, *args)
            @param errback: tuple(callable, *args)
            @param group_name: the name of the new group"""
        BaseScenario.__init__(self, 'GroupSave', callback, errback)
        self.__ab = ab

        self.group_name = group_name
コード例 #10
0
ファイル: contact_delete.py プロジェクト: DarKprince/emesene2
    def __init__(self, ab, callback, errback, contact_guid=''):
        """Deletes a contact from the address book.

            @param ab: the address book service
            @param callback: tuple(callable, *args)
            @param errback: tuple(callable, *args)
            @param contact_guid: the guid of the contact to delete"""
        BaseScenario.__init__(self, Scenario.TIMER, callback, errback)
        self.__ab = ab

        self.contact_guid = contact_guid
コード例 #11
0
ファイル: group_delete.py プロジェクト: DarKprince/emesene2
    def __init__(self, ab, callback, errback, group_guid=''):
        """Deletes a group from the address book.

            @param ab: the address book service
            @param callback: tuple(callable, *args)
            @param errback: tuple(callable, *args)
            @param group_guid: the guid of the group to delete"""
        BaseScenario.__init__(self, 'GroupSave', callback, errback)
        self.__ab = ab

        self.group_guid = group_guid
コード例 #12
0
    def __init__(self, ab, callback, errback, contact_guid=''):
        """Deletes a contact from the address book.

            @param ab: the address book service
            @param callback: tuple(callable, *args)
            @param errback: tuple(callable, *args)
            @param contact_guid: the guid of the contact to delete"""
        BaseScenario.__init__(self, Scenario.TIMER, callback, errback)
        self.__ab = ab

        self.contact_guid = contact_guid
コード例 #13
0
ファイル: group_delete.py プロジェクト: lppedd/papyon
    def __init__(self, ab, callback, errback, group_guid=''):
        """Deletes a group from the address book.

            @param ab: the address book service
            @param callback: tuple(callable, *args)
            @param errback: tuple(callable, *args)
            @param group_guid: the guid of the group to delete"""
        BaseScenario.__init__(self, 'GroupSave', callback, errback)
        self.__ab = ab

        self.group_guid = group_guid
コード例 #14
0
ファイル: mobile_contact_add.py プロジェクト: snowpunk/papyon
    def __init__(self, ab, callback, errback, 
                 phone_number="", contact_info={}):
        """Adds a mobile contact and updates the address book.

            @param ab: the adress book service
            @param callback: tuple(callable, *args)
            @param errback: tuple(callable, *args)"""
        BaseScenario.__init__(self, Scenario.MOBILE_CONTACT_MSGR_API, callback, errback)
        self.__ab = ab

        self.__phone_number = phone_number
        self.__contact_info = contact_info
コード例 #15
0
    def __init__(self, ab, callback, errback,
                 phone_number="", contact_info={}):
        """Adds a mobile contact and updates the address book.

            @param ab: the adress book service
            @param callback: tuple(callable, *args)
            @param errback: tuple(callable, *args)"""
        BaseScenario.__init__(self, Scenario.MOBILE_CONTACT_MSGR_API, callback, errback)
        self.__ab = ab

        self.__phone_number = phone_number
        self.__contact_info = contact_info
コード例 #16
0
ファイル: group_rename.py プロジェクト: snowpunk/papyon
    def __init__(self, ab, callback, errback, group_guid='', group_name=''):
        """Renames a group to the address book.

            @param ab: the address book service
            @param callback: tuple(callable, *args)
            @param errback: tuple(callable, *args)
            @param group_guid: the guid of the group to rename
            @param group_name: the new name for the group"""
        BaseScenario.__init__(self, 'GroupSave', callback, errback)
        self.__ab = ab

        self.group_guid = group_guid
        self.group_name = group_name
コード例 #17
0
    def __init__(self, ab, callback, errback, group_guid='', contact_guid=''):
        """Adds a contact to a group.

            @param ab: the address book service
            @param callback: tuple(callable, *args)
            @param errback: tuple(callable, *args)
            @param group_guid: the guid of the group
            @param contact_guid: the guid of the contact to add to the group"""
        BaseScenario.__init__(self, 'GroupSave', callback, errback)
        self.__ab = ab

        self.group_guid = group_guid
        self.contact_guid = contact_guid
コード例 #18
0
    def __init__(self, ab, callback, errback, group_guid='', contact_guid=''):
        """Adds a contact to a group.

            @param ab: the address book service
            @param callback: tuple(callable, *args)
            @param errback: tuple(callable, *args)
            @param group_guid: the guid of the group
            @param contact_guid: the guid of the contact to add to the group"""
        BaseScenario.__init__(self, 'GroupSave', callback, errback)
        self.__ab = ab

        self.group_guid = group_guid
        self.contact_guid = contact_guid
コード例 #19
0
    def __init__(self, ab, callback, errback, group_guid='', group_name=''):
        """Renames a group to the address book.

            @param ab: the address book service
            @param callback: tuple(callable, *args)
            @param errback: tuple(callable, *args)
            @param group_guid: the guid of the group to rename
            @param group_name: the new name for the group"""
        BaseScenario.__init__(self, 'GroupSave', callback, errback)
        self.__ab = ab

        self.group_guid = group_guid
        self.group_name = group_name
コード例 #20
0
    def __init__(self, ab, callback, errback, contact_guid='',
                 contact_properties={}):
        """Updates a contact properties

            @param ab: the address book service
            @param callback: tuple(callable, *args)
            @param errback: tuple(callable, *args)
            @param contact_guid: the guid of the contact to update"""
        BaseScenario.__init__(self, Scenario.CONTACT_SAVE, callback, errback)
        self.__ab = ab

        self.contact_guid = contact_guid
        self.contact_properties = contact_properties
        self.enable_allow_list_management = False
コード例 #21
0
ファイル: initial_sync.py プロジェクト: lppedd/papyon
    def __init__(self, address_book, membership, callback, errback, account=''):
        """Synchronizes the membership content when logging in.

            @param membership: the address book service
            @param callback: tuple(callable, *args)
            @param errback: tuple(callable, *args)
        """
        BaseScenario.__init__(self, 'Initial', callback, errback)
        self.__membership = membership
        self.__address_book = address_book

        self.__membership_response = None
        self.__ab_response = None
        self.__creating_ab = False

        self.__account = account
コード例 #22
0
ファイル: email_contact_add.py プロジェクト: stlcours/emesene
    def __init__(self,
                 ab,
                 callback,
                 errback,
                 email_address="",
                 contact_info={}):
        """Adds a mail contact and updates the address book.

            @param ab: the adress book service
            @param callback: tuple(callable, *args)
            @param errback: tuple(callable, *args)"""
        BaseScenario.__init__(self, Scenario.CONTACT_SAVE, callback, errback)
        self.__ab = ab

        self.__email_address = email_address
        self.__contact_info = contact_info
コード例 #23
0
    def __init__(self, sharing, callback, errback, account='',
                 network=NetworkID.MSN, membership=Membership.NONE,
                 state='Accepted'):
        """Unblocks a contact.

            @param sharing: the membership service
            @param callback: tuple(callable, *args)
            @param errback: tuple(callable, *args)
        """
        BaseScenario.__init__(self, Scenario.BLOCK_UNBLOCK, callback, errback)
        self.__sharing = sharing

        self.account = account
        self.network = network
        self.membership = membership
        self.state = state
コード例 #24
0
    def __init__(self, address_book, sharing, callback, errback, account=''):
        """Synchronizes the membership content when logging in.

            @param address_book: the address book service
            @param sharing: the sharging service
            @param callback: tuple(callable, *args)
            @param errback: tuple(callable, *args)
        """
        BaseScenario.__init__(self, 'Initial', callback, errback)
        self.__address_book = address_book
        self.__sharing = sharing

        self.__membership_response = None
        self.__ab_response = None

        self.__account = account
コード例 #25
0
    def __init__(self, sharing, callback, errback, account='',
                 network=NetworkID.MSN, memberships=Membership.NONE,
                 state='Accepted', block=True):
        """Declines an invitation.

            @param sharing: the membership service
            @param callback: tuple(callable, *args)
            @param errback: tuple(callable, *args)
        """
        BaseScenario.__init__(self, Scenario.TIMER, callback, errback)
        self.__sharing = sharing

        self.account = account
        self.network = network
        self.memberships = memberships
        self.state = state
        self.block = block
コード例 #26
0
ファイル: accept_invite.py プロジェクト: AmiZya/emesene
    def __init__(self, sharing, callback, errback,
                 account='',
                 memberships=Membership.NONE,
                 network=NetworkID.MSN):
        """Accepts an invitation.

            @param sharing: the membership service
            @param callback: tuple(callable, *args)
            @param errback: tuple(callable, *args)
            @param account: str
            @param memberships: int
            @param network: int
        """
        BaseScenario.__init__(self, Scenario.CONTACT_MSGR_API, callback, errback)
        self.__sharing = sharing
        self.account = account
        self.memberships = memberships
        self.network = network
コード例 #27
0
    def __init__(self,
                 ab,
                 callback,
                 errback,
                 contact_guid='',
                 contact_properties={}):
        """Updates a contact properties

            @param ab: the address book service
            @param callback: tuple(callable, *args)
            @param errback: tuple(callable, *args)
            @param contact_guid: the guid of the contact to update"""
        BaseScenario.__init__(self, Scenario.CONTACT_SAVE, callback, errback)
        self.__ab = ab

        self.contact_guid = contact_guid
        self.contact_properties = contact_properties
        self.enable_allow_list_management = False
コード例 #28
0
    def __init__(self, ab, callback, errback, account='', 
                 network_id=NetworkID.EXTERNAL, contact_info={},
                 invite_display_name='', invite_message=''):
        """Adds an external messenger contact and updates the address book.

            @param ab: the address book service
            @param callback: tuple(callable, *args)
            @param errback: tuple(callable, *args)"""
        BaseScenario.__init__(self, Scenario.CONTACT_MSGR_API, callback, errback)

        self._ab = ab

        self.account = account 
        self.network_id = network_id
        self.contact_info = contact_info

        self.invite_display_name = invite_display_name
        self.invite_message = invite_message
コード例 #29
0
ファイル: sync.py プロジェクト: stlcours/emesene
    def __init__(self,
                 address_book,
                 sharing,
                 callback,
                 errback,
                 delta_only=False):
        """Synchronizes the membership content when logging in.

            @param address_book: the address book service
            @param sharing: the sharging service
            @param callback: tuple(callable, *args)
            @param errback: tuple(callable, *args)
        """
        BaseScenario.__init__(self, 'Initial', callback, errback)
        self.__address_book = address_book
        self.__sharing = sharing

        self.__membership_response = None
        self.__ab_response = None

        self.__delta_only = delta_only
コード例 #30
0
ファイル: accept_invite.py プロジェクト: stlcours/emesene
    def __init__(self,
                 sharing,
                 callback,
                 errback,
                 account='',
                 memberships=Membership.NONE,
                 network=NetworkID.MSN):
        """Accepts an invitation.

            @param sharing: the membership service
            @param callback: tuple(callable, *args)
            @param errback: tuple(callable, *args)
            @param account: str
            @param memberships: int
            @param network: int
        """
        BaseScenario.__init__(self, Scenario.CONTACT_MSGR_API, callback,
                              errback)
        self.__sharing = sharing
        self.account = account
        self.memberships = memberships
        self.network = network
コード例 #31
0
    def __init__(self, ab, sharing, callback, errback,
                 account='',
                 memberships=Membership.NONE,
                 network=NetworkID.MSN,
                 state='Accepted'):
        """Accepts an invitation.

            @param ab: the address book service
            @param sharing: the membership service
            @param callback: tuple(callable, *args)
            @param errback: tuple(callable, *args)
        """
        BaseScenario.__init__(self, Scenario.CONTACT_MSGR_API, callback, errback)
        self.__ab = ab
        self.__sharing = sharing

        self.add_to_contact_list = True

        self.account = account
        self.memberships = memberships
        self.network = network
        self.state = state
コード例 #32
0
    def __init__(self, ab, sharing, callback, errback,
                 account='',
                 memberships=Membership.NONE,
                 network=NetworkID.MSN,
                 state='Accepted'):
        """Accepts an invitation.

            @param ab: the address book service
            @param sharing: the membership service
            @param callback: tuple(callable, *args)
            @param errback: tuple(callable, *args)
        """
        BaseScenario.__init__(self, Scenario.CONTACT_MSGR_API, callback, errback)
        self.__ab = ab
        self.__sharing = sharing

        self.add_to_contact_list = True

        self.account = account
        self.memberships = memberships
        self.network = network
        self.state = state
コード例 #33
0
ファイル: decline_invite.py プロジェクト: lppedd/papyon
    def __init__(self,
                 sharing,
                 callback,
                 errback,
                 account='',
                 network=NetworkID.MSN,
                 memberships=Membership.NONE,
                 state='Accepted',
                 block=True):
        """Declines an invitation.

            @param sharing: the membership service
            @param callback: tuple(callable, *args)
            @param errback: tuple(callable, *args)
        """
        BaseScenario.__init__(self, Scenario.TIMER, callback, errback)
        self.__sharing = sharing

        self.account = account
        self.network = network
        self.memberships = memberships
        self.state = state
        self.block = block