;TwitFeed Twitter RSS Script By Ford_Lawnmower irc.mindforge.org #USA-Chat alias -l TwitFeed { var %sockname $+(TwitFeed,$1,$ticks), %site $gettok($2,2,47) sockopen %sockname %site 80 sockmark %sockname $remove($2,%site,http://) 0 $1 %site } On *:Sockopen:TwitFeed*: { sockwrite -nt $sockname GET $gettok($sock($sockname).mark,1,32) HTTP/1.1 sockwrite -n $sockname Host: $gettok($sock($sockname).mark,4,32) sockwrite -n $sockname $crlf } On *:Sockread:TwitFeed*: { if ($sockerr) { echo -at >Sock error TwitFeed< } else { var %TwitFeed | sockread %TwitFeed if ( isin %TwitFeed) { sockmark $sockname $puttok($sock($sockname).mark,$calc($gettok($sock($sockname).mark,2,32) + 1),2,32) } if ($gettok($sock($sockname).mark,2,32) >= 5) { TwitResults $gettok($sock($sockname).mark,3,32) | sockclose $sockname | return } if ($gettok($sock($sockname).mark,2,32)) { if ($between(%TwitFeed,,,1)) { hadd -m TwitFeed $+($gettok($sock($sockname).mark,3,32),$gettok($sock($sockname).mark,2,32)) $ifmatch } if ($between(%TwitFeed,,+,1)) || ($between(%TwitFeed,,-,1)) { hadd -m TwitFeed $+($gettok($sock($sockname).mark,3,32),$gettok($sock($sockname).mark,2,32)) $& $hget(TwitFeed,$+($gettok($sock($sockname).mark,3,32),$gettok($sock($sockname).mark,2,32))) $ifmatch } if ($between(%TwitFeed,,,1)) { hadd -m TwitFeed $+($gettok($sock($sockname).mark,3,32),$gettok($sock($sockname).mark,2,32)) $& $hget(TwitFeed,$+($gettok($sock($sockname).mark,3,32),$gettok($sock($sockname).mark,2,32))) $+(,$fixspace($ifmatch),) } } } } dialog -l TwitFeed { title "TwitFeed" size -1 -1 104 120 option dbu text "Network:", 1, 8 6 25 8 text "Channel:", 2, 8 18 25 8 text "", 3, 36 6 65 8 text "", 4, 36 18 65 8 text "FEEDS", 5, 8 28 89 8 list 6, 8 37 89 60, size vsbar button "Add", 7, 5 106 29 12 button "Delete", 8, 38 106 29 12 button "Edit", 9, 71 106 29 12 text "", 10, 0 97 105 8 } On *:Dialog:TwitFeed*:init:*: { did -a $dname 3 $network did -a $dname 4 $active var %count $hfind(TwitFeedLIST,$+($network,,$active,*),0,w).item while (%count) { did -a $dname 6 $gettok($hfind(TwitFeedLIST,$+($network,,$active,*),%count,w).item,3,7) dec %count } } On *:Dialog:TwitFeed*:Sclick:7-9: { if ($did == 7) { dialogopen $+(TwitEdit,,$did($dname,3).text,,$did($dname,4).text) TwitEdit | if ($dialog($dname)) { dialog -x $dname } } if ($did == 8) && ($did($dname,6).seltext) { var %removeme $+($did($dname,3).text,,$did($dname,4).text,,$did($dname,6).seltext) .timer $+ %removeme off hdel TwitFeedLIST %removeme did -df $dname 6 $did($dname,6).sel } if ($did == 9) && ($did($dname,6).seltext) { dialogopen $+(TwitEdit,,$did($dname,3).text,,$did($dname,4).text,,$did($dname,6).seltext) TwitEdit if ($dialog($dname)) { dialog -x $dname } } } dialog -l TwitEdit { title "TwitFeed Add/Edit" size -1 -1 104 112 option dbu text "Network:", 1, 8 6 25 8 text "Channel:", 2, 8 18 25 8 text "", 3, 36 6 65 8 text "", 4, 36 18 65 8 text "FEED NAME", 5, 8 28 89 8 text "", 10, 0 86 105 8, center text "FEED LINK", 6, 8 52 89 8 edit "", 7, 7 38 90 10, autohs edit "", 8, 7 62 90 10, autohs button "Cancel", 9, 66 96 29 12 button "Accept", 11, 8 96 29 12 text "Delay in Seconds:", 12, 8 77 43 8 edit "", 13, 54 76 43 10 } On *:dialog:TwitEdit*:Sclick:9,11: { if ($did == 11) { if ($did($dname,7).text) && ($did($dname,8).text) && ($did($dname,13).text) { if (http:// !isin $did($dname,8).text) { did -a $dname 10 Link missing prefix http:// did -f $dname 8 .timer 1 4 if ($!dialog($dname)) { did -a $dname 10 } return } if ($did($dname,13).text !isnum) { did -a $dname 10 Delay should be a NUMBER did -f $dname 13 .timer 1 4 if ($!dialog($dname)) { did -a $dname 10 } return } var %addit $+($did($dname,3).text,,$did($dname,4).text,,$spunder($did($dname,7).text)), %del $did($dname,13).text, %flink $strip($did($dname,8).text) var %netcount $scon(0) while %netcount { if ($scon(%netcount).network == $did($dname,3).text) { var %netid %netcount } dec %netcount } scon %netid TwitTimer %addit %flink %del hadd -m TwitfeedLIST %addit %addit %flink %del var %diagname $+(TwitFeed,,$did($dname,3).text,,$did($dname,4).text) if ($dialog(%diagname)) { did -a %diagname 6 $spunder($did($dname,7).text) } dialogopen %diagname TwitFeed if ($dialog($dname)) { dialog -x $dname } } else { did -a $dname 10 Please fill in all of the boxes .timer 1 4 if ($!dialog($dname)) { did -a $dname 10 } } } if ($did == 9) { var %diagname $+(TwitFeed,,$did($dname,3).text,,$did($dname,4).text) dialogopen %diagname TwitFeed if ($dialog($dname)) { dialog -x $dname } } } On *:dialog:TwitEdit*:init:*: { tokenize 7 $dname did -a $dname 3 $2 did -a $dname 4 $3 if ($4) { did -am $dname 7 $4 did -af $dname 8 $gettok($hget(TwitFeedLIST,$remove($dname,TwitEdit)),2,32) did -a $dname 13 $gettok($hget(TwitFeedLIST,$remove($dname,TwitEdit)),3,32) } } On *:Connect: { if (!$hget(TwitFeedLIST)) { hmake TwitFeedLIST 5 if ($exists(TwitFeedLIST.hsh)) { hload TwitFeedLIST TwitFeedLIST.hsh } } var %records $hget(TwitFeedLIST,0).item while (%records) { .timer 1 $calc(%records * 5) TwitTimer $hget(TwitFeedLIST,%records).data dec %records } } On *:Disconnect: { if ($hget(TwitFeedLIST)) { hsave TwitFeedLIST TwitFeedLIST.hsh } } On *:Exit: { hfree TwitFeedLIST } On *:Unload: { hfree TwitFeedLIST } menu channel { TwitFeed:dialogopen $+(Twitfeed,,$network,,$chan) twitfeed } alias -l TwitResults { var %count 4 while (%count) { if (!$hfind($+(twitfeedDONE,$1),$+(*,$right($hget(TwitFeed,$+($1,%count)),10),*),1,w).data) { if ($me ison $gettok($1,2,7)) { .msg $gettok($1,2,7) 14T07wit14F06eed $gettok($1,3,7) $repchars($hget(TwitFeed,$+($1,%count))) } } dec %count } while (%count <= 3) { inc %count hadd -m $+(TwitFeedDONE,$1) $+($1,%count) $hget(TwitFeed,$+($1,%count)) } } alias -l repchars { return $replacex($1-,&gt;,>,",",’,',”,",&,&,“,",gt;,<) } ;Syntax TwitTimer NetworkChannelFeedName http://full/link/to/feedpage/4325677 delayinseconds alias -l TwitTimer { var %netcount $scon(0) while %netcount { if ($scon(%netcount).network == $gettok($1,1,7)) { var %netid %netcount } dec %netcount } scon %netid TwitFeed $1 $2 scon %netid .timer $+ $1 1 $iif($3 > 60,$3,60) scon %netid TwitTimer $1- } alias -l fixspace { return $replace($1-,$chr(32),% $+ 20) } alias -l DialogOpen { dialog $iif($dialog($1),-v,-m) $1- } alias -l spunder { return $replace($1-,$chr(32),_) } ;alias by Gummo alias -l between { noop $regex($1,/\Q $+ $2 $+ \E(.*?)\Q $+ $3 $+ \E/gi) | return $regml($4) }