---------------------------------------------------------------------------------
--
-- Prat - A framework for World of Warcraft chat mods
--
-- Copyright (C) 2006-2007  Prat Development Team
--
-- This program is free software; you can redistribute it and/or
-- modify it under the terms of the GNU General Public License
-- as published by the Free Software Foundation; either version 2
-- of the License, or (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to:
--
-- Free Software Foundation, Inc.,
-- 51 Franklin Street, Fifth Floor,
-- Boston, MA  02110-1301, USA.
--
--
-------------------------------------------------------------------------------



--[[
Name: PratTimestamps
Revision: $Revision: 28748 $
Author(s): Curney (asml8ed@gmail.com)
	   Krtek (krtek4@gmail.com)
Inspired by: idChat2_Timestamps by Industrial
Website: http://files.wowace.com/Prat/
Documentation: http://www.wowace.com/wiki/Prat/Integrated_Modules#Timestamps
Discussions: http://groups.google.com/group/wow-prat
Issues and feature requests: http://code.google.com/p/prat/issues/list
SVN: http://svn.wowace.com/wowace/trunk/Prat/
Description: Module for Prat that adds configurable timestamps to chat windows (default=on).
Dependencies: Prat
]]

local L = AceLibrary("AceLocale-2.2"):new("PratTimestamps")

L:RegisterTranslations("enUS", function() return {
	["Timestamps"] = true,
	["Chat window timestamp options."] = true,
	["Set Separately"] = true,
	["Toggle setting options separately for each chat window."] = true,
	["Show Timestamp"] = true,
	["Toggle showing timestamp on and off for each window."] = true,
	["Chat%dTimestampShow"] = true,
	["Toggle showing timestamp on and off for chat window %d."] = true,
	["Show All Timestamps"] = true,
	["Toggle showing timestamp on and off for all chat windows."] = true,
	["Format Timestamp"] = true,
	["Set timestamp format (strftime) for each chat window."] = true,
	["Chat%dTimestampFormat"] = true,
	["Set timestamp format (strftime) for chat window %d."] = true,
	["Format All Timestamps"] = true,
	["Set timestamp format (strftime) for all chat windows."] = true,
	["Show Space"] = true,
	["Toggle adding space after timestamp."] = true,
	["Color Timestamp"] = true,
	["Toggle the coloring the timestamp on and off."] = true,
	["Set Color"] = true,
	["Change the color of the timestamp."] = true,
	["Use Local Time"] = true,
	["Toggle using local time on and off."] = true,
	["prepend_name"] = "Prepend the Timestamp",
	["prepend_desc"] = "Put the timestamp first in the chat string.",
	["show_name"] = "Show",
	["show_desc"] = "Toggle showing timestamp settings for each window.",
	["show_perframename"] = "Chat%dTimestampShow",
	["show_perframedesc"] = "Toggle showing timestamp on and off for chat window %d.",
	["format_name"] = "Format",
	["format_desc"] = "Set timestamp format (strftime) for each window.",
	["format_perframename"] = "Chat%dTimestampFormat",
	["format_perframedesc"] = "Set timestamp format (strftime) for chat window %d.",
	["space_name"] = "Show Space",
	["space_desc"] = "Toggle adding space after timestamp.",
	["colortimestamp_name"] = "Color Timestamp",
	["colortimestamp_desc"] = "Toggle the coloring the timestamp on and off.",
	["localtime_name"] = "Use Local Time",
	["localtime_desc"] = "Toggle using local time on and off.",
} end)

L:RegisterTranslations("frFR", function() return {
	["Timestamps"] = "Affichage de l'heure",
	["Chat window timestamp options."] = "Options pour l'affichage de l'heure devant les messages",
	["Set Separately"] = "R\195\169gler s\195\169par\195\169ment",
	["Toggle setting options separately for each chat window."] = "Active/d\195\169sactive le r\195\169glage des options pour chaque fen\195\170tre s\195\169par\195\169ment.",
	["Show Timestamp"] = "Afficher l'heure",
	["Toggle showing timestamp on and off for each window."] = "Affiche/masque l'heure devant chaque message.",
	["Chat%dTimestampShow"] = "Fen\195\170tre %d",
	["Toggle showing timestamp on and off for chat window %d."] = "Affiche/masque l'heure devant les messages de la fen\195\170tre %d.",
	["Show All Timestamps"] = "Afficher l'heure partout",
	["Toggle showing timestamp on and off for all chat windows."] = "Afficher l'heure devant les messages de chaque fen\195\170tre",
	["Format Timestamp"] = "Format de l'heure",
	["Set timestamp format (strftime) for each chat window."] = "R\195\168gle le format de l'heure (strftime) pour chaque fen\195\170tre de discussion.",
	["Chat%dTimestampFormat"] = "Fen\195\170tre %d",
	["Set timestamp format (strftime) for chat window %d."] = "R\195\168gle le format de l'heure (strftime) pour la fen\195\170tre %d.",
	["Format All Timestamps"] = "Format de toutes les heures",
	["Set timestamp format (strftime) for all chat windows."] = "R\195\168gle le format de l'heure (strftime) pour l'ensemble des fen\195\170tres de discussion",
	["Show Space"] = "Afficher une espace",
	["Toggle adding space after timestamp."] = "Affiche/masque l'espace après l'heure.",
	["Color Timestamp"] = "Coloriser l'heure",
	["Toggle the coloring the timestamp on and off."] = "Active/d\195\169sactive la colorisation de l'heure.",
	["Set Color"] = "Couleur",
	["Change the color of the timestamp."] = "Change la couleur de l'heure.",
	["Use Local Time"] = "Utiliser l'heure locale",
	["Toggle using local time on and off."] = "Utilise ou non l'heure locale.",
	["prepend_name"] = "Pr\195\169pose l'heure",
	["prepend_desc"] = "Affiche l'heure en premier dans la cha\195\174ne",
	["show_name"] = "Afficher",
	["show_desc"] = "Affiche/masque les r\195\169glages de l'heure pour chaque fen\195\170tre.",
	["show_perframename"] = "Fen\195\170tre %d",
	["show_perframedesc"] = "Affiche/masque l'heure devant les messages de la fen\195\170tre %d.",
	["format_name"] = "Format",
	["format_desc"] = "R\195\168gle le format de l'heure (strftime) pour chaque fen\195\170tre de discussion.",
	["format_perframename"] = "Fen\195\170tre %d",
	["format_perframedesc"] = "Règle le format de l'heure (strftime) pour la fen\195\170tre de discussion %d.",
	["space_name"] = "Afficher une espace",
	["space_desc"] = "Affiche/masque l'espace apr\195\168s l'heure..",
	["colortimestamp_name"] = "Coloriser l'heure",
	["colortimestamp_desc"] = "Active/d\195\169sactive la colorisation de l'heure.",
	["localtime_name"] = "Utiliser l'heure locale",
	["localtime_desc"] = "Utilise ou non l'heure locale.",
} end)


L:RegisterTranslations("koKR", function() return {
	["Timestamps"] = "시간",
	["Chat window timestamp options."] = "대화창 시간 설정입니다.",
	["Set Separately"] = "구분 설정",
	["Toggle setting options separately for each chat window."] = "각각의 대화창에 대한 구분 설정을 사용합니다.",
	["Show Timestamp"] = "시간 표시",
	["Toggle showing timestamp on and off for each window."] = "각각의 대화창에 시간을 표시합니다.",
	["Chat%dTimestampShow"] = "대화창%d시간표시",
	["Toggle showing timestamp on and off for chat window %d."] = "대화창 %d에 시간을 표시합니다.",
	["Show All Timestamps"] = "모든 시간 표시",
	["Toggle showing timestamp on and off for all chat windows."] = "모든 대화창에 시간을 표시합니다.",
	["Format Timestamp"] = "시간 형식",
	["Set timestamp format (strftime) for each chat window."] = "각각의 대화창에 대한 시간 형식(strftime)을 설정합니다.",
	["Chat%dTimestampFormat"] = "대화창%d시간형식",
	["Set timestamp format (strftime) for chat window %d."] = "대화창 %d에 대한 시간 형식(strftime)을 설정합니다.",
	["Format All Timestamps"] = "모든 시간 형식",
	["Set timestamp format (strftime) for all chat windows."] = "모든 대화창에 대한 시간 형식(strftime)을 설정합니다.",
	["Show Space"] = "빈칸 표시",
	["Toggle adding space after timestamp."] = "시간 뒤에 빈 칸을 추가합니다.",
	["Color Timestamp"] = "시간 색상",
	["Toggle the coloring the timestamp on and off."] = "시간에 색상을 사용합니다.",
	["Set Color"] = "색상 설정",
	["Change the color of the timestamp."] = "시간의 색상을 변경합니다.",
	["Use Local Time"] = "로컬 시간 사용",
	["Toggle using local time on and off."] = "로컬 시간을 사용합니다.",
	["prepend_name"] = "대화 시간 추가",
	["prepend_desc"] = "대화 앞에 시간을 추가합니다.",
	["show_name"] = "표시",
	["show_desc"] = "각각의 대화창에 시간 표시를 설정합니다.",
	["show_perframename"] = "대화창%d시간표시",
	["show_perframedesc"] = "대화창 %d에 시간을 표시합니다.",
	["format_name"] = "형식",
	["format_desc"] = "각각의 대화창에 대한 시간 형식(strftime)을 설정합니다.",
	["format_perframename"] = "대화창%d시간형식",
	["format_perframedesc"] = "대화창 %d에 대한 시간 형식(strftime)을 설정합니다.",
	["space_name"] = "공백 표시",
	["space_desc"] = "시간뒤에 공백을 추가합니다.",
	["colortimestamp_name"] = "시간 색상",
	["colortimestamp_desc"] = "시간에 색상을 사용합니다.",
	["localtime_name"] = "로컬 시간 사용",
	["localtime_desc"] = "로컬 시간을 사용합니다.",
} end)


L:RegisterTranslations("esES", function() return {
	["Timestamps"] = "Horas",
	["Chat window timestamp options."] = "Opciones de hora para la ventana de chat",
	["Set Separately"] = "Por Separado",
	["Toggle setting options separately for each chat window."] = "Establecer opciones para cada ventana por separado",
	["Show Timestamp"] = "Mostrar Hora",
	["Toggle showing timestamp on and off for each window."] = "Muestra la hora en cada ventana",
	["Chat%dTimestampShow"] = "Mostrar hora en chat %d",
	["Toggle showing timestamp on and off for chat window %d."] = "Muestra la hora en la ventana de chat %d",
	["Show All Timestamps"] = "Mostrar todas las Horas",
	["Toggle showing timestamp on and off for all chat windows."] = "Muestra la hora en todas las ventanas de chat",
	["Format Timestamp"] = "Formatear Hora",
	["Set timestamp format (strftime) for each chat window."] = "Establece el formato de hora (strftime) para cada ventana de chat",
	["Chat%dTimestampFormat"] = "Formato de Hora en chat %d",
	["Set timestamp format (strftime) for chat window %d."] = "Establece el formato de hora (strftime) para la ventana de chat %d",
	["Format All Timestamps"] = "Formatear todas las Horas",
	["Set timestamp format (strftime) for all chat windows."] = "Establece el formato de hora (strftime) para todas las ventanas de chat",
	["Show Space"] = "Mostrar Espacio",
	["Toggle adding space after timestamp."] = "A�ade un espacio tras la Hora",
	["Color Timestamp"] = "Colorear Hora",
	["Toggle the coloring the timestamp on and off."] = "Colorea la Hora",
	["Set Color"] = "Color",
	["Change the color of the timestamp."] = "Cambia el color de la Hora",
	["Use Local Time"] = "Usar Hora Local",
	["Toggle using local time on and off."] = "Usar Hora Local",
	["prepend_name"] = "Hora delante",
	["prepend_desc"] = "Pone la hora al inicio del chat",
	["show_name"] = "Mostrar",
	["show_desc"] = "Muestra la hora en cada ventana.",
	["show_perframename"] = "Mostrar hora en chat %d",
	["show_perframedesc"] = "Muestra la hora en la ventana de chat %d",
	["format_name"] = "Formato",
	["format_desc"] = "Establece el formato de hora (strftime) para cada ventana de chat.",
	["format_perframename"] = "Formato de Hora en chat %d",
	["format_perframedesc"] = "Establece el formato de hora (strftime) para la ventana de chat %d.",
	["space_name"] = "Mostrar Espacio",
	["space_desc"] = "A�ade un espacio tras la Hora.",
	["colortimestamp_name"] = "Colorear Hora",
	["colortimestamp_desc"] = "Colorea la Hora",
	["localtime_name"] = "Usar Hora Local",
	["localtime_desc"] = "Usar Hora Local.",
} end)

L:RegisterTranslations("deDE", function() return {
	["Timestamps"] = "Zeitstempel",
	["Chat window timestamp options."] = "Chatfenster Zeitstempel Optionen",
	["Set Separately"] = "Seperat einstellen",
	["Toggle setting options separately for each chat window."] = "Schaltet die Einstellungsoptionen seperat f\195\188r jedes einzelne Fenster.",
	["Show Timestamp"] = "Zeige Zeitstempel",
	["Toggle showing timestamp on and off for each window."] = "Schaltet das Anzeigen der Zeitstempel an und aus f\195\188r jedes Fenster.",
	["Chat%dTimestampShow"] = "Chat %d Zeitstempel Anzeigen",
	["Toggle showing timestamp on and off for chat window %d."] = "Schaltet das Anzeigen des Zeitstempels an und aus f\195\188r das Chatfenster %d.",
	["Show All Timestamps"] = "Zeige Allle Zeitstempel",
	   ["Toggle showing timestamp on and off for all chat windows."] = "Schaltet das Anzeigen des Zeitstempels an und aus f\195\188r alle Chatfenster.",
	["Format Timestamp"] = "Zeitformat Art",
	["Set timestamp format (strftime) for each chat window."] = "Stellt das Zeitstempelformat (strfzeit format) f\195\188r jedes Chatfenster ein.",
	["Chat%dTimestampFormat"] = "Chat %d Zeitstempelformat",
	["Set timestamp format (strftime) for chat window %d."] = "Stellt das Zeitstempelformat (strfzeit format) f\195\188r das Chatfenster %d ein.",
	["Format All Timestamps"] = "Formatiere Alle Zeitstempel",
	["Set timestamp format (strftime) for all chat windows."] = "Stellt das Zeitstempelformat (strfzeit format) f\195\188r alle Chatfenster ein.",
	["Show Space"] = "Zeige Leerstelle",
	["Toggle adding space after timestamp."] = "Aktiviere eine Leerstelle nach dem Zeitstempel.",
	["Color Timestamp"] = "F\195\164rbe Zeitstempel",
	["Toggle the coloring the timestamp on and off."] = "Schaltet das einf\195\164rben des Zeitstempels ein und aus.",
	["Set Color"] = "W\195\164hle Farbe",
	["Change the color of the timestamp."] = "Farbe des Zeitstempels \195\164ndern.",
	   ["Use Local Time"] = "Benutze Lokale Zeit",
	["Toggle using local time on and off."] = "Schaltet die Benutzung der Lokalen Zeit ein und aus.",
	["show_name"] = "Zeige",
	["show_desc"] = "Schaltet das Anzeigen der Zeitstempel an und aus f\195\188r jedes Fenster.",
	["show_perframename"] = "Chat %d Zeitstempel Anzeigen",
	["show_perframedesc"] = "Schaltet das Anzeigen des Zeitstempels an und aus f\195\188r das Chatfenster %d.",
	["format_name"] = "Zeitformat Art",
	["format_desc"] = "Stellt das Zeitstempelformat (strfzeit format) f\195\188r jedes Chatfenster ein.",
	["format_perframename"] = "Chat %d Zeitstempelformat",
	["format_perframedesc"] = "Stellt das Zeitstempelformat (strfzeit format) f\195\188r das Chatfenster %d ein",
	["space_name"] = "Zeige Leerstelle",
	["space_desc"] = "Aktiviere eine Leerstelle nach dem Zeitstempel.",
	["colortimestamp_name"] = "F\195\164rbe Zeitstempel",
	["colortimestamp_desc"] = "Schaltet das einf\195\164rben des Zeitstempels ein und aus.",
	["localtime_name"] = "Benutze Lokale Zeit",
	["localtime_desc"] = "Schaltet die Benutzung der Lokalen Zeit ein und aus.",
} end)

Prat_Timestamps = Prat:NewModule(Prat:RequestModuleName("PratTimestamps"))

Prat_Timestamps.revision = tonumber(string.sub("$Revision: 28748 $", 12, -3))

-- Prat categories relevant to this module. list at: http://groups.google.com/group/wow-prat/web/prat-categories
local cat = Prat.Categories
Prat_Timestamps.Categories	= { cat.COLORS, cat.FORMATTING, cat.TEXT, cat.INFO }	-- eg { cat.TEXT, cat.INFO }

Prat_Timestamps.defaultDB = {
		on = true,
		separate = true,
		show = {true, true, true, true, true, true, true},
		showall = true,
		formatmode = "ALL",
		format = {"%X", "%X", "%X", "%X", "%X", "%X", "%X"},
		formatall = "%X",
		colortimestamp = true,
		color = {
			r = 1,
			g = 1,
			b = 1
		},
		space = true,
		localtime = true,
		prepend = true
}

Prat_Timestamps.moduleOptions = {}
Prat_Timestamps.toggleOptions = { show_handler={}, space=160, colortimestamp=170, prepend=190, localtime=130 }

-- Set this to true to use Prat Event Support
--Prat_Timestamps.supportsPratEvents = true

function Prat_Timestamps:GetModuleOptions()
	self.moduleOptions = {
		name = L["Timestamps"],
		desc = L["Chat window timestamp options."],
		type = "group",
		args = {
			separate = {
				name = L["Set Separately"],
				desc = L["Toggle setting options separately for each chat window."],
				type = "toggle",
				order = 100,
				get = function() return self.db.profile.separate end,
				set = function(v) self.db.profile.separate = v end,
			},
			show = {
				name = L["Show Timestamp"],
				desc = L["Toggle showing timestamp on and off for each window."],
				type = "group",
				order = 110,
				args = {
				},
			},
			showall = {
				name = L["Show All Timestamps"],
				desc = L["Toggle showing timestamp on and off for all chat windows."],
				type = "toggle",
				order = 120,
				get = function() return self.db.profile.showall end,
				set = function(v)
					self.db.profile.showall = v
					for i=1,NUM_CHAT_WINDOWS do
						self.db.profile.show[i] = v
						self:SetFrameStatus(i)
					end
				end,
				disabled = function() if self.db.profile.separate then return true else return false end end,
			},
			format = {
				name = L["Format Timestamp"],
				desc = L["Set timestamp format (strftime) for each chat window."],
				type = "group",
				order = 140,
				args = {
					help = {
						name	= 'help',
						desc	= 'How to customise your timestamp',
						type	= 'execute',
						order	= 100,
						func	= function() self:showHelpText() end,
					},
					chat1 = {
						name = string.format(L["Chat%dTimestampFormat"], 1),
						desc = string.format(L["Set timestamp format (strftime) for chat window %d."], 1),
						type = "text",
						order = 150,
						usage = "<string>",
						get = function() return self.db.profile.format[1] end,
						set = function(v) self.db.profile.format[1] = v end
					},
					chat2 = {
						name = string.format(L["Chat%dTimestampFormat"], 2),
						desc = string.format(L["Set timestamp format (strftime) for chat window %d."], 2),
						type = "text",
						order = 150,
						usage = "<string>",
						get = function() return self.db.profile.format[2] end,
						set = function(v) self.db.profile.format[2] = v end
					},
					chat3 = {
						name = string.format(L["Chat%dTimestampFormat"], 3),
						desc = string.format(L["Set timestamp format (strftime) for chat window %d."], 3),
						type = "text",
						order = 150,
						usage = "<string>",
						get = function() return self.db.profile.format[3] end,
						set = function(v) self.db.profile.format[3] = v end
					},
					chat4 = {
						name = string.format(L["Chat%dTimestampFormat"], 4),
						desc = string.format(L["Set timestamp format (strftime) for chat window %d."], 4),
						type = "text",
						order = 150,
						usage = "<string>",
						get = function() return self.db.profile.format[4] end,
						set = function(v) self.db.profile.format[4] = v end
					},
					chat5 = {
						name = string.format(L["Chat%dTimestampFormat"], 5),
						desc = string.format(L["Set timestamp format (strftime) for chat window %d."], 5),
						type = "text",
						order = 150,
						usage = "<string>",
						get = function() return self.db.profile.format[5] end,
						set = function(v) self.db.profile.format[5] = v end
					},
					chat6 = {
						name = string.format(L["Chat%dTimestampFormat"], 6),
						desc = string.format(L["Set timestamp format (strftime) for chat window %d."], 6),
						type = "text",
						order = 150,
						usage = "<string>",
						get = function() return self.db.profile.format[6] end,
						set = function(v) self.db.profile.format[6] = v end
					},
					chat7 = {
						name = string.format(L["Chat%dTimestampFormat"], 7),
						desc = string.format(L["Set timestamp format (strftime) for chat window %d."], 7),
						type = "text",
						order = 150,
						usage = "<string>",
						get = function() return self.db.profile.format[7] end,
						set = function(v) self.db.profile.format[7] = v end
					},
				},
				disabled = function() if not self.db.profile.separate then return true else return false end end,
			},
			formatall = {
				name = L["Format All Timestamps"],
				desc = L["Set timestamp format (strftime) for all chat windows."],
				type = "text",
				order = 150,
				usage = "<string>",
				get = function() return self.db.profile.formatall end,
				set = function(v)
					self.db.profile.formatall = v
					for i=1,NUM_CHAT_WINDOWS do
						self.db.profile.format[i] = v
					end
				end,
				disabled = function() if self.db.profile.separate then return true else return false end end,
			},
			setcolor = {
				name = L["Set Color"],
				desc = L["Change the color of the timestamp."],
				type = "color",
				order = 180,
				get = function() return self.db.profile.color.r, self.db.profile.color.g, self.db.profile.color.b end,
				set = function(r, g, b, a) self.db.profile.color.r, self.db.profile.color.g, self.db.profile.color.b = r, g, b end,
				disabled = function() if not self.db.profile.colortimestamp then return true else return false end end,
			},
		},
	}
   	return self.moduleOptions
end

function Prat_Timestamps:OnModuleEnable()
	self.moduleOptions.args.show.disabled = function() if not self.db.profile.separate then return true else return false end end

	if self.db.profile.show == nil then
		self:Debug("DB CORRUPT: show is nil")
		self.db.profile.show = {}
	end

	-- For this module to work, it must hook before Prat
	for i=1,NUM_CHAT_WINDOWS do
		self:Hook(getglobal("ChatFrame"..i), "AddMessage", true)
	end

  	self.secondsDifference = 0
	_,self.lastMinute = GetGameTime()
end

--[[------------------------------------------------
	Core Functions
------------------------------------------------]]--
function Prat_Timestamps:AddMessage(frame, text, ...)
	local id = frame:GetID()
	if self.db and self.db.profile.show and self.db.profile.show[id] then
		text = text and self:InsertTimeStamp(text, id)
	end
	self.hooks[frame].AddMessage(frame, text, ...)
end

function Prat_Timestamps:InsertTimeStamp(text, id)
	text = text or ""

	-- get timestamp format
	local dateFormat
   	dateFormat = self.db.profile.format[id]
   	-- get space character useage
	if ( self.db.profile.space ) then space = " " else space = "" end
	-- get color format
	if self.db.profile.colortimestamp then
		local color = string.format("%02x%02x%02x", self.db.profile.color.r*255, self.db.profile.color.g*255, self.db.profile.color.b*255)
		text = string.format("|cff"..color.."%s|r" .. space .. "%s", self:GetTime(dateFormat), text)
	else
		text = string.format("%s".. space .. "%s", self:GetTime(dateFormat), text)
	end

	return text
end

function Prat_Timestamps:GetTime(format)
	if self.db.profile.localtime then
		return date(format)
	else
		local tempDate = date("*t")
		tempDate["hour"], tempDate["min"] = GetGameTime()
		-- taken from FuBar_ClockFu
		if self.lastMinute ~= tempDate["min"] then
			_,self.lastMinute = GetGameTime()
			self.secondsDifference = mod(time(), 60)
		end
		tempDate["sec"] = mod(time() - self.secondsDifference, 60)
		return date(format, time(tempDate))
	end
end

-- Useless Code
function Prat_Timestamps:show(id, val)
	if self.db.profile.show == nil then
		self:Debug("DB CORRUPT: show is nil")
		self.db.profile.show = {}
	end
--   We want the hooks positioned relative to prat's hook so prat doesnt see us
--   self:SetFrameStatus(id)
end

-- Dead Code
function Prat_Timestamps:SetFrameStatus(id)


--	if self.db.profile.show[id] then
--		if not self:IsHooked(getglobal("ChatFrame"..id), "AddMessage") then self:Hook(getglobal("ChatFrame"..id), "AddMessage", true) end
--	else
--		if self:IsHooked(getglobal("ChatFrame"..id), "AddMessage") then self:Unhook(getglobal("ChatFrame"..id), "AddMessage") end
--	end
end

function Prat_Timestamps:showHelpText()
	-- should probably stick this in a popup frame; leaving it here for now as it's hopefully useful
	-- also need to update the web page, not sure they're 100% correct
	local helptext = 'Prat_Timestamp allows you to specify the timestamp style for each (or all) chat frames by listing how you want the display, in the format of percentage signs followed by numbers with each letter representing a different value (eg "%H:%M:%S" to display current hour, minute, and second seperated by colons). There are a huge number of potential values available to you, with some of the most common being:\
\
%C\
 - is replaced by (year / 100) as decimal number; single digits are preceded by a zero.\
\
%m\
 - is replaced by the month as a decimal number (01-12).\
\
%I\
 - is replaced by the hour (12-hour clock) as a decimal number (0-12)\
\
%H\
 - is replaced by the hour (24-hour clock) as a decimal number (00-23)\
\
%M\
 - is replaced by the minute as a decimal number (00-59).\
\
%p\
 - is replaced by national representation of either "ante meridiem" or "post meridiem" as appropriate.\
\
%S\
 - is replaced by the second as a decimal number (00-60).\
\
For a comprehensive listing of available timestamp escape characters, please see the following URL:\
\
 - http://groups.google.com/group/wow-prat/web/timestamp-formats'

 	SELECTED_CHAT_FRAME:AddMessage('|cffffe900Prat_Timestamps|r')
 	SELECTED_CHAT_FRAME:AddMessage(helptext)
end
