changeset 503:10119c2a9d33

Primitivus: new entities are added to contact list if they send messages + QuickFrontend: names fixes
author Goffi <goffi@goffi.org>
date Wed, 26 Sep 2012 00:38:41 +0200
parents debcf5dd404a
children 65ecbb473cbb
files frontends/src/primitivus/primitivus frontends/src/quick_frontend/quick_app.py
diffstat 2 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/src/primitivus/primitivus	Tue Sep 25 23:10:22 2012 +0200
+++ b/frontends/src/primitivus/primitivus	Wed Sep 26 00:38:41 2012 +0200
@@ -308,8 +308,13 @@
     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:
+            #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)
-        sender = JID(from_jid)
         if JID(self.contact_list.selected).short != sender.short:
             self.contact_list.putAlert(sender)
 
--- a/frontends/src/quick_frontend/quick_app.py	Tue Sep 25 23:10:22 2012 +0200
+++ b/frontends/src/quick_frontend/quick_app.py	Wed Sep 26 00:38:41 2012 +0200
@@ -23,7 +23,6 @@
 from sat.tools.jid  import JID
 from sat_frontends.bridge.DBus import DBusBridgeFrontend,BridgeExceptionNoService
 from optparse import OptionParser
-import pdb
 
 import gettext
 gettext.install('sat_frontend', "../i18n", unicode=True)
@@ -148,7 +147,7 @@
         ## misc ##
         self.profiles[profile]['onlineContact'] = set()  #FIXME: temporary
 
-        #TODO: gof: manage multi-profiles here
+        #TODO: manage multi-profiles here
         if not self.bridge.isConnected(profile):
             self.setStatusOnline(False)
         else:
@@ -206,7 +205,7 @@
         if not self.check_profile(profile):
             return
         debug(_("Disconnected"))
-        self.contactList.clearContacts()
+        self.contact_list.clearContacts()
         self.setStatusOnline(False)
     
     def connectionError(self, error_type, profile):
@@ -471,7 +470,7 @@
         if not self.check_profile(profile):
             return
         target = JID(jid)
-        self.contactList.remove(target)
+        self.contact_list.remove(target)
         try:
             self.profiles[profile]['onlineContact'].remove(target.short)
         except KeyError:
@@ -483,12 +482,12 @@
             return
         if name == "card_nick":
             target = JID(data['jid'])
-            if target in self.contactList:
+            if target in self.contact_list:
                 #self.CM.update(target, 'nick', unicode(data['nick']))
                 self.contact_list._replace(target)
         elif name == "card_avatar":
             target = JID(data['jid'])
-            if target in self.contactList:
+            if target in self.contact_list:
                 filename = self.bridge.getAvatarFile(data['avatar'])
                 #self.CM.update(target, 'avatar', filename)
                 self.contact_list._replace(target)