Skip to content

Commit

Permalink
extract wa version to its own variable
Browse files Browse the repository at this point in the history
  • Loading branch information
SchulteMK committed Jun 13, 2019
1 parent e7293ec commit c872073
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ import (
"github.com/Rhymen/go-whatsapp/crypto/hkdf"
)

//represents the WhatsAppWeb client version
var waVersion = []int{0, 3, 3324}

/*
Session contains session individual information. To be able to resume the connection without scanning the qr code
every time you should save the Session returned by Login and use RestoreWithSession the next time you want to login.
Expand Down Expand Up @@ -148,8 +151,7 @@ func (wac *Conn) Login(qrChan chan<- string) (Session, error) {
}

session.ClientId = base64.StdEncoding.EncodeToString(clientId)
//oldVersion=8691
login := []interface{}{"admin", "init", []int{0, 3, 3324}, []string{wac.longClientName, wac.shortClientName}, session.ClientId, true}
login := []interface{}{"admin", "init", waVersion, []string{wac.longClientName, wac.shortClientName}, session.ClientId, true}
loginChan, err := wac.writeJson(login)
if err != nil {
return session, fmt.Errorf("error writing login: %v\n", err)
Expand Down Expand Up @@ -303,7 +305,7 @@ func (wac *Conn) Restore() error {
wac.listener.Unlock()

//admin init
init := []interface{}{"admin", "init", []int{0, 3, 2390}, []string{wac.longClientName, wac.shortClientName}, wac.session.ClientId, true}
init := []interface{}{"admin", "init", waVersion, []string{wac.longClientName, wac.shortClientName}, wac.session.ClientId, true}
initChan, err := wac.writeJson(init)
if err != nil {
return fmt.Errorf("error writing admin init: %v\n", err)
Expand Down

1 comment on commit c872073

@houstondapaz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is better that the client pass this value?

Please sign in to comment.