diff options
| author | bwarsaw | 1999-01-13 23:54:46 +0000 |
|---|---|---|
| committer | bwarsaw | 1999-01-13 23:54:46 +0000 |
| commit | af8accd7a6542788787be75833cf2700d9138255 (patch) | |
| tree | 5df82dd2f97b29540f1d5b18c4b162b542fddd6e /Mailman/pythonlib | |
| parent | 957f44a429df2aa42c0105925776e9b364d1f23a (diff) | |
| download | mailman-af8accd7a6542788787be75833cf2700d9138255.tar.gz mailman-af8accd7a6542788787be75833cf2700d9138255.tar.zst mailman-af8accd7a6542788787be75833cf2700d9138255.zip | |
Diffstat (limited to 'Mailman/pythonlib')
| -rw-r--r-- | Mailman/pythonlib/rfc822.py | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/Mailman/pythonlib/rfc822.py b/Mailman/pythonlib/rfc822.py index 7ce3ff254..e7e4c75ac 100644 --- a/Mailman/pythonlib/rfc822.py +++ b/Mailman/pythonlib/rfc822.py @@ -298,34 +298,21 @@ class Message: def getaddrlist(self, name): """Get a list of addresses from a header. - - Retrieves a list of addresses from a header, where each - address is a tuple as returned by getaddr(). - """ - # New, by Ben Escoto - try: - data = self[name] - except KeyError: - return [] - a = AddrlistClass(data) - return a.getaddrlist() - - def getallrecipients(self): - """Returns a list of the all the recipient addresses. - This list is of 2-tuple elements as returned by getaddr(), but is a - collation of all the To: and Cc: headers found in the message. + Retrieves a list of addresses from a header, where each address is a + tuple as returned by getaddr(). Scans all named headers, so it works + properly with multiple To: or Cc: headers for example. + """ - rawrecips = [] - for h in (self.getallmatchingheaders('to') + - self.getallmatchingheaders('cc')): + raw = [] + for h in self.getallmatchingheaders(name): i = string.find(h, ':') if i > 0: - rawrecips.append(string.strip(h[i+1:])) - alladdrs = string.join(rawrecips, ', ') - a = AddressList(alladdrs) - return a.addresslist - + raw.append(string.strip(h[i+1:])) + alladdrs = string.join(raw, ', ') + a = AddrlistClass(alladdrs) + return a.getaddrlist() + def getdate(self, name): """Retrieve a date field from a header. |
