|
@@ -549,7 +549,7 @@ func (portal *Portal) Sync(user *User, contact whatsapp.Contact) {
|
|
func (portal *Portal) GetBasePowerLevels() *event.PowerLevelsEventContent {
|
|
func (portal *Portal) GetBasePowerLevels() *event.PowerLevelsEventContent {
|
|
anyone := 0
|
|
anyone := 0
|
|
nope := 99
|
|
nope := 99
|
|
- invite := 99
|
|
|
|
|
|
+ invite := 50
|
|
if portal.bridge.Config.Bridge.AllowUserInvite {
|
|
if portal.bridge.Config.Bridge.AllowUserInvite {
|
|
invite = 0
|
|
invite = 0
|
|
}
|
|
}
|
|
@@ -1328,6 +1328,25 @@ func (portal *Portal) HandleWhatsAppKick(senderJID string, jids []string) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+func (portal *Portal) HandleWhatsAppInvite(senderJID string, jids []string) {
|
|
|
|
+ senderIntent := portal.MainIntent()
|
|
|
|
+ if senderJID != "unknown" {
|
|
|
|
+ sender := portal.bridge.GetPuppetByJID(senderJID)
|
|
|
|
+ senderIntent = sender.IntentFor(portal)
|
|
|
|
+ }
|
|
|
|
+ for _, jid := range jids {
|
|
|
|
+ puppet := portal.bridge.GetPuppetByJID(jid)
|
|
|
|
+ _, err := senderIntent.InviteUser(portal.MXID, &mautrix.ReqInviteUser{UserID: puppet.MXID})
|
|
|
|
+ if err != nil {
|
|
|
|
+ portal.log.Warnfln("Failed to invite %s as %s: %v", puppet.MXID, senderIntent.UserID, err)
|
|
|
|
+ }
|
|
|
|
+ err = puppet.DefaultIntent().EnsureJoined(portal.MXID)
|
|
|
|
+ if err != nil {
|
|
|
|
+ portal.log.Errorfln("Failed to ensure %s is joined: %v", puppet.MXID, err)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
type base struct {
|
|
type base struct {
|
|
download func() ([]byte, error)
|
|
download func() ([]byte, error)
|
|
info whatsapp.MessageInfo
|
|
info whatsapp.MessageInfo
|