summaryrefslogtreecommitdiff
path: root/src/helsinki.at/rhimportd
diff options
context:
space:
mode:
Diffstat (limited to 'src/helsinki.at/rhimportd')
-rw-r--r--src/helsinki.at/rhimportd/ctrlTelnet.go12
-rw-r--r--src/helsinki.at/rhimportd/ctrlWebSimple.go10
-rw-r--r--src/helsinki.at/rhimportd/ctrlWebSocket.go14
3 files changed, 18 insertions, 18 deletions
diff --git a/src/helsinki.at/rhimportd/ctrlTelnet.go b/src/helsinki.at/rhimportd/ctrlTelnet.go
index 5cc578e..3b703dd 100644
--- a/src/helsinki.at/rhimportd/ctrlTelnet.go
+++ b/src/helsinki.at/rhimportd/ctrlTelnet.go
@@ -151,13 +151,13 @@ func telnetSet(c *telgo.Client, args []string, conf *rhimport.Config, rddb *rhim
return false
}
- var ctx *rhimport.ImportContext
+ var ctx *rhimport.Context
if c.UserData == nil {
- c.UserData = rhimport.NewImportContext(conf, rddb, "")
- ctx = c.UserData.(*rhimport.ImportContext)
+ c.UserData = rhimport.NewContext(conf, rddb, "")
+ ctx = c.UserData.(*rhimport.Context)
ctx.Trusted = false
} else {
- ctx = c.UserData.(*rhimport.ImportContext)
+ ctx = c.UserData.(*rhimport.Context)
}
switch strings.ToLower(args[1]) {
case "username":
@@ -209,7 +209,7 @@ func telnetShow(c *telgo.Client, args []string, conf *rhimport.Config, rddb *rhi
}
if c.UserData != nil {
- ctx := c.UserData.(*rhimport.ImportContext)
+ ctx := c.UserData.(*rhimport.Context)
c.Sayln(" UserName: %q", ctx.UserName)
c.Sayln(" Password: %q", ctx.Password)
c.Sayln(" SourceUri: %q", ctx.SourceUri)
@@ -240,7 +240,7 @@ func telnetRun(c *telgo.Client, args []string, conf *rhimport.Config, rddb *rhim
c.Sayln("context is empty please set at least one option")
return false
}
- ctx := c.UserData.(*rhimport.ImportContext)
+ ctx := c.UserData.(*rhimport.Context)
if err := ctx.SanityCheck(); err != nil {
c.Sayln("sanity check for import context returned: %s", err)
return false
diff --git a/src/helsinki.at/rhimportd/ctrlWebSimple.go b/src/helsinki.at/rhimportd/ctrlWebSimple.go
index 8af421f..9a408ed 100644
--- a/src/helsinki.at/rhimportd/ctrlWebSimple.go
+++ b/src/helsinki.at/rhimportd/ctrlWebSimple.go
@@ -82,7 +82,7 @@ func webSimpleErrorResponse(w http.ResponseWriter, code int, errStr string) {
encoder.Encode(respdata)
}
-func webSimpleResponse(w http.ResponseWriter, result *rhimport.ImportResult) {
+func webSimpleResponse(w http.ResponseWriter, result *rhimport.Result) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusInternalServerError)
encoder := json.NewEncoder(w)
@@ -90,7 +90,7 @@ func webSimpleResponse(w http.ResponseWriter, result *rhimport.ImportResult) {
encoder.Encode(respdata)
}
-func webSimpleParseRequest(conf *rhimport.Config, rddb *rhimport.RdDbChan, trusted bool, r *http.Request) (ctx *rhimport.ImportContext, err error) {
+func webSimpleParseRequest(conf *rhimport.Config, rddb *rhimport.RdDbChan, trusted bool, r *http.Request) (ctx *rhimport.Context, err error) {
decoder := json.NewDecoder(r.Body)
reqdata := newWebSimpleRequestData(conf)
@@ -103,7 +103,7 @@ func webSimpleParseRequest(conf *rhimport.Config, rddb *rhimport.RdDbChan, trust
if trusted {
username = r.Header.Get("X-Forwarded-User")
}
- ctx = rhimport.NewImportContext(conf, rddb, username)
+ ctx = rhimport.NewContext(conf, rddb, username)
ctx.Password = reqdata.Password
ctx.Trusted = trusted
ctx.ShowId = reqdata.ShowId
@@ -123,7 +123,7 @@ func webSimpleParseRequest(conf *rhimport.Config, rddb *rhimport.RdDbChan, trust
func webSimpleHandler(conf *rhimport.Config, rddb *rhimport.RdDbChan, sessions *rhimport.SessionStoreChan, trusted bool, w http.ResponseWriter, r *http.Request) {
rhdl.Printf("WebSimpleHandler: request for '%s'", html.EscapeString(r.URL.Path))
- var ctx *rhimport.ImportContext
+ var ctx *rhimport.Context
var err error
if ctx, err = webSimpleParseRequest(conf, rddb, trusted, r); err != nil {
webSimpleErrorResponse(w, http.StatusBadRequest, err.Error())
@@ -135,7 +135,7 @@ func webSimpleHandler(conf *rhimport.Config, rddb *rhimport.RdDbChan, sessions *
return
}
- var res *rhimport.ImportResult
+ var res *rhimport.Result
if res, err = rhimport.FetchFile(ctx); err != nil {
webSimpleErrorResponse(w, http.StatusInternalServerError, err.Error())
return
diff --git a/src/helsinki.at/rhimportd/ctrlWebSocket.go b/src/helsinki.at/rhimportd/ctrlWebSocket.go
index 7f4ae0d..2345db7 100644
--- a/src/helsinki.at/rhimportd/ctrlWebSocket.go
+++ b/src/helsinki.at/rhimportd/ctrlWebSocket.go
@@ -164,13 +164,13 @@ type webSocketSession struct {
refId string
session *rhimport.SessionChan
progresschan chan rhimport.ProgressData
- donechan chan rhimport.ImportResult
+ donechan chan rhimport.Result
}
func newWebSocketSession() *webSocketSession {
session := &webSocketSession{}
session.progresschan = make(chan rhimport.ProgressData, 10)
- session.donechan = make(chan rhimport.ImportResult, 1)
+ session.donechan = make(chan rhimport.Result, 1)
return session
}
@@ -186,14 +186,14 @@ func webSocketProgress(step int, stepName string, progress float64, userdata int
return true
}
-func webSocketDone(res rhimport.ImportResult, userdata interface{}) bool {
- c := userdata.(chan<- rhimport.ImportResult)
+func webSocketDone(res rhimport.Result, userdata interface{}) bool {
+ c := userdata.(chan<- rhimport.Result)
c <- res
return true
}
func (self *webSocketSession) startNewSession(reqdata *webSocketRequestData, conf *rhimport.Config, sessions *rhimport.SessionStoreChan) (int, string) {
- ctx := rhimport.NewImportContext(conf, nil, reqdata.UserName)
+ ctx := rhimport.NewContext(conf, nil, reqdata.UserName)
ctx.Password = reqdata.Password
ctx.Trusted = false
ctx.ShowId = reqdata.ShowId
@@ -215,7 +215,7 @@ func (self *webSocketSession) startNewSession(reqdata *webSocketRequestData, con
self.id = id
self.refId = reqdata.RefId
self.session = s
- if err := s.AddDoneHandler((chan<- rhimport.ImportResult)(self.donechan), webSocketDone); err != nil {
+ if err := s.AddDoneHandler((chan<- rhimport.Result)(self.donechan), webSocketDone); err != nil {
return http.StatusInternalServerError, err.Error()
}
if err := s.AddProgressHandler((chan<- rhimport.ProgressData)(self.progresschan), webSocketProgress); err != nil {
@@ -233,7 +233,7 @@ func (self *webSocketSession) reconnectSession(reqdata *webSocketRequestData, se
self.id = reqdata.Id
self.refId = refId
self.session = s
- if err := s.AddDoneHandler((chan<- rhimport.ImportResult)(self.donechan), webSocketDone); err != nil {
+ if err := s.AddDoneHandler((chan<- rhimport.Result)(self.donechan), webSocketDone); err != nil {
return http.StatusInternalServerError, err.Error()
}
if err := s.AddProgressHandler((chan<- rhimport.ProgressData)(self.progresschan), webSocketProgress); err != nil {