summaryrefslogtreecommitdiffstats
path: root/vendor/go.mau.fi/whatsmeow/store
diff options
context:
space:
mode:
authorWim <wim@42.be>2022-06-25 00:36:16 +0200
committerGitHub <noreply@github.com>2022-06-25 00:36:16 +0200
commit4649876956ab944d2a9ea8fc98c75dc8a9f5ef08 (patch)
tree0f32da8e492cabd8eca53de319e287e6c4791c5e /vendor/go.mau.fi/whatsmeow/store
parent5604d140e3bbf5c8f6c414b1427145a0c4e36bb4 (diff)
downloadmatterbridge-msglm-4649876956ab944d2a9ea8fc98c75dc8a9f5ef08.tar.gz
matterbridge-msglm-4649876956ab944d2a9ea8fc98c75dc8a9f5ef08.tar.bz2
matterbridge-msglm-4649876956ab944d2a9ea8fc98c75dc8a9f5ef08.zip
Update dependencies (#1851)
Diffstat (limited to 'vendor/go.mau.fi/whatsmeow/store')
-rw-r--r--vendor/go.mau.fi/whatsmeow/store/clientpayload.go6
-rw-r--r--vendor/go.mau.fi/whatsmeow/store/sqlstore/container.go3
-rw-r--r--vendor/go.mau.fi/whatsmeow/store/sqlstore/store.go27
-rw-r--r--vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrade.go2
-rw-r--r--vendor/go.mau.fi/whatsmeow/store/store.go2
5 files changed, 22 insertions, 18 deletions
diff --git a/vendor/go.mau.fi/whatsmeow/store/clientpayload.go b/vendor/go.mau.fi/whatsmeow/store/clientpayload.go
index 6ebf5d99..6e148181 100644
--- a/vendor/go.mau.fi/whatsmeow/store/clientpayload.go
+++ b/vendor/go.mau.fi/whatsmeow/store/clientpayload.go
@@ -74,7 +74,7 @@ func (vc WAVersionContainer) ProtoAppVersion() *waProto.AppVersion {
}
// waVersion is the WhatsApp web client version
-var waVersion = WAVersionContainer{2, 2218, 8}
+var waVersion = WAVersionContainer{2, 2222, 11}
// waVersionHash is the md5 hash of a dot-separated waVersion
var waVersionHash [16]byte
@@ -125,14 +125,14 @@ var BaseClientPayload = &waProto.ClientPayload{
// Deprecated: renamed to DeviceProps
var CompanionProps = DeviceProps
-var DeviceProps = &waProto.CompanionProps{
+var DeviceProps = &waProto.DeviceProps{
Os: proto.String("whatsmeow"),
Version: &waProto.AppVersion{
Primary: proto.Uint32(0),
Secondary: proto.Uint32(1),
Tertiary: proto.Uint32(0),
},
- PlatformType: waProto.CompanionProps_UNKNOWN.Enum(),
+ PlatformType: waProto.DeviceProps_UNKNOWN.Enum(),
RequireFullSync: proto.Bool(false),
}
diff --git a/vendor/go.mau.fi/whatsmeow/store/sqlstore/container.go b/vendor/go.mau.fi/whatsmeow/store/sqlstore/container.go
index b7c0a7c4..8a26fc53 100644
--- a/vendor/go.mau.fi/whatsmeow/store/sqlstore/container.go
+++ b/vendor/go.mau.fi/whatsmeow/store/sqlstore/container.go
@@ -181,7 +181,8 @@ const (
adv_key, adv_details, adv_account_sig, adv_account_sig_key, adv_device_sig,
platform, business_name, push_name)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15)
- ON CONFLICT (jid) DO UPDATE SET platform=$12, business_name=$13, push_name=$14
+ ON CONFLICT (jid) DO UPDATE
+ SET platform=excluded.platform, business_name=excluded.business_name, push_name=excluded.push_name
`
deleteDeviceQuery = `DELETE FROM whatsmeow_device WHERE jid=$1`
)
diff --git a/vendor/go.mau.fi/whatsmeow/store/sqlstore/store.go b/vendor/go.mau.fi/whatsmeow/store/sqlstore/store.go
index 01ec2056..abea5fe2 100644
--- a/vendor/go.mau.fi/whatsmeow/store/sqlstore/store.go
+++ b/vendor/go.mau.fi/whatsmeow/store/sqlstore/store.go
@@ -67,7 +67,7 @@ var _ store.ContactStore = (*SQLStore)(nil)
const (
putIdentityQuery = `
INSERT INTO whatsmeow_identity_keys (our_jid, their_id, identity) VALUES ($1, $2, $3)
- ON CONFLICT (our_jid, their_id) DO UPDATE SET identity=$3
+ ON CONFLICT (our_jid, their_id) DO UPDATE SET identity=excluded.identity
`
deleteAllIdentitiesQuery = `DELETE FROM whatsmeow_identity_keys WHERE our_jid=$1 AND their_id LIKE $2`
deleteIdentityQuery = `DELETE FROM whatsmeow_identity_keys WHERE our_jid=$1 AND their_id=$2`
@@ -108,7 +108,7 @@ const (
hasSessionQuery = `SELECT true FROM whatsmeow_sessions WHERE our_jid=$1 AND their_id=$2`
putSessionQuery = `
INSERT INTO whatsmeow_sessions (our_jid, their_id, session) VALUES ($1, $2, $3)
- ON CONFLICT (our_jid, their_id) DO UPDATE SET session=$3
+ ON CONFLICT (our_jid, their_id) DO UPDATE SET session=excluded.session
`
deleteAllSessionsQuery = `DELETE FROM whatsmeow_sessions WHERE our_jid=$1 AND their_id LIKE $2`
deleteSessionQuery = `DELETE FROM whatsmeow_sessions WHERE our_jid=$1 AND their_id=$2`
@@ -259,7 +259,7 @@ const (
getSenderKeyQuery = `SELECT sender_key FROM whatsmeow_sender_keys WHERE our_jid=$1 AND chat_id=$2 AND sender_id=$3`
putSenderKeyQuery = `
INSERT INTO whatsmeow_sender_keys (our_jid, chat_id, sender_id, sender_key) VALUES ($1, $2, $3, $4)
- ON CONFLICT (our_jid, chat_id, sender_id) DO UPDATE SET sender_key=$4
+ ON CONFLICT (our_jid, chat_id, sender_id) DO UPDATE SET sender_key=excluded.sender_key
`
)
@@ -279,7 +279,8 @@ func (s *SQLStore) GetSenderKey(group, user string) (key []byte, err error) {
const (
putAppStateSyncKeyQuery = `
INSERT INTO whatsmeow_app_state_sync_keys (jid, key_id, key_data, timestamp, fingerprint) VALUES ($1, $2, $3, $4, $5)
- ON CONFLICT (jid, key_id) DO UPDATE SET key_data=$3, timestamp=$4, fingerprint=$5
+ ON CONFLICT (jid, key_id) DO UPDATE
+ SET key_data=excluded.key_data, timestamp=excluded.timestamp, fingerprint=excluded.fingerprint
`
getAppStateSyncKeyQuery = `SELECT key_data, timestamp, fingerprint FROM whatsmeow_app_state_sync_keys WHERE jid=$1 AND key_id=$2`
)
@@ -301,7 +302,7 @@ func (s *SQLStore) GetAppStateSyncKey(id []byte) (*store.AppStateSyncKey, error)
const (
putAppStateVersionQuery = `
INSERT INTO whatsmeow_app_state_version (jid, name, version, hash) VALUES ($1, $2, $3, $4)
- ON CONFLICT (jid, name) DO UPDATE SET version=$3, hash=$4
+ ON CONFLICT (jid, name) DO UPDATE SET version=excluded.version, hash=excluded.hash
`
getAppStateVersionQuery = `SELECT version, hash FROM whatsmeow_app_state_version WHERE jid=$1 AND name=$2`
deleteAppStateVersionQuery = `DELETE FROM whatsmeow_app_state_version WHERE jid=$1 AND name=$2`
@@ -435,11 +436,11 @@ const (
`
putPushNameQuery = `
INSERT INTO whatsmeow_contacts (our_jid, their_jid, push_name) VALUES ($1, $2, $3)
- ON CONFLICT (our_jid, their_jid) DO UPDATE SET push_name=$3
+ ON CONFLICT (our_jid, their_jid) DO UPDATE SET push_name=excluded.push_name
`
putBusinessNameQuery = `
INSERT INTO whatsmeow_contacts (our_jid, their_jid, business_name) VALUES ($1, $2, $3)
- ON CONFLICT (our_jid, their_jid) DO UPDATE SET business_name=$3
+ ON CONFLICT (our_jid, their_jid) DO UPDATE SET business_name=excluded.business_name
`
getContactQuery = `
SELECT first_name, full_name, push_name, business_name FROM whatsmeow_contacts WHERE our_jid=$1 AND their_jid=$2
@@ -470,23 +471,25 @@ func (s *SQLStore) PutPushName(user types.JID, pushName string) (bool, string, e
return false, "", nil
}
-func (s *SQLStore) PutBusinessName(user types.JID, businessName string) error {
+func (s *SQLStore) PutBusinessName(user types.JID, businessName string) (bool, string, error) {
s.contactCacheLock.Lock()
defer s.contactCacheLock.Unlock()
cached, err := s.getContact(user)
if err != nil {
- return err
+ return false, "", err
}
if cached.BusinessName != businessName {
_, err = s.db.Exec(putBusinessNameQuery, s.JID, user, businessName)
if err != nil {
- return err
+ return false, "", err
}
+ previousName := cached.BusinessName
cached.BusinessName = businessName
cached.Found = true
+ return true, previousName, nil
}
- return nil
+ return false, "", nil
}
func (s *SQLStore) PutContactName(user types.JID, firstName, fullName string) error {
@@ -643,7 +646,7 @@ func (s *SQLStore) GetAllContacts() (map[types.JID]types.ContactInfo, error) {
const (
putChatSettingQuery = `
INSERT INTO whatsmeow_chat_settings (our_jid, chat_jid, %[1]s) VALUES ($1, $2, $3)
- ON CONFLICT (our_jid, chat_jid) DO UPDATE SET %[1]s=$3
+ ON CONFLICT (our_jid, chat_jid) DO UPDATE SET %[1]s=excluded.%[1]s
`
getChatSettingsQuery = `
SELECT muted_until, pinned, archived FROM whatsmeow_chat_settings WHERE our_jid=$1 AND chat_jid=$2
diff --git a/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrade.go b/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrade.go
index 37bd7c29..4a4b2ca7 100644
--- a/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrade.go
+++ b/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrade.go
@@ -239,7 +239,7 @@ func upgradeV2(tx *sql.Tx, container *Container) error {
if err != nil {
return err
}
- if container.dialect == "postgres" {
+ if container.dialect == "postgres" || container.dialect == "pgx" {
_, err = tx.Exec(fillSigKeyPostgres)
} else {
_, err = tx.Exec(fillSigKeySQLite)
diff --git a/vendor/go.mau.fi/whatsmeow/store/store.go b/vendor/go.mau.fi/whatsmeow/store/store.go
index 19feeb7f..76087e46 100644
--- a/vendor/go.mau.fi/whatsmeow/store/store.go
+++ b/vendor/go.mau.fi/whatsmeow/store/store.go
@@ -80,7 +80,7 @@ type ContactEntry struct {
type ContactStore interface {
PutPushName(user types.JID, pushName string) (bool, string, error)
- PutBusinessName(user types.JID, businessName string) error
+ PutBusinessName(user types.JID, businessName string) (bool, string, error)
PutContactName(user types.JID, fullName, firstName string) error
PutAllContactNames(contacts []ContactEntry) error
GetContact(user types.JID) (types.ContactInfo, error)