mIRC Home    About    Download    Register    News    Help

Print Thread
#143044 21/02/06 02:48 AM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
OP Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Has anyone tried using the new SSL sockets in mIRC 6.17? I just tried converting one of my working non-ssl socket scripts to an ssl version. This particular script retrieves emails using POP3. I set it up to connect to the Gmail POP3 server. The script works perfectly the first time I run it. The emails are retrieved and deleted from the server like they did in the non-ssl version. However, if I try to run the script again, mIRC locks up and I get the typical "mIRC has encountered a problem and needs to close" message from windows. Here is the code I'm using in case anyone else wants to confirm this (see warning below):

Code:
alias dogetmail getmail -e pop.gmail.com 995 [color:green]username password[/color]

alias getmail {
  if (-* iswm $1) {
    var %switches = $1
    tokenize 32 $2-
  }

  ;--------
  set %chkADDR $1
  set %chkPORT $2
  set %chkUSER $3
  set %chkPASS $4
  ;--------

  set %getmail.write 0
  set %getmail.state 1
  if ($sock(getmail)) sockclose getmail
  sockopen $iif(e isin %switches,-e) getmail %chkADDR %chkPORT
  .timer 1 5 sockclose getmail
}

on *:SOCKREAD:getmail:{
  var %s
  sockread %s
  tokenize 32 %s
  echo -a > $1-

  if (-ERR isin $1) {
    echo 4 -a ERROR: $1-
    echo 4 -a %getmail.state QUIT
    sockwrite -n $sockname QUIT
    ; set %getmail.state -1
  }
  elseif (%getmail.state < 0) {
    echo 4 -a %getmail.state Done
    sockclose $sockname
  }
  elseif ((OK isin $1) && (!%getmail.write)) {
    if (%getmail.state == 1) {
      echo 3 -a USER
      sockwrite -n $sockname USER %chkUSER
      inc %getmail.state
    }
    elseif (%getmail.state == 2) {
      echo 3 -a PASS
      sockwrite -n $sockname PASS %chkPASS
      inc %getmail.state
    }
    elseif (%getmail.state == 3) {
      echo 3 -a STAT
      sockwrite -n $sockname STAT
      inc %getmail.state
    }
    elseif (%getmail.state == 4) {
      echo 12 -a $2 $iif($2 == 1,message,messages)
      if ($2 > 0) {
        set %getmail.count 1
        set %getmail.state 5
        set %getmail.num $2
        .remove mailget.tmp
        echo 3 -a RETR %getmail.count
        sockwrite -n $sockname RETR %getmail.count
      }
      else {
        echo 3 -a QUIT
        sockwrite -n $sockname QUIT
        set %getmail.state 99
      }
    }
    elseif (%getmail.state == 5) {
      echo 7 -a Receiving %getmail.count
      set %getmail.write 1
    }
    elseif (%getmail.state == 6) {
      if (%getmail.dele < %getmail.num) {
        inc %getmail.dele
        echo 3 -a DELE %getmail.dele
        sockwrite -n $sockname DELE %getmail.dele
      }
      else {
        echo 3 -a QUIT
        sockwrite -n $sockname QUIT
        set %getmail.state 99
      }
    }
    elseif (%getmail.state == 99) {
      echo 3 -a DONE
      sockclose $sockname
      unset %getmail.*
    }
  }
  elseif (%getmail.state == 5) {
    if ($1- == .) {
      var %getmail.ticks = $ticks
      .rename mailget.tmp $+(%getmail.ticks,.txt)
      echo 7 -a Received %getmail.count
      echo 7 -a Saved as $+(%getmail.ticks,.txt)
      set %getmail.write 0
      if (%getmail.count < %getmail.num) {
        inc %getmail.count
        echo 3 -a RETR %getmail.count
        sockwrite -n $sockname RETR %getmail.count
      }
      else {
        set %getmail.dele 1
        echo 3 -a DELE 1
        sockwrite -n $sockname DELE 1
        set %getmail.state 6
      }
    }
    else {
      write mailget.tmp $iif($1,$1-,$crlf)
    }
  }
}


Just change the username and password to those for a gmail account.

THIS CODE WILL DELETE ALL THE MESSAGES FROM THE ACCOUNT AFTER THEY HAVE BEEN RETRIEVED. USE AT YOUR OWN RISK.

-genius_at_work

#143045 21/02/06 08:24 AM
Joined: Feb 2006
Posts: 3
F
Self-satisified door
Offline
Self-satisified door
F
Joined: Feb 2006
Posts: 3
Same problems. Bug-ridden. Tried different OpenSSL versions to no avail. No gMail checking for a while yet.

#143046 21/02/06 01:28 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
According to the pop3 server I have 4 emails in my inbox (which is true), so the snippet retrieved 3 of the emails, but when it sent RETR 4 there was no reply and the snippet never finished doing whatever it's doing, this is probably why it never crashes for me.

#143047 21/02/06 01:37 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
I don't think you were able to use non-ssl sockets to retrieve Gmail, as its POP3 is SSL, unless of course you sniffed the packets with an exernal http(s) sniffer, to retrieve your specific cookie for your inbox, and simulated a webbrowser.

There is a way without having to have an external program installed, with COM+sockets which is illustrated in my Gmail Checker.

What my addon does is automate this cookie retrieval process with the use of COM.

If I wouldn't have broken my shoulder I would have updated the Gmail Checker by now to expand it with reading capabilities, as the relevant code is working, but I'm in too much pain right now to finish it up, and typing/scripting with one hand completely sux.


Gone.
#143048 21/02/06 02:41 PM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
OP Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
The non-ssl version wasn't checking the gmail account, it was checking another, non-ssl email I have. The non-ssl code worked perfectly on the non-ssl server. The only changes I made to the code to make it ssl are in the /getmail alias. I added code to allow switches (which are removed) and then and $iif tests for the -e switch and adds it to the /sockopen if it is present, otherwise it remains as a non-ssl socket.

BTW, I'm not *really* looking to check/retrieve my gmail, as I never actually use gmail. I just wanted to try out the new ssl sockets.

@hixxy: That happened to me once too. (May be another symptom of the same bug.) Try restarting mIRC and running it again (several times). There don't even necessarily need to be emails on the account, as the code will connect, see that there are no emails, and disconnect. The lockups were happening both when there were emails, and when there were none.

-genius_at_work

#143049 21/02/06 03:00 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
I just tried it again a few times with a different amount of emails in my inbox and it crashed this time. It retrieved 7/8 the first time, then the second time it got 5/8 and then crashed a few seconds later. The weird thing is that I was able to use mIRC as normal between the time the emails stopped being read and the time mIRC crashed.

#143050 22/02/06 02:52 AM
Joined: Feb 2006
Posts: 3
F
Self-satisified door
Offline
Self-satisified door
F
Joined: Feb 2006
Posts: 3
As I said I've got the same problems. I should have mentioned I was using my own script. It was a very simple adjustment to activate an SSL option as you've shown and I came here looking to see if anyone else had had SSL socket problems. I've tried different SSL-enabled POPs with the same results.

The mIRC -e socket is buggy. Eventually mIRC will crash but even if it doesn't data in memory becomes corrupted and weird behaviour will be exhibited. The error is with the handling of ssleay32.dll according to the crash info.

Definite bug. Some kind of memory handling problem by the looks of the some the weird stuff going on but that's pure speculation.


Link Copied to Clipboard