comparison frontends/sortilege_old/sortilege @ 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
parents 952322b1d490
children
comparison
equal deleted inserted replaced
687:af0d08a84cc6 688:f7878ad3c846
108 self.update() #FIXME: window is not updated correctly (contacts are still here until C-L) 108 self.update() #FIXME: window is not updated correctly (contacts are still here until C-L)
109 109
110 def replace(self, jid, groups=None): 110 def replace(self, jid, groups=None):
111 """add a contact to the list""" 111 """add a contact to the list"""
112 name = self.CM.getAttr(jid,'name') 112 name = self.CM.getAttr(jid,'name')
113 self.jid_list.append(jid.short) 113 self.jid_list.append(jid.bare)
114 self.update() 114 self.update()
115 115
116 def indexUp(self): 116 def indexUp(self):
117 """increment select contact index""" 117 """increment select contact index"""
118 if self.__index < len(self.jid_list)-1: #we dont want to select a missing contact 118 if self.__index < len(self.jid_list)-1: #we dont want to select a missing contact
129 """for now, we just remove the contact""" 129 """for now, we just remove the contact"""
130 self.remove(jid) 130 self.remove(jid)
131 131
132 def remove(self, jid): 132 def remove(self, jid):
133 """remove a contact from the list""" 133 """remove a contact from the list"""
134 self.jid_list.remove(jid.short) 134 self.jid_list.remove(jid.bare)
135 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 135 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
136 self.__index = len(self.jid_list)-1 136 self.__index = len(self.jid_list)-1
137 self.update() 137 self.update()
138 138
139 def update(self): 139 def update(self):
262 262
263 def onContactChoosed(self, jid_txt): 263 def onContactChoosed(self, jid_txt):
264 """Called when a contact is selected in contact list.""" 264 """Called when a contact is selected in contact list."""
265 jid=JID(jid_txt) 265 jid=JID(jid_txt)
266 debug (_("contact choosed: %s"), jid) 266 debug (_("contact choosed: %s"), jid)
267 self.showChat(jid.short) 267 self.showChat(jid.bare)
268 self.statusBar.remove_item(jid.short) 268 self.statusBar.remove_item(jid.bare)
269 if len(self.statusBar)==0: 269 if len(self.statusBar)==0:
270 self.statusBar.hide() 270 self.statusBar.hide()
271 self.sizer.update() 271 self.sizer.update()
272 272
273 273
296 296
297 def newMessage(self, from_jid, msg, type, to_jid, profile): 297 def newMessage(self, from_jid, msg, type, to_jid, profile):
298 QuickApp.newMessage(self, from_jid, msg, type, to_jid, profile) 298 QuickApp.newMessage(self, from_jid, msg, type, to_jid, profile)
299 sender=JID(from_jid) 299 sender=JID(from_jid)
300 addr=JID(to_jid) 300 addr=JID(to_jid)
301 win = addr if sender.short == self.whoami.short else sender #FIXME: duplicate code with QuickApp 301 win = addr if sender.bare == self.whoami.bare else sender #FIXME: duplicate code with QuickApp
302 if (self.currentChat==None): 302 if (self.currentChat==None):
303 self.currentChat=win.short 303 self.currentChat=win.bare
304 self.showChat(win.short) 304 self.showChat(win.bare)
305 305
306 # we show the window in the status bar 306 # we show the window in the status bar
307 if not self.currentChat == win.short: 307 if not self.currentChat == win.bare:
308 self.statusBar.add_item(win.short) 308 self.statusBar.add_item(win.bare)
309 self.statusBar.show() 309 self.statusBar.show()
310 self.sizer.update() 310 self.sizer.update()
311 self.statusBar.update() 311 self.statusBar.update()
312 312
313 self.editBar.replace_cur() 313 self.editBar.replace_cur()