Fetch message buffers from mattermost-buffers

When processing a WS frame, we were matching buffers by name to insert
the posts on them. This PR looks for the buffer on
`mattermost-buffers` by id keyword, making it much safer
This commit is contained in:
Miguel de la Cruz 2022-06-07 09:13:35 +02:00
parent 635e95107d
commit 47eb5e405f

View file

@ -113,9 +113,9 @@ conform to a post plist"
"Processes a websocket posted message"
(let* ((channel-name (plist-get (plist-get msg :data) :channel_name))
(channel-display-name (plist-get (plist-get msg :data) :channel_display_name))
(chanb (or (get-buffer (format "> %s <" channel-name))
(get-buffer (format "> %s <" channel-display-name))))
(post (mattermost--ws-posted-to-post msg)))
(post (mattermost--ws-posted-to-post msg))
(channel-id (plist-get post :channel_id))
(chanb (plist-get mattermost-buffers (mattermost-string->keyword channel-id))))
(if (not (null chanb))
(with-current-buffer chanb
(save-excursion