comparison cagou/plugins/plugin_wid_contact_list.py @ 268:520fd0f50233

contact list: fixed crash with pb on addContact and delContact
author Goffi <goffi@goffi.org>
date Mon, 11 Mar 2019 20:27:25 +0100
parents ff1efdeff53f
children 1b835bcfa663
comparison
equal deleted inserted replaced
267:896f78760b63 268:520fd0f50233
65 contact_jid = contact_jid.strip() 65 contact_jid = contact_jid.strip()
66 # FIXME: trivial jid verification 66 # FIXME: trivial jid verification
67 if not contact_jid or not re.match(r"[^@ ]+@[^@ ]+", contact_jid): 67 if not contact_jid or not re.match(r"[^@ ]+@[^@ ]+", contact_jid):
68 return 68 return
69 contact_jid = jid.JID(contact_jid).bare 69 contact_jid = jid.JID(contact_jid).bare
70 G.host.bridge.addContact(contact_jid, 70 G.host.bridge.addContact(unicode(contact_jid),
71 self.profile, 71 self.profile,
72 callback=lambda: G.host.addNote( 72 callback=lambda: G.host.addNote(
73 _(u"contact request"), 73 _(u"contact request"),
74 _(u"a contact request has been sent to {contact_jid}").format( 74 _(u"a contact request has been sent to {contact_jid}").format(
75 contact_jid=contact_jid)), 75 contact_jid=contact_jid)),
86 self.contact_item = contact_item 86 self.contact_item = contact_item
87 super(DelContactMenu, self).__init__(**kwargs) 87 super(DelContactMenu, self).__init__(**kwargs)
88 88
89 def do_delete_contact(self): 89 def do_delete_contact(self):
90 self.hide() 90 self.hide()
91 G.host.bridge.delContact(self.contact_item.jid.bare, 91 G.host.bridge.delContact(unicode(self.contact_item.jid.bare),
92 self.contact_item.profile, 92 self.contact_item.profile,
93 callback=lambda: G.host.addNote( 93 callback=lambda: G.host.addNote(
94 _(u"contact removed"), 94 _(u"contact removed"),
95 _(u"{contact_jid} has been removed from your contacts list").format( 95 _(u"{contact_jid} has been removed from your contacts list").format(
96 contact_jid=self.contact_item.jid.bare)), 96 contact_jid=self.contact_item.jid.bare)),