mIRC Home    About    Download    Register    News    Help

Print Thread
Page 2 of 2 1 2
#141535 12/02/06 02:09 PM
Joined: May 2005
Posts: 449
Fjord artisan
OP Offline
Fjord artisan
Joined: May 2005
Posts: 449
My script is still only working sometimes. I've decided to put IF statements to see what point it's at before sending the next command. My question is: Is there a way to refer to what it has just read, like how other "ON" events use $1- to refer to what triggered the event? Would $sockbr equal the text in the buffer or just a 1 or 0 to show whether there is something in the buffer? Thanks.

I'd like to add checks to make sure it is getting the right response before sending the next command. How/where would I put these into the script I have in this thread?
I'll assume for now that $sockbr will return the contents of the buffer.
Code:
if ($sockbr == +OK POP3 server ready.) { sockwrite -n $sockname user UserName }
if ($sockbr == +OK please send PASS command) { sockwrite -n $sockname pass Password }
if ($sockbr == +OK MyName is welcome here) { sockwrite -n $sockname list }

Thanks.

Last edited by bwr30060; 12/02/06 02:40 PM.
#141536 12/02/06 03:36 PM
Joined: May 2005
Posts: 449
Fjord artisan
OP Offline
Fjord artisan
Joined: May 2005
Posts: 449
I figured out the problem. I had two sockreads, so it was skipping over some things that it needed in the buffer. I'll post the new code.
Code:
on *:sockopen:mail:{
  var %temptext
  sockread %temptext
}
on 1:sockread:mail:{
  ;sockwrite -n $sockname user bwraab
  sockread %temptext
  if (!$window(mail)) { window @mail }
  window @mail
  if (%temptext == +OK POP3 server ready.) { sockwrite -n $sockname user UserName }
  if (%temptext == +OK please send PASS command) { sockwrite -n $sockname pass Password }
  if (%temptext == +OK MyName is welcome here) { sockwrite -n $sockname list }
  if (%temptext == +OK 1 messages) { sockwrite -n $sockname retr 1 }
  if ($sockerr) {
    echo -a Error.
    halt
  }  
  if (%temptext) {    
    aline @mail %temptext
  }
  ;sockwrite -n $sockname quit
}

I hard coded "retr 1" in there just for testing purposes, because I knew there was 1 message on the server. I'm still working on this script, so it will change.

Page 2 of 2 1 2

Link Copied to Clipboard