Advertisement
Ford

Twitter Update No .dll

Mar 12th, 2011
435
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 ConsumerKeyHere
  7. alias -l consumer_secret return ConsumerSecretHere
  8. alias -l oauth_token return OauthTokenHere
  9. alias -l oauth_token_secret return OauthTokenSecretHere
  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 $hmacsha1($+($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. alias -l hmacsha1 {
  87. var %key $iif($len($1) <= 64,$1,$hex2chr($sha1_($1))), %ipad $xorall($str(6,64),%key), %opad = $xorall(%opad $str(\,64),%key), %message $2
  88. return $encode_($hex2chr($sha1_($+(%opad,$hex2chr($sha1_($+(%ipad,%message)))))),m)
  89. }
  90.  
  91. alias -l hex2chr { return $regsubex($1,/(.{2})/g,$chr($base(\t,16,10))) }
  92. alias -l xorall {
  93. var %end $iif($len($1) > $len($2),$len($1),$len($2)), %p $1, %k $2
  94. return $regsubex($str(.,%end),/(.)/g,$chr($xor($iif($asc($mid(%p,\n,1)),$v1,0),$iif($asc($mid(%k,\n,1)),$v1,0))))
  95. }
  96.  
  97. alias -l sha1_ {
  98. if ($version >= 7) {
  99. bset -c &a 1 $regsubex($1, /(*UTF8)(.)/gs, $asc(\1) $chr(32))
  100. return $sha1(&a, 1)
  101. }
  102. else return $sha1($1)
  103. }
  104.  
  105. alias -l encode_ {
  106. if ($version >= 7) {
  107. bset -c &a 1 $regsubex($1, /(*UTF8)(.)/gs, $asc(\1) $chr(32))
  108. noop $encode(&a, mb)
  109. returnex $bvar(&a, 1-).text
  110. }
  111. else return $encode($1,m)
  112. }
Advertisement
RAW Paste Data Copied
Advertisement