Prowl API with mIRC

An iPhone client for Growl available on the App Store.
Post Reply
FordLawnmower
Harmless
Posts: 1
Joined: Sun Jul 19, 2009 11:41 pm

Prowl API with mIRC

Post by FordLawnmower »

Someone asked me the other day to make an alias for mIRC to send a message from irc to their iphone using Prowls api. I didn't find anything related to mIRC here so I thought I would just post my alias here incase someone else is trying to bridge the gap between mIRC and Prowl.

Code: Select all

;Installation of OpenSSL is required to use Prowl api --->>  http://www.mirc.com/download/openssl-0.9.8k-setup.exe
;Install OpenSSL and then restart mIRC before using this script.
;Prowl API Script by Ford_Lawnmower irc.mindforge.org #USA-Chat
;Alias Syntax /Prowl apikey priority event-must-be-one-string text to send.
alias Prowl {
  if ($2 !isnum -2-2) || (!$4) { echo -st Syntax is /Prowl apikey priority event-must-be-one-string text to send. -- Priority must be a number between -2 and 2. | return }
  sockopen -e prowl prowl.weks.net 443
  sockmark prowl $1 $2 $+(mIRC,$version) $fixurl($3) $fixurl($4-)
}
On *:sockopen:prowl:{
  tokenize 32 $sock($sockname).mark
  sockwrite -nt $sockname GET $+(/publicapi/add?apikey=,$1,&priority=,$2,&application=,$3,&event=,$4,&description=,$5-)
  sockwrite -n  $sockname Host: prowl.weks.net $+ $+($crlf,2)
}
On *:sockread:prowl:{
  if (!$sockerr) {
    var %prowl | sockread %prowl
    if (<success code isin %prowl) { echo -at 07Message sent Successfully!  | sockclose $sockname }
    if (<error code isin %prowl) { echo -at 04An error occurred. Your message was not sent! | sockclose $sockname }
  }
}
alias -l fixurl return $regsubex($1-,/([^a-z0-9])/ig,% $+ $base($asc(\t),10,16,2))
The above alias will send a message through Prowls api with the following syntax -- /Prowl apikey priority event-must-be-one-string text to send.

Here is a small example script that will send a message through Prowl everytime someone says your current irc nickname.

Code: Select all

menu status,channel {
  Prowl Highlight
  .Set api key: set %prowlapikey $$?"Enter Your Prowl API Key"
  .$iif(!%prowlapikey,$style(2)) Prowl Highlight On:.enable #prowl
  .$iif($group(#prowl) == off,$style(2)) Prowl Hightlight Off:.disable #prowl
}
#prowl off
On *:text:*:*:{
  if ($istok($strip($1-),$me,32)) && (%Prowlapikey) {
    if ($timer($+(prowl,$nick,$network))) { return }
    .timer $+ $+(prowl,$nick,$network) 1 5 noop
    Prowl %prowlapikey 1 Highlight $nick said: $1-
  }
}
#prowl end
To use the example code, just add it to a remote with the prowl alias, add your apikey from the right click menu, and turn the script on from the right click menu.
**note** If you missed this in the code notes, Installation of openssl is required to run this script. You can get it here if you don't already have it --->>> http://www.mirc.com/download/openssl-0.9.8k-setup.exe

After installing openssl you will have to restart mIRC for it to take effect.
I hope this helps someone :)
Post Reply