Author: steve-e Date: 2008-07-08 21:15:54 +0200 (Tue, 08 Jul 2008) New Revision: 9899
Modified: trunk/src/common/caps.py trunk/src/dialogs.py trunk/src/roster_window.py Log: Fix two caps related tracebacks:
Quick fix: What does not exist cannot support anything. Fixes #4031. Fix variable referencing. Fixes #4076.
Modified: trunk/src/common/caps.py =================================================================== --- trunk/src/common/caps.py 2008-07-08 18:49:51 UTC (rev 9898) +++ trunk/src/common/caps.py 2008-07-08 19:15:54 UTC (rev 9899) @@ -180,7 +180,7 @@ 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.
Modified: trunk/src/dialogs.py =================================================================== --- trunk/src/dialogs.py 2008-07-08 18:49:51 UTC (rev 9898) +++ trunk/src/dialogs.py 2008-07-08 19:15:54 UTC (rev 9899) @@ -2315,9 +2315,9 @@ 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 @@ 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
Modified: trunk/src/roster_window.py =================================================================== --- trunk/src/roster_window.py 2008-07-08 18:49:51 UTC (rev 9898) +++ trunk/src/roster_window.py 2008-07-08 19:15:54 UTC (rev 9899) @@ -5493,13 +5493,12 @@ 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 = {}