Mercurial > p > roundup > code
comparison roundup/scripts/roundup_mailgw.py @ 3779:ee73abcc95d2
Sorry, another mega-patch:
- clarified windows service documentation (patch [SF#1597713])
- HTMLClass fixed to work with new item permissions check [SF#1602983]
- support POP over SSL (patch [SF#1597703])
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 13 Dec 2006 23:32:39 +0000 |
| parents | 22ec8e91da2b |
| children | 39af38d6f77d |
comparison
equal
deleted
inserted
replaced
| 3778:d9e35b7be5bb | 3779:ee73abcc95d2 |
|---|---|
| 12 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 12 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 13 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" | 13 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
| 14 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, | 14 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
| 15 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 15 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 16 # | 16 # |
| 17 # $Id: roundup_mailgw.py,v 1.22 2006-07-15 10:08:01 schlatterbeck Exp $ | 17 # $Id: roundup_mailgw.py,v 1.23 2006-12-13 23:32:39 richard Exp $ |
| 18 | 18 |
| 19 """Command-line script stub that calls the roundup.mailgw. | 19 """Command-line script stub that calls the roundup.mailgw. |
| 20 """ | 20 """ |
| 21 __docformat__ = 'restructuredtext' | 21 __docformat__ = 'restructuredtext' |
| 22 | 22 |
| 75 The username and password may be omitted: | 75 The username and password may be omitted: |
| 76 pop username@server | 76 pop username@server |
| 77 pop server | 77 pop server |
| 78 are both valid. The username and/or password will be prompted for if | 78 are both valid. The username and/or password will be prompted for if |
| 79 not supplied on the command-line. | 79 not supplied on the command-line. |
| 80 | |
| 81 POPS: | |
| 82 Connect to a POP server over ssl. This requires python 2.4 or later. | |
| 83 This supports the same notation as POP. | |
| 80 | 84 |
| 81 APOP: | 85 APOP: |
| 82 Same as POP, but using Authenticated POP: | 86 Same as POP, but using Authenticated POP: |
| 83 apop username:password@server | 87 apop username:password@server |
| 84 | 88 |
| 152 if hasattr(socket, 'setdefaulttimeout'): | 156 if hasattr(socket, 'setdefaulttimeout'): |
| 153 socket.setdefaulttimeout(60) | 157 socket.setdefaulttimeout(60) |
| 154 | 158 |
| 155 if source == 'mailbox': | 159 if source == 'mailbox': |
| 156 return handler.do_mailbox(specification) | 160 return handler.do_mailbox(specification) |
| 157 elif source == 'pop': | 161 elif source == 'pop' or source == 'pops': |
| 158 m = re.match(r'((?P<user>[^:]+)(:(?P<pass>.+))?@)?(?P<server>.+)', | 162 m = re.match(r'((?P<user>[^:]+)(:(?P<pass>.+))?@)?(?P<server>.+)', |
| 159 specification) | 163 specification) |
| 160 if m: | 164 if m: |
| 165 ssl = source.endswith('s') | |
| 166 if ssl and sys.version_info<(2,4): | |
| 167 return usage(argv, _('Error: a later version of python is required')) | |
| 161 return handler.do_pop(m.group('server'), m.group('user'), | 168 return handler.do_pop(m.group('server'), m.group('user'), |
| 162 m.group('pass')) | 169 m.group('pass'),ssl) |
| 163 return usage(argv, _('Error: pop specification not valid')) | 170 return usage(argv, _('Error: pop specification not valid')) |
| 164 elif source == 'apop': | 171 elif source == 'apop': |
| 165 m = re.match(r'((?P<user>[^:]+)(:(?P<pass>.+))?@)?(?P<server>.+)', | 172 m = re.match(r'((?P<user>[^:]+)(:(?P<pass>.+))?@)?(?P<server>.+)', |
| 166 specification) | 173 specification) |
| 167 if m: | 174 if m: |
| 170 return usage(argv, _('Error: apop specification not valid')) | 177 return usage(argv, _('Error: apop specification not valid')) |
| 171 elif source == 'imap' or source == 'imaps': | 178 elif source == 'imap' or source == 'imaps': |
| 172 m = re.match(r'((?P<user>[^:]+)(:(?P<pass>.+))?@)?(?P<server>.+)', | 179 m = re.match(r'((?P<user>[^:]+)(:(?P<pass>.+))?@)?(?P<server>.+)', |
| 173 specification) | 180 specification) |
| 174 if m: | 181 if m: |
| 175 ssl = 0 | 182 ssl = source.endswith('s') |
| 176 if source == 'imaps': | |
| 177 ssl = 1 | |
| 178 mailbox = '' | 183 mailbox = '' |
| 179 if len(args) > 3: | 184 if len(args) > 3: |
| 180 mailbox = args[3] | 185 mailbox = args[3] |
| 181 return handler.do_imap(m.group('server'), m.group('user'), | 186 return handler.do_imap(m.group('server'), m.group('user'), |
| 182 m.group('pass'), mailbox, ssl) | 187 m.group('pass'), mailbox, ssl) |
