當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。