first import

first import between version 0.1.3 and 0.2

darcs-hash:20051127110300-684f5-0ed50cd0e86df9195cec2c1df070fdf24a6faeb5.gz
This commit is contained in:
dax
2005-11-27 12:03:00 +01:00
commit 9fa2df5563
27 changed files with 4351 additions and 0 deletions

74
jmc.py Executable file
View File

@@ -0,0 +1,74 @@
#!/usr/bin/python -u
##
## Jabber Mail Component
## jmc.py
## Login : David Rousselie <dax@happycoders.org>
## Started on Fri Jan 7 11:06:42 2005
## $Id: jmc.py,v 1.3 2005/07/11 20:39:31 dax Exp $
##
## Copyright (C) 2005
## This program 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 2 of the License, or
## (at your option) any later version.
##
## This program 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 this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##
import sys
import os.path
import logging
from jabber.component import MailComponent, ComponentFatalError
from jabber.config import Config
def main(config_file = "jmc.xml", isDebug = 0):
try:
logger = logging.getLogger()
logger.addHandler(logging.StreamHandler())
if isDebug > 0:
logger.setLevel(logging.DEBUG)
try:
logger.debug("Loading config file " + config_file)
config = Config(config_file)
except:
print >>sys.stderr, "Couldn't load config file:", \
str(sys.exc_value)
sys.exit(1)
print "creating component..."
mailcomp = MailComponent(config)
print "starting..."
mailcomp.run(1)
except ComponentFatalError,e:
print e
print "Aborting."
sys.exit(1)
if __name__ == "__main__":
var_option = 0
file_num = 0
index = 0
debug_level = 0
for opt in sys.argv:
if var_option == 0 and len(opt) == 2 and opt == "-c":
var_option += 1
elif (var_option & 1) == 1 and len(opt) > 0:
var_option += 1
file_num = index
if len(opt) == 2 and opt == "-D":
debug_level = 1
index += 1
if (var_option & 2) == 2:
main(sys.argv[file_num], debug_level)
else:
main("jmc.xml", debug_level)