Advertisement
Ford

Twitter Quick_Update for mIRC Edit for mIRC with wine.

Mar 14th, 2011
431
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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 YourConsumerKeyHere
  7. alias -l consumer_secret return YourConsumerSecretHere
  8. alias -l oauth_token return YourOauthTokenHere
  9. alias -l oauth_token_secret return YourOauthTokenSecretHere
  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 $gmt, %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 showsign echo -gat $signature($1,$2)
  74. alias -l signature {
  75.   var %method $+($upper($1),&), %url $+($tuenc($2),&), %ck $tuenc&($+(oauth_consumer_key=,$3)), %ot $tuenc&($+(oauth_token=,$5))
  76.   var %once $tuenc&($+(oauth_nonce=,$7)), %ots $tuenc&($+(oauth_timestamp=,$8)), %post $iif($9-,$tuenc($+(&,$9-)))
  77.   return $hmac-sha1($+($4,&,$iif($6,$6)),$+(%method,%url,%ck,%once,$tuenc&($osm),%ots,%ot,$tuenc($over),%post),$+($ticks,$r(1,1000)))
  78. }
  79. alias -l osm return oauth_signature_method=HMAC-SHA1
  80. alias -l osmqt return oauth_signature_method="HMAC-SHA1"
  81. alias -l over return oauth_version=1.0
  82. alias -l overqt return oauth_version="1.0"
  83. alias -l tuenc return $regsubex($replace($1-,+,$chr(32)),/([^a-z0-9\._-])/ig,% $+ $base($asc(\t),10,16,2))
  84. alias -l tuenc& return $tuenc($+($1,&))
  85. alias -l suenc return $regsubex($1-,/([^a-z0-9\._-])/ig,% $+ $base($asc(\t),10,16,2))
  86. alias -l space2comma return $replace($1-,$chr(32),$chr(44))
  87. ;hmacsha1 by Ford_Lawnmower irc.GeekShed.net #Script-Help
  88. ;Syntax hmacsha1 key message or $hmacsha1(key,message)
  89. alias hmac-sha1 {
  90.   if (!$file($mircdirhmacsha1/hmacsha1.exe)) {
  91.     echo -gst *Error* Missing hmacsha1 application! Attempting to download....
  92.     Gethmacsha1App
  93.   }
  94.   else {
  95.     var %file $qt($+($mircdirhmacsha1/,$3))
  96.     .remove %file
  97.     run -np $mircdirhmacsha1/hmacsha1.exe $1-
  98.     var %count 1
  99.     :check
  100.     if ($file(%file).size != 28 && %count < 150000) {
  101.       inc %count
  102.       goto check
  103.     }
  104.     else {
  105.       var %return $read(%file)
  106.       .remove %file
  107.       $iif($isid,return,echo -a) %return
  108.     }
  109.   }
  110. }
  111. On *:start: if (!$isfile($qt($mircdirhmacsha1/hmacsha1.exe))) Gethmacsha1App
  112. alias -l Gethmacsha1App GetApp fordlawnmower.googlecode.com /files/hmacsha1 $nospace($mircdirhmacsha1\) hmacsha1.exe
  113. alias -l GetApp {
  114.   echo -gat Downloading App. Please wait........
  115.   var %dir $nospace($3)
  116.   if ($isfile($qt($+(%dir,$4)))) { .remove $qt($+(%dir,$4)) }
  117.   var %sockname $+(Get.App,$ticks,$r(1,$ticks))
  118.   if (!$isdir($qt(%dir))) { mkdir $qt(%dir) }
  119.   sockopen %sockname $1 80
  120.   sockmark %sockname $1-
  121. }
  122. On *:sockopen:Get.App*:{
  123.   sockwrite -nt $sockname GET $gettok($sock($sockname).mark,2,32) HTTP/1.0
  124.   sockwrite -n $sockname Host: $+($gettok($sock($sockname).mark,1,32),$str($crlf,2))
  125. }
  126. On *:sockread:Get.App*:{
  127.   if (!$gettok($sock($sockname).mark,5,32)) {
  128.     var %GetApp | sockread %GetApp
  129.     if (!%GetApp) { sockmark $sockname $sock($sockname).mark 1 }
  130.   }
  131.   else {
  132.     sockread &GetApp
  133.     bwrite $qt($+($nospace($gettok($sock($sockname).mark,3,32)),$gettok($sock($sockname).mark,4,32))) -1 -1 &GetApp
  134.   }
  135. }
  136. On *:sockclose:Get.App*: {
  137.   if (!$sockerr) {
  138.     .timer 1 10 echo -gat Download Complete!
  139.   }
  140. }
  141. alias -l nospace {
  142.   if ($chr(7) isin $1-) return $replace($1-,$chr(7),$chr(32))
  143.   else return $replace($1-,$chr(32),$chr(7))
  144. }
Advertisement
RAW Paste Data Copied
Advertisement