This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

xbanpurge.tcl error.

Support & discussion of released scripts, and announcements of new releases.
Post Reply
User avatar
Nor7on
Op
Posts: 185
Joined: Sat Mar 03, 2007 8:05 am
Location: Spain - Barcelona
Contact:

xbanpurge.tcl error.

Post by Nor7on »

hi, i have my eggdrops 1.6.18.
and put this xbanpurge.tcl in my eggdrop y get this error and die my eggdrop.

Code: Select all

[08:56] missing close-brace: possible unbalanced brace in comment
    while executing
"proc rawit {from keyword arg} {
global xlistdebug xlistchans xlistaccess xlistuser xlistpass xlistban xlistby xlistlevel xlisttimef
if { $from == "X!c..."
    (file "/home/nor7on/Modo/current/Xbanpurge.tcl" line 215)
    invoked from within
"source $files"
    ("foreach" body line 3)
    invoked from within
"foreach files $qload(filelist) {
                        if {$files == ""} {return 0}
                        source $files
                        }"
    ("foreach" body line 3)
    invoked from within
"foreach type $qload(types) {
        set qload(filelist) [glob -directory $qload(datadir) -nocomplain -- $type]
                foreach files $qload(filelist) {
                        if {$fi..."
    (file "scripts/quickload.tcl" line 36)
    invoked from within
"sourc
[08:56] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)
here post the complete code tcl.

Code: Select all

#####
# Xbanpurge v1.0 by HigH
# 1. What does it do ?
#   - it authenticates to X
#   - it unbans the eggdrop if banned, treating <75 bans as well 
#   - it invites the bot through X to channel, if set +i
#   - it ops the bot through X if autoop is not set
#   - takes the bans from X banlist and places them inside
#   - removes them if it finds them again in X's banlist
# 2. How does it work? 
#   - it adds X as a user internally, with flags +fX, f(friend) and X for bind raw procedures
#   - it provides some commands
#        - dcc command .xauth which does authentication ( for o|o )
#        - dcc command .xlist which does ban purging from X ( for o|o )
#        - msg command xbans which returns bans from X by /msging back ( for everybody )
#        - msg command bans which returns internal banlist by /msging back ( only for owners )
# 3. What does it NOT do (yet) ?
#   - it can be only used on one channel
#   - can not clear limit if it's set, because it is a 400 level or more privilege, and i think that 
#     a little too much for an eggdrop
#   - it has some problems when displaying special characters in bans, like *}*@* .. i will fix that soon 
#
# 4. Installation
#    Place it into /home/of/eggdrop/scripts and add "source scripts/xbanpurge.tcl" at the end of 
#    config file
#
# For problems, suggestions and complains please mail to solics@yahoo.com or contact me as HigH on undernet
# channel #bucuresti
#####

# Set is as the channel you want to monitor
set xlistchans "#Madrid"

# Set its user to X
set xlistuser "username"

# Set its pass to X
set xlistpass "Password"

# Set this to 0 if the bot does not have autoop to X
set xlistautoop 1

# Set its access to X
set xlistaccess 100

# Set this to how many minutes do you want between checking
set xlisttimer 20

# Set this if you want X to be ignored
set xlistxignore 1

# Set this to 0 if you want some extra infos printed in partyline
set xlistdebug 1




######### Do not modify, unless you know what you are doing #######
set xlistban ""
set xlistlevel ""
set xlistby ""
set xlisttimef ""
set xlistauthed 0





# This analyzes the raw NOTICEs coming from X
proc xlistraw { from keyword text } {
global xlistauthed xlistautoop xlistchans xlistuser xlistpass botnick xlistdebug
if { $from == "X!cservice@undernet.org" } {
	if { [string match "*You must be logged in to use this command*" $text] } {
		if { $xlistdebug == "1" } {putlog "We are not logged in to X."}
		putquick "ISON X"
		set xlistauthed 0
		return 2
		}
	if { [string match "*AUTHENTICATION SUCCESSFUL as*" $text] } {
		if { $xlistdebug == "1" } {putlog "We are just authenticated."}
		set xlistauthed 1
		return 3
		}
	if { [string match "*are not authorised with me anymo*" $text] } {
		if { $xlistdebug == "1" } {putlog "Somebody has just used our pass to X, reauthenticating ..."}
		putquick "ISON X"
		set xlistauthed 0
		return 4
		}
	if { [string match "*Ban List for channel*" $text] } {
		if { $xlistdebug == "1" } {putlog "Analizing banlist for $xlistchans."}
		return 5
		}
	if { [string match "*Channel *" $text] } {
		if { $xlistdebug == "1" } {putlog "Analizing status for $xlistchans."}
		return 6
		}
	if { [string match "*are not allowed to be opped on*" $text] } {
		if { $xlistdebug == "1" } {putlog "We are banned with level less than 75 on $xlistchans."}
		return 7
		}
	if { [string match "*You are already authenticated as*" $text] } {
		if { $xlistdebug == "1" } {putlog "We are already authenticated."}
		set xlistauthed 1
		return 8
		}
	} {
	return 0
	}
}

# This does the auth and oping, if xlistautoop is not set
proc xlistxauth { hand idx arg } {
putquick "ISON X"
}

# this is the dcc command to start analizing the banlist
proc xlistlist { hand idx arg } {
global xlistdebug xlistchans
if { $xlistdebug == "1" } {putlog "Msging X for banlist ..."}
putquick "PRIVMSG X :lbanlist $xlistchans *"
}

# this is for xbans pub command
proc xlistbans { nick uhost handle text } {
global xlistchans xlistdebug
if { $xlistdebug == "1" } {putlog "$nick is asking for X banlist ..." } 
putserv "PRIVMSG $nick :\037Some bans may not be displayed correctly, but that will be fixed in the next version."
foreach ban [banlist $xlistchans] {
	if { [string match "*Xbanpurge*" $ban] } {
		set list [split $ban]
		set length [llength $list]
		putserv "PRIVMSG $nick :Banning [charfilter [lrange $list 0 [expr $length-5]]]"
		}
	}
}


#this is for bans pub command
proc xlistbans2 { nick uhost handle text } {
global xlistchans xlistdebug
putserv "PRIVMSG $nick :\037Some bans may not be displayed correctly, but that will be fixed in the next version."
if { $xlistdebug == "1" } {putlog "$nick is asking for banlist ..." }
foreach ban [banlist $xlistchans] {
	set list [split $ban]
	set length [llength $list]
	putserv "PRIVMSG $nick :Banning [charfilter [lrange $list 0 [expr $length-5]]]"
	}
}


# This is executed when X joins the channel
proc xlistjoin { nick uhost handle channel } {
global xlistautoop xlistdebug xlistchans xlistuser xlistpass botnick xlistauthed
if { $xlistdebug == "1" } {putlog "X just joined the channel, authenticating ..."}
putquick "PRIVMSG X@channels.undernet.org :login $xlistuser $xlistpass"
if { $xlistdebug == "1" } {putlog "Authenticating ... "}
set xlistauthed 1
if { $xlistautoop == 0 } { 
	putquick "PRIVMSG X :op $botnick $xlistchans"
	} 
return 0
}

# ison parsing and authentication
### With compliments for Wcc :>
proc ison_parse {from key text} {
global xlistdebug xlistauthed xlistautoop xlistchans xlistuser xlistpass botnick
if { [lrange [split $text :] 1 1] == "X" } {
	if { $xlistauthed == "0" } {
		if { $xlistdebug == "1" } {putlog "Authenticating ... "}
		set xlistauthed 1
		putquick "PRIVMSG X@channels.undernet.org :login $xlistuser $xlistpass"
		if { $xlistautoop == 0 } {
			putquick "PRIVMSG X :op $botnick $xlistchans"
			if { $xlistdebug == "1" } {putlog "Oping ourself ..."}
			}
		putquick "PRIVMSG X :lbanlist #Madrid *"
		return 2
		} {
		putquick "PRIVMSG X :lbanlist #Madrid *"
		return 2
		}
	} {
	if { $xlistdebug == "1" } {putlog "X is not online."}
	set xlistauthed 0
	}
return 0
}

# this is done when connecting to the server
proc xlistinit { init-server } {
global xlistdebug xlistxignore
if { [validuser X] } {
	if { $xlistdebug == "1" } {putlog "X is already added as a user"}
	} else {
	if { $xlistdebug == "1" } {putlog "Adding X as a user"}
	adduser X *!*@undernet.org
	chattr X +X
}

if { $xlistxignore=="1" } {
	if { [isignore *!*@undernet.org] } { 
		if { $xlistdebug == "1" } {putlog "Notices from X are already ignored."}
		} {
		newignore *!*@undernet.org Xbanpurge "leave this untouched" 0
		if { $xlistdebug == "1" } {putlog "Ignoring notices coming from X."}
 		}
}
putquick "ISON X"
return 0
}

# this does the banlist analizing
proc rawit {from keyword arg} { 
global xlistdebug xlistchans xlistaccess xlistuser xlistpass xlistban xlistby xlistlevel xlisttimef
if { $from == "X!cservice@undernet.org" } { 
	set ctamea [split $arg]
	set bufferus [lrange [split [lrange $ctamea 1 1] :] 1 1]
	if { [string match "*No Match*" $arg] } {
		if { $xlistdebug == "1" } {putlog "No bans on $xlistchans."}
		return 0
		}
	if { [string match "*END*" $arg] } {
		if { $xlistdebug == "1" } {putlog "End of banlist."}
		return 0
		}
	if { $bufferus == $xlistchans } {
		set xlistban [lrange $ctamea 2 2] 
		set xlistlevel [lrange $ctamea 4 4]
		if { $xlistlevel > $xlistaccess } { 
			if { $xlistdebug == "1" } {putlog "The $xlistban ban is placed by a higher level user."}
			set xlistlevel "" 
			return 0
			} 
		}
	if { $bufferus == "ADDED" } {
		set xlistby [lrange $ctamea 3 end]
		}
	if { $bufferus == "EXP" } {
		set xlisttime [lrange $ctamea 2 end]
		set xlisttimedays [lrange [split $xlisttime] 0 0]
		set onething [split [lrange [split $xlisttime] 2 2] :]
		set xlisttimehours [lrange $onething 0 0]
		set xlisttimemins [lrange $onething 1 1]
		set xlisttimef [expr $xlisttimedays*24*60+[string index $xlisttimehours 0]*600+[string index $xlisttimehours 1]*60+[string index $xlisttimemins 0]*10+[string index $xlisttimemins 1]]
		if { $xlistban != "" && $xlistby !="" && $xlistlevel!="" && $xlisttimef!=""} {
			if { [isban $xlistban $xlistchans]} {
				foreach ban [banlist $xlistchans] {
					if { [string match "*Xbanpurge*" $ban] && [string match "*$xlistban*" $ban] } {
						killchanban $xlistchans $xlistban
  						putquick "PRIVMSG X :unban $xlistchans $xlistban"
						if { $xlistdebug == "1" } {putlog "Removing chanban $xlistban on $xlistchans"}
						break
						}
					}
				if { $xlistdebug == "1" } {putlog "Removing chanban $xlistban on $xlistchans, it was found on general banlist too"
				putquick "PRIVMSG X :unban $xlistchans $xlistban"
				} {
				 set user [lrange $xlistby 0 0]
				 set reason [lrange $xlistby 1 end]
                                 set by "by $user with reason $reason for $xlisttime since [strftime %d%h] [time]"
                                newchanban $xlistchans $xlistban Xbanpurge $by $xlisttimef
				if { $xlistdebug == "1" } {putlog "Banning $xlistban $by"} 
  				putquick "PRIVMSG X :unban $xlistchans $xlistban"
				set xlistban ""
				set xlistlevel ""
				set xlistby ""
				set xlisttimef ""
				return 0
				}
			}
		}
	}
return 0
}

# timers management and starting procedure
proc xlistkill {} {
   foreach j [timers] {
	if {[string compare [lindex $j 1] xlistdoitnow ] == 0} {
			   killtimer [lindex $j 2]
							 }
  }
  return 0
}


proc xliststart {} {
  global xlisttimer
  timer $xlisttimer xlistdoitnow
  return 0
}

proc xlistdoitnow {} {
putquick "ISON X"
xlistkill
xliststart
return 0
}

# for need-unban
proc xlistunban { channel type } {
	global xlistdebug username botnick xlistchans
	if { $xlistdebug == "1" } {putlog "We need unban on $xlistchans."}
	putquick "PRIVMSG X :unban $xlistchans $botnick"
	return 0
}

# for need-op
proc xlistop { channel type } {
	global xlistdebug username botnick xlistchans
	if { $xlistdebug == "1" } {putlog "We need op on $xlistchans."}
	putquick "PRIVMSG X :op $xlistchans $botnick"
	return 0
}

# for need-invite
proc xlistinvite { channel type } {
	global username xlistdebug botnick xlistchans
	if { $xlistdebug == "1" } {putlog "We need invite on $xlistchans."}
	putquick "PRIVMSG X :invite $xlistchans $botnick"
	return 0
}

# this does some filtering on special chars like {}
proc charfilter {x {y ""} } {
	for {set i 0} {$i < [string length $x]} {incr i} {
		switch -- [string index $x $i] {
			"\\" {append y ""}
			"\}" {append y ""}
			"\{" {append y ""}
			default {append y [string index $x $i]}
		}
	}
	return $y
}


# Finnaly
xlistkill
xliststart

# binds
bind RAW X|X NOTICE xlistraw
bind RAW X|X NOTICE rawit
bind dcc o|o xauth xlistxauth
bind dcc o|o xlist xlistlist
bind msg o|o xbans xlistbans
bind msg n|n bans xlistbans2
bind JOIN X|X "$xlistchans X!cservice@undernet.org" xlistjoin
bind JOIN X|X "$xlistchans $botnick!$username@*" xlistjoin
bind evnt - init-server xlistinit
bind raw - 303 ison_parse
bind need X|X "$xlistchans unban" xlistunban
bind need X|X "$xlistchans op" xlistop
bind need X|X "$xlistchans invite" xlistinvite

putlog "X authentication and ban purger by HigH loaded and timer set at $xlisttimer minute(s)."
somebody can helpme ?
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

User avatar
Nor7on
Op
Posts: 185
Joined: Sat Mar 03, 2007 8:05 am
Location: Spain - Barcelona
Contact:

Post by Nor7on »

rosc2112 i can't put .set errorInfo, ...cause when write en the partyline .rehash for load xbanpurge.tcl my eggdrop die.

*** Modo ( nor7on@Long.users.undernet.org ) ha dejado IRC (Read error: EOF from client)

i put in eggdrop.conf

source scripts/Xbanpurge.tcl

but my eggdrop too die.
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

Just an idea; download a fresh copy of the script and use notepad or (preferably) wget the file from your shell and edit (as needed) with pico/vi.
Last edited by Alchera on Tue Nov 13, 2007 12:11 am, edited 1 time in total.
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

Nor7on wrote:rosc2112 i can't put .set errorInfo, ...cause when write en the partyline .rehash for load xbanpurge.tcl my eggdrop die.
Yeah..thats why I said to read those 2 posts, which explain how to load scripts without crashing the bot, and how to get proper debug info.
User avatar
Nor7on
Op
Posts: 185
Joined: Sat Mar 03, 2007 8:05 am
Location: Spain - Barcelona
Contact:

Post by Nor7on »

rosc2112 yeah, but i don't know how run your script... can explain better how load your script? =(
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Alchera wrote:...and use notepad...
You guys need to stop suggesting people use notepad and suggest they use wordpad instead. Notepad has a serious flaw in unicode encoding even when saving files as simply .txt. Wordpad has none of these issues, and it is what you should be using instead of notepad. Just words for thought. ;)
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

speechles: Notepad works perfectly (ask demond) ... Wordpad has this tendency to save stuff in RTF format.

Back when I used Windows I used only EditPlus2.
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

Nor7on wrote:rosc2112 yeah, but i don't know how run your script... can explain better how load your script? =(
I thought the explanation in the previously-mentioned threads were fairly clear. Might try actually reading the example provided.
User avatar
Nor7on
Op
Posts: 185
Joined: Sat Mar 03, 2007 8:05 am
Location: Spain - Barcelona
Contact:

Post by Nor7on »

well i run your script.
i copy/parte your code in a file call sentinel.tcl and put this tcl in the eggdrop.conf file and .rehash

Code: Select all

<Nor7on> .rehash
<)Modo> [04:09] #Nor7on# rehash
<)Modo> Rehashing.
<)Modo> [04:09] Writing user file...
<)Modo> [04:09] Writing channel file...
<)Modo> [04:09] Rehashing ...
<)Modo> [04:09] Listening at telnet port 3344 (all).
<)Modo> [04:09] SCRIPT ERROR:Xbanpurge.tcl: missing close-brace: possible unbalanced brace in comment
<)Modo>     while executing
<)Modo> "proc rawit {from keyword arg} {
<)Modo> global xlistdebug xlistchans xlistaccess xlistuser xlistpass xlistban xlistby xlistlevel xlisttimef
<)Modo> if { $from == "X!c..."
<)Modo>     (file "scripts/Xbanpurge.tcl" line 215)
<)Modo>     invoked from within
<)Modo> "source scripts/$script"
<)Modo> [04:09] Userfile loaded, unpacking...
<Nor7on> .set errorInfo
<)Modo> [04:15] #Nor7on# set errorInfo
<)Modo> Currently: missing close-brace: possible unbalanced brace in comment
<)Modo> Currently:     while executing
<)Modo> Currently: "proc rawit {from keyword arg} {
<)Modo> Currently: global xlistdebug xlistchans xlistaccess xlistuser xlistpass xlistban xlistby xlistlevel xlisttimef
<)Modo> Currently: if { $from == "X!c..."
<)Modo> Currently:     (file "scripts/Xbanpurge.tcl" line 215)
<)Modo> Currently:     invoked from within
<)Modo> Currently: "source scripts/$script"
i run your script good or not? i don't now.
if this is good, so can helpme now? :)
User avatar
Nor7on
Op
Posts: 185
Joined: Sat Mar 03, 2007 8:05 am
Location: Spain - Barcelona
Contact:

Post by Nor7on »

somebody can helpme ? ;/
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

<)Modo> [04:09] SCRIPT ERROR:Xbanpurge.tcl: missing close-brace:
<)Modo> while executing
<)Modo> "proc rawit


If you (or whoever wrote this script) properly indented, you'd have found your error easily. As I did not feel like actually analyzing how this script functions, but merely added a brace at the bottom to fix the apparent error, I don't really know if the proc functions as it's supposed to or not. I'll leave the analysis up to you (or the author.)

Here is your "fixed" proc, properly indented:
http://members.dandy.net/~fbn/test.tcl.txt

It loads without error. Whether the last "return 0" is in the right place, I do not know.
Post Reply