Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;twitter_statuses_update by Ford_Lawnmower irc.GeekShed.net #Script-Help
- ;;;;;;;;;;;;;;;;;
- ;::Start Setup::;
- ;;;;;;;;;;;;;;;;;
- ;Edit the lines below to reflect your Twitter Application info.
- alias -l consumer_key return PutYourConsumerKeyHere
- alias -l consumer_secret return PutYourConsumerSecretHere
- alias -l oauth_token return PutYourOauthTokenHere
- alias -l oauth_token_secret return PutYourOauthTokenSecretHere
- ;;;;;;;;;;;;;;;
- ;::End Setup::;
- ;;;;;;;;;;;;;;;
- ;Syntax quick_update update text here *note* requires that you complete setup
- alias quick_update twitter_statuses_update echo -a $consumer_key $consumer_secret $oauth_token $oauth_token_secret $1-
- ;Syntax twitter_statuses_update echo -a consumer_key consumer_secret oauth_token oauth_token_secret status update here
- ;Note that echo -a can be changed to msg $chan or notice $nick ( must be two words )
- alias -l twitter_statuses_update {
- var %ots $ctime, %sockname $+(twitter_statuses_update,$network,$ticks,$r(1,10000)), %once $md5(%sockname)
- var %os $signature(post,http://twitter.com/statuses/update.xml,$3,$4,$5,$6,%once,%ots,$+(status=,$tuenc($7-)))
- sockopen %sockname twitter.com 80
- sockmark %sockname $1-2 $space2comma($+(oauth_nonce=,$qt(%once)) $osmqt $+(oauth_timestamp=,$qt(%ots)) $+(oauth_consumer_key=,$qt($tuenc($3))) $&
- $+(oauth_token=,$qt($tuenc($5))) $+(oauth_signature=,$qt($suenc(%os))) $overqt) $+(status=,$tuenc($7-))
- }
- on *:sockopen:twitter_statuses_update*: {
- if ($sockerr) echo -st Socket Error $nopath($script)
- else {
- tokenize 32 $sock($sockname).mark
- sockwrite -n $sockname POST /statuses/update.xml HTTP/1.1
- sockwrite -n $sockname Host: twitter.com
- sockwrite -n $sockname User-Agent: Lawnmower 9.64
- sockwrite -n $sockname Authorization: OAuth realm="/statuses/update.xml", $3
- sockwrite -n $sockname Content-Type: application/x-www-form-urlencoded
- sockwrite -n $sockname Content-Length: $len($4)
- sockwrite -n $sockname
- sockwrite -n $sockname $4
- sockwrite -n $sockname
- }
- }
- on *:sockread:twitter_statuses_update*: {
- if ($sockerr) { $gettok($sock($sockname).mark,1-2,32) Unknown Socket error $nopath($script) }
- else {
- var %twitter_statuses_updatevar | sockread %twitter_statuses_updatevar
- if (HTTP/1.1 401 isin %twitter_statuses_updatevar) {
- $gettok($sock($sockname).mark,1-2,32) Password/Username Error --> %twitter_statuses_updatevar
- sockclose $sockname | return
- }
- elseif (HTTP/1.1 502 isin %twitter_statuses_updatevar) || (HTTP/1.1 503 isin %twitter_statuses_updatevar) {
- $gettok($sock($sockname).mark,1-2,32) Server Busy Error --> %twitter_statuses_updatevar
- sockclose $sockname | return
- }
- elseif (HTTP/1.1 500 isin %twitter_statuses_updatevar) {
- $gettok($sock($sockname).mark,1-2,32) Server Side Error --> %twitter_statuses_updatevar
- sockclose $sockname | return
- }
- elseif (HTTP/1.1 403 isin %twitter_statuses_updatevar) {
- $gettok($sock($sockname).mark,1-2,32) Connection Actively Refused --> %twitter_statuses_updatevar
- sockclose $sockname | return
- }
- elseif (HTTP/1.1 400 isin %twitter_statuses_updatevar) {
- $gettok($sock($sockname).mark,1-2,32) Unknown Error --> %twitter_statuses_updatevar
- sockclose $sockname | return
- }
- elseif (HTTP/1.1 200 isin %twitter_statuses_updatevar) {
- $gettok($sock($sockname).mark,1-2,32) Updating Status Please Wait.........
- }
- elseif (</status> isin %twitter_statuses_updatevar) {
- .timer 1 3 $gettok($sock($sockname).mark,1-2,32) Your Status has been updated :)
- sockclose $sockname | return
- }
- }
- }
- ;Syntax $signature(POST/GET,URL,consumer_key,consumer_secret,oauth_token,oauth_token_secret,oauth_nonce,oauth_timestamp,PostData)
- alias -l signature {
- var %method $+($upper($1),&), %url $+($tuenc($2),&), %ck $tuenc&($+(oauth_consumer_key=,$3)), %ot $tuenc&($+(oauth_token=,$5))
- var %once $tuenc&($+(oauth_nonce=,$7)), %ots $tuenc&($+(oauth_timestamp=,$8)), %post $iif($9-,$tuenc($+(&,$9-)))
- return $hmac-sha1($+($4,&,$iif($6,$6)),$+(%method,%url,%ck,%once,$tuenc&($osm),%ots,%ot,$tuenc($over),%post))
- }
- alias -l osm return oauth_signature_method=HMAC-SHA1
- alias -l osmqt return oauth_signature_method="HMAC-SHA1"
- alias -l over return oauth_version=1.0
- alias -l overqt return oauth_version="1.0"
- alias -l tuenc return $regsubex($replace($1-,+,$chr(32)),/([^a-z0-9._-])/ig,% $+ $base($asc(\t),10,16,2))
- alias -l suenc return $regsubex($1-,/([^a-z0-9._-])/ig,% $+ $base($asc(\t),10,16,2))
- alias -l space2comma return $replace($1-,$chr(32),$chr(44))
- alias -l tuenc& return $tuenc($+($1,&))
- ;hmacsha1 by Ford_Lawnmower irc.GeekShed.net #Script-Help
- ;Syntax hmac-sha1 key message or $hmacsha1(key,message)
- alias -l OpenCom {
- if (!$com($2)) .comopen $2 $3
- if ($comerr) {
- .comreg $qt($1)
- if (!$com($2)) .comopen $2 $3
- }
- }
- alias -l hmac-sha1 {
- if ($exists(hmacsha1.dll)) {
- OpenCom hmacsha1.dll hmacsha1 hmac.sha1
- if (!$com(hmacsha1)) return 1
- var %process $com(hmacsha1,hmacsha1,3,bstr,$2,bstr,$1)
- var %result $com(hmacsha1).result
- if ($com(hmacsha1)) .comclose hmacsha1
- return $remove(%result,$lf)
- }
- else Gethmacsha1Dll
- }
- alias -l Gethmacsha1Dll GetDll fordlawnmower.googlecode.com /files/hmacsha1.dll $nospace($mircdir) hmacsha1.dll
- alias -l GetDll {
- echo -gat Downloading dll. Please retry your update in a few seconds.
- var %dir $nospace($3)
- if ($isfile($qt($+(%dir,$4)))) { .remove $qt($+(%dir,$4)) }
- var %sockname $+(Get.Dll,$ticks,$r(1,$ticks))
- if (!$isdir($qt(%dir))) { mkdir $qt(%dir) }
- sockopen %sockname $1 80
- sockmark %sockname $1-
- }
- On *:sockopen:Get.Dll*:{
- sockwrite -nt $sockname GET $gettok($sock($sockname).mark,2,32) HTTP/1.0
- sockwrite -n $sockname Host: $+($gettok($sock($sockname).mark,1,32),$str($crlf,2))
- }
- On *:sockread:Get.Dll*:{
- if (!$gettok($sock($sockname).mark,5,32)) {
- var %GetDll | sockread %GetDll
- if (!%GetDll) { sockmark $sockname $sock($sockname).mark 1 }
- }
- else {
- sockread &GetDll
- bwrite $qt($+($nospace($gettok($sock($sockname).mark,3,32)),$gettok($sock($sockname).mark,4,32))) -1 -1 &GetDll
- }
- }
- alias -l nospace {
- if ($chr(7) isin $1-) return $replace($1-,$chr(7),$chr(32))
- else return $replace($1-,$chr(32),$chr(7))
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement