summaryrefslogtreecommitdiff
path: root/src/rhimportd/ctrlTelnet.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/rhimportd/ctrlTelnet.go')
-rw-r--r--src/rhimportd/ctrlTelnet.go29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/rhimportd/ctrlTelnet.go b/src/rhimportd/ctrlTelnet.go
index 5d0aebe..974627d 100644
--- a/src/rhimportd/ctrlTelnet.go
+++ b/src/rhimportd/ctrlTelnet.go
@@ -28,16 +28,17 @@ import (
"fmt"
"github.com/spreadspace/telgo"
"helsinki.at/rhimport"
+ "helsinki.at/rhrd-go/rddb"
"net/http"
"strconv"
"strings"
)
-func telnetQuit(c *telgo.Client, args []string, conf *rhimport.Config, rddb *rhimport.RdDbChan) bool {
+func telnetQuit(c *telgo.Client, args []string, conf *rhimport.Config, db *rddb.DBChan) bool {
return true
}
-func telnetHelp(c *telgo.Client, args []string, conf *rhimport.Config, rddb *rhimport.RdDbChan) bool {
+func telnetHelp(c *telgo.Client, args []string, conf *rhimport.Config, db *rddb.DBChan) bool {
switch len(args) {
case 2:
switch args[1] {
@@ -145,7 +146,7 @@ func telnetSetBool(c *telgo.Client, param *bool, val string) {
}
}
-func telnetSet(c *telgo.Client, args []string, conf *rhimport.Config, rddb *rhimport.RdDbChan) bool {
+func telnetSet(c *telgo.Client, args []string, conf *rhimport.Config, db *rddb.DBChan) bool {
if len(args) != 3 {
c.Sayln("wrong number of arguments")
return false
@@ -153,7 +154,7 @@ func telnetSet(c *telgo.Client, args []string, conf *rhimport.Config, rddb *rhim
var ctx *rhimport.Context
if c.UserData == nil {
- c.UserData = rhimport.NewContext(conf, rddb)
+ c.UserData = rhimport.NewContext(conf, db)
ctx = c.UserData.(*rhimport.Context)
ctx.Trusted = false
} else {
@@ -192,7 +193,7 @@ func telnetSet(c *telgo.Client, args []string, conf *rhimport.Config, rddb *rhim
return false
}
-func telnetReset(c *telgo.Client, args []string, conf *rhimport.Config, rddb *rhimport.RdDbChan) bool {
+func telnetReset(c *telgo.Client, args []string, conf *rhimport.Config, db *rddb.DBChan) bool {
if len(args) > 1 {
c.Sayln("too many arguments")
return false
@@ -202,7 +203,7 @@ func telnetReset(c *telgo.Client, args []string, conf *rhimport.Config, rddb *rh
return false
}
-func telnetShow(c *telgo.Client, args []string, conf *rhimport.Config, rddb *rhimport.RdDbChan) bool {
+func telnetShow(c *telgo.Client, args []string, conf *rhimport.Config, db *rddb.DBChan) bool {
if len(args) > 1 {
c.Sayln("too many arguments")
return false
@@ -235,7 +236,7 @@ func telnetProgressCallback(step int, stepName string, progress float64, userdat
return true
}
-func telnetRun(c *telgo.Client, args []string, conf *rhimport.Config, rddb *rhimport.RdDbChan) bool {
+func telnetRun(c *telgo.Client, args []string, conf *rhimport.Config, db *rddb.DBChan) bool {
if c.UserData == nil {
c.Sayln("context is empty please set at least one option")
return false
@@ -275,14 +276,14 @@ func telnetRun(c *telgo.Client, args []string, conf *rhimport.Config, rddb *rhim
return false
}
-func StartControlTelnet(addr string, conf *rhimport.Config, rddb *rhimport.RdDbChan, sessions *rhimport.SessionStoreChan) {
+func StartControlTelnet(addr string, conf *rhimport.Config, db *rddb.DBChan, sessions *rhimport.SessionStoreChan) {
cmdlist := make(telgo.CmdList)
- cmdlist["quit"] = func(c *telgo.Client, args []string) bool { return telnetQuit(c, args, conf, rddb) }
- cmdlist["help"] = func(c *telgo.Client, args []string) bool { return telnetHelp(c, args, conf, rddb) }
- cmdlist["set"] = func(c *telgo.Client, args []string) bool { return telnetSet(c, args, conf, rddb) }
- cmdlist["reset"] = func(c *telgo.Client, args []string) bool { return telnetReset(c, args, conf, rddb) }
- cmdlist["show"] = func(c *telgo.Client, args []string) bool { return telnetShow(c, args, conf, rddb) }
- cmdlist["run"] = func(c *telgo.Client, args []string) bool { return telnetRun(c, args, conf, rddb) }
+ cmdlist["quit"] = func(c *telgo.Client, args []string) bool { return telnetQuit(c, args, conf, db) }
+ cmdlist["help"] = func(c *telgo.Client, args []string) bool { return telnetHelp(c, args, conf, db) }
+ cmdlist["set"] = func(c *telgo.Client, args []string) bool { return telnetSet(c, args, conf, db) }
+ cmdlist["reset"] = func(c *telgo.Client, args []string) bool { return telnetReset(c, args, conf, db) }
+ cmdlist["show"] = func(c *telgo.Client, args []string) bool { return telnetShow(c, args, conf, db) }
+ cmdlist["run"] = func(c *telgo.Client, args []string) bool { return telnetRun(c, args, conf, db) }
rhl.Println("telnet-ctrl: listening on", addr)
s := telgo.NewServer(addr, "rhimportd> ", cmdlist, nil)