summaryrefslogtreecommitdiffstats
path: root/module/plugins/AccountManager.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-10-22 19:44:59 +0200
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-10-22 19:47:17 +0200
commit0eb6e7ec4a1144dcca824d8add049787d3da1762 (patch)
treed653f5fe28bb247a3c4fadeca9bf6278d744f929 /module/plugins/AccountManager.py
parentSpare code cosmetics (diff)
downloadpyload-0eb6e7ec4a1144dcca824d8add049787d3da1762.tar.xz
Two space before function declaration
Diffstat (limited to 'module/plugins/AccountManager.py')
-rw-r--r--module/plugins/AccountManager.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/module/plugins/AccountManager.py b/module/plugins/AccountManager.py
index 4b8063002..b039b5827 100644
--- a/module/plugins/AccountManager.py
+++ b/module/plugins/AccountManager.py
@@ -14,6 +14,7 @@ ACC_VERSION = 1
class AccountManager():
"""manages all accounts"""
+
#----------------------------------------------------------------------
def __init__(self, core):
"""Constructor"""
@@ -24,6 +25,7 @@ class AccountManager():
self.initPlugins()
self.saveAccounts() # save to add categories to conf
+
def initPlugins(self):
self.accounts = {} # key = ( plugin )
self.plugins = {}
@@ -31,6 +33,7 @@ class AccountManager():
self.initAccountPlugins()
self.loadAccounts()
+
def getAccountPlugin(self, plugin):
"""get account instance for plugin or None if anonymous"""
if plugin in self.accounts:
@@ -41,6 +44,7 @@ class AccountManager():
else:
return None
+
def getAccountPlugins(self):
""" get all account instances"""
@@ -50,6 +54,7 @@ class AccountManager():
return plugins
+
#----------------------------------------------------------------------
def loadAccounts(self):
"""loads all accounts available"""
@@ -97,6 +102,7 @@ class AccountManager():
name, sep, pw = line.partition(":")
self.accounts[plugin][name] = {"password": pw, "options": {}, "valid": True}
+
#----------------------------------------------------------------------
def saveAccounts(self):
"""save all account information"""
@@ -117,12 +123,14 @@ class AccountManager():
f.close()
chmod(f.name, 0600)
+
#----------------------------------------------------------------------
def initAccountPlugins(self):
"""init names"""
for name in self.core.pluginManager.getAccountPlugins():
self.accounts[name] = {}
+
@lock
def updateAccount(self, plugin , user, password=None, options={}):
"""add or update account"""
@@ -134,6 +142,7 @@ class AccountManager():
self.saveAccounts()
if updated: p.scheduleRefresh(user, force=False)
+
@lock
def removeAccount(self, plugin, user):
"""remove account"""
@@ -144,6 +153,7 @@ class AccountManager():
self.saveAccounts()
+
@lock
def getAccountInfos(self, force=True, refresh=False):
data = {}
@@ -162,6 +172,7 @@ class AccountManager():
self.core.pullManager.addEvent(e)
return data
+
def sendChange(self):
e = AccountUpdateEvent()
self.core.pullManager.addEvent(e)