changeset 56:aff22ba168b0

quotedb: Show command name in the short helps.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 08 Sep 2011 21:00:31 +0300
parents f7ccab2a5811
children 4a39a8707fdf
files quotedb.tcl
diffstat 1 files changed, 24 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- 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 <teksti>"
+    qdb_msg $upublic $unick $uchan "$ucmd add <teksti>"
     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 <id>"
+    qdb_msg $upublic $unick $uchan "$ucmd del <id>"
     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 <id> \[1 | -1\]"
+    qdb_msg $upublic $unick $uchan "$ucmd vote \[<id> \[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 <teksti>|del <id>|find <parametrit>|vote|top3"
+    qdb_msg $upublic $unick $uchan "$ucmd add <teksti>|del <id>|find <parametrit>|vote|top3"
   }
 }