maria

maria

Joined
Feb 20, 2008
Occupation
Everything Geek!
Location
Houston, TX
Interests
Windows OS

Activity Stream

maria commented on a Page, Reddit Latest Post & Comment Watcher  -  Jul 04, 2012

too late. fixed everything. lol....

jethro, thank you for starting this project and creating something useful, without your help i wouldn't have been able to finish this off myself.

here's a Sub-Reddit Post .JSON Feed to Channel Script;

alias -l reddit {
  hadd -m reddit callback msg $1
  hadd reddit attr.count 0
  hdel reddit rcvd
  var %sockname = reddit2
  if ($sock(%sockname)) sockclose $v1
  sockopen %sockname www.reddit.com 80
}
alias -l trans {
  return $replace($1,&lt;,<,&gt;,>,&quot;,",&nbsp;,$chr(160),&amp;,&,&amp;#39;,')
}

on *:sockopen:reddit2:{
  if ($sockerr) { 
    echo 4 -ag $gettok($sock(reddit).mark,2,32) Error Connecting to $sock(reddit).addr
  }
  var %reddit2 = sockwrite -nt reddit2
  %reddit2 GET $+(/r/,%reddits,/new.json?sort=new&limit=1,$iif($hget(reddit,id),&after= $+ $v1)) HTTP/1.0-
  %reddit2 Cache-Control: max-age=0
  %reddit2 Connection: close
  %reddit2 User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)
  %reddit2 Host: $+($sock($sockname).addr,$str($crlf,2))
}

on *:sockread:reddit2:{
  if ($sockerr) { 
    echo 4 $gettok($sock(reddit).mark,2,32) Error Reading $sock(reddit).addr
    return
  }
  sockread &reddit2
  noop $hget(reddit,rcvd,&rcvd)
  bcopy &rcvd $calc($bvar(&rcvd,0) + 1) &reddit2 1 -1
  hadd -b reddit rcvd &rcvd
}

on *:sockclose:reddit2:{
  reddit.finished
}

alias reddit.finished {
  noop $hget(reddit,rcvd,&rcvd)

  var %g2 = $bvar(&rcvd,1-).text
  if ($regex(%g2,/"title"\: "(.*)"/)) {
    hadd -m reddit title $gettok($trans($regml(1)),1,34)
    hinc reddit attr.count
  }
  if ($regex(%g2,/"id"\: "(.*)"/)) {
    hadd -m reddit status old
    if ($hget(reddit,id) != $gettok($trans($regml(1)),1,34)) {
      hadd -m reddit id $v2
      hadd -m reddit status new
      hinc reddit attr.count
    }
  }
  if ($regex(%g2,/"author"\: "(.*)"/)) { 
    hadd -m reddit author $gettok($regml(1),1,34)
    hinc reddit attr.count
  }

  if ($hget(reddit,status) == new) && ($hget(reddit,attr.count) == 3) {
    $hget(reddit,callback) $&
      $chr(29) $+ $hget(reddit,title) $+ $chr(29) - $+(http://redd.it/,$hget(reddit,id)) by 12 $+ $hget(reddit,author)
  }
}

on me:*:join:#reddit:{
  if (%true) notice $me Reddit has been toggled off. Right-click on $&
    the nicklist or channel to toggle it on. | unset %true
}
on *:disconnect: if (%reddits) $+(.timer,#,$network) off | set -e %true 1
on me:*:part:#: if (%reddits) $+(.timer,#,$network) off | set -e %true 1
on *:kick:#:{
  if ($knick == $me) && (%reddits) $+(.timer,#,$network) off
  set -e %true 1
}
on *:quit:{
  if ($nick == $me) && (%reddits) {
    var %c = 1
    while ($comchan($me,%c)) {
      $+(.timer,$v1,$network) off
      set -e %true 1
      inc %c
    }
  }
}

menu channel,nicklist {
  Reddit
  .ON {
    if (!%reddits) {
      set -e %reddits $$?"Which Reddit to Watch?"
      set -e %reddittime $$?"How often do you want the latest post checked $&
        and sent to the channel in seconds?"
      $+(.timer,#,$network) 0 %reddittime reddit #
      echo 2 # * Reddit Set for: $+($chr(2),%reddits)
      echo 2 # * Time Interval in Seconds: $+($chr(2),%reddittime)
      if (%true) unset $v1
    }
    else echo 4 # * Reddit is Already Switched On!
  }
  .OFF { 
    if (%reddits) {
      $+(.timer,#,$network) off 
      echo 2 * Reddit Has Been Turned Off!
      unset %reddit* %true
    }
    else echo 4 # * Reddit is Already Switched Off!
  }
}
 Respond  
maria commented on a Page, Reddit Latest Post & Comment Watcher  -  Jul 03, 2012

Jethro wrote:

Well, it's expected to get the result repeated if there's no new post made...
that creates a tiny little problem... if you have it checking the site every 30 seconds seconds for new posts it will just keep repeating the same already mentioned post if no new one is created. i tried creating a variable using

set %norepost $+($hget(data4,1).item)

and checking against it before messaging the channel. unfortunately i couldn't make this work. any ideas on how to check if you've already used a post before proceeding with the action?

this is what i have so far, but it stops displaying new posts to the channel :(

alias -l reddit {
  var %sockname = reddit2
  if ($sock(%sockname)) sockclose $v1
  sockopen %sockname www.reddit.com 80
  sockmark %sockname msg $1
  inc %i
}
alias -l trans {
  return $replace($1,&lt;,<,&gt;,>,&quot;,",&nbsp;,$chr(160),&amp;,&,&amp;#39;,')
}

on *:sockopen:reddit2:{
  if ($sockerr) { 
    echo 4 -ag $gettok($sock(reddit).mark,2,32) Error Connecting to $sock(reddit).addr
  }
  var %reddit2 = sockwrite -nt reddit2
  %reddit2 GET $+(/r/,%reddits,/new.json?sort=new,$iif($hget(reddit,id),&after= $+ $v1)) HTTP/1.0
  %reddit2 Connection: close
  %reddit2 Host: $+($sock($sockname).addr,$str($crlf,2))
}

on *:sockread:reddit2:{
  if ($sockerr) { 
    echo 4 $gettok($sock(reddit).mark,2,32) Error Reading $sock(reddit).addr
    return
  }
  sockread &reddit2
  var %g2 = $bvar(&reddit2,1-).text
  if ($regex(%g2,/"title"\: "(.*)"/)) {
    hadd -m data3 $gettok($trans($regml(1)),1,34) 
  }
  if ($regex(%g2,/"id"\: "(.*)"/)) {
    hadd -m reddit status old
    if ($hget(reddit,id) != $gettok($trans($regml(1)),1,34)) {
      hadd -m reddit id $v2
      hadd -m reddit status new
      hadd -m data4 $+($gettok($+(http://redd.it/,$&
        $trans($regml(1))),1,34))
    }
  }
  if ($regex(%g2,/"author"\: "(.*)"/)) { 
    hadd -m data5 $+($chr(3),12,$gettok($regml(1),1,34))
    reddit.finished
    sockclose $sockname
  }
}

on *:sockclose:reddit2:{
  reddit.finished
}

alias reddit.finished {
  if ($hget(reddit,status) == new) && ($hget(data3)) && ($hget(data4)) {
    $sock($sockname).mark $&
      $+($chr(29),$hget(data3,1).item,$chr(32),$hget(data3,1).data,$chr(29),$chr(32),$chr(2),-,$chr(2)) $&
      $hget(data4,1).item by $hget(data5,1).item 
    hfree -w data*
  }
}

on me:*:join:#:{
  if (%true) notice $me Reddit has been toggled off. Right-click on $&
    the nicklist or channel to toggle it on. | unset %true
}
on *:disconnect: if (%reddits) $+(.timer,#,$network) off | set -e %true 1
on me:*:part:#: if (%reddits) $+(.timer,#,$network) off | set -e %true 1
on *:kick:#:{
  if ($knick == $me) && (%reddits) $+(.timer,#,$network) off
  set -e %true 1
}
on *:quit:{
  if ($nick == $me) && (%reddits) {
    var %c = 1
    while ($comchan($me,%c)) {
      $+(.timer,$v1,$network) off
      set -e %true 1
      inc %c
    }
  }
}

menu channel,nicklist {
  Reddit
  .ON {
    if (!%reddits) {
      set -e %reddits $$?"Which Reddit to Watch?"
      set -e %reddittime $$?"How often do you want the latest post checked $&
        and sent to the channel in seconds?"
      $+(.timer,#,$network) 0 %reddittime reddit #
      echo 2 # * Reddit Set for: $+($chr(2),%reddits)
      echo 2 # * Time Interval in Seconds: $+($chr(2),%reddittime)
      if (%true) unset $v1
    }
    else echo 4 # * Reddit is Already Switched On!
  }
  .OFF { 
    if (%reddits) {
      $+(.timer,#,$network) off 
      echo 2 * Reddit Has Been Turned Off!
      unset %reddit* %true
    }
    else echo 4 # * Reddit is Already Switched Off!
  }
}

seriously, been cracking at this all day and i can't figure out a way to stop messaging posts that it has already mentioned. it's driving me craaaaaaaaaaaazy

 Respond  
maria commented on a Page, Reddit Latest Post & Comment Watcher  -  Jul 03, 2012

amazing, but one small problem though. it keeps repeating the same last post/comment if no new commet/post is made.

also found another small bug... when titles from .json contain characters such as '<' it will reply with html code like '<', if you can convert the text in the title containing < to < i can learn from that and update the html code as they come by

 Respond  
maria commented on a Page, Reddit Latest Post & Comment Watcher  -  Jul 02, 2012

is there a way to have grab the latest post instead of the latest comment reply?

 Respond  
maria created a Page  -  Mar 11, 2008
1,097 

This triggers when you get the "# unable to join channel (address is banned)" message. It sets a timer where it will hammer the channel every three seconds. The timer disables when you join the channel.

maria commented on a Page, Massive murder  -  Feb 28, 2008

I like it, it\'s evil ;)

 Respond  
maria   -  Feb 28, 2008

No one wanted to ask me to be their valentine? :P

 Respond  
maria   -  Feb 21, 2008

@tye I can\'t create a new topic in the forum \"Itroduce Yourself\". I\'m new and would like to say give and receive greetings. :(

 Respond  
maria created a Page  -  Feb 20, 2008
574 

Forgotten basic protocols between clients. This snippet allows you to point and click to place a query to a user's client and getting an answers.

 Respond   mIRC  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.