Mercurial > libervia-backend
comparison src/plugins/plugin_misc_account.py @ 934:34dd9287dfe5
plugin account: bug fix profile deletion from the database + unsubscribe the contacts
author | souliane <souliane@mailoo.org> |
---|---|
date | Mon, 24 Mar 2014 16:21:14 +0100 |
parents | 52ee240acc9c |
children | fc7e0828b18e |
comparison
equal
deleted
inserted
replaced
933:955e5c781a40 | 934:34dd9287dfe5 |
---|---|
103 @return a Deferred instance | 103 @return a Deferred instance |
104 """ | 104 """ |
105 d = defer.Deferred() | 105 d = defer.Deferred() |
106 prosody_reg = ProsodyRegisterProtocol(password, d) | 106 prosody_reg = ProsodyRegisterProtocol(password, d) |
107 prosody_exe = join(plugin._prosody_path, plugin.getConfig('prosodyctl')) | 107 prosody_exe = join(plugin._prosody_path, plugin.getConfig('prosodyctl')) |
108 # TODO delete account which are not on the same host | |
108 reactor.spawnProcess(prosody_reg, prosody_exe, [prosody_exe, command, "%s@%s" % (profile, plugin.getConfig('new_account_domain'))], path=plugin._prosody_path) | 109 reactor.spawnProcess(prosody_reg, prosody_exe, [prosody_exe, command, "%s@%s" % (profile, plugin.getConfig('new_account_domain'))], path=plugin._prosody_path) |
109 return d | 110 return d |
110 | 111 |
111 | 112 |
112 class MiscAccount(object): | 113 class MiscAccount(object): |
316 """Actually delete the XMPP account and SàT profile | 317 """Actually delete the XMPP account and SàT profile |
317 @param data | 318 @param data |
318 @param profile | 319 @param profile |
319 """ | 320 """ |
320 def userDeleted(result): | 321 def userDeleted(result): |
322 client = self.host.profiles[profile] | |
323 | |
324 for jid_ in client.roster._jids: # empty roster | |
325 client.presence.unsubscribe(jid_) | |
326 | |
327 for jid_ in self.host.memory.getWaitingSub(profile): # delete waiting subscriptions | |
328 self.host.memory.delWaitingSub(jid_) | |
329 | |
321 self.host.disconnect(profile) | 330 self.host.disconnect(profile) |
322 self.host.memory.asyncDeleteProfile(profile, force=True) | 331 self.host.memory.asyncDeleteProfile(profile, force=True) |
323 return defer.succeed({}) | 332 return defer.succeed({}) |
324 | 333 |
325 def errback(failure): | 334 def errback(failure): |