FordLawnmower commented on a Page, Bitly url shortener  -  Mar 26, 2010

Sure Luke. Here it is:

;lshort Url Shortener by Ford_Lawnmower irc.mindforge.org #USA-Chat
menu Channel,Status {
  .$iif($group(#lshort) == On,$style(1)) lshort Trigger
  ..$iif($group(#lshort) == On,$style(2)) On: .enable #lshort
  ..$iif($group(#lshort) == Off,$style(2)) Off: .disable #lshort
}
#lshort on
On $*:Text:/^(!|@)lshort.*/Si:#: {
  if ($timer($+(lshort,$network,$nick))) { return }
  .timer $+ $+(lshort,$network,$nick) 1 6 noop
  var %method $iif($regml(1) == !,.notice $nick,$iif($regex($nick($chan,$nick).pnick,/(!|~|&|@|%)/),.msg $chan,.notice $nick))
  Getlshort %method $2-
}
#lshort end
alias lshort { Getlshort echo -a $1- }
alias -l Getlshort {
  $1-2 07Searching ........
  var %sockname $+(lshort,$network,$2,$ticks)
  sockopen %sockname lshort.co.cc 80
  sockmark %sockname $1-2 $+(/index.php?url=,$3,&alias=,$4)
}
On *:sockopen:lshort*: {
  if (!$sockerr) {
    sockwrite -nt $sockname GET $gettok($sock($sockname).mark,3,32) HTTP/1.0
    sockwrite -n $sockname Host: lshort.co.cc
    sockwrite -n $sockname $crlf
  }
  else { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
}
On *:sockread:lshort*: {
  if ($sockerr) { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
  else {
    var %lshort | sockread %lshort
    if ($regex(%lshort,/<p><strong>([^<]*)<\/strong><br\s\/>/)) {
      $gettok($sock($sockname).mark,1-2,32) 04l06s07h09o03r06t 04» $+(07,$regml(1),)
    }
  }
}

The alias function also works on this. Example:
!lshort google.com mazogoogle
Will return -->> http://lshort.co.cc/mazogoogle

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.