summaryrefslogtreecommitdiff
path: root/Mailman/Commands/cmd_unsubscribe.py
diff options
context:
space:
mode:
authorBarry Warsaw2008-02-27 01:26:18 -0500
committerBarry Warsaw2008-02-27 01:26:18 -0500
commita1c73f6c305c7f74987d99855ba59d8fa823c253 (patch)
tree65696889450862357c9e05c8e9a589f1bdc074ac /Mailman/Commands/cmd_unsubscribe.py
parent3f31f8cce369529d177cfb5a7c66346ec1e12130 (diff)
downloadmailman-a1c73f6c305c7f74987d99855ba59d8fa823c253.tar.gz
mailman-a1c73f6c305c7f74987d99855ba59d8fa823c253.tar.zst
mailman-a1c73f6c305c7f74987d99855ba59d8fa823c253.zip
Diffstat (limited to 'Mailman/Commands/cmd_unsubscribe.py')
-rw-r--r--Mailman/Commands/cmd_unsubscribe.py87
1 files changed, 0 insertions, 87 deletions
diff --git a/Mailman/Commands/cmd_unsubscribe.py b/Mailman/Commands/cmd_unsubscribe.py
deleted file mode 100644
index 870bfb41f..000000000
--- a/Mailman/Commands/cmd_unsubscribe.py
+++ /dev/null
@@ -1,87 +0,0 @@
-# Copyright (C) 2002-2008 by the Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-"""
- unsubscribe [password] [address=<address>]
- Unsubscribe from the mailing list. If given, your password must match
- your current password. If omitted, a confirmation email will be sent
- to the unsubscribing address. If you wish to unsubscribe an address
- other than the address you sent this request from, you may specify
- `address=<address>' (no brackets around the email address, and no
- quotes!)
-"""
-
-from email.Utils import parseaddr
-
-from Mailman import Errors
-from Mailman.i18n import _
-
-STOP = 1
-
-
-
-def gethelp(mlist):
- return _(__doc__)
-
-
-
-def process(res, args):
- mlist = res.mlist
- password = None
- address = None
- argnum = 0
- for arg in args:
- if arg.startswith('address='):
- address = arg[8:]
- elif argnum == 0:
- password = arg
- else:
- res.results.append(_('Usage:'))
- res.results.append(gethelp(mlist))
- return STOP
- argnum += 1
- # Fill in empty defaults
- if address is None:
- realname, address = parseaddr(res.msg['from'])
- if not mlist.isMember(address):
- listname = mlist.real_name
- res.results.append(
- _('%(address)s is not a member of the %(listname)s mailing list'))
- return STOP
- # If we're doing admin-approved unsubs, don't worry about the password
- if mlist.unsubscribe_policy:
- try:
- mlist.DeleteMember(address, 'mailcmd')
- except Errors.MMNeedApproval:
- res.results.append(_("""\
-Your unsubscription request has been forwarded to the list administrator for
-approval."""))
- elif password is None:
- # No password was given, so we need to do a mailback confirmation
- # instead of unsubscribing them here.
- cpaddr = mlist.getMemberCPAddress(address)
- mlist.ConfirmUnsubscription(cpaddr)
- # We don't also need to send a confirmation to this command
- res.respond = 0
- else:
- # No admin approval is necessary, so we can just delete them if the
- # passwords match.
- oldpw = mlist.getMemberPassword(address)
- if oldpw <> password:
- res.results.append(_('You gave the wrong password'))
- return STOP
- mlist.ApprovedDeleteMember(address, 'mailcmd')
- res.results.append(_('Unsubscription request succeeded.'))