diff --git a/src/otrlchatinterface.cpp b/src/otrlchatinterface.cpp index 70103a0..41fd427 100644 --- a/src/otrlchatinterface.cpp +++ b/src/otrlchatinterface.cpp @@ -96,7 +96,7 @@ static void create_privkey(void *opdata, const char *accountname, const char *pr Kopete::ChatSession *session= ((Kopete::ChatSession*)opdata); - PrivKeyPopup *popup = new PrivKeyPopup( session->view()->mainWidget(), i18n("Generating private key"), TQt::WType_Dialog | TQt::WStyle_StaysOnTop ); + PrivKeyPopup *popup = new PrivKeyPopup( session->view()->mainWidget(), i18n("Generating private key").utf8(), TQt::WType_Dialog | TQt::WStyle_StaysOnTop ); KAnimWidget *anim = new KAnimWidget( "kde", 72, popup->animFrame, "kopete" ); anim->start(); anim->show(); @@ -192,7 +192,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(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "fingerprints" ); + otrl_privkey_write_fingerprints( userstate, TQString("%1%2").arg(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )).arg("fingerprints").local8Bit() ); } static void gone_secure(void *opdata, ConnContext *context){ @@ -340,7 +340,7 @@ void handle_smp_event(void *opdata, OtrlSMPEvent smp_event, ConnContext *context case OTRL_SMPEVENT_NONE: break; case OTRL_SMPEVENT_ASK_FOR_SECRET: { - SMPPopup *popup = new SMPPopup( chatSession->view()->mainWidget(), i18n("Enter authentication secret"), TQString::null, TQt::WType_Dialog | TQt::WStyle_StaysOnTop, context, chatSession, false ); + SMPPopup *popup = new SMPPopup( chatSession->view()->mainWidget(), i18n("Enter authentication secret").utf8(), TQString::null, TQt::WType_Dialog | TQt::WStyle_StaysOnTop, context, chatSession, false ); popup->show(); break; } @@ -487,7 +487,7 @@ void handle_msg_event(void *opdata, OtrlMessageEvent msg_event, ConnContext *con void create_instag(void *opdata, const char *accountname, const char *protocol){ Q_UNUSED(opdata) - otrl_instag_generate(OtrlChatInterface::self()->getUserstate(), TQString(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "instags", accountname, protocol); + otrl_instag_generate(OtrlChatInterface::self()->getUserstate(), TQString("%1%2").arg(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )).arg("instags").local8Bit(), accountname, protocol); } #endif // HAVE_LIBOTR_0400 @@ -576,12 +576,12 @@ OtrlChatInterface::OtrlChatInterface(){ userstate = otrl_userstate_create(); - otrl_privkey_read( userstate, TQString(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "privkeys" ); + otrl_privkey_read( userstate, TQString("%1%2").arg(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )).arg("privkeys").local8Bit() ); - otrl_privkey_read_fingerprints(userstate, TQString(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "fingerprints", NULL, NULL); + otrl_privkey_read_fingerprints(userstate, TQString("%1%2").arg(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )).arg("fingerprints").local8Bit(), NULL, NULL); #ifdef HAVE_LIBOTR_0400 - otrl_instag_read(userstate, TQString(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "instags"); + otrl_instag_read(userstate, TQString("%1%2").arg(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )).arg("instags").local8Bit()); unsigned int interval = otrl_message_poll_get_default_interval(userstate); forwardSecrecyTimerStart(interval); @@ -661,7 +661,7 @@ int OtrlChatInterface::decryptMessage( TQString *msg, TQString accountId, if (nextMsg != OTRL_SMP_EXPECT1){ abortSMP( context, chatSession ); } else { - SMPPopup *popup = new SMPPopup( chatSession->view()->mainWidget(), i18n("Enter authentication secret"), TQString::null, TQt::WType_Dialog | TQt::WStyle_StaysOnTop, context, chatSession, false ); + SMPPopup *popup = new SMPPopup( chatSession->view()->mainWidget(), i18n("Enter authentication secret").utf8(), TQString::null, TQt::WType_Dialog | TQt::WStyle_StaysOnTop, context, chatSession, false ); popup->show(); } } @@ -736,7 +736,7 @@ TQString OtrlChatInterface::encryptMessage( TQString msg, TQString accountId, TQString protocol, TQString contactId , Kopete::ChatSession *chatSession ){ int err; char * newMessage; - if( otrl_proto_message_type( msg ) == OTRL_MSGTYPE_NOTOTR ){ + if( otrl_proto_message_type( msg.latin1() ) == OTRL_MSGTYPE_NOTOTR ){ msg.replace( TQString("<"), TQString("<"), false ); #ifdef HAVE_LIBOTR_0400 otrl_instag_t instance = chatSession->property("otr-instag").toUInt(); @@ -754,7 +754,7 @@ TQString OtrlChatInterface::encryptMessage( TQString msg, TQString accountId, } } } - OtrlMessageType type = otrl_proto_message_type( msg ); + OtrlMessageType type = otrl_proto_message_type( msg.latin1() ); if( type == OTRL_MSGTYPE_NOTOTR | type == OTRL_MSGTYPE_TAGGEDPLAINTEXT ){ msg.replace( "<", "<", false ); } @@ -772,9 +772,9 @@ TQString OtrlChatInterface::getDefaultQuery( TQString accountId ){ void OtrlChatInterface::disconnectSession( Kopete::ChatSession *chatSession ){ #ifdef HAVE_LIBOTR_0400 otrl_instag_t instance = chatSession->property("otr-instag").toUInt(); - otrl_message_disconnect( userstate, &ui_ops, chatSession, chatSession->account()->accountId().latin1(), chatSession->account()->protocol()->displayName().latin1(), chatSession->members().getFirst()->contactId(), instance ); + otrl_message_disconnect( userstate, &ui_ops, chatSession, chatSession->account()->accountId().latin1(), chatSession->account()->protocol()->displayName().latin1(), chatSession->members().getFirst()->contactId().latin1(), instance ); #else // HAVE_LIBOTR_0400 - otrl_message_disconnect( userstate, &ui_ops, chatSession, chatSession->account()->accountId().latin1(), chatSession->account()->protocol()->displayName().latin1(), chatSession->members().getFirst()->contactId() ); + otrl_message_disconnect( userstate, &ui_ops, chatSession, chatSession->account()->accountId().latin1(), chatSession->account()->protocol()->displayName().latin1(), chatSession->members().getFirst()->contactId().latin1() ); #endif // HAVE_LIBOTR_0400 OTRPlugin::plugin()->emitGoneSecure( chatSession, false ); @@ -810,9 +810,9 @@ int OtrlChatInterface::privState( Kopete::ChatSession *session ){ #ifdef HAVE_LIBOTR_0400 otrl_instag_t instance = session->property("otr-instag").toUInt(); - context = otrl_context_find(userstate, session->members().getFirst()->contactId(), session->account()->accountId(), session->account()->protocol()->displayName(), instance, 0, NULL, NULL, NULL); + context = otrl_context_find(userstate, session->members().getFirst()->contactId().latin1(), session->account()->accountId().latin1(), session->account()->protocol()->displayName().latin1(), instance, 0, NULL, NULL, NULL); #else // HAVE_LIBOTR_0400 - context = otrl_context_find(userstate, session->members().getFirst()->contactId(), session->account()->accountId(), session->account()->protocol()->displayName(), 0, NULL, NULL, NULL); + context = otrl_context_find(userstate, session->members().getFirst()->contactId().latin1(), session->account()->accountId().latin1(), session->account()->protocol()->displayName().latin1(), 0, NULL, NULL, NULL); #endif // HAVE_LIBOTR_0400 if( context ){ @@ -853,7 +853,7 @@ void OtrlChatInterface::verifyFingerprint( Kopete::ChatSession *session ){ context = otrl_context_find( userstate, session->members().getFirst()->contactId().latin1(), session->account()->accountId().latin1(), session->protocol()->displayName().latin1(), 0, NULL, NULL, NULL); #endif // HAVE_LIBOTR_0400 - SMPPopup *popup = new SMPPopup( session->view()->mainWidget(), i18n("Enter authentication secret"), TQString::null, TQt::WType_Dialog | TQt::WStyle_StaysOnTop, context, session, true ); + SMPPopup *popup = new SMPPopup( session->view()->mainWidget(), i18n("Enter authentication secret").utf8(), TQString::null, TQt::WType_Dialog | TQt::WStyle_StaysOnTop, context, session, true ); popup->show(); } @@ -868,7 +868,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(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "fingerprints" ); + otrl_privkey_write_fingerprints( userstate, TQString("%1%2").arg(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )).arg("fingerprints").local8Bit() ); OTRPlugin::plugin()->emitGoneSecure( session, privState( session ) ); } else { kdDebug() << "could not find fingerprint" << endl; @@ -880,7 +880,8 @@ Fingerprint *OtrlChatInterface::findFingerprint( TQString account ){ for( context = userstate->context_root; context != NULL; context = context->next ){ kdDebug() << context->username << endl; - if( strcmp( context->username, account ) == 0 ){ + if (context->username == account) + { kdDebug() << "found Context" << endl; return context->active_fingerprint ? context->active_fingerprint : NULL; } @@ -894,7 +895,8 @@ TQString OtrlChatInterface::findActiveFingerprint( Kopete::ChatSession *session for( context = userstate->context_root; context != NULL; context = context->next ){ kdDebug() << context->username << endl; - if( strcmp( context->username, session->members().getFirst()->contactId() ) == 0 ){ + if (context->username == session->members().getFirst()->contactId()) + { // otrl_privkey_hash_to_human( hash, context->fingerprint_root.next->fingerprint ); otrl_privkey_hash_to_human( hash, context->active_fingerprint->fingerprint ); return hash; @@ -940,13 +942,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(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "privkeys" ); + otrl_privkey_read( userstate, TQString("%1%2").arg(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )).arg("privkeys").local8Bit() ); file = ""; line = ""; // Updating fingerprints from <=0.3 kdDebug() << "updating fingerprints" << endl; - TQFile fingerprintfile( TQString(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "fingerprints" ); + TQFile fingerprintfile( TQString("%1%2").arg(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )).arg("fingerprints").local8Bit() ); if( fingerprintfile.open( IO_ReadWrite ) ){ kdDebug() << "file open" << endl; @@ -964,7 +966,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(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "fingerprints", NULL, NULL); + otrl_privkey_read_fingerprints(userstate, TQString("%1%2").arg(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )).arg("fingerprints").local8Bit(), NULL, NULL); } @@ -980,7 +982,7 @@ void OtrlChatInterface::checkFilePermissions( TQString file ){ privkeysInfo.permission( TQFileInfo::WriteOther ) | privkeysInfo.permission( TQFileInfo::ExeOther ) ){ kdDebug() << "Permissions of OTR storage file are wrong! Correcting..." << endl; - chmod( file, 0600); + chmod( file.local8Bit(), 0600); } } @@ -1065,8 +1067,8 @@ KeyGenThread::KeyGenThread( TQString accountname, TQString protocol ){ void KeyGenThread::run() { 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" ); + otrl_privkey_generate(OtrlChatInterface::self()->getUserstate(), TQString("%1%2").arg(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )).arg("privkeys").local8Bit(), accountname.latin1(), protocol.latin1()); + OtrlChatInterface::self()->checkFilePermissions( TQString("%1%2").arg(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )).arg("privkeys").local8Bit() ); } #include "otrlchatinterface.moc" diff --git a/src/otrlconfinterface.cpp b/src/otrlconfinterface.cpp index 812326d..5b4f6f0 100644 --- a/src/otrlconfinterface.cpp +++ b/src/otrlconfinterface.cpp @@ -83,7 +83,7 @@ bool OtrlConfInterface::hasPrivFingerprint( TQString accountId, TQString protoco void OtrlConfInterface::generateNewPrivKey( TQString accountId, TQString protocol ){ - PrivKeyPopup *popup = new PrivKeyPopup( preferencesDialog, i18n("Generating private key"), TQt::WType_Dialog | TQt::WStyle_StaysOnTop ); + PrivKeyPopup *popup = new PrivKeyPopup( preferencesDialog, i18n("Generating private key").utf8(), TQt::WType_Dialog | TQt::WStyle_StaysOnTop ); KAnimWidget *anim = new KAnimWidget( "kde", 72, popup->animFrame, "kopete" ); anim->start(); anim->show(); @@ -115,7 +115,7 @@ TQValueList OtrlConfInterface::readAllFingerprints(){ entry[1] = i18n("Unused"); } else { if (context && context->msgstate == OTRL_MSGSTATE_ENCRYPTED) { - if (context->active_fingerprint->trust && context->active_fingerprint->trust[0] != NULL) { + if (context->active_fingerprint->trust && context->active_fingerprint->trust[0] != 0) { entry[1] = i18n("Private"); } else { entry[1] = i18n("Unverified"); @@ -149,7 +149,7 @@ void OtrlConfInterface::verifyFingerprint( TQString strFingerprint, bool trust ) otrl_context_set_trust( fingerprint, NULL ); } kdDebug() << "Writing fingerprints" << endl; - otrl_privkey_write_fingerprints( userstate, TQString(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "fingerprints" ); + otrl_privkey_write_fingerprints( userstate, TQString("%1%2").arg(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )).arg("fingerprints").local8Bit() ); } else { kdDebug() << "could not find fingerprint" << endl; } @@ -158,7 +158,7 @@ void OtrlConfInterface::verifyFingerprint( TQString strFingerprint, bool trust ) bool OtrlConfInterface::isVerified( TQString strFingerprint ){ Fingerprint *fingerprint; - fingerprint = findFingerprint( strFingerprint ); + fingerprint = findFingerprint( strFingerprint.latin1() ); if( fingerprint->trust && fingerprint->trust[0] ){ kdDebug() << "found trust" << endl; @@ -175,7 +175,7 @@ void OtrlConfInterface::forgetFingerprint( TQString strFingerprint ){ fingerprint = findFingerprint( strFingerprint ); otrl_context_forget_fingerprint( fingerprint, 1 ); - otrl_privkey_write_fingerprints( userstate, TQString(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "fingerprints" ); + otrl_privkey_write_fingerprints( userstate, TQString("%1%2").arg(TDEGlobal::dirs()->saveLocation("data", "kopete_otr/", true )).arg("fingerprints").local8Bit() ); } Fingerprint *OtrlConfInterface::findFingerprint( TQString strFingerprint ){ diff --git a/src/smppopup.cpp b/src/smppopup.cpp index 66f28c1..0a550cc 100644 --- a/src/smppopup.cpp +++ b/src/smppopup.cpp @@ -74,7 +74,7 @@ void SMPPopup::openHelp() } void SMPPopup::manualAuth(){ - VerifyPopup *vfPopup = new VerifyPopup(this, i18n("Verify Fingerprint"), session); + VerifyPopup *vfPopup = new VerifyPopup(this, i18n("Verify Fingerprint").utf8(), session); vfPopup->show(); this->close(); }