#---------------------------------------------------------------------# # incith:oidentd $Rev:: 120 $ # # $Id:: incith-oidentd.tcl 120 2009-07-21 16:29:43Z incith $ # # # # This script will write a .oidentd.conf file before connecting, and # # then replace it with the original afterwards, so the bot can have # # its own ident. # # # Usage: # # Just set the variables properly below. Make sure you copy your # # working .oidentd.conf file to the 'backup' that you set below. # # # # Requirements: # # - oidentd: http://ojnk.sourceforge.net/ # # - the user running eggdrop has permission to 'spoof' with oidentd # # (see 'man oidentd.conf', I will not help with this) # # # # ChangeLog (m/d/y): # # 3/03/09: script created. # # # # TODO: # # - Suggestions/Thanks/Bugs/Ideas, e-mail at bottom of header. # # # # LICENSE (GPLv3): # # 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 3 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. # # (http://www.gnu.org/licenses/gpl-3.0.txt) # # # # Copyright (C) 2009, Jordan # # http://incith.com ~ incith@gmail.com ~ irc.freenode.net/#incith # #---------------------------------------------------------------------# setudef flag oidentd # 0 (zero) will disable an optional variable, 1 or above enables # namespace eval incith::oidentd { # the ident to set/spoof: variable identity "visitant" # your local oidentd configuration file variable config "/home/incith/.oidentd.conf" # set the original/backup copy that will get restored after # the bot connects (make a copy of your current working config): variable backup "/home/incith/.oidentd.conf.orig" } # script begins namespace eval incith::oidentd { variable version "incith:oidentd-SVN" variable debug 1 array set static {} array unset static * # [ipl] : a neat/handy putlog procedure, moved up here to use it sooner # proc ipl {who {where {}} {what {}}} { if {$where == "" && $what == ""} { # first argument only = data only putlog "${incith::oidentd::version}: ${who}" } elseif {$where != "" && $what == ""} { # two arguments = who and data putlog "${incith::oidentd::version}: <${who}> ${where}" } else { # all three... putlog "${incith::oidentd::version}: <${who}/${where}> ${what}" } } } namespace eval incith::oidentd { proc replace_config {{args}} { if {![file readable $incith::oidentd::config]} { ipl "Configuration file not found or not readable at '${incith::oidentd::config}', replace aborted." return } else { if {![file readable $incith::oidentd::backup]} { ipl "Backup configuration file unavailable at '${incith::oidentd::backup}', please create it first." return } set tmpID "global {\n reply \"${incith::oidentd::identity}\"\n}\n" set fopen [open $incith::oidentd::config w] puts $fopen $tmpID close $fopen } } proc restore_config {{args}} { if {![file readable $incith::oidentd::backup]} { ipl "Backup Configuration file not found or not readable at '${incith::oidentd::backup}', restore aborted." return } else { catch {file copy -force -- $incith::oidentd::backup ${incith::oidentd::config}} output_copy if {$output_copy != ""} { ipl "Could not restore oidentd configuration file: ${output_copy}!" } } } } # probably over-kill, oh well: bind evnt - sighup incith::oidentd::restore_config bind evnt - sigterm incith::oidentd::restore_config bind evnt - sigill incith::oidentd::restore_config bind evnt - sigquit incith::oidentd::restore_config bind evnt - init-server incith::oidentd::restore_config bind evnt - disconnect-server incith::oidentd::restore_config bind evnt - prerestart incith::oidentd::replace_config bind evnt - connect-server incith::oidentd::replace_config incith::oidentd::ipl "loaded."