Skip to content
Snippets Groups Projects
Commit b6058387 authored by Kjell Braden's avatar Kjell Braden
Browse files

make gotr plugin less verbose, fix key regeneration

parent 6cfe3ef8
No related branches found
No related tags found
No related merge requests found
...@@ -145,13 +145,23 @@ class GajimOtrAccount(potr.context.Account): ...@@ -145,13 +145,23 @@ class GajimOtrAccount(potr.context.Account):
super(GajimOtrAccount, self).__init__(name, PROTOCOL, MMS) super(GajimOtrAccount, self).__init__(name, PROTOCOL, MMS)
self.keyFilePath = os.path.join(gajim.gajimpaths.data_root, accountname) self.keyFilePath = os.path.join(gajim.gajimpaths.data_root, accountname)
def dropPrivkey(self):
try:
os.remove(self.keyFilePath + '.key2')
except IOError, e:
if e.errno != 2:
log.exception('IOError occurred when removing key file for %s',
self.name)
self.privkey = None
def loadPrivkey(self): def loadPrivkey(self):
try: try:
with open(self.keyFilePath + '.key2', 'r') as keyFile: with open(self.keyFilePath + '.key2', 'r') as keyFile:
return pickle.load(keyFile) return pickle.load(keyFile)
except IOError, e: except IOError, e:
log.exception('IOError occurred when loading key file for %s', if e.errno != 2:
self.name) log.exception('IOError occurred when loading key file for %s',
self.name)
return None return None
def savePrivkey(self): def savePrivkey(self):
...@@ -176,8 +186,9 @@ class GajimOtrAccount(potr.context.Account): ...@@ -176,8 +186,9 @@ class GajimOtrAccount(potr.context.Account):
self.getContext(ctx, newCtxCb).setTrust(fpr, trust) self.getContext(ctx, newCtxCb).setTrust(fpr, trust)
except IOError, e: except IOError, e:
log.exception('IOError occurred when loading fpr file for %s', if e.errno != 2:
self.name) log.exception('IOError occurred when loading fpr file for %s',
self.name)
def saveTrusts(self): def saveTrusts(self):
try: try:
......
...@@ -179,7 +179,7 @@ class OtrPluginConfigDialog(GajimPluginConfigDialog): ...@@ -179,7 +179,7 @@ class OtrPluginConfigDialog(GajimPluginConfigDialog):
if active > -1: if active > -1:
account = self.otr_account_store[active][0] account = self.otr_account_store[active][0]
button.set_sensitive(False) button.set_sensitive(False)
self.plugin.us[account].privkey = None self.plugin.us[account].dropPrivkey()
self.account_combobox_changed_cb(box, *args) self.account_combobox_changed_cb(box, *args)
button.set_sensitive(True) button.set_sensitive(True)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment