root/trunk/jjigw.py

Revision 165, 1.7 kB (checked in by jajcus, 2 years ago)

- addresses updated

  • Property svn:executable set to *
Line 
1 #!/usr/bin/python -u
2 #
3 #  Jajcus' Jabber to IRC Gateway
4 #  Copyright (C) 2004  Jacek Konieczny <jajcus@jajcus.net>
5 #
6 #  This program is free software; you can redistribute it and/or modify
7 #  it under the terms of the GNU General Public License as published by
8 #  the Free Software Foundation; either version 2 of the License, or
9 #  (at your option) any later version.
10 #
11 #  This program is distributed in the hope that it will be useful,
12 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 #  GNU General Public License for more details.
15 #
16 #  You should have received a copy of the GNU General Public License along
17 #  with this program; if not, write to the Free Software Foundation, Inc.,
18 #  59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19
20 import sys
21 import os.path
22 import logging
23
24 from jjigw.common import JJIGWFatalError
25 from jjigw.config import Config
26 from jjigw.component import Component
27
28 def main(profile=False):
29     config_dir,data_dir=".","."
30
31     try:
32         logger=logging.getLogger()
33         logger.addHandler(logging.StreamHandler())
34         logger.setLevel(logging.DEBUG)
35         try:
36             config=Config(config_dir,data_dir)
37         except:
38             print >>sys.stderr,"Couldn't load config file:",str(sys.exc_value)
39             sys.exit(1)
40
41         print "creating component..."
42         c=Component(config,profile=profile)
43
44         print "starting..."
45         c.run(1)
46     except JJIGWFatalError,e:
47         print e
48         print "Aborting."
49         sys.exit(1)
50
51 if '--profile' in sys.argv:
52     import profile
53     sys.argv.remove('--profile')
54     profile.run("main(profile=True)","jjigw.prof")
55 else:
56     main()
57
58 # vi: sts=4 et sw=4
59
Note: See TracBrowser for help on using the browser.