forked from MirrorHub/mautrix-whatsapp
Merge pull request #452 from abmantis/presence_on_typing
Send presence when typing changes
This commit is contained in:
commit
8da6e14bf8
4 changed files with 12 additions and 0 deletions
|
@ -54,6 +54,7 @@ type BridgeConfig struct {
|
||||||
SyncDirectChatList bool `yaml:"sync_direct_chat_list"`
|
SyncDirectChatList bool `yaml:"sync_direct_chat_list"`
|
||||||
DefaultBridgeReceipts bool `yaml:"default_bridge_receipts"`
|
DefaultBridgeReceipts bool `yaml:"default_bridge_receipts"`
|
||||||
DefaultBridgePresence bool `yaml:"default_bridge_presence"`
|
DefaultBridgePresence bool `yaml:"default_bridge_presence"`
|
||||||
|
SendPresenceOnTyping bool `yaml:"send_presence_on_typing"`
|
||||||
|
|
||||||
ForceActiveDeliveryReceipts bool `yaml:"force_active_delivery_receipts"`
|
ForceActiveDeliveryReceipts bool `yaml:"force_active_delivery_receipts"`
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,7 @@ func (helper *UpgradeHelper) doUpgrade() {
|
||||||
helper.Copy(Bool, "bridge", "sync_direct_chat_list")
|
helper.Copy(Bool, "bridge", "sync_direct_chat_list")
|
||||||
helper.Copy(Bool, "bridge", "default_bridge_receipts")
|
helper.Copy(Bool, "bridge", "default_bridge_receipts")
|
||||||
helper.Copy(Bool, "bridge", "default_bridge_presence")
|
helper.Copy(Bool, "bridge", "default_bridge_presence")
|
||||||
|
helper.Copy(Bool, "bridge", "send_presence_on_typing")
|
||||||
helper.Copy(Bool, "bridge", "force_active_delivery_receipts")
|
helper.Copy(Bool, "bridge", "force_active_delivery_receipts")
|
||||||
helper.Copy(Map, "bridge", "double_puppet_server_map")
|
helper.Copy(Map, "bridge", "double_puppet_server_map")
|
||||||
helper.Copy(Bool, "bridge", "double_puppet_allow_discovery")
|
helper.Copy(Bool, "bridge", "double_puppet_allow_discovery")
|
||||||
|
|
|
@ -147,6 +147,10 @@ bridge:
|
||||||
# Existing users won't be affected when these are changed.
|
# Existing users won't be affected when these are changed.
|
||||||
default_bridge_receipts: true
|
default_bridge_receipts: true
|
||||||
default_bridge_presence: true
|
default_bridge_presence: true
|
||||||
|
# Send the presence as "available" to whatsapp when users start typing on a portal.
|
||||||
|
# This works as a workaround for homeservers that do not support presence, and allows
|
||||||
|
# users to see when the whatsapp user on the other side is typing during a conversation.
|
||||||
|
send_presence_on_typing: false
|
||||||
# Should the bridge always send "active" delivery receipts (two gray ticks on WhatsApp)
|
# Should the bridge always send "active" delivery receipts (two gray ticks on WhatsApp)
|
||||||
# even if the user isn't marked as online (e.g. when presence bridging isn't enabled)?
|
# even if the user isn't marked as online (e.g. when presence bridging isn't enabled)?
|
||||||
#
|
#
|
||||||
|
|
|
@ -2818,6 +2818,12 @@ func (portal *Portal) setTyping(userIDs []id.UserID, state types.ChatPresence) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
portal.log.Warnln("Error sending chat presence:", err)
|
portal.log.Warnln("Error sending chat presence:", err)
|
||||||
}
|
}
|
||||||
|
if portal.bridge.Config.Bridge.SendPresenceOnTyping {
|
||||||
|
err = user.Client.SendPresence(types.PresenceAvailable)
|
||||||
|
if err != nil {
|
||||||
|
user.log.Warnln("Failed to set presence:", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue