- Timestamp:
- 04/15/08 07:32:45 (7 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
branches/session_centric/src/common/connection_handlers.py
r9459 r9465 1594 1594 1595 1595 msgtxt = msg.getBody() 1596 msghtml = msg.getXHTML()1597 1596 subject = msg.getSubject() # if not there, it's None 1598 1597 … … 1613 1612 jid = gajim.get_jid_without_resource(frm) 1614 1613 1615 encTag = msg.getTag('x', namespace = common.xmpp.NS_ENCRYPTED)1616 1614 # invitations 1617 1615 invite = None 1616 encTag = msg.getTag('x', namespace = common.xmpp.NS_ENCRYPTED) 1618 1617 1619 1618 if not encTag: … … 1621 1620 if invite and not invite.getTag('invite'): 1622 1621 invite = None 1623 1624 delayed = msg.getTag('x', namespace = common.xmpp.NS_DELAY) != None1625 msg_id = None1626 composing_xep = None1627 1622 1628 1623 # FIXME: Msn transport (CMSN1.2.1 and PyMSN0.10) do NOT RECOMMENDED … … 1640 1635 return 1641 1636 1642 form_node = None1643 for xtag in xtags:1644 if xtag.getNamespace() == common.xmpp.NS_DATA:1645 form_node = xtag1646 break1647 1648 chatstate = None1649 1650 # chatstates - look for chatstate tags in a message if not delayed1651 if not delayed:1652 composing_xep = False1653 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 break1659 # No XEP-0085 support, fallback to XEP-00221660 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 Nickname1669 user_nick = msg.getTagData('nick')1670 if not user_nick:1671 user_nick = ''1672 1673 1637 if encTag and self.USE_GPG: 1674 1638 encmsg = encTag.getData() … … 1684 1648 if mtype == 'error': 1685 1649 self.dispatch_error_message(msg, msgtxt, session, frm, tim, subject) 1686 1687 return1688 1650 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) 1692 1652 elif invite is not None: 1693 1653 self.dispatch_invite_message(invite, frm) 1694 1695 return1696 elif mtype == 'chat':1697 if not msg.getTag('body') and chatstate is None: # no <body>1698 return1699 1700 log_type = 'chat_msg_recv'1701 else: # it's a single message1702 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_as1717 1718 # XXX horrible hack1719 if isinstance(session, ChatControlSession):1720 session.received(frm, msgtxt, tim, encrypted, mtype, subject, chatstate,1721 msg_id, composing_xep, user_nick, msghtml, form_node)1722 1654 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) 1724 1660 # END messageCB 1725 1661 … … 1742 1678 1743 1679 # 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): 1745 1681 has_timestamp = bool(msg.timestamp) 1746 1682 … … 1762 1698 return 1763 1699 1764 self.dispatch('GC_MSG', (frm, msgtxt, tim, has_timestamp, msg html,1700 self.dispatch('GC_MSG', (frm, msgtxt, tim, has_timestamp, msg.getXHTML(), 1765 1701 statusCode)) 1766 1702
