diff frontends/src/primitivus/primitivus @ 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 011eff37e21d
children a2bc5089c2eb
line wrap: on
line diff
--- a/frontends/src/primitivus/primitivus	Mon Apr 18 18:35:19 2016 +0200
+++ b/frontends/src/primitivus/primitivus	Tue May 24 22:11:04 2016 +0200
@@ -96,12 +96,13 @@
         if self.mode == C.MODE_INSERTION:
             if isinstance(self.host.selected_widget, quick_chat.QuickChat):
                 chat_widget = self.host.selected_widget
-                self.host.sendMessage(chat_widget.target,
-                                     editBar.get_edit_text(),
-                                     mess_type = "groupchat" if chat_widget.type == 'group' else "chat", # TODO: put this in QuickChat
-                                     errback=lambda failure: self.host.notify(_("Error while sending message ({})").format(failure)),
-                                     profile_key=chat_widget.profile
-                                    )
+                self.host.messageSend(
+                    chat_widget.target,
+                    {'': editBar.get_edit_text()}, # TODO: handle language
+                    mess_type = "groupchat" if chat_widget.type == 'group' else "chat", # TODO: put this in QuickChat
+                    errback=lambda failure: self.host.notify(_("Error while sending message ({})").format(failure)),
+                    profile_key=chat_widget.profile
+                    )
                 editBar.set_edit_text('')
         elif self.mode == C.MODE_COMMAND:
             self.commandHandler()
@@ -723,7 +724,9 @@
 
     def roomJoinedHandler(self, room_jid_s, room_nicks, user_nick, profile):
         super(PrimitivusApp, self).roomJoinedHandler(room_jid_s, room_nicks, user_nick, profile)
-        self.contact_lists[profile].setFocus(jid.JID(room_jid_s), True)
+        for contact_list in self.widgets.getWidgets(ContactList):
+            if profile in contact_list.profiles:
+                contact_list.setFocus(jid.JID(room_jid_s), True)
 
     def progressStartedHandler(self, pid, metadata, profile):
         super(PrimitivusApp, self).progressStartedHandler(pid, metadata, profile)