""" readme.txt (plugins/)

	If you don't read this, and ask a question covered in here, you suck.
	
	This is a slate plugin, it is not loaded by the bot, it is completely ignored.
	
	Enclosed you will find every possible event you could get.
	
"""

import support ## It's a good idea to import support
	
class exposed():
	def __init__(self, parent):
		## It is always good to make a permanent reference to your parent class.
		self.p = parent
		
		## Declare variables
		pass
		
	def __attr__(self):
		## This function is referenced by the plugin loader to get information about
		## your plugin. Think of this as the plugin header from StealthBot.
		return {
			'name' : 'name',
			'author' : "author",
			'version' : (1, 0), ## Version code in a tuple
			'description' : 'a description',
			'notes' : 'some notes',
			'help' : 'some help info',
			'chatexplicit' : False ## While True, you will only recieve __cevent__ calls, while False, you recieve __invoke__ aswell
			'onlymain' : False ## While True, this plugin will only be loaded by the main bot in a family
			}
			
	def __invoke__(self, ID, Length, Data, p):
		## This is called when the main pybot class gets data from the
		## socket it is running. It only includes data from the BNCS
		## connection, as other sockets are made by plugins and registered
		## globally. You will recieve the ID, Length and Data parsed for you
		## already, however you must run it through the buffer again to get
		## the data back. Finally, you recieve a fresh instance of the parent
		## class if you need to use it.
		b = buffer.pin()
		b.unbuild(Data)
		
	def __cevent__(self, ID, Data, p):
		## This is called when the main bot finds a chat event comming through
		## the socket. It intercepts it, parses it and spits it back to you.
		## You may also recieve unique events generated by the bot, and all of
		## them are greater than or equal to 0x100. You also recieve a new parent
		## class. If an event has an irrelevant username, you will recieve your
		## unique name with a pound (#) in front of it.
		##
		## If you want a raw list of BNCS events, please view this link:
		##   http://ersan.us/src/bnetdocs/contenta77e.html?Section=m&Code=35
		##
		## Note: None of these are python pass'd.
		
		# BNCS
		if (ID == 0x00):
			''' CE_UNKNOWN '''
			## This event has no identification.
		elif (ID == 0x01):
			''' CE_USERINCHANNEL '''
			## You will recieve this once for every user in the channel you are joining.
			## You are always last.
		elif (ID == 0x02):
			''' CE_USERJOIN '''
			## Someone has joined your channel.
		elif (ID == 0x03):
			''' CE_USERLEAVES '''
			## Someone has left your channel.
		elif (ID == 0x04):
			''' CE_WHISPERFROM '''
			## You have been whispered by someone.
		elif (ID == 0x05):
			''' CE_USERTALK '''
			## You are receiving channel text.
		elif (ID == 0x06):
			''' CE_BROADCAST '''
			## Battle.net is broadcasting a message.
		elif (ID == 0x07):
			''' CE_CHANNELJOIN '''
			## You have joined a channel, and have not received the userlist yet.
		elif (ID == 0x09):
			''' CE_USERUPDATE / CE_FLAGSUPDATE '''
			## Someone's flags have changed, they have changed characters or they have been changed in their clan.
			## You will recieve this for everyone in the channel if you unsquelch someone.
		elif (ID == 0x0A):
			''' CE_WHISPERTO '''
			## You have whispered someone.
		elif (ID == 0x0D or ID == 0x0F or ID == 0x0E or ID == 0x13):
			''' CE_ERROR '''
			## This includes all red messages.
		elif (ID == 0x12):
			''' CE_INFO '''
			## This includes all blue messages.
		elif (ID == 0x17):
			''' CE_USEREMOTE '''
			## Someone has done an /emote command.
		# Custom
		elif (ID == 0x100):
			## AddChat Echo from BNCS.
		elif (ID == 0x101):
			## Someone has issued a command instructing your bot. It is parsed but access was not checked.
			## index:
			## 0: Username
			## 1: User's flags in channel
			## 2: Parsed commandObject (view reference in support.py)
		elif (ID == 0x102):
			## The socket has failed or has been disconnected.
		elif (ID == 0x103):
			## Text was sent from the bot's user interface.
		elif (ID == 0x104):
			## The bot is starting to connect, it has already sent the protocol ID.
