-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Silent mode #76
base: devel
Are you sure you want to change the base?
Silent mode #76
Conversation
…to check for environment variable SILENT_MODE before private messaging the user. Included SILENT_MODE in .env.example
So I was actually thinking of a slightly different approach with this than what you've gone with here. This is 95% of what i wanted but... For maximum debugging ability, I was thinking rather than intercepting the events by overriding the send, that instead intercepting them after sending them would be closer to normal functionality. As in, sending the messages as you normally would, but those messages being sent to a sort of /dev/null (or some sort of mini-server that only does logging or something) rather than to the IRC server. My goal with this feature is to keep it as close to vanilla functionality as humanly possible while still intercepting the messages, so the less monkeypatching of cinch that is done, the better. |
If I'm understanding correctly, then I can dig a little deeper into the framework. It sounds like you want to capture at the last possible moment before the message is actually sent. I could redirect in the base send function in irc.rb...
Or I could redirect in message_queue.rb right before it's written to the socket...
Do either of those put us closer to the same page? |
The latter seems like the last possible point to catch it, so that'd probably be optimal. It would also allow us to catch everything going out without having to do special cases for each type of output if I understand correctly, no? The only other potential problem I can see relating to doing things this way is that we may want to have a way to set an override for the silent mode with specific plugins. For example, cinch-identify would stop functioning in silent mode and therefore break identification as messages from the bot wouldn't be sent to the server. |
Any update on this? :) |
Jeebus, I forgot all about JBot! I've been tied up with qtwebkit stuff lately, but as soon as I get a chance to revisit this I'll let you know. |
Hey man, I don't want to leave you hanging. I want to finish this but I have to accept I'm just not able to make it a priority. My apologies. |
Possibly resolves #64.
I've added a SILENT_MODE environment variable and included it in the example file.
Added extensions.rb with the monkey patches. Was able to just call super with Cinch::User since send() is from the Target base class.
reply() and action_reply() are actually members of Cinch::Message, so the patch overwrites them and I had to copy the implementation into the extension. This could be problematic if the implementation changes in the future. Is there possibly a better way or another way to patch the class without changing the API?
Output when in silent mode is in the format:
SILENT MODE: Type of message to [user nick] = [message that would have been sent]