author | sandman <sandman> | 2002-08-06 00:55:56 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-08-06 00:55:56 (UTC) |
commit | b980135ff5ce5447ca41411b6ace74ce2803fadb (patch) (unidiff) | |
tree | c02cdd16e1435855bff16e2c2707f5d5484d43f4 /noncore/unsupported/mail2/libmail/imapbase.cpp | |
parent | d96244956f42782f987acc2b5efb32dc1f1dd70a (diff) | |
download | opie-b980135ff5ce5447ca41411b6ace74ce2803fadb.zip opie-b980135ff5ce5447ca41411b6ace74ce2803fadb.tar.gz opie-b980135ff5ce5447ca41411b6ace74ce2803fadb.tar.bz2 |
mail2 should display (most) mails now with these workarounds. imap handling
is still buggy by design though.
Diffstat (limited to 'noncore/unsupported/mail2/libmail/imapbase.cpp') (more/less context) (ignore 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 | |||
@@ -52,12 +52,16 @@ void IMAPBase::writeCommands() | |||
52 | QStringList::Iterator it; | 52 | QStringList::Iterator it; |
53 | for (it = _commandQueue.begin(); it != _commandQueue.end(); it++) { | 53 | for (it = _commandQueue.begin(); it != _commandQueue.end(); it++) { |
54 | if (!(*it).isEmpty() && _writingAllowed) { | 54 | if (!(*it).isEmpty() && _writingAllowed) { |
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 |
58 | _socket->writeBlock((*it).latin1(), (*it).length()); | 58 | _socket->writeBlock((*it).latin1(), (*it).length()); |
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); |
61 | break; | 65 | break; |
62 | } | 66 | } |
63 | } | 67 | } |
@@ -92,19 +96,37 @@ void IMAPBase::slotDisconnected() | |||
92 | _connected = false; | 96 | _connected = false; |
93 | emit disconnected(); | 97 | emit disconnected(); |
94 | } | 98 | } |
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 | } |
108 | } | 123 | } |
109 | } | 124 | } |
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 | } | ||