Пример #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')
Пример #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')
Пример #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)
Пример #4
0
Файл: irc.py Проект: 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)
Пример #5
0
 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)
Пример #6
0
Файл: irc.py Проект: 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)
Пример #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
Пример #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
Пример #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')
Пример #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')
Пример #11
0
 def build_message(self, text):
     text, html = build_text_html_message_pair(text)
     return Message(text, html=html)
Пример #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
Пример #13
0
 def build_message(self, text):
     text, html = build_text_html_message_pair(text)
     return Message(text, html=html)