# HG changeset patch # User Matti Hamalainen # Date 1315504831 -10800 # Node ID aff22ba168b068a2520bee54cf7f4f902eaad52a # Parent f7ccab2a5811d9b415749b4b3821211c35216219 quotedb: Show command name in the short helps. diff -r f7ccab2a5811 -r aff22ba168b0 quotedb.tcl --- a/quotedb.tcl Thu Sep 08 17:49:50 2011 +0300 +++ b/quotedb.tcl Thu Sep 08 21:00:31 2011 +0300 @@ -53,18 +53,18 @@ ### Binding initializations bind pub - !spede spede_pub_cmd bind msg - spede spede_msg_cmd -proc spede_pub_cmd {unick uhost uhand uchan utext} { qdb_command "spededb" $unick $uhost $uhand $uchan $utext 1 } -proc spede_msg_cmd {unick uhost uhand utext} { qdb_command "spededb" $unick $uhost $uhand "" $utext 0 } +proc spede_pub_cmd {unick uhost uhand uchan utext} { qdb_command "!spede" "spededb" $unick $uhost $uhand $uchan $utext 1 } +proc spede_msg_cmd {unick uhost uhand utext} { qdb_command "spede" "spededb" $unick $uhost $uhand "" $utext 0 } bind pub - !mn mn_pub_cmd bind msg - mn mn_msg_cmd -proc mn_pub_cmd {unick uhost uhand uchan utext} { qdb_command "mndb" $unick $uhost $uhand $uchan $utext 1 } -proc mn_msg_cmd {unick uhost uhand utext} { qdb_command "mndb" $unick $uhost $uhand "" $utext 0 } +proc mn_pub_cmd {unick uhost uhand uchan utext} { qdb_command "!mn" "mndb" $unick $uhost $uhand $uchan $utext 1 } +proc mn_msg_cmd {unick uhost uhand utext} { qdb_command "mn" "mndb" $unick $uhost $uhand "" $utext 0 } bind pub - !tuksu tuksu_pub_cmd bind msg - tuksu tuksu_msg_cmd -proc tuksu_pub_cmd {unick uhost uhand uchan utext} { qdb_command "tuksudb" $unick $uhost $uhand $uchan $utext 1 } -proc tuksu_msg_cmd {unick uhost uhand utext} { qdb_command "tuksudb" $unick $uhost $uhand "" $utext 0 } +proc tuksu_pub_cmd {unick uhost uhand uchan utext} { qdb_command "!tuksu" "tuksudb" $unick $uhost $uhand $uchan $utext 1 } +proc tuksu_msg_cmd {unick uhost uhand utext} { qdb_command "tuksu" "tuksudb" $unick $uhost $uhand "" $utext 0 } @@ -153,7 +153,7 @@ #------------------------------------------------------------------------- -proc qdb_add {utable unick uhost uhand uchan utext upublic} { +proc qdb_add {ucmd utable unick uhost uhand uchan utext upublic} { global quotedb if {$uhand == "" || $uhand == {}} { @@ -162,7 +162,7 @@ } if {$utext == "" || $utext == {}} { - qdb_msg $upublic $unick $uchan "wtf! add " + qdb_msg $upublic $unick $uchan "$ucmd add " return 0 } @@ -185,7 +185,7 @@ #------------------------------------------------------------------------- -proc qdb_delete {utable unick uhand uchan utext upublic} { +proc qdb_delete {ucmd utable unick uhand uchan utext upublic} { global quotedb qdb_max_deltime set maxdiff [expr $qdb_max_deltime * 60] @@ -195,7 +195,7 @@ } if {![regexp {^\s*([0-9]+)$} $utext umatch unum]} { - qdb_msg $upublic $unick $uchan "del " + qdb_msg $upublic $unick $uchan "$ucmd del " return 0 } @@ -226,7 +226,7 @@ #------------------------------------------------------------------------- -proc qdb_toplist {utable unick uchan unum upublic} { +proc qdb_toplist {ucmd utable unick uchan unum upublic} { global quotedb if {$unum < 2 || $unum > 4} { @@ -247,7 +247,7 @@ #------------------------------------------------------------------------- -proc qdb_vote {utable unick uhand uchan utext upublic} { +proc qdb_vote {ucmd utable unick uhand uchan utext upublic} { global quotedb if {$uhand == "" || $uhand == {}} { @@ -262,7 +262,7 @@ quotedb eval $usql { set uid $qid } } elseif {[regexp {^\s*([0-9]+)$} $utext umatch uid]} { } elseif {![regexp {^\s*([0-9]+)\s+(-1|1)$} $utext umatch uid uvote]} { - qdb_msg $upublic $unick $uchan "vote \[1 | -1\]" + qdb_msg $upublic $unick $uchan "$ucmd vote \[ \[1|-1\]\]" return 0 } @@ -303,7 +303,7 @@ #------------------------------------------------------------------------- -proc qdb_get {utable unick uchan uindex upublic} { +proc qdb_get {ucmd utable unick uchan uindex upublic} { global quotedb set usql "SELECT total(${utable}_votes.vote) AS uvote, ${utable}.id AS quoteID, ${utable}.utext AS utext, ${utable}.user AS uuser FROM ${utable} LEFT JOIN ${utable}_votes ON ${utable}_votes.urlid = ${utable}.id" @@ -331,7 +331,7 @@ #------------------------------------------------------------------------- -proc qdb_find {utable unick uhand uchan utext upublic} { +proc qdb_find {ucmd utable unick uhand uchan utext upublic} { global quotedb qdb_showmax_pub qdb_showmax_priv if {$upublic == 0} { @@ -382,32 +382,32 @@ #------------------------------------------------------------------------- -proc qdb_command {utable unick uhost uhand uchan utext upublic} { +proc qdb_command {ucmd utable unick uhost uhand uchan utext upublic} { set utext [string trim $utext] if {$utext == "" || $utext == {}} { # No arguments, assume random query - qdb_get $utable $unick $uchan -1 $upublic + qdb_get $ucmd $utable $unick $uchan -1 $upublic } elseif {[regexp {^([0-9]+)$} $utext umatch unum]} { # Numeric argument, assume index query - qdb_get $utable $unick $uchan $unum $upublic + qdb_get $ucmd $utable $unick $uchan $unum $upublic } elseif {[regexp {^top\s*([0-9]+)$} $utext umatch unum]} { # Toplist of quotes - qdb_toplist $utable $unick $uchan $unum $upublic + qdb_toplist $ucmd $utable $unick $uchan $unum $upublic } elseif {[regexp {^add\s*(.*)$} $utext umatch unum]} { # Add quote - qdb_add $utable $unick $uhost $uhand $uchan $unum $upublic + qdb_add $ucmd $utable $unick $uhost $uhand $uchan $unum $upublic } elseif {[regexp {^del\s*([0-9]*)$} $utext umatch unum]} { # Delete quote - qdb_delete $utable $unick $uhand $uchan $unum $upublic + qdb_delete $ucmd $utable $unick $uhand $uchan $unum $upublic } elseif {[regexp {^find\s*(.*)$} $utext umatch unum]} { # Find quote(s) - qdb_find $utable $unick $uhand $uchan $unum $upublic + qdb_find $ucmd $utable $unick $uhand $uchan $unum $upublic } elseif {[regexp {^vote\s*(.*)$} $utext umatch unum]} { # Vote - qdb_vote $utable $unick $uhand $uchan $unum $upublic + qdb_vote $ucmd $utable $unick $uhand $uchan $unum $upublic } else { - qdb_msg $upublic $unick $uchan "add |del |find |vote|top3" + qdb_msg $upublic $unick $uchan "$ucmd add |del |find |vote|top3" } }