From 47eb5e405f9c24efe39785e4358640dba7c09f8c Mon Sep 17 00:00:00 2001 From: Miguel de la Cruz Date: Tue, 7 Jun 2022 09:13:35 +0200 Subject: [PATCH] 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 --- mattermost.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mattermost.el b/mattermost.el index da3dc9a..ffb049b 100644 --- a/mattermost.el +++ b/mattermost.el @@ -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