|
|
|
@ -181,7 +181,7 @@ static void new_fingerprint(void *opdata, OtrlUserState us, const char *accountn
|
|
|
|
|
|
|
|
|
|
static void write_fingerprints(void *opdata){
|
|
|
|
|
kdDebug() << "Writing fingerprints" << endl;
|
|
|
|
|
otrl_privkey_write_fingerprints( userstate, TQString(KGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "fingerprints" );
|
|
|
|
|
otrl_privkey_write_fingerprints( userstate, TQString(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "fingerprints" );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void gone_secure(void *opdata, ConnContext *context){
|
|
|
|
@ -257,11 +257,11 @@ OtrlChatInterface::OtrlChatInterface(){
|
|
|
|
|
|
|
|
|
|
userstate = otrl_userstate_create();
|
|
|
|
|
|
|
|
|
|
otrl_privkey_read( userstate, TQString(KGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "privkeys" );
|
|
|
|
|
otrl_privkey_read( userstate, TQString(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "privkeys" );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
otrl_privkey_read_fingerprints(userstate, TQString(KGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "fingerprints", NULL, NULL);
|
|
|
|
|
otrl_privkey_read_fingerprints(userstate, TQString(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "fingerprints", NULL, NULL);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -504,7 +504,7 @@ void OtrlChatInterface::setTrust( Kopete::ChatSession *session, bool trust ){
|
|
|
|
|
otrl_context_set_trust( fingerprint, NULL );
|
|
|
|
|
}
|
|
|
|
|
kdDebug() << "Writing fingerprints" << endl;
|
|
|
|
|
otrl_privkey_write_fingerprints( userstate, TQString(KGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "fingerprints" );
|
|
|
|
|
otrl_privkey_write_fingerprints( userstate, TQString(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "fingerprints" );
|
|
|
|
|
OTRPlugin::plugin()->emitGoneSecure( session, privState( session ) );
|
|
|
|
|
} else {
|
|
|
|
|
kdDebug() << "could not find fingerprint" << endl;
|
|
|
|
@ -555,7 +555,7 @@ bool OtrlChatInterface::isVerified( Kopete::ChatSession *session ){
|
|
|
|
|
void OtrlChatInterface::updateKeyfile( Kopete::Account *account ){
|
|
|
|
|
// Updating private keys from <=0.3
|
|
|
|
|
kdDebug() << "updating keys" << endl;
|
|
|
|
|
TQFile keyfile( TQString(KGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "privkeys" );
|
|
|
|
|
TQFile keyfile( TQString(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "privkeys" );
|
|
|
|
|
TQString line;
|
|
|
|
|
TQString file;
|
|
|
|
|
|
|
|
|
@ -576,13 +576,13 @@ void OtrlChatInterface::updateKeyfile( Kopete::Account *account ){
|
|
|
|
|
keyfile.writeBlock( file.latin1(), file.length() );
|
|
|
|
|
keyfile.close();
|
|
|
|
|
otrl_privkey_forget_all( userstate );
|
|
|
|
|
otrl_privkey_read( userstate, TQString(KGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "privkeys" );
|
|
|
|
|
otrl_privkey_read( userstate, TQString(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "privkeys" );
|
|
|
|
|
|
|
|
|
|
file = "";
|
|
|
|
|
line = "";
|
|
|
|
|
// Updating fingerprints from <=0.3
|
|
|
|
|
kdDebug() << "updating fingerprints" << endl;
|
|
|
|
|
TQFile fingerprintfile( TQString(KGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "fingerprints" );
|
|
|
|
|
TQFile fingerprintfile( TQString(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "fingerprints" );
|
|
|
|
|
|
|
|
|
|
if( fingerprintfile.open( IO_ReadWrite ) ){
|
|
|
|
|
kdDebug() << "file open" << endl;
|
|
|
|
@ -600,7 +600,7 @@ void OtrlChatInterface::updateKeyfile( Kopete::Account *account ){
|
|
|
|
|
fingerprintfile.writeBlock( file.latin1(), file.length() );
|
|
|
|
|
fingerprintfile.close();
|
|
|
|
|
otrl_context_forget_all( userstate );
|
|
|
|
|
otrl_privkey_read_fingerprints(userstate, TQString(KGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "fingerprints", NULL, NULL);
|
|
|
|
|
otrl_privkey_read_fingerprints(userstate, TQString(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "fingerprints", NULL, NULL);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -678,8 +678,8 @@ KeyGenThread::KeyGenThread( TQString accountname, TQString protocol ){
|
|
|
|
|
|
|
|
|
|
void KeyGenThread::run()
|
|
|
|
|
{
|
|
|
|
|
kdDebug() << "Creating private key... Storing to: " + TQString(KGlobal::dirs()->saveLocation("data", "kopete_otr/", true)) + "privkeys" << endl;
|
|
|
|
|
otrl_privkey_generate(OtrlChatInterface::self()->getUserstate(), TQString(KGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "privkeys", accountname, protocol);
|
|
|
|
|
OtrlChatInterface::self()->checkFilePermissions( TQString(KGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "privkeys" );
|
|
|
|
|
kdDebug() << "Creating private key... Storing to: " + TQString(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true)) + "privkeys" << endl;
|
|
|
|
|
otrl_privkey_generate(OtrlChatInterface::self()->getUserstate(), TQString(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "privkeys", accountname, protocol);
|
|
|
|
|
OtrlChatInterface::self()->checkFilePermissions( TQString(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "privkeys" );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|