Primitivus: new entities are added to contact list if they send messages + QuickFrontend: names fixes

This commit is contained in:
Goffi 2012-09-26 00:38:41 +02:00
commit 27b2eed139
2 changed files with 11 additions and 7 deletions

View file

@ -308,8 +308,13 @@ class PrimitivusApp(QuickApp):
def newMessage(self, from_jid, msg, type, to_jid, profile):
if not self.check_profile(profile):
return
QuickApp.newMessage(self, from_jid, msg, type, to_jid, profile)
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)
if JID(self.contact_list.selected).short != sender.short:
self.contact_list.putAlert(sender)

View file

@ -23,7 +23,6 @@ from logging import debug, info, warning, error
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 @@ class QuickApp():
## 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 @@ class QuickApp():
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 @@ class QuickApp():
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 @@ class QuickApp():
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)