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))
|
||||
|
||||
def is_supported(self, contact, feature):
|
||||
if not contact.resource:
|
||||
if not contact or not contact.resource:
|
||||
return False
|
||||
|
||||
# FIXME: We assume everything is supported if we got no caps.
|
||||
|
|
|
@ -2315,9 +2315,9 @@ class SingleMessageWindow:
|
|||
if gajim.connections[self.account].connected <= 1:
|
||||
# if offline or connecting
|
||||
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
|
||||
if type(self.to) == type([]):
|
||||
if isinstance(self.to, list):
|
||||
sender_list = [i[0].jid + '/' + i[0].resource for i in self.to]
|
||||
else:
|
||||
sender_list = [self.to_entry.get_text().decode('utf-8')]
|
||||
|
@ -2325,14 +2325,15 @@ class SingleMessageWindow:
|
|||
for to_whom_jid in sender_list:
|
||||
if self.completion_dict.has_key(to_whom_jid):
|
||||
to_whom_jid = self.completion_dict[to_whom_jid].jid
|
||||
|
||||
subject = self.subject_entry.get_text().decode('utf-8')
|
||||
begin, end = self.message_tv_buffer.get_bounds()
|
||||
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,
|
||||
message)
|
||||
return
|
||||
continue
|
||||
|
||||
if self.session:
|
||||
session = self.session
|
||||
|
|
|
@ -5493,13 +5493,12 @@ class RosterWindow:
|
|||
if len(contact_list) > 1: # several resources
|
||||
invite_to_new_room_menuitem.set_submenu(self.build_resources_submenu(
|
||||
contact_list, account, self.on_invite_to_new_room, cap=NS_MUC))
|
||||
elif len(list_) == 1 and gajim.capscache.is_supported(contact, NS_MUC):
|
||||
invite_menuitem.set_sensitive(True)
|
||||
invite_to_new_room_menuitem.connect('activate',
|
||||
self.on_invite_to_new_room, list_)
|
||||
else:
|
||||
if gajim.capscache.is_supported(contact, NS_MUC):
|
||||
invite_menuitem.set_sensitive(True)
|
||||
invite_to_new_room_menuitem.connect('activate',
|
||||
self.on_invite_to_new_room, list_)
|
||||
else:
|
||||
invite_menuitem.set_sensitive(False)
|
||||
invite_menuitem.set_sensitive(False)
|
||||
# transform None in 'jabber'
|
||||
c_t = contacts_transport or 'jabber'
|
||||
muc_jid = {}
|
||||
|
|
Loading…
Reference in New Issue