diff options
Diffstat (limited to 'libkpgp/kpgpbase5.cpp')
-rw-r--r-- | libkpgp/kpgpbase5.cpp | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/libkpgp/kpgpbase5.cpp b/libkpgp/kpgpbase5.cpp index 46ded2c73..288957399 100644 --- a/libkpgp/kpgpbase5.cpp +++ b/libkpgp/kpgpbase5.cpp @@ -112,7 +112,7 @@ Base5::encsign( Block& block, const KeyIDList& recipients, if (signonly) { input.append("\n"); - input.tqreplace(TQRegExp("[ \t]+\n"), "\n"); //strip trailing whitespace + input.replace(TQRegExp("[ \t]+\n"), "\n"); //strip trailing whitespace } //We have to do this otherwise it's all in vain @@ -123,7 +123,7 @@ Base5::encsign( Block& block, const KeyIDList& recipients, status = ERROR; // now parse the returned info - if(error.tqfind("Cannot unlock private key") != -1) + if(error.find("Cannot unlock private key") != -1) { errMsg = i18n("The passphrase you entered is invalid."); status |= ERROR; @@ -133,16 +133,16 @@ Base5::encsign( Block& block, const KeyIDList& recipients, //{ TQCString aStr; index = -1; - while((index = error.tqfind("WARNING: The above key",index+1)) != -1) + while((index = error.find("WARNING: The above key",index+1)) != -1) { - int index2 = error.tqfind("But you previously",index); - int index3 = error.tqfind("WARNING: The above key",index+1); + int index2 = error.find("But you previously",index); + int index3 = error.find("WARNING: The above key",index+1); if(index2 == -1 || (index2 > index3 && index3 != -1)) { // the key wasn't valid, no encryption to this person // extract the person - index2 = error.tqfind('\n',index); - index3 = error.tqfind('\n',index2+1); + index2 = error.find('\n',index); + index3 = error.find('\n',index2+1); aStr += error.mid(index2+1, index3-index2-1); aStr += ", "; } @@ -150,7 +150,7 @@ Base5::encsign( Block& block, const KeyIDList& recipients, if(!aStr.isEmpty()) { aStr.truncate(aStr.length()-2); - if(error.tqfind("No valid keys found") != -1) + if(error.find("No valid keys found") != -1) errMsg = i18n("The key(s) you want to encrypt your message " "to are not trusted. No encryption done."); else @@ -161,10 +161,10 @@ Base5::encsign( Block& block, const KeyIDList& recipients, status |= BADKEYS; } //} - if((index = error.tqfind("No encryption keys found for")) != -1) + if((index = error.find("No encryption keys found for")) != -1) { - index = error.tqfind(':',index); - int index2 = error.tqfind('\n',index); + index = error.find(':',index); + int index2 = error.find('\n',index); errMsg = i18n("Missing encryption key(s) for:\n%1") .tqarg(TQString(error.mid(index,index2-index))); @@ -178,8 +178,8 @@ Base5::encsign( Block& block, const KeyIDList& recipients, // dash-escape the input if (input[0] == '-') input = "- " + input; - for ( int idx = 0 ; (idx = input.tqfind("\n-", idx)) >= 0 ; idx += 4 ) - input.tqreplace(idx, 2, "\n- -"); + for ( int idx = 0 ; (idx = input.find("\n-", idx)) >= 0 ; idx += 4 ) + input.replace(idx, 2, "\n- -"); output = "-----BEGIN PGP SIGNED MESSAGE-----\n\n" + input + "\n" + output; } @@ -212,7 +212,7 @@ Base5::decrypt( Block& block, const char *passphrase ) // lets parse the returned information. int index; - index = error.tqfind("Cannot decrypt message"); + index = error.find("Cannot decrypt message"); if(index != -1) { //kdDebug(5100) << "message is encrypted" << endl; @@ -220,7 +220,7 @@ Base5::decrypt( Block& block, const char *passphrase ) // ok. we have an encrypted message. Is the passphrase bad, // or do we not have the secret key? - if(error.tqfind("Need a pass phrase") != -1) + if(error.find("Need a pass phrase") != -1) { if(passphrase != 0) { @@ -242,15 +242,15 @@ Base5::decrypt( Block& block, const char *passphrase ) #if 0 // ##### FIXME: This information is anyway currently not used // I'll change it to always determine the recipients. - index = error.tqfind("can only be decrypted by:"); + index = error.find("can only be decrypted by:"); if(index != -1) { - index = error.tqfind('\n',index); - int end = error.tqfind("\n\n",index); + index = error.find('\n',index); + int end = error.find("\n\n",index); mRecipients.clear(); int index2; - while( (index2 = error.tqfind('\n',index+1)) <= end ) + while( (index2 = error.find('\n',index+1)) <= end ) { TQCString item = error.mid(index+1,index2-index-1); item.stripWhiteSpace(); @@ -260,7 +260,7 @@ Base5::decrypt( Block& block, const char *passphrase ) } #endif } - index = error.tqfind("Good signature"); + index = error.find("Good signature"); if(index != -1) { //kdDebug(5100) << "good signature" << endl; @@ -268,18 +268,18 @@ Base5::decrypt( Block& block, const char *passphrase ) status |= GOODSIG; // get key ID of signer - index = error.tqfind("Key ID ", index) + 7; + index = error.find("Key ID ", index) + 7; block.setSignatureKeyId( error.mid(index, 8) ); // get signer - index = error.tqfind('"',index) + 1; - int index2 = error.tqfind('"', index); + index = error.find('"',index) + 1; + int index2 = error.find('"', index); block.setSignatureUserId( error.mid(index, index2-index) ); /// ### FIXME get signature date block.setSignatureDate( "" ); } - index = error.tqfind("BAD signature"); + index = error.find("BAD signature"); if(index != -1) { //kdDebug(5100) << "BAD signature" << endl; @@ -287,21 +287,21 @@ Base5::decrypt( Block& block, const char *passphrase ) status |= ERROR; // get key ID of signer - index = error.tqfind("Key ID ", index) + 7; + index = error.find("Key ID ", index) + 7; block.setSignatureKeyId( error.mid(index, 8) ); // get signer - index = error.tqfind('"',index) + 1; - int index2 = error.tqfind('"', index); + index = error.find('"',index) + 1; + int index2 = error.find('"', index); block.setSignatureUserId( error.mid(index, index2-index) ); /// ### FIXME get signature date block.setSignatureDate( "" ); } - index = error.tqfind("Signature by unknown key"); + index = error.find("Signature by unknown key"); if(index != -1) { - index = error.tqfind("keyid: 0x",index) + 9; + index = error.find("keyid: 0x",index) + 9; block.setSignatureKeyId( error.mid(index, 8) ); block.setSignatureUserId( TQString() ); // FIXME: not a very good solution... @@ -483,7 +483,7 @@ Base5::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ ) int eol; // search the end of the current line - eol = output.tqfind( '\n', offset ); + eol = output.find( '\n', offset ); if( ( eol == -1 ) || ( eol == offset ) ) break; @@ -525,7 +525,7 @@ Base5::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ ) pos = offset + 4; while( output[pos] == ' ' ) pos++; - pos2 = output.tqfind( ' ', pos ); + pos2 = output.find( ' ', pos ); subkey->setKeyLength( output.mid( pos, pos2-pos ).toUInt() ); //kdDebug(5100) << "Key Length: "<<subkey->keyLength()<<endl; @@ -534,7 +534,7 @@ Base5::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ ) while( output[pos] == ' ' ) pos++; pos += 2; // skip the '0x' - pos2 = output.tqfind( ' ', pos ); + pos2 = output.find( ' ', pos ); subkey->setKeyID( output.mid( pos, pos2-pos ) ); //kdDebug(5100) << "Key ID: "<<subkey->keyID()<<endl; @@ -542,7 +542,7 @@ Base5::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ ) pos = pos2 + 1; while( output[pos] == ' ' ) pos++; - pos2 = output.tqfind( ' ', pos ); + pos2 = output.find( ' ', pos ); int year = output.mid( pos, 4 ).toInt(); int month = output.mid( pos+5, 2 ).toInt(); int day = output.mid( pos+8, 2 ).toInt(); @@ -561,7 +561,7 @@ Base5::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ ) pos = pos2 + 1; while( output[pos] == ' ' ) pos++; - pos2 = output.tqfind( ' ', pos ); + pos2 = output.find( ' ', pos ); if( output[pos] == '-' ) { // key doesn't expire subkey->setExpirationDate( -1 ); @@ -595,7 +595,7 @@ Base5::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ ) pos = pos2 + 1; while( output[pos] == ' ' ) pos++; - pos2 = output.tqfind( ' ', pos ); + pos2 = output.find( ' ', pos ); if( !strncmp( output.data() + pos, "RSA", 3 ) ) { sign = true; @@ -653,11 +653,11 @@ Base5::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ ) f20 Fingerprint20 = 226F 4B63 6DA2 7389 91D1 2A49 D58A 3EC1 5214 181E */ - int pos = output.tqfind( '=', offset+3 ) + 2; + int pos = output.find( '=', offset+3 ) + 2; TQCString fingerprint = output.mid( pos, eol-pos ); // remove white space from the fingerprint - for ( int idx = 0 ; (idx = fingerprint.tqfind(' ', idx)) >= 0 ; ) - fingerprint.tqreplace( idx, 1, "" ); + for ( int idx = 0 ; (idx = fingerprint.find(' ', idx)) >= 0 ; ) + fingerprint.replace( idx, 1, "" ); assert( subkey != 0 ); subkey->setFingerprint( fingerprint ); //kdDebug(5100)<<"Fingerprint: "<<fingerprint<<endl; @@ -700,13 +700,13 @@ Base5::parseSingleKey( const TQCString& output, Key* key /* = 0 */ ) offset = 0; else { - offset = output.tqfind( "\nType Bits" ) + 1; + offset = output.find( "\nType Bits" ) + 1; if( offset == 0 ) return 0; } // key data begins in the next line - offset = output.tqfind( '\n', offset ) + 1; + offset = output.find( '\n', offset ) + 1; if( offset == -1 ) return 0; @@ -730,13 +730,13 @@ Base5::parseKeyList( const TQCString& output, bool onlySecretKeys ) offset = 0; else { - offset = output.tqfind( "\nType Bits" ) + 1; + offset = output.find( "\nType Bits" ) + 1; if( offset == 0 ) return keys; } // key data begins in the next line - offset = output.tqfind( '\n', offset ) + 1; + offset = output.find( '\n', offset ) + 1; if( offset == -1 ) return keys; @@ -770,11 +770,11 @@ Base5::parseTrustDataForKey( Key* key, const TQCString& str ) UserIDList userIDs = key->userIDs(); // search the start of the trust data - int offset = str.tqfind( "\n\n KeyID" ) + 9; + int offset = str.find( "\n\n KeyID" ) + 9; if( offset == -1 + 9 ) return; - offset = str.tqfind( '\n', offset ) + 1; + offset = str.find( '\n', offset ) + 1; if( offset == -1 + 1 ) return; @@ -788,7 +788,7 @@ Base5::parseTrustDataForKey( Key* key, const TQCString& str ) int eol; // search the end of the current line - if( ( eol = str.tqfind( '\n', offset ) ) == -1 ) + if( ( eol = str.find( '\n', offset ) ) == -1 ) break; if( str[offset+23] != ' ' ) |