Mercurial > hg > egg-tcls
comparison quotedb.tcl @ 674:57dd82ac2a06
quotedb: Rename some variables.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 23 Feb 2021 15:10:44 +0200 |
parents | f55dc6599308 |
children | 09be9264ee79 |
comparison
equal
deleted
inserted
replaced
673:afe4b1fe5e79 | 674:57dd82ac2a06 |
---|---|
437 return 1 | 437 return 1 |
438 } | 438 } |
439 | 439 |
440 | 440 |
441 #------------------------------------------------------------------------- | 441 #------------------------------------------------------------------------- |
442 proc qdb_cmd {ucmd utable unick uhost uhand uchan utext upublic} { | 442 proc qdb_cmd {ucmd utable unick uhost uhand uchan uargs upublic} { |
443 global qdb_channels | 443 global qdb_channels |
444 | 444 |
445 # Check if command comes from allowed channel or is private | 445 # Check if command comes from allowed channel or is private |
446 if {$upublic && ![utl_match_delim_list $qdb_channels $uchan]} { | 446 if {$upublic && ![utl_match_delim_list $qdb_channels $uchan]} { |
447 return 0 | 447 return 0 |
448 } | 448 } |
449 | 449 |
450 # Trim argument text | 450 # Trim argument text |
451 set utext [string trim $utext] | 451 set uargs [string trim $uargs] |
452 | 452 |
453 if {$utext == "" || $utext == {}} { | 453 if {$uargs == "" || $uargs == {}} { |
454 # No arguments, assume random query | 454 # No arguments, assume random query |
455 qdb_show $ucmd $utable $upublic $unick $uhost $uhand $uchan -1 | 455 qdb_show $ucmd $utable $upublic $unick $uhost $uhand $uchan -1 |
456 } elseif {[regexp {^(stat|stats|tilasto|tilastot)$} $utext]} { | 456 } elseif {[regexp {^(stat|stats|tilasto|tilastot)$} $uargs]} { |
457 # Statistics | 457 # Statistics |
458 qdb_stats $ucmd $utable $upublic $unick $uhost $uhand $uchan $utext | 458 qdb_stats $ucmd $utable $upublic $unick $uhost $uhand $uchan $uargs |
459 } elseif {[regexp {^(last|latest|uusin|viimeisin)$} $utext]} { | 459 } elseif {[regexp {^(last|latest|uusin|viimeisin)$} $uargs]} { |
460 # Latest added | 460 # Latest added |
461 qdb_show $ucmd $utable $upublic $unick $uhost $uhand $uchan -2 | 461 qdb_show $ucmd $utable $upublic $unick $uhost $uhand $uchan -2 |
462 } elseif {[regexp {^([0-9]+)$} $utext -> unum]} { | 462 } elseif {[regexp {^([0-9]+)$} $uargs -> unum]} { |
463 # Numeric argument, assume id query | 463 # Numeric argument, assume id query |
464 qdb_show $ucmd $utable $upublic $unick $uhost $uhand $uchan $unum | 464 qdb_show $ucmd $utable $upublic $unick $uhost $uhand $uchan $unum |
465 } elseif {[regexp {^top\s*([0-9]+)?$} $utext -> uargs]} { | 465 } elseif {[regexp {^top\s*([0-9]+)?$} $uargs -> rargs]} { |
466 # Toplist of quotes | 466 # Toplist of quotes |
467 qdb_toplist $ucmd $utable $upublic $unick $uhost $uhand $uchan $utext $uargs | 467 qdb_toplist $ucmd $utable $upublic $unick $uhost $uhand $uchan $uargs $rargs |
468 } elseif {[regexp {^add\s*(.*)$} $utext -> uargs]} { | 468 } elseif {[regexp {^add\s*(.*)$} $uargs -> rargs]} { |
469 # Add quote | 469 # Add quote |
470 qdb_add $ucmd $utable $upublic $unick $uhost $uhand $uchan $uargs | 470 qdb_add $ucmd $utable $upublic $unick $uhost $uhand $uchan $rargs |
471 } elseif {[regexp {^del\s*([0-9]*)$} $utext -> uargs]} { | 471 } elseif {[regexp {^del\s*([0-9]*)$} $uargs -> rargs]} { |
472 # Delete quote | 472 # Delete quote |
473 qdb_delete $ucmd $utable $upublic $unick $uhost $uhand $uchan $uargs | 473 qdb_delete $ucmd $utable $upublic $unick $uhost $uhand $uchan $rargs |
474 } elseif {[regexp {^update\s*(.*)$} $utext -> uargs]} { | 474 } elseif {[regexp {^update\s*(.*)$} $uargs -> rargs]} { |
475 # Modify/update quote | 475 # Modify/update quote |
476 qdb_update $ucmd $utable $upublic $unick $uhost $uhand $uchan $uargs | 476 qdb_update $ucmd $utable $upublic $unick $uhost $uhand $uchan $rargs |
477 } elseif {[regexp {^find\s*(.*)$} $utext -> uargs]} { | 477 } elseif {[regexp {^find\s*(.*)$} $uargs -> rargs]} { |
478 # Find quote(s) | 478 # Find quote(s) |
479 qdb_find $ucmd $utable $upublic $unick $uhost $uhand $uchan $uargs | 479 qdb_find $ucmd $utable $upublic $unick $uhost $uhand $uchan $rargs |
480 } elseif {[regexp {^vote\s*(.*)$} $utext -> uargs]} { | 480 } elseif {[regexp {^vote\s*(.*)$} $uargs -> rargs]} { |
481 # Vote | 481 # Vote |
482 qdb_vote $ucmd $utable $upublic $unick $uhost $uhand $uchan $uargs | 482 qdb_vote $ucmd $utable $upublic $unick $uhost $uhand $uchan $rargs |
483 } else { | 483 } else { |
484 # Help/usage | 484 # Help/usage |
485 qdb_msg $ucmd $utable $upublic $unick $uchan "help" | 485 qdb_msg $ucmd $utable $upublic $unick $uchan "help" |
486 } | 486 } |
487 } | 487 } |