diff frontends/src/primitivus/primitivus @ 510:886754295efe

quick frontend, primitivus, wix: MUC private messages management /!\ not fully finished, backend part is not done yet /!\ - as resources are discarded to manage chat windows lists, a pretty dirty hack is done to work around this: full jid is escaped using a prefix (it becomes invalid and resource is preserved). - new quick_utils module, with helper methods. escapePrivate and unescapePrivate implementations - MUC private messages are not managed in Wix yet
author Goffi <goffi@goffi.org>
date Thu, 11 Oct 2012 00:48:35 +0200
parents f98bef71a918
children 8ee9113d307b
line wrap: on
line diff
--- a/frontends/src/primitivus/primitivus	Fri Sep 28 00:48:52 2012 +0200
+++ b/frontends/src/primitivus/primitivus	Thu Oct 11 00:48:35 2012 +0200
@@ -24,8 +24,6 @@
 from urwid_satext import sat_widgets
 from sat_frontends.quick_frontend.quick_app import QuickApp
 from sat_frontends.quick_frontend.quick_chat_list import QuickChatList
-from sat_frontends.quick_frontend.quick_contact_list import QuickContactList
-from sat_frontends.quick_frontend.quick_contact_management import QuickContactManagement
 from sat_frontends.primitivus.profile_manager import ProfileManager
 from sat_frontends.primitivus.contact_list import ContactList
 from sat_frontends.primitivus.chat import Chat
@@ -47,9 +45,6 @@
 class ChatList(QuickChatList):
     """This class manage the list of chat windows"""
     
-    def __init__(self, host):
-        QuickChatList.__init__(self, host)
-    
     def createChat(self, target):
         return Chat(target, self.host)
 
@@ -300,7 +295,7 @@
         if contact:
             chat = self.chat_wins[contact]
             try:
-                self.bridge.sendMessage(contact,
+                self.sendMessage(contact,
                                     editBar.get_edit_text(),
                                     mess_type = "groupchat" if chat.type == 'group' else "chat",
                                     profile_key=self.profile)
@@ -308,18 +303,17 @@
                 self.notify(_("Error while sending message"))
             editBar.set_edit_text('')
 
-    def newMessage(self, from_jid, msg, type, to_jid, profile):
-        if not self.check_profile(profile):
-            return
-        sender = JID(from_jid)
-        if not sender in self.contact_list and sender.short != self.profiles[profile]['whoami'].short:
+    def newMessage(self, from_jid, to_jid, msg, _type, profile):
+        QuickApp.newMessage(self, from_jid, to_jid, msg, _type, profile)
+        
+        if not from_jid in self.contact_list and from_jid.short != self.profiles[profile]['whoami'].short:
             #XXX: needed to show entities which haven't sent any
             #     presence information and which are not in roster
             #TODO: put these entities in a "not in roster" list
-            self.contact_list.replace(sender)
-        QuickApp.newMessage(self, from_jid, msg, type, to_jid, profile)
-        if JID(self.contact_list.selected).short != sender.short:
-            self.contact_list.putAlert(sender)
+            self.contact_list.replace(from_jid)
+        
+        if JID(self.contact_list.selected).short != from_jid.short:
+            self.contact_list.putAlert(from_jid)
 
     def _dialogOkCb(self, widget, data):
         self.removePopUp()