tools: renamed tools.jid.JID attribute "short" to "bare"
This commit is contained in:
parent
a154d9acbb
commit
36cea6fc91
1 changed files with 94 additions and 94 deletions
|
|
@ -254,7 +254,7 @@ class QuickApp(object):
|
|||
from_jid = JID(from_jid_s)
|
||||
to_jid = JID(to_jid_s)
|
||||
|
||||
from_me = from_jid.short == self.profiles[profile]['whoami'].short
|
||||
from_me = from_jid.bare == self.profiles[profile]['whoami'].bare
|
||||
win = to_jid if from_me else from_jid
|
||||
|
||||
if _type != "groupchat" and self.contact_list.getSpecial(win) == "MUC":
|
||||
|
|
@ -273,14 +273,14 @@ class QuickApp(object):
|
|||
self.newMessage(from_jid, to_jid, msg, _type, extra, profile)
|
||||
|
||||
def newMessage(self, from_jid, to_jid, msg, _type, extra, profile):
|
||||
from_me = from_jid.short == self.profiles[profile]['whoami'].short
|
||||
from_me = from_jid.bare == self.profiles[profile]['whoami'].bare
|
||||
win = to_jid if from_me else from_jid
|
||||
|
||||
self.current_action_ids = set()
|
||||
self.current_action_ids_cb = {}
|
||||
|
||||
timestamp = extra.get('archive')
|
||||
self.chat_wins[win.short].printMessage(from_jid, msg, profile, float(timestamp) if timestamp else '')
|
||||
self.chat_wins[win.bare].printMessage(from_jid, msg, profile, float(timestamp) if timestamp else '')
|
||||
|
||||
def sendMessage(self, to_jid, message, subject='', mess_type="auto", options={}, profile_key="@NONE@"):
|
||||
if to_jid.startswith(const_PRIVATE_PREFIX):
|
||||
|
|
@ -303,9 +303,9 @@ class QuickApp(object):
|
|||
return
|
||||
debug (_("presence update for %(jid)s (show=%(show)s, priority=%(priority)s, statuses=%(statuses)s) [profile:%(profile)s]") % {'jid':jabber_id, 'show':show, 'priority':priority, 'statuses':statuses, 'profile':profile})
|
||||
from_jid=JID(jabber_id)
|
||||
debug ("from_jid.short=%(from_jid)s whoami.short=%(whoami)s" % {'from_jid':from_jid.short, 'whoami':self.profiles[profile]['whoami'].short})
|
||||
debug ("from_jid.bare=%(from_jid)s whoami.bare=%(whoami)s" % {'from_jid':from_jid.bare, 'whoami':self.profiles[profile]['whoami'].bare})
|
||||
|
||||
if from_jid.short==self.profiles[profile]['whoami'].short:
|
||||
if from_jid.bare==self.profiles[profile]['whoami'].bare:
|
||||
if not type:
|
||||
self.setStatusOnline(True)
|
||||
elif type=="unavailable":
|
||||
|
|
@ -317,8 +317,8 @@ class QuickApp(object):
|
|||
if show != 'unavailable':
|
||||
|
||||
#FIXME: must be moved in a plugin
|
||||
if from_jid.short in self.profiles[profile]['watched'] and not from_jid.short in self.profiles[profile]['onlineContact']:
|
||||
self.showAlert(_("Watched jid [%s] is connected !") % from_jid.short)
|
||||
if from_jid.bare in self.profiles[profile]['watched'] and not from_jid.bare in self.profiles[profile]['onlineContact']:
|
||||
self.showAlert(_("Watched jid [%s] is connected !") % from_jid.bare)
|
||||
|
||||
self.profiles[profile]['onlineContact'].add(from_jid) #FIXME onlineContact is useless with CM, must be removed
|
||||
|
||||
|
|
@ -498,9 +498,9 @@ class QuickApp(object):
|
|||
def _subscribe_cb(self, answer, data):
|
||||
entity, profile = data
|
||||
if answer:
|
||||
self.bridge.subscription("subscribed", entity.short, profile_key = profile)
|
||||
self.bridge.subscription("subscribed", entity.bare, profile_key = profile)
|
||||
else:
|
||||
self.bridge.subscription("unsubscribed", entity.short, profile_key = profile)
|
||||
self.bridge.subscription("unsubscribed", entity.bare, profile_key = profile)
|
||||
|
||||
def subscribe(self, type, raw_jid, profile):
|
||||
"""Called when a subsciption management signal is received"""
|
||||
|
|
@ -509,13 +509,13 @@ class QuickApp(object):
|
|||
entity = JID(raw_jid)
|
||||
if type=="subscribed":
|
||||
# this is a subscription confirmation, we just have to inform user
|
||||
self.showDialog(_("The contact %s has accepted your subscription") % entity.short, _('Subscription confirmation'))
|
||||
self.showDialog(_("The contact %s has accepted your subscription") % entity.bare, _('Subscription confirmation'))
|
||||
elif type=="unsubscribed":
|
||||
# this is a subscription refusal, we just have to inform user
|
||||
self.showDialog(_("The contact %s has refused your subscription") % entity.short, _('Subscription refusal'), 'error')
|
||||
self.showDialog(_("The contact %s has refused your subscription") % entity.bare, _('Subscription refusal'), 'error')
|
||||
elif type=="subscribe":
|
||||
# this is a subscriptionn request, we have to ask for user confirmation
|
||||
answer = self.showDialog(_("The contact %s wants to subscribe to your presence.\nDo you accept ?") % entity.short, _('Subscription confirmation'), 'yes/no', answer_cb = self._subscribe_cb, answer_data=(entity, profile))
|
||||
answer = self.showDialog(_("The contact %s wants to subscribe to your presence.\nDo you accept ?") % entity.bare, _('Subscription confirmation'), 'yes/no', answer_cb = self._subscribe_cb, answer_data=(entity, profile))
|
||||
|
||||
def showDialog(self, message, title, type="info", answer_cb = None):
|
||||
raise NotImplementedError
|
||||
|
|
@ -539,7 +539,7 @@ class QuickApp(object):
|
|||
target = JID(jid)
|
||||
self.contact_list.remove(target)
|
||||
try:
|
||||
self.profiles[profile]['onlineContact'].remove(target.short)
|
||||
self.profiles[profile]['onlineContact'].remove(target.bare)
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue