Changeset 9222
- Timestamp:
- 12/30/07 17:30:37 (11 months ago)
- Files:
-
- 1 modified
-
trunk/src/chat_control.py (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/chat_control.py
r9217 r9222 1054 1054 1055 1055 # Enable ecryption if needed 1056 e2e_is_active = hasattr(self, 'session') and self.session and self.session.enable_encryption 1057 self.gpg_is_active = False 1056 1058 gpg_pref = gajim.config.get_per('contacts', contact.jid, 1057 1059 'gpg_enabled') 1058 if gpg_pref and gajim.config.get_per('accounts', self.account, 'keyid') and\1060 if not e2e_is_active and gpg_pref and gajim.config.get_per('accounts', self.account, 'keyid') and\ 1059 1061 gajim.connections[self.account].USE_GPG: 1062 self.gpg_is_active = True 1060 1063 gajim.encrypted_chats[self.account].append(contact.jid) 1061 1064 msg = _('GPG encryption enabled') … … 1257 1260 def _toggle_gpg(self): 1258 1261 ec = gajim.encrypted_chats[self.account] 1259 if self. contact.jid in ec:1262 if self.gpg_is_active: 1260 1263 # Disable encryption 1261 1264 ec.remove(self.contact.jid) 1262 gpg_is_active = False1265 self.gpg_is_active = False 1263 1266 msg = _('GPG encryption disabled') 1264 1267 else: 1265 1268 # Enable encryption 1266 1269 ec.append(self.contact.jid) 1267 gpg_is_active = True1270 self.gpg_is_active = True 1268 1271 msg = _('GPG encryption enabled') 1269 1272 … … 1273 1276 gajim.config.add_per('contacts', self.contact.jid) 1274 1277 gajim.config.set_per('contacts', self.contact.jid, 'gpg_enabled', 1275 gpg_is_active)1278 self.gpg_is_active) 1276 1279 ChatControlBase.print_conversation_line(self, msg, 'status', '', None) 1277 1280 … … 1362 1365 1363 1366 keyID = '' 1364 gpg_pref = gajim.config.get_per('contacts', contact.jid, 1365 'gpg_enabled') 1366 if gpg_pref: 1367 if self.gpg_is_active: 1367 1368 keyID = contact.keyID 1368 1369 encrypted = True … … 1507 1508 else: 1508 1509 # GPG encryption 1509 ec = gajim.encrypted_chats[self.account] 1510 if encrypted and jid not in ec: 1510 if encrypted and not self.gpg_is_active: 1511 1511 msg = _('The following message was encrypted') 1512 1512 ChatControlBase.print_conversation_line(self, msg, 1513 1513 'status', '', tim) 1514 1514 self._toggle_gpg() 1515 elif not encrypted and jid in ec:1515 elif not encrypted and self.gpg_is_active: 1516 1516 msg = _('The following message was NOT encrypted') 1517 1517 ChatControlBase.print_conversation_line(self, msg, … … 1650 1650 toggle_gpg_menuitem.set_sensitive(False) 1651 1651 else: 1652 toggle_gpg_menuitem.set_sensitive(True) 1653 gpg_pref = gajim.config.get_per('contacts', jid, 1654 'gpg_enabled') 1655 toggle_gpg_menuitem.set_active(bool(gpg_pref)) 1652 e2e_is_active = int(self.session != None and self.session.enable_encryption) 1653 toggle_gpg_menuitem.set_sensitive(not e2e_is_active) 1654 toggle_gpg_menuitem.set_active(self.gpg_is_active) 1656 1655 1657 1656 # TODO: check that the remote client supports e2e … … 1661 1660 isactive = int(self.session != None and self.session.enable_encryption) 1662 1661 toggle_e2e_menuitem.set_active(isactive) 1662 toggle_e2e_menuitem.set_sensitive(not self.gpg_is_active) 1663 1663 1664 1664 # If we don't have resource, we can't do file transfer
