Exemplo n.º 1
0
 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')
Exemplo n.º 2
0
 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')
Exemplo n.º 3
0
 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)
Exemplo n.º 4
0
Arquivo: irc.py Projeto: edux/err
    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)
Exemplo n.º 5
0
Arquivo: irc.py Projeto: revcozmo/err
 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)
Exemplo n.º 6
0
Arquivo: irc.py Projeto: qznc/err
 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)
Exemplo n.º 7
0
 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
Exemplo n.º 8
0
 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
Exemplo n.º 9
0
 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')
Exemplo n.º 10
0
 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')
Exemplo n.º 11
0
 def build_message(self, text):
     text, html = build_text_html_message_pair(text)
     return Message(text, html=html)
Exemplo n.º 12
0
 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
Exemplo n.º 13
0
 def build_message(self, text):
     text, html = build_text_html_message_pair(text)
     return Message(text, html=html)