]> jfr.im git - irc/quakenet/newserv.git/commitdiff
CHANSERV: better batcher error handling for expired accounts/accounts with no email.
authorChris Porter <redacted>
Sun, 12 Oct 2014 12:20:31 +0000 (13:20 +0100)
committerChris Porter <redacted>
Sun, 12 Oct 2014 12:20:31 +0000 (13:20 +0100)
--HG--
branch : chanserv-live

chanserv/batcher/batcher

index 9606a4bf2a6124ba2af87746fe78c5a996696f0c..04d2eb2b65339a7f204dab621b9394ce0f4f059c 100755 (executable)
@@ -40,7 +40,11 @@ def email(userid, emailtype, prevemail):
   cur.execute("SELECT users.*, code FROM chanserv.users LEFT JOIN chanserv.languages ON language = languageid WHERE id = %d" % userid)
 
   unifieddict = {}
-  for key, value in cur.fetchone().items():
+  one = cur.fetchone()
+  if one is None:
+    return
+
+  for key, value in one.items():
     unifieddict["user.%s" % key] = value
 
   for key, value in CONFIG["templateoptions"].items():
@@ -58,7 +62,10 @@ def email(userid, emailtype, prevemail):
   if not mailto:
     mailto = "user.email"
 
-  print "%s -> %s" % (`subject`, `unifieddict[mailto]`)
+  if not unifieddict[mailto]:
+    return
+
+  print "%s -> %s (%d)" % (`subject`, `unifieddict[mailto]`, userid)
   inject(unifieddict[mailto], subject, template)
 
 def main():