Mercurial > libervia-backend
changeset 688:f7878ad3c846
tools: renamed tools.jid.JID attribute "short" to "bare"
author | souliane <souliane@mailoo.org> |
---|---|
date | Tue, 29 Oct 2013 16:26:55 +0100 (2013-10-29) |
parents | af0d08a84cc6 |
children | 78bf4ed37574 |
files | frontends/sortilege_old/chat.py frontends/sortilege_old/sortilege frontends/src/jp/jp frontends/src/primitivus/chat.py frontends/src/primitivus/contact_list.py frontends/src/primitivus/primitivus frontends/src/quick_frontend/quick_app.py frontends/src/quick_frontend/quick_chat.py frontends/src/quick_frontend/quick_chat_list.py frontends/src/quick_frontend/quick_contact_list.py frontends/src/quick_frontend/quick_contact_management.py frontends/src/quick_frontend/quick_utils.py frontends/src/wix/chat.py frontends/src/wix/contact_list.py frontends/src/wix/main_window.py src/tools/jid.py |
diffstat | 16 files changed, 94 insertions(+), 94 deletions(-) [+] |
line wrap: on
line diff
--- a/frontends/sortilege_old/chat.py Mon Oct 28 19:04:49 2013 +0100 +++ b/frontends/sortilege_old/chat.py Tue Oct 29 16:26:55 2013 +0100 @@ -82,7 +82,7 @@ header=self.__getHeader(self.content[idx]) msg=self.content[idx][2] part=0 #part of the text - if JID(self.content[idx][1]).short==self.host.profiles[self.host.profile]['whoami'].short: + if JID(self.content[idx][1]).bare==self.host.profiles[self.host.profile]['whoami'].bare: att_header=curses.color_pair(1) else: att_header=curses.color_pair(2) @@ -140,7 +140,7 @@ timestamp=str(current_time) if self.last_history and current_time - float(self.last_history) < 5: #FIXME: Q&D fix to avoid double print on new chat window return - self.content.append([timestamp,jid.short,msg]) + self.content.append([timestamp,jid.bare,msg]) self.update() def handleKey(self, k):
--- a/frontends/sortilege_old/sortilege Mon Oct 28 19:04:49 2013 +0100 +++ b/frontends/sortilege_old/sortilege Tue Oct 29 16:26:55 2013 +0100 @@ -110,7 +110,7 @@ def replace(self, jid, groups=None): """add a contact to the list""" name = self.CM.getAttr(jid,'name') - self.jid_list.append(jid.short) + self.jid_list.append(jid.bare) self.update() def indexUp(self): @@ -131,7 +131,7 @@ def remove(self, jid): """remove a contact from the list""" - self.jid_list.remove(jid.short) + self.jid_list.remove(jid.bare) if self.__index >= len(self.jid_list) and self.__index > 0: #if select index is out of border, we put it on the last contact self.__index = len(self.jid_list)-1 self.update() @@ -264,8 +264,8 @@ """Called when a contact is selected in contact list.""" jid=JID(jid_txt) debug (_("contact choosed: %s"), jid) - self.showChat(jid.short) - self.statusBar.remove_item(jid.short) + self.showChat(jid.bare) + self.statusBar.remove_item(jid.bare) if len(self.statusBar)==0: self.statusBar.hide() self.sizer.update() @@ -298,14 +298,14 @@ QuickApp.newMessage(self, from_jid, msg, type, to_jid, profile) sender=JID(from_jid) addr=JID(to_jid) - win = addr if sender.short == self.whoami.short else sender #FIXME: duplicate code with QuickApp + win = addr if sender.bare == self.whoami.bare else sender #FIXME: duplicate code with QuickApp if (self.currentChat==None): - self.currentChat=win.short - self.showChat(win.short) + self.currentChat=win.bare + self.showChat(win.bare) # we show the window in the status bar - if not self.currentChat == win.short: - self.statusBar.add_item(win.short) + if not self.currentChat == win.bare: + self.statusBar.add_item(win.bare) self.statusBar.show() self.sizer.update() self.statusBar.update()
--- a/frontends/src/jp/jp Mon Oct 28 19:04:49 2013 +0100 +++ b/frontends/src/jp/jp Tue Oct 29 16:26:55 2013 +0100 @@ -321,7 +321,7 @@ #if the resource is not given, we try to add the last known resource last_resource = self.bridge.getLastResource(param_jid, self.options.profile) if last_resource: - return "%s/%s" % (_jid.short, last_resource) + return "%s/%s" % (_jid.bare, last_resource) return param_jid @@ -334,7 +334,7 @@ if confirm_type == "FILE_TRANSFER": if not self.options.wait_file: return - if self.dest_jids and not JID(data['from']).short in [JID(_jid).short for _jid in self.dest_jids]: + if self.dest_jids and not JID(data['from']).bare in [JID(_jid).bare for _jid in self.dest_jids]: return #file is not sent by a filtered jid answer_data["dest_path"] = os.getcwd()+'/'+data['filename'] @@ -354,7 +354,7 @@ elif confirm_type == "PIPE_TRANSFER": if not self.options.pipe_in: return - if self.dest_jids and not JID(data['from']).short in [JID(_jid).short for _jid in self.dest_jids]: + if self.dest_jids and not JID(data['from']).bare in [JID(_jid).bare for _jid in self.dest_jids]: return #pipe stream is not sent by a filtered jid tmp_dir = tempfile.mkdtemp()
--- a/frontends/src/primitivus/chat.py Mon Oct 28 19:04:49 2013 +0100 +++ b/frontends/src/primitivus/chat.py Tue Oct 29 16:26:55 2013 +0100 @@ -190,7 +190,7 @@ #We ignore click on our own nick return #we have a click on a nick, we add the private conversation to the contact_list - full_jid = JID("%s/%s" % (self.target.short, nick)) + full_jid = JID("%s/%s" % (self.target.bare, nick)) new_jid = escapePrivate(full_jid) if new_jid not in self.host.contact_list: self.host.contact_list.add(new_jid) @@ -340,9 +340,9 @@ def onFileSelected(self, filepath): self.host.removePopUp() #FIXME: check last_resource: what if self.target.resource exists ? - last_resource = self.host.bridge.getLastResource(unicode(self.target.short), self.host.profile) + last_resource = self.host.bridge.getLastResource(unicode(self.target.bare), self.host.profile) if last_resource: - full_jid = JID("%s/%s" % (self.target.short, last_resource)) + full_jid = JID("%s/%s" % (self.target.bare, last_resource)) else: full_jid = self.target progress_id = self.host.bridge.sendFile(full_jid, filepath, {}, self.host.profile)
--- a/frontends/src/primitivus/contact_list.py Mon Oct 28 19:04:49 2013 +0100 +++ b/frontends/src/primitivus/contact_list.py Tue Oct 29 16:26:55 2013 +0100 @@ -70,7 +70,7 @@ def __contains__(self, jid): for group in self.groups: - if jid.short in self.groups[group][1]: + if jid.bare in self.groups[group][1]: return True return False @@ -108,7 +108,7 @@ def putAlert(self, jid): """Put an alert on the jid to get attention from user (e.g. for new message)""" - self.alert_jid.add(jid.short) + self.alert_jid.add(jid.bare) self.update() def __groupClicked(self, group_wid): @@ -153,7 +153,7 @@ and not contact in self.alert_jid and contact != self.selected): continue show_icon, show_attr = const_SHOW_ICON.get(show,('','default')) - contact_disp = ('alert' if contact in self.alert_jid else show_attr, nick or name or jid.node or jid.short) + contact_disp = ('alert' if contact in self.alert_jid else show_attr, nick or name or jid.node or jid.bare) display = [ show_icon + " " , contact_disp] if self.show_status: status_disp = ('status',"\n " + status) if status else "" @@ -180,7 +180,7 @@ jid=JID(special) name = self.getCache(jid, 'name') nick = self.getCache(jid, 'nick') - special_disp = ('alert' if special in self.alert_jid else 'default', nick or name or jid.node or jid.short) + special_disp = ('alert' if special in self.alert_jid else 'default', nick or name or jid.node or jid.bare) display = [ " " , special_disp] header = '(*) ' if special in self.alert_jid else '' widget = sat_widgets.SelectableText(display, @@ -233,7 +233,7 @@ def replace(self, jid, groups=None, attributes=None): """add a contact to the list if doesn't exist, else update it""" QuickContactList.replace(self, jid, groups, attributes) - if jid.short in self.specials: + if jid.bare in self.specials: return if not groups: groups = [None] @@ -244,7 +244,7 @@ for group in groups: if not self.groups.has_key(group): self.groups[group] = [True,set()] #[unfold,list_of_contacts] - self.groups[group][1].add(jid.short) + self.groups[group][1].add(jid.bare) self.update() def remove(self, jid): @@ -253,8 +253,8 @@ groups_to_remove = [] for group in self.groups: contacts = self.groups[group][1] - if jid.short in contacts: - contacts.remove(jid.short) + if jid.bare in contacts: + contacts.remove(jid.bare) if not len(contacts): groups_to_remove.append(group) for group in groups_to_remove: @@ -275,7 +275,7 @@ if None in self.groups: folded, group_jids = self.groups[None] for group_jid in group_jids: - if JID(group_jid).short == special_jid.short: + if JID(group_jid).bare == special_jid.bare: group_jids.remove(group_jid) break self.update() @@ -286,5 +286,5 @@ def updatePresence(self, jid, show, priority, statuses): #XXX: for the moment, we ignore presence updates for special entities - if jid.short not in self.specials: + if jid.bare not in self.specials: QuickContactList.updatePresence(self, jid, show, priority, statuses)
--- a/frontends/src/primitivus/primitivus Mon Oct 28 19:04:49 2013 +0100 +++ b/frontends/src/primitivus/primitivus Tue Oct 29 16:26:55 2013 +0100 @@ -374,13 +374,13 @@ def newMessage(self, from_jid, to_jid, msg, _type, extra, profile): QuickApp.newMessage(self, from_jid, to_jid, msg, _type, extra, profile) - if not from_jid in self.contact_list and from_jid.short != self.profiles[profile]['whoami'].short: + if not from_jid in self.contact_list and from_jid.bare != self.profiles[profile]['whoami'].bare: #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(from_jid) - if JID(self.contact_list.selected).short != from_jid.short: + if JID(self.contact_list.selected).bare != from_jid.bare: self.contact_list.putAlert(from_jid) def _dialogOkCb(self, widget, data): @@ -518,7 +518,7 @@ self.removePopUp() jid=JID(edit.get_edit_text()) if jid.is_valid(): - self.bridge.addContact(jid.short, profile_key=self.profile) + self.bridge.addContact(jid.bare, profile_key=self.profile) else: message = _("'%s' is an invalid JID !") % jid error (message) @@ -623,7 +623,7 @@ self.chat_wins[win].updateChatState(state) return - from_bare = JID(from_jid_s).short + from_bare = JID(from_jid_s).bare if from_bare in self.chat_wins: self.chat_wins[from_bare].updateChatState(state)
--- a/frontends/src/quick_frontend/quick_app.py Mon Oct 28 19:04:49 2013 +0100 +++ b/frontends/src/quick_frontend/quick_app.py Tue Oct 29 16:26:55 2013 +0100 @@ -254,7 +254,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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
--- a/frontends/src/quick_frontend/quick_chat.py Mon Oct 28 19:04:49 2013 +0100 +++ b/frontends/src/quick_frontend/quick_chat.py Tue Oct 29 16:26:55 2013 +0100 @@ -110,15 +110,15 @@ if self.target.startswith(const_PRIVATE_PREFIX): target = unescapePrivate(self.target) else: - target = self.target.short + target = self.target.bare - self.host.bridge.getHistory(self.host.profiles[profile]['whoami'].short, target, 20, profile=profile, callback=onHistory, errback=onHistoryError) + self.host.bridge.getHistory(self.host.profiles[profile]['whoami'].bare, target, 20, profile=profile, callback=onHistory, errback=onHistoryError) def _get_nick(self, jid): """Return nick of this jid when possible""" if self.target.startswith(const_PRIVATE_PREFIX): unescaped = unescapePrivate(self.target) - if jid.startswith(const_PRIVATE_PREFIX) or unescaped.short == jid.short: + if jid.startswith(const_PRIVATE_PREFIX) or unescaped.bare == jid.bare: return unescaped.resource return jid.resource if self.type == "group" else (self.host.contact_list.getCache(jid,'nick') or self.host.contact_list.getCache(jid,'name') or jid.node) @@ -126,7 +126,7 @@ """Print message in chat window. Must be implemented by child class""" jid=JID(from_jid) nick = self._get_nick(jid) - mymess = (jid.resource == self.nick) if self.type == "group" else (jid.short == self.host.profiles[profile]['whoami'].short) #mymess = True if message comes from local user + mymess = (jid.resource == self.nick) if self.type == "group" else (jid.bare == self.host.profiles[profile]['whoami'].bare) #mymess = True if message comes from local user if msg.startswith('/me '): self.printInfo('* %s %s' % (nick, msg[4:]),type='me', timestamp=timestamp) return
--- a/frontends/src/quick_frontend/quick_chat_list.py Mon Oct 28 19:04:49 2013 +0100 +++ b/frontends/src/quick_frontend/quick_chat_list.py Tue Oct 29 16:26:55 2013 +0100 @@ -30,10 +30,10 @@ def __getitem__(self, to_jid): target = JID(to_jid) - if not target.short in self: + if not target.bare in self: #we have to create the chat win - self[target.short] = self.createChat(target) - return dict.__getitem__(self, target.short) + self[target.bare] = self.createChat(target) + return dict.__getitem__(self, target.bare) def createChat(self, target): raise NotImplementedError
--- a/frontends/src/quick_frontend/quick_contact_list.py Mon Oct 28 19:04:49 2013 +0100 +++ b/frontends/src/quick_frontend/quick_contact_list.py Tue Oct 29 16:26:55 2013 +0100 @@ -34,7 +34,7 @@ def getCache(self, jid, name): try: - jid_cache = self._cache[jid.short] + jid_cache = self._cache[jid.bare] if name == 'status': #XXX: we get the first status for 'status' key return jid_cache['statuses'].get('default','') return jid_cache[name] @@ -42,7 +42,7 @@ return None def setCache(self, jid, name, value): - jid_cache = self._cache.setdefault(jid.short, {}) + jid_cache = self._cache.setdefault(jid.bare, {}) jid_cache[name] = value def __contains__(self, jid): @@ -60,7 +60,7 @@ def remove(self, jid): """remove a contact from the list""" try: - del self.specials[jid.short] + del self.specials[jid.bare] except KeyError: pass @@ -70,7 +70,7 @@ def getSpecial(self, jid): """Return special type of jid, or None if it's not special""" - return self.specials.get(jid.short) + return self.specials.get(jid.bare) def setSpecial(self, jid, _type, show=False): """Set entity as a special @@ -78,7 +78,7 @@ @param _type: special type (e.g.: "MUC") @param show: True to display the dialog to chat with this entity """ - self.specials[jid.short] = _type + self.specials[jid.bare] = _type def updatePresence(self, jid, show, priority, statuses): """Update entity's presence status
--- a/frontends/src/quick_frontend/quick_contact_management.py Mon Oct 28 19:04:49 2013 +0100 +++ b/frontends/src/quick_frontend/quick_contact_management.py Tue Oct 29 16:26:55 2013 +0100 @@ -30,7 +30,7 @@ self.__contactlist = {} def __contains__(self, entity): - return entity.short in self.__contactlist + return entity.bare in self.__contactlist def clear(self): """Clear all the contact list""" @@ -38,13 +38,13 @@ def add(self, entity): """Add contact to the list, update resources""" - if not self.__contactlist.has_key(entity.short): - self.__contactlist[entity.short] = {'resources':[]} + if not self.__contactlist.has_key(entity.bare): + self.__contactlist[entity.bare] = {'resources':[]} if not entity.resource: return - if entity.resource in self.__contactlist[entity.short]['resources']: - self.__contactlist[entity.short]['resources'].remove(entity.resource) - self.__contactlist[entity.short]['resources'].append(entity.resource) + if entity.resource in self.__contactlist[entity.bare]['resources']: + self.__contactlist[entity.bare]['resources'].remove(entity.resource) + self.__contactlist[entity.bare]['resources'].append(entity.resource) def getContFromGroup(self, group): """Return all contacts which are in given group""" @@ -60,28 +60,28 @@ @param entity: jid of the contact @param name: name of the attribute @return: asked attribute""" - if self.__contactlist.has_key(entity.short): + if self.__contactlist.has_key(entity.bare): if name == 'status': #FIXME: for the moment, we only use the first status - if self.__contactlist[entity.short]['statuses']: - return self.__contactlist[entity.short]['statuses'].values()[0] - if self.__contactlist[entity.short].has_key(name): - return self.__contactlist[entity.short][name] + if self.__contactlist[entity.bare]['statuses']: + return self.__contactlist[entity.bare]['statuses'].values()[0] + if self.__contactlist[entity.bare].has_key(name): + return self.__contactlist[entity.bare][name] else: debug(_('Trying to get attribute for an unknown contact')) return None def isConnected(self, entity): """Tell if the contact is online""" - return self.__contactlist.has_key(entity.short) + return self.__contactlist.has_key(entity.bare) def remove(self, entity): """remove resource. If no more resource is online or is no resource is specified, contact is deleted""" try: if entity.resource: - self.__contactlist[entity.short]['resources'].remove(entity.resource) - if not entity.resource or not self.__contactlist[entity.short]['resources']: + self.__contactlist[entity.bare]['resources'].remove(entity.resource) + if not entity.resource or not self.__contactlist[entity.bare]['resources']: #no more resource available: the contact seems really disconnected - del self.__contactlist[entity.short] + del self.__contactlist[entity.bare] except KeyError: error(_('INTERNAL ERROR: Key error')) raise @@ -92,11 +92,11 @@ @param key: name of the attribute @param value: value of the attribute """ - if self.__contactlist.has_key(entity.short): - self.__contactlist[entity.short][key] = value + if self.__contactlist.has_key(entity.bare): + self.__contactlist[entity.bare][key] = value else: - debug (_('Trying to update an unknown contact: %s'), entity.short) + debug (_('Trying to update an unknown contact: %s'), entity.bare) def get_full(self, entity): - return entity.short+'/'+self.__contactlist[entity.short]['resources'][-1] + return entity.bare+'/'+self.__contactlist[entity.bare]['resources'][-1]
--- a/frontends/src/quick_frontend/quick_utils.py Mon Oct 28 19:04:49 2013 +0100 +++ b/frontends/src/quick_frontend/quick_utils.py Tue Oct 29 16:26:55 2013 +0100 @@ -22,7 +22,7 @@ def escapePrivate(ori_jid): """Escape a private jid""" - return JID(const_PRIVATE_PREFIX + ori_jid.short + '@' + ori_jid.resource) + return JID(const_PRIVATE_PREFIX + ori_jid.bare + '@' + ori_jid.resource) def unescapePrivate(escaped_jid): if not escaped_jid.startswith(const_PRIVATE_PREFIX):
--- a/frontends/src/wix/chat.py Mon Oct 28 19:04:49 2013 +0100 +++ b/frontends/src/wix/chat.py Tue Oct 29 16:26:55 2013 +0100 @@ -199,7 +199,7 @@ def onEnterPressed(self, event): """Behaviour when enter pressed in send line.""" - self.host.sendMessage(self.target.short if self.type == 'group' else self.target, + self.host.sendMessage(self.target.bare if self.type == 'group' else self.target, event.GetString(), mess_type="groupchat" if self.type == 'group' else "chat", profile_key=self.host.profile) @@ -257,9 +257,9 @@ if filename: debug(_("filename: %s"),filename) #FIXME: check last_resource: what if self.target.resource exists ? - last_resource = self.host.bridge.getLastResource(unicode(self.target.short), self.host.profile) + last_resource = self.host.bridge.getLastResource(unicode(self.target.bare), self.host.profile) if last_resource: - full_jid = JID("%s/%s" % (self.target.short, last_resource)) + full_jid = JID("%s/%s" % (self.target.bare, last_resource)) else: full_jid = self.target id = self.host.bridge.sendFile(full_jid, filename, {}, self.host.profile)
--- a/frontends/src/wix/contact_list.py Mon Oct 28 19:04:49 2013 +0100 +++ b/frontends/src/wix/contact_list.py Tue Oct 29 16:26:55 2013 +0100 @@ -65,7 +65,7 @@ @return: list of indexes""" result=[] for i in range(self.GetCount()): - if (type(entity) == JID and type(self.GetClientData(i)) == JID and self.GetClientData(i).short == entity.short) or\ + if (type(entity) == JID and type(self.GetClientData(i)) == JID and self.GetClientData(i).bare == entity.bare) or\ self.GetClientData(i) == entity: result.append(i) return result @@ -136,7 +136,7 @@ </td> </table> """ % (avatar, - escape(nick or name or jid.node or jid.short), + escape(nick or name or jid.node or jid.bare), show_html, escape(status))
--- a/frontends/src/wix/main_window.py Mon Oct 28 19:04:49 2013 +0100 +++ b/frontends/src/wix/main_window.py Tue Oct 29 16:26:55 2013 +0100 @@ -339,10 +339,10 @@ def onContactActivated(self, jid): debug (_("onContactActivated: %s"), jid) - if self.chat_wins[jid.short].IsShown(): - self.chat_wins[jid.short].Hide() + if self.chat_wins[jid.bare].IsShown(): + self.chat_wins[jid.bare].Hide() else: - self.chat_wins[jid.short].Show() + self.chat_wins[jid.bare].Show() def onConnectRequest(self, e): self.bridge.connect(self.profile) @@ -394,7 +394,7 @@ if dlg.ShowModal() == wx.ID_OK: jid=JID(dlg.GetValue()) if jid.is_valid(): - self.bridge.addContact(jid.short, profile_key=self.profile) + self.bridge.addContact(jid.bare, profile_key=self.profile) else: error (_("'%s' is an invalid JID !"), jid) #TODO: notice the user @@ -413,14 +413,14 @@ dlg.Destroy() return - dlg = wx.MessageDialog(self, _("Are you sure you want to delete %s from your roster list ?") % target.short, + dlg = wx.MessageDialog(self, _("Are you sure you want to delete %s from your roster list ?") % target.bare, _('Contact suppression'), wx.YES_NO | wx.ICON_QUESTION ) if dlg.ShowModal() == wx.ID_YES: - info(_("Unsubscribing %s presence"), target.short) - self.bridge.delContact(target.short, profile_key=self.profile) + info(_("Unsubscribing %s presence"), target.bare) + self.bridge.delContact(target.bare, profile_key=self.profile) dlg.Destroy() @@ -435,7 +435,7 @@ dlg.ShowModal() dlg.Destroy() return - _id = self.bridge.getCard(target.short, profile_key=self.profile) + _id = self.bridge.getCard(target.bare, profile_key=self.profile) self.current_action_ids.add(_id) self.current_action_ids_cb[_id] = self.onProfileReceived
--- a/src/tools/jid.py Mon Oct 28 19:04:49 2013 +0100 +++ b/src/tools/jid.py Tue Oct 29 16:26:55 2013 +0100 @@ -27,7 +27,7 @@ return self def __parse(self): - """find node domaine and resource""" + """find node domain and resource""" node_end = self.find('@') if node_end < 0: node_end = 0 @@ -38,11 +38,11 @@ self.domain = self[(node_end + 1) if node_end else 0:domain_end] self.resource = self[domain_end + 1:] if not node_end: - self.short = self + self.bare = self else: - self.short = self.node + '@' + self.domain + self.bare = self.node + '@' + self.domain def is_valid(self): """return True if the jid is xmpp compliant""" - #FIXME: always return True for the moment - return True + #TODO: implement real check, according to RFCs + return self.domain != ""