Example #1
0
    def __init__(self, session = None, obj = None, remote = None):
        if session is not None:
            # We're sending
            super(ObjectTransfer, self).__init__(session = session)
            self.msnObject = MSNObject.parse(self.P2PSession.Invitation.BodyValues['Context'].decode('b64').strip('\0'))
            if self.msnObject.type == '3':
                self.msnObject = self.client.self_buddy.msn_obj
                self.data_buffer = self.client.self_buddy.icon_path.open('rb')

            self.sending = True
            AppId = self.P2PSession.Invitation.BodyValues.get('AppID', None)
            if AppId is not None:
                self.AppId = int(AppId)

        else:
            super(ObjectTransfer, self).__init__(ver = remote.P2PVersionSupported, remote = remote, remoteEP = remote.SelectRandomEPID())
            self.msnObject = obj
            self.data_buffer = io.BytesIO()
            if obj.type == '3':
                self.AppId = 12

            self.sending = False
Example #2
0
    def ValidateInvitation(self, invite):
        ret = super(ObjectTransfer, self).ValidateInvitation(invite)
        if not ret:
            return ret

        return MSNObject.parse(invite.BodyValues['Context'].decode('b64').strip('\0')).type == '3'