# Path: halibot/halmodule.py
# class HalModule(HalObject):
# 
# 	def reply(self, msg0=None, **kwargs):
# 		# Create the reply message
# 		body = kwargs.get('body', msg0.body)
# 		mtype = kwargs.get('type', msg0.type)
# 		author = kwargs.get('author', msg0.author)
# 		origin = kwargs.get('origin', self.name)
# 
# 		msg = Message(body=body, type=mtype, author=author, origin=origin)
# 
# 		# Synchronous reply?
# 		if msg0.sync:
# 			self.sync_replies[msg0.uuid].append(msg)
# 		else:
# 			self.send_to(msg, [ msg0.origin ])
# 
# 	def hasPermission(self, msg, perm):
# 		return self._hal.auth.hasPermission(msg.origin, msg.identity, perm)


from . import HalModule
#
# CommandModule
#    Subclass of HalModule that does the heavy lifting of commands for you
#

# Decorator for converting the string stripped of the command to an argument list
def AsArgs(func):
	def wrapper(self, string, msg=None):
		args = string.split(" ")
		func(self, args, msg=msg)
	return wrapper


# Path: halibot/halmodule.py
# class HalModule(HalObject):
# 
# 	def reply(self, msg0=None, **kwargs):
# 		# Create the reply message
# 		body = kwargs.get('body', msg0.body)
# 		mtype = kwargs.get('type', msg0.type)
# 		author = kwargs.get('author', msg0.author)
# 		origin = kwargs.get('origin', self.name)
# 
# 		msg = Message(body=body, type=mtype, author=author, origin=origin)
# 
# 		# Synchronous reply?
# 		if msg0.sync:
# 			self.sync_replies[msg0.uuid].append(msg)
# 		else:
# 			self.send_to(msg, [ msg0.origin ])
# 
# 	def hasPermission(self, msg, perm):
# 		return self._hal.auth.hasPermission(msg.origin, msg.identity, perm)


# Path: halibot/commandmodule.py
from . import HalModule

#
# CommandModule
#    Subclass of HalModule that does the heavy lifting of commands for you
#

# Decorator for converting the string stripped of the command to an argument list
def AsArgs(func):
	def wrapper(self, string, msg=None):
		args = string.split(" ")
		func(self, args, msg=msg)
	return wrapper


class CommandModule(HalModule):