changeset 344:7d83d1401ac3

Completely untested pop gateway. It's a start.
author Richard Jones <richard@users.sourceforge.net>
date Thu, 01 Nov 2001 22:07:11 +0000
parents ab16997d9cda
children 09fbcb96d409
files roundup-popgw
diffstat 1 files changed, 60 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/roundup-popgw	Thu Nov 01 22:07:11 2001 +0000
@@ -0,0 +1,60 @@
+#! /usr/bin/python
+#
+# Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/)
+# This module is free software, and you may redistribute it and/or modify
+# under the same terms as Python, so long as this copyright message and
+# disclaimer are retained in their original form.
+#
+# IN NO EVENT SHALL BIZAR SOFTWARE PTY LTD BE LIABLE TO ANY PARTY FOR
+# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING
+# OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE.  THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
+# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
+# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+# 
+# $Id: roundup-popgw,v 1.1 2001-11-01 22:07:11 richard Exp $
+
+import sys
+if int(sys.version[0]) < 2:
+    print "Roundup requires Python 2.0 or newer."
+    sys.exit(1)
+
+# figure the instance home
+import os
+if len(sys.argv) > 1:
+    instance_home = sys.argv[1]
+else:
+    instance_home = os.environ.get('ROUNDUP_INSTANCE', '')
+if not instance_home:
+    print 'No instance home specified'
+    sys.exit(1)
+
+# get the instance
+import roundup.instance
+instance = roundup.instance.open(instance_home)
+
+# invoke the mail handler
+db = instance.open('admin')
+handler = instance.MailGW(db)
+
+import getpass, poplib
+
+M = poplib.POP3('localhost')
+M.user(getpass.getuser())
+M.pass_(getpass.getpass())
+numMessages = len(M.list()[1])
+for i in range(numMessages):
+    for j in M.retr(i+1)[1]:
+        s = cStringIO.StringIO('\n'.join(j))
+        s.seek(0)
+        handler.main(s)
+
+#
+# $Log: not supported by cvs2svn $
+#
+#
+# vim: set filetype=python ts=4 sw=4 et si

Roundup Issue Tracker: http://roundup-tracker.org/