Ignore incoming typing notifications from logged-in users
This commit is contained in:
13
user.go
13
user.go
@@ -186,6 +186,12 @@ func (br *DiscordBridge) GetUserByID(id string) *User {
|
||||
return user
|
||||
}
|
||||
|
||||
func (br *DiscordBridge) GetCachedUserByID(id string) *User {
|
||||
br.usersLock.Lock()
|
||||
defer br.usersLock.Unlock()
|
||||
return br.usersByID[id]
|
||||
}
|
||||
|
||||
func (br *DiscordBridge) NewUser(dbUser *database.User) *User {
|
||||
user := &User{
|
||||
User: dbUser,
|
||||
@@ -1228,10 +1234,17 @@ func (user *User) messageAckHandler(m *discordgo.MessageAck) {
|
||||
}
|
||||
|
||||
func (user *User) typingStartHandler(t *discordgo.TypingStart) {
|
||||
if t.UserID == user.DiscordID {
|
||||
return
|
||||
}
|
||||
portal := user.GetExistingPortalByID(t.ChannelID)
|
||||
if portal == nil || portal.MXID == "" {
|
||||
return
|
||||
}
|
||||
targetUser := user.bridge.GetCachedUserByID(t.UserID)
|
||||
if targetUser != nil {
|
||||
return
|
||||
}
|
||||
portal.handleDiscordTyping(t)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user