Logo Search packages:      
Sourcecode: mailody version File versions  Download package

void Mailody::Imaplib::startConnection ( const QString &  server,
int  port,
SocketSafe::Secure  safe 
)

connect to the Imapserver. You can call this safely with changing from socket to secure socket and vice versa.

Parameters:
server the server
port the port to connect to.
safe what safety level

Definition at line 246 of file imaplib.cpp.

References Mailody::SocketSafe::aboutToClose(), disconnected(), error(), Mailody::SocketSafe::reconnect(), and status().

Referenced by Mailody::ImapManager::startConnection().

{
    m_currentMailbox = QString::null;
    m_currentQueueItem = Queue();
    m_readyToSend = false;
    m_queue.clear();

    if (m_socket)
    {
        kdDebug() << "Delete connection" << endl;
        m_socket->aboutToClose();
        m_socket->deleteLater();
        m_socket = 0;
    }

    m_safe = safe;

    switch(safe)
    {
        case SocketSafe::NONE:
            if (port == 0)
                port = 143;
            m_socket  = new SocketSafe(this, "Imaplib", server, port,
                                       SocketSafe::NONE);
            break;
        case SocketSafe::SSL:
            if (port == 0)
                port = 993;
            m_socket  = new SocketSafe(this," Imaplib", server, port,
                                       SocketSafe::SSL);
            break;
        case SocketSafe::TLS:
            if (port == 0)
                port = 143;
            m_socket = new SocketSafe(this, "Imaplib", server, port,
                                      SocketSafe::TLS);
            break;
        case SocketSafe::CLEAR:
            break;
    }

    connect(m_socket, SIGNAL(data(const QString&)),
            SLOT(slotRead(const QString&)));
    connect(m_socket, SIGNAL(connected()),
            SLOT(slotConnected()));
    connect(m_socket, SIGNAL(error(const QString&)),
            SIGNAL(error(const QString&)));
    connect(m_socket, SIGNAL(disconnected()),
            SIGNAL(disconnected()));

    emit status(i18n("Connecting"));
    m_currentQueueItem= Queue(Queue::Connecting,"","");
    m_socket->reconnect();
}


Generated by  Doxygen 1.6.0   Back to index