Advertisement
Ford

Twitter Quick_Update dll version

Mar 16th, 2011
529
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 6.25 KB | None | 0 0
  1. ;twitter_statuses_update by Ford_Lawnmower irc.GeekShed.net #Script-Help
  2. ;;;;;;;;;;;;;;;;;
  3. ;::Start Setup::;
  4. ;;;;;;;;;;;;;;;;;
  5. ;Edit the lines below to reflect your Twitter Application info.
  6. alias -l consumer_key return PutYourConsumerKeyHere
  7. alias -l consumer_secret return PutYourConsumerSecretHere
  8. alias -l oauth_token return PutYourOauthTokenHere
  9. alias -l oauth_token_secret return PutYourOauthTokenSecretHere
  10. ;;;;;;;;;;;;;;;
  11. ;::End Setup::;
  12. ;;;;;;;;;;;;;;;
  13. ;Syntax quick_update update text here *note* requires that you complete setup
  14. alias quick_update twitter_statuses_update echo -a $consumer_key $consumer_secret $oauth_token $oauth_token_secret $1-
  15. ;Syntax twitter_statuses_update echo -a consumer_key consumer_secret oauth_token oauth_token_secret status update here
  16. ;Note that echo -a can be changed to msg $chan or notice $nick ( must be two words )
  17. alias -l twitter_statuses_update {
  18.   var %ots $ctime, %sockname $+(twitter_statuses_update,$network,$ticks,$r(1,10000)), %once $md5(%sockname)
  19.   var %os $signature(post,http://twitter.com/statuses/update.xml,$3,$4,$5,$6,%once,%ots,$+(status=,$tuenc($7-)))
  20.   sockopen %sockname twitter.com 80
  21.   sockmark %sockname $1-2 $space2comma($+(oauth_nonce=,$qt(%once)) $osmqt $+(oauth_timestamp=,$qt(%ots)) $+(oauth_consumer_key=,$qt($tuenc($3))) $&
  22.     $+(oauth_token=,$qt($tuenc($5))) $+(oauth_signature=,$qt($suenc(%os))) $overqt) $+(status=,$tuenc($7-))
  23. }
  24. on *:sockopen:twitter_statuses_update*: {
  25.   if ($sockerr) echo -st Socket Error $nopath($script)
  26.   else {
  27.     tokenize 32 $sock($sockname).mark
  28.     sockwrite -n $sockname POST /statuses/update.xml HTTP/1.1
  29.     sockwrite -n $sockname Host: twitter.com
  30.     sockwrite -n $sockname User-Agent: Lawnmower 9.64
  31.     sockwrite -n $sockname Authorization: OAuth realm="/statuses/update.xml", $3
  32.     sockwrite -n $sockname Content-Type: application/x-www-form-urlencoded
  33.     sockwrite -n $sockname Content-Length: $len($4)
  34.     sockwrite -n $sockname
  35.     sockwrite -n $sockname $4
  36.     sockwrite -n $sockname
  37.   }
  38. }
  39. on *:sockread:twitter_statuses_update*: {
  40.   if ($sockerr) { $gettok($sock($sockname).mark,1-2,32) Unknown Socket error $nopath($script) }
  41.   else {
  42.     var %twitter_statuses_updatevar | sockread %twitter_statuses_updatevar
  43.     if (HTTP/1.1 401 isin %twitter_statuses_updatevar) {
  44.       $gettok($sock($sockname).mark,1-2,32) Password/Username Error --> %twitter_statuses_updatevar
  45.       sockclose $sockname | return
  46.     }
  47.     elseif (HTTP/1.1 502 isin %twitter_statuses_updatevar) || (HTTP/1.1 503 isin %twitter_statuses_updatevar) {
  48.       $gettok($sock($sockname).mark,1-2,32) Server Busy Error --> %twitter_statuses_updatevar
  49.       sockclose $sockname | return
  50.     }
  51.     elseif (HTTP/1.1 500 isin %twitter_statuses_updatevar) {
  52.       $gettok($sock($sockname).mark,1-2,32) Server Side Error --> %twitter_statuses_updatevar
  53.       sockclose $sockname | return      
  54.     }
  55.     elseif (HTTP/1.1 403 isin %twitter_statuses_updatevar) {
  56.       $gettok($sock($sockname).mark,1-2,32) Connection Actively Refused --> %twitter_statuses_updatevar
  57.       sockclose $sockname | return      
  58.     }
  59.     elseif (HTTP/1.1 400 isin %twitter_statuses_updatevar) {
  60.       $gettok($sock($sockname).mark,1-2,32) Unknown Error --> %twitter_statuses_updatevar
  61.       sockclose $sockname | return
  62.     }
  63.     elseif (HTTP/1.1 200 isin %twitter_statuses_updatevar) {
  64.       $gettok($sock($sockname).mark,1-2,32) Updating Status Please Wait.........
  65.     }
  66.     elseif (</status> isin %twitter_statuses_updatevar) {
  67.       .timer 1 3 $gettok($sock($sockname).mark,1-2,32) Your Status has been updated :)
  68.       sockclose $sockname | return
  69.     }
  70.   }
  71. }
  72. ;Syntax $signature(POST/GET,URL,consumer_key,consumer_secret,oauth_token,oauth_token_secret,oauth_nonce,oauth_timestamp,PostData)
  73. alias -l signature {
  74.   var %method $+($upper($1),&), %url $+($tuenc($2),&), %ck $tuenc&($+(oauth_consumer_key=,$3)), %ot $tuenc&($+(oauth_token=,$5))
  75.   var %once $tuenc&($+(oauth_nonce=,$7)), %ots $tuenc&($+(oauth_timestamp=,$8)), %post $iif($9-,$tuenc($+(&,$9-)))
  76.   return $hmac-sha1($+($4,&,$iif($6,$6)),$+(%method,%url,%ck,%once,$tuenc&($osm),%ots,%ot,$tuenc($over),%post))
  77. }
  78. alias -l osm return oauth_signature_method=HMAC-SHA1
  79. alias -l osmqt return oauth_signature_method="HMAC-SHA1"
  80. alias -l over return oauth_version=1.0
  81. alias -l overqt return oauth_version="1.0"
  82. alias -l tuenc return $regsubex($replace($1-,+,$chr(32)),/([^a-z0-9._-])/ig,% $+ $base($asc(\t),10,16,2))
  83. alias -l suenc return $regsubex($1-,/([^a-z0-9._-])/ig,% $+ $base($asc(\t),10,16,2))
  84. alias -l space2comma return $replace($1-,$chr(32),$chr(44))
  85. alias -l tuenc& return $tuenc($+($1,&))
  86. ;hmacsha1 by Ford_Lawnmower irc.GeekShed.net #Script-Help
  87. ;Syntax hmac-sha1 key message or $hmacsha1(key,message)
  88. alias -l OpenCom {
  89.   if (!$com($2)) .comopen $2 $3
  90.   if ($comerr) {
  91.     .comreg $qt($1)
  92.     if (!$com($2)) .comopen $2 $3
  93.   }
  94. }
  95. alias -l hmac-sha1 {
  96.   if ($exists(hmacsha1.dll)) {
  97.     OpenCom hmacsha1.dll hmacsha1 hmac.sha1
  98.     if (!$com(hmacsha1)) return 1
  99.     var %process $com(hmacsha1,hmacsha1,3,bstr,$2,bstr,$1)
  100.     var %result $com(hmacsha1).result
  101.     if ($com(hmacsha1)) .comclose hmacsha1
  102.     return $remove(%result,$lf)
  103.   }
  104.   else Gethmacsha1Dll
  105. }
  106. alias -l Gethmacsha1Dll GetDll fordlawnmower.googlecode.com /files/hmacsha1.dll $nospace($mircdir) hmacsha1.dll
  107. alias -l GetDll {
  108.   echo -gat Downloading dll. Please retry your update in a few seconds.
  109.   var %dir $nospace($3)
  110.   if ($isfile($qt($+(%dir,$4)))) { .remove $qt($+(%dir,$4)) }
  111.   var %sockname $+(Get.Dll,$ticks,$r(1,$ticks))
  112.   if (!$isdir($qt(%dir))) { mkdir $qt(%dir) }
  113.   sockopen %sockname $1 80
  114.   sockmark %sockname $1-
  115. }
  116. On *:sockopen:Get.Dll*:{
  117.   sockwrite -nt $sockname GET $gettok($sock($sockname).mark,2,32) HTTP/1.0
  118.   sockwrite -n $sockname Host: $+($gettok($sock($sockname).mark,1,32),$str($crlf,2))
  119. }
  120. On *:sockread:Get.Dll*:{
  121.   if (!$gettok($sock($sockname).mark,5,32)) {
  122.     var %GetDll | sockread %GetDll
  123.     if (!%GetDll) { sockmark $sockname $sock($sockname).mark 1 }
  124.   }
  125.   else {
  126.     sockread &GetDll
  127.     bwrite $qt($+($nospace($gettok($sock($sockname).mark,3,32)),$gettok($sock($sockname).mark,4,32))) -1 -1 &GetDll
  128.   }
  129. }
  130. alias -l nospace {
  131.   if ($chr(7) isin $1-) return $replace($1-,$chr(7),$chr(32))
  132.   else return $replace($1-,$chr(32),$chr(7))
  133. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement