mIRC Home    About    Download    Register    News    Help

Print Thread
Strawpoll.me #244291 14/02/14 03:39 AM
Joined: Feb 2014
Posts: 9
L
LizardJammer Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
L
Joined: Feb 2014
Posts: 9
Hello I have been trying to make a Strawpoll using the command !vote option 1, option 2, option 3.... I have been able to get the !vote to work and be comma delimited but the sockets and posting back the correct hyperlink are confusing to me.

Last edited by LizardJammer; 14/02/14 03:41 AM.
Re: Strawpoll.me [Re: LizardJammer] #244298 14/02/14 01:28 PM
Joined: Jan 2004
Posts: 1,287
L
Loki12583 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,287
Strawpoll only allows a single vote per IP address, so you won't be able to pass votes for other people.

Re: Strawpoll.me [Re: Loki12583] #244303 14/02/14 04:30 PM
Joined: Feb 2014
Posts: 9
L
LizardJammer Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
L
Joined: Feb 2014
Posts: 9
I am sorry, I have worded this wrong. The command !vote would be to create the poll only and display a link to the newly created poll. Maybe the command would be better as !CStrawPoll Option 1, Option 2, Option 3.

Thanks Loki12583 you are very active I have got information from some of your help you posted for others. It is very nice of you to be such a helpful person.

Re: Strawpoll.me [Re: LizardJammer] #244308 14/02/14 07:54 PM
Joined: Jan 2004
Posts: 1,287
L
Loki12583 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,287
Syntax: "!poll title : a, b, c", title is optional and will be replaced with a default title "Poll", both ":" and "-" can be used to separate the title; spaces around the title delimiter are optional. This is tested and working:

Examples:
!poll Super Fun Title:a,b,c
!poll Some Other Title - a, b, c
!poll a, b, c

Code:
on *:text:!poll *:#:{
  var %regex = /(?:(.+?)\s*[:-]+\s*|())(.+?)$/iS
  if ($regex($strip($2-),%regex)) {
    var %title = $iif($regml(1),$v1,Poll)
    var %options = $regsubex($regml(2),/\s* $+ $chr(44) $+ \s*/g,$chr(44))
  }
  else return

  noop $strawpoll.create(#,%title,%options)
}

alias strawpoll.create {
  var %chan = $1, %title = $urlencode($2), %options
  var %multi = true, %permissive = false

  var %i = 1, %n = $numtok($3,44)
  while (%i <= %n) {
    %options = %options $+ &options[]= $+ $urlencode($gettok($3,%i,44))
    inc %i
  }

  var %sockname = strawpoll. $+ $ticks
  hfree -w %sockname | hmake %sockname
  hadd %sockname headerfile %sockname $+ .header.txt
  hadd %sockname datafile %sockname $+ .data.txt

  hadd %sockname host strawpoll.me
  hadd %sockname request /ajax/new-poll
  hadd %sockname method POST
  hadd %sockname data $+(title=,%title,%options,&multi=,%multi,&permissive=,%permissive)
  hadd %sockname signal strawpoll.create
  hadd %sockname params %chan

  sockopen %sockname $hget(%sockname,host) 80
}

on *:signal:strawpoll.create:{
  var %err = $1, %sockname = $2, %header = $3, %data = $4, %chan = $5

  if (* 200 OK iswm $read(%header,1)) && ($regex($read(%data,n,1),(\d+))) {
    msg %chan http://strawpoll.me/ $+ $regml(1)
  }
  else msg %chan Could not create poll.

  hfree -w %sockname
  .remove %header | .remove %data
}

on *:sockopen:strawpoll.*:{
  var %a = sockwrite -n $sockname
  %a $hget($sockname,method) $hget($sockname,request) HTTP/1.0
  %a Host: $hget($sockname,host)
  %a Connection: close
  if ($hget($sockname,data) != $null) {
    %a Content-Type: application/x-www-form-urlencoded
    %a Content-Length: $len($v1)
  }
  %a $+($crlf,$hget($sockname,data))
}

on *:sockread:strawpoll.*:{
  var %header
  var %headerfile = $hget($sockname,headerfile)
  var %datafile = $hget($sockname,datafile)

  if (!$hget($sockname,header.complete)) {
    sockread %header
    while (%header != $null) {
      write %headerfile %header
      sockread %header
    }
    if ($sockbr) hadd $sockname header.complete $true
  }
  if ($hget($sockname,header.complete)) {
    sockread &read
    while ($sockbr) {
      bwrite %datafile -1 -1 &read
      sockread &read
    }
  }
}

on *:sockclose:strawpoll.*:{
  var %header = $hget($sockname,headerfile)
  var %data = $hget($sockname,datafile)
  var %signal = $hget($sockname,signal)
  var %params = $hget($sockname,params)

  if (%signal) .signal %signal 0 $sockname %header %data %params
  else {
    hfree -w $sockname
    .remove %header | .remove %data
  }
}

alias urlencode return $regsubex($1-,/([^A-Z0-9])/gi,$+(%,$base($asc(\1),10,16)))

Re: Strawpoll.me [Re: Loki12583] #244313 14/02/14 09:47 PM
Joined: Feb 2014
Posts: 5
O
Orangefanta Offline
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
O
Joined: Feb 2014
Posts: 5
Originally Posted By: Loki12583
Syntax: "!poll title : a, b, c", title is optional and will be replaced with a default title "Poll", both ":" and "-" can be used to separate the title; spaces around the title delimiter are optional. This is tested and working:

Examples:
!poll Super Fun Title:a,b,c
!poll Some Other Title - a, b, c
!poll a, b, c

Code:
on *:text:!poll *:#:{
  var %regex = /(?:(.+?)\s*[:-]+\s*|())(.+?)$/iS
  if ($regex($strip($2-),%regex)) {
    var %title = $iif($regml(1),$v1,Poll)
    var %options = $regsubex($regml(2),/\s* $+ $chr(44) $+ \s*/g,$chr(44))
  }
  else return

  noop $strawpoll.create(#,%title,%options)
}

alias strawpoll.create {
  var %chan = $1, %title = $urlencode($2), %options
  var %multi = true, %permissive = false

  var %i = 1, %n = $numtok($3,44)
  while (%i <= %n) {
    %options = %options $+ &options[]= $+ $urlencode($gettok($3,%i,44))
    inc %i
  }

  var %sockname = strawpoll. $+ $ticks
  hfree -w %sockname | hmake %sockname
  hadd %sockname headerfile %sockname $+ .header.txt
  hadd %sockname datafile %sockname $+ .data.txt

  hadd %sockname host strawpoll.me
  hadd %sockname request /ajax/new-poll
  hadd %sockname method POST
  hadd %sockname data $+(title=,%title,%options,&multi=,%multi,&permissive=,%permissive)
  hadd %sockname signal strawpoll.create
  hadd %sockname params %chan

  sockopen %sockname $hget(%sockname,host) 80
}

on *:signal:strawpoll.create:{
  var %err = $1, %sockname = $2, %header = $3, %data = $4, %chan = $5

  if (* 200 OK iswm $read(%header,1)) && ($regex($read(%data,n,1),(\d+))) {
    msg %chan http://strawpoll.me/ $+ $regml(1)
  }
  else msg %chan Could not create poll.

  hfree -w %sockname
  .remove %header | .remove %data
}

on *:sockopen:strawpoll.*:{
  var %a = sockwrite -n $sockname
  %a $hget($sockname,method) $hget($sockname,request) HTTP/1.0
  %a Host: $hget($sockname,host)
  %a Connection: close
  if ($hget($sockname,data) != $null) {
    %a Content-Type: application/x-www-form-urlencoded
    %a Content-Length: $len($v1)
  }
  %a $+($crlf,$hget($sockname,data))
}

on *:sockread:strawpoll.*:{
  var %header
  var %headerfile = $hget($sockname,headerfile)
  var %datafile = $hget($sockname,datafile)

  if (!$hget($sockname,header.complete)) {
    sockread %header
    while (%header != $null) {
      write %headerfile %header
      sockread %header
    }
    if ($sockbr) hadd $sockname header.complete $true
  }
  if ($hget($sockname,header.complete)) {
    sockread &read
    while ($sockbr) {
      bwrite %datafile -1 -1 &read
      sockread &read
    }
  }
}

on *:sockclose:strawpoll.*:{
  var %header = $hget($sockname,headerfile)
  var %data = $hget($sockname,datafile)
  var %signal = $hget($sockname,signal)
  var %params = $hget($sockname,params)

  if (%signal) .signal %signal 0 $sockname %header %data %params
  else {
    hfree -w $sockname
    .remove %header | .remove %data
  }
}

alias urlencode return $regsubex($1-,/([^A-Z0-9])/gi,$+(%,$base($asc(\1),10,16)))


Can you add a floodblock to this?

Re: Strawpoll.me [Re: Orangefanta] #244317 15/02/14 02:57 AM
Joined: Feb 2014
Posts: 9
L
LizardJammer Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
L
Joined: Feb 2014
Posts: 9
I see where I went wrong in my script, thanks so much you guys are fantastic!!!!! <3 <3 <3

Yes I have flood control (= TY TY TY

Add this to the trigger command (under If above above var)

Code:
if ((%floodpoll = On) || (%floodpoll. $+ $nick = On) ) { return }
    set -u10 %floodpoll On
    set -u30 %floodpoll. $+ $nick On


Last edited by LizardJammer; 15/02/14 05:03 AM.
Re: Strawpoll.me [Re: LizardJammer] #244450 28/02/14 02:49 PM
Joined: Feb 2014
Posts: 16
L
LooseFlapper Offline
Pikka bird
Offline
Pikka bird
L
Joined: Feb 2014
Posts: 16
Hey, I am really sorry for necroing this thread and lock it if you wish but I couldn't help but notice that it's set to Allow Multiple Choices. How would I go about disabling this option? smile

EDIT:
Nevermind! I must've missed it but I found it now.
Code:
alias strawpoll.create {
  var %chan = $1, %title = $urlencode($2), %options
  var %multi = true, %permissive = false

Changed var %multi from true to false.

Last edited by LooseFlapper; 28/02/14 02:59 PM.

/Loose
Re: Strawpoll.me [Re: Loki12583] #244863 02/04/14 03:15 PM
Joined: Mar 2014
Posts: 215
J
judge2020 Offline
Fjord artisan
Offline
Fjord artisan
J
Joined: Mar 2014
Posts: 215
Originally Posted By: Loki12583
Syntax: "!poll title : a, b, c", title is optional and will be replaced with a default title "Poll", both ":" and "-" can be used to separate the title; spaces around the title delimiter are optional. This is tested and working:

Examples:
!poll Super Fun Title:a,b,c
!poll Some Other Title - a, b, c
!poll a, b, c

Code:
on *:text:!poll *:#:{
  var %regex = /(?:(.+?)\s*[:-]+\s*|())(.+?)$/iS
  if ($regex($strip($2-),%regex)) {
    var %title = $iif($regml(1),$v1,Poll)
    var %options = $regsubex($regml(2),/\s* $+ $chr(44) $+ \s*/g,$chr(44))
  }
  else return

  noop $strawpoll.create(#,%title,%options)
}

alias strawpoll.create {
  var %chan = $1, %title = $urlencode($2), %options
  var %multi = true, %permissive = false

  var %i = 1, %n = $numtok($3,44)
  while (%i <= %n) {
    %options = %options $+ &options[]= $+ $urlencode($gettok($3,%i,44))
    inc %i
  }

  var %sockname = strawpoll. $+ $ticks
  hfree -w %sockname | hmake %sockname
  hadd %sockname headerfile %sockname $+ .header.txt
  hadd %sockname datafile %sockname $+ .data.txt

  hadd %sockname host strawpoll.me
  hadd %sockname request /ajax/new-poll
  hadd %sockname method POST
  hadd %sockname data $+(title=,%title,%options,&multi=,%multi,&permissive=,%permissive)
  hadd %sockname signal strawpoll.create
  hadd %sockname params %chan

  sockopen %sockname $hget(%sockname,host) 80
}

on *:signal:strawpoll.create:{
  var %err = $1, %sockname = $2, %header = $3, %data = $4, %chan = $5

  if (* 200 OK iswm $read(%header,1)) && ($regex($read(%data,n,1),(\d+))) {
    msg %chan http://strawpoll.me/ $+ $regml(1)
  }
  else msg %chan Could not create poll.

  hfree -w %sockname
  .remove %header | .remove %data
}

on *:sockopen:strawpoll.*:{
  var %a = sockwrite -n $sockname
  %a $hget($sockname,method) $hget($sockname,request) HTTP/1.0
  %a Host: $hget($sockname,host)
  %a Connection: close
  if ($hget($sockname,data) != $null) {
    %a Content-Type: application/x-www-form-urlencoded
    %a Content-Length: $len($v1)
  }
  %a $+($crlf,$hget($sockname,data))
}

on *:sockread:strawpoll.*:{
  var %header
  var %headerfile = $hget($sockname,headerfile)
  var %datafile = $hget($sockname,datafile)

  if (!$hget($sockname,header.complete)) {
    sockread %header
    while (%header != $null) {
      write %headerfile %header
      sockread %header
    }
    if ($sockbr) hadd $sockname header.complete $true
  }
  if ($hget($sockname,header.complete)) {
    sockread &read
    while ($sockbr) {
      bwrite %datafile -1 -1 &read
      sockread &read
    }
  }
}

on *:sockclose:strawpoll.*:{
  var %header = $hget($sockname,headerfile)
  var %data = $hget($sockname,datafile)
  var %signal = $hget($sockname,signal)
  var %params = $hget($sockname,params)

  if (%signal) .signal %signal 0 $sockname %header %data %params
  else {
    hfree -w $sockname
    .remove %header | .remove %data
  }
}

alias urlencode return $regsubex($1-,/([^A-Z0-9])/gi,$+(%,$base($asc(\1),10,16)))

can you make this op only?


#imAbeginner
i made a chat bot for mark_paintball! http://twitch.tv/mark_paintball
Re: Strawpoll.me [Re: judge2020] #244864 02/04/14 03:48 PM
Joined: Jan 2004
Posts: 1,287
L
Loki12583 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,287
Originally Posted By: judge2020
can you make this op only?

If you want any code to be accessible only to ops it takes a single line:

Code:
if ($nick !isop #) return

Re: Strawpoll.me [Re: Loki12583] #244865 02/04/14 04:31 PM
Joined: Mar 2014
Posts: 215
J
judge2020 Offline
Fjord artisan
Offline
Fjord artisan
J
Joined: Mar 2014
Posts: 215
Originally Posted By: Loki12583
Originally Posted By: judge2020
can you make this op only?

If you want any code to be accessible only to ops it takes a single line:

Code:
if ($nick !isop #) return

thanks, i accidentally didn't put # after isop


#imAbeginner
i made a chat bot for mark_paintball! http://twitch.tv/mark_paintball
Re: Strawpoll.me [Re: Loki12583] #244866 02/04/14 04:40 PM
Joined: Mar 2014
Posts: 215
J
judge2020 Offline
Fjord artisan
Offline
Fjord artisan
J
Joined: Mar 2014
Posts: 215
Originally Posted By: Loki12583
Originally Posted By: judge2020
can you make this op only?

If you want any code to be accessible only to ops it takes a single line:

Code:
if ($nick !isop #) return

when i put that in, i get this error (worked before):
Code:
-> *than:* Could not create poll.
-
* /sockwrite: 'HTTP/1.0' no such socket (line 389, remote.ini.ini)
-
ON Unknown command
-
ON Unknown command
-

and here is my line 387-397:
Code:
on *:sockopen:strawpoll.*:{
  var %a = sockwrite -n $sockname
  %a $hget($sockname,method) $hget($sockname,request) HTTP/1.0
  %a Host: $hget($sockname,host)
  %a Connection: close
  if ($hget($sockname,data) != $null) {
    %a Content-Type: application/x-www-form-urlencoded
    %a Content-Length: $len($v1)
  }
  %a $+($crlf,$hget($sockname,data))
}
-

Last edited by judge2020; 02/04/14 04:41 PM.

#imAbeginner
i made a chat bot for mark_paintball! http://twitch.tv/mark_paintball
Re: Strawpoll.me [Re: judge2020] #244867 02/04/14 05:20 PM
Joined: Jan 2004
Posts: 1,287
L
Loki12583 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,287
Well where did you put that line? It needs to go in the beginning of the text event.

Re: Strawpoll.me [Re: Loki12583] #244869 02/04/14 06:12 PM
Joined: Mar 2014
Posts: 215
J
judge2020 Offline
Fjord artisan
Offline
Fjord artisan
J
Joined: Mar 2014
Posts: 215
Originally Posted By: Loki12583
Well where did you put that line? It needs to go in the beginning of the text event.

i did put it at the beginning
Code:
on *:text:!poll*:#:{
  if ( $nick isop #) return
  var %regex = /(?:(.+?)\s*[:-]+\s*|())(.+?)$/iS
  if ($regex($strip($2-),%regex)) {
    var %title = $iif($regml(1),$v1,Poll)
    var %options = $regsubex($regml(2),/\s* $+ $chr(44) $+ \s*/g,$chr(44))
  }
  else return

  noop $strawpoll.create(#,%title,%options)
}

alias strawpoll.create {
  var %chan = $1, %title = $urlencode($2), %options
  var %multi = true, %permissive = false

  var %i = 1, %n = $numtok($3,44)
  while (%i <= %n) {
    %options = %options $+ &options[]= $+ $urlencode($gettok($3,%i,44))
    inc %i
  }

  var %sockname = strawpoll. $+ $ticks
  hfree -w %sockname | hmake %sockname
  hadd %sockname headerfile %sockname $+ .header.txt
  hadd %sockname datafile %sockname $+ .data.txt

  hadd %sockname host strawpoll.me
  hadd %sockname request /ajax/new-poll
  hadd %sockname method POST
  hadd %sockname data $+(title=,%title,%options,&multi=,%multi,&permissive=,%permissive)
  hadd %sockname signal strawpoll.create
  hadd %sockname params %chan

  sockopen %sockname $hget(%sockname,host) 80
}

on *:signal:strawpoll.create:{
  var %err = $1, %sockname = $2, %header = $3, %data = $4, %chan = $5

  if (* 200 OK iswm $read(%header,1)) && ($regex($read(%data,n,1),(\d+))) {
    msg %chan http://strawpoll.me/ $+ $regml(1)
  }
  else msg %chan Could not create poll.

  hfree -w %sockname
  .remove %header | .remove %data
}

on *:sockopen:strawpoll.*:{
  var %a = sockwrite -n $sockname
  %a $hget($sockname,method) $hget($sockname,request) HTTP/1.0
  %a Host: $hget($sockname,host)
  %a Connection: close
  if ($hget($sockname,data) != $null) {
    %a Content-Type: application/x-www-form-urlencoded
    %a Content-Length: $len($v1)
  }
  %a $+($crlf,$hget($sockname,data))
}

on *:sockread:strawpoll.*:{
  var %header
  var %headerfile = $hget($sockname,headerfile)
  var %datafile = $hget($sockname,datafile)

  if (!$hget($sockname,header.complete)) {
    sockread %header
    while (%header != $null) {
      write %headerfile %header
      sockread %header
    }
    if ($sockbr) hadd $sockname header.complete $true
  }
  if ($hget($sockname,header.complete)) {
    sockread &read
    while ($sockbr) {
      bwrite %datafile -1 -1 &read
      sockread &read
    }
  }
}

on *:sockclose:strawpoll.*:{
  var %header = $hget($sockname,headerfile)
  var %data = $hget($sockname,datafile)
  var %signal = $hget($sockname,signal)
  var %params = $hget($sockname,params)

  if (%signal) .signal %signal 0 $sockname %header %data %params
  else {
    hfree -w $sockname
    .remove %header | .remove %data
  }
}

alias urlencode return $regsubex($1-,/([^A-Z0-9])/gi,$+(%,$base($asc(\1),10,16)))


#imAbeginner
i made a chat bot for mark_paintball! http://twitch.tv/mark_paintball
Re: Strawpoll.me [Re: judge2020] #244873 02/04/14 06:52 PM
Joined: Jan 2004
Posts: 1,287
L
Loki12583 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,287
Aside from you including the wrong statement (you excluded the "!" before isop), that works perfectly. The errors you provided are indicative of malformed syntax, which is not present in the text you provided.

Re: Strawpoll.me [Re: Loki12583] #244874 02/04/14 06:55 PM
Joined: Mar 2014
Posts: 215
J
judge2020 Offline
Fjord artisan
Offline
Fjord artisan
J
Joined: Mar 2014
Posts: 215
Originally Posted By: Loki12583
Aside from you including the wrong statement (you excluded the "!" before isop), that works perfectly. The errors you provided are indicative of malformed syntax, which is not present in the text you provided.

oh lol thanks. I'm new at this.


#imAbeginner
i made a chat bot for mark_paintball! http://twitch.tv/mark_paintball
Re: Strawpoll.me [Re: judge2020] #245374 18/04/14 06:40 PM
Joined: Apr 2014
Posts: 18
K
Kawalli Offline
Pikka bird
Offline
Pikka bird
K
Joined: Apr 2014
Posts: 18
Is creating FINE the Strawpoll but before, its posting this error line:

Command:
!poll super fun title:1,2,3

Error Message:
Krawalli -> Not a valid parameter: Super

But it gives out directly the correct created link ^^

Re: Strawpoll.me [Re: Kawalli] #245377 18/04/14 06:57 PM
Joined: Jan 2004
Posts: 1,287
L
Loki12583 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,287
Then you've changed something or another script is interfering with it. "Krawalli -> Not a valid parameter: Super" does not sound like an error that the script or mIRC itself produces.

Re: Strawpoll.me [Re: Loki12583] #245380 18/04/14 07:03 PM
Joined: Apr 2014
Posts: 18
K
Kawalli Offline
Pikka bird
Offline
Pikka bird
K
Joined: Apr 2014
Posts: 18
Oops... my bad laugh

Re: Strawpoll.me [Re: Loki12583] #246518 15/06/14 08:12 PM
Joined: Mar 2014
Posts: 52
P
patrickplays Offline
Babel fish
Offline
Babel fish
P
Joined: Mar 2014
Posts: 52
Originally Posted By: Loki12583
Syntax: "!poll title : a, b, c", title is optional and will be replaced with a default title "Poll", both ":" and "-" can be used to separate the title; spaces around the title delimiter are optional. This is tested and working:

Examples:
!poll Super Fun Title:a,b,c
!poll Some Other Title - a, b, c
!poll a, b, c

Code:
on *:text:!poll *:#:{
  var %regex = /(?:(.+?)\s*[:-]+\s*|())(.+?)$/iS
  if ($regex($strip($2-),%regex)) {
    var %title = $iif($regml(1),$v1,Poll)
    var %options = $regsubex($regml(2),/\s* $+ $chr(44) $+ \s*/g,$chr(44))
  }
  else return

  noop $strawpoll.create(#,%title,%options)
}

alias strawpoll.create {
  var %chan = $1, %title = $urlencode($2), %options
  var %multi = true, %permissive = false

  var %i = 1, %n = $numtok($3,44)
  while (%i <= %n) {
    %options = %options $+ &options[]= $+ $urlencode($gettok($3,%i,44))
    inc %i
  }

  var %sockname = strawpoll. $+ $ticks
  hfree -w %sockname | hmake %sockname
  hadd %sockname headerfile %sockname $+ .header.txt
  hadd %sockname datafile %sockname $+ .data.txt

  hadd %sockname host strawpoll.me
  hadd %sockname request /ajax/new-poll
  hadd %sockname method POST
  hadd %sockname data $+(title=,%title,%options,&multi=,%multi,&permissive=,%permissive)
  hadd %sockname signal strawpoll.create
  hadd %sockname params %chan

  sockopen %sockname $hget(%sockname,host) 80
}

on *:signal:strawpoll.create:{
  var %err = $1, %sockname = $2, %header = $3, %data = $4, %chan = $5

  if (* 200 OK iswm $read(%header,1)) && ($regex($read(%data,n,1),(\d+))) {
    msg %chan http://strawpoll.me/ $+ $regml(1)
  }
  else msg %chan Could not create poll.

  hfree -w %sockname
  .remove %header | .remove %data
}

on *:sockopen:strawpoll.*:{
  var %a = sockwrite -n $sockname
  %a $hget($sockname,method) $hget($sockname,request) HTTP/1.0
  %a Host: $hget($sockname,host)
  %a Connection: close
  if ($hget($sockname,data) != $null) {
    %a Content-Type: application/x-www-form-urlencoded
    %a Content-Length: $len($v1)
  }
  %a $+($crlf,$hget($sockname,data))
}

on *:sockread:strawpoll.*:{
  var %header
  var %headerfile = $hget($sockname,headerfile)
  var %datafile = $hget($sockname,datafile)

  if (!$hget($sockname,header.complete)) {
    sockread %header
    while (%header != $null) {
      write %headerfile %header
      sockread %header
    }
    if ($sockbr) hadd $sockname header.complete $true
  }
  if ($hget($sockname,header.complete)) {
    sockread &read
    while ($sockbr) {
      bwrite %datafile -1 -1 &read
      sockread &read
    }
  }
}

on *:sockclose:strawpoll.*:{
  var %header = $hget($sockname,headerfile)
  var %data = $hget($sockname,datafile)
  var %signal = $hget($sockname,signal)
  var %params = $hget($sockname,params)

  if (%signal) .signal %signal 0 $sockname %header %data %params
  else {
    hfree -w $sockname
    .remove %header | .remove %data
  }
}

alias urlencode return $regsubex($1-,/([^A-Z0-9])/gi,$+(%,$base($asc(\1),10,16)))


hi, this is not working anymore frown
it worked about 2-3 days ago. could someone help please? laugh

output is: could not create poll.

idk if its cloudfare. i think they added it just now

Last edited by patrickplays; 15/06/14 08:17 PM.
Re: Strawpoll.me [Re: patrickplays] #246522 15/06/14 11:22 PM
Joined: Jan 2004
Posts: 1,287
L
Loki12583 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,287
It is because of cloudfare, they have ddos protection at the moment which verifies your browser. So feel free to work around their explicit actions to block scripts like this.