HowTo for getting PUSH notifications while Rooms is offline (BNC needed)

(if you have some more good ideas, just send me an email)

Although it's not the best practice to use Apple's push notification service, it's still a nice little workaround until I provide a solution which I think is ready for public use ;-)

What it does

The scripting addons at the bottom make your BNC listen for private messages and for special words within you channel. It then sends them using Prowl to your iPhone.
Since most BNCs - like psyBNC for example - also provide the need information, it only sends this while you are NOT connected to the BNC for sure. ;-)
I also  asked the Zac in the Prowl forum for a new feature to also link those Prowl Push messages directly to an iPhone app, so lets see if we also can get this to work.



What you need



HowTo …

At first you need to install Prowl on your iPhone,  make yourself an account and insert the login into Prowl on your iPhone.

You can then check if Prowl is working correct by using their  web form(you need to be logged in at their page).

In order to let external programs send messages using the Prowl service you'll need  your personal API key now.

Now all we finally need is to tell our BNC to send us those messages automatically ;-)
On most BNCs this means we just have add some scripts to it...

... for psyBNC

Let's say you already have your USER1 set up correctly on psyBNC and you already joined the channel #testchannel.
Open the file USER1.SCRIPT within psyBNC's ./scripts/ folder or create it if it doesn't exist.

Your final script may be different but here's a example to add to the file:

Listen for private messages, nick alerts & word highlights (just replace YOURNICKNAME & #testchannel within the 'word highlight' and YOURAPIKEY within URLs at the end)

; Prowl PUSH Addon v0.2 (by DerFlash)
;
; Changes:
;    v0.2:
;      * Added '-O /dev/null' again to prevent wget from spamming into the psyBNC directory.

; Prowl - query & nick-alert (if user is on AND (its a pm OR it contains the usernick))
server PRIVMSG * * *     if [[ $USERON == 0 ]] && ( [[ $P3 == $USERNICK ]] || [[ `echo $CONTENT | grep -ci $USERNICK` != 0 ]] ); then FC1=$(echo "$NICK @ $(if [[ $P3 == $USERNICK ]]; then echo 'IRC'; else echo $P3; fi )" | perl -MURI::Escape -lne 'print uri_escape($_)'); FC2=$(echo "$CONTENT" | perl -MURI::Escape -lne 'print uri_escape($_)'); wget -q -O /dev/null --no-check-certificate "https://prowl.weks.net/publicapi/add?apikey=YOURAPIKEY&priority=0&application=$FC1&description=$FC2+http%3A%2F%2Fopen.roomsapp.mobi" > /dev/null; fi

; Prowl - word highlight
server PRIVMSG * #testchannel "*YOURNICKNAME*"     if [[ $USERON == 0 ]]; then FC1=$(echo "$NICK @ $CHANNEL" | perl -MURI::Escape -lne 'print uri_escape($_)'); FC2=$(echo "$CONTENT" | perl -MURI::Escape -lne 'print uri_escape($_)'); wget -q -O /dev/null --no-check-certificate "https://prowl.weks.net/publicapi/add?apikey=YOURAPIKEY&priority=0&application=$FC1&description=$FC2+http%3A%2F%2Fopen.roomsapp.mobi" > /dev/null; fi

... for sBNC

Manuel wrote me this tcl script. I did not check this script yet, but maybe someone can just try it out and give me some feedback.

# Quick and dirty hack for Prowl notifications with sBNC
# Thanks to irc-guide.de for tcl-tutorials
#
# by Manuel Hergenröder

internalbind server prowl:log

proc prowl:log {client parameters} {
	set prowluser "INSERTSBNCUSERHERE"

    if {[string equal [getctx] $prowluser] && ![getbncuser $client hasclient]} {
        if {[string match -nocase *${::botnick}* [lindex $parameters 3]]} {
        	set msg "Channel [lrange $parameters 2 2] - [lrange $parameters 0 0]: [lrange $parameters 3 end]"
	    	set msg_escaped [exec echo $msg | perl -MURI::Escape -lne "print uri_escape(\$_)"]
	    	exec wget -q -O /dev/null --no-check-certificate https://prowl.weks.net/publicapi/add?apikey=APIKEY&priority=0&application=sBNC&event=Channel&description=$msg_escaped > /dev/null
        }
        if {[string match -nocase *${::botnick}* [lindex $parameters 2]]} {
	    	set msg "[lrange $parameters 0 0]: [lrange $parameters 3 end]"
	    	set msg_escaped [exec echo $msg | perl -MURI::Escape -lne "print uri_escape(\$_)"]
	    	exec wget -q -O /dev/null --no-check-certificate https://prowl.weks.net/publicapi/add?apikey=APIKEY&priority=0&application=sBNC&event=Qry&description=$msg_escaped > /dev/null
        }
    }
}