示例#1
0
    def incoming_message(self, buddy, message):
        from_jid = message.get_from()
        if from_jid != self.jid_to:
            self.reset_chat_states()
        self.jid_to = from_jid
        #self.message = message
        body = get_message_body(message)

        if body:
            stamp = get_message_timestamp(message)

            if stamp:
                did_receive = self.received_message(buddy,
                                                    body,
                                                    timestamp=stamp,
                                                    offline=True,
                                                    content_type='text/html')
            else:
                did_receive = self.received_message(buddy,
                                                    body,
                                                    content_type='text/html')

            if did_receive:
                Conversation.incoming_message(self)

        chatstate = self.get_message_chatstate(message, body)
        if chatstate is False:
            chatstate = None
            if pref('jabber.system_message.show_gone',
                    type=bool,
                    default=False):
                self.system_message(
                    _('{name} has left the conversation.').format(
                        name=from_jid))
        self.typing_status[buddy] = chatstate
示例#2
0
    def incoming_message(self, buddy, message):
        from_jid = message.get_from()
        if from_jid != self.jid_to:
            self.reset_chat_states()
        self.jid_to = from_jid
        #self.message = message
        body = get_message_body(message)

        if body:
            stamp = get_message_timestamp(message)

            if stamp:
                did_receive = self.received_message(buddy, body, timestamp = stamp, offline = True, content_type = 'text/html')
            else:
                did_receive = self.received_message(buddy, body, content_type = 'text/html')

            if did_receive:
                Conversation.incoming_message(self)

        chatstate = self.get_message_chatstate(message, body)
        if chatstate is False:
            chatstate = None
            if pref('jabber.system_message.show_gone', type=bool, default=False):
                self.system_message(_('{name} has left the conversation.').format(name=from_jid))
        self.typing_status[buddy] = chatstate
示例#3
0
    def incoming_message(self,
                         buddy,
                         message,
                         timestamp=None,
                         content_type='text/yahoortf'):
        if not isinstance(buddy, YahooBuddy):
            raise TypeError()

        # Convert formatting to HTML.
        if content_type == 'text/html':
            message = yahooformat.tohtml(message)
            message = yahooformat.fix_font_size(message)
        if content_type == 'text/yahoortf':
            message = yahooformat.tohtml(message.encode('xml'))
            content_type = 'text/html'

        # convert newlines
        message = newlines_to_brs(message)

        self.typing_status[buddy] = None

        if timestamp is None:
            kws = {}
        else:
            kws = dict(timestamp=timestamp)
        kws['content_type'] = content_type
        if self.received_message(buddy, message, **kws):
            Conversation.incoming_message(self)
示例#4
0
 def exit(self):
     if self.chat_states_allowed and pref('privacy.send_typing_notifications', False):
         m    = Message(to_jid = self.jid_to, stanza_type='chat')
         node = m.xmlnode
         ChatState('gone').as_xml(node)
         self.protocol.send_message(m)
     self.protocol.conversations.pop(self.id, None)
     Conversation.exit(self)
示例#5
0
 def exit(self):
     if self.chat_states_allowed and pref(
             'privacy.send_typing_notifications', False):
         m = Message(to_jid=self.jid_to, stanza_type='chat')
         node = m.xmlnode
         ChatState('gone').as_xml(node)
         self.protocol.send_message(m)
     self.protocol.conversations.pop(self.id, None)
     Conversation.exit(self)
示例#6
0
    def exit(self):
        buddies_to_notify_of_exit = []
        for buddy in self.other_buddies:
            buddies_to_notify_of_exit.extend([
                'conf_from', buddy.name])

        self.protocol.send('conflogoff', 'available', [
            'frombuddy', self.self_buddy.name,
            'conf_name', self.name,
            ] + buddies_to_notify_of_exit)

        Conversation.exit(self)
示例#7
0
    def exit(self):
        buddies_to_notify_of_exit = []
        for buddy in self.other_buddies:
            buddies_to_notify_of_exit.extend(['conf_from', buddy.name])

        self.protocol.send('conflogoff', 'available', [
            'frombuddy',
            self.self_buddy.name,
            'conf_name',
            self.name,
        ] + buddies_to_notify_of_exit)

        Conversation.exit(self)
示例#8
0
    def __init__(self, protocol, buddy, jid_to, thread=None):
        '''

        @param protocol:   a JabberProtocol Instance
        @param buddy:      the buddy you are talking to
        @param jid_to:     the jid you are talking to
        @param jid_from:   the jid you are talking from
        @param thread:     the thread id, if any (not yet used)
        '''

        if not isinstance(buddy, JabberBuddy.JabberBuddy):
            raise TypeError

        Conversation.__init__(self, protocol)
        self.buddy_to = buddy
        self.jid_to = jid_to
        #        self.jid_from = jid_from
        self.buddies = protocol.buddies
        self.thread = thread
        self.name = buddy.alias

        self.reset_chat_states()
示例#9
0
    def __init__(self, protocol, buddy, jid_to, thread=None):
        '''

        @param protocol:   a JabberProtocol Instance
        @param buddy:      the buddy you are talking to
        @param jid_to:     the jid you are talking to
        @param jid_from:   the jid you are talking from
        @param thread:     the thread id, if any (not yet used)
        '''

        if not isinstance(buddy, JabberBuddy.JabberBuddy):
            raise TypeError


        Conversation.__init__(self, protocol)
        self.buddy_to = buddy
        self.jid_to   = jid_to
#        self.jid_from = jid_from
        self.buddies  = protocol.buddies
        self.thread   = thread
        self.name     = buddy.alias

        self.reset_chat_states()
示例#10
0
    def incoming_message(self, buddy, message, timestamp = None, content_type = 'text/yahoortf'):
        if not isinstance(buddy, YahooBuddy):
            raise TypeError()

        # Convert formatting to HTML.
        if content_type == 'text/html':
            message = yahooformat.tohtml(message)
            message = yahooformat.fix_font_size(message)
        if content_type == 'text/yahoortf':
            message = yahooformat.tohtml(message.encode('xml'))
            content_type = 'text/html'

        # convert newlines
        message = newlines_to_brs(message)

        self.typing_status[buddy] = None

        if timestamp is None:
            kws = {}
        else:
            kws = dict(timestamp=timestamp)
        kws['content_type'] = content_type
        if self.received_message(buddy, message, **kws):
            Conversation.incoming_message(self)
示例#11
0
 def __init__(self, protocol):
     Conversation.__init__(self, protocol)
     self.__dict__.update(
         buddies = protocol.buddies,
         self_buddy = protocol.self_buddy)
示例#12
0
 def exit(self):
     self.protocol.exit_conversation(self)
     Conversation.exit(self)
示例#13
0
 def __init__(self, protocol):
     Conversation.__init__(self, protocol)
     self.__dict__.update(buddies=protocol.buddies,
                          self_buddy=protocol.self_buddy)
示例#14
0
 def exit(self):
     log.info('YahooChat exit: sending chatlogout_available')
     self.protocol.send('chatlogout', 'available', frombuddy = self.myname)
     Conversation.exit(self)
示例#15
0
 def exit(self):
     log.info('YahooChat exit: sending chatlogout_available')
     self.protocol.send('chatlogout', 'available', frombuddy=self.myname)
     Conversation.exit(self)
示例#16
0
 def exit(self):
     self.protocol.exit_conversation(self)
     Conversation.exit(self)
示例#17
0
 def __init__(self, irc):
     Conversation.__init__(self, irc)
     self.irc = irc
     self.buddies = irc.buddies
     self.cmds = irc.cmds
     self.self_buddy = self.irc.self_buddy
示例#18
0
 def exit(self):
     self.room_list[:] = []
     Conversation.exit(self)
示例#19
0
 def __init__(self, irc):
     Conversation.__init__(self, irc)
     self.irc = irc
     self.buddies = irc.buddies
     self.cmds = irc.cmds
     self.self_buddy = self.irc.self_buddy
示例#20
0
 def exit(self):
     self.room_list[:] = []
     Conversation.exit(self)