mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-09-11 01:52:30 +00:00
Update vendor (#1384)
This commit is contained in:
47
vendor/github.com/Rhymen/go-whatsapp/contact.go
generated
vendored
47
vendor/github.com/Rhymen/go-whatsapp/contact.go
generated
vendored
@@ -2,9 +2,11 @@ package whatsapp
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/Rhymen/go-whatsapp/binary"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Rhymen/go-whatsapp/binary"
|
||||
)
|
||||
|
||||
type Presence string
|
||||
@@ -241,3 +243,46 @@ func buildParticipantNodes(participants []string) []binary.Node {
|
||||
}
|
||||
return p
|
||||
}
|
||||
|
||||
func (wac *Conn) BlockContact(jid string) (<-chan string, error) {
|
||||
return wac.handleBlockContact("add", jid)
|
||||
}
|
||||
|
||||
func (wac *Conn) UnblockContact(jid string) (<-chan string, error) {
|
||||
return wac.handleBlockContact("remove", jid)
|
||||
}
|
||||
|
||||
func (wac *Conn) handleBlockContact(action, jid string) (<-chan string, error) {
|
||||
ts := time.Now().Unix()
|
||||
tag := fmt.Sprintf("%d.--%d", ts, wac.msgCount)
|
||||
|
||||
netsplit := strings.Split(jid, "@")
|
||||
cusjid := netsplit[0] + "@c.us"
|
||||
|
||||
n := binary.Node{
|
||||
Description: "action",
|
||||
Attributes: map[string]string{
|
||||
"type": "set",
|
||||
"epoch": strconv.Itoa(wac.msgCount),
|
||||
},
|
||||
Content: []interface{}{
|
||||
binary.Node{
|
||||
Description: "block",
|
||||
Attributes: map[string]string{
|
||||
"type": action,
|
||||
},
|
||||
Content: []binary.Node{
|
||||
{
|
||||
Description: "user",
|
||||
Attributes: map[string]string{
|
||||
"jid": cusjid,
|
||||
},
|
||||
Content: nil,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return wac.writeBinary(n, contact, ignore, tag)
|
||||
}
|
||||
|
Reference in New Issue
Block a user