root/branches/gajim_0.4/common/thread.py

Revision 359, 1.3 kB (checked in by asterix, 4 years ago)

update my email adress
update copyright
add missing headers

  • Property svn:keywords set to LastChangedDate LastChangedRevision LastChangedBy HeadURL Id
Line 
1##      common/thread.py
2##
3## Gajim Team:
4##      - Yann Le Boulanger <asterix@lagaule.org>
5##      - Vincent Hanquez <tab@snarc.org>
6##
7##      Copyright (C) 2003-2005 Gajim Team
8##
9## This program is free software; you can redistribute it and/or modify
10## it under the terms of the GNU General Public License as published
11## by the Free Software Foundation; version 2 only.
12##
13## This program is distributed in the hope that it will be useful,
14## but WITHOUT ANY WARRANTY; without even the implied warranty of
15## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16## GNU General Public License for more details.
17##
18
19import threading
20import socket
21import time
22import sys
23from common import i18n
24_ = i18n._
25
26class GajimThread(threading.Thread): 
27        def __init__(self, name = None, queueIn = None, queueOut = None): 
28                self.queueIn = queueIn
29                self.queueOut = queueOut
30                threading.Thread.__init__(self, target = self.run, \
31                        name = name) 
32        # END __init__
33 
34        def run(self):
35                mod = compile("import plugins.%s" % self.getName(), \
36                        self.getName(), "exec")
37                try:
38                        res = eval(mod)
39                        mod = compile("plugins.%s.%s.plugin(self.queueIn, self.queueOut)" % (self.getName(),self.getName()), self.getName(), "exec")
40                        res = eval(mod)
41                except:
42                        print _("plugin %s cannot be launched : ") % self.getName() + \
43                                str(sys.exc_info()[1][0:])
44        # END run
45# END GajimThread
Note: See TracBrowser for help on using the browser.