Fix two caps related tracebacks:
Quick fix: What does not exist cannot support anything. Fixes #4031. Fix variable referencing. Fixes #4076.
This commit is contained in:
parent
fca6bdbbc4
commit
c99048b02f
|
@ -180,7 +180,7 @@ class CapsCache(object):
|
||||||
con.discoverInfo(jid, '%s#%s' % (node, hash))
|
con.discoverInfo(jid, '%s#%s' % (node, hash))
|
||||||
|
|
||||||
def is_supported(self, contact, feature):
|
def is_supported(self, contact, feature):
|
||||||
if not contact.resource:
|
if not contact or not contact.resource:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# FIXME: We assume everything is supported if we got no caps.
|
# FIXME: We assume everything is supported if we got no caps.
|
||||||
|
|
|
@ -2317,7 +2317,7 @@ class SingleMessageWindow:
|
||||||
ErrorDialog(_('Connection not available'),
|
ErrorDialog(_('Connection not available'),
|
||||||
_('Please make sure you are connected with "%s".') % self.account)
|
_('Please make sure you are connected with "%s".') % self.account)
|
||||||
return
|
return
|
||||||
if type(self.to) == type([]):
|
if isinstance(self.to, list):
|
||||||
sender_list = [i[0].jid + '/' + i[0].resource for i in self.to]
|
sender_list = [i[0].jid + '/' + i[0].resource for i in self.to]
|
||||||
else:
|
else:
|
||||||
sender_list = [self.to_entry.get_text().decode('utf-8')]
|
sender_list = [self.to_entry.get_text().decode('utf-8')]
|
||||||
|
@ -2325,14 +2325,15 @@ class SingleMessageWindow:
|
||||||
for to_whom_jid in sender_list:
|
for to_whom_jid in sender_list:
|
||||||
if self.completion_dict.has_key(to_whom_jid):
|
if self.completion_dict.has_key(to_whom_jid):
|
||||||
to_whom_jid = self.completion_dict[to_whom_jid].jid
|
to_whom_jid = self.completion_dict[to_whom_jid].jid
|
||||||
|
|
||||||
subject = self.subject_entry.get_text().decode('utf-8')
|
subject = self.subject_entry.get_text().decode('utf-8')
|
||||||
begin, end = self.message_tv_buffer.get_bounds()
|
begin, end = self.message_tv_buffer.get_bounds()
|
||||||
message = self.message_tv_buffer.get_text(begin, end).decode('utf-8')
|
message = self.message_tv_buffer.get_text(begin, end).decode('utf-8')
|
||||||
|
|
||||||
if to_whom_jid.find('/announce/') != -1:
|
if '/announce/' in to_whom_jid:
|
||||||
gajim.connections[self.account].send_motd(to_whom_jid, subject,
|
gajim.connections[self.account].send_motd(to_whom_jid, subject,
|
||||||
message)
|
message)
|
||||||
return
|
continue
|
||||||
|
|
||||||
if self.session:
|
if self.session:
|
||||||
session = self.session
|
session = self.session
|
||||||
|
|
|
@ -5493,8 +5493,7 @@ class RosterWindow:
|
||||||
if len(contact_list) > 1: # several resources
|
if len(contact_list) > 1: # several resources
|
||||||
invite_to_new_room_menuitem.set_submenu(self.build_resources_submenu(
|
invite_to_new_room_menuitem.set_submenu(self.build_resources_submenu(
|
||||||
contact_list, account, self.on_invite_to_new_room, cap=NS_MUC))
|
contact_list, account, self.on_invite_to_new_room, cap=NS_MUC))
|
||||||
else:
|
elif len(list_) == 1 and gajim.capscache.is_supported(contact, NS_MUC):
|
||||||
if gajim.capscache.is_supported(contact, NS_MUC):
|
|
||||||
invite_menuitem.set_sensitive(True)
|
invite_menuitem.set_sensitive(True)
|
||||||
invite_to_new_room_menuitem.connect('activate',
|
invite_to_new_room_menuitem.connect('activate',
|
||||||
self.on_invite_to_new_room, list_)
|
self.on_invite_to_new_room, list_)
|
||||||
|
|
Loading…
Reference in New Issue