cocodelabs / znc-palaver

ZNC module for push notifications
MIT License
112 stars 14 forks source link

Change to user/network module #62

Closed dongcarl closed 3 years ago

dongcarl commented 4 years ago

I wonder how hard it would be to change this to a user module or even a network module instead of a global module? It would be nice to have granular control over what users/networks the palaver module sends notifications for.

I tried changing the GLOBALMODULEDEFS to USERMODULEDEFS and NETWORKMODULEDEFS, and they seemed to compile fine, but I suspect there's more to it than just changing the macro invocation...

Some context: I'm trying to setup my ZNC to be multi-client with the older way, which seems more robust to me, and quite usable since Palaver has server-time cap: https://wiki.znc.in/Multiple_clients#Older_way. The way I want to do this is by having a johndoe_palaver ZNC user, a johndoe_weechat ZNC user, etc. I want to make sure that I only receive notifications on palaver for the johndoe_palaver ZNC user and perhaps I'm understanding the code incorrectly but it seems like since it's a global module, I'll be getting notifications for all ZNC users on Palaver.

kylef commented 4 years ago

Hi @dongcarl,

You’ll only receive notifications to the user/network combinations that you connect to from Palaver, for example if you don’t connect to the johndoe_weechat from Palaver then you won’t receive push notifications to a Palaver device. You need to connect and authenticate as a user to get notifications for them, you wouldn’t want one user seeing notifications for another user, that would be a significant privacy flaw.

Using a separate account for weechat will prevent a few of the normal behaviours from working properly:

  1. When connecting, attaching or unaway in weechat it won’t automatically remove notifications on Palaver
  2. You will receive notifications even when you are actively using weechat

I’d recommend taking a look at the clientaway and znc-playback modules, you may be able to achieve the behaviour you are looking for using them instead.


It‘s only possible to use the module as a global module due to the way that IRCv3 capabilities current work in ZNC. The negotiation on which capabilities (such as palaver push) can happen before the client has authenticated with ZNC, and the necessary ZNC module hooks only work specifically for global modules (https://github.com/znc/znc/blob/95369455fcbc95f8064253b1e72c8b9bc83b6e98/src/Client.cpp#701).