Changeset 9871
- Timestamp:
- 07/01/08 12:26:50 (5 months ago)
- Location:
- trunk/src
- Files:
-
- 2 modified
-
chat_control.py (modified) (3 diffs)
-
roster_window.py (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/chat_control.py
r9863 r9871 46 46 constants = Constants() 47 47 from common.rst_xhtml_generator import create_xhtml 48 from common.xmpp.protocol import NS_XHTML 48 from common.xmpp.protocol import NS_XHTML, NS_FILE, NS_MUC 49 49 50 50 try: … … 1075 1075 # If we don't have resource, we can't do file transfer 1076 1076 # in transports, contact holds our info we need to disable it too 1077 if self.TYPE_ID == message_control.TYPE_PM and self.gc_contact.jid and \1078 self.gc_contact.resource:1077 if NS_FILE in gajim.capscache[(contact.caps_hash_method, 1078 contact.caps_hash)].features: 1079 1079 send_file_button.set_sensitive(True) 1080 elif contact.resource and contact.jid.find('@') != -1:1081 send_file_button.set_sensitive(True)1082 1080 else: 1083 1081 send_file_button.set_sensitive(False) 1084 1082 1085 1083 # check if it's possible to convert to groupchat 1086 if gajim.get_transport_name_from_jid(self.contact.jid) or \ 1087 gajim.connections[self.account].is_zeroconf: 1084 if NS_MUC in gajim.capscache[(contact.caps_hash_method, 1085 contact.caps_hash)].features: 1086 convert_to_gc_button.set_sensitive(True) 1087 else: 1088 1088 convert_to_gc_button.set_sensitive(False) 1089 1089 … … 1822 1822 # If we don't have resource, we can't do file transfer 1823 1823 # in transports, contact holds our info we need to disable it too 1824 if self.TYPE_ID == message_control.TYPE_PM and self.gc_contact.jid and \1825 self.gc_contact.resource:1824 if NS_FILE in gajim.capscache[(contact.caps_hash_method, 1825 contact.caps_hash)].features: 1826 1826 send_file_menuitem.set_sensitive(True) 1827 elif contact.resource and contact.jid.find('@') != -1:1828 send_file_menuitem.set_sensitive(True)1829 1827 else: 1830 1828 send_file_menuitem.set_sensitive(False) 1831 1829 1832 1830 # check if it's possible to convert to groupchat 1833 if gajim.get_transport_name_from_jid(jid) or \ 1834 gajim.connections[self.account].is_zeroconf: 1831 if NS_MUC in gajim.capscache[(contact.caps_hash_method, 1832 contact.caps_hash)].features: 1833 convert_to_gc_menuitem.set_sensitive(True) 1834 else: 1835 1835 convert_to_gc_menuitem.set_sensitive(False) 1836 1836 -
trunk/src/roster_window.py
r9869 r9871 61 61 import dbus 62 62 from lastfm_track_listener import LastFMTrackListener 63 64 from common.xmpp.protocol import NS_COMMANDS, NS_FILE, NS_MUC 63 65 64 66 try: … … 4883 4885 self.on_roster_treeview_row_activated, tree_path) 4884 4886 4885 if contact.resource: 4887 if contact.resource and NS_FILE in gajim.capscache[ 4888 (contact.caps_hash_method, contact.caps_hash)].features: 4889 send_file_menuitem.set_sensitive(True) 4886 4890 send_file_menuitem.connect('activate', 4887 4891 self.on_send_file_menuitem_activate, contact, account) 4888 else: # if we do no have resource we cannot do much4892 else: 4889 4893 send_file_menuitem.set_sensitive(False) 4890 4894 … … 5036 5040 account, gajim.interface.on_open_chat_window)) 5037 5041 send_file_menuitem.set_submenu(self.build_resources_submenu(contacts, 5038 account, self.on_send_file_menuitem_activate)) 5042 account, self.on_send_file_menuitem_activate, 5043 cap=NS_FILE)) 5039 5044 execute_command_menuitem.set_submenu(self.build_resources_submenu( 5040 contacts, account, self.on_execute_command)) 5045 contacts, account, self.on_execute_command, 5046 cap=NS_COMMANDS)) 5041 5047 5042 5048 else: # one resource 5043 5049 start_chat_menuitem.connect('activate', 5044 5050 gajim.interface.on_open_chat_window, contact, account) 5045 execute_command_menuitem.connect('activate', self.on_execute_command, 5046 contact, account, contact.resource) 5051 if contact.resource and NS_FILE in gajim.capscache[ 5052 (contact.caps_hash_method, contact.caps_hash)].features: 5053 execute_command_menuitem.set_sensitive(True) 5054 execute_command_menuitem.connect('activate', self.on_execute_command, 5055 contact, account, contact.resource) 5056 else: 5057 execute_command_menuitem.set_sensitive(False) 5047 5058 5048 5059 our_jid_other_resource = None … … 5052 5063 # Else this var is useless but harmless in next connect calls 5053 5064 5054 if contact.resource: 5065 if contact.resource and NS_FILE in gajim.capscache[ 5066 (contact.caps_hash_method, contact.caps_hash)].features: 5067 send_file_menuitem.set_sensitive(True) 5055 5068 send_file_menuitem.connect('activate', 5056 5069 self.on_send_file_menuitem_activate, contact, account) 5057 else: # if we do not have resource we cannot send file5070 else: 5058 5071 send_file_menuitem.set_sensitive(False) 5059 5072 … … 5443 5456 5444 5457 def build_resources_submenu(self, contacts, account, action, room_jid=None, 5445 room_account=None ):5458 room_account=None, cap=None): 5446 5459 ''' Build a submenu with contact's resources. 5447 5460 room_jid and room_account are for action self.on_invite_to_room ''' … … 5467 5480 else: # start_chat, execute_command, send_file 5468 5481 item.connect('activate', action, c, account, c.resource) 5482 if cap and cap not in gajim.capscache[ 5483 (c.caps_hash_method, c.caps_hash)].features: 5484 item.set_sensitive(False) 5469 5485 return sub_menu 5470 5486 … … 5499 5515 if len(contact_list) > 1: # several resources 5500 5516 invite_to_new_room_menuitem.set_submenu(self.build_resources_submenu( 5501 contact_list, account, self.on_invite_to_new_room)) 5502 else: 5503 invite_to_new_room_menuitem.connect('activate', 5504 self.on_invite_to_new_room, list_) 5517 contact_list, account, self.on_invite_to_new_room, cap=NS_MUC)) 5518 else: 5519 if NS_MUC in gajim.capscache[(contact.caps_hash_method, 5520 contact.caps_hash)].features: 5521 invite_menuitem.set_sensitive(True) 5522 invite_to_new_room_menuitem.connect('activate', 5523 self.on_invite_to_new_room, list_) 5524 else: 5525 invite_menuitem.set_sensitive(False) 5505 5526 # transform None in 'jabber' 5506 5527 c_t = contacts_transport or 'jabber'
