@@ -73,6 +73,8 @@ local POLL_INTERVAL = 55
73
73
-- Floating values like 0.4 should work too.
74
74
local timeout = 5 * 1000 -- overriden by w.config_get_plugin later
75
75
76
+ local current_buffer
77
+
76
78
local default_color = w .color (' default' )
77
79
-- Cache error variables so we don't have to look them up for every error
78
80
-- message, a normal user will not change these ever anyway.
@@ -2711,7 +2713,7 @@ function Room:ParseChunk(chunk, backlog, chunktype)
2711
2713
-- luacheck: ignore 542
2712
2714
elseif chunk [' type' ] == ' m.receipt' then
2713
2715
-- TODO: figure out if we can do something sensible with read receipts
2714
- elseif chunk [' type' ] == ' m.fully_read' and self .buffer ~= w . current_buffer () then
2716
+ elseif chunk [' type' ] == ' m.fully_read' and self .buffer ~= current_buffer then
2715
2717
-- we don't want to update read line for the current buffer
2716
2718
-- TODO: check if read marker correspond to the last event in the room
2717
2719
w .buffer_set (self .buffer , " unread" , " " )
@@ -3303,10 +3305,17 @@ function typing_notification_cb(signal, sig_type, data)
3303
3305
return w .WEECHAT_RC_OK
3304
3306
end
3305
3307
3306
- function buffer_switch_cb (signal , sig_type , data )
3308
+ function buffer_switch_cb (data , signal , sig_type )
3307
3309
-- Update bar item
3308
3310
w .bar_item_update (' matrix_typing_notice' )
3309
- local current_buffer = w .current_buffer ()
3311
+ if current_buffer then
3312
+ local room = SERVER :findRoom (current_buffer )
3313
+ if room then
3314
+ room :MarkAsRead ()
3315
+ end
3316
+ end
3317
+
3318
+ current_buffer = w .current_buffer ()
3310
3319
local room = SERVER :findRoom (current_buffer )
3311
3320
if room then
3312
3321
room :MarkAsRead ()
@@ -3315,7 +3324,6 @@ function buffer_switch_cb(signal, sig_type, data)
3315
3324
end
3316
3325
3317
3326
function typing_bar_item_cb (data , buffer , args )
3318
- local current_buffer = w .current_buffer ()
3319
3327
local room = SERVER :findRoom (current_buffer )
3320
3328
if not room then return ' ' end
3321
3329
local typing_ids = table.concat (room .typing_ids , ' ' )
0 commit comments