Right now if a module wants to tell you something, it has many ways to do that:
CUtils::PrintMessage() can be used when ZNC is starting, so that we have a console where the message will be.
PutModule() can be used if user is connected to ZNC via IRC.
WebSock.GetSession()->AddError() for the case of web request.
It would make sense to have 1 special way for modules to give messages to user. And the system will show the message to the user in one of those 3 ways, depending on the current situation and how user did the request to the module (in case if the message is a reply to such request).
Right now if a module wants to tell you something, it has many ways to do that:
1. CUtils::PrintMessage() can be used when ZNC is starting, so that we have a console where the message will be.
2. PutModule() can be used if user is connected to ZNC via IRC.
3. WebSock.GetSession()->AddError() for the case of web request.
It would make sense to have 1 special way for modules to give messages to user. And the system will show the message to the user in one of those 3 ways, depending on the current situation and how user did the request to the module (in case if the message is a reply to such request).
## <bountysource-plugin>
Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/670-a-way-to-communicate-with-modules?utm_campaign=plugin&utm_content=tracker%2F1759&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F1759&utm_medium=issues&utm_source=github).
</bountysource-plugin>
<!-- github-sync-id:4007688 -->
This method should also allow modules to take the response. This would allow znc-xmpp to speak to modules and get the response back to the correct location.
This method should also allow modules to take the response. This would allow znc-xmpp to speak to modules and get the response back to the correct location.
<!-- github-comment-id:4999990 -->
I forgot about the 4rd way - to assign a string to a special parameter in OnLoad() hook, and actually this string is shown to user in all those cases, in webadmin when user failed to load a module, in *status, in console.
But it works only when the module is loading, and it can't have several messages, like WebSock and CUtils do. And it can't distinguish error messages from success ones, like WebSock and CUtils do.
I forgot about the 4rd way - to assign a string to a special parameter in OnLoad() hook, and actually this string is shown to user in all those cases, in webadmin when user failed to load a module, in *status, in console.
But it works only when the module is loading, and it can't have several messages, like WebSock and CUtils do. And it can't distinguish error messages from success ones, like WebSock and CUtils do.
<!-- github-comment-id:5000068 -->
OnLoad() can distinguish errors - either the module failed to load or it succeeded
anyway: WebSocks require special code anyway, so that special code can handle AddError(), too. I think no module uses CUtils::PrintMessage() and I don't think any module should. That leaves us with PutModule() for most normal (IRC) stuff, I guess.
OnLoad() can distinguish errors - either the module failed to load or it succeeded
anyway: WebSocks require special code anyway, so that special code can handle AddError(), too. I think no module uses CUtils::PrintMessage() and I don't think any module should. That leaves us with PutModule() for most normal (IRC) stuff, I guess.
<!-- github-comment-id:5002516 -->
An OnModMsg(mod, msg) would be helpful if invoked when any module calls PutModule. The hook would able to process what is put by a module similar to how OnPrivMsg works.
I currently have the watch module setup and would like to be able to do something like the following so I could send the watch notices to a push module and receive them on my mobile device:
# push
OnModMsg(self, mod, msg):
if mod.GetName() == "Watch":
self.send_notification(msg)
The hook should be implemented in such a way that it need only be called from the module receiving the data and not explicitly sent from module sending the data.
An `OnModMsg(mod, msg)` would be helpful if invoked when any module calls `PutModule`. The hook would able to process what is put by a module similar to how `OnPrivMsg` works.
I currently have the [watch](http://wiki.znc.in/Watch) module setup and would like to be able to do something like the following so I could send the watch notices to a push module and receive them on my mobile device:
```
# push
OnModMsg(self, mod, msg):
if mod.GetName() == "Watch":
self.send_notification(msg)
```
The hook should be implemented in such a way that it need only be called from the module receiving the data and not explicitly sent from module sending the data.
<!-- github-comment-id:229170463 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Right now if a module wants to tell you something, it has many ways to do that:
It would make sense to have 1 special way for modules to give messages to user. And the system will show the message to the user in one of those 3 ways, depending on the current situation and how user did the request to the module (in case if the message is a reply to such request).
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
This method should also allow modules to take the response. This would allow znc-xmpp to speak to modules and get the response back to the correct location.
I forgot about the 4rd way - to assign a string to a special parameter in OnLoad() hook, and actually this string is shown to user in all those cases, in webadmin when user failed to load a module, in *status, in console.
But it works only when the module is loading, and it can't have several messages, like WebSock and CUtils do. And it can't distinguish error messages from success ones, like WebSock and CUtils do.
OnLoad() can distinguish errors - either the module failed to load or it succeeded
anyway: WebSocks require special code anyway, so that special code can handle AddError(), too. I think no module uses CUtils::PrintMessage() and I don't think any module should. That leaves us with PutModule() for most normal (IRC) stuff, I guess.
An
OnModMsg(mod, msg)would be helpful if invoked when any module callsPutModule. The hook would able to process what is put by a module similar to howOnPrivMsgworks.I currently have the watch module setup and would like to be able to do something like the following so I could send the watch notices to a push module and receive them on my mobile device:
The hook should be implemented in such a way that it need only be called from the module receiving the data and not explicitly sent from module sending the data.