Пример #1
0
def iterate():
	import tj.plugins
	for module in plugin.getPlugins(IBotPlugin, tj.plugins):
		if(module.__module__ not in conf.get('active-plugins')):
			continue
		m = module()
		yield m
Пример #2
0
def get(name):
	import tj.plugins
	for module in plugin.getPlugins(IBotPlugin, tj.plugins):
		if(module.__module__ not in conf.get('active-plugins')):
			continue
		if(name in (module.name, module.__module__)):
			m = module()
			return m
	return None
Пример #3
0
	def makeService(cls, config):
		"""
		Setup the necessary network services for the application server.
		"""
		if(conf.get('suppress-deprecation-warnings')):
			warnings.filterwarnings('ignore', r'.*', DeprecationWarning)

		master_service = service.MultiService()
		
		xmpp_client = XMPPClient(jid.internJID(conf.get('jid')), conf.get('secret'))
		xmpp_client.setName("xmpp-client")
		xmpp_client.setServiceParent(master_service)
		
		bot = xmpp.BotProtocol()
		bot.setHandlerParent(xmpp_client)
		
		for room in conf.get('join-rooms'):
			print 'creating room client for %s' % room
			muc_client = xmpp.MUCBotClient(*room)
			muc_client.setHandlerParent(xmpp_client)
		
		return master_service