summaryrefslogtreecommitdiff
path: root/src/helsinki.at/rhimportd/ctrlTelnet.go
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2015-12-31 09:56:21 (GMT)
committerChristian Pointner <equinox@helsinki.at>2015-12-31 09:56:21 (GMT)
commit016803268a21b5b341760875ea692c58d185dbda (patch)
tree9bda884d90644233cad969cd12d5fea372c97492 /src/helsinki.at/rhimportd/ctrlTelnet.go
parent0ef8fcb03fc4f51b8bc6b1a24f2e964b6a03d50c (diff)
improved coding style
Diffstat (limited to 'src/helsinki.at/rhimportd/ctrlTelnet.go')
-rw-r--r--src/helsinki.at/rhimportd/ctrlTelnet.go60
1 files changed, 30 insertions, 30 deletions
diff --git a/src/helsinki.at/rhimportd/ctrlTelnet.go b/src/helsinki.at/rhimportd/ctrlTelnet.go
index 4ea7c66..7373de3 100644
--- a/src/helsinki.at/rhimportd/ctrlTelnet.go
+++ b/src/helsinki.at/rhimportd/ctrlTelnet.go
@@ -33,11 +33,11 @@ import (
"strings"
)
-func telnet_quit(c *telgo.TelnetClient, args []string, conf *rhimport.Config, rddb *rhimport.RdDbChan) bool {
+func telnetQuit(c *telgo.TelnetClient, args []string, conf *rhimport.Config, rddb *rhimport.RdDbChan) bool {
return true
}
-func telnet_help(c *telgo.TelnetClient, args []string, conf *rhimport.Config, rddb *rhimport.RdDbChan) bool {
+func telnetHelp(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 telnet_help(c *telgo.TelnetClient, args []string, conf *rhimport.Config, rd
return false
}
-func telnet_set_int(c *telgo.TelnetClient, param *int, val string) {
+func telnetSetInt(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 telnet_set_int(c *telgo.TelnetClient, param *int, val string) {
}
}
-func telnet_set_uint(c *telgo.TelnetClient, param *uint, val string) {
+func telnetSetUint(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 telnet_set_uint(c *telgo.TelnetClient, param *uint, val string) {
}
}
-func telnet_set_bool(c *telgo.TelnetClient, param *bool, val string) {
+func telnetSetBool(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 telnet_set_bool(c *telgo.TelnetClient, param *bool, val string) {
}
}
-func telnet_set(c *telgo.TelnetClient, args []string, conf *rhimport.Config, rddb *rhimport.RdDbChan) bool {
+func telnetSet(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 telnet_set(c *telgo.TelnetClient, args []string, conf *rhimport.Config, rdd
case "sourceuri":
ctx.SourceUri = args[2]
case "showid":
- telnet_set_uint(c, &ctx.ShowId, args[2])
+ telnetSetUint(c, &ctx.ShowId, args[2])
case "clearshowcarts":
- telnet_set_bool(c, &ctx.ClearShowCarts, args[2])
+ telnetSetBool(c, &ctx.ClearShowCarts, args[2])
case "groupname":
ctx.GroupName = args[2]
case "cart":
- telnet_set_uint(c, &ctx.Cart, args[2])
+ telnetSetUint(c, &ctx.Cart, args[2])
case "clearcart":
- telnet_set_bool(c, &ctx.ClearCart, args[2])
+ telnetSetBool(c, &ctx.ClearCart, args[2])
case "cut":
- telnet_set_uint(c, &ctx.Cut, args[2])
+ telnetSetUint(c, &ctx.Cut, args[2])
case "channels":
- telnet_set_uint(c, &ctx.Channels, args[2])
+ telnetSetUint(c, &ctx.Channels, args[2])
case "normalizationlevel":
- telnet_set_int(c, &ctx.NormalizationLevel, args[2])
+ telnetSetInt(c, &ctx.NormalizationLevel, args[2])
case "autotrimlevel":
- telnet_set_int(c, &ctx.AutotrimLevel, args[2])
+ telnetSetInt(c, &ctx.AutotrimLevel, args[2])
case "usemetadata":
- telnet_set_bool(c, &ctx.UseMetaData, args[2])
+ telnetSetBool(c, &ctx.UseMetaData, args[2])
default:
c.Sayln("unknown parameter, use 'help set' for a list of available parameters")
}
return false
}
-func telnet_reset(c *telgo.TelnetClient, args []string, conf *rhimport.Config, rddb *rhimport.RdDbChan) bool {
+func telnetReset(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 telnet_reset(c *telgo.TelnetClient, args []string, conf *rhimport.Config, r
return false
}
-func telnet_show(c *telgo.TelnetClient, args []string, conf *rhimport.Config, rddb *rhimport.RdDbChan) bool {
+func telnetShow(c *telgo.TelnetClient, args []string, conf *rhimport.Config, rddb *rhimport.RdDbChan) bool {
if len(args) > 1 {
c.Sayln("too many arguments")
return false
@@ -229,13 +229,13 @@ func telnet_show(c *telgo.TelnetClient, args []string, conf *rhimport.Config, rd
return false
}
-func telnet_progress_callback(step int, step_name string, progress float64, userdata interface{}) bool {
+func telnetProgressCallback(step int, stepName string, progress float64, userdata interface{}) bool {
c := userdata.(*telgo.TelnetClient)
- c.Say("%s: %3.2f%%\r", step_name, progress*100)
+ c.Say("%s: %3.2f%%\r", stepName, progress*100)
return true
}
-func telnet_run(c *telgo.TelnetClient, args []string, conf *rhimport.Config, rddb *rhimport.RdDbChan) bool {
+func telnetRun(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
@@ -246,7 +246,7 @@ func telnet_run(c *telgo.TelnetClient, args []string, conf *rhimport.Config, rdd
return false
}
- ctx.ProgressCallBack = telnet_progress_callback
+ ctx.ProgressCallBack = telnetProgressCallback
ctx.ProgressCallBackData = c
ctx.Cancel = c.Cancel
@@ -275,17 +275,17 @@ func telnet_run(c *telgo.TelnetClient, args []string, conf *rhimport.Config, rdd
return false
}
-func StartControlTelnet(addr_s string, conf *rhimport.Config, rddb *rhimport.RdDbChan, sessions *rhimport.SessionStoreChan) {
+func StartControlTelnet(addr string, conf *rhimport.Config, rddb *rhimport.RdDbChan, sessions *rhimport.SessionStoreChan) {
cmdlist := make(telgo.TelgoCmdList)
- 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) }
+ cmdlist["quit"] = func(c *telgo.TelnetClient, args []string) bool { return telnetQuit(c, args, conf, rddb) }
+ cmdlist["help"] = func(c *telgo.TelnetClient, args []string) bool { return telnetHelp(c, args, conf, rddb) }
+ cmdlist["set"] = func(c *telgo.TelnetClient, args []string) bool { return telnetSet(c, args, conf, rddb) }
+ cmdlist["reset"] = func(c *telgo.TelnetClient, args []string) bool { return telnetReset(c, args, conf, rddb) }
+ cmdlist["show"] = func(c *telgo.TelnetClient, args []string) bool { return telnetShow(c, args, conf, rddb) }
+ cmdlist["run"] = func(c *telgo.TelnetClient, args []string) bool { return telnetRun(c, args, conf, rddb) }
- rhl.Println("telnet-ctrl: listening on", addr_s)
- s := telgo.NewTelnetServer(addr_s, "rhimportd> ", cmdlist, nil)
+ rhl.Println("telnet-ctrl: listening on", addr)
+ s := telgo.NewTelnetServer(addr, "rhimportd> ", cmdlist, nil)
if err := s.Run(); err != nil {
fmt.Printf("telnet server returned: %s", err)
}