#########
#
# MootBot - Templating Module
# Copyright 2007 Andrew Williams
#
#########
#
#########
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU Lesser General Public License as published by
#    the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
#
#    You should have received a copy of the GNU Lesser General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
#
#########

################################################################################
# DO NOT EDIT DO NOT EDIT DO NOT EDIT  DO NOT EDIT DO NOT EDIT DO NOT EDIT     #
#                         EDIT MOOTBOT_CONFIG.TCL			       #
################################################################################

array set aTemplateVariables {}

proc templateReset {} {
	global aTemplateVariables
   	array set aTemplateVariables
}

proc setTemplateVal {name value} {
	global aTemplateVariables

	set aTemplateVariables($name) $value
}

proc parseTemplate {input} {
	global aTemplateVariables
	set output [string map [array get aTemplateVariables] $text]

	template:reset
	return $output
}

proc logWrite {ltype chan text} {
	global aChanLog aMinutesFile

	if {$ltype == 1} {
		puts $aChanLog($chan) $text
		flush $aChanLog($chan)
		return 1
	}
        if {$ltype == 2} {
		puts $aMinutesFile($chan) $text
		flush $aMinutesFile($chan)
		return 1
	}
	
	return 0

}














