changeset 1727:68e498b3367e

reverted revision 2ebe66a96d05
author souliane <souliane@mailoo.org>
date Tue, 08 Dec 2015 16:55:54 +0100
parents 2ebe66a96d05
children 0eaa1a409dfb
files src/plugins/plugin_misc_account.py
diffstat 1 files changed, 2 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/plugin_misc_account.py	Mon Dec 07 20:35:21 2015 +0100
+++ b/src/plugins/plugin_misc_account.py	Tue Dec 08 16:55:54 2015 +0100
@@ -27,7 +27,6 @@
 from sat.core.constants import Const as C
 
 from twisted.internet import reactor, defer, protocol
-from twisted.words.protocols.jabber import jid
 from twisted.python.procutils import which
 from twisted.python.failure import Failure
 from twisted.mail.smtp import sendmail
@@ -62,8 +61,7 @@
                 "new_account_domain": "example.net",
                 "prosody_path": None, # prosody path (where prosodyctl will be executed from), or None to automaticaly find it
                 "prosodyctl": "prosodyctl",
-                "reserved_list": ['libervia'], # profiles which can't be used
-                "auto_add_contacts": ['salut-a-toi@libervia.org'],
+                "reserved_list": ['libervia'] # profiles which can't be used
                }
 
 
@@ -170,9 +168,7 @@
         return ''.join([random.choice(charset) for i in range(15)])
 
     def _registerAccount(self, email, password, profile):
-        d = self.registerAccount(email, password, None, profile)
-        d.addCallback(lambda dummy: self.autoAddContacts(password, profile))
-        return d
+        return self.registerAccount(email, password, None, profile)
 
     def registerAccount(self, email, password, jid_s, profile):
         """Register a new profile and its associated XMPP account.
@@ -231,29 +227,6 @@
         d.addErrback(removeProfile)
         return d
 
-    def autoAddContacts(self, password, profile):
-        """Auto-add some roster contacts after the profile creation.
-        
-        @param password (unicode): XMPP account password
-        """
-        contacts = self.getConfig('auto_add_contacts')
-        if not contacts:
-            return
-
-        def addContact(was_connected, contacts):
-            for contact in contacts:
-                d = self.host.addContact(contact, profile)
-            if not was_connected:
-                d.addCallback(lambda dummy: self.host.disconnect(profile))
-
-        try:
-            contacts_jid = [jid.JID(contact) for contact in contacts]
-        except (RuntimeError, jid.InvalidFormat, AttributeError):
-            log.error("Invalid JIDs list: %s" % ", ".join(contacts))
-        else:
-            d = self.host.asyncConnect(profile, password, max_retries=0)
-            d.addCallback(addContact, contacts_jid)
-
     def sendEmails(self, email, jid_s, password, profile):
         # time to send the email
 
@@ -575,6 +548,5 @@
             self.host.memory.asyncDeleteProfile(jid_s)
             raise failure
 
-        d.addCallback(self.autoAddContacts(password, jid_s))
         d.addErrback(removeProfile)
         return d