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