コード例 #1
0
ファイル: bot.py プロジェクト: forcemain/Ludolph
 def msg_send(self, mto, mbody, mfrom=None, mnick=None, **kwargs):
     """
     Create message and send it.
     """
     return OutgoingLudolphMessage.create(mbody, **kwargs).send(self,
                                                                mto,
                                                                mfrom=mfrom,
                                                                mnick=mnick)
コード例 #2
0
ファイル: bot.py プロジェクト: erigones/Ludolph
    def msg_resend(self, msg, **kwargs):
        """
        Re-send message to original recipient with optional delay.
        """
        defaults = {"mtype": msg.get("mtype", None), "msubject": msg.get("subject", None)}
        defaults.update(kwargs)

        return OutgoingLudolphMessage.create(msg["body"], **kwargs).send(self, msg["from"], mfrom=msg["to"])
コード例 #3
0
ファイル: bot.py プロジェクト: erigones/Ludolph
    def msg_reply(self, msg, mbody, preserve_msg=False, **kwargs):
        """
        Set message reply text and html, and send it.
        """
        if mbody is None:
            return None  # Command performs custom message sending

        if preserve_msg:
            msg = self.msg_copy(msg)

        return OutgoingLudolphMessage.create(mbody, **kwargs).reply(msg)
コード例 #4
0
ファイル: bot.py プロジェクト: forcemain/Ludolph
    def msg_reply(self, msg, mbody, preserve_msg=False, **kwargs):
        """
        Set message reply text and html, and send it.
        """
        if mbody is None:
            return None  # Command performs custom message sending

        if preserve_msg:
            msg = self.msg_copy(msg)

        return OutgoingLudolphMessage.create(mbody, **kwargs).reply(msg)
コード例 #5
0
ファイル: bot.py プロジェクト: erigones/Ludolph
    def msg_broadcast(self, mbody, **kwargs):
        """
        Send message to all users in roster.
        """
        msg = OutgoingLudolphMessage.create(mbody, **kwargs)
        i = 0

        for jid in self.client_roster:
            if not (jid == self.boundjid.bare or jid in self.broadcast_blacklist):
                msg.send(self, jid)
                i += 1

        return i
コード例 #6
0
ファイル: bot.py プロジェクト: forcemain/Ludolph
    def msg_broadcast(self, mbody, **kwargs):
        """
        Send message to all users in roster.
        """
        msg = OutgoingLudolphMessage.create(mbody, **kwargs)
        i = 0

        for jid in self.client_roster:
            if not (jid == self.boundjid.bare
                    or jid in self.broadcast_blacklist):
                msg.send(self, jid)
                i += 1

        return i
コード例 #7
0
ファイル: bot.py プロジェクト: forcemain/Ludolph
    def msg_resend(self, msg, **kwargs):
        """
        Re-send message to original recipient with optional delay.
        """
        defaults = {
            'mtype': msg.get('mtype', None),
            'msubject': msg.get('subject', None)
        }
        defaults.update(kwargs)

        return OutgoingLudolphMessage.create(msg['body'],
                                             **kwargs).send(self,
                                                            msg['from'],
                                                            mfrom=msg['to'])
コード例 #8
0
ファイル: bot.py プロジェクト: erigones/Ludolph
 def msg_send(self, mto, mbody, mfrom=None, mnick=None, **kwargs):
     """
     Create message and send it.
     """
     return OutgoingLudolphMessage.create(mbody, **kwargs).send(self, mto, mfrom=mfrom, mnick=mnick)