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) --- vendor/github.com/Rhymen/go-whatsapp/conn.go | 3 +++ vendor/github.com/Rhymen/go-whatsapp/session.go | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'vendor/github.com/Rhymen/go-whatsapp') 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) -- cgit v1.2.3