WTF Should I Make For Dinner.com

By SReject on Oct 31, 2011

This is my take on hxck's WTFD snippet
-- Orignal Snippet: http://www.hawkee.com/snippet/9111/

/wtfd:Set Public|Private On|Off
Public|Private - Enables|Disables the !dinner and !vdinner channel commands
On|Off - Turns the word censor on off

/wtfd [-v]
This command does the same as the !dinner and !vdinner commands except
the results are displayed locally(Not set to server)
if '-v' is specified, a vegaterian dish is returned.

Bug Fixes/Additions/Changes:

  • Fixed onLoad Event(Replaced "$false" with off)
  • Added 5sec flood protection
alias -l wtfd return whatthefu $+ ckshouldimakefordinner.com
alias -l wtfd:c return $replacex($1-,fu $+ ck,****,sh $+ it,****)
on *:LOAD: wtfd:Set Public off
on *:UNLOAD:{
  if ($sock(wtfd)) sockclose $v1
  unset %wtfd*
}

#wtfd on
on $*:TEXT:/^!v?dinner$/Si:#:{
  if ($sock(wtfd) || %wtfd:Flood) { return }
  sockopen wtfd $wtfd 80
  sockmark wtfd $iif(!v* iswm $1,/veg.php,/index.php) msg #
  set -eu5 %wtfd:Flood $true
}
#wtfd end
on *:SOCKOPEN:wtfd:{
  tokenize 32 $sock($sockname).mark
  if ($sockerr) $2- Dinner: Unable to connect.
  else {
    sockwrite -n $sockname GET $1 HTTP/1.1
    sockwrite -n $sockname Host: $wtfd
    sockwrite -n $sockname Connection: close
    sockwrite -n $sockname
  }
}
on *:SOCKWRITE:wtfd:{
  if ($sockerr) { 
    $gettok($sock($sockname).mark,2-,32) Dinner: Unable to request page 
    unset %wtfd:* 
  }
}
on *:SOCKREAD:wtfd:{
  tokenize 32 $sock($sockname).mark
  if ($sockerr) {
    $2- Dinner: Unable to read data.
    unset %wtfd:*
  }
  else {
    var %tmp 
    sockread %tmp
    while ($sockbr) {
      if ($regex(%tmp,^([^<>]+)<\/dl>)) set %wtfd:Line $regml(1)
      elseif ($regex(%tmp,^<dt><a href="([^"]+)"[^>]+>([^<>]+)<\/a><\/dt>$)) {
        set %wtfd:Link $regml(1)
        set %wtfd:Desc $regml(2)
      }
      sockread %tmp
    }
  }
}
on *:SOCKCLOSE:wtfd: {
  tokenize 32 $sock($sockname).mark
  if ($sockerr) $2- Dinner: Connection closed Unexpectedly
  else {
    $2- $iif(%wtfdc,$wtfd:c(%wtfd:line),%wtfd:line) $+ : %wtfd:desc
    $2- %wtfd:link
  }
  unset %wtfd:*
}

alias wtfd {
  if ($sock(wtfd)) echo -ac info2 * /wtfd: Socket in use, please wait
  else {
    sockopen wtfd $wtfd 80
    sockmark wtfd $iif($1 == -v,/veg.php,/index.php) echo -a * WTFD:
  }
}

alias wtfd:Set {
  if (!$regex($1-,/^(Private|Public) (on|off)$/i)) {
    echo -ac info2 * /wtfd:Set: Invalid parameters
  }
  else {
    $iif($1 == Public,.enable,.disable) #wtfd
    set %wtfdc $iif($2 == on,$true,$false)
    echo -ac info * /wtfd is now $1 and the word censor is $2
  }
}

Comments

Sign in to comment.
SReject   -  Oct 31, 2011

@IllogicTC & Jethro: I added a 5 second floodcontrol var to the onText

 Respond  
IllogicTC   -  Oct 31, 2011

FIND SOME CHILD LABOUR TO COOK YOU SOME !@#
I don't remember the dish. This was a vegetarian result, which I found funny to have prefixed with that.

This is very enjoyable, SReject, thanks. Howeve, I would also suggest some sort of flood protection, just to make sure. After all, it IS a fun socket, and you know how people on the 'net get some days >_>

 Respond  
Jethro   -  Oct 31, 2011

Even so, you can still get flooded.

 Respond  
SReject   -  Oct 31, 2011

@Conscious: Yes, yes it should. Thank you

@Jehro: In all actually it WILL NOT close the socket if it gets one request while another is processing. It just ignores the 2nd request. It's sort of it's flood protection.

 Respond  
Stewie1k94   -  Oct 31, 2011

Nice :) 7/10

 Respond  
alabama   -  Oct 31, 2011

You won't not make some fucking: Skillet-Baked Green Trout
http://www.cookstr.com/recipes/skillet-baked-green-trout
How about some fucking: Turtle Soup
http://www.cookstr.com/recipes/turtle-soup
How about some fucking: Glazed Corned Beef with Root Vegetables
http://www.cookstr.com/recipes/glazed-corned-beef-with-root-vegetables
Induce food coma with some fucking: Roasted Leg of Rabbit with Bacon and a Mustard Sauce
http://www.cookstr.com/recipes/roasted-leg-of-rabbit-with-bacon-and-a-mustard-sauce

 Respond  
Jethro   -  Oct 31, 2011

Oh I wouldn't be surprised, 'cause I come from a family where foul words like those are a normal part of daily conversation...:p hahahha

 Respond  
Conscious   -  Oct 31, 2011

on *:LOAD: wtfd:Set Public $false
Shouldn't that be wtfd:Set Public off?

 Respond  
alabama   -  Oct 31, 2011

jethro, im using the script lol

 Respond  
alabama   -  Oct 31, 2011

I'D SAY EAT SHIT, BUT THAT WOULDN'T BE HELPFUL, HOW ABOUT SOME FUCKING
STEAK SALAD WITH VEGETABLES

 Respond  
Jethro   -  Oct 31, 2011

alabama, what the heck are you talking about? Type in English please.

 Respond  
alabama   -  Oct 31, 2011

CURE YOUR MOUTH'S POST TRAUMATIC STRESS DISORDER WITH SOME FUCKING
SALADE NIÇOISE

 Respond  
Jethro   -  Oct 31, 2011

Looks promising and nice job man.

It'd have been better if you made the socket dynamic, because the current script can only be triggered one at a time. If a person enters the text trigger while another socket is open, the script will close the socket of another person and only reply to him or her.

 Respond  
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.