当前位置: 首页>>代码示例>>Python>>正文


Python FilesProp.getFilePropBySid方法代码示例

本文整理汇总了Python中common.file_props.FilesProp.getFilePropBySid方法的典型用法代码示例。如果您正苦于以下问题:Python FilesProp.getFilePropBySid方法的具体用法?Python FilesProp.getFilePropBySid怎么用?Python FilesProp.getFilePropBySid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在common.file_props.FilesProp的用法示例。


在下文中一共展示了FilesProp.getFilePropBySid方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: OpenStream

# 需要导入模块: from common.file_props import FilesProp [as 别名]
# 或者: from common.file_props.FilesProp import getFilePropBySid [as 别名]
 def OpenStream(self, sid, to, fp, blocksize=4096):
     """
     Start new stream. You should provide stream id 'sid', the endpoind jid
     'to', the file object containing info for send 'fp'. Also the desired
     blocksize can be specified.
     Take into account that recommended stanza size is 4k and IBB uses
     base64 encoding that increases size of data by 1/3.
     """
     if not nbxmpp.JID(to).getResource():
         return
     file_props = FilesProp.getFilePropBySid(sid)
     file_props.direction = '|>' + to
     file_props.block_size = blocksize
     file_props.fp = fp
     file_props.seq = 0
     file_props.error = 0
     file_props.paused = False
     file_props.received_len = 0
     file_props.last_time = time.time()
     file_props.connected = True
     file_props.completed = False
     file_props.disconnect_cb = None
     file_props.continue_cb = None
     syn = nbxmpp.Protocol('iq', to, 'set', payload=[nbxmpp.Node(
         nbxmpp.NS_IBB + ' open', {'sid': file_props.transport_sid,
         'block-size': blocksize, 'stanza': 'iq'})])
     self.connection.send(syn)
     file_props.syn_id = syn.getID()
     return file_props
开发者ID:jabber-at,项目名称:gajim,代码行数:31,代码来源:bytestream.py

示例2: _result_socks5_sid

# 需要导入模块: from common.file_props import FilesProp [as 别名]
# 或者: from common.file_props.FilesProp import getFilePropBySid [as 别名]
 def _result_socks5_sid(self, sid, hash_id):
     """
     Store the result of SHA message from auth
     """
     file_props = FilesProp.getFilePropBySid(sid)
     file_props.hash_ = hash_id
     return
开发者ID:jabber-at,项目名称:gajim,代码行数:9,代码来源:bytestream.py

示例3: _ResultCB

# 需要导入模块: from common.file_props import FilesProp [as 别名]
# 或者: from common.file_props.FilesProp import getFilePropBySid [as 别名]
 def _ResultCB(self, con, iq_obj):
     # if we want to respect xep-0065 we have to check for proxy
     # activation result in any result iq
     real_id = unicode(iq_obj.getAttr('id'))
     if not real_id.startswith('au_'):
         return
     frm = self._ft_get_from(iq_obj)
     id_ = real_id[3:]
     file_props = FilesProp.getFilePropBySid(id_)
     if file_props.streamhost_used:
         for host in file_props.proxyhosts:
             if host['initiator'] == frm and 'idx' in host:
                 gajim.socks5queue.activate_proxy(host['idx'])
                 raise nbxmpp.NodeProcessed
开发者ID:jabber-at,项目名称:gajim,代码行数:16,代码来源:bytestream.py

示例4: _bytestreamErrorCB

# 需要导入模块: from common.file_props import FilesProp [as 别名]
# 或者: from common.file_props.FilesProp import getFilePropBySid [as 别名]
 def _bytestreamErrorCB(self, con, iq_obj):
     id_ = unicode(iq_obj.getAttr('id'))
     frm = helpers.get_full_jid_from_iq(iq_obj)
     query = iq_obj.getTag('query')
     gajim.proxy65_manager.error_cb(frm, query)
     jid = helpers.get_jid_from_iq(iq_obj)
     id_ = id_[3:]
     file_props = FilesProp.getFilePropBySid(id_)
     if not file_props:
         return
     file_props.error = -4
     from common.connection_handlers_events import FileRequestErrorEvent
     gajim.nec.push_incoming_event(FileRequestErrorEvent(None, conn=self,
         jid=jid, file_props=file_props, error_msg=''))
     raise nbxmpp.NodeProcessed
开发者ID:jabber-at,项目名称:gajim,代码行数:17,代码来源:bytestream.py

示例5: _bytestreamSetCB

# 需要导入模块: from common.file_props import FilesProp [as 别名]
# 或者: from common.file_props.FilesProp import getFilePropBySid [as 别名]
    def _bytestreamSetCB(self, con, iq_obj):
        target = iq_obj.getAttr('to')
        id_ = iq_obj.getAttr('id')
        query = iq_obj.getTag('query')
        sid = query.getAttr('sid')
        file_props = FilesProp.getFileProp(self.name, sid)
        streamhosts = []
        for item in query.getChildren():
            if item.getName() == 'streamhost':
                host_dict = {
                        'state': 0,
                        'target': target,
                        'id': id_,
                        'sid': sid,
                        'initiator': self._ft_get_from(iq_obj)
                }
                for attr in item.getAttrs():
                    host_dict[attr] = item.getAttr(attr)
                if 'host' not in host_dict:
                    continue
                if 'jid' not in host_dict:
                    continue
                if 'port' not in host_dict:
                    continue
                streamhosts.append(host_dict)
        file_props = FilesProp.getFilePropBySid(sid)
        if file_props is not None:
            if file_props.type_ == 's': # FIXME: remove fast xmlns
                # only psi do this
                if file_props.streamhosts:
                    file_props.streamhosts.extend(streamhosts)
                else:
                    file_props.streamhosts = streamhosts
                gajim.socks5queue.connect_to_hosts(self.name, sid,
                        self.send_success_connect_reply, None)
                raise nbxmpp.NodeProcessed
        else:
            log.warning('Gajim got streamhosts for unknown transfer. Ignoring it.')
            raise nbxmpp.NodeProcessed

        file_props.streamhosts = streamhosts
        def _connection_error(sid):
            self._connect_error(sid, 'item-not-found', 'cancel',
                msg='Could not connect to given hosts')
        if file_props.type_ == 'r':
            gajim.socks5queue.connect_to_hosts(self.name, sid,
                    self.send_success_connect_reply, _connection_error)
        raise nbxmpp.NodeProcessed
开发者ID:gajim,项目名称:gajim,代码行数:50,代码来源:bytestream.py


注:本文中的common.file_props.FilesProp.getFilePropBySid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。