summaryrefslogtreecommitdiffstats
path: root/module/plugins/AccountManager.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2012-01-08 14:44:59 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2012-01-08 14:44:59 +0100
commitbac28b7740aae772636d8b90e291d9c17dfd59a7 (patch)
tree08b6bd4f00cf27819f06d24f363d633b852f50a3 /module/plugins/AccountManager.py
parentsome cleanups (diff)
downloadpyload-bac28b7740aae772636d8b90e291d9c17dfd59a7.tar.xz
new MultiHoster hook
Diffstat (limited to 'module/plugins/AccountManager.py')
-rw-r--r--module/plugins/AccountManager.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/module/plugins/AccountManager.py b/module/plugins/AccountManager.py
index 00dd2ccc6..c610d10e0 100644
--- a/module/plugins/AccountManager.py
+++ b/module/plugins/AccountManager.py
@@ -48,6 +48,12 @@ class AccountManager:
return
+ def iterAccounts(self):
+ """ yields login, account for all accounts"""
+ for name, data in self.accounts.iteritems():
+ for login, account in data.iteritems():
+ yield login, account
+
def saveAccounts(self):
"""save all account information"""
@@ -71,6 +77,9 @@ class AccountManager:
self.accounts[plugin][loginname] = klass(self, loginname, password, options)
+ def getAccount(self, plugin, user):
+ return self.accounts[plugin].get(user, None)
+
@lock
def updateAccount(self, plugin, user, password=None, options={}):
"""add or update account"""
@@ -84,7 +93,7 @@ class AccountManager:
self.createAccount(plugin, user, password, options)
self.saveAccounts()
- self.sendChange()
+ self.sendChange(plugin, user)
@lock
def removeAccount(self, plugin, user):
@@ -92,7 +101,7 @@ class AccountManager:
if plugin in self.accounts and user in self.accounts[plugin]:
del self.accounts[plugin][user]
self.core.db.removeAccount(plugin, user)
- self.sendChange()
+ self.core.eventManager.dispatchEvent("accountDeleted", plugin, user)
else:
self.core.log.debug("Remove non existing account %s %s" % (plugin, user))
@@ -128,6 +137,5 @@ class AccountManager:
for acc in p.itervalues():
acc.getAccountInfo(True)
-
- def sendChange(self):
- self.core.eventManager.dispatchEvent("accountsUpdated") \ No newline at end of file
+ def sendChange(self, plugin, name):
+ self.core.eventManager.dispatchEvent("accountUpdated", plugin, name) \ No newline at end of file