Show
Ignore:
Timestamp:
04/15/08 07:32:45 (7 months ago)
Author:
bct
Message:

check tic-tac-toe win conditions, slimmed down _messageCB some more

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/session_centric/src/common/connection_handlers.py

    r9459 r9465  
    15941594 
    15951595                msgtxt = msg.getBody() 
    1596                 msghtml = msg.getXHTML() 
    15971596                subject = msg.getSubject() # if not there, it's None 
    15981597 
     
    16131612                                jid = gajim.get_jid_without_resource(frm) 
    16141613 
    1615                 encTag = msg.getTag('x', namespace = common.xmpp.NS_ENCRYPTED) 
    16161614                # invitations 
    16171615                invite = None 
     1616                encTag = msg.getTag('x', namespace = common.xmpp.NS_ENCRYPTED) 
    16181617 
    16191618                if not encTag: 
     
    16211620                        if invite and not invite.getTag('invite'): 
    16221621                                invite = None 
    1623  
    1624                 delayed = msg.getTag('x', namespace = common.xmpp.NS_DELAY) != None 
    1625                 msg_id = None 
    1626                 composing_xep = None 
    16271622 
    16281623                # FIXME: Msn transport (CMSN1.2.1 and PyMSN0.10) do NOT RECOMMENDED 
     
    16401635                                return 
    16411636 
    1642                 form_node = None 
    1643                 for xtag in xtags: 
    1644                         if xtag.getNamespace() == common.xmpp.NS_DATA: 
    1645                                 form_node = xtag 
    1646                                 break 
    1647  
    1648                 chatstate = None 
    1649  
    1650                 # chatstates - look for chatstate tags in a message if not delayed 
    1651                 if not delayed: 
    1652                         composing_xep = False 
    1653                         children = msg.getChildren() 
    1654                         for child in children: 
    1655                                 if child.getNamespace() == 'http://jabber.org/protocol/chatstates': 
    1656                                         chatstate = child.getName() 
    1657                                         composing_xep = 'XEP-0085' 
    1658                                         break 
    1659                         # No XEP-0085 support, fallback to XEP-0022 
    1660                         if not chatstate: 
    1661                                 chatstate_child = msg.getTag('x', namespace = common.xmpp.NS_EVENT) 
    1662                                 if chatstate_child: 
    1663                                         chatstate = 'active' 
    1664                                         composing_xep = 'XEP-0022' 
    1665                                         if not msgtxt and chatstate_child.getTag('composing'): 
    1666                                                 chatstate = 'composing' 
    1667  
    1668                 # XEP-0172 User Nickname 
    1669                 user_nick = msg.getTagData('nick') 
    1670                 if not user_nick: 
    1671                         user_nick = '' 
    1672  
    16731637                if encTag and self.USE_GPG: 
    16741638                        encmsg = encTag.getData() 
     
    16841648                if mtype == 'error': 
    16851649                        self.dispatch_error_message(msg, msgtxt, session, frm, tim, subject) 
    1686  
    1687                         return 
    16881650                elif mtype == 'groupchat': 
    1689                         self.dispatch_gc_message(msg, subject, frm, msgtxt, jid, tim, msghtml) 
    1690  
    1691                         return 
     1651                        self.dispatch_gc_message(msg, subject, frm, msgtxt, jid, tim) 
    16921652                elif invite is not None: 
    16931653                        self.dispatch_invite_message(invite, frm) 
    1694  
    1695                         return 
    1696                 elif mtype == 'chat': 
    1697                         if not msg.getTag('body') and chatstate is None: # no <body> 
    1698                                 return 
    1699  
    1700                         log_type = 'chat_msg_recv' 
    1701                 else: # it's a single message 
    1702                         log_type = 'single_msg_recv' 
    1703  
    1704                         mtype = 'normal' 
    1705  
    1706                 if session.is_loggable() and msgtxt: 
    1707                         try: 
    1708                                 msg_id = gajim.logger.write(log_type, frm, msgtxt, 
    1709                                         tim = tim, subject = subject) 
    1710                         except exceptions.PysqliteOperationalError, e: 
    1711                                 self.dispatch('ERROR', (_('Disk Write Error'), str(e))) 
    1712  
    1713                 treat_as = gajim.config.get('treat_incoming_messages') 
    1714  
    1715                 if treat_as: 
    1716                         mtype = treat_as 
    1717  
    1718                 # XXX horrible hack 
    1719                 if isinstance(session, ChatControlSession): 
    1720                         session.received(frm, msgtxt, tim, encrypted, mtype, subject, chatstate, 
    1721                                 msg_id, composing_xep, user_nick, msghtml, form_node) 
    17221654                else: 
    1723                         session.received(msg) 
     1655                        # XXX horrible hack 
     1656                        if isinstance(session, ChatControlSession): 
     1657                                session.received(frm, msgtxt, tim, encrypted, subject, msg) 
     1658                        else: 
     1659                                session.received(msg) 
    17241660        # END messageCB 
    17251661 
     
    17421678 
    17431679        # process and dispatch a groupchat message 
    1744         def dispatch_gc_message(self, msg, subject, frm, msgtxt, jid, tim, msghtml): 
     1680        def dispatch_gc_message(self, msg, subject, frm, msgtxt, jid, tim): 
    17451681                has_timestamp = bool(msg.timestamp) 
    17461682 
     
    17621698                                return 
    17631699 
    1764                         self.dispatch('GC_MSG', (frm, msgtxt, tim, has_timestamp, msghtml, 
     1700                        self.dispatch('GC_MSG', (frm, msgtxt, tim, has_timestamp, msg.getXHTML(), 
    17651701                                statusCode)) 
    17661702