Changeset 8683
- Timestamp:
- 08/31/07 19:22:58 (15 months ago)
- Location:
- branches/gajim_0.11.1/src
- Files:
-
- 7 modified
-
chat_control.py (modified) (11 diffs)
-
common/connection.py (modified) (2 diffs)
-
common/contacts.py (modified) (3 diffs)
-
common/zeroconf/connection_handlers_zeroconf.py (modified) (4 diffs)
-
common/zeroconf/connection_zeroconf.py (modified) (2 diffs)
-
gajim.py (modified) (4 diffs)
-
message_control.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/gajim_0.11.1/src/chat_control.py
r8601 r8683 511 511 512 512 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): 514 514 '''Send the given message to the active tab. Doesn't return None if error 515 515 ''' … … 521 521 ret = MessageControl.send_message(self, message, keyID, type = type, 522 522 chatstate = chatstate, msg_id = msg_id, 523 composing_ jep = composing_jep, resource = resource,523 composing_xep = composing_xep, resource = resource, 524 524 user_nick = self.user_nick) 525 525 if ret: … … 1084 1084 if contact.show == 'offline': 1085 1085 chatstate = '' 1086 elif contact.composing_ jep == 'JEP-0085':1086 elif contact.composing_xep == 'XEP-0085': 1087 1087 if st == 'all' or cs == 'composing': 1088 1088 chatstate = helpers.get_uf_chatstate(cs) 1089 1089 else: 1090 1090 chatstate = '' 1091 elif contact.composing_ jep == 'JEP-0022':1091 elif contact.composing_xep == 'XEP-0022': 1092 1092 if cs in ('composing', 'paused'): 1093 1093 # only print composing, paused … … 1161 1161 chatstates_on = gajim.config.get('outgoing_chat_state_notifications') != \ 1162 1162 'disabled' 1163 composing_ jep = contact.composing_jep1163 composing_xep = contact.composing_xep 1164 1164 chatstate_to_send = None 1165 1165 if chatstates_on and contact is not None: 1166 if composing_ jep is None:1166 if composing_xep is None: 1167 1167 # no info about peer 1168 1168 # send active to discover chat state capabilities … … 1170 1170 # because we want it sent with REAL message 1171 1171 # (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' 1180 1176 1181 1177 chatstate_to_send = 'active' … … 1183 1179 # if peer supports jep85 and we are not 'ask', send 'active' 1184 1180 # NOTE: first active and 'ask' is set in gajim.py 1185 elif composing_ jep is not False:1181 elif composing_xep is not False: 1186 1182 #send active chatstate on every message (as JEP says) 1187 1183 chatstate_to_send = 'active' … … 1193 1189 1194 1190 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): 1196 1192 self.print_conversation(message, self.contact.jid, 1197 1193 encrypted = encrypted) … … 1486 1482 return 1487 1483 1488 if contact.composing_ jep is False: # jid cannot do jep85 nor jep221484 if contact.composing_xep is False: # jid cannot do xep85 nor xep22 1489 1485 return 1490 1486 … … 1494 1490 return 1495 1491 1496 if contact.composing_ jep is None:1492 if contact.composing_xep is None: 1497 1493 # we don't know anything about jid, so return 1498 1494 # NOTE: … … 1508 1504 # in JEP22, when we already sent stop composing 1509 1505 # notification on paused, don't resend it 1510 if contact.composing_ jep == 'JEP-0022' and \1506 if contact.composing_xep == 'XEP-0022' and \ 1511 1507 contact.our_chatstate in ('paused', 'active', 'inactive') and \ 1512 1508 state is not 'composing': # not composing == in (active, inactive, gone) … … 1530 1526 1531 1527 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) 1533 1529 contact.our_chatstate = state 1534 1530 if contact.our_chatstate == 'active': -
branches/gajim_0.11.1/src/common/connection.py
r8676 r8683 700 700 701 701 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, 703 703 user_nick = None, xhtml = None): 704 704 if not self.connection: … … 754 754 # tag is the active event 755 755 if chatstate is not None: 756 if (composing_ jep == 'JEP-0085' or not composing_jep) and \757 composing_ jep != 'asked_once':758 # JEP-0085756 if (composing_xep == 'XEP-0085' or not composing_xep) and \ 757 composing_xep != 'asked_once': 758 # XEP-0085 759 759 msg_iq.setTag(chatstate, namespace = common.xmpp.NS_CHATSTATES) 760 if composing_ jep in ('JEP-0022', 'asked_once') or not composing_jep:761 # JEP-0022760 if composing_xep in ('XEP-0022', 'asked_once') or not composing_xep: 761 # XEP-0022 762 762 chatstate_node = msg_iq.setTag('x', 763 763 namespace = common.xmpp.NS_EVENT) -
branches/gajim_0.11.1/src/common/contacts.py
r8661 r8683 21 21 def __init__(self, jid='', name='', groups=[], show='', status='', sub='', 22 22 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): 24 24 self.jid = jid 25 25 self.name = name … … 44 44 self.msg_id = msg_id 45 45 # 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 support48 self.composing_ jep = composing_jep46 # 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 49 49 # this is contact's chatstate 50 50 self.chatstate = chatstate … … 145 145 def create_contact(self, jid='', name='', groups=[], show='', status='', 146 146 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): 148 148 return Contact(jid, name, groups, show, status, sub, ask, resource, 149 149 priority, keyID, our_chatstate, chatstate, last_status_time, 150 composing_ jep)150 composing_xep) 151 151 152 152 def copy_contact(self, contact): -
branches/gajim_0.11.1/src/common/zeroconf/connection_handlers_zeroconf.py
r7568 r8683 652 652 delayed = msg.getTag('x', namespace = common.xmpp.NS_DELAY) != None 653 653 msg_id = None 654 composing_ jep = None654 composing_xep = None 655 655 xtags = msg.getTags('x') 656 656 # chatstates - look for chatstate tags in a message if not delayed 657 657 if not delayed: 658 composing_ jep = False658 composing_xep = False 659 659 children = msg.getChildren() 660 660 for child in children: 661 661 if child.getNamespace() == 'http://jabber.org/protocol/chatstates': 662 662 chatstate = child.getName() 663 composing_ jep = 'JEP-0085'663 composing_xep = 'XEP-0085' 664 664 break 665 665 # No JEP-0085 support, fallback to JEP-0022 … … 668 668 if chatstate_child: 669 669 chatstate = 'active' 670 composing_ jep = 'JEP-0022'670 composing_xep = 'XEP-0022' 671 671 if not msgtxt and chatstate_child.getTag('composing'): 672 672 chatstate = 'composing' … … 704 704 subject = subject) 705 705 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)) 707 707 elif mtype == 'normal': # it's single message 708 708 if self.name not in no_log_for and jid not in no_log_for and msgtxt: … … 711 711 if invite: 712 712 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)) 714 714 # END messageCB 715 715 -
branches/gajim_0.11.1/src/common/zeroconf/connection_zeroconf.py
r8653 r8683 346 346 347 347 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, 349 349 user_nick = None): 350 350 fjid = jid … … 394 394 # tag is the active event 395 395 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: 397 397 # JEP-0085 398 398 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: 400 400 # JEP-0022 401 401 chatstate_node = msg_iq.setTag('x', namespace = common.xmpp.NS_EVENT) -
branches/gajim_0.11.1/src/gajim.py
r8670 r8683 585 585 if array[1] in ('offline', 'error'): 586 586 contact1.our_chatstate = contact1.chatstate = \ 587 contact1.composing_ jep = None587 contact1.composing_xep = None 588 588 gajim.connections[account].remove_transfers_for_contact(contact1) 589 589 self.roster.chg_contact_status(contact1, array[1], status_message, … … 614 614 def handle_event_msg(self, account, array): 615 615 # '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)) 617 617 # user_nick is JEP-0172 618 618 … … 627 627 chatstate = array[6] 628 628 msg_id = array[7] 629 composing_ jep = array[8]629 composing_xep = array[8] 630 630 xhtml = array[10] 631 631 if gajim.config.get('ignore_incoming_xhtml'): … … 668 668 contact = contact[0] 669 669 if contact: 670 if contact.composing_ jep != 'JEP-0085': # We cache xep85 support671 contact.composing_ jep = composing_jep670 if contact.composing_xep != 'XEP-0085': # We cache xep85 support 671 contact.composing_xep = composing_xep 672 672 if chat_control and chat_control.type_id == message_control.TYPE_CHAT: 673 673 if chatstate is not None: -
branches/gajim_0.11.1/src/message_control.py
r7984 r8683 112 112 113 113 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, 115 115 user_nick = None): 116 116 '''Send the given message to the active tab. Doesn't return None if error … … 120 120 return gajim.connections[self.account].send_message(jid, message, keyID, 121 121 type = type, chatstate = chatstate, msg_id = msg_id, 122 composing_ jep = composing_jep, resource = self.resource,122 composing_xep = composing_xep, resource = self.resource, 123 123 user_nick = user_nick)
