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)
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"])
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)
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
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'])