Bläddra i källkod

cleanups

Signed-off-by: hwipl <33433250+hwipl@users.noreply.github.com>
hwipl 6 år sedan
förälder
incheckning
d0b8f91e6d
8 ändrade filer med 56 tillägg och 74 borttagningar
  1. 0 6
      scripts/auth.tcl
  2. 1 9
      scripts/date.tcl
  3. 18 20
      scripts/funwar.tcl
  4. 2 2
      scripts/greetings.tcl
  5. 4 4
      scripts/maketiny.tcl
  6. 19 19
      scripts/qstat.tcl
  7. 4 5
      scripts/topic.tcl
  8. 8 9
      scripts/watch.tcl

+ 0 - 6
scripts/auth.tcl

@@ -10,11 +10,5 @@ proc auth_auth { type } {
 #	puthelp "PRIVMSG <auth_serv>: HELLO <email> <email>"
 #}
 
-#proc auth_test {nick host hand chan argv} {
-#	puthelp "PRIVMSG $nick :test,1,2,3..."
-#}
-
 #bind pub - !register auth_register
 bind evnt - init-server auth_auth
-#bind pub - !test auth_test
-

+ 1 - 9
scripts/date.tcl

@@ -1,16 +1,8 @@
 # date.tcl
-#set date "/usr/bin/date"
-
-#global date
-
-#proc show_date { nick host hand chan arg } {
-#	puthelp "PRIVMSG $chan :[clock format [clock seconds]]"
-#}
-#bind pub - !date show_date
-
 
 proc show_date { nick host hand chan arg } {
 	set date_format "%a %b %d %H:%M:%S %Z %Y"
 	puthelp "PRIVMSG $chan :[clock format [clock seconds] -format $date_format]"
 }
+
 bind pub - !date show_date

+ 18 - 20
scripts/funwar.tcl

@@ -2,7 +2,6 @@
 # funwar script
 # have fun ;)
 
-
 package require sql
 
 # sql stuff:
@@ -42,12 +41,12 @@ set funwar_output_footer "*** end of funwars list ***"
 #<don´t change>
 proc funwar_post {game id date time xonx clantag irc www server org chan } {
 #</don´t change>
-	
+
 set funwar_output_body "$game $date $xonx $clantag $irc"
 
 
 #<don´t change>
-puthelp "PRIVMSG $chan :$funwar_output_body"	
+puthelp "PRIVMSG $chan :$funwar_output_body"
 }
 #</don´t change>
 
@@ -145,12 +144,12 @@ proc funwar_rtcw { nick host hand chan arg } {
 	global funwar_sql_password
 	global funwar_sql_dbname_rtcw
 	global funwar_sql_tblname_rtcw
-	
+
 	set order "id"
 	set game "RTCW"
 	set limit "10"
 	set command ""
-	
+
 	funwar_sql_parsedb $funwar_sql_server $funwar_sql_user $funwar_sql_password $funwar_sql_dbname_rtcw $funwar_sql_tblname_rtcw $order $chan $game $limit $command
 
 }
@@ -162,14 +161,14 @@ proc funwar_et { nick host hand chan arg } {
 	global funwar_sql_password
 	global funwar_sql_dbname_et
 	global funwar_sql_tblname_et
-	
+
 	set order "id"
 	set game "ET"
 	set limit "10"
 	set command ""
-	
+
 	funwar_sql_parsedb $funwar_sql_server $funwar_sql_user $funwar_sql_password $funwar_sql_dbname_et $funwar_sql_tblname_et $order $chan $game $limit $command
-	
+
 }
 
 proc funwar_both { nick host hand chan arg } {
@@ -181,23 +180,23 @@ proc funwar_both { nick host hand chan arg } {
 	global funwar_sql_tblname_rtcw
 	global funwar_sql_dbname_et
 	global funwar_sql_tblname_et
-	
+
 	set order "id"
 	set game "RTCW"
 	set limit "3"
 	set command "nofooter"
-	
+
 	funwar_sql_parsedb $funwar_sql_server $funwar_sql_user $funwar_sql_password $funwar_sql_dbname_rtcw $funwar_sql_tblname_rtcw $order $chan $game $limit $command
-	
+
 	set game "ET"
 	set command "noheader"
-	
+
 	funwar_sql_parsedb $funwar_sql_server $funwar_sql_user $funwar_sql_password $funwar_sql_dbname_et $funwar_sql_tblname_et $order $chan $game $limit $command
-	
+
 }
 
 proc funwar_auto { min hour day month year } {
-	
+
 	global funwar_channels_auto
 	global funwar_sql_server
 	global funwar_sql_user
@@ -207,21 +206,20 @@ proc funwar_auto { min hour day month year } {
 	global funwar_sql_dbname_et
 	global funwar_sql_tblname_et
 	global funwar_channels_auto
-	
+
 	set order "id"
 	set game "RTCW"
 	set limit "3"
 	set command "nofooter"
-	
+
 	funwar_sql_parsedb $funwar_sql_server $funwar_sql_user $funwar_sql_password $funwar_sql_dbname_rtcw $funwar_sql_tblname_rtcw $order $funwar_channels_auto $game $limit $command
-	
+
 	set game "ET"
 	set command "noheader"
-	
+
 	funwar_sql_parsedb $funwar_sql_server $funwar_sql_user $funwar_sql_password $funwar_sql_dbname_et $funwar_sql_tblname_et $order $funwar_channels_auto $game $limit $command
-	
-}
 
+}
 
 bind pub - $funwar_trigger_et funwar_et
 bind pub - $funwar_trigger_rtcw funwar_rtcw

+ 2 - 2
scripts/greetings.tcl

@@ -1,10 +1,10 @@
 # greetings tcl
 
-bind join - * join_greeting
-
 proc join_greeting { nick host hand chan } {
 	set $greetInChannel ""
 	if { [lsearch $greetInChannel $chan] != "-1" } {
 	puthelp "NOTICE $nick :Hi ${nick}!"
 	}
 }
+
+bind join - * join_greeting

+ 4 - 4
scripts/maketiny.tcl

@@ -18,14 +18,14 @@ if { [llength $argv] == 0 } {
 
 if ![catch {open $command r} input] {
 	while {[gets $input line] >= 0} {
-		
+
 		# regexp to extract the right part of the html file and the get the tiny url
 		# output tiny url
-		
+
 		if [regexp {<input type=hidden name=tinyurl value=\"(.*)\">} $line match tinyurl] {
 				puthelp "PRIVMSG $chan :$tinyurl"
 		}
-		
+
 	}
 	close $input
 }
@@ -44,7 +44,7 @@ proc tinyurl_tinylast {nick host hand chan argv} {
 
 proc tinyurl_urlhistory {nick host hand chan argv} {
 	set urlhistory "url_history_$chan"
-	
+
 	if {[regexp {(http://\S*)} $argv match url] != 0} {
 		if ![catch {open $urlhistory w} output] {
 			puts $output $url

+ 19 - 19
scripts/qstat.tcl

@@ -100,8 +100,8 @@ proc add_match {nick host hand chan arg} {
 	close $output
 	puthelp "NOTICE $nick :Attempted to add server."
 	putlog "match.tcl: $nick@$chan attempted to add a server to the list"
-	} else { puthelp "NOTICE $nick :Error opening file: $input"
-		 putlog "match.tcl: ERROR! Error opening file: $input"}
+	} else { puthelp "NOTICE $nick :Error opening file: $output"
+		 putlog "match.tcl: ERROR! Error opening file: $output"}
 	}
 	} else { puthelp "NOTICE $nick :Can't add empty entry" }
 	}
@@ -114,33 +114,33 @@ proc refresh_servers {nick host hand chan arg} {
 	global playerlist1
 	global optionsall
 	global optionssingle
-	
+
 	if { $arg == "" } {
-	
+
 	if {[file exists $file]} {
-	
+
 	if {[file size $file] > 0} {
-	
+
 	if ![catch {open $file r} input] {
 	while {[gets $input line] >= 0} {
 	lappend matches $line
 	}
 	close $input
 	}
-	
+
 	if ![catch {open "|$qstat $optionsall -f $file" r} input] {
-	
+
 	while {[gets $input line] >= 0} {
 	formatline $line $chan $matches
 	}
-	
+
 	close $input
 	} else { puthelp "PRIVMSG $nick :Error refreshing servers: $input " }
 	} else { puthelp "PRIVMSG $nick :No servers have been added yet..." }
 	} else { puthelp "PRIVMSG $nick :No servers have been added yet..." }
 
 	} else {
-        
+
 	set playerlist1 ""
 	if {[file exists $file]} {
 	if {[file size $file] > 0} {
@@ -159,15 +159,9 @@ proc refresh_servers {nick host hand chan arg} {
 	} else { puthelp "NOTICE $nick :Error opening file: $input" }
 	} else { puthelp "PRIVMSG $chan :No servers have been added yet..."}
 	} else { puthelp "PRIVMSG $chan :No servers have been added yet..."}
-	
-	}
-}	
 
-# binds to call the procedures:
-bind pub - $showcommand show_matches
-bind pub - $addcommand add_match
-bind pub - $delcommand del_match
-bind pub - $refreshcommand refresh_servers
+	}
+}
 
 proc formatline { line chan matches } {
 	set match [regexp {([\d]+.[\d]+.[\d]+.[\d]+:[\d]+)\
@@ -179,7 +173,7 @@ proc formatline { line chan matches } {
 	if { $match == 1 } {
 	set number [expr [lsearch $matches $address] +1]
 	puthelp "PRIVMSG $chan :($number) \0030,1\00307[format "%-21s " $address] \00315[format "%-45s " $name] \0034[format "%-7s " ($players)] \00315[format "%-10s " ($map)]"}
-}	
+}
 
 proc formatone { line chan arg } {
 	global playerlist1
@@ -200,3 +194,9 @@ proc formatone { line chan arg } {
 		}
 	}
 }
+
+# binds to call the procedures:
+bind pub - $showcommand show_matches
+bind pub - $addcommand add_match
+bind pub - $delcommand del_match
+bind pub - $refreshcommand refresh_servers

+ 4 - 5
scripts/topic.tcl

@@ -8,13 +8,12 @@ proc set_topic_on { nick host hand chan arg } {
 	putserv "TOPIC $chan :Something is now online"
 }
 
-bind pub o|o !off set_topic_off
-bind pub o|o !on set_topic_on
-
-bind pub - !topic set_topic
-
 proc set_topic { nick host hand chan arg } {
 	if [isop $chan $nick] {
 	putserv "TOPIC $chan :$arg"
 	}
 }
+
+bind pub o|o !off set_topic_off
+bind pub o|o !on set_topic_on
+bind pub - !topic set_topic

+ 8 - 9
scripts/watch.tcl

@@ -1,17 +1,17 @@
 #!/usr/bin/tclsh
 
 proc watch_nick {nick host hand chan argv} {
-	
+
 	global watch_nick_user
 	set watch_nick_user $nick
-	
+
 	# check if there are enough parameters
 	if {[llength $argv] < 2} {
 		puthelp "PRIVMSG $nick :Usage: !watch <add|del|chk> <nick>"
 		#puts "PRIVMSG $nick :Usage: !watch <add|del> <nick>"
 		return
 	}
-	
+
 	# set some variables
 	set command [lindex $argv 0]
 	set nick2watch [lindex $argv 1]
@@ -26,13 +26,13 @@ proc watch_nick {nick host hand chan argv} {
 }
 
 proc watch_add {nick} {
-	
+
 	# file where to save nicks
 	set nickdb "watch_nick.db"
 
 	# helper var to check if nick is already saved
 	set found 0
-	
+
 	# open file and start reading and comparing saved nicks with submitted one
 	if ![catch {open $nickdb r} input] {
 		while {[gets $input line] >= 0} {
@@ -42,7 +42,7 @@ proc watch_add {nick} {
 		}
 		close $input
 	}
-	
+
 	# insert nick into nickdb if it´s not already in it
 	if { $found == 0} {
 		if ![catch {open $nickdb a} output] {
@@ -56,7 +56,7 @@ proc watch_del {nick} {
 
 	# file where to save nicks
 	set nickdb "watch_nick.db"
-	
+
 	# open file and read nicks from it (omit nick that´s about to get deleted)
 	if ![catch {open $nickdb r} input] {
 		while {[gets $input line] >= 0} {
@@ -81,7 +81,7 @@ proc watch_chk {nick2watch} {
 
 	bind RAW - 401 watch_chk_nosuch
 	bind RAW - 311 watch_chk_info
-	putserv "WHOIS $nick2watch"	
+	putserv "WHOIS $nick2watch"
 }
 
 proc watch_chk_nosuch {var1 var2 var3} {
@@ -99,4 +99,3 @@ proc watch_chk_info {var1 var2 var3} {
 }
 
 bind pub - !watch watch_nick
-