Skip to content
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

Notify only 1 line #241

Open
doni-irc opened this issue Oct 15, 2018 · 20 comments
Open

Notify only 1 line #241

doni-irc opened this issue Oct 15, 2018 · 20 comments

Comments

@doni-irc
Copy link

doni-irc commented Oct 15, 2018

on
[15:25:41] <\d> test
[15:25:42] <\d> test 2
[15:25:47] <\d> test 3

I receive only one line
[\d: [\d] test

debug:
[15:25:40] <*push> service: telegram
[15:25:40] <*push> service_host: api.telegram.org
[15:25:40] <*push> service_url: /bot326151331:AAElXCttbr4thZkHQw1WsNdhJ4F1545ZdII/sendMessage
[15:25:40] <*push> service_auth:
[15:25:40] <*push> use_port: 443
[15:25:40] <*push> use_ssl: 1
[15:25:40] <*push> use_post: 1
[15:25:40] <*push> using libcurl
[15:25:40] <*push> curl: HTTP status code 200

@dgw
Copy link
Collaborator

dgw commented Oct 15, 2018

This is expected behavior. The condition last_notification defaults to 300 seconds, and limits how often notifications are sent for a given context (quoting the README documentation):

Time in seconds since the last notification sent from that channel or query window. Notifications will only be sent if the elapsed time is greater than this value. A value of 0 (zero) will disable this condition.

Issue /znc *push set last_notification 0 and you should be notified of every line in your test case.

@doni-irc
Copy link
Author

doni-irc commented Oct 15, 2018

it was already set to 0.... any sugestions?
ps: right now, as it often happens, i am not even receiving the first line...

[21:00:07] <*push> +========================+===============================================+
[21:00:07] <*push> | Option | Value |
[21:00:07] <*push> +========================+===============================================+
[21:00:07] <*push> | away_only | no |
[21:00:07] <*push> +------------------------+-----------------------------------------------+
[21:00:07] <*push> | channel_conditions | all |
[21:00:07] <*push> +------------------------+-----------------------------------------------+
[21:00:07] <*push> | client_count_less_than | 0 |
[21:00:07] <*push> +------------------------+-----------------------------------------------+
[21:00:07] <*push> | context | * |
[21:00:07] <*push> +------------------------+-----------------------------------------------+
[21:00:07] <*push> | debug | on |
[21:00:07] <*push> +------------------------+-----------------------------------------------+
[21:00:07] <*push> | highlight | CADUTO! |
[21:00:07] <*push> +------------------------+-----------------------------------------------+
[21:00:07] <*push> | idle | 0 |
[21:00:07] <*push> +------------------------+-----------------------------------------------+
[21:00:07] <*push> | last_active | 0 |
[21:00:07] <*push> +------------------------+-----------------------------------------------+
[21:00:07] <*push> | last_notification | 0 |
[21:00:07] <*push> +------------------------+-----------------------------------------------+
[21:00:07] <*push> | message_content | {context}: [{nick}] {message} |
[21:00:07] <*push> +------------------------+-----------------------------------------------+
[21:00:07] <*push> | message_escape | |
[21:00:07] <*push> +------------------------+-----------------------------------------------+
[21:00:07] <*push> | message_length | 1000 |
[21:00:07] <*push> +------------------------+-----------------------------------------------+
[21:00:07] <*push> | message_priority | 0 |
[21:00:07] <*push> +------------------------+-----------------------------------------------+
[21:00:07] <*push> | message_sound | |
[21:00:07] <*push> +------------------------+-----------------------------------------------+
[21:00:07] <*push> | message_title | {title} |
[21:00:07] <*push> +------------------------+-----------------------------------------------+
[21:00:07] <*push> | message_uri | |
[21:00:07] <*push> +------------------------+-----------------------------------------------+
[21:00:07] <*push> | message_uri_post | no |
[21:00:07] <*push> +------------------------+-----------------------------------------------+
[21:00:07] <*push> | message_uri_title | |
[21:00:07] <*push> +------------------------+-----------------------------------------------+
[21:00:07] <*push> | network_blacklist | |
[21:00:07] <*push> +------------------------+-----------------------------------------------+
[21:00:07] <*push> | nick_blacklist | Tools Links |
[21:00:07] <*push> +------------------------+-----------------------------------------------+
[21:00:07] <*push> | proxy | |
[21:00:07] <*push> +------------------------+-----------------------------------------------+
[21:00:07] <*push> | proxy_ssl_verify | yes |
[21:00:07] <*push> +------------------------+-----------------------------------------------+
[21:00:07] <*push> | query_conditions | all |
[21:00:07] <*push> +------------------------+-----------------------------------------------+
[21:00:07] <*push> | replied | yes |
[21:00:07] <*push> +------------------------+-----------------------------------------------+
[21:00:07] <*push> | secret | 326151331:AAElXCttbr4thYkHQw1WsyYyJ4F1545ZdII |
[21:00:07] <*push> +------------------------+-----------------------------------------------+
[21:00:07] <*push> | service | telegram |
[21:00:07] <*push> +------------------------+-----------------------------------------------+
[21:00:07] <*push> | target | 228292831 |
[21:00:07] <*push> +------------------------+-----------------------------------------------+
[21:00:07] <*push> | username | |
[21:00:07] <*push> +========================+===============================================+

@dgw
Copy link
Collaborator

dgw commented Oct 15, 2018

If you're not even getting the first line sometimes, that's a different issue. I haven't used the Telegram integration, but my Pushover clients get everything they should. (My last_notification is set to 1, so it can fire pretty quickly too.)

Could be Telegram rate limiting, for all I know. I do know you should change your Telegram secret, now that you've pasted it here.

@doni-irc
Copy link
Author

doni-irc commented Oct 16, 2018

No problem. It’s a fake secret key. Do you know somethings free service like Telegram?

@dgw
Copy link
Collaborator

dgw commented Oct 16, 2018

Quick check of Telegram's FAQ says sending more than one message per second to a given chat is discouraged, and will eventually receive errors. So the rate-limit theory is indeed possible.

I don't know your platform, and honestly haven't looked at notification services in years (since starting to use Pushover for my stuff), but znc-push's readme has a list of supported ones. If none of those suits you, but you can find another you like, adding support for a new service isn't too difficult.

@doni-irc
Copy link
Author

How can I setup notifications with this service? https://pushfleet.com

@dgw
Copy link
Collaborator

dgw commented Oct 16, 2018

I threw together a quick version of the module that supports Pushfleet: https://raw.githubusercontent.com/dgw/znc-push/e4d6e1f0f709960613d708337cdca903fb584fd9/push.cpp

Haven't tested it, but it did compile on my ZNC server. App ID is baked-in; set znc-push's target option to the user ID(s) you want to send notifications to (comma-separated, if more than one).

Let me know how it goes, and if all's good I'll flesh out the documentation and open a PR later this week. (If all is not good, I'll try to fix it tomorrow.)

@dgw
Copy link
Collaborator

dgw commented Oct 18, 2018

@deltagnan Any issues? Good to go?

@doni-irc
Copy link
Author

@dgw not yet. I don’t think I will be to able to do it 😅

@dgw
Copy link
Collaborator

dgw commented Oct 18, 2018

@deltagnan To do what?

All you should need is to download that version of the module code to your ZNC machine, znc-buildmod push.cpp, and move the compiled push.so file into ZNC's module directory (replacing the one you currently have). Or are you using the Python version…?

I just need confirmation that it works. You don't need to do any code-related work! 😸

@doni-irc
Copy link
Author

Ok i will do it tonight 😃

@dgw
Copy link
Collaborator

dgw commented Oct 18, 2018

Forgot to mention that you'll need to tell ZNC to update the module, or restart ZNC, depending on version. Might as well write detailed instructions, as I don't know how experienced you are. (And it never hurts to over-document… well, almost never!)

After you install the new push.so, issue /znc updatemod push from your IRC client. Then, issue /znc *push set service pushfleet. If you get "Error: unknown service name", then the updatemod didn't work and the easiest fix is to restart ZNC and try setting the service name again. (I've found that updatemod doesn't work right in some versions of ZNC. But if, after restarting ZNC, you still get "Error: unknown service name", the push.so file is probably in the wrong place. 😹)

Once you've set the service to pushfleet, issue /znc *push set target Uxxxxxxx (replacing Uxxxxxxx with your user ID from the Pushfleet client). Then /znc *push send This is a test Pushfleet notification and you should get it pretty quickly on your device, assuming everything's set up properly.

@doni-irc
Copy link
Author

doni-irc commented Oct 18, 2018

wge etc...
znc-buildmod push.cpp
[15:36:04] <*status> Reloading [push] everywhere
[15:36:04] <*status> Done
.restart
<*push> Error: unknown service name
[15:47:06] <*status> Reloading [push] everywhere
[15:47:06] <*status> Done
<*push> Error: unknown service name

it's not in wrong place: /.znc/modules/push.so (i renamed old one in pushh.so)

@dgw
Copy link
Collaborator

dgw commented Oct 18, 2018

Sorry, I forgot there are two if-else trees.

Fixed version, which should recognize the new service name: https://raw.githubusercontent.com/dgw/znc-push/428599026bc61aa0ab707ec8815dc0eadbc7f5f7/push.cpp

@doni-irc
Copy link
Author

ok, it's work but doesnt work sending notification

[16:10:14] send prova
[16:10:14] <*push> service: pushfleet
[16:10:14] <*push> service_host: pushfleet.com
[16:10:14] <*push> service_url: /api/v1/send
[16:10:14] <*push> service_auth:
[16:10:14] <*push> use_port: 443
[16:10:14] <*push> use_ssl: 1
[16:10:14] <*push> use_post: 1
[16:10:14] <*push> NOT using libcurl
[16:10:14] <*push> Building notification to pushfleet.com/api/v1/send...
[16:10:14] <*push> User-Agent: ZNC Push/dev
[16:10:14] <*push> Query string: appid=AQQBMWCV&message=%2Apush%3A+%5B%2Apush%5D+prova&url=&userid=UQZX6767
[16:10:14] <*push> Request sending
[16:10:14] <*push> Ok

@doni-irc
Copy link
Author

Must I setup only target with my User Token?

@dgw
Copy link
Collaborator

dgw commented Oct 18, 2018

Yes, user token goes in target and that's it.

I found another problem (finally broke down and built a local ZNC instance, which is why it took me so long to answer) and pushed another new version. Pushfleet doesn't like POST requests, which is apparently what znc-push sends by default. Fixed that: https://github.com/dgw/znc-push/blob/3e3d84f5a1ebe0a84a41b01b5676a2299d1cc5ca/push.cpp

Haven't yet figured out how to completely suppress the url parameter, though. If left empty, it defaults to a Google search for the notification message, which is not very useful.

This link will always refer to the latest revision of the pushfleet branch, as well: https://raw.githubusercontent.com/dgw/znc-push/add-pushfleet/push.cpp (or at least, it will until I eventually delete the branch)

@dgw
Copy link
Collaborator

dgw commented Oct 18, 2018

FYI, it might or might not work. The appid has disappeared from my Pushfleet account dashboard, and I'm done creating new ones until I hear back from support about why this keeps happening.

Feel free to make your own appid and replace mine in the code if it doesn't work, @deltagnan.

@doni-irc
Copy link
Author

doni-irc commented Oct 18, 2018

I dont know why but everytime i made an app on Pushfleet after few hours the app disappears from my app list... http://i67.tinypic.com/10gz5hf.jpg

@dgw
Copy link
Collaborator

dgw commented Oct 19, 2018

Well, it might be pointless to keep working on Pushfleet support in znc-push, if apps get removed every few hours. That's exactly what happened to my apps, too.

I'll still give them until next week to answer, and might polish up the code and PR it anyway as a WIP, but it won't be of any practical use until this appid thing gets sorted. I thought maybe they had a bot scanning GitHub for appids and deleting apps whose keys were published (since mine were committed and pushed to a public repo). But I doubt you were publishing your keys, and they were deleted too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants