From 19eec2ed032f5f60086da1b318046113943575e3 Mon Sep 17 00:00:00 2001 From: Wim Date: Tue, 21 Apr 2020 19:55:47 +0200 Subject: Update Rhymen/go-whatsapp. Fixes #1107 (#1109) --- go.mod | 2 +- go.sum | 4 ++-- vendor/github.com/Rhymen/go-whatsapp/conn.go | 3 +++ vendor/github.com/Rhymen/go-whatsapp/session.go | 10 +++++----- vendor/modules.txt | 2 +- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index dc165f50..c2433d09 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ require ( github.com/Baozisoftware/qrcode-terminal-go v0.0.0-20170407111555-c0650d8dff0f github.com/Jeffail/gabs v1.1.1 // indirect github.com/Philipp15b/go-steam v1.0.1-0.20190816133340-b04c5a83c1c0 - github.com/Rhymen/go-whatsapp v0.1.1-0.20200408093540-2f227c53b44f + github.com/Rhymen/go-whatsapp v0.1.1-0.20200421062035-31e8111ac334 github.com/d5/tengo/v2 v2.1.2 github.com/dfordsoft/golib v0.0.0-20180902042739-76ee6ab99bec github.com/fsnotify/fsnotify v1.4.7 diff --git a/go.sum b/go.sum index 56543ae2..b983d8c1 100644 --- a/go.sum +++ b/go.sum @@ -12,8 +12,8 @@ github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAE github.com/Philipp15b/go-steam v1.0.1-0.20190816133340-b04c5a83c1c0 h1:TO7d4rocnNFng6ZQrPe7U6WqHtK5eHEMrgrnnM/72IQ= github.com/Philipp15b/go-steam v1.0.1-0.20190816133340-b04c5a83c1c0/go.mod h1:HuVM+sZFzumUdKPWiz+IlCMb4RdsKdT3T+nQBKL+sYg= github.com/Rhymen/go-whatsapp v0.0.0/go.mod h1:rdQr95g2C1xcOfM7QGOhza58HeI3I+tZ/bbluv7VazA= -github.com/Rhymen/go-whatsapp v0.1.1-0.20200408093540-2f227c53b44f h1:uclEol7RbpElhXXmwu38PDeGcgMXNU2vh5DWwzlg7xI= -github.com/Rhymen/go-whatsapp v0.1.1-0.20200408093540-2f227c53b44f/go.mod h1:o7jjkvKnigfu432dMbQ/w4PH0Yp5u4Y6ysCNjUlcYCk= +github.com/Rhymen/go-whatsapp v0.1.1-0.20200421062035-31e8111ac334 h1:kb1zvD+xd+XbPUdQ0lMxnRaQ76N5C9vMAClLi8Dyw1Y= +github.com/Rhymen/go-whatsapp v0.1.1-0.20200421062035-31e8111ac334/go.mod h1:o7jjkvKnigfu432dMbQ/w4PH0Yp5u4Y6ysCNjUlcYCk= github.com/Rhymen/go-whatsapp/examples/echo v0.0.0-20190325075644-cc2581bbf24d/go.mod h1:zgCiQtBtZ4P4gFWvwl9aashsdwOcbb/EHOGRmSzM8ME= github.com/Rhymen/go-whatsapp/examples/restoreSession v0.0.0-20190325075644-cc2581bbf24d/go.mod h1:5sCUSpG616ZoSJhlt9iBNI/KXBqrVLcNUJqg7J9+8pU= github.com/Rhymen/go-whatsapp/examples/sendImage v0.0.0-20190325075644-cc2581bbf24d/go.mod h1:RdiyhanVEGXTam+mZ3k6Y3VDCCvXYCwReOoxGozqhHw= diff --git a/vendor/github.com/Rhymen/go-whatsapp/conn.go b/vendor/github.com/Rhymen/go-whatsapp/conn.go index 26df39da..f8b57443 100644 --- a/vendor/github.com/Rhymen/go-whatsapp/conn.go +++ b/vendor/github.com/Rhymen/go-whatsapp/conn.go @@ -90,6 +90,7 @@ type Conn struct { longClientName string shortClientName string + clientVersion string loginSessionLock sync.RWMutex Proxy func(*http.Request) (*url.URL, error) @@ -121,6 +122,7 @@ func NewConn(timeout time.Duration) (*Conn, error) { longClientName: "github.com/rhymen/go-whatsapp", shortClientName: "go-whatsapp", + clientVersion: "0.1.0", } return wac, wac.connect() } @@ -135,6 +137,7 @@ func NewConnWithProxy(timeout time.Duration, proxy func(*http.Request) (*url.URL longClientName: "github.com/rhymen/go-whatsapp", shortClientName: "go-whatsapp", + clientVersion: "0.1.0", Proxy: proxy, } return wac, wac.connect() diff --git a/vendor/github.com/Rhymen/go-whatsapp/session.go b/vendor/github.com/Rhymen/go-whatsapp/session.go index b4690d21..f026df7d 100644 --- a/vendor/github.com/Rhymen/go-whatsapp/session.go +++ b/vendor/github.com/Rhymen/go-whatsapp/session.go @@ -107,7 +107,7 @@ func CheckCurrentServerVersion() ([]int, error) { } b64ClientId := base64.StdEncoding.EncodeToString(clientId) - login := []interface{}{"admin", "init", waVersion, []string{wac.longClientName, wac.shortClientName}, b64ClientId, true} + login := []interface{}{"admin", "init", waVersion, []string{wac.longClientName, wac.shortClientName, wac.clientVersion}, b64ClientId, true} loginChan, err := wac.writeJson(login) if err != nil { return nil, fmt.Errorf("error writing login: %s", err.Error()) @@ -141,11 +141,11 @@ func CheckCurrentServerVersion() ([]int, error) { SetClientName sets the long and short client names that are sent to WhatsApp when logging in and displayed in the WhatsApp Web device list. As the values are only sent when logging in, changing them after logging in is not possible. */ -func (wac *Conn) SetClientName(long, short string) error { +func (wac *Conn) SetClientName(long, short, version string) error { if wac.session != nil && (wac.session.EncKey != nil || wac.session.MacKey != nil) { return fmt.Errorf("cannot change client name after logging in") } - wac.longClientName, wac.shortClientName = long, short + wac.longClientName, wac.shortClientName, wac.clientVersion = long, short, version return nil } @@ -213,7 +213,7 @@ func (wac *Conn) Login(qrChan chan<- string) (Session, error) { } session.ClientId = base64.StdEncoding.EncodeToString(clientId) - login := []interface{}{"admin", "init", waVersion, []string{wac.longClientName, wac.shortClientName}, session.ClientId, true} + login := []interface{}{"admin", "init", waVersion, []string{wac.longClientName, wac.shortClientName, wac.clientVersion}, session.ClientId, true} loginChan, err := wac.writeJson(login) if err != nil { return session, fmt.Errorf("error writing login: %v\n", err) @@ -369,7 +369,7 @@ func (wac *Conn) Restore() error { wac.listener.Unlock() //admin init - init := []interface{}{"admin", "init", waVersion, []string{wac.longClientName, wac.shortClientName}, wac.session.ClientId, true} + init := []interface{}{"admin", "init", waVersion, []string{wac.longClientName, wac.shortClientName, wac.clientVersion}, wac.session.ClientId, true} initChan, err := wac.writeJson(init) if err != nil { return fmt.Errorf("error writing admin init: %v\n", err) diff --git a/vendor/modules.txt b/vendor/modules.txt index 38017238..e8d5ffab 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -15,7 +15,7 @@ github.com/Philipp15b/go-steam/protocol/steamlang github.com/Philipp15b/go-steam/rwu github.com/Philipp15b/go-steam/socialcache github.com/Philipp15b/go-steam/steamid -# github.com/Rhymen/go-whatsapp v0.1.1-0.20200408093540-2f227c53b44f +# github.com/Rhymen/go-whatsapp v0.1.1-0.20200421062035-31e8111ac334 github.com/Rhymen/go-whatsapp github.com/Rhymen/go-whatsapp/binary github.com/Rhymen/go-whatsapp/binary/proto -- cgit v1.2.3