# Path: halibot/halconfigurer.py
# class HalConfigurer():
# 
# 	def __init__(self, options={}):
# 		self.options = options
# 
# 	def option(self, option_type, key, **kwargs):
# 		opt = option_type(key, **kwargs)
# 
# 		# Override the default if the option is already set
# 		if key in self.options:
# 			opt.default = self.options[key]
# 
# 		val = opt.configure()
# 		if val != None:
# 			self.options[key] = val
# 
# 	def optionString(self, key, **kwargs):
# 		self.option(Option.String, key, **kwargs)
# 
# 	def optionInt(self, key, **kwargs):
# 		self.option(Option.Int, key, **kwargs)
# 
# 	def optionNumber(self, key, **kwargs):
# 		self.option(Option.Number, key, **kwargs)
# 
# 	def optionBoolean(self, key, **kwargs):
# 		self.option(Option.Boolean, key, **kwargs)
# 
# 	def configure(self):
# 		pass # pragma: no cover
# 
# Path: halibot/message.py
# class MalformedMsgException(Exception): 'Bad message object'


import logging
import asyncio
import inspect
import copy
from threading import Thread
from collections import defaultdict
from .halconfigurer import HalConfigurer
from .message import MalformedMsgException
		fut = asyncio.run_coroutine_threadsafe(self._receive(msg), self.eventloop)
		return fut

	def init(self):
		pass

	def shutdown(self):
		pass

	def apply_filter(self, dest):
		fl = self._hal.config.get("filters")
		if not fl:
			return dest # Filters not enabled/configured

		name = dest.split("/")[0]

		ib = fl.get("inbound", {})
		ob = fl.get("outbound", {})

		ret = "/".join(ib.get(name, []) + [dest])
		ret = "/".join(ob.get(self.name, []) + [ret])

		return ret

	def raw_send(self, msg):
		if not msg.target:
			self.log.warning("Message passed to send without target")
			raise MalformedMsgException("raw_send given empty target")
		if not msg.origin:
			self.log.warning("Message passed to send without origin")

# Path: halibot/halconfigurer.py
# class HalConfigurer():
# 
# 	def __init__(self, options={}):
# 		self.options = options
# 
# 	def option(self, option_type, key, **kwargs):
# 		opt = option_type(key, **kwargs)
# 
# 		# Override the default if the option is already set
# 		if key in self.options:
# 			opt.default = self.options[key]
# 
# 		val = opt.configure()
# 		if val != None:
# 			self.options[key] = val
# 
# 	def optionString(self, key, **kwargs):
# 		self.option(Option.String, key, **kwargs)
# 
# 	def optionInt(self, key, **kwargs):
# 		self.option(Option.Int, key, **kwargs)
# 
# 	def optionNumber(self, key, **kwargs):
# 		self.option(Option.Number, key, **kwargs)
# 
# 	def optionBoolean(self, key, **kwargs):
# 		self.option(Option.Boolean, key, **kwargs)
# 
# 	def configure(self):
# 		pass # pragma: no cover
# 
# Path: halibot/message.py
# class MalformedMsgException(Exception): 'Bad message object'


# Path: halibot/halobject.py
import logging
import asyncio
import inspect
import copy
from threading import Thread
from collections import defaultdict
from .halconfigurer import HalConfigurer
from .message import MalformedMsgException

		fut = asyncio.run_coroutine_threadsafe(self._receive(msg), self.eventloop)
		return fut

	def init(self):
		pass

	def shutdown(self):
		pass

	def apply_filter(self, dest):
		fl = self._hal.config.get("filters")
		if not fl:
			return dest # Filters not enabled/configured

		name = dest.split("/")[0]

		ib = fl.get("inbound", {})
		ob = fl.get("outbound", {})

		ret = "/".join(ib.get(name, []) + [dest])
		ret = "/".join(ob.get(self.name, []) + [ret])

		return ret

	def raw_send(self, msg):
		if not msg.target:
			self.log.warning("Message passed to send without target")
			raise MalformedMsgException("raw_send given empty target")
		if not msg.origin:
			self.log.warning("Message passed to send without origin")

			raise MalformedMsgException("raw_send given empty origin")