summaryrefslogtreecommitdiffstats
path: root/libkpgp/kpgpbaseG.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libkpgp/kpgpbaseG.cpp')
-rw-r--r--libkpgp/kpgpbaseG.cpp92
1 files changed, 46 insertions, 46 deletions
diff --git a/libkpgp/kpgpbaseG.cpp b/libkpgp/kpgpbaseG.cpp
index b04b31bf2..ecb5af195 100644
--- a/libkpgp/kpgpbaseG.cpp
+++ b/libkpgp/kpgpbaseG.cpp
@@ -38,9 +38,9 @@ BaseG::BaseG()
{
// determine the version of gpg (the method is equivalent to gpgme's method)
runGpg( "--version", 0 );
- int eol = output.tqfind( '\n' );
+ int eol = output.find( '\n' );
if( eol > 0 ) {
- int pos = output.tqfindRev( ' ', eol - 1 );
+ int pos = output.findRev( ' ', eol - 1 );
if( pos != -1 ) {
mVersion = output.mid( pos + 1, eol - pos - 1 );
kdDebug(5100) << "found GnuPG " << mVersion << endl;
@@ -138,11 +138,11 @@ BaseG::encsign( Block& block, const KeyIDList& recipients,
// (expired or revoked key)
// gpg: 23456789: no info to calculate a trust probability
// (untrusted key, 23456789 is the key Id of the encryption sub key)
- while((index = error.tqfind("skipped: ",index)) != -1)
+ while((index = error.find("skipped: ",index)) != -1)
{
bad = TRUE;
- index = error.tqfind('\'',index);
- int index2 = error.tqfind('\'',index+1);
+ index = error.find('\'',index);
+ int index2 = error.find('\'',index+1);
badkeys += error.mid(index, index2-index+1) + ", ";
num++;
}
@@ -178,14 +178,14 @@ BaseG::encsign( Block& block, const KeyIDList& recipients,
// Example 4 (unusable secret key, sign & encrypt):
// gpg: skipped `0xAC0EB35D': unusable secret key
// gpg: [stdin]: sign+encrypt failed: unusable secret key
- if( error.tqfind("bad passphrase") != -1 )
+ if( error.find("bad passphrase") != -1 )
{
errMsg = i18n("Signing failed because the passphrase is wrong.");
status |= BADPHRASE;
status |= ERR_SIGNING;
status |= ERROR;
}
- else if( error.tqfind("unusable secret key") != -1 )
+ else if( error.find("unusable secret key") != -1 )
{
errMsg = i18n("Signing failed because your secret key is unusable.");
status |= ERR_SIGNING;
@@ -213,7 +213,7 @@ BaseG::decrypt( Block& block, const char *passphrase )
clear();
input = block.text();
exitqStatus = runGpg("--batch --decrypt", passphrase);
- if( !output.isEmpty() && ( error.tqfind( "gpg: quoted printable" ) == -1 ) )
+ if( !output.isEmpty() && ( error.find( "gpg: quoted printable" ) == -1 ) )
block.setProcessedText( output );
block.setError( error );
@@ -244,13 +244,13 @@ BaseG::decrypt( Block& block, const char *passphrase )
// gpg: public key decryption failed: bad passphrase
// gpg: encrypted with 2048-bit ELG-E key, ID 23456789, created 2000-02-02
// "Foo Bar (home) <foo@bar.xyz>"
- if( error.tqfind( "gpg: encrypted with" ) != -1 )
+ if( error.find( "gpg: encrypted with" ) != -1 )
{
//kdDebug(5100) << "kpgpbase: message is encrypted" << endl;
status |= ENCRYPTED;
- if( error.tqfind( "\ngpg: decryption failed" ) != -1 )
+ if( error.find( "\ngpg: decryption failed" ) != -1 )
{
- if( ( index = error.tqfind( "bad passphrase" ) ) != -1 )
+ if( ( index = error.find( "bad passphrase" ) ) != -1 )
{
if( passphrase != 0 )
{
@@ -262,15 +262,15 @@ BaseG::decrypt( Block& block, const char *passphrase )
else
{
// Search backwards the user ID of the needed key
- index2 = error.tqfindRev('"', index) - 1;
- index = error.tqfindRev(" \"", index2) + 7;
+ index2 = error.findRev('"', index) - 1;
+ index = error.findRev(" \"", index2) + 7;
// The conversion from UTF8 is necessary because gpg stores and
// prints user IDs in UTF8
block.setRequiredUserId( TQString::fromUtf8( error.mid( index, index2 - index + 1 ) ) );
kdDebug(5100) << "Base: key needed is \"" << block.requiredUserId() << "\"!" << endl;
}
}
- else if( error.tqfind( "secret key not available" ) != -1 )
+ else if( error.find( "secret key not available" ) != -1 )
{
// no secret key fitting this message
status |= NO_SEC_KEY;
@@ -283,14 +283,14 @@ BaseG::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();
@@ -304,48 +304,48 @@ BaseG::decrypt( Block& block, const char *passphrase )
// Example 1 (unknown signature key):
// gpg: Signature made Wed 02 Jan 2002 11:26:33 AM CET using DSA key ID 2E250C64
// gpg: Can't check signature: public key not found
- if((index = error.tqfind("Signature made")) != -1)
+ if((index = error.find("Signature made")) != -1)
{
//kdDebug(5100) << "Base: message is signed" << endl;
status |= SIGNED;
// get signature date and signature key ID
// Example: Signature made Sun 06 May 2001 03:49:27 PM CEST using DSA key ID 12345678
- index2 = error.tqfind("using", index+15);
+ index2 = error.find("using", index+15);
block.setSignatureDate( error.mid(index+15, index2-(index+15)-1) );
kdDebug(5100) << "Message was signed on '" << block.signatureDate() << "'\n";
- index2 = error.tqfind("key ID ", index2) + 7;
+ index2 = error.find("key ID ", index2) + 7;
block.setSignatureKeyId( error.mid(index2,8) );
kdDebug(5100) << "Message was signed with key '" << block.signatureKeyId() << "'\n";
// move index to start of next line
- index = error.tqfind('\n', index2)+1;
+ index = error.find('\n', index2)+1;
- if ((error.tqfind("Key matching expected", index) != -1)
- || (error.tqfind("Can't check signature", index) != -1))
+ if ((error.find("Key matching expected", index) != -1)
+ || (error.find("Can't check signature", index) != -1))
{
status |= UNKNOWN_SIG;
status |= GOODSIG;
block.setSignatureUserId( TQString() );
}
- else if( error.tqfind("Good signature", index) != -1 )
+ else if( error.find("Good signature", index) != -1 )
{
status |= GOODSIG;
// get the primary user ID of the signer
- index = error.tqfind('"',index);
- index2 = error.tqfind('\n',index+1);
- index2 = error.tqfindRev('"', index2-1);
+ index = error.find('"',index);
+ index2 = error.find('\n',index+1);
+ index2 = error.findRev('"', index2-1);
block.setSignatureUserId( error.mid( index+1, index2-index-1 ) );
}
- else if( error.tqfind("BAD signature", index) != -1 )
+ else if( error.find("BAD signature", index) != -1 )
{
//kdDebug(5100) << "BAD signature" << endl;
status |= ERROR;
// get the primary user ID of the signer
- index = error.tqfind('"',index);
- index2 = error.tqfind('\n',index+1);
- index2 = error.tqfindRev('"', index2-1);
+ index = error.find('"',index);
+ index2 = error.find('\n',index+1);
+ index2 = error.findRev('"', index2-1);
block.setSignatureUserId( error.mid( index+1, index2-index-1 ) );
}
- else if( error.tqfind("Can't find the right public key", index) != -1 )
+ else if( error.find("Can't find the right public key", index) != -1 )
{
// #### fix this hack
// I think this can't happen anymore because if the pubring is missing
@@ -389,7 +389,7 @@ BaseG::readPublicKey( const KeyID& keyID,
if( !strncmp( output.data(), "pub:", 4 ) )
offset = 0;
else {
- offset = output.tqfind( "\npub:" );
+ offset = output.find( "\npub:" );
if( offset == -1 )
return 0;
else
@@ -536,7 +536,7 @@ BaseG::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ )
{
int eol;
// search the end of the current line
- if( ( eol = output.tqfind( '\n', index ) ) == -1 )
+ if( ( eol = output.find( '\n', index ) ) == -1 )
break;
bool bIsPublicKey = false;
@@ -555,7 +555,7 @@ BaseG::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ )
Subkey *subkey = new Subkey( TQCString(), !bIsPublicKey );
int pos = index + 4; // begin of 2nd field
- int pos2 = output.tqfind( ':', pos );
+ int pos2 = output.find( ':', pos );
for( int field = 2; field <= 12; field++ )
{
switch( field )
@@ -652,7 +652,7 @@ BaseG::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ )
break;
}
pos = pos2 + 1;
- pos2 = output.tqfind( ':', pos );
+ pos2 = output.find( ':', pos );
}
key->addSubkey( subkey );
}
@@ -663,7 +663,7 @@ BaseG::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ )
UserID *userID = new UserID( "" );
int pos = index + 4; // begin of 2nd field
- int pos2 = output.tqfind( ':', pos );
+ int pos2 = output.find( ':', pos );
for( int field=2; field <= 10; field++ )
{
switch( field )
@@ -710,13 +710,13 @@ BaseG::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ )
break;
case 10: // User-ID
TQCString uid = output.mid( pos, pos2-pos );
- // tqreplace "\xXX" with the corresponding character;
+ // replace "\xXX" with the corresponding character;
// other escaped characters, i.e. \n, \r etc., are ignored
// because they shouldn't appear in user IDs
- for ( int idx = 0 ; (idx = uid.tqfind( "\\x", idx )) >= 0 ; ++idx ) {
+ for ( int idx = 0 ; (idx = uid.find( "\\x", idx )) >= 0 ; ++idx ) {
char str[2] = "x";
str[0] = (char) TQString( uid.mid( idx + 2, 2 ) ).toShort( 0, 16 );
- uid.tqreplace( idx, 4, str );
+ uid.replace( idx, 4, str );
}
TQString uidString = TQString::fromUtf8( uid.data() );
// check whether uid was utf-8 encoded
@@ -785,7 +785,7 @@ BaseG::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ )
break;
}
pos = pos2 + 1;
- pos2 = output.tqfind( ':', pos );
+ pos2 = output.find( ':', pos );
}
// user IDs are printed in UTF-8 by gpg (if one uses --with-colons)
@@ -801,8 +801,8 @@ BaseG::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ )
// search the fingerprint (it's in the 10th field)
int pos = index + 4;
for( int i = 0; i < 8; i++ )
- pos = output.tqfind( ':', pos ) + 1;
- int pos2 = output.tqfind( ':', pos );
+ pos = output.find( ':', pos ) + 1;
+ int pos2 = output.find( ':', pos );
key->setFingerprint( keyID, output.mid( pos, pos2-pos ) );
}
@@ -830,9 +830,9 @@ BaseG::parseKeyList( const TQCString& output, bool secretKeys )
offset = 0;
else {
if( secretKeys )
- offset = output.tqfind( "\nsec:" );
+ offset = output.find( "\nsec:" );
else
- offset = output.tqfind( "\npub:" );
+ offset = output.find( "\npub:" );
if( offset == -1 )
return keys;
else