comparison src/bridge/DBus.py @ 1955:633b5c21aefd

backend, frontend: messages refactoring (huge commit, not finished): /!\ database schema has been modified, do a backup before updating message have been refactored, here are the main changes: - languages are now handled - all messages have an uid (internal to SàT) - message updating is anticipated - subject is now first class - new naming scheme is used newMessage => messageNew, getHistory => historyGet, sendMessage => messageSend - minimal compatibility refactoring in quick_frontend/Primitivus, better refactoring should follow - threads handling - delayed messages are saved into history - info messages may also be saved in history (e.g. to keep track of people joining/leaving a room) - duplicate messages should be avoided - historyGet return messages in right order, no need to sort again - plugins have been updated to follow new features, some of them need to be reworked (e.g. OTR) - XEP-0203 (Delayed Delivery) is now fully handled in core, the plugin just handle disco and creation of a delay element - /!\ jp and Libervia are currently broken, as some features of Primitivus It has been put in one huge commit to avoid breaking messaging between changes. This is the main part of message refactoring, other commits will follow to take profit of the new features/behaviour.
author Goffi <goffi@goffi.org>
date Tue, 24 May 2016 22:11:04 +0200
parents 2daf7b4c6756
children a2bc5089c2eb
comparison
equal deleted inserted replaced
1943:ccfe45302a5c 1955:633b5c21aefd
164 signature='ssss') 164 signature='ssss')
165 def entityDataUpdated(self, jid, name, value, profile): 165 def entityDataUpdated(self, jid, name, value, profile):
166 pass 166 pass
167 167
168 @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, 168 @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX,
169 signature='sdssa{ss}a{ss}sa{ss}s')
170 def messageNew(self, uid, timestamp, from_jid, to_jid, message, subject, mess_type, extra, profile):
171 pass
172
173 @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX,
169 signature='ssss') 174 signature='ssss')
170 def newAlert(self, message, title, alert_type, profile): 175 def newAlert(self, message, title, alert_type, profile):
171 pass 176 pass
172 177
173 @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, 178 @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX,
174 signature='sa{ss}ass') 179 signature='sa{ss}ass')
175 def newContact(self, contact_jid, attributes, groups, profile): 180 def newContact(self, contact_jid, attributes, groups, profile):
176 pass 181 pass
177 182
178 @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, 183 @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX,
179 signature='ssssa{ss}s')
180 def newMessage(self, from_jid, message, mess_type, to_jid, extra, profile):
181 pass
182
183 @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX,
184 signature='ssss') 184 signature='ssss')
185 def paramUpdate(self, name, value, category, profile): 185 def paramUpdate(self, name, value, category, profile):
186 pass 186 pass
187 187
188 @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX, 188 @dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX,
319 async_callbacks=('callback', 'errback')) 319 async_callbacks=('callback', 'errback'))
320 def getFeatures(self, profile_key, callback=None, errback=None): 320 def getFeatures(self, profile_key, callback=None, errback=None):
321 return self._callback("getFeatures", unicode(profile_key), callback=callback, errback=errback) 321 return self._callback("getFeatures", unicode(profile_key), callback=callback, errback=errback)
322 322
323 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 323 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
324 in_signature='ssibss', out_signature='a(dssssa{ss})',
325 async_callbacks=('callback', 'errback'))
326 def getHistory(self, from_jid, to_jid, limit, between=True, search='', profile="@NONE@", callback=None, errback=None):
327 return self._callback("getHistory", unicode(from_jid), unicode(to_jid), limit, between, unicode(search), unicode(profile), callback=callback, errback=errback)
328
329 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
330 in_signature='ss', out_signature='s', 324 in_signature='ss', out_signature='s',
331 async_callbacks=None) 325 async_callbacks=None)
332 def getMainResource(self, contact_jid, profile_key="@DEFAULT@"): 326 def getMainResource(self, contact_jid, profile_key="@DEFAULT@"):
333 return self._callback("getMainResource", unicode(contact_jid), unicode(profile_key)) 327 return self._callback("getMainResource", unicode(contact_jid), unicode(profile_key))
334 328
403 async_callbacks=None) 397 async_callbacks=None)
404 def getWaitingSub(self, profile_key="@DEFAULT@"): 398 def getWaitingSub(self, profile_key="@DEFAULT@"):
405 return self._callback("getWaitingSub", unicode(profile_key)) 399 return self._callback("getWaitingSub", unicode(profile_key))
406 400
407 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 401 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
402 in_signature='ssibss', out_signature='a(sdssa{ss}a{ss}sa{ss})',
403 async_callbacks=('callback', 'errback'))
404 def historyGet(self, from_jid, to_jid, limit, between=True, search='', profile="@NONE@", callback=None, errback=None):
405 return self._callback("historyGet", unicode(from_jid), unicode(to_jid), limit, between, unicode(search), unicode(profile), callback=callback, errback=errback)
406
407 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
408 in_signature='s', out_signature='b', 408 in_signature='s', out_signature='b',
409 async_callbacks=None) 409 async_callbacks=None)
410 def isConnected(self, profile_key="@DEFAULT@"): 410 def isConnected(self, profile_key="@DEFAULT@"):
411 return self._callback("isConnected", unicode(profile_key)) 411 return self._callback("isConnected", unicode(profile_key))
412 412
421 async_callbacks=None) 421 async_callbacks=None)
422 def loadParamsTemplate(self, filename): 422 def loadParamsTemplate(self, filename):
423 return self._callback("loadParamsTemplate", unicode(filename)) 423 return self._callback("loadParamsTemplate", unicode(filename))
424 424
425 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 425 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
426 in_signature='sa{ss}a{ss}sa{ss}s', out_signature='',
427 async_callbacks=('callback', 'errback'))
428 def messageSend(self, to_jid, message, subject='', mess_type="auto", extra={}, profile_key="@NONE@", callback=None, errback=None):
429 return self._callback("messageSend", unicode(to_jid), message, subject, unicode(mess_type), extra, unicode(profile_key), callback=callback, errback=errback)
430
431 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
426 in_signature='sis', out_signature='', 432 in_signature='sis', out_signature='',
427 async_callbacks=None) 433 async_callbacks=None)
428 def paramsRegisterApp(self, xml, security_limit=-1, app=''): 434 def paramsRegisterApp(self, xml, security_limit=-1, app=''):
429 return self._callback("paramsRegisterApp", unicode(xml), security_limit, unicode(app)) 435 return self._callback("paramsRegisterApp", unicode(xml), security_limit, unicode(app))
430 436
467 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 473 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
468 in_signature='s', out_signature='b', 474 in_signature='s', out_signature='b',
469 async_callbacks=None) 475 async_callbacks=None)
470 def saveParamsTemplate(self, filename): 476 def saveParamsTemplate(self, filename):
471 return self._callback("saveParamsTemplate", unicode(filename)) 477 return self._callback("saveParamsTemplate", unicode(filename))
472
473 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
474 in_signature='ssssa{ss}s', out_signature='',
475 async_callbacks=('callback', 'errback'))
476 def sendMessage(self, to_jid, message, subject='', mess_type="auto", extra={}, profile_key="@NONE@", callback=None, errback=None):
477 return self._callback("sendMessage", unicode(to_jid), unicode(message), unicode(subject), unicode(mess_type), extra, unicode(profile_key), callback=callback, errback=errback)
478 478
479 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, 479 @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
480 in_signature='sssis', out_signature='', 480 in_signature='sssis', out_signature='',
481 async_callbacks=None) 481 async_callbacks=None)
482 def setParam(self, name, value, category, security_limit=-1, profile_key="@DEFAULT@"): 482 def setParam(self, name, value, category, security_limit=-1, profile_key="@DEFAULT@"):
624 self.dbus_bridge.disconnected(profile) 624 self.dbus_bridge.disconnected(profile)
625 625
626 def entityDataUpdated(self, jid, name, value, profile): 626 def entityDataUpdated(self, jid, name, value, profile):
627 self.dbus_bridge.entityDataUpdated(jid, name, value, profile) 627 self.dbus_bridge.entityDataUpdated(jid, name, value, profile)
628 628
629 def messageNew(self, uid, timestamp, from_jid, to_jid, message, subject, mess_type, extra, profile):
630 self.dbus_bridge.messageNew(uid, timestamp, from_jid, to_jid, message, subject, mess_type, extra, profile)
631
629 def newAlert(self, message, title, alert_type, profile): 632 def newAlert(self, message, title, alert_type, profile):
630 self.dbus_bridge.newAlert(message, title, alert_type, profile) 633 self.dbus_bridge.newAlert(message, title, alert_type, profile)
631 634
632 def newContact(self, contact_jid, attributes, groups, profile): 635 def newContact(self, contact_jid, attributes, groups, profile):
633 self.dbus_bridge.newContact(contact_jid, attributes, groups, profile) 636 self.dbus_bridge.newContact(contact_jid, attributes, groups, profile)
634
635 def newMessage(self, from_jid, message, mess_type, to_jid, extra, profile):
636 self.dbus_bridge.newMessage(from_jid, message, mess_type, to_jid, extra, profile)
637 637
638 def paramUpdate(self, name, value, category, profile): 638 def paramUpdate(self, name, value, category, profile):
639 self.dbus_bridge.paramUpdate(name, value, category, profile) 639 self.dbus_bridge.paramUpdate(name, value, category, profile)
640 640
641 def presenceUpdate(self, entity_jid, show, priority, statuses, profile): 641 def presenceUpdate(self, entity_jid, show, priority, statuses, profile):