2003-10-22 20:45:13 +02:00
|
|
|
## common/thread.py
|
|
|
|
##
|
|
|
|
## Gajim Team:
|
2005-01-07 22:52:38 +01:00
|
|
|
## - Yann Le Boulanger <asterix@lagaule.org>
|
2004-06-18 11:25:15 +02:00
|
|
|
## - Vincent Hanquez <tab@snarc.org>
|
2003-10-22 20:45:13 +02:00
|
|
|
##
|
2005-01-07 22:52:38 +01:00
|
|
|
## Copyright (C) 2003-2005 Gajim Team
|
2003-10-22 20:45:13 +02:00
|
|
|
##
|
|
|
|
## 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; version 2 only.
|
|
|
|
##
|
|
|
|
## 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.
|
|
|
|
##
|
|
|
|
|
|
|
|
import threading
|
|
|
|
import socket
|
|
|
|
import time
|
2004-07-17 23:00:38 +02:00
|
|
|
import sys
|
|
|
|
from common import i18n
|
|
|
|
_ = i18n._
|
2003-11-30 16:50:23 +01:00
|
|
|
|
2003-10-22 20:45:13 +02:00
|
|
|
class GajimThread(threading.Thread):
|
|
|
|
def __init__(self, name = None, queueIn = None, queueOut = None):
|
|
|
|
self.queueIn = queueIn
|
|
|
|
self.queueOut = queueOut
|
2005-03-02 13:07:27 +01:00
|
|
|
threading.Thread.__init__(self, target = self.run, name = name)
|
2003-10-22 20:45:13 +02:00
|
|
|
# END __init__
|
|
|
|
|
|
|
|
def run(self):
|
2005-03-02 13:07:27 +01:00
|
|
|
mod = compile('import plugins.%s' % self.getName(), self.getName(), 'exec')
|
2005-03-02 00:48:05 +01:00
|
|
|
res = eval(mod)
|
2005-03-02 13:07:27 +01:00
|
|
|
mod = compile('plugins.%s.%s.plugin(self.queueIn, self.queueOut)'
|
|
|
|
% (self.getName(), self.getName()), self.getName(), 'exec')
|
2005-03-02 00:48:05 +01:00
|
|
|
res = eval(mod)
|
2003-10-22 20:45:13 +02:00
|
|
|
# END run
|
|
|
|
# END GajimThread
|