summaryrefslogtreecommitdiff
path: root/src/mailman/commands/cmd_unsubscribe.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman/commands/cmd_unsubscribe.py')
-rw-r--r--src/mailman/commands/cmd_unsubscribe.py88
1 files changed, 0 insertions, 88 deletions
diff --git a/src/mailman/commands/cmd_unsubscribe.py b/src/mailman/commands/cmd_unsubscribe.py
deleted file mode 100644
index 456b8089d..000000000
--- a/src/mailman/commands/cmd_unsubscribe.py
+++ /dev/null
@@ -1,88 +0,0 @@
-# Copyright (C) 2002-2009 by the Free Software Foundation, Inc.
-#
-# This file is part of GNU Mailman.
-#
-# GNU Mailman 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 3 of the License, or (at your option)
-# any later version.
-#
-# GNU Mailman 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
-# GNU Mailman. If not, see <http://www.gnu.org/licenses/>.
-
-"""
- 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.'))