Show
Ignore:
Timestamp:
07/18/08 22:24:34 (5 months ago)
Author:
js
Message:

Support for displaying XEP-0184 receipts.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/chat_control.py

    r9940 r9953  
    4646constants = Constants() 
    4747from common.rst_xhtml_generator import create_xhtml 
    48 from common.xmpp.protocol import NS_XHTML, NS_FILE, NS_MUC, NS_ESESSION 
     48from common.xmpp.protocol import NS_XHTML, NS_FILE, NS_MUC, NS_RECEIPTS, NS_ESESSION 
    4949 
    5050try: 
     
    661661        def print_conversation_line(self, text, kind, name, tim, 
    662662        other_tags_for_name=[], other_tags_for_time=[], other_tags_for_text=[], 
    663         count_as_new=True, subject=None, old_kind=None, xhtml=None, simple=False): 
     663        count_as_new=True, subject=None, old_kind=None, xhtml=None, simple=False, xep0184_id = None): 
    664664                '''prints 'chat' type messages''' 
    665665                jid = self.contact.jid 
     
    672672                        other_tags_for_name, other_tags_for_time, other_tags_for_text, 
    673673                        subject, old_kind, xhtml, simple=simple) 
     674 
     675                if xep0184_id is not None: 
     676                        textview.show_xep0184_warning(xep0184_id) 
    674677 
    675678                if not count_as_new: 
     
    15391542                                self._schedule_activity_timers() 
    15401543 
    1541                 if ChatControlBase.send_message(self, message, keyID, 
    1542                 type = 'chat', chatstate = chatstate_to_send, 
    1543                 composing_xep = composing_xep, 
    1544                 process_command = process_command): 
     1544                id = ChatControlBase.send_message(self, message, keyID, 
     1545                        type = 'chat', chatstate = chatstate_to_send, 
     1546                        composing_xep = composing_xep, 
     1547                        process_command = process_command) 
     1548                if id: 
     1549                        # XXX: Once we have fallback to disco, remove 
     1550                        #      notexistant check 
     1551                        if gajim.capscache.is_supported(contact, NS_RECEIPTS) \ 
     1552                        and not gajim.capscache.is_supported(contact, 
     1553                        'notexistant') and gajim.config.get_per('accounts', 
     1554                        self.account, 'request_receipt'): 
     1555                                xep0184_id = id 
     1556                        else: 
     1557                                xep0184_id = None 
     1558 
    15451559                        self.print_conversation(message, self.contact.jid, 
    1546                                 encrypted = encrypted) 
     1560                                encrypted = encrypted, xep0184_id = xep0184_id) 
    15471561 
    15481562        def check_for_possible_paused_chatstate(self, arg): 
     
    16301644 
    16311645        def print_conversation(self, text, frm='', tim=None, encrypted=False, 
    1632         subject=None, xhtml=None, simple=False): 
     1646        subject=None, xhtml=None, simple=False, xep0184_id=None): 
    16331647                # TODO: contact? ITYM frm. 
    16341648                '''Print a line in the conversation: 
     
    16841698                ChatControlBase.print_conversation_line(self, text, kind, name, tim, 
    16851699                        subject=subject, old_kind=self.old_msg_kind, xhtml=xhtml, 
    1686                         simple=simple) 
     1700                        simple=simple, xep0184_id=xep0184_id) 
    16871701                if text.startswith('/me ') or text.startswith('/me\n'): 
    16881702                        self.old_msg_kind = None