From 4e24d1dd7bd9d89f946ec56cb4350ce777d17bfe Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sat, 1 Sep 2018 23:34:57 +0300 Subject: [PATCH] Format and remove unnecessary things --- generator.go | 8 +++++--- http.go | 5 ++--- protocol.go | 2 +- registration.go | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/generator.go b/generator.go index 6a40b3b..e78889e 100644 --- a/generator.go +++ b/generator.go @@ -44,14 +44,16 @@ func GenerateRegistration(asName, botName string, reserveRooms, reserveUsers boo boldCyan.Println("Generating appservice config and registration.") reader := bufio.NewReader(os.Stdin) + registration := CreateRegistration() + config := Create() + registration.RateLimited = false + name, err := readString(reader, "Enter name for appservice", asName) if err != nil { fmt.Println("Failed to read user Input:", err) return } - registration := CreateRegistration(name) - config := Create() - registration.RateLimited = false + registration.ID = name registration.SenderLocalpart, err = readString(reader, "Enter bot username", botName) if err != nil { diff --git a/http.go b/http.go index 6e88f3f..3a0757d 100644 --- a/http.go +++ b/http.go @@ -1,11 +1,11 @@ package appservice import ( + "context" "encoding/json" + "github.com/gorilla/mux" "io/ioutil" "net/http" - "github.com/gorilla/mux" - "context" "time" ) @@ -106,7 +106,6 @@ func (as *AppService) PutTransaction(w http.ResponseWriter, r *http.Request) { } for _, event := range eventList.Events { - as.Log.Debugln("Received event", event.ID) as.UpdateState(event) as.Events <- event } diff --git a/protocol.go b/protocol.go index 2b422c9..0523ba5 100644 --- a/protocol.go +++ b/protocol.go @@ -2,8 +2,8 @@ package appservice import ( "encoding/json" - "net/http" "maunium.net/go/gomatrix" + "net/http" ) // EventList contains a list of events. diff --git a/registration.go b/registration.go index 85d9c41..b632db0 100644 --- a/registration.go +++ b/registration.go @@ -21,7 +21,7 @@ type Registration struct { } // CreateRegistration creates a Registration with random appservice and homeserver tokens. -func CreateRegistration(name string) *Registration { +func CreateRegistration() *Registration { return &Registration{ AppToken: RandomString(64), ServerToken: RandomString(64),