Don't save empty NickServ passwords
This commit is contained in:
parent
db9caf210e
commit
f63d224c66
1 changed files with 8 additions and 0 deletions
|
@ -450,12 +450,16 @@ class userProfile(object):
|
||||||
return self.autoidentify
|
return self.autoidentify
|
||||||
def setAutoIdentify(self, b):
|
def setAutoIdentify(self, b):
|
||||||
self.autoidentify = b
|
self.autoidentify = b
|
||||||
|
if self.chat.handle not in self.passwd:
|
||||||
|
self.passwd[self.chat.handle] = {}
|
||||||
self.passwd[self.chat.handle]["auto"] = b
|
self.passwd[self.chat.handle]["auto"] = b
|
||||||
self.saveNickServPass()
|
self.saveNickServPass()
|
||||||
def getNickServPass(self):
|
def getNickServPass(self):
|
||||||
return self.nickservpass
|
return self.nickservpass
|
||||||
def setNickServPass(self, pw):
|
def setNickServPass(self, pw):
|
||||||
self.nickservpass = pw
|
self.nickservpass = pw
|
||||||
|
if self.chat.handle not in self.passwd:
|
||||||
|
self.passwd[self.chat.handle] = {}
|
||||||
self.passwd[self.chat.handle]["pw"] = pw
|
self.passwd[self.chat.handle]["pw"] = pw
|
||||||
self.saveNickServPass()
|
self.saveNickServPass()
|
||||||
def save(self):
|
def save(self):
|
||||||
|
@ -471,6 +475,10 @@ class userProfile(object):
|
||||||
fp.write(jsonoutput)
|
fp.write(jsonoutput)
|
||||||
fp.close()
|
fp.close()
|
||||||
def saveNickServPass(self):
|
def saveNickServPass(self):
|
||||||
|
# remove profiles with no passwords
|
||||||
|
for h,t in self.passwd.items():
|
||||||
|
if "auto" not in t or "pw" not in t or t["pw"] == "":
|
||||||
|
del self.passwd[h]
|
||||||
try:
|
try:
|
||||||
jsonoutput = json.dumps(self.passwd, indent=4)
|
jsonoutput = json.dumps(self.passwd, indent=4)
|
||||||
except ValueError, e:
|
except ValueError, e:
|
||||||
|
|
Loading…
Reference in a new issue