summaryrefslogtreecommitdiffstats
path: root/src/otrplugin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/otrplugin.cpp')
-rw-r--r--src/otrplugin.cpp102
1 files changed, 51 insertions, 51 deletions
diff --git a/src/otrplugin.cpp b/src/otrplugin.cpp
index 873c800..323ee44 100644
--- a/src/otrplugin.cpp
+++ b/src/otrplugin.cpp
@@ -18,11 +18,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#include <qstylesheet.h>
-#include <qtimer.h>
-#include <qregexp.h>
-#include <qfile.h>
-#include <qcolor.h>
+#include <tqstylesheet.h>
+#include <tqtimer.h>
+#include <tqregexp.h>
+#include <tqfile.h>
+#include <tqcolor.h>
#include <kdebug.h>
#include <kaction.h>
@@ -62,22 +62,22 @@ typedef KGenericFactory<OTRPlugin> OTRPluginFactory;
static const KAboutData aboutdata("kopete_otr", I18N_NOOP("OTR") , "0.7" );
K_EXPORT_COMPONENT_FACTORY( kopete_otr, OTRPluginFactory( &aboutdata ) )
-OTRPlugin::OTRPlugin( QObject *parent, const char *name, const QStringList & /* args */ )
-: Kopete::Plugin( OTRPluginFactory::instance(), parent, name )
+OTRPlugin::OTRPlugin( TQObject *tqparent, const char *name, const TQStringList & /* args */ )
+: Kopete::Plugin( OTRPluginFactory::instance(), tqparent, name )
{
if( !pluginStatic_ )
pluginStatic_=this;
m_inboundHandler = new OtrMessageHandlerFactory(this);
- connect( Kopete::ChatSessionManager::self(), SIGNAL( aboutToSend( Kopete::Message & ) ),
- SLOT( slotOutgoingMessage( Kopete::Message & ) ) );
-// connect( Kopete::ChatSessionManager::self(), SIGNAL( aboutToDisplay( Kopete::Message & ) ),
-// this, SLOT( slotIncomingMessage( Kopete::Message & ) ) );
+ connect( Kopete::ChatSessionManager::self(), TQT_SIGNAL( aboutToSend( Kopete::Message & ) ),
+ TQT_SLOT( slotOutgoingMessage( Kopete::Message & ) ) );
+// connect( Kopete::ChatSessionManager::self(), TQT_SIGNAL( aboutToDisplay( Kopete::Message & ) ),
+// this, TQT_SLOT( slotIncomingMessage( Kopete::Message & ) ) );
- connect( Kopete::ChatSessionManager::self(), SIGNAL( chatSessionCreated( Kopete::ChatSession * ) ),
- this, SLOT( slotNewChatSessionWindow( Kopete::ChatSession * ) ) );
- QObject::connect( this, SIGNAL( settingsChanged() ), this, SLOT( slotSettingsChanged() ) );
+ connect( Kopete::ChatSessionManager::self(), TQT_SIGNAL( chatSessionCreated( Kopete::ChatSession * ) ),
+ this, TQT_SLOT( slotNewChatSessionWindow( Kopete::ChatSession * ) ) );
+ TQObject::connect( this, TQT_SIGNAL( settingsChanged() ), this, TQT_SLOT( slotSettingsChanged() ) );
@@ -85,25 +85,25 @@ OTRPlugin::OTRPlugin( QObject *parent, const char *name, const QStringList & /*
otrlChatInterface = OtrlChatInterface::self();
//update key files when an account is ready to use
- if( QFile::exists( QString( KGlobal::dirs()->saveLocation( "data", "kopete_otr/", true ) ) + "privkey" ) &&
- !QFile::exists( QString( KGlobal::dirs()->saveLocation( "data", "kopete_otr/", true ) ) + "privkeys" ) ){
+ if( TQFile::exists( TQString( KGlobal::dirs()->saveLocation( "data", "kopete_otr/", true ) ) + "privkey" ) &&
+ !TQFile::exists( TQString( KGlobal::dirs()->saveLocation( "data", "kopete_otr/", true ) ) + "privkeys" ) ){
kdDebug() << "Detected old format keyfile. Doing updates!" << endl;
kdDebug() << "Reading old keyfile..." << endl;
- QFile fpold( QString(KGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "privkey" );
- QString line;
- QString file;
+ TQFile fpold( TQString(KGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "privkey" );
+ TQString line;
+ TQString file;
if( fpold.open( IO_ReadWrite ) ){
while( fpold.readLine( line, 100 ) != -1){
file.append( line );
}
}
kdDebug() << "Writing new keyfile" << endl;
- QFile fpnew( QString(KGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "privkeys" );
+ TQFile fpnew( TQString(KGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "privkeys" );
fpnew.open( IO_ReadWrite );
fpnew.writeBlock( file.latin1(), file.length() );
fpnew.close();
kdDebug() << "Writing backup for old keyfile" << endl;
- QFile fpbup( QString(KGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "privkey.old" );
+ TQFile fpbup( TQString(KGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "privkey.old" );
fpbup.open( IO_ReadWrite );
fpbup.writeBlock( file.latin1(), file.length() );
fpbup.close();
@@ -111,7 +111,7 @@ OTRPlugin::OTRPlugin( QObject *parent, const char *name, const QStringList & /*
fpold.remove();
kdDebug() << "Reading old fingerprintsfile..." << endl;
- QFile fpfingerprintsold( QString(KGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "fingerprints" );
+ TQFile fpfingerprintsold( TQString(KGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "fingerprints" );
line = "";
file = "";
if( fpfingerprintsold.open( IO_ReadWrite ) ){
@@ -120,35 +120,35 @@ OTRPlugin::OTRPlugin( QObject *parent, const char *name, const QStringList & /*
}
}
kdDebug() << "Writing backup for old fingerprintsfile" << endl;
- QFile fpfingerprintsbup( QString(KGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "fingerprints.old" );
+ TQFile fpfingerprintsbup( TQString(KGlobal::dirs()->saveLocation("data", "kopete_otr/", true )) + "fingerprints.old" );
fpfingerprintsbup.open( IO_ReadWrite );
fpfingerprintsbup.writeBlock( file.latin1(), file.length() );
fpfingerprintsbup.close();
kdDebug() << "Waiting for accounts to update keyfile format" << endl;
- connect( Kopete::AccountManager::self(), SIGNAL( accountRegistered( Kopete::Account * ) ),
- this, SLOT( accountReady( Kopete::Account * ) ) );
+ connect( Kopete::AccountManager::self(), TQT_SIGNAL( accountRegistered( Kopete::Account * ) ),
+ this, TQT_SLOT( accountReady( Kopete::Account * ) ) );
}
// Checking file Permissions
- OtrlChatInterface::self()->checkFilePermissions( QString( KGlobal::dirs()->saveLocation( "data", "kopete_otr/", true ) ) + "privkeys" );
- OtrlChatInterface::self()->checkFilePermissions( QString( KGlobal::dirs()->saveLocation( "data", "kopete_otr/", true ) ) + "fingerprints" );
+ OtrlChatInterface::self()->checkFilePermissions( TQString( KGlobal::dirs()->saveLocation( "data", "kopete_otr/", true ) ) + "privkeys" );
+ OtrlChatInterface::self()->checkFilePermissions( TQString( KGlobal::dirs()->saveLocation( "data", "kopete_otr/", true ) ) + "fingerprints" );
// Check also file permissions for eventuallly old beckup files
- OtrlChatInterface::self()->checkFilePermissions( QString( KGlobal::dirs()->saveLocation( "data", "kopete_otr/", true ) ) + "privkey.old" );
- OtrlChatInterface::self()->checkFilePermissions( QString( KGlobal::dirs()->saveLocation( "data", "kopete_otr/", true ) ) + "fingerprints.old" );
+ OtrlChatInterface::self()->checkFilePermissions( TQString( KGlobal::dirs()->saveLocation( "data", "kopete_otr/", true ) ) + "privkey.old" );
+ OtrlChatInterface::self()->checkFilePermissions( TQString( KGlobal::dirs()->saveLocation( "data", "kopete_otr/", true ) ) + "fingerprints.old" );
//setting the policy
slotSettingsChanged();
//adding menu to contaclists menubar and contacts popup menu
- QStringList policies;
+ TQStringList policies;
policies << i18n("&Default") << i18n("Al&ways") << i18n("&Opportunistic") << i18n("&Manual") << i18n("Ne&ver");
- otrPolicyMenu = new KSelectAction( i18n( "&OTR Policy" ), QString::fromLatin1("kopete_otr"), 0, actionCollection(), "otr_policy" );
+ otrPolicyMenu = new KSelectAction( i18n( "&OTR Policy" ), TQString::tqfromLatin1("kopete_otr"), 0, actionCollection(), "otr_policy" );
otrPolicyMenu->setItems( policies );
otrPolicyMenu->popupMenu()->insertSeparator( 1 );
otrPolicyMenu->setEnabled( false );
- connect( otrPolicyMenu, SIGNAL( activated() ), this, SLOT( slotSetPolicy() ) );
- connect( Kopete::ContactList::self(), SIGNAL( metaContactSelected( bool ) ), this, SLOT( slotSelectionChanged( bool ) ) );
+ connect( otrPolicyMenu, TQT_SIGNAL( activated() ), this, TQT_SLOT( slotSetPolicy() ) );
+ connect( Kopete::ContactList::self(), TQT_SIGNAL( metaContactSelected( bool ) ), this, TQT_SLOT( slotSelectionChanged( bool ) ) );
setXMLFile( "otrui.rc" );
@@ -157,9 +157,9 @@ OTRPlugin::OTRPlugin( QObject *parent, const char *name, const QStringList & /*
//Add GUI action to all already existing kmm
// (if the plugin is launched when kopete already runing)
- QValueList<Kopete::ChatSession*> sessions =
+ TQValueList<Kopete::ChatSession*> sessions =
Kopete::ChatSessionManager::self()->sessions();
- QValueListIterator<Kopete::ChatSession*> it;
+ TQValueListIterator<Kopete::ChatSession*> it;
for (it= sessions.begin(); it!=sessions.end() ; ++it){
slotNewChatSessionWindow( *it );
}
@@ -196,11 +196,11 @@ void OTRPlugin::slotNewChatSessionWindow( Kopete::ChatSession *KMM )
void OTRPlugin::slotOutgoingMessage( Kopete::Message& msg )
{
if( msg.direction() == Kopete::Message::Outbound ){
- QString plainBody = msg.plainBody();
- QString accountId = msg.manager()->account()->accountId();
+ TQString plainBody = msg.plainBody();
+ TQString accountId = msg.manager()->account()->accountId();
Kopete::Contact *contact = msg.to().first();
- QString encBody = otrlChatInterface->encryptMessage( plainBody, accountId, msg.manager()->account()->protocol()->displayName(), contact->contactId(), msg.manager() );
+ TQString encBody = otrlChatInterface->encryptMessage( plainBody, accountId, msg.manager()->account()->protocol()->displayName(), contact->contactId(), msg.manager() );
msg.setBody( encBody, Kopete::Message::Crypted );
if( !msg.plainBody().isEmpty() ){
messageCache.insert( encBody, plainBody );
@@ -212,19 +212,19 @@ void OTRPlugin::slotEnableOtr( Kopete::ChatSession *session, bool enable ){
if( enable ){
- QString policy = session->members().getFirst()->metaContact()->pluginData( OTRPlugin::plugin(), "otr_policy" );
+ TQString policy = session->members().getFirst()->metaContact()->pluginData( OTRPlugin::plugin(), "otr_policy" );
bool noerr;
KopeteOtrKcfg::self()->readConfig();
if( policy.toInt( &noerr, 10 ) == 4 || ( policy.toInt( &noerr, 10 ) == 0 && KopeteOtrKcfg::self()->rbNever() ) ){
Kopete::Message msg( session->account()->myself(), session->members(), i18n( "Your policy settings do not allow encrypted sessions to this contact." ), Kopete::Message::Internal, Kopete::Message::RichText );
session->appendMessage( msg );
} else {
- QString body = otrlChatInterface->getDefaultQuery( session->account()->accountId() );
- Kopete::Message msg1( session->account()->myself(), session->members().getFirst(), QString( body ), Kopete::Message::Outbound );
+ TQString body = otrlChatInterface->getDefaultQuery( session->account()->accountId() );
+ Kopete::Message msg1( session->account()->myself(), session->members().getFirst(), TQString( body ), Kopete::Message::Outbound );
if( otrlChatInterface->privState( session ) > 0 ){
- body = i18n("Attempting to refresh the OTR session with <b>%1</b>...").arg( otrlChatInterface->formatContact( session->members().getFirst()->contactId() ) );
+ body = i18n("Attempting to refresh the OTR session with <b>%1</b>...").tqarg( otrlChatInterface->formatContact( session->members().getFirst()->contactId() ) );
} else {
- body = i18n("Attempting to start a private OTR session with <b>%1</b>...").arg( otrlChatInterface->formatContact( session->members().getFirst()->contactId() ) );
+ body = i18n("Attempting to start a private OTR session with <b>%1</b>...").tqarg( otrlChatInterface->formatContact( session->members().getFirst()->contactId() ) );
}
Kopete::Message msg2( session->account()->myself(), session->members().getFirst(), body, Kopete::Message::Internal, Kopete::Message::RichText );
@@ -260,20 +260,20 @@ void OTRPlugin::emitGoneSecure( Kopete::ChatSession *session, int status){
emit goneSecure( session, status );
}
-QMap<QString, QString> OTRPlugin::getMessageCache(){
+TQMap<TQString, TQString> OTRPlugin::getMessageCache(){
return messageCache;
}
void OtrMessageHandler::handleMessage( Kopete::MessageEvent *event ){
Kopete::Message msg = event->message();
Kopete::ChatSession *session = msg.manager();
- QMap<QString, QString> messageCache = OTRPlugin::plugin()->getMessageCache();
+ TQMap<TQString, TQString> messageCache = OTRPlugin::plugin()->getMessageCache();
if( msg.direction() == Kopete::Message::Inbound ){
- QString body = msg.parsedBody();
+ TQString body = msg.parsedBody();
kdDebug() << "Received Message: " << msg.parsedBody() << endl;
- QString accountId = msg.manager()->account()->accountId();
- QString contactId = msg.from()->contactId();
+ TQString accountId = msg.manager()->account()->accountId();
+ TQString contactId = msg.from()->contactId();
int ignoremessage = OtrlChatInterface::self()->decryptMessage( &body, accountId, msg.manager()->account()->protocol()->displayName(), contactId, msg.manager() );
msg.setBody( body, Kopete::Message::RichText );
if( ignoremessage | OtrlChatInterface::self()->shouldDiscard( msg.plainBody() ) ){
@@ -281,7 +281,7 @@ kdDebug() << "Received Message: " << msg.parsedBody() << endl;
return;
}
} else if( msg.direction() == Kopete::Message::Outbound ){
- if( messageCache.contains( msg.plainBody() ) ){
+ if( messageCache.tqcontains( msg.plainBody() ) ){
msg.setBody( messageCache[msg.plainBody()] );
messageCache.remove( messageCache[msg.plainBody()] );
if(messageCache.count() > 5) messageCache.clear();
@@ -314,7 +314,7 @@ void OTRPlugin::slotSelectionChanged( bool single){
Kopete::MetaContact *metaContact = Kopete::ContactList::self()->selectedMetaContacts().first();
- QString policy = metaContact->pluginData( this, "otr_policy" );
+ TQString policy = metaContact->pluginData( this, "otr_policy" );
bool noerr;
if ( !policy.isEmpty() && policy != "null" )
@@ -328,7 +328,7 @@ void OTRPlugin::slotSetPolicy(){
kdDebug() << "Setting contact policy" << endl;
Kopete::MetaContact *metaContact = Kopete::ContactList::self()->selectedMetaContacts().first();
if( metaContact ){
- metaContact->setPluginData( this, "otr_policy", QString::number( otrPolicyMenu->currentItem() ) );
+ metaContact->setPluginData( this, "otr_policy", TQString::number( otrPolicyMenu->currentItem() ) );
}
}