--- mailman-2.0.99b2.orig/Mailman/Gui/General.py +++ mailman-2.0.99b2/Mailman/Gui/General.py @@ -252,12 +252,13 @@ _('Notifications'), - ('send_reminders', mm_cfg.Radio, (_('No'), _('Yes')), 0, - _('''Send monthly password reminders?'''), + ('send_reminders', mm_cfg.Radio, + (_('No'), _('Monthly'), _('Quarterly'), _('Yearly')), 0, + _('''Send monthly password reminders, and how often?'''), - _('''Turn this on if you want password reminders to be sent once - per month to your members. Note that members may disable their - own individual password reminders.''')), + _('''Turn this on if you want password reminders to be sent to + your members monthly, quaterly or yearly. Note that members may + disable their own individual password reminders.''')), ('welcome_msg', mm_cfg.Text, (4, WIDTH), 0, _('''List-specific text prepended to new-subscriber welcome --- mailman-2.0.99b2.orig/Mailman/Defaults.py.in +++ mailman-2.0.99b2/Mailman/Defaults.py.in @@ -786,6 +786,10 @@ DEFAULT_UMBRELLA_MEMBER_ADMIN_SUFFIX = "-owner" # This variable controls whether monthly password reminders are sent. +# 0 - no reminders +# 1 - monthly +# 2 - quarterly +# 3 - yearly DEFAULT_SEND_REMINDERS = 1 # Send welcome messages to new users? Probably should keep this set to 1. --- mailman-2.0.99b2.orig/Mailman/HTMLFormatter.py +++ mailman-2.0.99b2/Mailman/HTMLFormatter.py @@ -334,9 +334,12 @@ return '' % (name, text) def FormatReminder(self, lang): - if self.send_reminders: - return _('Once a month, your password will be emailed to you as' - ' a reminder.') + if self.send_reminders in (1, 2, 3): + frequencies = [_('Once a month'), + _('Once in a quarter'), + _('Once in a year')] + return frequencies[self.send_reminders - 1] + \ + _(', your password will be emailed to you as a reminder.') return '' def ParseTags(self, template, replacements, lang=None): --- mailman-2.0.99b2.orig/cron/crontab.in.in +++ mailman-2.0.99b2/cron/crontab.in.in @@ -11,7 +11,7 @@ 0 12 * * * @PYTHON@ -S @prefix@/cron/senddigests # # 5 AM on the first of each month, mail out password reminders. -0 5 1 * * @PYTHON@ -S @prefix@/cron/mailpasswds +0 5 1 * * @PYTHON@ -S @prefix@/cron/mailpasswds --cron # # Every 5 mins, try to gate news to mail. You can comment this one out # if you don't want to allow gating, or don't have any going on right now, --- mailman-2.0.99b2.orig/cron/mailpasswds +++ mailman-2.0.99b2/cron/mailpasswds @@ -29,6 +29,9 @@ Options: -h/--help Print this message and exit. + + -c/--cron + Called from cron and check for send_reminder_frequency. """ # This puppy should probably do lots of logging. @@ -36,6 +39,7 @@ import os import errno import getopt +import time import paths # mm_cfg must be imported before the other modules, due to the side-effect of @@ -68,17 +72,32 @@ +def time_to_send_reminders(mlist): + freqency = mlist.send_reminders + month = time.localtime()[1] + if frequency == 1: # monthly + return 1 + elif frequency == 2 and month % 3 == 1: # quarterly + return 1 + elif frequency == 3 and month == 1: # yearly + return 1 + return 0 + + def main(): try: - opts, args = getopt.getopt(sys.argv[1:], 'h', ['help']) + opts, args = getopt.getopt(sys.argv[1:], 'ch', ['cron', 'help']) except getopt.error, msg: usage(1, msg) if args: usage(1) + called_from_cron = 0 for opt, arg in opts: - if opt in ('-h', '--help'): + if opt in ('-c', '--cron'): + called_from_cron = 1 + elif opt in ('-h', '--help'): usage(0) # This is the list that all the reminders will look like they come from, @@ -98,7 +117,9 @@ byhost = {} for listname in Utils.list_names(): mlist = MailList.MailList(listname, lock=0) - if not mlist.send_reminders: + if mlist.send_reminders == 0: + continue + if called_from_cron and not time_to_send_reminders(mlist): continue if mm_cfg.VIRTUAL_HOST_OVERVIEW: host = mlist.host_name