]> jfr.im git - irc/quakenet/newserv.git/commitdiff
Add some better emails.
authorChris Porter <redacted>
Sun, 9 Mar 2008 18:39:30 +0000 (18:39 +0000)
committerChris Porter <redacted>
Sun, 9 Mar 2008 18:39:30 +0000 (18:39 +0000)
Add more string replacement and the option for templates to redirect to different email addresses.

chanserv/batcher/batcher
chanserv/batcher/config.py.example
chanserv/batcher/templates.py

index 11106589e4d635cfe1895d78bef4c5d8aba13c4c..925dcd4ac5d99e4e0713b08ac8c7b9307abf755d 100755 (executable)
@@ -32,7 +32,7 @@ def processtemplate(emailtype, lang, obj):
   else:
     k = template, subject = MAILTEMPLATES["languages"][""][emailtype]
 
-  return k["body"] % obj, k["subject"] % obj
+  return k["body"] % obj, k["subject"] % obj, MAILTEMPLATES["sendto"].setdefault(emailtype)
 
 def email(userid, emailtype, prevemail):
   cur = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
@@ -53,9 +53,12 @@ def email(userid, emailtype, prevemail):
   else:
     language = ""
 
-  template, subject = processtemplate(emailtype, language, unifieddict)
+  template, subject, mailto = processtemplate(emailtype, language, unifieddict)
+  if not mailto:
+    mailto = "user.email"
+
   print "%s -> %s" % (`subject`, `unifieddict["user.email"]`)
-  inject(unifieddict["user.email"], subject, template)
+  inject(unifieddict[mailto], subject, template)
 
 def main():
   ignoring = {}
index 802d314074aeddfc9bb3036d9e0191258a69e50b..be0117a69c807ace651acc753cfcb3f1faf1dd89 100644 (file)
@@ -2,6 +2,13 @@ CONFIG = {
   "conn": "dbname='q9' user='' password=''",
   "smtphost": "localhost",
   "smtpauth": None,
+  "templateoptions": {
+    "bot": "Q9",
+    "cleanup": 80,
+    "securityurl": "http://www.quakenet.org/faq/faq.php?c=160",
+    "siteurl": "http://www.quakenet.org/",
+    "server": "CServe.test.quakenet.org",
+  },
   "from": "q9@quakenet.org",
   "defaultlang": "en",
   "url": "http://webdev.quakenet.org/~slug/q9dev/",
index ba0dc2af7fe5126239bac585091a6051dc0aa3f7..84ff5086185c7670d6a9042fc1b6f083c31a2fd7 100644 (file)
@@ -12,23 +12,25 @@ MAILTEMPLATES = {
   "mutators": {
     1: generate_url,
   },
-
+  "sendto": {
+    5: "prevemail",
+  },
   "languages": {
     "en": {
       1: {
-        "subject": "New account registration",
+        "subject": "%(config.bot)s account registration",
         "body": """
 Thank you for registering.
 To get your password please visit:
 %(url)s
 
 In case you forget your login/password use:
-/msg %(config.bot)s REQUESTPASSWORD %(user)s %(user.email)s
+/msg %(config.bot)s REQUESTPASSWORD %(user.username)s %(user.email)s
 
-Make sure you've read the %(config.bot)s FAQ FAQ at http://www.quakenet.org for a complete
+Make sure you've read the %(config.bot)s FAQ at %(config.siteurl)s for a complete
 reference on Q's commands and usage.
 
- ** PLEASE READ http://www.quakenet.org/faq/faq.php?c=160 --
+ ** PLEASE READ %(config.securityurl)s --
     it contains important information about keeping your account secure.
     Note that QuakeNet Operators will not intervene if you fail to read
     the above URL and your account is compromised as a result.
@@ -39,9 +41,24 @@ AFTER %(config.cleanup)d DAYS, AND ALL CHANLEVS ARE LOST!
 NB: Save this email for future reference.
 """,
       },
-      2: { "subject": "Password request", "body": "Your password: %(user.password)s", },
-      3: { "subject": "New password", "body": "Your new password: %(user.password)s", },
-      5: { "subject": "Email change", "body": "Your old email address: %(prevemail)s", },
+      2: { "subject": "%(config.bot)s password request", "body": """
+Your username/password is:
+
+Username: %(user.username)s
+Password: %(user.password)s
+
+To auth yourself to %(config.bot)s, type the following command
+
+   /MSG %(config.bot)s@%(config.server)s AUTH %(user.username)s %(user.password)s
+""", },
+      3: { "subject": "%(config.bot)s password change", "body": "Your new password: %(user.password)s", },
+      5: { "subject": "%(config.bot)s email change", "body": """
+Your email address has been changed on %(config.bot)s.
+
+ADD RESET STUFF,
+
+blah %(user.email)s
+""", },
     },
   },
 }