Logo Search packages:      
Sourcecode: kbiff version File versions

void KBiffMonitor::setMailbox ( KBiffURL url  )  [slot]

Sets the mailbox to monitor. It uses a KBiffURL to specify the protocol, host, username, password, port and path (depending on protocol type). KBiffMonitor recognizes eight protocols:

  • mbox Unix style mailbox files
  • pop3 POP3
  • imap4 IMAP4
  • maildir Mailboxes in maildir format
  • mh Mailboxes in MH format
  • nttp USENET newsgroups
  • imap4s imap4 over SSL
  • pop3s POP3 over SSL

Some examples:

 mbox:/var/spool/mail/granroth
 

This would monitor a local file called '/var/spool/mail/granroth'

 pop3://granroth:password@host.net:1234
 

This would monitor POP3 mailbox 'granroth' on server 'host.net' using 1234 as the port and 'password' as the password.

 imap4://granroth:password@host.net/Mail/mailbox
 

This would monitor IMAP4 mailbox 'Mail/mailbox' on server 'host.net' with 'granroth' as the user and 'password' as the password.

Definition at line 230 of file kbiffmonitor.cpp.

References KBiffURL::pass(), KBiffURL::searchPar(), and signal_checkMail().

Referenced by setMailbox().

{
    if (imap)
    {
        delete imap;
        imap = 0;
    }
    if (pop)
    {
        delete pop;
        pop = 0;
    }
    if (nntp)
    {
        delete nntp;
        nntp = 0;
    }

    protocol = url.protocol();

    if (protocol == "imap4")
    {
        disconnect(this);

        imap = new KBiffImap;

        connect(this, SIGNAL(signal_checkMail()), SLOT(checkImap()));
        server   = url.host();
        user     = url.user();
        password = url.pass();

        mailbox  = url.path().right(url.path().length() - 1); 
        port     = (url.port() > 0) ? url.port() : 143;

        preauth = url.query() == "?preauth" ? true : false;
        keepalive = url.ref() == "keepalive" ? true : false;
        bool async = url.ref() == "async" ? true : false;
        imap->setAsync(async);
#ifdef USE_SSL
        imap->setSSL(false);
#endif // USE_SSL
        simpleURL = "imap4://" + server + "/" + mailbox;
    }

#ifdef USE_SSL
    if (protocol == "imap4s")
    {
        disconnect(this);

        imap = new KBiffImap;

        connect(this, SIGNAL(signal_checkMail()), SLOT(checkImap()));
        server   = url.host();
        user     = url.user();
        password = url.pass();

        mailbox  = url.path().right(url.path().length() - 1); 
        port     = (url.port() > 0) ? url.port() : 993;

        preauth = url.query() == "?preauth" ? true : false;
        keepalive = url.ref() == "keepalive" ? true : false;
        bool async = url.ref() == "async" ? true : false;
        imap->setAsync(async);
      imap->setSSL(true);
        simpleURL = "imap4s://" + server + "/" + mailbox;
    }
#endif // USE_SSL

    if (protocol == "pop3")
    {
        disconnect(this);

        pop = new KBiffPop;

        connect(this, SIGNAL(signal_checkMail()), SLOT(checkPop()));
        server   = url.host();
        user     = url.user();
        password = url.pass();
        mailbox  = url.user();
        port     = (url.port() > 0) ? url.port() : 110;

        keepalive = url.ref() == "keepalive" ? true : false;
        bool async = url.ref() == "async" ? true : false;
        pop->setAsync(async);
#ifdef USE_SSL
        pop->setSSL(false);
#endif // USE_SSL

        simpleURL = "pop3://" + server + "/" + mailbox;
    }

#ifdef USE_SSL
    if (protocol == "pop3s")
    {
        disconnect(this);

        pop = new KBiffPop;

        connect(this, SIGNAL(signal_checkMail()), SLOT(checkPop()));
        server   = url.host();
        user     = url.user();
        password = url.pass();
        mailbox  = url.user();
        port     = (url.port() > 0) ? url.port() : 995;

        keepalive = url.ref() == "keepalive" ? true : false;
        bool async = url.ref() == "async" ? true : false;
        pop->setAsync(async);
      pop->setSSL(true);

        simpleURL = "pop3s://" + server + "/" + mailbox;
    }
#endif // USE_SSL

    if (protocol == "mbox")
    {
        disconnect(this);

        connect(this, SIGNAL(signal_checkMail()), SLOT(checkMbox()));
        mailbox = url.path();

        simpleURL = "mbox:" + mailbox;
    }

    if (protocol == "file")
    {
        disconnect(this);

        connect(this, SIGNAL(signal_checkMail()), SLOT(checkLocal()));
        mailbox = url.path();

        simpleURL = "file:" + mailbox;
    }

    if (protocol == "maildir")
    {
        disconnect(this);

        connect(this, SIGNAL(signal_checkMail()), SLOT(checkMaildir()));
        mailbox = url.path();

        simpleURL = "maildir:" + mailbox;
    }

    if (protocol == "mh")
    {
        disconnect(this);

        connect(this, SIGNAL(signal_checkMail()), SLOT(checkMHdir()));
        mailbox = url.path();

        simpleURL = "mh:" + mailbox;
    }

    if (protocol == "nntp")
    {
        disconnect(this);

        nntp = new KBiffNntp;

        connect(this, SIGNAL(signal_checkMail()), SLOT(checkNntp()));
        server   = url.host();
        user     = url.user();
        password = url.pass();

        mailbox  = url.path().right(url.path().length() - 1); 
        port     = (url.port() > 0) ? url.port() : 119;

        keepalive = url.ref() == "keepalive" ? true : false;
        bool async = url.ref() == "async" ? true : false;
        nntp->setAsync(async);
#ifdef USE_SSL
        nntp->setSSL(false);
#endif // USE_SSL
        simpleURL = "nntp://" + server + "/" + mailbox;
    }

    fetchCommand = url.searchPar("fetch");
}


Generated by  Doxygen 1.6.0   Back to index