Just a little script to update your Twitter Status. I just made an account for writing this script, but this seems like it could be useful for updating your status. You could definitely use the alias twitterup to make a script to update your status from a timer. Anyway, I've tested this over and over, the only flaw I found, is that the "Remember Me" function, doesn't work if you have $decode disabled in mirc options. Other than that, I can't find anything wrong with it.
The character counter gets lost for a second, if you try to paste more than 140 characters into the update box, but as soon as you click the edit screen again, it catches up.
Just added a direct message system with tons of new routines. If you have the old one, unload it first. Direct message is on the menu.
;Twitter Status update Script by Ford_Lawnmower
;Added DirectMessage 04/02/2009
;If you have the Original Twitter Update loaded - Unload it before using this. Alot of the same variable names are used in this.
;While I have constantly tested this with each change in code, there could still be some bugs in it. Please let me know if you find any. I know it's a monstrosity,
;There is also some code here that is only currently being used for my testing with twitters api. Enjoy :) I think it works very well. My next update will be a
;fully functional Twitter Home script :) I have a few other twitter related projects going too. Too see, you can follow me -> http://twitter.com/FordLawnmower
;This script is pretty straight forward. The dialog works just like the one on the site. Just enter your username and password, type your status update in the box,
;and click update. Your password is encrypted by mirc with mime encryption, so if you want to use the "Remember Me" function, You can't have $decode locked out
;in your mirc options. To see if you have it locked, goto tools, options, other, lock. Look to the right and see if decode is checked. Uncheck it to use the
;"Remember Me" function. Using encryption to store the password was the only option that made any sense to me. If someone has a suggestion I'm all ears :P
;Questions, Comments, You can find me on WyldRyde in #Script-Help, SwiftIRC #Technical,#AtomReactor, Abjects #Technical, #AtomReactor, #USA-Chat
;And MindForge #Technical,#AtomReactor,#Hollywood,#USA,#Emule-USA
menu * {
Twitter
.TwitterUpdate:TwitterUpdate
.TwitterDirectMessage:TwitterDirectMessage
}
dialog TwitterUpdate {
title "TwitterUpdate"
size -1 -1 112 128
option dbu
edit "", 1, 40 8 66 10, autohs
edit "", 2, 40 24 66 10, pass autohs
edit "", 3, 8 56 98 34, multi return autovs limit 140
text "User Name:", 4, 0 8 33 8, right
text "Password", 5, 0 24 33 8, right
text "", 6, 80 48 25 8, right
button "Update", 7, 12 96 37 12
button "Close", 8, 65 96 37 12, cancel
check "Remember Me", 9, 56 34 50 10, left
text "", 10, 0 112 113 16, center
button "Clear", 11, 10 43 23 12
}
On *:Dialog:TwitterUpdate:Sclick:11: {
did -r TwitterUpdate 3
did -a TwitterUpdate 6 140
did -a TwitterUpdate 10
}
On *:Dialog:TwitterUpdate:Sclick:9: {
if ($did(TwitterUpdate,9).state) {
did -a TwitterUpdate 10 You can only set Remember if decode is enabled. Tools,options,other,lock to enable.
if ($did(TwitterUpdate,9).state) { .timer 1 3 did -a TwitterUpdate 10 If you have decode blocked in options uncheck the Remember box. }
.timer 1 9 did -a TwitterUpdate 10
}
}
On *:Dialog:TwitterUpdate:Sclick:7: {
if ($did(TwitterUpdate,9).state) && ($did(TwitterUpdate,1).text) && ($did(TwitterUpdate,2).text) {
set %Global.TwitterUpdate.info $encode($+($did(TwitterUpdate,1).text,:,$did(TwitterUpdate,2).text),m)
}
if (!$did(TwitterUpdate,1).text) {
did -f TwitterUpdate 1
did -a TwitterUpdate 10 You must enter your Registered Twitter user name
.timer 1 4 did -a TwitterUpdate 10
return
}
if (!$did(TwitterUpdate,2).text) {
did -f TwitterUpdate 2
did -a TwitterUpdate 10 You must enter your Registered Twitter Password
.timer 1 4 did -a TwitterUpdate 10
return
}
if (!$did(TwitterUpdate,3).text) {
did -f TwitterUpdate 3
did -a TwitterUpdate 10 You must enter Some text for your update ;/
.timer 1 4 did -a TwitterUpdate 10
return
}
if ($did(TwitterUpdate,9).state) && ($did(TwitterUpdate,1).text) && ($did(TwitterUpdate,2).text) {
set %Global.TwitterUpdate.info $encode($+($did(TwitterUpdate,1).text,:,$did(TwitterUpdate,2).text),m)
}
if (!$did(TwitterUpdate,9).state) { unset %Global.TwitterUpdate.info }
TwitterUp $+($did(TwitterUpdate,1).text,:,$did(TwitterUpdate,2).text) $+($did(TwitterUpdate,3,1).text,$&
$did(TwitterUpdate,3,2).text,$did(TwitterUpdate,3,3).text,$did(TwitterUpdate,3,4))
}
On *:Dialog:TwitterUpdate:Edit:3: {
set %TwitterUpdate.Words $calc($did(TwitterUpdate,3,1).len + $did(TwitterUpdate,3,2).len + $did(TwitterUpdate,3,3).len + $did(TwitterUpdate,3,4).len)
did -a TwitterUpdate 6 $calc(140 - %TwitterUpdate.Words)
}
On *:Dialog:TwitterUpdate:init:*: {
if (%Global.TwitterUpdate.info) {
did -a TwitterUpdate 1 $gettok($decode(%Global.TwitterUpdate.info,m),1,58)
did -a TwitterUpdate 2 $gettok($decode(%Global.TwitterUpdate.info,m),2,58)
did -c TwitterUpdate 9
}
did -a TwitterUpdate 6 140
}
alias TwitterDirectMessage {
if (!$dialog(Twitter_DM)) { dialog -m Twitter_DM Twitter_DM }
else { echo -a TwitterDirectMessage already opened }
}
alias TwitterUpdate {
if (!$dialog(TwitterUpdate)) { dialog -m TwitterUpdate TwitterUpdate }
else { echo -a TwitterUpdate is already opened }
}
alias -l TwitterUp.timeout {
if ($dialog(TwitterUpdate)) {
did -a TwitterUpdate 10 Unknown Error - Update Not complete
.timer 1 4 did -a TwitterUpdate 10
}
else {
echo -a Unknown Error - Update Not complete
}
TwitterUp.clear
}
alias -l TwitterUp.clear {
unset %TwitterUp*
sockclose TwitterUp
.timer-TwitterUp off
halt
}
;Syntax $1=username:password $2-=Twitter Update message
alias TwitterUp {
sockclose TwitterUp
.set %TwitterUp.Info $encode($1,m)
set %TwitterUp.Update $+(status=,$fixurl($2-))
set %TwitterUpurl /statuses/update.xml
set %TwitterUpsite twitter.com
sockopen TwitterUp %TwitterUpsite 80
.timer-TwitterUp 1 15 TwitterUp.timeout
}
on *:sockopen:TwitterUp: {
sockwrite -n $sockname POST %TwitterUpurl HTTP/1.1
sockwrite -n $sockname Host: %TwitterUpsite
sockwrite -n $sockname User-Agent: Twitter-IRC
sockwrite -n $sockname Authorization: Basic %TwitterUp.info
sockwrite -n $sockname Content-Type: application/x-www-form-urlencoded
sockwrite -n $sockname Content-Length: $len(%TwitterUp.Update)
sockwrite -n $sockname
sockwrite -n $sockname %TwitterUp.Update
sockwrite -n $sockname
}
on *:sockread:TwitterUp: {
if ($sockerr > 0) { echo -a Unknown Socket error | TwitterUp.clear }
else {
var %TwitterUpvar | sockread %TwitterUpvar
if (HTTP/1.1 401 isin %TwitterUpvar) {
if ($dialog(TwitterUpdate)) {
did -a TwitterUpdate 10 Password/Username Error --> %TwitterUpvar
did -f TwitterUpdate 2
.timer 1 6 did -a TwitterUpdate 10
}
else {
echo -a Password/Username Error --> %TwitterUpvar
}
TwitterUp.Clear
}
if (HTTP/1.1 502 isin %TwitterUpvar) || (HTTP/1.1 503 isin %TwitterUpvar) {
if ($dialog(TwitterUpdate)) {
did -a TwitterUpdate 10 Server Busy Error --> %TwitterUpvar
.timer 1 6 did -a TwitterUpdate 10
}
else {
echo -a Server Busy Error --> %TwitterUpvar
}
TwitterUp.Clear
}
if (HTTP/1.1 500 isin %TwitterUpvar) {
if ($dialog(TwitterUpdate)) {
did -a TwitterUpdate 10 Server Side Error --> %TwitterUpvar
.timer 1 6 did -a TwitterUpdate 10
}
else {
echo -a Server Side Error --> %TwitterUpvar
}
TwitterUp.Clear
}
if (HTTP/1.1 403 isin %TwitterUpvar) {
if ($dialog(TwitterUpdate)) {
did -a TwitterUpdate 10 Connection Actively Refused --> %TwitterUpvar
.timer 1 6 did -a TwitterUpdate 10
}
else {
echo -a Connection Actively Refused --> %TwitterUpvar
}
TwitterUp.Clear
}
if (HTTP/1.1 400 isin %TwitterUpvar) {
if ($dialog(TwitterUpdate)) {
did -a TwitterUpdate 10 Unknown Error --> %TwitterUpvar
.timer 1 6 did -a TwitterUpdate 10
}
else {
echo -a Unknown Error --> %TwitterUpvar
}
TwitterUp.Clear
}
if (HTTP/1.1 200 isin %TwitterUpvar) {
if ($dialog(TwitterUpdate)) {
did -a TwitterUpdate 10 Updating Status Please Wait.........
}
else {
echo -a Updating Status Please Wait.........
}
}
if (</status> isin %TwitterUpvar) {
if ($dialog(TwitterUpdate)) {
.timer 1 3 did -a Twitterupdate 10 Your Status has been updated :)
}
else {
.timer 1 3 echo -a Your Status has been updated :)
}
TwitterUp.Clear
}
}
}
;alias fixurl by GiGiGlum - Thanks GiGi :)
alias -l fixurl return $regsubex($1-,/([^a-z0-9])/ig,% $+ $base($asc(\t),10,16,2))
alias -l httpstrip {
var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, )
return %x
}
;Start of scripts for DirectMessage
;Start twitterfriends alias
alias -l TwitterFriends.timeout {
did -a Twitter_DM 10 Unknown Error - Friends Update Not complete
.timer 1 4 did -a Twitter_DM 10
TwitterFriends.clear
}
alias -l TwitterFriends.clear {
unset %TF*
unset %TwitterFriends*
sockclose TwitterFriends
.timer-TwitterFriends off
halt
}
;Syntax $1=username:password
alias TwitterFriends {
if (!$hget(TwitterFriends)) { hmake -s TwitterFriends 10 }
sockclose TwitterFriends
.set %TwitterFriends.Info $encode($1,m)
set %TwitterFriendsurl /statuses/friends.xml
set %TwitterFriendssite twitter.com
sockopen TwitterFriends %TwitterFriendssite 80
.timer-TwitterFriends 1 25 TwitterFriends.timeout
}
on *:sockopen:TwitterFriends: {
sockwrite -n $sockname GET %TwitterFriendsurl HTTP/1.0
sockwrite -n $sockname Host: %TwitterFriendssite
sockwrite -n $sockname User-Agent: Twitter-IRC
sockwrite -n $sockname Authorization: Basic %TwitterFriends.info
sockwrite -n $sockname Content-Type: application/x-www-form-urlencoded
sockwrite -n $sockname
}
on *:sockread:TwitterFriends: {
if ($sockerr > 0) { echo -a Unknown Socket error | TwitterFriends.clear }
else {
var %TwitterFriendsvar | sockread %TwitterFriendsvar
if (HTTP/1.1 401 isin %TwitterFriendsvar) {
did -a Twitter_DM 10 Password/Username Error --> %TwitterFriendsvar
;need to add a call to login here
did -f Twitter_DM 2
.timer 1 6 did -a Twitter_DM 10
TwitterFriends.Clear
}
if (HTTP/1.1 502 isin %TwitterFriendsvar) || (HTTP/1.1 503 isin %TwitterFriendsvar) {
did -a Twitter_DM 10 Server Busy Error --> %TwitterFriendsvar
.timer 1 6 did -a Twitter_DM 10
TwitterFriends.Clear
}
if (HTTP/1.1 500 isin %TwitterFriendsvar) {
did -a Twitter_DM 10 Server Side Error --> %TwitterFriendsvar
.timer 1 6 did -a Twitter_DM 10
TwitterFriends.Clear
}
if (HTTP/1.1 403 isin %TwitterFriendsvar) {
did -a Twitter_DM 10 Connection Actively Refused --> %TwitterFriendsvar
.timer 1 6 did -a Twitter_DM 10
TwitterFriends.Clear
}
if (HTTP/1.1 400 isin %TwitterFriendsvar) {
did -a Twitter_DM 10 Unknown Error --> %TwitterFriendsvar
.timer 1 6 did -a Twitter_DM 10
TwitterFriends.Clear
}
if (HTTP/1.1 200 isin %TwitterFriendsvar) {
did -a Twitter_DM 10 Updating Status Please Wait.........
hdel -w TwitterFriends *
}
if (<name> isin %TwitterFriendsvar) {
if (%TF.name) { hadd TwitterFriends %TF.name $+(<sn>,%TF.sname,</sn>,<i>,%TF.image,</i>,<t>,%TF.text,</t>,<u>,%TF.url,</u>,<d>,%TF.desc,</d>,<l>,%TF.loc,</l>) }
set %TF.name $replace($remove(%TwitterFriendsvar,<name>,</name>),$chr(32),$chr(7))
}
if (<Screen_name> isin %TwitterFriendsvar) { set %TF.sname $remove(%TwitterFriendsvar,<screen_name>,</screen_name>) }
if (<profile_image_url> isin %TwitterFriendsvar) { set %TF.image $remove(%TwitterFriendsvar,<profile_image_url>,</profile_image_url>) }
if (<text> isin %TwitterFriendsvar) { set %TF.text $remove(%TwitterFriendsvar,<text>,</text>) }
if (<url> isin %TwitterFriendsvar) { set %TF.url $remove(%TwitterFriendsvar,<url>,</url>) }
if (<description> isin %TwitterFriendsvar) { set %TF.desc $remove(%TwitterFriendsvar,<description>,</description>) }
if (<location> isin %TwitterFriendsvar) { set %TF.loc $remove(%TwitterFriendsvar,<location>,</location>) }
if (</users> isin %TwitterFriendsvar) {
hadd TwitterFriends %TF.name $+(<sn>,%TF.sname,</sn>,<i>,%TF.image,</i>,<t>,%TF.text,</t>,<u>,%TF.url,</u>,<d>,%TF.desc,</d>,<l>,%TF.loc,</l>)
did -a Twitter_DM 10
TwitterFriends.Clear
}
}
}
alias listfriends {
var %listcount = $hget(TwitterFriends,0).item
while %listcount {
echo -a %listcount $hget(TwitterFriends,%listcount).item $hget(TwitterFriends,%listcount).data
dec %listcount
}
}
alias -l TwitterDM.timeout {
did -a Twitter_DM 10 Unknown Error - Update Not complete
.timer 1 4 did -a Twitter_DM 10
TwitterDM.clear
}
alias -l TwitterDM.clear {
unset %TwitterDM*
sockclose TwitterDM
.timer-TwitterDM off
halt
}
;Syntax $1=username:password $2=DirectName $3-=Twitter Update message
alias TwitterDM {
sockclose TwitterDM
set %TwitterDM.User $fixurl($2)
.set %TwitterDM.Info $encode($1,m)
set %TwitterDM.Update $+(text=,$fixurl($3-))
set %TwitterDMurl /direct_messages/new.xml
set %TwitterDMsite twitter.com
sockopen TwitterDM %TwitterDMsite 80
.timer-TwitterDM 1 15 TwitterDM.timeout
}
on *:sockopen:TwitterDM: {
sockwrite -n $sockname POST %TwitterDMurl HTTP/1.1
sockwrite -n $sockname Host: %TwitterDMsite
sockwrite -n $sockname User-Agent: Twitter-IRC
sockwrite -n $sockname Authorization: Basic %TwitterDM.info
sockwrite -n $sockname Content-Type: application/x-www-form-urlencoded
sockwrite -n $sockname Content-Length: $calc(6 + $len(%TwitterDM.User) + $len(%TwitterDM.Update))
sockwrite -n $sockname
sockwrite -n $sockname user= $+ %TwitterDM.User $+ & $+ %TwitterDM.Update
sockwrite -n $sockname
}
on *:sockread:TwitterDM: {
if ($sockerr > 0) { echo -a Unknown Socket error | TwitterDM.clear }
else {
var %TwitterDMvar | sockread %TwitterDMvar
if (HTTP/1.1 401 isin %TwitterDMvar) {
did -a Twitter_DM 10 Password/Username Error --> %TwitterDMvar
did -f Twitter_DM 2
.timer 1 6 did -a Twitter_DM 10
TwitterDM.Clear
}
if (HTTP/1.1 502 isin %TwitterDMvar) || (HTTP/1.1 503 isin %TwitterDMvar) {
did -a Twitter_DM 10 Server Busy Error --> %TwitterDMvar
.timer 1 6 did -a Twitter_DM 10
TwitterDM.Clear
}
if (HTTP/1.1 500 isin %TwitterDMvar) {
did -a Twitter_DM 10 Server Side Error --> %TwitterDMvar
.timer 1 6 did -a Twitter_DM 10
TwitterDM.Clear
}
if (HTTP/1.1 403 isin %TwitterDMvar) {
did -a Twitter_DM 10 Connection Actively Refused --> %TwitterDMvar
.timer 1 6 did -a Twitter_DM 10
TwitterDM.Clear
}
if (HTTP/1.1 400 isin %TwitterDMvar) {
did -a Twitter_DM 10 Unknown Error --> %TwitterDMvar
.timer 1 6 did -a Twitter_DM 10
TwitterDM.Clear
}
if (HTTP/1.1 200 isin %TwitterDMvar) {
did -a Twitter_DM 10 Sending Message Please Wait.........
}
if (</direct_message> isin %TwitterDMvar) {
did -r Twitter_DM 2
did -a Twitter_DM 11 140
.timer 1 3 did -a Twitter_DM 10 Message Sent :)
.timer 1 6 did -a Twitter_DM 10
TwitterDM.Clear
}
}
}
;Start Twitter followers - Direct message Dialogs
dialog Twitter_Login {
title "Twitter Login"
size -1 -1 104 57
option dbu
edit "", 1, 32 8 66 10, autohs
edit "", 2, 32 24 66 10, pass autohs
check "Remember Me", 3, 48 34 50 10, left
text "User Name", 4, 0 9 33 8, center
text "Password", 5, 0 25 33 8, center
button "Accept", 6, 6 45 29 12
button "Cancel", 7, 70 45 29 12
}
dialog Twitter_DM {
title "Twitter Direct Message"
size -1 -1 146 200
option dbu
combo 1, 24 48 76 10, drop
edit "", 2, 8 64 130 26, multi
button "Send", 3, 106 92 29 12
button "InBox", 4, 32 104 29 12
button "Sent", 5, 72 104 29 12
edit "" ,6, 8 120 130 58, multi read hsbar vsbar
button "Close", 7, 32 178 77 12, cancel
text "Send", 8, 0 49 21 8, right
text "A Direct Message", 9, 100 49 47 8, center
text "", 10, 0 192 145 8, center
text "", 11, 9 90 25 8
edit "", 12, 40 8 58 10, autohs
edit "", 13, 40 24 58 10, pass autohs
text "User Name", 14, 0 9 33 8, center
text "Password", 15, 0 25 33 8, center
check "Remember Me", 16, 48 34 50 10, left
button "Login/Update", 17, 104 24 37 12
}
On *:Dialog:Twitter_DM:Sclick:17: {
if ($did(Twitter_DM,12).text) && ($did(Twitter_DM,13).text) {
Twitterfollowers $+($did(Twitter_DM,12).text,:,$did(Twitter_DM,13).text)
.timer 1 3 TwitterDMR $+($did(Twitter_DM,12).text,:,$did(Twitter_DM,13).text)
if ($did(Twitter_DM,16).state) { set %Global.TwitterUpdate.info $encode($+($did(Twitter_DM,12).text,:,$did(Twitter_DM,13).text),m) }
}
else {
did -a Twitter_DM 10 User Name and Password Needed
did -f Twitter_DM 12
.timer 1 3 did -a Twitter_DM 10
}
}
On *:Dialog:Twitter_DM:Sclick:16: {
if ($did(Twitter_DM,16).state) {
if ($did(Twitter_DM,12).text) && ($did(Twitter_DM,13).text) {
set %Global.TwitterUpdate.info $encode($+($did(Twitter_DM,12).text,:,$did(Twitter_DM,13).text),m)
}
}
else { unset %Global.TwitterUpdate.info }
}
On *:Dialog:Twitter_DM:Sclick:5: {
if ($did(Twitter_DM,12).text) && ($did(Twitter_DM,13).text) {
TwitterDMS $+($did(Twitter_DM,12).text,:,$did(Twitter_DM,13).text)
}
else {
did -a Twitter_DM 10 User Name and Password Needed
did -f Twitter_DM 12
.timer 1 3 did -a Twitter_DM 10
}
}
On *:Dialog:Twitter_DM:Sclick:4: {
if ($did(Twitter_DM,12).text) && ($did(Twitter_DM,13).text) {
TwitterDMR $+($did(Twitter_DM,12).text,:,$did(Twitter_DM,13).text)
}
else {
did -a Twitter_DM 10 User Name and Password Needed
did -f Twitter_DM 12
.timer 1 3 did -a Twitter_DM 10
}
}
On *:Dialog:Twitter_DM:Sclick:3: {
if ($did(Twitter_DM,12).text) && ($did(Twitter_DM,13).text) {
if (!$did(Twitter_DM,1).sel) {
did -a Twitter_DM 10 Select a Follower from the list to send your message to.
did -f Twitter_DM 1
.timer 1 3 did -a Twitter_DM 10
return
}
if (!$did(Twitter_DM,2).text) {
did -a Twitter_DM 10 Type some text in the box to send to $did(Twitter_DM,1).seltext
did -f Twitter_DM 2
.timer 1 3 did -a Twitter_DM 10
return
}
var %TwitterDM.Message = $left($+($did(Twitter_DM,2,1).text,$did(Twitter_DM,2,2).text,$did(Twitter_DM,2,3).text),140)
TwitterDM $+($did(Twitter_DM,12).text,:,$did(Twitter_DM,13).text) $did(Twitter_DM,1).seltext %TwitterDM.Message
}
else {
did -a Twitter_DM 10 User Name and Password Needed
did -f Twitter_DM 12
.timer 1 3 did -a Twitter_DM 10
}
}
On *:Dialog:Twitter_DM:Edit:2: {
set %TwitterFollowers.Words $calc($did(Twitter_DM,2,1).len + $did(Twitter_DM,2,2).len + $did(Twitter_DM,2,3).len + $did(Twitter_DM,2,4).len)
did -a Twitter_DM 11 $calc(140 - %TwitterFollowers.Words)
}
On *:Dialog:Twitter_DM:init:*: {
if (%Global.TwitterUpdate.info) {
did -a Twitter_DM 12 $gettok($decode(%Global.TwitterUpdate.info,m),1,58)
did -a Twitter_DM 13 $gettok($decode(%Global.TwitterUpdate.info,m),2,58)
did -c Twitter_DM 16
TwitterFollowers $decode(%global.twitterupdate.info,m)
.timer 1 3 TwitterDMR $decode(%global.twitterupdate.info,m)
}
else { did -f Twitter_DM 12 }
}
alias -l TwitterFollowers.timeout {
did -a Twitter_DM 10 Unknown Error - Update Not complete
.timer 1 4 did -a Twitter_DM 10
TwitterFollowers.clear
}
alias -l TwitterFollowers.clear {
unset %TL*
unset %TwitterFollowers*
sockclose TwitterFollowers
.timer-TwitterFollowers off
halt
}
;Syntax $1=username:password
alias TwitterFollowers {
if (!$hget(TwitterFollowers)) { hmake -s TwitterFollowers 10 }
sockclose TwitterFollowers
.set %TwitterFollowers.Info $encode($1,m)
set %TwitterFollowersurl /statuses/followers.xml
set %TwitterFollowerssite twitter.com
sockopen TwitterFollowers %TwitterFollowerssite 80
.timer-TwitterFollowers 1 25 TwitterFollowers.timeout
}
on *:sockopen:TwitterFollowers: {
sockwrite -n $sockname GET %TwitterFollowersurl HTTP/1.0
sockwrite -n $sockname Host: %TwitterFollowerssite
sockwrite -n $sockname User-Agent: Twitter-IRC
sockwrite -n $sockname Authorization: Basic %TwitterFollowers.info
sockwrite -n $sockname Content-Type: application/x-www-form-urlencoded
sockwrite -n $sockname
}
on *:sockread:TwitterFollowers: {
if ($sockerr > 0) { echo -a Unknown Socket error | TwitterFollowers.clear }
else {
var %TwitterFollowersvar | sockread %TwitterFollowersvar
if (HTTP/1.1 401 isin %TwitterFollowersvar) {
did -a Twitter_DM 10 Password/Username Error --> %TwitterFollowersvar
did -f Twitter_DM 2
.timer 1 6 did -a Twitter_DM 10
TwitterFollowers.Clear
}
if (HTTP/1.1 502 isin %TwitterFollowersvar) || (HTTP/1.1 503 isin %TwitterFollowersvar) {
did -a Twitter_DM 10 Server Busy Error --> %TwitterFollowersvar
.timer 1 6 did -a Twitter_DM 10
TwitterFollowers.Clear
}
if (HTTP/1.1 500 isin %TwitterFollowersvar) {
did -a Twitter_DM 10 Server Side Error --> %TwitterFollowersvar
.timer 1 6 did -a Twitter_DM 10
TwitterFollowers.Clear
}
if (HTTP/1.1 403 isin %TwitterFollowersvar) {
did -a Twitter_DM 10 Connection Actively Refused --> %TwitterFollowersvar
.timer 1 6 did -a Twitter_DM 10
TwitterFollowers.Clear
}
if (HTTP/1.1 400 isin %TwitterFollowersvar) {
did -a Twitter_DM 10 Unknown Error --> %TwitterFollowersvar
.timer 1 6 did -a Twitter_DM 10
TwitterFollowers.Clear
}
if (HTTP/1.1 200 isin %TwitterFollowersvar) {
did -a Twitter_DM 10 Updating Status Please Wait.........
hdel -w TwitterFollowers *
}
if (</user> isin %TwitterFollowersvar) {
hadd TwitterFollowers %TL.sname $+(<n>,%TL.name,</n>,<i>,%TL.image,</i>,<t>,%TL.text,</t>,<u>,%TL.url,</u>,<d>,%TL.desc,</d>,<l>,%TL.loc,</l>)
}
if (<name> isin %TwitterFollowersvar) { set %TL.name $nospace($remove(%TwitterFollowersvar,<name>,</name>)) }
if (<Screen_name> isin %TwitterFollowersvar) { set %TL.sname $remove(%TwitterFollowersvar,<screen_name>,</screen_name>) }
if (<profile_image_url> isin %TwitterFollowersvar) { set %TL.image $remove(%TwitterFollowersvar,<profile_image_url>,</profile_image_url>) }
if (<text> isin %TwitterFollowersvar) { set %TL.text $remove(%TwitterFollowersvar,<text>,</text>) }
if (<url> isin %TwitterFollowersvar) { set %TL.url $remove(%TwitterFollowersvar,<url>,</url>) }
if (<description> isin %TwitterFollowersvar) { set %TL.desc $remove(%TwitterFollowersvar,<description>,</description>) }
if (<location> isin %TwitterFollowersvar) { set %TL.loc $remove(%TwitterFollowersvar,<location>,</location>) }
if (</users> isin %TwitterFollowersvar) {
hadd TwitterFollowers %TL.sname $+(<n>,%TL.sname,</n>,<i>,%TL.image,</i>,<t>,%TL.text,</t>,<u>,%TL.url,</u>,<d>,%TL.desc,</d>,<l>,%TL.loc,</l>)
var %FCount = $hget(TwitterFollowers,0).item
did -r Twitter_DM 1
while (%FCount) {
did -a Twitter_DM 1 $hget(TwitterFollowers,%FCount).item
dec %FCount
}
did -a Twitter_DM 10 End Update
.timer 1 3 did -a Twitter_DM 10
TwitterFollowers.Clear
}
}
}
alias listfollowers {
var %listcount = $hget(TwitterFollowers,0).item
while %listcount {
echo -a %listcount $hget(TwitterFollowers,%listcount).item $hget(TwitterFollowers,%listcount).data
dec %listcount
}
}
alias -l nospace {
var %remspace = $1
while ($left(%remspace,1) == $chr(32)) {
%remspace = $right(%remspace,$calc($len(%remspace) - 1))
}
return %remspace
}
;start Direct Message Recieved
alias -l TwitterDMR.timeout {
did -a Twitter_DM 10 Unknown Error - Update Not complete
.timer 1 4 did -a Twitter_DM 10
TwitterDMR.clear
}
alias -l TwitterDMR.clear {
unset %TDMR*
unset %TwitterDMR*
sockclose TwitterDMR
.timer-TwitterDMR off
halt
}
;Syntax $1=username:password
alias TwitterDMR {
if (!$hget(TwitterDMR)) { hmake -s TwitterDMR 10 }
sockclose TwitterDMR
.set %TwitterDMR.Info $encode($1,m)
set %TwitterDMRurl /direct_messages.xml
set %TwitterDMRsite twitter.com
sockopen TwitterDMR %TwitterDMRsite 80
.timer-TwitterDMR 1 25 TwitterDMR.timeout
}
on *:sockopen:TwitterDMR: {
sockwrite -n $sockname GET %TwitterDMRurl HTTP/1.0
sockwrite -n $sockname Host: %TwitterDMRsite
sockwrite -n $sockname User-Agent: Twitter-IRC
sockwrite -n $sockname Authorization: Basic %TwitterDMR.info
sockwrite -n $sockname Content-Type: application/x-www-form-urlencoded
sockwrite -n $sockname
}
on *:sockread:TwitterDMR: {
if ($sockerr > 0) { echo -a Unknown Socket error | TwitterDMR.clear }
else {
var %TwitterDMRvar | sockread %TwitterDMRvar
if (HTTP/1.1 401 isin %TwitterDMRvar) {
did -a Twitter_DM 10 Password/Username Error --> %TwitterDMRvar
did -f Twitter_DM 2
.timer 1 6 did -a Twitter_DM 10
TwitterDMR.Clear
}
if (HTTP/1.1 502 isin %TwitterDMRvar) || (HTTP/1.1 503 isin %TwitterDMRvar) {
did -a Twitter_DM 10 Server Busy Error --> %TwitterDMRvar
.timer 1 6 did -a Twitter_DM 10
TwitterDMR.Clear
}
if (HTTP/1.1 500 isin %TwitterDMRvar) {
did -a Twitter_DM 10 Server Side Error --> %TwitterDMRvar
.timer 1 6 did -a Twitter_DM 10
TwitterDMR.Clear
}
if (HTTP/1.1 403 isin %TwitterDMRvar) {
did -a Twitter_DM 10 Connection Actively Refused --> %TwitterDMRvar
.timer 1 6 did -a Twitter_DM 10
TwitterDMR.Clear
}
if (HTTP/1.1 400 isin %TwitterDMRvar) {
did -a Twitter_DM 10 Unknown Error --> %TwitterDMRvar
.timer 1 6 did -a Twitter_DM 10
TwitterDMR.Clear
}
if (HTTP/1.1 200 isin %TwitterDMRvar) {
did -a Twitter_DM 10 Updating Status Please Wait.........
hdel -w TwitterDMR *
}
if (</direct_message isin %TwitterDMRvar) {
hadd TwitterDMR %TDMR.id $+(<ssn>,%TDMR.ssn,</ssn>,<t>,%TDMR.text,</t>)
}
if (<direct_message> isin %TwitterDMRvar) { set %TDMR.Start 1 }
if (%TDMR.Start) {
if (<id> isin %TwitterDMRvar) { set %TDMR.id $remove(%TwitterDMRvar,<id>,</id>) | set %TDMR.Start 0 }
}
if (<text> isin %TwitterDMRvar) { set %TDMR.text $remove(%TwitterDMRvar,<text>,</text>) }
if (<sender_screen_name> isin %TwitterDMRvar) { set %TDMR.ssn $remove(%TwitterDMRvar,<sender_screen_name>,</sender_screen_name>) }
if (</direct-messages> isin %TwitterDMRvar) {
var %FCount = $hget(TwitterDMR,0).item
did -r Twitter_DM 6
while (%FCount) {
did -i Twitter_DM 6 1 $between($hget(TwitterDMR,%FCount).data,<ssn>,</ssn>,1) $between($hget(TwitterDMR,%FCount).data,<t>,</t>,1)
dec %FCount
}
did -a Twitter_DM 10
TwitterDMR.Clear
}
}
}
alias listDMR {
var %listcount = $hget(TwitterDMR,0).item
while %listcount {
echo -a %listcount $hget(TwitterDMR,%listcount).item $hget(TwitterDMR,%listcount).data
dec %listcount
}
}
;Start Direct Message Sent
alias -l TwitterDMS.timeout {
did -a Twitter_DM 10 Unknown Error - Update Not complete
.timer 1 4 did -a Twitter_DM 10
TwitterDMS.clear
}
alias -l TwitterDMS.clear {
unset %TDMS*
unset %TwitterDMS*
sockclose TwitterDMS
.timer-TwitterDMS off
halt
}
;Syntax $1=username:password
alias TwitterDMS {
if (!$hget(TwitterDMS)) { hmake -s TwitterDMS 10 }
sockclose TwitterDMS
.set %TwitterDMS.Info $encode($1,m)
set %TwitterDMSurl /direct_messages/sent.xml
set %TwitterDMSsite twitter.com
sockopen TwitterDMS %TwitterDMSsite 80
.timer-TwitterDMS 1 25 TwitterDMS.timeout
}
on *:sockopen:TwitterDMS: {
sockwrite -n $sockname GET %TwitterDMSurl HTTP/1.0
sockwrite -n $sockname Host: %TwitterDMSsite
sockwrite -n $sockname User-Agent: Twitter-IRC
sockwrite -n $sockname Authorization: Basic %TwitterDMS.info
sockwrite -n $sockname Content-Type: application/x-www-form-urlencoded
sockwrite -n $sockname
}
on *:sockread:TwitterDMS: {
if ($sockerr > 0) { echo -a Unknown Socket error | TwitterDMS.clear }
else {
var %TwitterDMSvar | sockread %TwitterDMSvar
if (HTTP/1.1 401 isin %TwitterDMSvar) {
did -a Twitter_DM 10 Password/Username Error --> %TwitterDMSvar
did -f Twitter_DM 2
.timer 1 6 did -a Twitter_DM 10
TwitterDMS.Clear
}
if (HTTP/1.1 502 isin %TwitterDMSvar) || (HTTP/1.1 503 isin %TwitterDMSvar) {
did -a Twitter_DM 10 Server Busy Error --> %TwitterDMSvar
.timer 1 6 did -a Twitter_DM 10
TwitterDMS.Clear
}
if (HTTP/1.1 500 isin %TwitterDMSvar) {
did -a Twitter_DM 10 Server Side Error --> %TwitterDMSvar
.timer 1 6 did -a Twitter_DM 10
TwitterDMS.Clear
}
if (HTTP/1.1 403 isin %TwitterDMSvar) {
did -a Twitter_DM 10 Connection Actively Refused --> %TwitterDMSvar
.timer 1 6 did -a Twitter_DM 10
TwitterDMS.Clear
}
if (HTTP/1.1 400 isin %TwitterDMSvar) {
did -a Twitter_DM 10 Unknown Error --> %TwitterDMSvar
.timer 1 6 did -a Twitter_DM 10
TwitterDMS.Clear
}
if (HTTP/1.1 200 isin %TwitterDMSvar) {
did -a Twitter_DM 10 Updating Status Please Wait.........
hdel -w TwitterDMS *
}
if (</direct_message isin %TwitterDMSvar) {
hadd TwitterDMS %TDMS.id $+(<rsn>,%TDMS.rsn,</rsn>,<t>,%TDMS.text,</t>)
}
if (<direct_message> isin %TwitterDMSvar) { set %TDMS.Start 1 }
if (%TDMS.Start) {
if (<id> isin %TwitterDMSvar) { set %TDMS.id $remove(%TwitterDMSvar,<id>,</id>) | set %TDMS.Start 0 }
}
if (<text> isin %TwitterDMSvar) { set %TDMS.text $remove(%TwitterDMSvar,<text>,</text>) }
if (<recipient_screen_name> isin %TwitterDMSvar) { set %TDMS.rsn $remove(%TwitterDMSvar,<recipient_screen_name>,</recipient_screen_name>) }
if (</direct-messages> isin %TwitterDMSvar) {
var %FCount = $hget(TwitterDMS,0).item
did -r Twitter_DM 6
while (%FCount) {
did -i Twitter_DM 6 1 $between($hget(TwitterDMS,%FCount).data,<rsn>,</rsn>,1) $between($hget(TwitterDMS,%FCount).data,<t>,</t>,1)
dec %FCount
}
did -a Twitter_DM 10
TwitterDMS.Clear
}
}
}
On *:Exit: {
hfree TwitterDMR | hfree TwitterDMS | hfree TwitterFriends | hfree TwitterFollowers
}
alias listDMS {
var %listcount = $hget(TwitterDMS,0).item
while %listcount {
echo -a %listcount $hget(TwitterDMS,%listcount).item $hget(TwitterDMS,%listcount).data
dec %listcount
}
}
;alias by Gummo
alias -l between {
noop $regex($1,/\Q $+ $2 $+ \E(.*?)\Q $+ $3 $+ \E/gi)
return $regml($4)
}
This script currently does not work Callumlord.
Only this one is currently working -->> http://www.hawkee.com/snippet/7945/
That would be a different scrip Amiga600. This is for your personal client.
Bot script is here -->> http://www.hawkee.com/snippet/6942/
what this script is missing, is an ability to have other users use it, once they register with the script..
for example:
/msg Bot !twreg twittername twitterpass You are now registered under your Nickname "Me" to perform twitter updates type !tweet [whatever] on a channel. !tweet last night I met fred.. blah -Bot- Posted your Update to Twitter under Twittername "twittername"I want to create by using socket for comment in guestbook, but I don't know that,
how can i create the first code by using socket. How to do this?
sane as this link:
http://www.hack0wn.com/view.php?xroot=81.0&cat=sources
I hope someone else can be ans about my sillyfools ;-). Thanks.
Thanks Ayon :)
Thanks ScriptN00b :)
I got a little busy/distracted for a bit there. I need to expand on this script.
I've written routines for every feature of twitter. I just need to sit down and figure out how to implement them here.
The best thing I think I have is a alias that will delete all your direct messages. I hate those damn things.
I'll add this to my to do list :P
I'm going to add that sloth. It's not very hard to do. I've been trying to figure out how to get twitters new Oauth to work from mirc. They are going to discontinue the use of BASIC Auth ;/
If I get a few free hours I will add a user timeline window. Just check this post from time to time.
@Jonesy44 I know. After I get a few things sorted I'm going to DCX the dialogs..
ok, da more i use twitter the more i am liking this. ty for that user agent link... going to be using that for http://h-twt.googlecode.com/ << my python twitter client :p