summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/helsinki.at/rhimportd/ctrlTelnet.go48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/helsinki.at/rhimportd/ctrlTelnet.go b/src/helsinki.at/rhimportd/ctrlTelnet.go
index f578f54..45579e2 100644
--- a/src/helsinki.at/rhimportd/ctrlTelnet.go
+++ b/src/helsinki.at/rhimportd/ctrlTelnet.go
@@ -33,11 +33,11 @@ import (
"strings"
)
-func handle_cmd_quit(c *telgo.TelnetClient, args []string, conf *rhimport.Config, rddb *rhimport.RdDbChan) bool {
+func telnet_quit(c *telgo.TelnetClient, args []string, conf *rhimport.Config, rddb *rhimport.RdDbChan) bool {
return true
}
-func handle_cmd_help(c *telgo.TelnetClient, args []string, conf *rhimport.Config, rddb *rhimport.RdDbChan) bool {
+func telnet_help(c *telgo.TelnetClient, args []string, conf *rhimport.Config, rddb *rhimport.RdDbChan) bool {
switch len(args) {
case 2:
switch args[1] {
@@ -121,7 +121,7 @@ func handle_cmd_help(c *telgo.TelnetClient, args []string, conf *rhimport.Config
return false
}
-func handle_cmd_set_int(c *telgo.TelnetClient, param *int, val string) {
+func telnet_set_int(c *telgo.TelnetClient, param *int, val string) {
if vint, err := strconv.ParseInt(val, 10, 32); err != nil {
c.Sayln("invalid value (must be an integer)")
} else {
@@ -129,7 +129,7 @@ func handle_cmd_set_int(c *telgo.TelnetClient, param *int, val string) {
}
}
-func handle_cmd_set_uint(c *telgo.TelnetClient, param *uint, val string) {
+func telnet_set_uint(c *telgo.TelnetClient, param *uint, val string) {
if vuint, err := strconv.ParseUint(val, 10, 32); err != nil {
c.Sayln("invalid value (must be a positive integer)")
} else {
@@ -137,7 +137,7 @@ func handle_cmd_set_uint(c *telgo.TelnetClient, param *uint, val string) {
}
}
-func handle_cmd_set_bool(c *telgo.TelnetClient, param *bool, val string) {
+func telnet_set_bool(c *telgo.TelnetClient, param *bool, val string) {
if vbool, err := strconv.ParseBool(val); err != nil {
c.Sayln("invalid value (must be true or false)")
} else {
@@ -145,7 +145,7 @@ func handle_cmd_set_bool(c *telgo.TelnetClient, param *bool, val string) {
}
}
-func handle_cmd_set(c *telgo.TelnetClient, args []string, conf *rhimport.Config, rddb *rhimport.RdDbChan) bool {
+func telnet_set(c *telgo.TelnetClient, args []string, conf *rhimport.Config, rddb *rhimport.RdDbChan) bool {
if len(args) != 3 {
c.Sayln("wrong number of arguments")
return false
@@ -167,32 +167,32 @@ func handle_cmd_set(c *telgo.TelnetClient, args []string, conf *rhimport.Config,
case "sourceuri":
ctx.SourceUri = args[2]
case "showid":
- handle_cmd_set_uint(c, &ctx.ShowId, args[2])
+ telnet_set_uint(c, &ctx.ShowId, args[2])
case "clearshowcarts":
- handle_cmd_set_bool(c, &ctx.ClearShowCarts, args[2])
+ telnet_set_bool(c, &ctx.ClearShowCarts, args[2])
case "groupname":
ctx.GroupName = args[2]
case "cart":
- handle_cmd_set_uint(c, &ctx.Cart, args[2])
+ telnet_set_uint(c, &ctx.Cart, args[2])
case "clearcart":
- handle_cmd_set_bool(c, &ctx.ClearCart, args[2])
+ telnet_set_bool(c, &ctx.ClearCart, args[2])
case "cut":
- handle_cmd_set_uint(c, &ctx.Cut, args[2])
+ telnet_set_uint(c, &ctx.Cut, args[2])
case "channels":
- handle_cmd_set_uint(c, &ctx.Channels, args[2])
+ telnet_set_uint(c, &ctx.Channels, args[2])
case "normalizationlevel":
- handle_cmd_set_int(c, &ctx.NormalizationLevel, args[2])
+ telnet_set_int(c, &ctx.NormalizationLevel, args[2])
case "autotrimlevel":
- handle_cmd_set_int(c, &ctx.AutotrimLevel, args[2])
+ telnet_set_int(c, &ctx.AutotrimLevel, args[2])
case "usemetadata":
- handle_cmd_set_bool(c, &ctx.UseMetaData, args[2])
+ telnet_set_bool(c, &ctx.UseMetaData, args[2])
default:
c.Sayln("unknown parameter, use 'help set' for a list of available parameters")
}
return false
}
-func handle_cmd_reset(c *telgo.TelnetClient, args []string, conf *rhimport.Config, rddb *rhimport.RdDbChan) bool {
+func telnet_reset(c *telgo.TelnetClient, args []string, conf *rhimport.Config, rddb *rhimport.RdDbChan) bool {
if len(args) > 1 {
c.Sayln("too many arguments")
return false
@@ -202,7 +202,7 @@ func handle_cmd_reset(c *telgo.TelnetClient, args []string, conf *rhimport.Confi
return false
}
-func handle_cmd_show(c *telgo.TelnetClient, args []string, conf *rhimport.Config, rddb *rhimport.RdDbChan) bool {
+func telnet_show(c *telgo.TelnetClient, args []string, conf *rhimport.Config, rddb *rhimport.RdDbChan) bool {
if len(args) > 1 {
c.Sayln("too many arguments")
return false
@@ -235,7 +235,7 @@ func telnet_progress_callback(step int, step_name string, progress float64, user
return true
}
-func handle_cmd_run(c *telgo.TelnetClient, args []string, conf *rhimport.Config, rddb *rhimport.RdDbChan) bool {
+func telnet_run(c *telgo.TelnetClient, args []string, conf *rhimport.Config, rddb *rhimport.RdDbChan) bool {
if c.UserData == nil {
c.Sayln("context is empty please set at least one option")
return false
@@ -277,12 +277,12 @@ func handle_cmd_run(c *telgo.TelnetClient, args []string, conf *rhimport.Config,
func StartControlTelnet(addr_s string, conf *rhimport.Config, rddb *rhimport.RdDbChan) {
cmdlist := make(telgo.TelgoCmdList)
- cmdlist["quit"] = func(c *telgo.TelnetClient, args []string) bool { return handle_cmd_quit(c, args, conf, rddb) }
- cmdlist["help"] = func(c *telgo.TelnetClient, args []string) bool { return handle_cmd_help(c, args, conf, rddb) }
- cmdlist["set"] = func(c *telgo.TelnetClient, args []string) bool { return handle_cmd_set(c, args, conf, rddb) }
- cmdlist["reset"] = func(c *telgo.TelnetClient, args []string) bool { return handle_cmd_reset(c, args, conf, rddb) }
- cmdlist["show"] = func(c *telgo.TelnetClient, args []string) bool { return handle_cmd_show(c, args, conf, rddb) }
- cmdlist["run"] = func(c *telgo.TelnetClient, args []string) bool { return handle_cmd_run(c, args, conf, rddb) }
+ cmdlist["quit"] = func(c *telgo.TelnetClient, args []string) bool { return telnet_quit(c, args, conf, rddb) }
+ cmdlist["help"] = func(c *telgo.TelnetClient, args []string) bool { return telnet_help(c, args, conf, rddb) }
+ cmdlist["set"] = func(c *telgo.TelnetClient, args []string) bool { return telnet_set(c, args, conf, rddb) }
+ cmdlist["reset"] = func(c *telgo.TelnetClient, args []string) bool { return telnet_reset(c, args, conf, rddb) }
+ cmdlist["show"] = func(c *telgo.TelnetClient, args []string) bool { return telnet_show(c, args, conf, rddb) }
+ cmdlist["run"] = func(c *telgo.TelnetClient, args []string) bool { return telnet_run(c, args, conf, rddb) }
rhl.Println("telnet-ctrl: listening on", addr_s)
s := telgo.NewTelnetServer(addr_s, "rhimportd> ", cmdlist, nil)