diff options
Diffstat (limited to 'libkpgp/kpgpbase2.cpp')
-rw-r--r-- | libkpgp/kpgpbase2.cpp | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/libkpgp/kpgpbase2.cpp b/libkpgp/kpgpbase2.cpp index be96b5da9..97db773a7 100644 --- a/libkpgp/kpgpbase2.cpp +++ b/libkpgp/kpgpbase2.cpp @@ -118,16 +118,16 @@ Base2::encsign( Block& block, const KeyIDList& recipients, bool bad = FALSE; unsigned int num = 0; TQCString badkeys = ""; - if (error.tqfind("Cannot find the public key") != -1) + if (error.find("Cannot find the public key") != -1) { index = 0; num = 0; - while((index = error.tqfind("Cannot find the public key",index)) + while((index = error.find("Cannot find the public key",index)) != -1) { bad = TRUE; - index = error.tqfind('\'',index); - int index2 = error.tqfind('\'',index+1); + index = error.find('\'',index); + int index2 = error.find('\'',index+1); if (num++) badkeys += ", "; badkeys += error.mid(index, index2-index+1); @@ -149,15 +149,15 @@ Base2::encsign( Block& block, const KeyIDList& recipients, status |= ERROR; } } - if (error.tqfind("skipping userid") != -1) + if (error.find("skipping userid") != -1) { index = 0; num = 0; - while((index = error.tqfind("skipping userid",index)) + while((index = error.find("skipping userid",index)) != -1) { bad = TRUE; - int index2 = error.tqfind('\n',index+16); + int index2 = error.find('\n',index+16); if (num++) badkeys += ", "; badkeys += error.mid(index+16, index2-index-16); @@ -187,12 +187,12 @@ Base2::encsign( Block& block, const KeyIDList& recipients, #endif if(passphrase != 0) { - if(error.tqfind("Pass phrase is good") != -1) + if(error.find("Pass phrase is good") != -1) { //kdDebug(5100) << "Base: Good Passphrase!" << endl; status |= SIGNED; } - if( error.tqfind("Bad pass phrase") != -1) + if( error.find("Bad pass phrase") != -1) { errMsg = i18n("Bad passphrase; could not sign."); status |= BADPHRASE; @@ -200,7 +200,7 @@ Base2::encsign( Block& block, const KeyIDList& recipients, status |= ERROR; } } - if (error.tqfind("Signature error") != -1) + if (error.find("Signature error") != -1) { errMsg = i18n("Signing failed: please check your PGP User Identity, " "the PGP setup, and the key rings."); @@ -208,7 +208,7 @@ Base2::encsign( Block& block, const KeyIDList& recipients, status |= ERR_SIGNING; status |= ERROR; } - if (error.tqfind("Encryption error") != -1) + if (error.find("Encryption error") != -1) { errMsg = i18n("Encryption failed: please check your PGP setup " "and the key rings."); @@ -238,16 +238,16 @@ Base2::decrypt( Block& block, const char *passphrase ) // pgp2.6 has sometimes problems with the ascii armor pgp5.0 produces // this hack can solve parts of the problem - if(error.tqfind("ASCII armor corrupted.") != -1) + if(error.find("ASCII armor corrupted.") != -1) { kdDebug(5100) << "removing ASCII armor header" << endl; - int index1 = input.tqfind("-----BEGIN PGP SIGNED MESSAGE-----"); + int index1 = input.find("-----BEGIN PGP SIGNED MESSAGE-----"); if(index1 != -1) - index1 = input.tqfind("-----BEGIN PGP SIGNATURE-----", index1); + index1 = input.find("-----BEGIN PGP SIGNATURE-----", index1); else - index1 = input.tqfind("-----BEGIN PGP MESSAGE-----"); - index1 = input.tqfind('\n', index1); - index2 = input.tqfind("\n\n", index1); + index1 = input.find("-----BEGIN PGP MESSAGE-----"); + index1 = input.find('\n', index1); + index2 = input.find("\n\n", index1); input.remove(index1, index2 - index1); exitqStatus = run(PGP2 " +batchmode +language=en -f", passphrase); if( !output.isEmpty() ) @@ -282,19 +282,19 @@ Base2::decrypt( Block& block, const char *passphrase ) * * You do not have the secret key needed to decrypt this file. */ - if(error.tqfind("File is encrypted.") != -1) + if(error.find("File is encrypted.") != -1) { //kdDebug(5100) << "kpgpbase: message is encrypted" << endl; status |= ENCRYPTED; - if((index = error.tqfind("Key for user ID:")) != -1) + if((index = error.find("Key for user ID:")) != -1) { // Find out the key for which the phrase is needed index += 17; - index2 = error.tqfind('\n', index); + index2 = error.find('\n', index); block.setRequiredUserId( error.mid(index, index2 - index) ); //kdDebug(5100) << "Base: key needed is \"" << block.requiredUserId() << "\"!\n"; - if((passphrase != 0) && (error.tqfind("Bad pass phrase") != -1)) + if((passphrase != 0) && (error.find("Bad pass phrase") != -1)) { errMsg = i18n("Bad passphrase; could not decrypt."); kdDebug(5100) << "Base: passphrase is bad" << endl; @@ -314,14 +314,14 @@ Base2::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 read by:"); + index = error.find("can only be read 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(); - 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(); @@ -392,19 +392,19 @@ Base2::decrypt( Block& block, const char *passphrase ) * Signature made 2001/09/09 16:01 GMT using 1024-bit key, key ID 12345678 */ - if((index = error.tqfind("File has signature")) != -1) + if((index = error.find("File has signature")) != -1) { // move index to start of next line - index = error.tqfind('\n', index+18) + 1; + index = error.find('\n', index+18) + 1; //kdDebug(5100) << "Base: message is signed" << endl; status |= SIGNED; // get signature date and signature key ID - if ((index2 = error.tqfind("Signature made", index)) != -1) { + if ((index2 = error.find("Signature made", index)) != -1) { index2 += 15; - int index3 = error.tqfind("using", index2); + int index3 = error.find("using", index2); block.setSignatureDate( error.mid(index2, index3-index2-1) ); kdDebug(5100) << "Message was signed on '" << block.signatureDate() << "'\n"; - index3 = error.tqfind("key ID ", index3) + 7; + index3 = error.find("key ID ", index3) + 7; block.setSignatureKeyId( error.mid(index3,8) ); kdDebug(5100) << "Message was signed with key '" << block.signatureKeyId() << "'\n"; } @@ -415,38 +415,38 @@ Base2::decrypt( Block& block, const char *passphrase ) block.setSignatureKeyId( "" ); } - if( ( index2 = error.tqfind("Key matching expected", index) ) != -1) + if( ( index2 = error.find("Key matching expected", index) ) != -1) { status |= UNKNOWN_SIG; status |= GOODSIG; - int index3 = error.tqfind("Key ID ", index2) + 7; + int index3 = error.find("Key ID ", index2) + 7; block.setSignatureKeyId( error.mid(index3,8) ); block.setSignatureUserId( TQString() ); } - else if( (index2 = error.tqfind("Good signature from", index)) != -1 ) + else if( (index2 = error.find("Good signature from", index)) != -1 ) { status |= GOODSIG; // get signer - index = error.tqfind('"',index2+19); - index2 = error.tqfind('"', index+1); + index = error.find('"',index2+19); + index2 = error.find('"', index+1); block.setSignatureUserId( error.mid(index+1, index2-index-1) ); } - else if( (index2 = error.tqfind("Bad signature from", index)) != -1 ) + else if( (index2 = error.find("Bad signature from", index)) != -1 ) { status |= ERROR; // get signer - index = error.tqfind('"',index2+19); - index2 = error.tqfind('"', index+1); + index = error.find('"',index2+19); + index2 = error.find('"', index+1); block.setSignatureUserId( error.mid(index+1, index2-index-1) ); } - else if( error.tqfind("Keyring file", index) != -1 ) + else if( error.find("Keyring file", index) != -1 ) { // #### fix this hack status |= UNKNOWN_SIG; status |= GOODSIG; // this is a hack... // determine file name of missing keyring file - index = error.tqfind('\'', index) + 1; - index2 = error.tqfind('\'', index); + index = error.find('\'', index) + 1; + index2 = error.find('\'', index); block.setSignatureUserId( i18n("The keyring file %1 does not exist.\n" "Please check your PGP setup.").tqarg(TQString(error.mid(index, index2-index))) ); } @@ -547,7 +547,7 @@ Base2::doGetPublicKeys( const TQCString & cmd, const TQStringList & patterns ) // put all new keys into a map, remove duplicates while ( !publicKeys.isEmpty() ) { Key * key = publicKeys.take( 0 ); - if ( !map.tqcontains( key->primaryFingerprint() ) ) + if ( !map.contains( key->primaryFingerprint() ) ) map.insert( key->primaryFingerprint(), key ); else delete key; @@ -626,10 +626,10 @@ Base2::parsePublicKeyData( const TQCString& output, Key* key /* = 0 */ ) { /* if( secretKeys ) - index = output.tqfind( "\nsec" ); + index = output.find( "\nsec" ); else */ - index = output.tqfind( "\npub" ); + index = output.find( "\npub" ); if( index == -1 ) return 0; else @@ -641,7 +641,7 @@ Base2::parsePublicKeyData( const TQCString& output, Key* key /* = 0 */ ) int index2; // search the end of the current line - if( ( index2 = output.tqfind( '\n', index ) ) == -1 ) + if( ( index2 = output.find( '\n', index ) ) == -1 ) break; if( !strncmp( output.data() + index, "pub", 3 ) || @@ -699,19 +699,19 @@ Base2::parsePublicKeyData( const TQCString& output, Key* key /* = 0 */ ) pos = index + 4; while( output[pos] == ' ' ) pos++; - pos2 = output.tqfind( '/', pos ); + pos2 = output.find( '/', pos ); subkey->setKeyLength( output.mid( pos, pos2-pos ).toUInt() ); // Key ID pos = pos2 + 1; - pos2 = output.tqfind( ' ', pos ); + pos2 = output.find( ' ', pos ); subkey->setKeyID( output.mid( pos, pos2-pos ) ); // Creation Date 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(); @@ -754,8 +754,8 @@ Base2::parsePublicKeyData( const TQCString& output, Key* key /* = 0 */ ) TQCString fingerprint = output.mid( pos, index2-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, "" ); subkey->setFingerprint( fingerprint ); } @@ -827,10 +827,10 @@ Base2::parseTrustDataForKey( Key* key, const TQCString& str ) UserIDList userIDs = key->userIDs(); // search the trust data belonging to this key - int index = str.tqfind( '\n' ) + 1; + int index = str.find( '\n' ) + 1; while( ( index > 0 ) && ( strncmp( str.data() + index+2, keyID.data(), 8 ) != 0 ) ) - index = str.tqfind( '\n', index ) + 1; + index = str.find( '\n', index ) + 1; if( index == 0 ) return; @@ -846,7 +846,7 @@ Base2::parseTrustDataForKey( Key* key, const TQCString& str ) int index2; // search the end of the current line - if( ( index2 = str.tqfind( '\n', index ) ) == -1 ) + if( ( index2 = str.find( '\n', index ) ) == -1 ) break; // check if trust info for the next key starts @@ -908,9 +908,9 @@ Base2::parseKeyList( const TQCString& output, bool secretKeys ) else { if( secretKeys ) - index = output.tqfind( "\nsec" ); + index = output.find( "\nsec" ); else - index = output.tqfind( "\npub" ); + index = output.find( "\npub" ); if( index == -1 ) return keys; else @@ -922,7 +922,7 @@ Base2::parseKeyList( const TQCString& output, bool secretKeys ) int index2; // search the end of the current line - if( ( index2 = output.tqfind( '\n', index ) ) == -1 ) + if( ( index2 = output.find( '\n', index ) ) == -1 ) break; if( !strncmp( output.data() + index, "pub", 3 ) || @@ -979,19 +979,19 @@ Base2::parseKeyList( const TQCString& output, bool secretKeys ) pos = index + 4; while( output[pos] == ' ' ) pos++; - pos2 = output.tqfind( '/', pos ); + pos2 = output.find( '/', pos ); subkey->setKeyLength( output.mid( pos, pos2-pos ).toUInt() ); // Key ID pos = pos2 + 1; - pos2 = output.tqfind( ' ', pos ); + pos2 = output.find( ' ', pos ); subkey->setKeyID( output.mid( pos, pos2-pos ) ); // Creation Date 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(); @@ -1035,8 +1035,8 @@ Base2::parseKeyList( const TQCString& output, bool secretKeys ) pos2 = pos + 18; TQCString fingerprint = output.mid( pos, index2-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, "" ); subkey->setFingerprint( fingerprint ); } |