summaryrefslogtreecommitdiff
path: root/aurweb/scripts/notify.py
diff options
context:
space:
mode:
Diffstat (limited to 'aurweb/scripts/notify.py')
-rwxr-xr-xaurweb/scripts/notify.py40
1 files changed, 21 insertions, 19 deletions
diff --git a/aurweb/scripts/notify.py b/aurweb/scripts/notify.py
index ddd6e49..e9458b4 100755
--- a/aurweb/scripts/notify.py
+++ b/aurweb/scripts/notify.py
@@ -10,11 +10,13 @@ import aurweb.db
aur_location = aurweb.config.get('options', 'aur_location')
aur_request_ml = aurweb.config.get('options', 'aur_request_ml')
+aur_shortname = aurweb.config.get('options', 'aur_shortname');
+aur_longname = aurweb.config.get('options', 'aur_longname');
sendmail = aurweb.config.get('notifications', 'sendmail')
sender = aurweb.config.get('notifications', 'sender')
reply_to = aurweb.config.get('notifications', 'reply-to')
-
+domain = aurweb.config.get('notifications', 'domain');
def headers_cc(cclist):
return {'Cc': str.join(', ', cclist)}
@@ -174,7 +176,7 @@ def send_resetkey(conn, uid):
'WHERE ID = ?', [uid])
username, to, resetkey = cur.fetchone()
- subject = 'AUR Password Reset'
+ subject = '%s Password Reset' % (aur_shortname)
body = 'A password reset request was submitted for the account %s ' \
'associated with your email address. If you wish to reset your ' \
'password follow the link [1] below, otherwise ignore this ' \
@@ -189,11 +191,11 @@ def welcome(conn, uid):
'WHERE ID = ?', [uid])
username, to, resetkey = cur.fetchone()
- subject = 'Welcome to the Arch User Repository'
- body = 'Welcome to the Arch User Repository! In order to set an initial ' \
+ subject = 'Welcome to the %s' % (aur_longname)
+ body = 'Welcome to the %s! In order to set an initial ' \
'password for your new account, please click the link [1] below. ' \
'If the link does not work, try copying and pasting it into your ' \
- 'browser.'
+ 'browser.' % (aur_longname)
refs = '[1] ' + aur_location + '/passreset/?resetkey=' + resetkey
send_notification([to], subject, body, refs)
@@ -208,7 +210,7 @@ def comment(conn, uid, pkgbase_id, comment_id):
user_uri = aur_location + '/account/' + user + '/'
pkgbase_uri = aur_location + '/pkgbase/' + pkgbase + '/'
- subject = 'AUR Comment for %s' % (pkgbase)
+ subject = '%s Comment for %s' % (aur_shortname, pkgbase)
body = '%s [1] added the following comment to %s [2]:' % (user, pkgbase)
body += '\n\n' + text + '\n\n'
body += 'If you no longer wish to receive notifications about this ' \
@@ -216,7 +218,7 @@ def comment(conn, uid, pkgbase_id, comment_id):
('Disable notifications')
refs = '[1] ' + user_uri + '\n'
refs += '[2] ' + pkgbase_uri
- thread_id = '<pkg-notifications-' + pkgbase + '@aur.archlinux.org>'
+ thread_id = '<pkg-notifications-' + pkgbase + '@' + domain + '>'
headers = headers_reply(thread_id)
send_notification(to, subject, body, refs, headers)
@@ -230,7 +232,7 @@ def update(conn, uid, pkgbase_id):
user_uri = aur_location + '/account/' + user + '/'
pkgbase_uri = aur_location + '/pkgbase/' + pkgbase + '/'
- subject = 'AUR Package Update: %s' % (pkgbase)
+ subject = '%s Package Update: %s' % (aur_shortname, pkgbase)
body = '%s [1] pushed a new commit to %s [2].' % (user, pkgbase)
body += '\n\n'
body += 'If you no longer wish to receive notifications about this ' \
@@ -238,7 +240,7 @@ def update(conn, uid, pkgbase_id):
('Disable notifications')
refs = '[1] ' + user_uri + '\n'
refs += '[2] ' + pkgbase_uri
- thread_id = '<pkg-notifications-' + pkgbase + '@aur.archlinux.org>'
+ thread_id = '<pkg-notifications-' + pkgbase + '@' + domain + '>'
headers = headers_reply(thread_id)
send_notification(to, subject, body, refs, headers)
@@ -253,7 +255,7 @@ def flag(conn, uid, pkgbase_id):
user_uri = aur_location + '/account/' + user + '/'
pkgbase_uri = aur_location + '/pkgbase/' + pkgbase + '/'
- subject = 'AUR Out-of-date Notification for %s' % (pkgbase)
+ subject = '%s Out-of-date Notification for %s' % (aur_shortname, pkgbase)
body = 'Your package %s [1] has been flagged out-of-date by %s [2]:' % \
(pkgbase, user)
body += '\n\n' + text
@@ -271,7 +273,7 @@ def adopt(conn, pkgbase_id, uid):
user_uri = aur_location + '/account/' + user + '/'
pkgbase_uri = aur_location + '/pkgbase/' + pkgbase + '/'
- subject = 'AUR Ownership Notification for %s' % (pkgbase)
+ subject = '%s Ownership Notification for %s' % (aur_shortname, pkgbase)
body = 'The package %s [1] was adopted by %s [2].' % (pkgbase, user)
refs = '[1] ' + pkgbase_uri + '\n'
refs += '[2] ' + user_uri
@@ -287,7 +289,7 @@ def disown(conn, pkgbase_id, uid):
user_uri = aur_location + '/account/' + user + '/'
pkgbase_uri = aur_location + '/pkgbase/' + pkgbase + '/'
- subject = 'AUR Ownership Notification for %s' % (pkgbase)
+ subject = '%s Ownership Notification for %s' % (aur_shortname, pkgbase)
body = 'The package %s [1] was disowned by %s [2].' % (pkgbase, user)
refs = '[1] ' + pkgbase_uri + '\n'
refs += '[2] ' + user_uri
@@ -301,7 +303,7 @@ def comaintainer_add(conn, pkgbase_id, uid):
pkgbase_uri = aur_location + '/pkgbase/' + pkgbase + '/'
- subject = 'AUR Co-Maintainer Notification for %s' % (pkgbase)
+ subject = '%s Co-Maintainer Notification for %s' % (aur_shortname, pkgbase)
body = 'You were added to the co-maintainer list of %s [1].' % (pkgbase)
refs = '[1] ' + pkgbase_uri + '\n'
@@ -314,7 +316,7 @@ def comaintainer_remove(conn, pkgbase_id, uid):
pkgbase_uri = aur_location + '/pkgbase/' + pkgbase + '/'
- subject = 'AUR Co-Maintainer Notification for %s' % (pkgbase)
+ subject = '%s Co-Maintainer Notification for %s' % (aur_shortname, pkgbase)
body = ('You were removed from the co-maintainer list of %s [1].' %
(pkgbase))
refs = '[1] ' + pkgbase_uri + '\n'
@@ -332,7 +334,7 @@ def delete(conn, uid, old_pkgbase_id, new_pkgbase_id=None):
user_uri = aur_location + '/account/' + user + '/'
pkgbase_uri = aur_location + '/pkgbase/' + old_pkgbase + '/'
- subject = 'AUR Package deleted: %s' % (old_pkgbase)
+ subject = '%s Package deleted: %s' % (aur_shortname, old_pkgbase)
if new_pkgbase_id:
new_pkgbase_uri = aur_location + '/pkgbase/' + new_pkgbase + '/'
body = '%s [1] merged %s [2] into %s [3].\n\n' \
@@ -378,7 +380,7 @@ def request_open(conn, uid, reqid, reqtype, pkgbase_id, merge_into=None):
body += '\n\n' + text
refs = '[1] ' + user_uri + '\n'
refs += '[2] ' + pkgbase_uri + '\n'
- thread_id = '<pkg-request-' + reqid + '@aur.archlinux.org>'
+ thread_id = '<pkg-request-' + reqid + '@' + domain + '>'
# Use a deterministic Message-ID for the first email referencing a request.
headers = headers_msgid(thread_id)
headers.update(headers_cc(cc))
@@ -398,14 +400,14 @@ def request_close(conn, uid, reqid, reason):
body = 'Request #%d has been %s by %s [1]' % (int(reqid), reason, user)
refs = '[1] ' + user_uri
else:
- body = 'Request #%d has been %s automatically by the Arch User ' \
- 'Repository package request system' % (int(reqid), reason)
+ body = 'Request #%d has been %s automatically by the %s ' \
+ 'package request system' % (int(reqid), reason, aur_longname)
refs = None
if text.strip() == '':
body += '.'
else:
body += ':\n\n' + text
- thread_id = '<pkg-request-' + reqid + '@aur.archlinux.org>'
+ thread_id = '<pkg-request-' + reqid + '@' + domain + '>'
headers = headers_reply(thread_id)
headers.update(headers_cc(cc))