Changeset 8683

Show
Ignore:
Timestamp:
08/31/07 19:22:58 (15 months ago)
Author:
asterix
Message:

[misc] repare sending composing chatstates using xep instead of xep. Fix #3241.

Location:
branches/gajim_0.11.1/src
Files:
7 modified

Legend:

Unmodified
Added
Removed
  • branches/gajim_0.11.1/src/chat_control.py

    r8601 r8683  
    511511 
    512512        def send_message(self, message, keyID = '', type = 'chat', chatstate = None, 
    513         msg_id = None, composing_jep = None, resource = None): 
     513        msg_id = None, composing_xep = None, resource = None): 
    514514                '''Send the given message to the active tab. Doesn't return None if error 
    515515                ''' 
     
    521521                        ret = MessageControl.send_message(self, message, keyID, type = type, 
    522522                                chatstate = chatstate, msg_id = msg_id, 
    523                                 composing_jep = composing_jep, resource = resource, 
     523                                composing_xep = composing_xep, resource = resource, 
    524524                                user_nick = self.user_nick) 
    525525                        if ret: 
     
    10841084                        if contact.show == 'offline': 
    10851085                                chatstate = '' 
    1086                         elif contact.composing_jep == 'JEP-0085': 
     1086                        elif contact.composing_xep == 'XEP-0085': 
    10871087                                if st == 'all' or cs == 'composing': 
    10881088                                        chatstate = helpers.get_uf_chatstate(cs) 
    10891089                                else: 
    10901090                                        chatstate = '' 
    1091                         elif contact.composing_jep == 'JEP-0022': 
     1091                        elif contact.composing_xep == 'XEP-0022': 
    10921092                                if cs in ('composing', 'paused'): 
    10931093                                        # only print composing, paused 
     
    11611161                chatstates_on = gajim.config.get('outgoing_chat_state_notifications') != \ 
    11621162                        'disabled' 
    1163                 composing_jep = contact.composing_jep 
     1163                composing_xep = contact.composing_xep 
    11641164                chatstate_to_send = None 
    11651165                if chatstates_on and contact is not None: 
    1166                         if composing_jep is None: 
     1166                        if composing_xep is None: 
    11671167                                # no info about peer 
    11681168                                # send active to discover chat state capabilities 
     
    11701170                                # because we want it sent with REAL message 
    11711171                                # (not standlone) eg. one that has body 
    1172                                  
    1173                                 #FIXME: 
    1174                                 # Enable 3 next lines after 0.11 release. 
    1175                                 # Having this disabled violate xep85 5.1.2 but then we don't break 
    1176                                 # notifications between 0.10.1 and 0.11 See #2637 
    1177                                 # if contact.our_chatstate: 
    1178                                 #       # We already ask for xep 85, don't ask it twice 
    1179                                 #       composing_jep = 'asked_once' 
     1172 
     1173                                if contact.our_chatstate: 
     1174                                        # We already asked for xep 85, don't ask it twice 
     1175                                        composing_xep = 'asked_once' 
    11801176 
    11811177                                chatstate_to_send = 'active' 
     
    11831179                        # if peer supports jep85 and we are not 'ask', send 'active' 
    11841180                        # NOTE: first active and 'ask' is set in gajim.py 
    1185                         elif composing_jep is not False: 
     1181                        elif composing_xep is not False: 
    11861182                                #send active chatstate on every message (as JEP says) 
    11871183                                chatstate_to_send = 'active' 
     
    11931189                                 
    11941190                if not ChatControlBase.send_message(self, message, keyID, type = 'chat', 
    1195                 chatstate = chatstate_to_send, composing_jep = composing_jep): 
     1191                chatstate = chatstate_to_send, composing_xep = composing_xep): 
    11961192                        self.print_conversation(message, self.contact.jid, 
    11971193                                encrypted = encrypted) 
     
    14861482                        return 
    14871483 
    1488                 if contact.composing_jep is False: # jid cannot do jep85 nor jep22 
     1484                if contact.composing_xep is False: # jid cannot do xep85 nor xep22 
    14891485                        return 
    14901486 
     
    14941490                        return 
    14951491 
    1496                 if contact.composing_jep is None: 
     1492                if contact.composing_xep is None: 
    14971493                        # we don't know anything about jid, so return 
    14981494                        # NOTE: 
     
    15081504                # in JEP22, when we already sent stop composing 
    15091505                # notification on paused, don't resend it 
    1510                 if contact.composing_jep == 'JEP-0022' and \ 
     1506                if contact.composing_xep == 'XEP-0022' and \ 
    15111507                contact.our_chatstate in ('paused', 'active', 'inactive') and \ 
    15121508                state is not 'composing': # not composing == in (active, inactive, gone) 
     
    15301526 
    15311527                MessageControl.send_message(self, None, chatstate = state, 
    1532                         msg_id = contact.msg_id, composing_jep = contact.composing_jep) 
     1528                        msg_id = contact.msg_id, composing_xep = contact.composing_xep) 
    15331529                contact.our_chatstate = state 
    15341530                if contact.our_chatstate == 'active': 
  • branches/gajim_0.11.1/src/common/connection.py

    r8676 r8683  
    700700 
    701701        def send_message(self, jid, msg, keyID, type = 'chat', subject='', 
    702         chatstate = None, msg_id = None, composing_jep = None, resource = None, 
     702        chatstate = None, msg_id = None, composing_xep = None, resource = None, 
    703703        user_nick = None, xhtml = None): 
    704704                if not self.connection: 
     
    754754                # tag is the active event 
    755755                if chatstate is not None: 
    756                         if (composing_jep == 'JEP-0085' or not composing_jep) and \ 
    757                         composing_jep != 'asked_once': 
    758                                 # JEP-0085 
     756                        if (composing_xep == 'XEP-0085' or not composing_xep) and \ 
     757                        composing_xep != 'asked_once': 
     758                                # XEP-0085 
    759759                                msg_iq.setTag(chatstate, namespace = common.xmpp.NS_CHATSTATES) 
    760                         if composing_jep in ('JEP-0022', 'asked_once') or not composing_jep: 
    761                                 # JEP-0022 
     760                        if composing_xep in ('XEP-0022', 'asked_once') or not composing_xep: 
     761                                # XEP-0022 
    762762                                chatstate_node = msg_iq.setTag('x', 
    763763                                        namespace = common.xmpp.NS_EVENT) 
  • branches/gajim_0.11.1/src/common/contacts.py

    r8661 r8683  
    2121        def __init__(self, jid='', name='', groups=[], show='', status='', sub='', 
    2222        ask='', resource='', priority=0, keyID='', our_chatstate=None, 
    23         chatstate=None, last_status_time=None, msg_id = None, composing_jep = None): 
     23        chatstate=None, last_status_time=None, msg_id = None, composing_xep = None): 
    2424                self.jid = jid 
    2525                self.name = name 
     
    4444                self.msg_id = msg_id 
    4545                # tell which JEP we're using for composing state 
    46                 # None = have to ask, JEP-0022 = use this jep, 
    47                 # JEP-0085 = use this jep, False = no composing support 
    48                 self.composing_jep = composing_jep 
     46                # None = have to ask, XEP-0022 = use this jep, 
     47                # XEP-0085 = use this jep, False = no composing support 
     48                self.composing_xep = composing_xep 
    4949                # this is contact's chatstate 
    5050                self.chatstate = chatstate 
     
    145145        def create_contact(self, jid='', name='', groups=[], show='', status='', 
    146146                sub='', ask='', resource='', priority=0, keyID='', our_chatstate=None, 
    147                 chatstate=None, last_status_time=None, composing_jep=None): 
     147                chatstate=None, last_status_time=None, composing_xep=None): 
    148148                return Contact(jid, name, groups, show, status, sub, ask, resource, 
    149149                        priority, keyID, our_chatstate, chatstate, last_status_time, 
    150                         composing_jep) 
     150                        composing_xep) 
    151151         
    152152        def copy_contact(self, contact): 
  • branches/gajim_0.11.1/src/common/zeroconf/connection_handlers_zeroconf.py

    r7568 r8683  
    652652                delayed = msg.getTag('x', namespace = common.xmpp.NS_DELAY) != None 
    653653                msg_id = None 
    654                 composing_jep = None 
     654                composing_xep = None 
    655655                xtags = msg.getTags('x') 
    656656                # chatstates - look for chatstate tags in a message if not delayed 
    657657                if not delayed: 
    658                         composing_jep = False 
     658                        composing_xep = False 
    659659                        children = msg.getChildren() 
    660660                        for child in children: 
    661661                                if child.getNamespace() == 'http://jabber.org/protocol/chatstates': 
    662662                                        chatstate = child.getName() 
    663                                         composing_jep = 'JEP-0085' 
     663                                        composing_xep = 'XEP-0085' 
    664664                                        break 
    665665                        # No JEP-0085 support, fallback to JEP-0022 
     
    668668                                if chatstate_child: 
    669669                                        chatstate = 'active' 
    670                                         composing_jep = 'JEP-0022' 
     670                                        composing_xep = 'XEP-0022' 
    671671                                        if not msgtxt and chatstate_child.getTag('composing'): 
    672672                                                chatstate = 'composing' 
     
    704704                                        subject = subject) 
    705705                        self.dispatch('MSG', (frm, msgtxt, tim, encrypted, mtype, subject, 
    706                                 chatstate, msg_id, composing_jep, user_nick, msghtml)) 
     706                                chatstate, msg_id, composing_xep, user_nick, msghtml)) 
    707707                elif mtype == 'normal': # it's single message 
    708708                        if self.name not in no_log_for and jid not in no_log_for and msgtxt: 
     
    711711                        if invite: 
    712712                                self.dispatch('MSG', (frm, msgtxt, tim, encrypted, 'normal', 
    713                                         subject, chatstate, msg_id, composing_jep, user_nick)) 
     713                                        subject, chatstate, msg_id, composing_xep, user_nick)) 
    714714        # END messageCB 
    715715         
  • branches/gajim_0.11.1/src/common/zeroconf/connection_zeroconf.py

    r8653 r8683  
    346346 
    347347        def send_message(self, jid, msg, keyID, type = 'chat', subject='', 
    348         chatstate = None, msg_id = None, composing_jep = None, resource = None,  
     348        chatstate = None, msg_id = None, composing_xep = None, resource = None,  
    349349        user_nick = None): 
    350350                fjid = jid 
     
    394394                # tag is the active event 
    395395                if chatstate is not None: 
    396                         if composing_jep == 'JEP-0085' or not composing_jep: 
     396                        if composing_xep == 'XEP-0085' or not composing_xep: 
    397397                                # JEP-0085 
    398398                                msg_iq.setTag(chatstate, namespace = common.xmpp.NS_CHATSTATES) 
    399                         if composing_jep == 'JEP-0022' or not composing_jep: 
     399                        if composing_xep == 'XEP-0022' or not composing_xep: 
    400400                                # JEP-0022 
    401401                                chatstate_node = msg_iq.setTag('x', namespace = common.xmpp.NS_EVENT) 
  • branches/gajim_0.11.1/src/gajim.py

    r8670 r8683  
    585585                        if array[1] in ('offline', 'error'): 
    586586                                contact1.our_chatstate = contact1.chatstate = \ 
    587                                         contact1.composing_jep = None 
     587                                        contact1.composing_xep = None 
    588588                                gajim.connections[account].remove_transfers_for_contact(contact1) 
    589589                        self.roster.chg_contact_status(contact1, array[1], status_message, 
     
    614614        def handle_event_msg(self, account, array): 
    615615                # 'MSG' (account, (jid, msg, time, encrypted, msg_type, subject, 
    616                 # chatstate, msg_id, composing_jep, user_nick, xhtml)) 
     616                # chatstate, msg_id, composing_xep, user_nick, xhtml)) 
    617617                # user_nick is JEP-0172 
    618618 
     
    627627                chatstate = array[6] 
    628628                msg_id = array[7] 
    629                 composing_jep = array[8] 
     629                composing_xep = array[8] 
    630630                xhtml = array[10] 
    631631                if gajim.config.get('ignore_incoming_xhtml'): 
     
    668668                        contact = contact[0] 
    669669                if contact: 
    670                         if contact.composing_jep != 'JEP-0085': # We cache xep85 support 
    671                                 contact.composing_jep = composing_jep 
     670                        if contact.composing_xep != 'XEP-0085': # We cache xep85 support 
     671                                contact.composing_xep = composing_xep 
    672672                        if chat_control and chat_control.type_id == message_control.TYPE_CHAT: 
    673673                                if chatstate is not None: 
  • branches/gajim_0.11.1/src/message_control.py

    r7984 r8683  
    112112 
    113113        def send_message(self, message, keyID = '', type = 'chat', 
    114         chatstate = None, msg_id = None, composing_jep = None, resource = None, 
     114        chatstate = None, msg_id = None, composing_xep = None, resource = None, 
    115115        user_nick = None): 
    116116                '''Send the given message to the active tab. Doesn't return None if error 
     
    120120                return gajim.connections[self.account].send_message(jid, message, keyID, 
    121121                        type = type, chatstate = chatstate, msg_id = msg_id, 
    122                         composing_jep = composing_jep, resource = self.resource, 
     122                        composing_xep = composing_xep, resource = self.resource, 
    123123                        user_nick = user_nick)