summaryrefslogtreecommitdiffstats
path: root/bridge
diff options
context:
space:
mode:
Diffstat (limited to 'bridge')
-rw-r--r--bridge/slack/handlers.go2
-rw-r--r--bridge/slack/users_channels.go6
2 files changed, 8 insertions, 0 deletions
diff --git a/bridge/slack/handlers.go b/bridge/slack/handlers.go
index d05a358c..4dc57d0d 100644
--- a/bridge/slack/handlers.go
+++ b/bridge/slack/handlers.go
@@ -95,6 +95,8 @@ func (b *Bslack) handleSlackClient(messages chan *config.Message) {
b.users.populateUser(ev.User)
case *slack.HelloEvent, *slack.LatencyReport, *slack.ConnectingEvent:
continue
+ case *slack.UserChangeEvent:
+ b.users.invalidateUser(ev.User.ID)
default:
b.Log.Debugf("Unhandled incoming event: %T", ev)
}
diff --git a/bridge/slack/users_channels.go b/bridge/slack/users_channels.go
index 41fd0bd8..9b34b779 100644
--- a/bridge/slack/users_channels.go
+++ b/bridge/slack/users_channels.go
@@ -113,6 +113,12 @@ func (b *users) populateUser(userID string) {
b.users[userID] = user
}
+func (b *users) invalidateUser(userID string) {
+ b.usersMutex.Lock()
+ defer b.usersMutex.Unlock()
+ delete(b.users, userID)
+}
+
func (b *users) populateUsers(wait bool) {
b.refreshMutex.Lock()
if !wait && (time.Now().Before(b.earliestRefresh) || b.refreshInProgress) {