poljar / weechat-matrix

Weechat Matrix protocol script written in python
Other
957 stars 120 forks source link

Status items of other python scripts are overwritten #54

Open trygveaa opened 5 years ago

trygveaa commented 5 years ago

When I use this together with wee-slack, most of the status line in the slack buffers become empty. I.e. one example is [23:41] [104] 46:, without name, user count etc.

This is because weechat-matrix overwrites the default status bar items by calling bar_item_new on existing items. I'm not sure what the correct method to set the contents of these items is though.

poljar commented 5 years ago

Hi. It's a shame that we can't just signal weechat to ignore us like we can with hook_command_run.

Could you check out if 12bf9c85c49dd482e641b1c6d94a35a30e7da878 fixes this for you?

trygveaa commented 5 years ago

Hm, that helps. The buffer name should be (#channelname) instead of servername.#channelname though.

However, if multiple plugins have defined these bar items, it seems that weechat only calls one of the functions. wee-slack doesn't do this, but if it had, the item contents would only be correct for one of the plugins.

poljar commented 5 years ago

I must have missed something, even though I implemented it just like the irc plugin does.

Are you sure that it runs only once or once per plugin? I don't see how the irc plugin would display correct data if it's only once. If it runs once per plugin it makes sense that multiple python scripts can't add the same bar items.

trygveaa commented 5 years ago

Sorry, I meant scripts in the previous comment, i.e. once per plugin. To be specific, I haven't tested when irc's function is run. I only tested that if I add a similar bar_item_new function to wee-slack, only one of wee-slack's and weechat-matrix' methods is called when I change buffer. So I guess it must be once per plugin since it is displayed correctly in irc buffers.

poljar commented 5 years ago

Sadly I don't think we can do much better than 12bf9c8 does (with a correct implementation) without changing Weechat or turning the script into a plugin.

Would wee-slack need the bar items in the future?

trygveaa commented 5 years ago

Sadly I don't think we can do much better than 12bf9c8 does (with a correct implementation) without changing Weechat or turning the script into a plugin.

Hm, okay, that's too bad.

Would wee-slack need the bar items in the future?

I don't think so, was just thinking that generally scripts shouldn't interfere with each other.

I searched through weechat's script repo, and I couldn't find any other python plugins creating these bar items, so I think we are good for now at least.