def test_xhtmlparsing_and_textify(self): text_plain, node = build_text_html_message_pair( '<html><body>Message</body></html>') self.assertEqual(text_plain, 'Message') self.assertEqual(node.tag, 'html') self.assertEqual(node.getchildren()[0].tag, 'body') self.assertEqual(node.getchildren()[0].text, 'Message')
def test_xhtmlparsing_and_textify(self): text_plain, node = build_text_html_message_pair( "<html><body>Message</body></html>") self.assertEqual(text_plain, "Message") self.assertEqual(node.tag, "html") self.assertEqual(node.getchildren()[0].tag, "body") self.assertEqual(node.getchildren()[0].text, 'Message')
def send_message(self, mess): msg_func = self.send_private_message if mess.typ == 'chat' else self.send_public_message if mess.typ == 'chat' and mess.getTo().resource: # if this is a response in private of a public message take the recipient in the resource instead of the incoming chatroom to = mess.getTo().resource else: to = mess.getTo().node for line in build_text_html_message_pair(mess.getBody())[0].split('\n'): msg_func(to, line)
def send_message(self, mess): super(IRCBackend, self).send_message(mess) if mess.type == 'chat': msg_func = self.conn.send_private_message msg_to = mess.to.person else: msg_func = self.conn.send_public_message msg_to = mess.to.room for line in build_text_html_message_pair(mess.body)[0].split('\n'): msg_func(msg_to, line)
def send_message(self, mess): super(IRCBackend, self).send_message(mess) msg_func = self.conn.send_private_message if mess.type == 'chat' else self.conn.send_public_message # If this is a response in private of a public message take the recipient in # the resource instead of the incoming chatroom if mess.type == 'chat' and mess.to.resource: to = mess.to.resource else: to = mess.to.node for line in build_text_html_message_pair(mess.body)[0].split('\n'): msg_func(to, line)
def send_message(self, mess): super(IRCBackend, self).send_message(mess) msg_func = self.conn.send_private_message if mess.type == 'chat' else self.conn.send_public_message # If this is a response in private of a public message take the recipient in # the resource instead of the incoming chatroom if mess.type == 'chat' and mess.to.resource: to = mess.to.resource else: to = mess.to.node for line in build_text_html_message_pair(mess.body)[0].split('\n'): msg_func(to, line)
def build_message(self, text): txt, node = build_text_html_message_pair(text) msg = Message(txt, html=node) if node else Message(txt) msg.frm = self.jid return msg # rebuild a pure html snippet to include directly in the console html
def build_message(self, text): txt, node = build_text_html_message_pair(utf8(text)) msg = Message(txt, html=node) if node else Message(txt) msg.setFrom(self.jid) return msg # rebuild a pure html snippet to include directly in the console html
def test_xhtmlparsing_and_textify(self): text_plain, node = build_text_html_message_pair("<html><body>Message</body></html>") self.assertEqual(text_plain, "Message") self.assertEqual(node.tag, "html") self.assertEqual(node.getchildren()[0].tag, "body") self.assertEqual(node.getchildren()[0].text, 'Message')
def test_xhtmlparsing_and_textify(self): text_plain, node = build_text_html_message_pair('<html><body>Message</body></html>') self.assertEqual(text_plain, 'Message') self.assertEqual(node.tag, 'html') self.assertEqual(node.getchildren()[0].tag, 'body') self.assertEqual(node.getchildren()[0].text, 'Message')
def build_message(self, text): text, html = build_text_html_message_pair(text) return Message(text, html=html)
def build_message(self, text): txt, node = build_text_html_message_pair(text) msg = Message(txt, html=node) if node else Message(txt) msg.frm = self.bot_identifier return msg # rebuild a pure html snippet to include directly in the console html
def build_message(self, text): text, html = build_text_html_message_pair(text) return Message(text, html=html)