summaryrefslogtreecommitdiffstats
path: root/libkmime/kmime_parsers.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-04-13 00:46:47 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-04-13 00:46:47 +0000
commit67e29a054cfcb1b0d2fe6b0a316cf6b3eec087b7 (patch)
tree5f52a9eada2e9f3654fc327d7c14dfef570a6ecb /libkmime/kmime_parsers.cpp
parent2ee4bf4fd5eff93b2fbef0ff8e8063edffc5da5c (diff)
downloadtdepim-67e29a054cfcb1b0d2fe6b0a316cf6b3eec087b7.tar.gz
tdepim-67e29a054cfcb1b0d2fe6b0a316cf6b3eec087b7.zip
Initial conversion of kdepim to TQt
This will probably require some tweaking before it will build under Qt4, however Qt3 builds are OK. Any alterations this commit makes to kdepim behaviour under Qt3 are unintentional and should be fixed. git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1227832 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libkmime/kmime_parsers.cpp')
-rw-r--r--libkmime/kmime_parsers.cpp70
1 files changed, 35 insertions, 35 deletions
diff --git a/libkmime/kmime_parsers.cpp b/libkmime/kmime_parsers.cpp
index 446f1af7c..c9dc1e3d1 100644
--- a/libkmime/kmime_parsers.cpp
+++ b/libkmime/kmime_parsers.cpp
@@ -39,7 +39,7 @@ bool MultiPart::parse()
//find the first valid boundary
while(1) {
- if( (pos1=s_rc.find(b, pos1))==-1 || pos1==0 || s_rc[pos1-1]=='\n' ) //valid boundary found or no boundary at all
+ if( (pos1=s_rc.tqfind(b, pos1))==-1 || pos1==0 || s_rc[pos1-1]=='\n' ) //valid boundary found or no boundary at all
break;
pos1+=blen; //boundary found but not valid => skip it;
}
@@ -56,11 +56,11 @@ bool MultiPart::parse()
while(pos1>-1 && pos2>-1) {
//skip the rest of the line for the first boundary - the message-part starts here
- if( (pos1=s_rc.find('\n', pos1))>-1 ) { //now search the next linebreak
+ if( (pos1=s_rc.tqfind('\n', pos1))>-1 ) { //now search the next linebreak
//now find the next valid boundary
pos2=++pos1; //pos1 and pos2 point now to the beginning of the next line after the boundary
while(1) {
- if( (pos2=s_rc.find(b, pos2))==-1 || s_rc[pos2-1]=='\n' ) //valid boundary or no more boundaries found
+ if( (pos2=s_rc.tqfind(b, pos2))==-1 || s_rc[pos2-1]=='\n' ) //valid boundary or no more boundaries found
break;
pos2+=blen; //boundary is invalid => skip it;
}
@@ -77,7 +77,7 @@ bool MultiPart::parse()
pos2+=blen; //pos2 points now to the first charakter after the boundary
if(s_rc[pos2]=='-' && s_rc[pos2+1]=='-') { //end-boundary
pos1=pos2+2; //pos1 points now to the character directly after the end-boundary
- if( (pos1=s_rc.find('\n', pos1))>-1 ) //skipt the rest of this line
+ if( (pos1=s_rc.tqfind('\n', pos1))>-1 ) //skipt the rest of this line
e_pilouge=s_rc.mid(pos1+1, s_rc.length()-pos1-1); //everything after the end-boundary is considered as the epilouge
pos1=-1;
pos2=-1; //break
@@ -149,12 +149,12 @@ bool UUEncoded::parse()
while (success) {
int beginPos=currentPos, uuStart=currentPos, endPos=0, lineCount=0, MCount=0, pos=0, len=0;
- bool tqcontainsBegin=false, tqcontainsEnd=false;
+ bool containsBegin=false, containsEnd=false;
TQCString tmp,fileName;
- if( (beginPos=s_rc.find(TQRegExp("begin [0-9][0-9][0-9]"),currentPos))>-1 && (beginPos==0 || s_rc.at(beginPos-1)=='\n') ) {
- tqcontainsBegin=true;
- uuStart=s_rc.find('\n', beginPos);
+ if( (beginPos=s_rc.tqfind(TQRegExp("begin [0-9][0-9][0-9]"),currentPos))>-1 && (beginPos==0 || s_rc.at(beginPos-1)=='\n') ) {
+ containsBegin=true;
+ uuStart=s_rc.tqfind('\n', beginPos);
if(uuStart==-1) {//no more line breaks found, we give up
success = false;
break;
@@ -163,12 +163,12 @@ bool UUEncoded::parse()
}
else beginPos=currentPos;
- if ( (endPos=s_rc.find("\nend",(uuStart>0)? uuStart-1:0))==-1 )
+ if ( (endPos=s_rc.tqfind("\nend",(uuStart>0)? uuStart-1:0))==-1 )
endPos=s_rc.length(); //no end found
else
- tqcontainsEnd=true;
+ containsEnd=true;
- if ((tqcontainsBegin && tqcontainsEnd) || firstIteration) {
+ if ((containsBegin && containsEnd) || firstIteration) {
//printf("beginPos=%d , uuStart=%d , endPos=%d\n", beginPos, uuStart, endPos);
//all lines in a uuencoded text start with 'M'
@@ -183,18 +183,18 @@ bool UUEncoded::parse()
//printf("lineCount=%d , MCount=%d\n", lineCount, MCount);
if( MCount==0 || (lineCount-MCount)>10 ||
- ((!tqcontainsBegin || !tqcontainsEnd) && (MCount<15)) ) { // harder check for splitted-articles
+ ((!containsBegin || !containsEnd) && (MCount<15)) ) { // harder check for splitted-articles
success = false;
break; //too many "non-M-Lines" found, we give up
}
- if( (!tqcontainsBegin || !tqcontainsEnd) && s_ubject) { // message may be split up => parse subject
+ if( (!containsBegin || !containsEnd) && s_ubject) { // message may be split up => parse subject
TQRegExp rx("[0-9]+/[0-9]+");
pos=rx.search(TQString(s_ubject), 0);
len=rx.matchedLength();
if(pos!=-1) {
tmp=s_ubject.mid(pos, len);
- pos=tmp.find('/');
+ pos=tmp.tqfind('/');
p_artNr=tmp.left(pos).toInt();
t_otalNr=tmp.right(tmp.length()-pos-1).toInt();
} else {
@@ -207,7 +207,7 @@ bool UUEncoded::parse()
if(beginPos>0)
t_ext.append(s_rc.mid(currentPos,beginPos-currentPos));
- if(tqcontainsBegin)
+ if(containsBegin)
fileName = s_rc.mid(beginPos+10, uuStart-beginPos-11); //everything between "begin ### " and the next LF is considered as the filename
else
fileName = "";
@@ -216,7 +216,7 @@ bool UUEncoded::parse()
m_imeTypes.append(guessMimeType(fileName));
firstIteration=false;
- int next = s_rc.find('\n', endPos+1);
+ int next = s_rc.tqfind('\n', endPos+1);
if(next==-1) { //no more line breaks found, we give up
success = false;
break;
@@ -249,12 +249,12 @@ bool YENCEncoded::yencMeta(TQCString& src, const TQCString& name, int* value)
bool found = false;
TQCString sought=name + "=";
- int iPos=src.find( sought);
+ int iPos=src.tqfind( sought);
if (iPos>-1) {
- int pos1=src.find(' ', iPos);
- int pos2=src.find('\r', iPos);
- int pos3=src.find('\t', iPos);
- int pos4=src.find('\n', iPos);
+ int pos1=src.tqfind(' ', iPos);
+ int pos2=src.tqfind('\r', iPos);
+ int pos3=src.tqfind('\t', iPos);
+ int pos4=src.tqfind('\n', iPos);
if (pos2>=0 && (pos1<0 || pos1>pos2))
pos1=pos2;
if (pos3>=0 && (pos1<0 || pos1>pos3))
@@ -281,19 +281,19 @@ bool YENCEncoded::parse()
while (success) {
int beginPos=currentPos, yencStart=currentPos;
- bool tqcontainsPart=false;
+ bool containsPart=false;
TQCString fileName,mimeType;
- if ((beginPos=s_rc.find("=ybegin ", currentPos))>-1 && ( beginPos==0 || s_rc.at( beginPos-1)=='\n') ) {
- yencStart=s_rc.find( '\n', beginPos);
+ if ((beginPos=s_rc.tqfind("=ybegin ", currentPos))>-1 && ( beginPos==0 || s_rc.at( beginPos-1)=='\n') ) {
+ yencStart=s_rc.tqfind( '\n', beginPos);
if (yencStart==-1) { // no more line breaks found, give up
success = false;
break;
} else {
yencStart++;
- if (s_rc.find("=ypart", yencStart)==yencStart) {
- tqcontainsPart=true;
- yencStart=s_rc.find( '\n', yencStart);
+ if (s_rc.tqfind("=ypart", yencStart)==yencStart) {
+ containsPart=true;
+ yencStart=s_rc.tqfind( '\n', yencStart);
if ( yencStart== -1) {
success=false;
break;
@@ -305,14 +305,14 @@ bool YENCEncoded::parse()
// Filenames can contain any embedded chars until end of line
TQCString meta=s_rc.mid(beginPos, yencStart-beginPos);
- int namePos=meta.find("name=");
+ int namePos=meta.tqfind("name=");
if (namePos== -1) {
success=false;
break;
}
- int eolPos=meta.find('\r', namePos);
+ int eolPos=meta.tqfind('\r', namePos);
if (eolPos== -1)
- eolPos=meta.find('\n', namePos);
+ eolPos=meta.tqfind('\n', namePos);
if (eolPos== -1) {
success=false;
break;
@@ -332,7 +332,7 @@ bool YENCEncoded::parse()
}
int partBegin, partEnd;
- if (tqcontainsPart) {
+ if (containsPart) {
if (!yencMeta(meta, "part", &p_artNr)) {
success=false;
break;
@@ -355,7 +355,7 @@ bool YENCEncoded::parse()
int len=s_rc.length();
bool lineStart=true;
int lineLength=0;
- bool tqcontainsEnd=false;
+ bool containsEnd=false;
TQByteArray binary = TQByteArray(yencSize);
while (pos<len) {
int ch=s_rc.at(pos);
@@ -382,7 +382,7 @@ bool YENCEncoded::parse()
ch=s_rc.at( pos+1);
if (lineStart && ch=='y')
{
- tqcontainsEnd=true;
+ containsEnd=true;
break;
}
pos+=2;
@@ -412,7 +412,7 @@ bool YENCEncoded::parse()
}
}
- if (!tqcontainsEnd)
+ if (!containsEnd)
{
success=false;
break;
@@ -424,7 +424,7 @@ bool YENCEncoded::parse()
}
// pos now points to =yend; get end data
- eolPos=s_rc.find('\n', pos);
+ eolPos=s_rc.tqfind('\n', pos);
if (eolPos== -1)
{
success=false;