Diffstat (limited to 'noncore/unsupported/mail2/libmail/imapbase.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/unsupported/mail2/libmail/imapbase.cpp | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/noncore/unsupported/mail2/libmail/imapbase.cpp b/noncore/unsupported/mail2/libmail/imapbase.cpp index 9a2ba47..4753f43 100644 --- a/noncore/unsupported/mail2/libmail/imapbase.cpp +++ b/noncore/unsupported/mail2/libmail/imapbase.cpp | |||
@@ -55,3 +55,3 @@ void IMAPBase::writeCommands() | |||
55 | #ifndef QT_NO_DEBUG | 55 | #ifndef QT_NO_DEBUG |
56 | qDebug("IMAP > " + (*it).stripWhiteSpace()); | 56 | qDebug("IMAP > " + (*it).stripWhiteSpace().local8Bit ()); |
57 | #endif | 57 | #endif |
@@ -59,2 +59,6 @@ void IMAPBase::writeCommands() | |||
59 | _writingAllowed = false; | 59 | _writingAllowed = false; |
60 | if (( *it ). find ( QRegExp ( "^[a-z][0-9]+ " )) == 0 ) | ||
61 | _lasttag = (*it).left(2); | ||
62 | |||
63 | connect(_socket, SIGNAL(readyRead()), SLOT(slotDataAvailiable())); | ||
60 | _commandQueue.remove(it); | 64 | _commandQueue.remove(it); |
@@ -95,13 +99,24 @@ void IMAPBase::slotDisconnected() | |||
95 | 99 | ||
100 | #include <unistd.h> | ||
101 | |||
96 | void IMAPBase::slotDataAvailiable() | 102 | void IMAPBase::slotDataAvailiable() |
97 | { | 103 | { |
104 | static bool firstline = true; | ||
105 | |||
98 | while (_socket->canReadLine()) { | 106 | while (_socket->canReadLine()) { |
99 | _data += _socket->readLine(); | 107 | QString tmp = _socket-> readLine ( ); |
100 | if (_socket->atEnd()) { | 108 | |
101 | #ifndef QT_NO_DEBUG | 109 | _data += tmp; |
102 | qDebug("IMAP < " + _data.stripWhiteSpace()); | 110 | qDebug ( "New Line [%d]: '%s'\n", _connected ? 1 : 0, tmp.latin1( )); |
103 | #endif | 111 | |
112 | if ( firstline || tmp. left(2) == _lasttag ) { | ||
113 | firstline = false; | ||
114 | |||
115 | // if ( _socket-> atEnd ( )) | ||
116 | qDebug ( "at end -> emitting\n" ); | ||
117 | |||
118 | QObject::disconnect(_socket, SIGNAL(readyRead()), this, SLOT(slotDataAvailiable())); | ||
104 | emit dataReceived(_data); | 119 | emit dataReceived(_data); |
120 | _data = QString::null; | ||
105 | _writingAllowed = true; | 121 | _writingAllowed = true; |
106 | _data = QString(0); | ||
107 | } | 122 | } |
@@ -110 +125,8 @@ void IMAPBase::slotDataAvailiable() | |||
110 | 125 | ||
126 | void IMAPBase::tryRead ( QString &data ) | ||
127 | { | ||
128 | qDebug ( "Trying to read...\n" ); | ||
129 | |||
130 | while ( _socket-> canReadLine ( )) | ||
131 | data += _socket-> readLine ( ); | ||
132 | } | ||