comparison src/plugins/plugin_xep_0085.py @ 1335:2c6c93438f74 frontends_multi_profiles

plugin XEP-0085: fixed bad call to udateEntityData
author Goffi <goffi@goffi.org>
date Mon, 23 Feb 2015 18:04:25 +0100
parents be3a301540c0
children f29beedb33b0
comparison
equal deleted inserted replaced
1334:15e177584d82 1335:2c6c93438f74
149 @param value: "true" to activate the notifications, or any other value to delete it 149 @param value: "true" to activate the notifications, or any other value to delete it
150 @param category: parameter category 150 @param category: parameter category
151 @param type_: parameter type 151 @param type_: parameter type
152 """ 152 """
153 if (category, name) == (PARAM_KEY, PARAM_NAME): 153 if (category, name) == (PARAM_KEY, PARAM_NAME):
154 self.updateEntityData(C.ENTITY_ALL, True if bool("true") else DELETE_VALUE, profile_key=profile) 154 self.updateEntityData(C.ENTITY_ALL, True if bool("true") else DELETE_VALUE, profile=profile)
155 return False 155 return False
156 return True 156 return True
157 157
158 def messageReceivedTrigger(self, message, post_treat, profile): 158 def messageReceivedTrigger(self, message, post_treat, profile):
159 """ 159 """
171 try: 171 try:
172 domish.generateElementsNamed(message.elements(), name="body").next() 172 domish.generateElementsNamed(message.elements(), name="body").next()
173 try: 173 try:
174 domish.generateElementsNamed(message.elements(), name="active").next() 174 domish.generateElementsNamed(message.elements(), name="active").next()
175 # contact enabled Chat State Notifications 175 # contact enabled Chat State Notifications
176 self.updateEntityData(from_jid, True, profile_key=profile) 176 self.updateEntityData(from_jid, True, profile=profile)
177 except StopIteration: 177 except StopIteration:
178 if message.getAttribute('type') == 'chat': 178 if message.getAttribute('type') == 'chat':
179 # contact didn't enable Chat State Notifications 179 # contact didn't enable Chat State Notifications
180 self.updateEntityData(from_jid, False, profile_key=profile) 180 self.updateEntityData(from_jid, False, profile=profile)
181 return True 181 return True
182 except StopIteration: 182 except StopIteration:
183 pass 183 pass
184 184
185 # send our next "composing" states to any MUC and to the contacts who enabled the feature 185 # send our next "composing" states to any MUC and to the contacts who enabled the feature
258 try: 258 try:
259 return self.host.memory.getEntityDatum(to_jid, ENTITY_KEY, profile) 259 return self.host.memory.getEntityDatum(to_jid, ENTITY_KEY, profile)
260 except (exceptions.UnknownEntityError, KeyError): 260 except (exceptions.UnknownEntityError, KeyError):
261 if forceEntityData: 261 if forceEntityData:
262 # enable it for the first time 262 # enable it for the first time
263 self.updateEntityData(to_jid, True, profile_key=profile) 263 self.updateEntityData(to_jid, True, profile=profile)
264 return True 264 return True
265 # wait for the first message before sending states 265 # wait for the first message before sending states
266 return False 266 return False
267 267
268 def __chatStateInit(self, to_jid, mess_type, profile): 268 def __chatStateInit(self, to_jid, mess_type, profile):