예제 #1
0
    def __init__(self, config):
        log("master: jid:%s" % (config.component, ))

        self.running = True
        self.connection = CONNECTION.idle

        self.config = config
        self.regdb = DatabaseAPI()

        Component.__init__(
            self,
            JID(config.component),
            config.secret,
            config.server,
            int(config.port),
            disco_name="Vipadia Ltd Skype Gateway",
            disco_type="skype",
            disco_category="gateway",
        )

        self.disco_info.add_feature('http://jabber.org/protocol/disco#info')
        self.disco_info.add_feature('jabber:iq:register')
        self.disco_info.add_feature('jabber:iq:time')
        self.disco_info.add_feature('jabber:iq:version')
        self.disco_info.add_feature('http://jabber.org/protocol/rosterx')
예제 #2
0
    def __init__(self, jid, secret, server, port, **options):
        if not isinstance(jid, JID):
            jid = JID(jid)

        kwargs = {
            'disco_name':"pyjirc",
            'disco_category':"x-service",
            'disco_type':"bridge",
        }
        kwargs.update(options)
        Component.__init__(self, jid, secret, server, port, **kwargs)
        self.disco_info.add_feature("jabber:iq:version")
예제 #3
0
파일: groupchat.py 프로젝트: optixx/karaka
    def __init__(self, config):
        log("muc: jid:%s" % (config.muc,))
        
        self.connection = CONNECTION.idle
        self.running = True
        self.config = config
        Component.__init__(
            self, JID(config.muc), config.secret, config.server, int(config.port),
            disco_name="Vipadia Ltd Skype Muc Gateway",
            )

        self.disco_info.add_feature('http://jabber.org/protocol/disco#info')
        self.disco_info.add_feature('jabber:iq:version')
예제 #4
0
파일: chat.py 프로젝트: mor1/karaka
    def __init__(self, config):
        log("master: jid:%s" % (config.component,))
        
        self.running = True
        self.connection = CONNECTION.idle

        self.config = config
        self.regdb = DatabaseAPI()
        
        Component.__init__(
            self, JID(config.component), config.secret, config.server, int(config.port),
            disco_name="Vipadia Ltd Skype Gateway",
            disco_type="skype", disco_category="gateway",
            )

        self.disco_info.add_feature('http://jabber.org/protocol/disco#info')
        self.disco_info.add_feature('jabber:iq:register')
        self.disco_info.add_feature('jabber:iq:time')
        self.disco_info.add_feature('jabber:iq:version')
        self.disco_info.add_feature('http://jabber.org/protocol/rosterx')
예제 #5
0
 def __init__(self, config, logger):
     """Create instance and initialize from configuration options.
     Also set logger to global default one."""
     self.serverOpts = config.getOptions('server')
     self.mysqlOpts = config.getOptions('mysql')
     self.compOpts = config.getOptions('component')
     # initialize component
     logger.info('JoggerBot component initializing')
     name = self.compOpts['name']
     secret = self.serverOpts['secret']
     serverHostname = self.serverOpts['hostname']
     port = int(self.serverOpts['port'])
     try:
         fullName = self.compOpts['fullname']
     except KeyError:
         # using old configuration data
         self.logger.warning('Old configuration data is used')
         fullName = name
     Component.__init__(self,
                        JID(name),
                        secret,
                        serverHostname,
                        port,
                        disco_name=fullName,
                        disco_category='x-service',
                        disco_type='x-jogger')
     self.disco_info.add_feature('jabber:iq:version')
     logger.info('JoggerBot component initialized')
     self.startTime = time.time()
     self.cfg = config
     self.logger = logger
     # the signals we should respond to with graceful exit
     # for debug purpose also check Win platform
     if sys.platform == 'win32':
         signals = (signal.SIGTERM, signal.SIGINT)
     else:
         signals = (signal.SIGHUP, signal.SIGKILL, signal.SIGTERM,
                    signal.SIGINT)
     for sign in signals:
         signal.signal(sign, self.shutdown)
     self._connectDB()
예제 #6
0
 def __init__(self, config, logger):
     """Create instance and initialize from configuration options.
     Also set logger to global default one."""
     self.serverOpts = config.getOptions('server')
     self.mysqlOpts = config.getOptions('mysql')
     self.compOpts = config.getOptions('component')
     # initialize component
     logger.info('JoggerBot component initializing')
     name = self.compOpts['name']
     secret = self.serverOpts['secret']
     serverHostname = self.serverOpts['hostname']
     port = int(self.serverOpts['port'])
     try:
         fullName = self.compOpts['fullname']
     except KeyError:
         # using old configuration data
         self.logger.warning('Old configuration data is used')
         fullName = name
     Component.__init__(self, JID(name), secret, serverHostname, port,
         disco_name=fullName, disco_category='x-service',
         disco_type='x-jogger')
     self.disco_info.add_feature('jabber:iq:version')
     logger.info('JoggerBot component initialized')
     self.startTime = time.time()
     self.cfg = config
     self.logger = logger
     # the signals we should respond to with graceful exit
     # for debug purpose also check Win platform
     if sys.platform == 'win32':
         signals = (signal.SIGTERM, signal.SIGINT)
     else:
         signals = (signal.SIGHUP, signal.SIGKILL, 
             signal.SIGTERM, signal.SIGINT)
     for sign in signals:
         signal.signal(sign, self.shutdown)
     self._connectDB()