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


Python IQ.addElement方法代码示例

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


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

示例1: getStats

# 需要导入模块: from twisted.words.protocols.jabber.client import IQ [as 别名]
# 或者: from twisted.words.protocols.jabber.client.IQ import addElement [as 别名]
	def getStats(self, jid = "icq.netlab.cz"):
		iq = IQ(self.xmlstream, "get")
		iq['to'] = jid
		iq.addElement(("http://jabber.org/protocol/stats", "query"))

		iq.addCallback(self._statsReceived)
		iq.send()
开发者ID:mikerCZ,项目名称:spectrum,代码行数:9,代码来源:stats.py

示例2: sync_stream

# 需要导入模块: from twisted.words.protocols.jabber.client import IQ [as 别名]
# 或者: from twisted.words.protocols.jabber.client.IQ import addElement [as 别名]
def sync_stream(q, xmpp_connection):
    """Used to ensure that Salut has processed all stanzas sent to it on this
       xmpp_connection."""

    iq = IQ(None, "get")
    iq.addElement(('http://jabber.org/protocol/disco#info', 'query'))
    xmpp_connection.send(iq)
    q.expect('stream-iq', query_ns='http://jabber.org/protocol/disco#info')
开发者ID:freedesktop-unofficial-mirror,项目名称:telepathy__telepathy-salut,代码行数:10,代码来源:saluttest.py

示例3: invalid_user

# 需要导入模块: from twisted.words.protocols.jabber.client import IQ [as 别名]
# 或者: from twisted.words.protocols.jabber.client.IQ import addElement [as 别名]
    def invalid_user(self, xs):
        iq = IQ(self.xmlstream, "set")
        iq.addElement(("jabber:iq:register", "query"))
        iq.query.addElement("username", content = self.jid.user)
        iq.query.addElement("password", content = self.password)

        iq.addCallback(self._registerResultEvent)

        iq.send()
开发者ID:Svedrin,项目名称:spectrum,代码行数:11,代码来源:tests.py

示例4: make_result_iq

# 需要导入模块: from twisted.words.protocols.jabber.client import IQ [as 别名]
# 或者: from twisted.words.protocols.jabber.client.IQ import addElement [as 别名]
def make_result_iq(iq):
    result = IQ(None, "result")
    result["id"] = iq["id"]
    query = iq.firstChildElement()

    if query:
        result.addElement((query.uri, query.name))

    return result
开发者ID:freedesktop-unofficial-mirror,项目名称:telepathy__telepathy-salut,代码行数:11,代码来源:saluttest.py

示例5: sync_stream

# 需要导入模块: from twisted.words.protocols.jabber.client import IQ [as 别名]
# 或者: from twisted.words.protocols.jabber.client.IQ import addElement [as 别名]
def sync_stream(q, stream):
    """Used to ensure that Gabble has processed all stanzas sent to it."""

    iq = IQ(stream, "get")
    id = iq['id']
    iq.addElement(('http://jabber.org/protocol/disco#info', 'query'))
    stream.send(iq)
    q.expect('stream-iq', query_ns='http://jabber.org/protocol/disco#info',
        predicate=(lambda event:
            event.stanza['id'] == id and event.iq_type == 'result'))
开发者ID:Thaodan,项目名称:telepathy-gabble,代码行数:12,代码来源:gabbletest.py

示例6: authenticated

# 需要导入模块: from twisted.words.protocols.jabber.client import IQ [as 别名]
# 或者: from twisted.words.protocols.jabber.client.IQ import addElement [as 别名]
    def authenticated(self, xs):

        presence = domish.Element((None, 'presence'))
        xs.send(presence)

        iq = IQ(self.xmlstream, "set")
        iq.addElement(("jabber:iq:register", "query"))
        iq.query.addElement("remove")

        iq.addCallback(self._result)

        iq.send()
开发者ID:Svedrin,项目名称:spectrum,代码行数:14,代码来源:tests.py

示例7: make_result_iq

# 需要导入模块: from twisted.words.protocols.jabber.client import IQ [as 别名]
# 或者: from twisted.words.protocols.jabber.client.IQ import addElement [as 别名]
def make_result_iq(stream, iq, add_query_node=True):
    result = IQ(stream, "result")
    result["id"] = iq["id"]
    to = iq.getAttribute('to')
    if to is not None:
        result["from"] = to
    query = iq.firstChildElement()

    if query and add_query_node:
        result.addElement((query.uri, query.name))

    return result
开发者ID:Thaodan,项目名称:telepathy-gabble,代码行数:14,代码来源:gabbletest.py

示例8: registerAccount

# 需要导入模块: from twisted.words.protocols.jabber.client import IQ [as 别名]
# 或者: from twisted.words.protocols.jabber.client.IQ import addElement [as 别名]
    def registerAccount(self, username=None, password=None):
        if username:
            self.jid.user = username
        if password:
            self.password = password

        iq = IQ(self.xmlstream, "set")
        iq.addElement(("jabber:iq:register", "query"))
        iq.query.addElement("username", content=self.jid.user)
        iq.query.addElement("password", content=self.password)

        iq.addCallback(self._registerResultEvent)
        iq.send()
开发者ID:ecmanaged,项目名称:ecm-agent,代码行数:15,代码来源:core.py

示例9: authenticated

# 需要导入模块: from twisted.words.protocols.jabber.client import IQ [as 别名]
# 或者: from twisted.words.protocols.jabber.client.IQ import addElement [as 别名]
    def authenticated(self, xs):

        self.log.debug('Cloud Authenticated')
        presence = domish.Element((None, 'presence'))
        xs.send(presence)
        xs.addObserver('/presence', self.on_presence)
        xs.addObserver('/iq', self.on_iq)
        xs.addObserver('/message', self.on_event)
        disco = IQ(xs, 'get')
        disco.addElement(('http://jabber.org/protocol/disco#items', 'query'))
        disco.addCallback(self.cloud_discovered)
        disco.send()
#         self.reactor.callLater(120, xs.sendFooter)
        self.reactor.callLater(5, self.check_users)
开发者ID:bverdu,项目名称:onDemand,代码行数:16,代码来源:controller.py

示例10: _result2

# 需要导入模块: from twisted.words.protocols.jabber.client import IQ [as 别名]
# 或者: from twisted.words.protocols.jabber.client.IQ import addElement [as 别名]
    def _result2(self, iq):
        if iq['type'] != 'result':
            self.failed()
        query = iq.firstChildElement()
        if query.name != "query":
            self.failed()

        iq = IQ(self.xmlstream, "get")
        iq['to'] = transport
        iq.addElement(("jabber:iq:register", "query"))

        iq.addCallback(self._result3)

        iq.send()
开发者ID:Svedrin,项目名称:spectrum,代码行数:16,代码来源:tests.py

示例11: send_error_reply

# 需要导入模块: from twisted.words.protocols.jabber.client import IQ [as 别名]
# 或者: from twisted.words.protocols.jabber.client.IQ import addElement [as 别名]
def send_error_reply(stream, iq, error_stanza=None):
    result = IQ(stream, "error")
    result["id"] = iq["id"]
    query = iq.firstChildElement()
    to = iq.getAttribute('to')
    if to is not None:
        result["from"] = to

    if query:
        result.addElement((query.uri, query.name))

    if error_stanza:
        result.addChild(error_stanza)

    stream.send(result)
开发者ID:Thaodan,项目名称:telepathy-gabble,代码行数:17,代码来源:gabbletest.py

示例12: answer_error_to_pubsub_request

# 需要导入模块: from twisted.words.protocols.jabber.client import IQ [as 别名]
# 或者: from twisted.words.protocols.jabber.client.IQ import addElement [as 别名]
def answer_error_to_pubsub_request(stream, request):
    # look for node's name in the request
    items = xpath.queryForNodes('/iq/pubsub/items', request)[0]
    node = items['node']

    reply = IQ(stream, "error")
    reply['id'] = request['id']
    reply['from'] = request['to']
    pubsub = reply.addElement((ns.PUBSUB, 'pubsub'))
    items = pubsub.addElement((None, 'items'))
    items['node'] = node
    error = reply.addElement((None, 'error'))
    error['type'] = 'auth'
    error.addElement((ns.STANZA, 'not-authorized'))
    error.addElement(("%s#errors" % ns.PUBSUB, 'presence-subscription-required'))
    stream.send(reply)
开发者ID:Thaodan,项目名称:telepathy-gabble,代码行数:18,代码来源:util.py

示例13: test

# 需要导入模块: from twisted.words.protocols.jabber.client import IQ [as 别名]
# 或者: from twisted.words.protocols.jabber.client.IQ import addElement [as 别名]
def test(q, bus, conn, stream):
    # This sidecar sends a stanza, and waits for a reply, before being
    # created.
    pattern = EventPattern('stream-iq', to='sidecar.example.com',
        query_ns='http://example.com/sidecar')
    call_async(q, conn.Sidecars1, 'EnsureSidecar', TEST_PLUGIN_IFACE + ".IQ")
    e = q.expect_many(pattern)[0]

    # The server said yes, so we should get a sidecar back!
    acknowledge_iq(stream, e.stanza)
    q.expect('dbus-return', method='EnsureSidecar')

    identities = ["test/app-list//Test"]
    features = ["com.example.test1", "com.example.test2"]
    ver = compute_caps_hash(identities, features, {})

    iq = IQ(stream, "get")
    query = iq.addElement((ns.DISCO_INFO, 'query'))
    query['node'] = ns.GABBLE_CAPS + '#' + ver
    stream.send(iq)
    e = q.expect('stream-iq', query_ns='http://jabber.org/protocol/disco#info')

    returned_features = [feature['var']
        for feature in xpath.queryForNodes('/iq/query/feature', e.stanza)]
    assertEquals(features, returned_features)

    returned_identities = [identity['category'] + "/" + identity['type']+"//" + identity['name']
        for identity in xpath.queryForNodes('/iq/query/identity', e.stanza)]
    assertEquals(identities, returned_identities)

    new_ver = compute_caps_hash(returned_identities, returned_features, {})
    assertEquals(new_ver, ver)
开发者ID:Thaodan,项目名称:telepathy-gabble,代码行数:34,代码来源:sidecar-own-caps.py

示例14: __init__

# 需要导入模块: from twisted.words.protocols.jabber.client import IQ [as 别名]
# 或者: from twisted.words.protocols.jabber.client.IQ import addElement [as 别名]
    def __init__(self, iq: IQ):
        self.iq = iq

        # Create form element
        self.form = iq.addElement("x")
        self.form.attributes["xmlns"] = "jabber:x:data"
        self.form.attributes["type"] = "form"
开发者ID:vladamatena,项目名称:h2x,代码行数:9,代码来源:iq.py

示例15: _send_socks5_reply

# 需要导入模块: from twisted.words.protocols.jabber.client import IQ [as 别名]
# 或者: from twisted.words.protocols.jabber.client.IQ import addElement [as 别名]
 def _send_socks5_reply(self, id, stream_used):
     result = IQ(self.stream, 'result')
     result['id'] = id
     result['from'] = self.target
     result['to'] = self.initiator
     query = result.addElement((ns.BYTESTREAMS, 'query'))
     streamhost_used = query.addElement((None, 'streamhost-used'))
     streamhost_used['jid'] = stream_used
     result.send()
开发者ID:dfghj44444,项目名称:realxtend-naali-deps,代码行数:11,代码来源:bytestream.py


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