Initial commit
Initial commit

file:b/SolaceLib.lua (new)
--- /dev/null
+++ b/SolaceLib.lua
@@ -1,1 +1,89 @@
+local SOLACELIB_MAJOR, SOLACELIB_MINOR = "SolaceLib", 0.50
+local SolaceLib = _G[SOLACELIB_MAJOR]
 
+if not SolaceLib or SolaceLib.minor < SOLACELIB_MINOR then 
+	SolaceLib = SolaceLib or { }
+	_G[SOLACELIB_MAJOR] = SolaceLib
+	SolaceLib.minor = SOLACELIB_MINOR
+
+	SolaceLib.commands = { count = 0 }
+
+	SLASH_SOLACE1 = "/solace"
+	SlashCmdList["SOLACE"] = function(msg) SolaceLib:slashHandler(msg) end
+
+	function SolaceLib:commandsInit(cmd,desc,fnct)
+		
+		-- Initialize soulmsg
+		SolaceLib.commands.count = SolaceLib.commands.count + 1
+		SolaceLib.commands[SolaceLib.commands.count] = { }
+		SolaceLib.commands[SolaceLib.commands.count].cmd = cmd
+		SolaceLib.commands[SolaceLib.commands.count].desc = desc
+		if type( fnct ) == "string" then
+			SolaceLib.commands[SolaceLib.commands.count].func = function(msg, index)
+				self[fnct](SolaceLib, msg, index)
+			end
+		else
+			SolaceLib.commands[SolaceLib.commands.count].func = fnct
+		end
+	end
+
+	function SolaceLib:printHelp()
+		DEFAULT_CHAT_FRAME:AddMessage("/solace commands:")
+		for i = 1, SolaceLib.commands.count do
+			DEFAULT_CHAT_FRAME:AddMessage(" - "..SolaceLib.commands[i].cmd..": "..SolaceLib.commands[i].desc)
+		end
+	end
+
+	-- Internal function to pick which channel to should get the messages.
+	function SolaceLib:slashParser(msg)
+		local firstspace = string.find(msg, " ", 1, true)
+		if (firstspace) then
+			local command = string.sub(msg, 1, firstspace - 1)
+			local option = string.sub(msg, firstspace + 1)
+			return command, option
+		else
+			return msg, nil
+		end
+	end
+
+	function SolaceLib:slashHandler(msg)
+		
+		local carg1, carg2 = SolaceLib:slashParser(msg)
+		local matchfound = false
+		
+		if carg1 then
+			carg1 = string.lower(carg1)
+		end
+		
+		if ( not carg1 ) then
+			SolaceLib:printHelp()
+		else
+			for i = 1, SolaceLib.commands.count do
+				if ( carg1 == SolaceLib.commands[i].cmd ) then
+					matchfound = true
+					SolaceLib.commands[i].func(carg2,i)
+				end
+			end
+			if ( not matchfound ) then
+				SolaceLib:printHelp()
+			end
+		end    
+	end
+
+	function SolaceLib:getCmdindex(cmd)
+		for i = 1, SolaceLib.commands.count do
+			if ( cmd == SolaceLib.commands[i].cmd ) then
+				return i
+			end
+		end
+		return false
+	end
+	
+	-- Compatibility Functions
+	function SolaceCmdInit(cmd,desc,fun)
+		DEFAULT_CHAT_FRAME:AddMessage("One of your Solace mods is out of date!  Please update SolaceBuffDisplay or SolaceStones.")
+		SolaceLib:commandsInit(cmd,desc,func)
+	end
+	function SolaceGetCmdIndex(cmd) SolaceLib:getCmdindex(cmd) end
+	SOLACELIB_VER = SOLACELIB_MINOR
+end

file:b/SolaceLib.toc (new)
--- /dev/null
+++ b/SolaceLib.toc
@@ -1,1 +1,8 @@
+## Interface: 70200
+## Title: Lib: SolaceLib
+## Notes: Common functions for Solace mods.
+## Version: 7.2.0
+## Author: Hallithron
 
+SolaceLib.lua
+