GMail - Read E-Mails from mIRC!

By TMFKSOFT on Aug 29, 2012

Load this script up and use /gmail to check your email.

This script IS buggy. I am fixing it still.

Version 0.1

; Gmail Notifications - By Thomas Edwards (TMFKSOFT)
; This is a take off from the Gtalk notifications

alias gmail {
  ; This will force check mail, it will also be used with the timer
  echo Reading Email
  set %gmailu EMAILHERE
  set %gmailp PASSWORDHERE
  set %awaiting $false
  set %gmail_getting $false

  sockopen -e mail pop.gmail.com 995
}
on 1:sockopen:mail:{
  sockwrite $sockname user %gmailu $+ $crlf
}
on 1:sockread:mail:{
  var %read
  sockread %read
  ;echo GMAIL DEBUG: %read
  tokenize 32 %read
  if ($3 == PASS) {
    ;echo Sending Password.
    sockwrite $sockname pass %gmailp $+ $crlf
  }
  else if ($2 == Welcome.) {
    ;echo Getting LIST.
    sockwrite $sockname list $+ $crlf
  }
  else if ($3 == follows) {
    set %awaiting $true
    echo Awaiting Message
  }
  else if ($3 == Messages) {
    if ($2 != %gmailunread) {
      var %x %gmailunread
      while (%x <= $2) {
        echo Reading Message %x
        sockwrite $sockname retr %x $+ $crlf
        set %awaiting $true
        inc %x
      }
      var %unsetme $tip(unread_info,Gmail Info,$2 Unread E-Mails,%ptimer,$mircexe,5,p_reply)
      set %gmailunread $2
    }
  }
  else if ($1 == .) {
    if (%awaiting == $true) {
      set %awaiting $false
      unset %gmail_subject %gmail_sender
    }
    else {
      echo END of Messages.
      sockwrite $sockname quit %x $+ $crlf
      sockclose $sockname
    }
  }
  else {
    if (%awaiting == $true) {
      echo Got Message Data
      if ($1 == Content-Type: && $2 == text/plain;) {
        echo Recieving RAW.
        set %gmail_getting $true
      }
      else if ($1 == Content-Type: && $2 == multipart/alternative;) {
        ;; Boundry
        set %gmail_boundry $right($3,-9)

      }
      else if ($1 == Subject:) {
        set %gmail_subject $2-
      }
      else if ($1 == $+(--,%gmail_boundry)) {
        var %unsetme $tip(unread_info,%gmail_sender,$1-,%ptimer,$mircexe,5,p_reply) 
        echo End of MESSAGE.
        set %gmail_getting $false
      }
      else {
        if (%gmail_getting == $true) { 
          if ($1 != $null) {
            var %unsetme $tip(unread_info,%gmail_subject,$1-,%ptimer,$mircexe,5,p_reply) 
          }
        }
      }
    }
  }
}

Comments

Sign in to comment.
Clouds   -  Jul 05, 2013

It doesn't actually read the email(s), it just displays the following:

GMAIL DEBUG: +OK 4 messages (2938 bytes)
GMAIL DEBUG: 1 731
GMAIL DEBUG: 2 736
GMAIL DEBUG: 3 734
GMAIL DEBUG: 4 737
GMAIL DEBUG: .
END of Messages.

TMFKSOFT  -  Jul 05, 2013

The Script is old and GMail has changed stuff since then.
Sadly I dont have a machine I can dev on so I can't fix the issue.

Sign in to comment

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.