Changeset 2399 for trunk/src/common/connection.py
- Timestamp:
- 07/19/05 16:38:58 (3 years ago)
- Files:
-
- 1 modified
-
trunk/src/common/connection.py (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/common/connection.py
r2386 r2399 219 219 tim = time.localtime(timegm(tim)) 220 220 encrypted = False 221 chatstate_tag = None 221 222 xtags = msg.getTags('x') 222 223 encTag = None … … 226 227 encTag = xtag 227 228 break 229 230 # chatstates - look for chatstate tags in a message 231 children = msg.getChildren() 232 for child in children: 233 if child.getNamespace() == 'http://jabber.org/protocol/chatstates': 234 chatstate_tag = child.getName() 235 break 236 228 237 if encTag and USE_GPG: 229 238 #decrypt … … 254 263 tim = tim) 255 264 self.dispatch('MSG', (str(msg.getFrom()), msgtxt, tim, encrypted, 256 mtype, subject ))265 mtype, subject, None)) 257 266 else: # it's type 'chat' 258 if not msg.getTag('body') : #no <body>267 if not msg.getTag('body') and chatstate_tag is None: #no <body> 259 268 return 260 269 log_msgtxt = msgtxt … … 264 273 tim = tim) 265 274 self.dispatch('MSG', (str(msg.getFrom()), msgtxt, tim, encrypted, 266 mtype, subject ))275 mtype, subject, chatstate_tag)) 267 276 # END messageCB 268 277 … … 860 869 self.dispatch('STATUS', show) 861 870 862 def send_message(self, jid, msg, keyID, type = 'chat', subject='' ):863 if not self.connection: 864 return 865 if not msg :871 def send_message(self, jid, msg, keyID, type = 'chat', subject='', chatstate = None): 872 if not self.connection: 873 return 874 if not msg and chatstate is None: 866 875 return 867 876 msgtxt = msg … … 887 896 if msgenc: 888 897 msg_iq.setTag(common.xmpp.NS_ENCRYPTED + ' x').setData(msgenc) 898 899 # chatstates - if peer supports jep85, send chatstates 900 # please note that the only valid tag inside a message containing a <body> tag is the active event 901 if chatstate != None: 902 msg_iq.setTag(chatstate, {}, namespace='http://jabber.org/protocol/chatstates') 903 889 904 self.to_be_sent.append(msg_iq) 890 905 gajim.logger.write('outgoing', msg, jid) … … 940 955 return 941 956 942 def update_ user(self, jid, name, groups):957 def update_contact(self, jid, name, groups): 943 958 if self.connection: 944 959 self.connection.getRoster().setItem(jid = jid, name = name, … … 1151 1166 1152 1167 def gc_set_role(self, room_jid, nick, role, reason = ''): 1168 '''role is for all the life of the room so it's based on nick''' 1153 1169 if not self.connection: 1154 1170 return … … 1163 1179 1164 1180 def gc_set_affiliation(self, room_jid, jid, affiliation, reason = ''): 1181 '''affiliation is for all the life of the room so it's based on jid''' 1165 1182 if not self.connection: 1166 1183 return
