weechat-matrix icon indicating copy to clipboard operation
weechat-matrix copied to clipboard

short_name set by buffer_autoset is reset

Open EDmitry opened this issue 6 years ago • 2 comments

I've tried using buffer_autoset to change buffer names. When I add the rule initially, the buffer is renamed correctly immediately. But if I restart Weechat and reconnect, I see original buffer names. I suspect Weechat-matrix renames/updates the room name after the fact. Is there a way to disable it?

EDmitry avatar Dec 12 '19 01:12 EDmitry

The buffer name is set every time an event has the chance of changing the name. We don't store any events locally so those events arrive every time you start Weechat.

Disabling buffer name updates should be quite straightforward by modifying this method https://github.com/poljar/weechat-matrix/blob/master/matrix/buffer.py#L1154.

If we can detect that buffer_autoset is working and disable updates automagically that would be event better.

poljar avatar Dec 13 '19 17:12 poljar

A quick way around this, which should fit most usage cases as room names don't change often, is to replace line 1165 by the following piece of code

        if self.weechat_buffer.short_name.startswith('!bufautoset_'):
            self.weechat_buffer.short_name = self.weechat_buffer.short_name[12:]
        else:
            self.weechat_buffer.short_name = room_name

Then, preceding the name set in buffer_autoset by !bufautoset_ prevents any initial changes.

xaltsc avatar Nov 28 '20 16:11 xaltsc