Update dependencies
This commit is contained in:
6
vendor/github.com/Rhymen/go-whatsapp/conn.go
generated
vendored
6
vendor/github.com/Rhymen/go-whatsapp/conn.go
generated
vendored
@ -89,6 +89,9 @@ type Conn struct {
|
||||
Info *Info
|
||||
Store *Store
|
||||
ServerLastSeen time.Time
|
||||
|
||||
longClientName string
|
||||
shortClientName string
|
||||
}
|
||||
|
||||
type wsMsg struct {
|
||||
@ -122,6 +125,9 @@ func NewConn(timeout time.Duration) (*Conn, error) {
|
||||
msgCount: 0,
|
||||
msgTimeout: timeout,
|
||||
Store: newStore(),
|
||||
|
||||
longClientName: "github.com/rhymen/go-whatsapp",
|
||||
shortClientName: "go-whatsapp",
|
||||
}
|
||||
|
||||
go wac.readPump()
|
||||
|
16
vendor/github.com/Rhymen/go-whatsapp/session.go
generated
vendored
16
vendor/github.com/Rhymen/go-whatsapp/session.go
generated
vendored
@ -84,6 +84,18 @@ func newInfoFromReq(info map[string]interface{}) *Info {
|
||||
return ret
|
||||
}
|
||||
|
||||
/*
|
||||
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 {
|
||||
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
|
||||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
Login is the function that creates a new whatsapp session and logs you in. If you do not want to scan the qr code
|
||||
every time, you should save the returned session and use RestoreSession the next time. Login takes a writable channel
|
||||
@ -122,7 +134,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, 225}, []string{"github.com/rhymen/go-whatsapp", "go-whatsapp"}, session.ClientId, true}
|
||||
login := []interface{}{"admin", "init", []int{0, 3, 225}, []string{wac.longClientName, wac.shortClientName}, session.ClientId, true}
|
||||
loginChan, err := wac.write(login)
|
||||
if err != nil {
|
||||
return session, fmt.Errorf("error writing login: %v\n", err)
|
||||
@ -235,7 +247,7 @@ func (wac *Conn) RestoreSession(session Session) (Session, error) {
|
||||
wac.listener["s1"] = make(chan string, 1)
|
||||
|
||||
//admin init
|
||||
init := []interface{}{"admin", "init", []int{0, 3, 225}, []string{"github.com/rhymen/go-whatsapp", "go-whatsapp"}, session.ClientId, true}
|
||||
init := []interface{}{"admin", "init", []int{0, 3, 225}, []string{wac.longClientName, wac.shortClientName}, session.ClientId, true}
|
||||
initChan, err := wac.write(init)
|
||||
if err != nil {
|
||||
wac.session = nil
|
||||
|
Reference in New Issue
Block a user