Switch back to go-whatsapp upstream
This commit is contained in:
parent
79851a62b4
commit
e4a78832ad
6 changed files with 35 additions and 43 deletions
11
Gopkg.lock
generated
11
Gopkg.lock
generated
|
@ -2,7 +2,7 @@
|
|||
|
||||
|
||||
[[projects]]
|
||||
branch = "develop"
|
||||
branch = "master"
|
||||
name = "github.com/Rhymen/go-whatsapp"
|
||||
packages = [
|
||||
".",
|
||||
|
@ -13,8 +13,7 @@
|
|||
"crypto/curve25519",
|
||||
"crypto/hkdf"
|
||||
]
|
||||
revision = "00ef431f94f17f125f842d0c7d4e9b68294c6559"
|
||||
source = "github.com/tulir/go-whatsapp"
|
||||
revision = "c31092027237441cffba1b9cb148eadf7c83c3d2"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/fatih/color"
|
||||
|
@ -55,8 +54,8 @@
|
|||
[[projects]]
|
||||
name = "github.com/mattn/go-isatty"
|
||||
packages = ["."]
|
||||
revision = "0360b2af4f38e8d38c7fce2a9f4e702702d73a39"
|
||||
version = "v0.0.3"
|
||||
revision = "6ca4dbf54d38eea1a992b3c722a76a5d1c4cb25c"
|
||||
version = "v0.0.4"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/mattn/go-sqlite3"
|
||||
|
@ -146,6 +145,6 @@
|
|||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "16c945243c327e861a6dc4fa2b43010d00453b8ee71427b95fb5dfcc6cb6ebee"
|
||||
inputs-digest = "9158f20cc827fadd5ed71302b767c938595986ef9e0623496eddfb4f95f75c76"
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
|
|
|
@ -26,9 +26,10 @@
|
|||
|
||||
|
||||
[[constraint]]
|
||||
branch = "develop"
|
||||
branch = "master"
|
||||
name = "github.com/Rhymen/go-whatsapp"
|
||||
source = "github.com/tulir/go-whatsapp"
|
||||
# branch = "develop"
|
||||
# source = "github.com/tulir/go-whatsapp"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/mattn/go-sqlite3"
|
||||
|
|
52
vendor/github.com/Rhymen/go-whatsapp/handler.go
generated
vendored
52
vendor/github.com/Rhymen/go-whatsapp/handler.go
generated
vendored
|
@ -72,7 +72,7 @@ type JsonMessageHandler interface {
|
|||
/**
|
||||
The RawMessageHandler interface needs to be implemented to receive raw messages dispatched by the dispatcher.
|
||||
Raw messages are the raw protobuf structs instead of the easy-to-use structs in TextMessageHandler, ImageMessageHandler, etc..
|
||||
*/
|
||||
*/
|
||||
type RawMessageHandler interface {
|
||||
Handler
|
||||
HandleRawMessage(message *proto.WebMessageInfo)
|
||||
|
@ -96,51 +96,45 @@ func (wac *Conn) handle(message interface{}) {
|
|||
}
|
||||
case string:
|
||||
for _, h := range wac.handler {
|
||||
x, ok := h.(JsonMessageHandler)
|
||||
if !ok {
|
||||
continue
|
||||
if x, ok := h.(JsonMessageHandler); ok {
|
||||
go x.HandleJsonMessage(m)
|
||||
}
|
||||
go x.HandleJsonMessage(m)
|
||||
}
|
||||
case TextMessage:
|
||||
for _, h := range wac.handler {
|
||||
x, ok := h.(TextMessageHandler)
|
||||
if !ok {
|
||||
continue
|
||||
if x, ok := h.(TextMessageHandler); ok {
|
||||
go x.HandleTextMessage(m)
|
||||
}
|
||||
go x.HandleTextMessage(m)
|
||||
}
|
||||
case ImageMessage:
|
||||
for _, h := range wac.handler {
|
||||
x, ok := h.(ImageMessageHandler)
|
||||
if !ok {
|
||||
continue
|
||||
if x, ok := h.(ImageMessageHandler); ok {
|
||||
go x.HandleImageMessage(m)
|
||||
}
|
||||
go x.HandleImageMessage(m)
|
||||
}
|
||||
case VideoMessage:
|
||||
for _, h := range wac.handler {
|
||||
x, ok := h.(VideoMessageHandler)
|
||||
if !ok {
|
||||
continue
|
||||
if x, ok := h.(VideoMessageHandler); ok {
|
||||
go x.HandleVideoMessage(m)
|
||||
}
|
||||
go x.HandleVideoMessage(m)
|
||||
}
|
||||
case AudioMessage:
|
||||
for _, h := range wac.handler {
|
||||
x, ok := h.(AudioMessageHandler)
|
||||
if !ok {
|
||||
continue
|
||||
if x, ok := h.(AudioMessageHandler); ok {
|
||||
go x.HandleAudioMessage(m)
|
||||
}
|
||||
go x.HandleAudioMessage(m)
|
||||
}
|
||||
case DocumentMessage:
|
||||
for _, h := range wac.handler {
|
||||
x, ok := h.(DocumentMessageHandler)
|
||||
if !ok {
|
||||
continue
|
||||
if x, ok := h.(DocumentMessageHandler); ok {
|
||||
go x.HandleDocumentMessage(m)
|
||||
}
|
||||
}
|
||||
case *proto.WebMessageInfo:
|
||||
for _, h := range wac.handler {
|
||||
if x, ok := h.(RawMessageHandler); ok {
|
||||
go x.HandleRawMessage(m)
|
||||
}
|
||||
go x.HandleDocumentMessage(m)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -157,13 +151,7 @@ func (wac *Conn) dispatch(msg interface{}) {
|
|||
if con, ok := message.Content.([]interface{}); ok {
|
||||
for a := range con {
|
||||
if v, ok := con[a].(*proto.WebMessageInfo); ok {
|
||||
for _, h := range wac.handler {
|
||||
x, ok := h.(RawMessageHandler)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
go x.HandleRawMessage(v)
|
||||
}
|
||||
wac.handle(v)
|
||||
wac.handle(parseProtoMessage(v))
|
||||
}
|
||||
}
|
||||
|
|
4
vendor/github.com/Rhymen/go-whatsapp/session.go
generated
vendored
4
vendor/github.com/Rhymen/go-whatsapp/session.go
generated
vendored
|
@ -87,9 +87,9 @@ func newInfoFromReq(info map[string]interface{}) *Info {
|
|||
/*
|
||||
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) {
|
||||
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
|
||||
|
|
4
vendor/github.com/mattn/go-isatty/.travis.yml
generated
vendored
4
vendor/github.com/mattn/go-isatty/.travis.yml
generated
vendored
|
@ -2,6 +2,10 @@ language: go
|
|||
go:
|
||||
- tip
|
||||
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
|
||||
before_install:
|
||||
- go get github.com/mattn/goveralls
|
||||
- go get golang.org/x/tools/cmd/cover
|
||||
|
|
2
vendor/github.com/mattn/go-isatty/isatty_others.go
generated
vendored
2
vendor/github.com/mattn/go-isatty/isatty_others.go
generated
vendored
|
@ -3,7 +3,7 @@
|
|||
|
||||
package isatty
|
||||
|
||||
// IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2
|
||||
// IsCygwinTerminal return true if the file descriptor is a cygwin or msys2
|
||||
// terminal. This is also always false on this environment.
|
||||
func IsCygwinTerminal(fd uintptr) bool {
|
||||
return false
|
||||
|
|
Loading…
Reference in a new issue