--- 0.9/src/mailarchive-admin.py.orig 2007-03-01 08:01:51.000000000 +0900 +++ 0.9/src/mailarchive-admin.py 2007-03-01 09:04:33.000000000 +0900 @@ -385,6 +385,17 @@ self._import_from_pop3('cmd',db,arg[0]) ## Help + _help_stdin = [('stdin ', 'import from stdin')] + + def do_stdin(self,line): + arg = self.arg_tokenize(line) + if len(arg) < 1 : + print "- MLname" + db = self.db_open() + self.env = self.env_open() + self._import_from_stdin('cmd',db,arg[0]) + + ## Help _help_help = [('help', 'Show documentation')] def do_help(self, line=None): @@ -398,7 +409,9 @@ else: docs = (#self._help_about + self._help_help + - self._help_import + self._help_pop3 + self._help_import + + self._help_pop3 + + self._help_stdin ) print 'mailarc-admin - The Trac MailArchivePlugin Administration Console ' if not self.interactive: @@ -459,7 +472,8 @@ fp.close() #if handle_ta: db.commit() - self.print_info("End Imporing %s. " % msgfile_path) + self.print_info("End Imporing %s mails from %s. " % + (str(counter-1), msgfile_path)) def _import_from_pop3(self,author, db, mlid): @@ -527,6 +541,23 @@ self.print_info("End Reciving. " ) + def _import_from_stdin(self,author, db, mlid): + mes_text = ''.join(['%s' % line for line in sys.stdin]) + messageid = '' + exception_flag = False + try: + msg = email.message_from_string(mes_text) + messageid = msg['message-id'] + self.import_message(msg,author,mlid,db) + except Exception, e: + exception_flag = True + self.print_error('Exception At Message-ID:'+messageid) + self.print_error( e ) + + db.commit() + self.print_info("Message-Id: %s done." % messageid ) + + def run(args): """Main entry point.""" admin = MailArchiveAdmin() --- 0.9/src/mailarchive/mailarchive.py.orig 2006-05-20 21:32:52.000000000 +0900 +++ 0.9/src/mailarchive/mailarchive.py 2007-03-01 09:23:28.000000000 +0900 @@ -352,6 +352,7 @@ target_category = category prefix = 'mailarc.category.items.'+mlid + prefix = re.compile('\.$').sub('',prefix) req.hdf[prefix + '.name'] = mlid prefix = prefix + ".items."+yearmonth