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


Python StanzaBase.reply方法代码示例

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


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

示例1: reply

# 需要导入模块: from slixmpp.xmlstream import StanzaBase [as 别名]
# 或者: from slixmpp.xmlstream.StanzaBase import reply [as 别名]
    def reply(self, body=None, clear=True):
        """
        Create a message reply.

        Overrides StanzaBase.reply.

        Sets proper 'to' attribute if the message is from a MUC, and
        adds a message body if one is given.

        :param str body:  Optional text content for the message.
        :param bool clear: Indicates if existing content should be removed
                           before replying. Defaults to True.

        :rtype: :class:`~.Message`
        """
        new_message = StanzaBase.reply(self, clear)

        if self['type'] == 'groupchat':
            new_message['to'] = new_message['to'].bare

        new_message['thread'] = self['thread']
        new_message['parent_thread'] = self['parent_thread']

        del new_message['id']

        if body is not None:
            new_message['body'] = body
        return new_message
开发者ID:mathieui,项目名称:slixmpp,代码行数:30,代码来源:message.py

示例2: reply

# 需要导入模块: from slixmpp.xmlstream import StanzaBase [as 别名]
# 或者: from slixmpp.xmlstream.StanzaBase import reply [as 别名]
    def reply(self, clear=True):
        """
        Create a new <iq> stanza replying to ``self``.

        Overrides StanzaBase.reply

        Sets the 'type' to 'result' in addition to the default
        StanzaBase.reply behavior.

        :param bool clear: Indicates if existing content should be
                           removed before replying. Defaults to True.
        """
        new_iq = StanzaBase.reply(self, clear=clear)
        new_iq["type"] = "result"
        return new_iq
开发者ID:poezio,项目名称:slixmpp,代码行数:17,代码来源:iq.py

示例3: reply

# 需要导入模块: from slixmpp.xmlstream import StanzaBase [as 别名]
# 或者: from slixmpp.xmlstream.StanzaBase import reply [as 别名]
    def reply(self, clear=True):
        """
        Create a new reply <presence/> stanza from ``self``.

        Overrides StanzaBase.reply.

        :param bool clear: Indicates if the stanza contents should be removed
                           before replying. Defaults to True.
        """
        new_presence = StanzaBase.reply(self, clear)
        if self['type'] == 'unsubscribe':
            new_presence['type'] = 'unsubscribed'
        elif self['type'] == 'subscribe':
            new_presence['type'] = 'subscribed'
        return new_presence
开发者ID:mathieui,项目名称:slixmpp,代码行数:17,代码来源:presence.py


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