diff -Nru i2p-messenger-0.2.24/debian/changelog i2p-messenger-0.2.25/debian/changelog --- i2p-messenger-0.2.24/debian/changelog 2014-11-23 01:33:39.000000000 +0000 +++ i2p-messenger-0.2.25/debian/changelog 2015-03-10 01:50:25.000000000 +0000 @@ -1,3 +1,15 @@ +i2p-messenger (0.2.25-1~trusty+1) trusty; urgency=medium + + * Upload to PPA + + -- Kill Your TV Tue, 10 Mar 2015 01:50:14 +0000 + +i2p-messenger (0.2.25-1) unstable; urgency=medium + + * New upstream release from http://git.repo.i2p/w/I2P-Messenger-QT.git + + -- Kill Your TV Mon, 09 Mar 2015 19:54:20 +0000 + i2p-messenger (0.2.24-2ubuntu1) trusty; urgency=medium * Initial upload for Trusty diff -Nru i2p-messenger-0.2.24/debian/control i2p-messenger-0.2.25/debian/control --- i2p-messenger-0.2.24/debian/control 2014-11-23 01:33:39.000000000 +0000 +++ i2p-messenger-0.2.25/debian/control 2015-03-10 01:50:25.000000000 +0000 @@ -2,10 +2,10 @@ Section: net Priority: extra Maintainer: Kill Your TV -Build-Depends: debhelper (>= 9), qt4-qmake, libqt4-dev, libaudio-dev, hardening-wrapper +Build-Depends: debhelper (>= 9), qt4-qmake, libqt4-dev, libaudio-dev Bugs:mailto:killyourtv@i2pmail.org -Standards-Version: 3.9.4 -Homepage: http://forum.i2p/viewtopic.php?p=30651#30651 +Standards-Version: 3.9.6 +Homepage: http://git.repo.i2p/w/I2P-Messenger-QT.git Package: i2p-messenger Architecture: any diff -Nru i2p-messenger-0.2.24/debian/patches/0001-sound-paths.patch i2p-messenger-0.2.25/debian/patches/0001-sound-paths.patch --- i2p-messenger-0.2.24/debian/patches/0001-sound-paths.patch 2014-11-23 01:33:39.000000000 +0000 +++ i2p-messenger-0.2.25/debian/patches/0001-sound-paths.patch 2015-03-10 01:50:25.000000000 +0000 @@ -3,7 +3,7 @@ Subject: sound paths --- - src/backend/SoundManager.cpp | 6 +++--- + src/backend/SoundManager.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backend/SoundManager.cpp b/src/backend/SoundManager.cpp diff -Nru i2p-messenger-0.2.24/debian/patches/0002-configs-in-homedir.patch i2p-messenger-0.2.25/debian/patches/0002-configs-in-homedir.patch --- i2p-messenger-0.2.24/debian/patches/0002-configs-in-homedir.patch 1970-01-01 00:00:00.000000000 +0000 +++ i2p-messenger-0.2.25/debian/patches/0002-configs-in-homedir.patch 2015-03-10 01:50:25.000000000 +0000 @@ -0,0 +1,28 @@ +From: Kill Your TV +Date: Fri, 12 Oct 2012 18:09:15 +0000 +Subject: configs in homedir + +--- + src/backend/Core.cpp | 9 ++------- + 1 file changed, 2 insertions(+), 7 deletions(-) + +diff --git a/src/backend/Core.cpp b/src/backend/Core.cpp +index 31003ad..f1834e4 100755 +--- a/src/backend/Core.cpp ++++ b/src/backend/Core.cpp +@@ -33,13 +33,8 @@ + CCore::CCore() + { + +- if(QFile::exists(QApplication::applicationDirPath()+"/UseHomeForConfigStore")==true){ +- mConfigPath=QDesktopServices::storageLocation(QDesktopServices::HomeLocation); +- mConfigPath+="/.I2P-Messenger"; +- } +- else{ +- mConfigPath=QApplication::applicationDirPath(); +- } ++ mConfigPath=QDesktopServices::storageLocation(QDesktopServices::HomeLocation); ++ mConfigPath+="/.I2P-Messenger"; + + mDebugMessageHandler= new CDebugMessageManager("General"); + mSoundManager= new CSoundManager(mConfigPath); diff -Nru i2p-messenger-0.2.24/debian/patches/0002-typo-fixes.patch i2p-messenger-0.2.25/debian/patches/0002-typo-fixes.patch --- i2p-messenger-0.2.24/debian/patches/0002-typo-fixes.patch 2014-11-23 01:33:39.000000000 +0000 +++ i2p-messenger-0.2.25/debian/patches/0002-typo-fixes.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,271 +0,0 @@ -From: Kill Your TV -Date: Fri, 12 Oct 2012 18:09:07 +0000 -Subject: typo fixes - ---- - src/gui/form_Main.cpp | 26 ++++++++++++-------------- - src/gui/form_about.ui | 8 ++++---- - src/gui/form_settingsgui.ui | 20 ++++++++++---------- - src/gui/form_userSearch.ui | 2 +- - 4 files changed, 27 insertions(+), 29 deletions(-) - -diff --git a/src/gui/form_Main.cpp b/src/gui/form_Main.cpp -index 78b93da..06d1b20 100755 ---- a/src/gui/form_Main.cpp -+++ b/src/gui/form_Main.cpp -@@ -107,7 +107,7 @@ void form_MainWindow::onlineComboBoxChanged() - QMessageBox* msgBox= new QMessageBox(NULL); - msgBox->setIcon(QMessageBox::Information); - msgBox->setText(""); -- msgBox->setInformativeText(tr("Sorry a Filetransfer or Filerecive ist active,\nclosing aborted")); -+ msgBox->setInformativeText(tr("Sorry, a file transfer is active,\nclosing aborted")); - msgBox->setStandardButtons(QMessageBox::Ok); - msgBox->setDefaultButton(QMessageBox::Ok); - msgBox->setWindowModality(Qt::NonModal); -@@ -138,7 +138,7 @@ void form_MainWindow::initToolBars() - QMessageBox* msgBox= new QMessageBox(NULL); - msgBox->setIcon(QMessageBox::Information); - msgBox->setText(tr("I2P-Messenger")); -- msgBox->setInformativeText(tr("Sorry you have to enter a Nickname(at User-details) for UserSearch,UserSearch deaktivated")); -+ msgBox->setInformativeText("A nickname must be picked to use User Search. Set the nickname in 'User Details.' User Search deactivated"); - msgBox->setStandardButtons(QMessageBox::Ok); - msgBox->setDefaultButton(QMessageBox::Ok); - msgBox->setWindowModality(Qt::NonModal); -@@ -195,7 +195,7 @@ void form_MainWindow::namingMe(){ - if(Destination!=""){ - clipboard->setText(Destination); - QMessageBox::information(this, "", -- tr("Your Destination is in the clipboard"),QMessageBox::Close); -+ tr("Your Destination has been copied to the clipboard"),QMessageBox::Close); - } - else - QMessageBox::information(this, "", -@@ -232,7 +232,7 @@ void form_MainWindow::closeApplication(){ - QMessageBox* msgBox= new QMessageBox(NULL); - msgBox->setIcon(QMessageBox::Information); - msgBox->setText(""); -- msgBox->setInformativeText(tr("Sorry a Filetransfer or Filerecive ist active,\nClosing aborted")); -+ msgBox->setInformativeText(tr("Sorry a File transfer is active,\nClosing aborted")); - msgBox->setStandardButtons(QMessageBox::Ok); - msgBox->setDefaultButton(QMessageBox::Ok); - msgBox->setWindowModality(Qt::NonModal); -@@ -621,7 +621,7 @@ void form_MainWindow::OnlineStateChanged() - - if(onlinestatus==User::USERTRYTOCONNECT){ - comboBox->clear(); -- comboBox->addItem(QIcon(ICON_USER_TRYTOCONNECT) , tr("TryToConnect")); //index 0 -+ comboBox->addItem(QIcon(ICON_USER_TRYTOCONNECT) , tr("Try to Connect")); //index 0 - comboBox->addItem(QIcon(ICON_USER_OFFLINE) , tr("Offline")); //1 - comboBox->setCurrentIndex(0); - trayIcon->setIcon(QIcon(ICON_USER_TRYTOCONNECT)); -@@ -631,9 +631,9 @@ void form_MainWindow::OnlineStateChanged() - comboBox->clear(); - - comboBox->addItem(QIcon(ICON_USER_ONLINE) , tr("Online")); //index 0 -- comboBox->addItem(QIcon(ICON_USER_WANTTOCHAT) , tr("WantToChat")); //1 -+ comboBox->addItem(QIcon(ICON_USER_WANTTOCHAT) , tr("Want to Chat")); //1 - comboBox->addItem(QIcon(ICON_USER_AWAY) , tr("Away")); //2 -- comboBox->addItem(QIcon(ICON_USER_DONT_DUSTURB) , tr("Don't disturb")); //3 -+ comboBox->addItem(QIcon(ICON_USER_DONT_DUSTURB) , tr("Do not Disturb"));//3 - comboBox->addItem(QIcon(ICON_USER_INVISIBLE) , tr("Invisible")); //4 - comboBox->addItem(QIcon(ICON_USER_OFFLINE) , tr("Offline")); //5 - } -@@ -790,7 +790,7 @@ void form_MainWindow::copyDestination() - - clipboard->setText(Destination); - QMessageBox::information(this, "", -- tr("The Destination is in the clipboard"),QMessageBox::Close); -+ tr("The Destination has been copied to the clipboard"),QMessageBox::Close); - - } - -@@ -865,7 +865,7 @@ void form_MainWindow::eventChatWindowClosed(QString Destination) - } - else{ - qCritical()<<"form_MainWindow::eventChatWindowClosed\n" -- <<"Closing a unknown ChatWindow"; -+ <<"Closing an unknown ChatWindow"; - } - - } -@@ -883,7 +883,7 @@ void form_MainWindow::openChatWindow(QString Destination) - CUser* User; - User=Core->getUserManager()->getUserByI2P_Destination(Destination); - if(User==NULL){ -- qCritical()<<"form_MainWindow::openChatWindow"<<"try to open a Chatwindow,but the user don't exists"; -+ qCritical()<<"form_MainWindow::openChatWindow"<<"tried to open a Chat window, but the user doesn't exist"; - return; - } - -@@ -929,7 +929,7 @@ void form_MainWindow::eventFileSendWindowClosed(qint32 StreamID) - } - else{ - qCritical()<<"form_MainWindow::eventFileSendWindowClosed\n" -- <<"Closing a unknown FileSendWindow"; -+ <<"Closing an unknown FileSendWindow"; - } - } - -@@ -1013,7 +1013,7 @@ void form_MainWindow::openUserSearchWindow() - - if(currentState==USEROFFLINE || currentState==USERTRYTOCONNECT){ - QMessageBox::information(this, "", -- tr("Your Client must be Online for that"),QMessageBox::Close); -+ tr("Your client must be Online for that"),QMessageBox::Close); - return; - } - -@@ -1045,5 +1045,3 @@ void form_MainWindow::eventDebugWindowClosed() - delete mDebugWindow; - mDebugWindow=NULL; - } -- -- -\ No newline at end of file -diff --git a/src/gui/form_about.ui b/src/gui/form_about.ui -index 3e5513c..8415854 100755 ---- a/src/gui/form_about.ui -+++ b/src/gui/form_about.ui -@@ -78,7 +78,7 @@ - - - -- Applicationversion: -+ Application Version: - - - -@@ -92,7 +92,7 @@ - - - -- Protocolversion: -+ Protocol Version: - - - -@@ -106,7 +106,7 @@ - - - -- Supported Filetransferversions: -+ Supported File-transfer Versions: - - - -@@ -124,7 +124,7 @@ - - - -- Contact the dev/s (on I2P-Bote): -+ Contact the devs (on I2P-Bote): - - - -diff --git a/src/gui/form_settingsgui.ui b/src/gui/form_settingsgui.ui -index f42c668..aac5bc4 100755 ---- a/src/gui/form_settingsgui.ui -+++ b/src/gui/form_settingsgui.ui -@@ -330,7 +330,7 @@ - - - -- Usersearch -+ User Search - - - -@@ -355,7 +355,7 @@ - - - -- Waittime between rechecking offline users -+ Time to wait between checks for offline users - - - -@@ -499,7 +499,7 @@ p, li { white-space: pre-wrap; } - - - -- Autoaccept Filerecive -+ Auto-accept File Transfers - - - -@@ -529,7 +529,7 @@ p, li { white-space: pre-wrap; } - - - -- Incoming Filefolder: -+ Incoming File Folder: - - - -@@ -562,7 +562,7 @@ p, li { white-space: pre-wrap; } - true - - -- Enable Incomingsubfolders -+ Enable Incoming Sub-folders - - - true -@@ -1513,7 +1513,7 @@ p, li { white-space: pre-wrap; } - - - -- go Online: -+ Came online: - - - -@@ -1529,7 +1529,7 @@ p, li { white-space: pre-wrap; } - - - -- go Offline: -+ Went offline: - - - -@@ -1650,7 +1650,7 @@ p, li { white-space: pre-wrap; } - - - -- FileRecive -+ File Receive - - - -@@ -1747,7 +1747,7 @@ p, li { white-space: pre-wrap; } - - - -- Chatmessage -+ Chat message - - - -@@ -2579,7 +2579,7 @@ p, li { white-space: pre-wrap; } - - - -- Reannouncetimer in hours -+ Re-announcetimer (in hours) - - - -diff --git a/src/gui/form_userSearch.ui b/src/gui/form_userSearch.ui -index d1392f6..49c0396 100755 ---- a/src/gui/form_userSearch.ui -+++ b/src/gui/form_userSearch.ui -@@ -34,7 +34,7 @@ - - - -- Search - options -+ Search - Options - - - diff -Nru i2p-messenger-0.2.24/debian/patches/0003-configs-in-homedir.patch i2p-messenger-0.2.25/debian/patches/0003-configs-in-homedir.patch --- i2p-messenger-0.2.24/debian/patches/0003-configs-in-homedir.patch 2014-11-23 01:33:39.000000000 +0000 +++ i2p-messenger-0.2.25/debian/patches/0003-configs-in-homedir.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ -From: Kill Your TV -Date: Fri, 12 Oct 2012 18:09:15 +0000 -Subject: configs in homedir - ---- - src/backend/Core.cpp | 9 ++------- - 1 file changed, 2 insertions(+), 7 deletions(-) - -diff --git a/src/backend/Core.cpp b/src/backend/Core.cpp -index 69ce5be..e9f7d4f 100755 ---- a/src/backend/Core.cpp -+++ b/src/backend/Core.cpp -@@ -33,13 +33,8 @@ - CCore::CCore() - { - -- if(QFile::exists(QApplication::applicationDirPath()+"/UseHomeForConfigStore")==true){ -- mConfigPath=QDesktopServices::storageLocation(QDesktopServices::HomeLocation); -- mConfigPath+="/.I2P-Messenger"; -- } -- else{ -- mConfigPath=QApplication::applicationDirPath(); -- } -+ mConfigPath=QDesktopServices::storageLocation(QDesktopServices::HomeLocation); -+ mConfigPath+="/.I2P-Messenger"; - - mDebugMessageHandler= new CDebugMessageManager("General"); - mSoundManager= new CSoundManager(mConfigPath); diff -Nru i2p-messenger-0.2.24/debian/patches/0003-Hardening-flags.patch i2p-messenger-0.2.25/debian/patches/0003-Hardening-flags.patch --- i2p-messenger-0.2.24/debian/patches/0003-Hardening-flags.patch 1970-01-01 00:00:00.000000000 +0000 +++ i2p-messenger-0.2.25/debian/patches/0003-Hardening-flags.patch 2015-03-10 01:50:25.000000000 +0000 @@ -0,0 +1,40 @@ +From: Kill Your TV +Date: Mon, 9 Mar 2015 22:48:19 +0000 +Subject: Hardening flags + +--- + I2P-Messenger.pro | 4 ++-- + I2P-Messenger_release.pro | 4 +++- + 2 files changed, 5 insertions(+), 3 deletions(-) + +diff --git a/I2P-Messenger.pro b/I2P-Messenger.pro +index 6e206a1..dfe0ebb 100755 +--- a/I2P-Messenger.pro ++++ b/I2P-Messenger.pro +@@ -5,8 +5,8 @@ CONFIG += qt \ + QT += network xml + TEMPLATE = app + +-QMAKE_CXXFLAGS+= -std=c++11 -Wall +-QMAKE_LFLAGS += -std=c++11 ++QMAKE_CXXFLAGS+= -std=c++11 -Wall $(shell dpkg-buildflags --get CXXFLAGS) ++QMAKE_LFLAGS += -std=c++11 $(shell dpkg-buildflags --get LDFLAGS) + + DEPENDPATH += ". \ + src/gui/ \ +diff --git a/I2P-Messenger_release.pro b/I2P-Messenger_release.pro +index 0f87b23..ab0a456 100755 +--- a/I2P-Messenger_release.pro ++++ b/I2P-Messenger_release.pro +@@ -6,8 +6,10 @@ CONFIG += qt \ + QT += network xml + TEMPLATE = app + ++CXXFLAGS += $(shell dpkg-buildflags --get CXXFLAGS) ++ + QMAKE_CXXFLAGS+= -std=c++11 -Wall +-QMAKE_LFLAGS += -std=c++11 ++QMAKE_LFLAGS += -std=c++11 $(shell dpkg-buildflags --get LDFLAGS) + + DEPENDPATH += ". \ + src/gui/ \ diff -Nru i2p-messenger-0.2.24/debian/patches/0004-improved-sam-error.patch i2p-messenger-0.2.25/debian/patches/0004-improved-sam-error.patch --- i2p-messenger-0.2.24/debian/patches/0004-improved-sam-error.patch 2014-11-23 01:33:39.000000000 +0000 +++ i2p-messenger-0.2.25/debian/patches/0004-improved-sam-error.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -From: Kill Your TV -Date: Fri, 12 Oct 2012 18:10:49 +0000 -Subject: improved sam error - ---- - src/backend/StreamController.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/backend/StreamController.cpp b/src/backend/StreamController.cpp -index 7fecc2f..32ac57b 100755 ---- a/src/backend/StreamController.cpp -+++ b/src/backend/StreamController.cpp -@@ -75,7 +75,7 @@ void CStreamController::slotDisconnected() - - QMessageBox msgBox(NULL); - msgBox.setIcon(QMessageBox::Critical); -- msgBox.setInformativeText("<-- StreamController (I2P) can't connect I2P(sam) or I2P crashed -->\nSamHost:\t"+mSamHost+"\nSamPort:\t" +mSamPort+"\n"); -+ msgBox.setInformativeText("Cannot connect to\nSamHost:\t"+mSamHost+"\nSamPort:\t" +mSamPort+"\n\nTry the following to resolve the error:\n\n - Go to http://"+mSamHost+":7657/configclients.\n - Find the section for \"SAM application bridge\".\n - Click the button labelled \"Start\".\n\nAfter doing this, try to connect again."); - msgBox.setStandardButtons(QMessageBox::Ok); - msgBox.setDefaultButton(QMessageBox::Ok); - msgBox.setWindowModality(Qt::NonModal); diff -Nru i2p-messenger-0.2.24/debian/patches/series i2p-messenger-0.2.25/debian/patches/series --- i2p-messenger-0.2.24/debian/patches/series 2014-11-23 01:33:39.000000000 +0000 +++ i2p-messenger-0.2.25/debian/patches/series 2015-03-10 01:50:25.000000000 +0000 @@ -1,4 +1,3 @@ 0001-sound-paths.patch -0002-typo-fixes.patch -0003-configs-in-homedir.patch -0004-improved-sam-error.patch +0002-configs-in-homedir.patch +0003-Hardening-flags.patch diff -Nru i2p-messenger-0.2.24/I2P-Messenger.pro i2p-messenger-0.2.25/I2P-Messenger.pro --- i2p-messenger-0.2.24/I2P-Messenger.pro 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/I2P-Messenger.pro 2014-12-26 20:46:32.000000000 +0000 @@ -1,10 +1,13 @@ CONFIG += qt \ - debug + debug QT += network xml TEMPLATE = app +QMAKE_CXXFLAGS+= -std=c++11 -Wall +QMAKE_LFLAGS += -std=c++11 + DEPENDPATH += ". \ src/gui/ \ src/backend/" @@ -24,7 +27,7 @@ src/backend/FileTransferRecive.cpp \ src/backend/SoundManager.cpp \ src/backend/ConnectionManager.cpp \ - src/backend/StreamController.cpp \ + src/backend/SessionController.cpp \ src/backend/I2PStream.cpp \ src/backend/ChatmessageChanger.cpp \ src/backend/UserBlockManager.cpp \ @@ -35,8 +38,6 @@ src/backend/UserManager.cpp \ src/backend/FileTransferManager.cpp \ src/backend/TextEmotionChanger.cpp \ - src/backend/ChatMessageAckEntry.cpp \ - src/backend/CMessageAckManager.cpp \ src/backend/UnsentChatMessageStorage.cpp \ src/gui/form_Main.cpp \ src/gui/form_chatwidget.cpp \ @@ -60,7 +61,7 @@ src/backend/FileTransferRecive.h \ src/backend/SoundManager.h \ src/backend/ConnectionManager.h \ - src/backend/StreamController.h \ + src/backend/SessionController.h \ src/backend/I2PStream.h \ src/backend/ChatmessageChanger.h \ src/backend/UserBlockManager.h \ @@ -71,8 +72,6 @@ src/backend/UserManager.h \ src/backend/FileTransferManager.h \ src/backend/TextEmotionChanger.h \ - src/backend/ChatMessageAckEntry.h \ - src/backend/CMessageAckManager.h \ src/backend/UnsentChatMessageStorage.h \ src/gui/form_Main.h \ src/gui/form_chatwidget.h \ diff -Nru i2p-messenger-0.2.24/I2P-Messenger_release.pro i2p-messenger-0.2.25/I2P-Messenger_release.pro --- i2p-messenger-0.2.24/I2P-Messenger_release.pro 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/I2P-Messenger_release.pro 2014-12-26 20:46:32.000000000 +0000 @@ -1,10 +1,14 @@ CONFIG += qt \ - release + release + QT += network xml TEMPLATE = app +QMAKE_CXXFLAGS+= -std=c++11 -Wall +QMAKE_LFLAGS += -std=c++11 + DEPENDPATH += ". \ src/gui/ \ src/backend/" @@ -24,7 +28,7 @@ src/backend/FileTransferRecive.cpp \ src/backend/SoundManager.cpp \ src/backend/ConnectionManager.cpp \ - src/backend/StreamController.cpp \ + src/backend/SessionController.cpp \ src/backend/I2PStream.cpp \ src/backend/ChatmessageChanger.cpp \ src/backend/UserBlockManager.cpp \ @@ -35,8 +39,6 @@ src/backend/UserManager.cpp \ src/backend/FileTransferManager.cpp \ src/backend/TextEmotionChanger.cpp \ - src/backend/ChatMessageAckEntry.cpp \ - src/backend/CMessageAckManager.cpp \ src/backend/UnsentChatMessageStorage.cpp \ src/gui/form_Main.cpp \ src/gui/form_chatwidget.cpp \ @@ -59,7 +61,7 @@ src/backend/FileTransferRecive.h \ src/backend/SoundManager.h \ src/backend/ConnectionManager.h \ - src/backend/StreamController.h \ + src/backend/SessionController.h \ src/backend/I2PStream.h \ src/backend/ChatmessageChanger.h \ src/backend/UserBlockManager.h \ @@ -70,8 +72,6 @@ src/backend/UserManager.h \ src/backend/FileTransferManager.h \ src/backend/TextEmotionChanger.h \ - src/backend/ChatMessageAckEntry.h \ - src/backend/CMessageAckManager.h \ src/backend/UnsentChatMessageStorage.h \ src/gui/form_Main.h \ src/gui/form_chatwidget.h \ diff -Nru i2p-messenger-0.2.24/SeedlessFallbackList.txt i2p-messenger-0.2.25/SeedlessFallbackList.txt --- i2p-messenger-0.2.24/SeedlessFallbackList.txt 1970-01-01 00:00:00.000000000 +0000 +++ i2p-messenger-0.2.25/SeedlessFallbackList.txt 2014-12-26 20:46:32.000000000 +0000 @@ -0,0 +1,10 @@ +//--------------------------------------------------------------------------- +//one line for each b32 destination,- messenger will search autom. for more +// generated 06.12.2014 +//--------------------------------------------------------------------------- +h3dxk6nrgdiwjnfwfwc6r2hrhispeacxncghotafqjudkcxawc5q.b32.i2p +vnmf4apo3mpxitki2nzqjx24cq4ykuiptpdmihgyecomcql5ttaa.b32.i2p +ixn4lvajrh2w5ppkdjhb4ibi6l52zh3taoqjrdqjl7racc2khsia.b32.i2p +ngskssigpqojp7bfbyabdzbbmiqiaz6jdakqk2zimdx7oiuu6f5a.b32.i2p +msxukjtkaoscqarobbfijwhxvkzrxddvk2ddx5mdxmu7iytk6c4q.b32.i2p +6oitbpuzljdmi45ly3cf5n6tudxmowqpkgpbalbs6tx5mcbwm2pq.b32.i2p \ No newline at end of file diff -Nru i2p-messenger-0.2.24/src/backend/ChatMessageAckEntry.cpp i2p-messenger-0.2.25/src/backend/ChatMessageAckEntry.cpp --- i2p-messenger-0.2.24/src/backend/ChatMessageAckEntry.cpp 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/backend/ChatMessageAckEntry.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,87 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2008 by I2P-Messenger * - * Messenger-Dev@I2P-Messenger * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#include "ChatMessageAckEntry.h" - - -CChatMessageAckEntry::CChatMessageAckEntry(QString ChatMessage,qint32 timeOutInSec) -:mChatMessage(ChatMessage),mTimeOutInSec(timeOutInSec) -{ - QByteArray byteTmp; - byteTmp.insert(0,ChatMessage); - - - mChatMessageHash=QCryptographicHash::hash(byteTmp,QCryptographicHash::Md5).toHex(); - - //qDebug()<<"File\t"<<__FILE__<<"\n"<<"Line:\t"<<__LINE__<<"\n"<<"calced hash:\t"<(mChatMessage); - qint32& TimeOutInSec=const_cast(mTimeOutInSec); - - ChatMessage=con.mChatMessage; - this->mChatMessageHash=con.mChatMessageHash; - TimeOutInSec=con.mTimeOutInSec; - - connect(&mTimer,SIGNAL(timeout()), - this,SLOT(slotTimeOut())); - - mTimer.start(mTimeOutInSec*1000); - mTimeDebug.start(); - return *this; -} - -QString CChatMessageAckEntry::getChatMessage() -{ - return mChatMessage; -} diff -Nru i2p-messenger-0.2.24/src/backend/ChatMessageAckEntry.h i2p-messenger-0.2.25/src/backend/ChatMessageAckEntry.h --- i2p-messenger-0.2.24/src/backend/ChatMessageAckEntry.h 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/backend/ChatMessageAckEntry.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,64 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2008 by I2P-Messenger * - * Messenger-Dev@I2P-Messenger * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - - -#ifndef CCHATMESSAGEACKENTRY_H -#define CCHATMESSAGEACKENTRY_H - -#include -#include -#include -#include -#include -#include - -class CChatMessageAckEntry :public QObject -{ -Q_OBJECT -public: - CChatMessageAckEntry(QString ChatMessage,qint32 timeOutInSec=2); - ~CChatMessageAckEntry(); - QByteArray getHash(); - QString getChatMessage(); - - bool operator ==(QByteArray& In ); - CChatMessageAckEntry& operator =(const CChatMessageAckEntry& con); - -signals: - void signAckTimeOut(QString ChatMessage,QByteArray ChatMessageHash); - -private slots: - void slotTimeOut(); - -private: - CChatMessageAckEntry(const CChatMessageAckEntry&); - CChatMessageAckEntry& operator <(const CChatMessageAckEntry&); - CChatMessageAckEntry& operator >(const CChatMessageAckEntry&); - CChatMessageAckEntry& operator >=(const CChatMessageAckEntry&); - CChatMessageAckEntry& operator <=(const CChatMessageAckEntry&); - - QTimer mTimer; - QTime mTimeDebug; - const QString mChatMessage; - const qint32 mTimeOutInSec; - QByteArray mChatMessageHash; //MD5 -}; - -#endif // CCHATMESSAGEACKENTRY_H diff -Nru i2p-messenger-0.2.24/src/backend/CMessageAckManager.cpp i2p-messenger-0.2.25/src/backend/CMessageAckManager.cpp --- i2p-messenger-0.2.24/src/backend/CMessageAckManager.cpp 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/backend/CMessageAckManager.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,128 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2008 by I2P-Messenger * - * Messenger-Dev@I2P-Messenger * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#include "CMessageAckManager.h" - -CCMessageAckManager::CCMessageAckManager(quint32 timeOutInSec) -:mTimeOutInSec(timeOutInSec) -{ - mLastNumber=0; -} - -CCMessageAckManager::~CCMessageAckManager() -{ - CChatMessageAckEntry* tmp; - QHashIterator it(mHashForAck); - while(it.hasNext()){ - it.next(); - tmp=it.value(); - disconnect(tmp,SIGNAL(signAckTimeOut(QString,QByteArray)), - this,SLOT(signAckTimeOut(QString,QByteArray))); - tmp->deleteLater(); - } - -} - -void CCMessageAckManager::doReset() -{ - mLastNumber=0; - CChatMessageAckEntry* tmp; - QHashIterator it(mHashForAck); - while(it.hasNext()){ - it.next(); - tmp=it.value(); - disconnect(tmp,SIGNAL(signAckTimeOut(QString,QByteArray)), - this,SLOT(slotChatMessageTimeOutEntry(QString,QByteArray))); - - QString Message=tr("Not possible to acknowledging this message (reason user disconnected):"); - Message+=tmp->getChatMessage(); - emit signChatMessageTimeOut(Message, true); - tmp->deleteLater(); - } -} - -QByteArray CCMessageAckManager::doCalcHash(QByteArray Data) -{ - QByteArray tmp=QCryptographicHash::hash(Data,QCryptographicHash::Md5).toHex(); - - //qDebug()<<"File\t"<<__FILE__<<"\n"<<"Line:\t"<<__LINE__<<"\n"<<"calced hash:\t"<getHash(); - mHashForAck.insert(tmp->getHash(),tmp); - return ChatMessage; -} - -void CCMessageAckManager::inputNewAckMessage(QByteArray Data) -{ - CChatMessageAckEntry* tmp=mHashForAck.take(Data); - if(tmp!=NULL){ - disconnect(tmp,SIGNAL(signAckTimeOut(QString,QByteArray)), - this,SLOT(slotChatMessageTimeOutEntry(QString,QByteArray))); - tmp->deleteLater(); - }else{ -// qDebug()<<"File\t"<<__FILE__<<"\n"<<"Line:\t"<<__LINE__<<"\n"<<"no message with this hash found \?\n" -// <<"hash recived:\t"<deleteLater(); - }else{ - qWarning()<<"File\t"<<__FILE__< -#include -#include -#include -#include -#include -#include - -#include "ChatMessageAckEntry.h" - -class CCMessageAckManager : public QObject -{ - Q_OBJECT -public: - CCMessageAckManager(quint32 timeOutInSec); - ~CCMessageAckManager(); - - void doReset(); - QByteArray doCalcHash(QByteArray Data); - - QByteArray inputNewChatMessage(QByteArray ChatMessage); //return number\tChatmessage (number=4Byte hex) - void inputNewAckMessage(QByteArray Data); - -signals: - void signChatMessageTimeOut(QString ChatMessage,bool b); - -private slots: - void slotChatMessageTimeOutEntry(QString ChatMessage,QByteArray ChatMessageHash); - -private: - quint32 getNextNumber(); - - - CCMessageAckManager(const CCMessageAckManager&); - CCMessageAckManager& operator=(const CCMessageAckManager&); - QHash mHashForAck; - - const quint32 mTimeOutInSec; - quint32 mLastNumber; - -}; - -#endif // CMESSAGEACKMANAGER_H diff -Nru i2p-messenger-0.2.24/src/backend/ConnectionManager.cpp i2p-messenger-0.2.25/src/backend/ConnectionManager.cpp --- i2p-messenger-0.2.24/src/backend/ConnectionManager.cpp 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/backend/ConnectionManager.cpp 2014-12-26 20:46:32.000000000 +0000 @@ -20,8 +20,8 @@ #include "ConnectionManager.h" -CConnectionManager::CConnectionManager(QString SamHost,QString SamPort) -:mSamHost(SamHost),mSamPort(SamPort) +CConnectionManager::CConnectionManager(QString SamHost,QString SamPort,QString ConfigPath) +:mSamHost(SamHost),mSamPort(SamPort),mConfigPath(ConfigPath) { mComponentStateStopped=false; StreamController=NULL; @@ -39,12 +39,13 @@ QString BridgeName=generateBridgeName(); if(SessionStyle==STREAM &&StreamController==NULL){ - this->StreamController=new CStreamController( mSamHost, + this->StreamController=new CSessionController( mSamHost, mSamPort, BridgeName, SamPrivKey, + mConfigPath, SessionOptions - ); + ); connect(StreamController,SIGNAL(signDebugMessages(const QString)),this, SIGNAL(signDebugMessages(const QString))); @@ -97,7 +98,7 @@ emit signStreamControllerStatusOK(Status); } -qint32 CConnectionManager::nextFreePosID() +qint32 CConnectionManager::nextFreePosID() const { qint32 nextNumber=1; @@ -112,7 +113,7 @@ return nextNumber; } -qint32 CConnectionManager::nextFreeNegID() +qint32 CConnectionManager::nextFreeNegID() const { qint32 nextNumber=-1; @@ -150,7 +151,7 @@ return true; } -const CI2PStream *CConnectionManager::doCreateNewStreamObject(StreamMode Mode,bool Silence,bool dontConnectSendStreamStatus) +CI2PStream *CConnectionManager::doCreateNewStreamObject(StreamMode Mode,bool Silence,bool dontConnectSendStreamStatus) { QString Message; @@ -195,7 +196,7 @@ } } -const CI2PStream * CConnectionManager::getStreamObjectByID(qint32 ID) +CI2PStream * CConnectionManager::getStreamObjectByID(qint32 ID) const { if(allStreams.contains(ID)==false){ return NULL; @@ -205,7 +206,7 @@ } } -QString CConnectionManager::getStreamControllerBridgeName() +QString CConnectionManager::getStreamControllerBridgeName() const { if(StreamController!=NULL){ return StreamController->getBridgeName(); @@ -213,7 +214,7 @@ return 0; } -const CI2PStream * CConnectionManager::getStreamObjectByDestination(QString Destination) +CI2PStream * CConnectionManager::getStreamObjectByDestination(QString Destination) const { QMapIterator i(allStreams); while (i.hasNext()) { @@ -238,7 +239,6 @@ allStreams.insert(ID,t); //---------------------------------------------------- - //create new StreamIncomingListener CI2PStream* t2= new CI2PStream(mSamHost,mSamPort,nextFreeNegID(),StreamController->getBridgeName(),ACCEPT,false); t2->setUsedFor("Incoming StreamListener"); @@ -268,17 +268,8 @@ stopp(); } -const QMap< qint32, CI2PStream * >* CConnectionManager::getAllStreamObjects() -{ - return &allStreams; -} -const QMap* CConnectionManager::getAllStreamIncomingListenerObjects() -{ - return &StreamIncomingListener; -} - -QString CConnectionManager::getSamPrivKey() +QString CConnectionManager::getSamPrivKey() const { if(StreamController!=NULL){ return StreamController->getSamPrivKey(); @@ -288,19 +279,19 @@ } } -QString CConnectionManager::generateBridgeName() +QString CConnectionManager::generateBridgeName() const { QString Name; int length=0; - srand ( time(NULL) ); + qsrand ( QTime::currentTime().msec() ); while(length<3){ length=rand()% 9; } for(int i=0;i"); } -bool CConnectionManager::isComponentStopped()const -{ - return mComponentStateStopped; -} void CConnectionManager::stopp() { diff -Nru i2p-messenger-0.2.24/src/backend/ConnectionManager.h i2p-messenger-0.2.25/src/backend/ConnectionManager.h --- i2p-messenger-0.2.24/src/backend/ConnectionManager.h 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/backend/ConnectionManager.h 2014-12-26 20:46:32.000000000 +0000 @@ -21,11 +21,11 @@ #ifndef CONNECTIONMANAGER_H #define CONNECTIONMANAGER_H -#include "StreamController.h" +#include "SessionController.h" #include "I2PStream.h" #include #include - +#include namespace SESSION_ENUMS { @@ -41,7 +41,7 @@ { Q_OBJECT public: - CConnectionManager(QString SamHost,QString SamPort); + CConnectionManager(QString SamHost,QString SamPort,QString ConfigPath); ~CConnectionManager(); bool doCreateSession( @@ -53,16 +53,21 @@ void doReStart(); void doNamingLookUP(QString Name); bool doDestroyStreamObjectByID(qint32 ID); - const CI2PStream* doCreateNewStreamObject(StreamMode Mode,bool Silence=false,bool dontConnectSendStreamStatus=false); + CI2PStream* doCreateNewStreamObject(StreamMode Mode,bool Silence=false,bool dontConnectSendStreamStatus=false); - bool isComponentStopped()const; + bool isComponentStopped()const + {return mComponentStateStopped;} - QString getStreamControllerBridgeName(); - QString getSamPrivKey(); - const CI2PStream* getStreamObjectByID(qint32 ID); - const CI2PStream* getStreamObjectByDestination(QString Destination); - const QMap* getAllStreamObjects(); - const QMap* getAllStreamIncomingListenerObjects(); + QString getStreamControllerBridgeName() const; + QString getSamPrivKey() const; + CI2PStream* getStreamObjectByID(qint32 ID) const; + CI2PStream* getStreamObjectByDestination(QString Destination) const; + + const QMap* getAllStreamObjects() const + {return &allStreams;} + + const QMap* getAllStreamIncomingListenerObjects()const + {return &StreamIncomingListener;} public slots: void slotSessionStreamStatusOK(bool Status); @@ -79,19 +84,20 @@ void signNewSamPrivKeyGenerated(const QString SamPrivKey); private: - qint32 nextFreePosID (); - qint32 nextFreeNegID (); - QString generateBridgeName(); + qint32 nextFreePosID () const; + qint32 nextFreeNegID () const; + QString generateBridgeName() const; void stopp(); QMap StreamIncomingListener; - CStreamController* StreamController; + CSessionController* StreamController; bool mSessionStreamStatusOK; bool mComponentStateStopped; const QString mSamHost; const QString mSamPort; + const QString mConfigPath; inline void SessionStreamStatusOKCheck(){ if(mSessionStreamStatusOK==false)return; diff -Nru i2p-messenger-0.2.24/src/backend/Core.cpp i2p-messenger-0.2.25/src/backend/Core.cpp --- i2p-messenger-0.2.24/src/backend/Core.cpp 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/backend/Core.cpp 2014-12-26 20:46:32.000000000 +0000 @@ -51,8 +51,8 @@ mConnectionManager=new CConnectionManager( settings.value("SamHost","127.0.0.1").toString(), - settings.value("SamPort","7656").toString() - ); + settings.value("SamPort","7656").toString(), + mConfigPath); connect (mConnectionManager,SIGNAL(signNamingReplyRecived(const SAM_Message_Types::RESULT, QString, QString, QString)),this, SLOT(slotNamingReplyRecived(const SAM_Message_Types::RESULT, QString, QString, QString)),Qt::DirectConnection); @@ -150,6 +150,38 @@ mConnectionManager->doNamingLookUP(Name); } +QString CCore::calcSessionOptionString() const +{ + QString SessionOptionString=""; + QString Signature_Type=""; + + QSettings settings(mConfigPath+"/application.ini",QSettings::IniFormat); + + settings.beginGroup("Network"); + SessionOptionString.append("inbound.nickname="+settings.value("TunnelName","I2P-Messenger").toString()+" "); + ///FIXME TunnelName no whitespace allowed... + + //inbound options + SessionOptionString.append("inbound.quantity="+settings.value("inbound.quantity","1").toString()+ " "); + SessionOptionString.append("inbound.backupQuantity="+settings.value("inbound.backupQuantity","1").toString()+ " "); + SessionOptionString.append("inbound.length="+settings.value("inbound.length","3").toString()+ " "); + + //outbound options + SessionOptionString.append("outbound.quantity="+settings.value("outbound.quantity","1").toString()+ " "); + SessionOptionString.append("outbound.backupQuantity="+settings.value("outbound.backupQuantity","1").toString()+ " "); + SessionOptionString.append("outbound.length="+settings.value("outbound.length","3").toString()+ " "); + + //SIGNATURE_TYPE + SessionOptionString.append("SIGNATURE_TYPE="+settings.value("Signature_Type","DSA_SHA1").toString()+ " "); + ///TODO check for valid string match DSA_SHA1 || ECDSA_SHA256_P256 ... + ///TODO which Signature_Type as default for best security ??? + + settings.remove("SessionOptionString");//no longer used,- so erase it + settings.endGroup(); + + return SessionOptionString; +} + void CCore::init(){ using namespace SESSION_ENUMS; @@ -168,7 +200,7 @@ mConnectionManager->doCreateSession( STREAM, SamPrivKey, - settings.value("SessionOptionString","inbound.nickname=I2P-Messenger inbound.quantity=1 inbound.backupQuantity=1 inbound.length=3 outbound.quantity=1 outbound.backupQuantity=1 outbound.length=3").toString()); + calcSessionOptionString()); settings.endGroup(); @@ -176,7 +208,7 @@ void CCore::slotStreamStatusRecived(const SAM_Message_Types::RESULT result,const qint32 ID,QString Message){ - CI2PStream* stream=(CI2PStream*)mConnectionManager->getStreamObjectByID(ID); + CI2PStream* stream=mConnectionManager->getStreamObjectByID(ID); CUser* user=NULL; QString Destination; @@ -571,7 +603,7 @@ this->init(); } -QString CCore::getDestinationByID(qint32 ID) +QString CCore::getDestinationByID(qint32 ID) const { CUser* user=mUserManager->getUserByI2P_ID(ID); if(user!=NULL){ @@ -619,7 +651,7 @@ void CCore::setStreamTypeToKnown(qint32 ID,const QByteArray Data,bool isFileTransfer_Recive) { - CI2PStream* t=(CI2PStream*)mConnectionManager->getStreamObjectByID(ID); + CI2PStream* t=mConnectionManager->getStreamObjectByID(ID); t->setConnectionType(KNOWN); disconnect(t,SIGNAL(signDataRecived(const qint32, const QByteArray)),mProtocol, SLOT(slotInputUnknown(const qint32, const QByteArray))); @@ -646,7 +678,7 @@ } -const CI2PStream * CCore::getI2PStreamObjectByID(qint32 ID)const +CI2PStream * CCore::getI2PStreamObjectByID(qint32 ID)const { return mConnectionManager->getStreamObjectByID(ID); } @@ -674,7 +706,7 @@ msec=settings->value("Waittime_between_rechecking_offline_mUsers","30000").toInt(); settings->endGroup(); - CI2PStream* t =(CI2PStream*)mConnectionManager->doCreateNewStreamObject(CONNECT); + CI2PStream* t =mConnectionManager->doCreateNewStreamObject(CONNECT); connect(t,SIGNAL(signStreamStatusRecived(const SAM_Message_Types::RESULT, const qint32, const QString)),this, SLOT(slotStreamStatusRecived(const SAM_Message_Types::RESULT, const qint32, QString))); @@ -726,23 +758,53 @@ void CCore::loadUserInfos() { - QSettings settings(mConfigPath+"/application.ini",QSettings::IniFormat); - settings.beginGroup("User-Infos"); - mUserInfos.Nickname= settings.value("Nickname","").toString(); - mUserInfos.Age= settings.value("Age","0").toInt(); - mUserInfos.Interests= settings.value("Interests","").toString(); - - if(settings.value("Gender","").toString()=="Male"){ - mUserInfos.Gender="Male"; - } - else if(settings.value("Gender","").toString()=="Female"){ - mUserInfos.Gender="Female"; - } - if(mUserInfos.AvatarImage!=settings.value("AvatarBinaryImage","").toByteArray()){ - mUserInfos.AvatarImage=settings.value("AvatarBinaryImage","").toByteArray(); - emit signOwnAvatarImageChanged(); - } - settings.endGroup(); + QSettings settings(mConfigPath+"/application.ini",QSettings::IniFormat); + settings.beginGroup("User-Infos"); + if(mUserInfos.Nickname!=settings.value("Nickname","").toString()){ + mUserInfos.Nickname=settings.value("Nickname","").toString(); + emit signNicknameChanged(); + } + + if(mUserInfos.Nickname.isEmpty()==true){ + //generate random Nickname (8 Chars) + const QString possibleCharacters("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"); + const int randomStringLength = 8; + + QString randomString; + for(int i=0; isetIcon(QMessageBox::Information); + msgBox->setInformativeText(tr("No username...\ngenerating one: %1\n\nplease change your userprofile in the settings").arg(randomString)); + msgBox->setStandardButtons(QMessageBox::Ok); + msgBox->setDefaultButton(QMessageBox::Ok); + msgBox->setWindowModality(Qt::NonModal); + msgBox->show(); + } + + mUserInfos.Age= settings.value("Age","0").toInt(); + mUserInfos.Interests= settings.value("Interests","").toString(); + + if(settings.value("Gender","").toString()=="Male"){ + mUserInfos.Gender="Male"; + } + else if(settings.value("Gender","").toString()=="Female"){ + mUserInfos.Gender="Female"; + } + if(mUserInfos.AvatarImage!=settings.value("AvatarBinaryImage","").toByteArray()){ + mUserInfos.AvatarImage=settings.value("AvatarBinaryImage","").toByteArray(); + emit signOwnAvatarImageChanged(); + } + settings.endGroup(); } const CRecivedInfos CCore::getUserInfos() const diff -Nru i2p-messenger-0.2.24/src/backend/Core.h i2p-messenger-0.2.25/src/backend/Core.h --- i2p-messenger-0.2.24/src/backend/Core.h 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/backend/Core.h 2014-12-26 20:46:32.000000000 +0000 @@ -36,7 +36,7 @@ #include "FileTransferManager.h" #include "UnsentChatMessageStorage.h" -#define CLIENTVERSION "0.2.24" +#define CLIENTVERSION "0.2.25" #define CLIENTNAME "I2P-Messenger (QT)" using namespace SAM_Message_Types; @@ -54,14 +54,14 @@ CCore(); ~CCore(); - QString getDestinationByID(qint32 ID); + QString getDestinationByID(qint32 ID) const; const QString getMyDestination() const; const QString getMyDestinationB32() const; ONLINESTATE getOnlineStatus() const; QString getClientName() const {return CLIENTNAME;}; QString getClientVersion() const {return CLIENTVERSION;}; QString getProtocolVersion() const {return mProtocol->getProtocolVersion();}; - const CI2PStream* getI2PStreamObjectByID(qint32 ID)const; + CI2PStream* getI2PStreamObjectByID(qint32 ID)const; const CRecivedInfos getUserInfos() const; QString getConnectionDump() const; const QString getConfigPath() const {return mConfigPath;}; @@ -73,7 +73,7 @@ CUserBlockManager* getUserBlockManager() const {return mUserBlockManager;}; CProtocol* getProtocol() const {return mProtocol;}; CSeedlessManager* getSeedlessManager() const {return mSeedlessManager;}; - CSoundManager* getSoundManager() {return mSoundManager;}; + CSoundManager* getSoundManager() const {return mSoundManager;}; CUserManager* getUserManager() const {return mUserManager;}; CFileTransferManager* getFileTransferManager() const {return mFileTransferManager;}; // @@ -92,6 +92,7 @@ void createStreamObjectsForAllUsers(); void createStreamObjectForUser(CUser& User); void loadUserInfos(); + QString calcSessionOptionString()const; private slots: // @@ -105,6 +106,7 @@ void signUserStatusChanged(); void signOnlineStatusChanged(); void signOwnAvatarImageChanged(); + void signNicknameChanged(); private: CConnectionManager* mConnectionManager; diff -Nru i2p-messenger-0.2.24/src/backend/DebugMessageManager.cpp i2p-messenger-0.2.25/src/backend/DebugMessageManager.cpp --- i2p-messenger-0.2.24/src/backend/DebugMessageManager.cpp 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/backend/DebugMessageManager.cpp 2014-12-26 20:46:32.000000000 +0000 @@ -41,10 +41,6 @@ mMessages.clear(); } -const QStringList CDebugMessageManager::getAllMessages() -{ - return mMessages; -} void CDebugMessageManager::slotNewIncomingDebugMessage(const QString Message){ while(mMessages.count()>= (signed int)mMaxMessageCount){ diff -Nru i2p-messenger-0.2.24/src/backend/DebugMessageManager.h i2p-messenger-0.2.25/src/backend/DebugMessageManager.h --- i2p-messenger-0.2.24/src/backend/DebugMessageManager.h 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/backend/DebugMessageManager.h 2014-12-26 20:46:32.000000000 +0000 @@ -36,7 +36,7 @@ public slots: void doClearAllMessages(); - const QStringList getAllMessages(); + const QStringList getAllMessages() const {return mMessages;} private slots: void slotNewIncomingDebugMessage(const QString Message); diff -Nru i2p-messenger-0.2.24/src/backend/FileTransferManager.cpp i2p-messenger-0.2.25/src/backend/FileTransferManager.cpp --- i2p-messenger-0.2.24/src/backend/FileTransferManager.cpp 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/backend/FileTransferManager.cpp 2014-12-26 20:46:32.000000000 +0000 @@ -86,7 +86,7 @@ void CFileTransferManager::addNewFileRecive(qint32 ID, QString FileName, QString FileSize,QString Destination,QString ProtocolVersion) { - CI2PStream* Stream=(CI2PStream*)mCore.getConnectionManager()->getStreamObjectByID(ID); + CI2PStream* Stream=mCore.getConnectionManager()->getStreamObjectByID(ID); FileName=FilterForFileName(FileName); double ProtocolVersionD; @@ -177,7 +177,7 @@ } -bool CFileTransferManager::isThisID_a_FileSendID(qint32 ID) +bool CFileTransferManager::isThisID_a_FileSendID(qint32 ID) const { for(int i=0;igetStreamID()==ID){ @@ -187,7 +187,7 @@ return false; } -bool CFileTransferManager::isThisID_a_FileReciveID(qint32 ID) +bool CFileTransferManager::isThisID_a_FileReciveID(qint32 ID) const { for(int i=0;igetStreamID()==ID){ @@ -197,7 +197,7 @@ return false; } -bool CFileTransferManager::checkIfAFileTransferOrReciveisActive()const +bool CFileTransferManager::checkIfAFileTransferOrReciveisActive() const { if(mFileSends.count()>0) return true; if(mFileRecives.count()>0) return true; @@ -235,7 +235,7 @@ } } -const QString CFileTransferManager::FilterForFileName(QString FileName) +const QString CFileTransferManager::FilterForFileName(QString FileName)const { FileName.replace("\\",""); FileName.replace("/",""); diff -Nru i2p-messenger-0.2.24/src/backend/FileTransferManager.h i2p-messenger-0.2.25/src/backend/FileTransferManager.h --- i2p-messenger-0.2.24/src/backend/FileTransferManager.h 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/backend/FileTransferManager.h 2014-12-26 20:46:32.000000000 +0000 @@ -40,13 +40,13 @@ void removeFileTransfer(const qint32 ID); void removeFileRecive (const qint32 ID); - CFileTransferRecive* getFileTransferReciveByID(qint32 ID)const; - CFileTransferSend* getFileTransferSendsByID(qint32 ID)const; - const QList getFileTransferReciveList()const; - const QList getFileTransferSendsList()const; + CFileTransferRecive* getFileTransferReciveByID(qint32 ID) const; + CFileTransferSend* getFileTransferSendsByID(qint32 ID) const; + const QList getFileTransferReciveList() const; + const QList getFileTransferSendsList() const; - bool isThisID_a_FileSendID(qint32 ID); - bool isThisID_a_FileReciveID(qint32 ID); + bool isThisID_a_FileSendID(qint32 ID) const; + bool isThisID_a_FileReciveID(qint32 ID) const; bool checkIfAFileTransferOrReciveisActive()const; @@ -58,7 +58,7 @@ QList mFileSends; QList mFileRecives; - const QString FilterForFileName(QString FileName); + const QString FilterForFileName(QString FileName) const; }; #endif // FILETRANSFERMANAGER_H diff -Nru i2p-messenger-0.2.24/src/backend/FileTransferRecive.cpp i2p-messenger-0.2.25/src/backend/FileTransferRecive.cpp --- i2p-messenger-0.2.24/src/backend/FileTransferRecive.cpp 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/backend/FileTransferRecive.cpp 2014-12-26 20:46:32.000000000 +0000 @@ -35,7 +35,7 @@ mConnectionManager=mCore.getConnectionManager(); QSettings settings(mCore.getConfigPath()+"/application.ini",QSettings::IniFormat); - bool AutoAcceptFileRecive=false; + bool AutoAcceptFileRecive; QString AutoAcceptedFilePath; mStream.setUsedFor("FileTransferRecive"); @@ -358,11 +358,8 @@ void CFileTransferRecive::CalcETA(int speed) { QString EmitString; - int hours=0; - int minutes=0; - int secs=0; - int secLeft; + if(speed>0){ secLeft=(mFileSize-mAllreadyRecivedSize) / speed ; } @@ -374,6 +371,9 @@ //> 24h emit signETA(tr("never or (>24 h)")); }else{ + int hours=0; + int minutes=0; + int secs=0; if(secLeft>=3600){ //hours diff -Nru i2p-messenger-0.2.24/src/backend/FileTransferSend.cpp i2p-messenger-0.2.25/src/backend/FileTransferSend.cpp --- i2p-messenger-0.2.24/src/backend/FileTransferSend.cpp 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/backend/FileTransferSend.cpp 2014-12-26 20:46:32.000000000 +0000 @@ -32,7 +32,7 @@ { - mStream=(CI2PStream*)ConnectionManager.doCreateNewStreamObject(CONNECT,false); + mStream=ConnectionManager.doCreateNewStreamObject(CONNECT,false); mStream->setUsedFor("FileTransferSend"); connect(mStream,SIGNAL(signStreamStatusRecived(const SAM_Message_Types::RESULT, const qint32, const QString)), @@ -365,11 +365,8 @@ void CFileTransferSend::CalcETA(int speed) { QString EmitString; - int hours=0; - int minutes=0; - int secs=0; - int secLeft; + if(speed>0){ if(mUsingProtocolVersionD<=0.2){ secLeft=(mFileSize-mAllreadySendedSize) / speed ; @@ -383,14 +380,16 @@ else{ secLeft =mFileSize-mRemoteRecivedSize; } - } - + } if(secLeft> 86400){ //> 24h emit signETA(tr("never or (>24 h)")); }else{ - + int hours=0; + int minutes=0; + int secs=0; + if(secLeft>=3600){ //hours hours=secLeft/3600; diff -Nru i2p-messenger-0.2.24/src/backend/HttpOverStreamObject.cpp i2p-messenger-0.2.25/src/backend/HttpOverStreamObject.cpp --- i2p-messenger-0.2.24/src/backend/HttpOverStreamObject.cpp 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/backend/HttpOverStreamObject.cpp 2014-12-26 20:46:32.000000000 +0000 @@ -23,7 +23,10 @@ CHttpOverStreamObject::CHttpOverStreamObject(CConnectionManager& ConnectionManager) :mConnectionManager(ConnectionManager) { - mStream=NULL; + mStream=NULL; + mFirstStreamStatus=true; + mIsTimeOutCantReachPeerCLosed=false; + mMode=HTTPMODE::GET; } CHttpOverStreamObject::~ CHttpOverStreamObject() @@ -40,6 +43,7 @@ qCritical() <<"File\t"<<__FILE__<setUsedFor("HttpOverStreamObject"); mStreamID=mStream->getID(); diff -Nru i2p-messenger-0.2.24/src/backend/I2PSamMessageAnalyser.cpp i2p-messenger-0.2.25/src/backend/I2PSamMessageAnalyser.cpp --- i2p-messenger-0.2.24/src/backend/I2PSamMessageAnalyser.cpp 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/backend/I2PSamMessageAnalyser.cpp 2014-12-26 20:46:32.000000000 +0000 @@ -19,12 +19,15 @@ ***************************************************************************/ #include "I2PSamMessageAnalyser.h" -CI2PSamMessageAnalyser::CI2PSamMessageAnalyser() +CI2PSamMessageAnalyser::CI2PSamMessageAnalyser(const QString debugFrom) +:mDebugFrom(debugFrom) { //Constructor } -const SAM_MESSAGE CI2PSamMessageAnalyser::Analyse(QString Message) + + +const SAM_MESSAGE CI2PSamMessageAnalyser::Analyse(QString Message) const { using namespace SAM_Message_Types; @@ -41,10 +44,7 @@ else if(list[2].contains("RESULT=I2P_ERROR")==true)t.result=I2P_ERROR; //Get Message - if(Message.contains("MESSAGE=",Qt::CaseInsensitive)){ - t.Message=Message.mid(Message.indexOf("MESSAGE=")+8); - t.Message.remove("\n"); - } + t.Message=getValue(Message,"Message"); } else if((list[0].contains("SESSION")==true) && (list[1].contains("STATUS")==true)){ t.type=SESSION_STATUS; @@ -55,17 +55,12 @@ else if(list[2].contains("RESULT=DUPLICATED_DEST",Qt::CaseInsensitive))t.result=DUPLICATED_DEST; else if(list[2].contains("RESULT=I2P_ERROR",Qt::CaseInsensitive))t.result=I2P_ERROR; else if(list[2].contains("RESULT=INVALID_KEY",Qt::CaseInsensitive))t.result=INVALID_KEY; - else if(list[2].contains("RESULT=I2P_ERROR",Qt::CaseInsensitive)){ - t.result=I2P_ERROR; - //Get Message - if(Message.contains("MESSAGE=",Qt::CaseInsensitive)){ - t.Message=Message.mid(Message.indexOf("MESSAGE=")+8); - t.Message.remove("\n"); - } - } else{ t.type=ERROR_IN_ANALYSE; } + //Get Message + t.Message=getValue(Message,"Message"); + } else if((list[0].contains("STREAM")==true) && (list[1].contains("STATUS")==true)){ t.type=STREAM_STATUS; @@ -78,20 +73,12 @@ else if(list[2].contains("RESULT=INVALID_ID",Qt::CaseInsensitive))t.result=INVALID_ID; else if(list[2].contains("RESULT=TIMEOUT",Qt::CaseInsensitive))t.result=TIMEOUT; else if(list[2].contains("RESULT=ALREADY_ACCEPTING",Qt::CaseInsensitive))t.result=ALREADY_ACCEPTING; - else - { + else{ t.type=ERROR_IN_ANALYSE; - return t; } - //---------------- //Get Message - if(Message.contains("MESSAGE=",Qt::CaseInsensitive)){ - t.Message=Message.mid(Message.indexOf("MESSAGE=")+8); - t.Message.remove("\n"); - } - //---------------- - + t.Message=getValue(Message,"Message"); } else if((list[0].contains("NAMING")==true) && (list[1].contains("REPLY")==true)){ t.type=NAMING_REPLY; @@ -104,42 +91,19 @@ t.type=ERROR_IN_ANALYSE; return t; } - //get Name - QStringList temp=list[3].split("="); - t.Name=temp[1].remove("\n"); - - //get Value - if(list.count()-1>=4){ - QStringList temp=list[4].split("="); - t.Value=temp[1].remove("\n"); - } - //Get Message - if(Message.contains("MESSAGE=",Qt::CaseInsensitive)){ - t.Message=Message.mid(Message.indexOf("MESSAGE=")+8); - t.Message.remove("\n"); - } + t.Name=getValue(Message,"NAME"); + t.Value=getValue(Message,"VALUE"); + t.Message=getValue(Message,"MESSAGE"); } else if((list[0].contains("DEST")==true) && (list[1].contains("REPLY")==true)){ t.type=DEST_REPLY; //get the Keys - if(list[2].contains("PUB=",Qt::CaseInsensitive)==true){ - QStringList temp=list[2].split("="); - t.PUB=temp[1].remove("\n"); - - //must be PrivKey - temp=list[3].split("="); - t.PRIV=temp[1].remove("\n"); - } - else{ - QStringList temp=list[2].split("="); - t.PRIV=temp[1].remove("\n"); - - //must be PubKey - temp=list[3].split("="); - t.PUB=temp[1].remove("\n"); - - } + t.PUB=getValue(Message,"PUB"); + t.PRIV=getValue(Message,"PRIV"); + + //Get Message + t.Message=getValue(Message,"Message"); } else{ t.type=ERROR_IN_ANALYSE; @@ -148,32 +112,30 @@ return t; } -qint32 CI2PSamMessageAnalyser::QStringToQint32(QString value) + +CI2PSamMessageAnalyser::~ CI2PSamMessageAnalyser() { - bool OK=false; - qint32 iValue =value.toInt ( &OK,10 ); - if(OK==false) - { - qCritical()<<"File\t"<<__FILE__<setIcon(QMessageBox::Warning); - msgBox->setText("I2PSamMessageAnalyser"); - msgBox->setInformativeText("cant parse value: "+value ); - msgBox->setStandardButtons(QMessageBox::Ok); - msgBox->setDefaultButton(QMessageBox::Ok); - msgBox->setWindowModality(Qt::NonModal); - msgBox->show(); - } - return iValue; } -CI2PSamMessageAnalyser::~ CI2PSamMessageAnalyser() +QString CI2PSamMessageAnalyser::getValue(const QString& answer, const QString& key) const { + if (key.isEmpty()){ + return ""; + } -} + const QString keyPattern = key + "="; + size_t valueStart = answer.indexOf(keyPattern); + if (valueStart ==(size_t)-1){ + return ""; + } + + valueStart += keyPattern.length(); + size_t valueEnd = answer.indexOf(' ', valueStart); + + if (valueEnd ==(size_t)-1){ + valueEnd = answer.indexOf('\n', valueStart); + } + + return answer.mid(valueStart, valueEnd - valueStart); +} \ No newline at end of file diff -Nru i2p-messenger-0.2.24/src/backend/I2PSamMessageAnalyser.h i2p-messenger-0.2.25/src/backend/I2PSamMessageAnalyser.h --- i2p-messenger-0.2.24/src/backend/I2PSamMessageAnalyser.h 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/backend/I2PSamMessageAnalyser.h 2014-12-26 20:46:32.000000000 +0000 @@ -32,7 +32,6 @@ STREAM_STATUS, NAMING_REPLY, DEST_REPLY, - ERROR_IN_ANALYSE }; @@ -74,11 +73,14 @@ { Q_OBJECT public: - CI2PSamMessageAnalyser(); + CI2PSamMessageAnalyser(const QString debugFrom="not set"); ~CI2PSamMessageAnalyser(); - const SAM_MESSAGE Analyse(QString Message); + const SAM_MESSAGE Analyse(QString Message) const; private: - qint32 QStringToQint32(QString value); + const QString mDebugFrom; + + + QString getValue(const QString& answer, const QString& key) const; }; #endif diff -Nru i2p-messenger-0.2.24/src/backend/I2PStream.cpp i2p-messenger-0.2.25/src/backend/I2PStream.cpp --- i2p-messenger-0.2.24/src/backend/I2PStream.cpp 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/backend/I2PStream.cpp 2014-12-26 20:46:32.000000000 +0000 @@ -19,8 +19,8 @@ ***************************************************************************/ #include "I2PStream.h" -#define SAM_HANDSHAKE_V3 "HELLO VERSION MIN=3.0 MAX=3.0\n" -#define CONNECTIONTIMEOUT 60000 +const QString SAM_HANDSHAKE_V3="HELLO VERSION MIN=3.1 MAX=3.1\n"; +const int CONNECTIONTIMEOUT=60000; CI2PStream::CI2PStream(QString mSamHost,QString mSamPort,qint32 mID,QString mStreamBridgeName,StreamMode mMode,bool mSilence,QString UsedFor) :mSamHost(mSamHost),mSamPort(mSamPort),mID(mID),mStreamBridgeName(mStreamBridgeName),mMode(mMode),mSilence(mSilence),mUsedFor(UsedFor) @@ -112,7 +112,7 @@ emit signDebugMessages("\n"+SAM_HANDSHAKE_V3); try{ if(mTcpSocket.isWritable()){ - mTcpSocket.write(SAM_HANDSHAKE_V3); + mTcpSocket.write(SAM_HANDSHAKE_V3.toUtf8()); //mTcpSocket.flush(); } }catch(...){} @@ -162,7 +162,7 @@ CurrentPacket=mIncomingPackets->left(mIncomingPackets->indexOf("\n",0)+1); - mAnalyser= new CI2PSamMessageAnalyser(); + mAnalyser= new CI2PSamMessageAnalyser("CI2PStream"); QString t(CurrentPacket.data()); SAM_MESSAGE sam=mAnalyser->Analyse(t); @@ -205,7 +205,7 @@ //Get Stream Status - mAnalyser= new CI2PSamMessageAnalyser(); + mAnalyser= new CI2PSamMessageAnalyser("CI2PStream"); QString t(CurrentPacket.data()); @@ -270,16 +270,6 @@ mTcpSocket.disconnectFromHost(); } -QString CI2PStream::getDestination() -{ - return mDestination; -} - -qint32 CI2PStream::getID() -{ - return mID; -} - void CI2PStream::operator <<(const QByteArray Data) { QString smID=QString::number(mID,10); @@ -309,18 +299,6 @@ *(this)<show(); - return app.exec(); + app.exec(); app.closeAllWindows(); return 0; diff -Nru i2p-messenger-0.2.24/src/backend/PacketManager.cpp i2p-messenger-0.2.25/src/backend/PacketManager.cpp --- i2p-messenger-0.2.24/src/backend/PacketManager.cpp 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/backend/PacketManager.cpp 2014-12-26 20:46:32.000000000 +0000 @@ -40,21 +40,16 @@ } -void CPacketManager::operator << ( QByteArray t ) +void CPacketManager::operator << (const QByteArray t ) { if(mData!=NULL){ mData->append ( t ); checkifOnePacketIsCompleate(); } } -qint32 CPacketManager::getID() -{ - return mID; -} void CPacketManager::checkifOnePacketIsCompleate() -{ - +{ if(mData==NULL){ return; } @@ -75,7 +70,7 @@ <<"StreamID: "<doDisconnect(); } diff -Nru i2p-messenger-0.2.24/src/backend/PacketManager.h i2p-messenger-0.2.25/src/backend/PacketManager.h --- i2p-messenger-0.2.24/src/backend/PacketManager.h 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/backend/PacketManager.h 2014-12-26 20:46:32.000000000 +0000 @@ -31,9 +31,9 @@ public: CPacketManager (CConnectionManager& ConnectionManager,qint32 ID ); ~CPacketManager(); - void operator << ( QByteArray t ); - qint32 getID(); - void checkifOnePacketIsCompleate(); + void operator << (const QByteArray t ); + qint32 getID()const {return mID;} + public slots: void slotDataInput( qint32 ID,QByteArray t); @@ -43,7 +43,8 @@ CConnectionManager& mConnectionManager; const qint32 mID; QByteArray* mData; - bool isDeleted; + + void checkifOnePacketIsCompleate(); }; diff -Nru i2p-messenger-0.2.24/src/backend/Protocol.cpp i2p-messenger-0.2.25/src/backend/Protocol.cpp --- i2p-messenger-0.2.24/src/backend/Protocol.cpp 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/backend/Protocol.cpp 2014-12-26 20:46:32.000000000 +0000 @@ -36,7 +36,7 @@ void CProtocol::newConnectionChat(const qint32 ID){ using namespace Protocol_Info; - CI2PStream* stream= (CI2PStream*)mCore.getI2PStreamObjectByID(ID); + CI2PStream* stream=mCore.getI2PStreamObjectByID(ID); //send the ChatSystem\tProtocolVersion if(stream->getFIRSTPAKETCHAT_allreadySended()==false){ @@ -289,20 +289,6 @@ else if(ProtocolInfoTag=="0019"){//AVATARIMAGE_CHANGED send(GET_AVATARIMAGE,ID); } -// else if(ProtocolInfoTag=="0020"){//CHATMESSAGE_WITH_ACK -// CUser* thisUser=mCore.getUserManager()->getUserByI2P_ID(ID); -// if(thisUser!=NULL){ -// QByteArray tmp=Data.mid(4);//remove ProtocolInfoTag -// thisUser->slotIncomingNewChatMessageForACK(tmp); -// } -// } -// else if(ProtocolInfoTag=="0021"){//ANSWER_OF_CHATMESSAGE_ACK -// CUser* thisUser=mCore.getUserManager()->getUserByI2P_ID(ID); -// if(thisUser!=NULL){ -// QByteArray tmp=Data.mid(4);//remove ProtocolInfoTag -// thisUser->slotIncomingChatMessageACK(tmp); -// } -// } //end Messages else{ qWarning()<<"File\t"<<__FILE__<getConnectionType()==UNKNOWN){ //check if First Paket = from a other CHATSYSTEM @@ -331,7 +317,6 @@ <<"Message:\t"<<"Can't convert QString to double"<= 0.6 AVATARIMAGE_CHANGED, //----------------------- - //Protocolversion >= 0.7 - //CHATMESSAGE_WITH_ACK, - //ANSWER_OF_CHATMESSAGE_ACK - //----------------------- - - - //USER_ACCEPTED, - //USER_NOT_ACCEPTED - + }; @@ -117,12 +109,12 @@ public: CProtocol(CCore& Core); ~CProtocol(); - QString getProtocolVersion(){return PROTOCOLVERSION;}; + QString getProtocolVersion()const {return PROTOCOLVERSION;}; void newConnectionChat(const qint32 ID); - void send(const MESSAGES_TAGS TAG,const qint32 ID,QByteArray Data); - void send(const MESSAGES_TAGS TAG,const qint32 ID,QString Data); - void send(const COMMANDS_TAGS TAG,const qint32 ID); + void send(const MESSAGES_TAGS TAG,const qint32 ID,QByteArray Data) const; + void send(const MESSAGES_TAGS TAG,const qint32 ID,QString Data) const; + void send(const COMMANDS_TAGS TAG,const qint32 ID) const; public slots: void slotInputUnknown(const qint32 ID,const QByteArray Data); diff -Nru i2p-messenger-0.2.24/src/backend/SeedlessAnnouncer.h i2p-messenger-0.2.25/src/backend/SeedlessAnnouncer.h --- i2p-messenger-0.2.24/src/backend/SeedlessAnnouncer.h 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/backend/SeedlessAnnouncer.h 2014-12-26 20:46:32.000000000 +0000 @@ -34,8 +34,8 @@ public: CSeedlessAnnouncer(CCore& Core,QString ID); ~CSeedlessAnnouncer(); - QString getID(){return mID;}; - QString getDestination(){return mDestination;}; + QString getID()const {return mID;}; + QString getDestination()const {return mDestination;}; void doAnnounce(QString ServerAddress,QString ServiceName,QByteArray DataForSend); diff -Nru i2p-messenger-0.2.24/src/backend/SeedlessManager.cpp i2p-messenger-0.2.25/src/backend/SeedlessManager.cpp --- i2p-messenger-0.2.24/src/backend/SeedlessManager.cpp 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/backend/SeedlessManager.cpp 2014-12-26 20:46:32.000000000 +0000 @@ -37,6 +37,8 @@ setting.beginGroup("Usersearch"); mReAnnouncingTimer.setInterval(setting.value("ReAnnounceTimerInHours",1).toInt()*3600000); setting.endGroup(); + + qsrand (QTime::currentTime().msec()); } CSeedlessManager::~ CSeedlessManager() @@ -82,14 +84,13 @@ QString DebugMessage; QString ServerAddress; QStringList allKkeys= mSeedlessServerList.keys(); - int randomNumber; QStringList ServerAdressesList; - DebugMessage="<-- CSeedlessManager::doSeedlessSearch -->"; + DebugMessage="<-- CSeedlessManager::doSeedlessSearch -->\n"; DebugMessage+="MetaDataForSearching:\n"+Data+"\n"; DebugMessage+="---------------------------------------------------\n"; - emit signSearchState("Progress 0/"+QString::number(COUNT_FOR_SEEDLESSMESSENGER_SEARCH)); + emit signSearchState("Progress 0/"+QString::number(getCountForSeedlessMessengerSearch())); if(mSeedlessServerList.isEmpty()){ emit signSeedlessSearchNothingFound(); @@ -98,9 +99,9 @@ DebugMessage+="using server:\n"; - while(ServerAdressesList.count()getDestination(); if(t==true && Header.at(0)=="HTTP/1.1 200 OK" ){ + bool OK; + DebugMessage+="Searching OK (ID: "+ID+")\n"; DebugMessage+="Header start:\n"; @@ -295,7 +296,7 @@ DebugMessage+="-------------------------------\n"; resultStr=ExtractMessengerInformation(Data.at(responsCount),OK); - if(OK==TRUE){ + if(OK==true){ if(mSearchResult.contains(resultStr.b32Dest)==false){ mSearchResult.insert(resultStr.b32Dest,resultStr); }else{ @@ -355,7 +356,7 @@ emit signSeedlessSearchResults(mSearchResult); mSearchResult.clear(); }else{ - emit signSearchState("Progress " +QString::number(COUNT_FOR_SEEDLESSMESSENGER_SEARCH - mSeedlessUserSearcherList.count())+"/"+QString::number(COUNT_FOR_SEEDLESSMESSENGER_SEARCH)); + emit signSearchState("Progress " +QString::number(getCountForSeedlessMessengerSearch() - mSeedlessUserSearcherList.count())+"/"+QString::number(getCountForSeedlessMessengerSearch())); } emit DebugMessages(DebugMessage); @@ -399,7 +400,7 @@ } file.close(); - if(mSeedlessServerList.isEmpty()==true || mSeedlessServerList.count()< 4 ){ + if(mSeedlessServerList.isEmpty()==true){ LoadFallBackSeedlessServerList(); } } @@ -419,58 +420,68 @@ currentServerInformation=i.value(); out<<"b32Dest:\t" <setIcon(QMessageBox::Critical); + msgBox->setText("CSeedlessManager(LoadFallBackSeedlessServerList)"); + msgBox->setInformativeText("Can't load fallbacklist because the file: SeedlessFallbackList.txt don't exits"); + msgBox->setStandardButtons(QMessageBox::Ok); + msgBox->setDefaultButton(QMessageBox::Ok); + msgBox->setWindowModality(Qt::NonModal); + msgBox->show(); + return ; + } + + file.open(QIODevice::ReadOnly | QIODevice::Text); + QTextStream in(&file); + + DebugMessage="<--LoadFallBackSeedlessServerList-->\n"; + DebugMessage.append("added Server:\n"); + mSeedlessServerList.clear(); + + while(!in.atEnd()){ + QString textLine=in.readLine().trimmed(); + if(textLine.startsWith("//")==true || textLine.startsWith("#")){continue;} + + if(doCheckForValidB32(textLine)==true && mSeedlessServerList.contains(textLine)==false){ + //add new SeedlessServer + SeedlessServerInformation newServer; + newServer.b32Dest=textLine; + newServer.failCount=0; + mSeedlessServerList.insert(newServer.b32Dest,newServer); + + DebugMessage+=textLine; + DebugMessage+="\n"; + } + } + file.close(); + emit DebugMessages(DebugMessage); } void CSeedlessManager::slotSeedlessServerSearchFinished(bool t, QStringList Header, QList< QByteArray > Data, QString ID) @@ -561,13 +572,13 @@ CheckForMax_FailCount(); } - emit DebugMessages(DebugMessage); + currentSearcher->deleteLater(); mSeedlessServerSearchList.remove(ID); if(mSeedlessServerSearchList.isEmpty()==true){ - emit DebugMessages("<-- the SeedlessServerSearch complead finished -->"); + DebugMessage.append("<-- the SeedlessServerSearch complead finished -->"); SaveSeedlessServerList(); if(mFirstServerSearch==true){ @@ -575,6 +586,8 @@ doSeedlessAnnounce(); } } + + emit DebugMessages(DebugMessage); } void CSeedlessManager::SearchForMoreUseFullSeedlessServer() @@ -589,18 +602,17 @@ DebugMessage="<-- CSeedlessManager::SearchForMoreUseFullSeedlessServer -->\n"; DebugMessage+="asking Server:\n"; - if(mSeedlessServerList.count()==COUNT_FOR_SEEDLESSSERVER_SEARCH){ - for(int i=0; i< COUNT_FOR_SEEDLESSSERVER_SEARCH;i++){ + if(mSeedlessServerList.count()==getCountForSeedlessserverSearch()){ + for(int i=0; i< getCountForSeedlessserverSearch();i++){ DebugMessage+= SeedlessServerListkeys.at(i)+"\n"; MapForSearch.insert(SeedlessServerListkeys.at(i),sID.number(i,10)); } - }else if (mSeedlessServerList.count() > COUNT_FOR_SEEDLESSSERVER_SEARCH){ + }else if (mSeedlessServerList.count() > getCountForSeedlessserverSearch()){ //choice random SeedlessServer - - for(int i=0; i< COUNT_FOR_SEEDLESSSERVER_SEARCH;i++){ - randomNumber =(rand() % SeedlessServerListkeys.count()); + for(int i=0; i< getCountForSeedlessserverSearch();i++){ + randomNumber =(qrand() % SeedlessServerListkeys.count()); while(MapForSearch.contains(SeedlessServerListkeys.at(randomNumber))==true){ - randomNumber =(rand() % SeedlessServerListkeys.count()); + randomNumber =(qrand() % SeedlessServerListkeys.count()); } DebugMessage+=SeedlessServerListkeys.at(randomNumber)+"\n"; @@ -620,7 +632,6 @@ while(i.hasNext()){ i.next(); - CSeedlessSearcher* searcher=new CSeedlessSearcher(mCore,i.value()); connect(searcher,SIGNAL(signDoneSuccessfully(bool,QStringList,QList,QString)), @@ -653,7 +664,7 @@ } } - if(mSeedlessServerList.isEmpty()==true || mSeedlessServerList.count()< 4 ){ + if(mSeedlessServerList.isEmpty()==true){ LoadFallBackSeedlessServerList(); SaveSeedlessServerList(); } @@ -692,10 +703,9 @@ if(mSeedlessUserSearcherList.isEmpty()==false){ QStringList allSeedlessUserSearcherListKeys=mSeedlessUserSearcherList.keys(); - CSeedlessSearcher* tmp; for(int i=0;iaddNewUser(str.NickName,str.b32Dest,0,true); @@ -851,4 +861,11 @@ mSeedlessServerSearchList.remove(allSeedlessServerSearchKeys.at(i)); } } +int CSeedlessManager::getCountForSeedlessserverSearch() const +{ + if(mSeedlessServerList.count()>=3){return 3;} + else{ + return mSeedlessServerList.count(); + } +} diff -Nru i2p-messenger-0.2.24/src/backend/SeedlessManager.h i2p-messenger-0.2.25/src/backend/SeedlessManager.h --- i2p-messenger-0.2.24/src/backend/SeedlessManager.h 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/backend/SeedlessManager.h 2014-12-26 20:46:32.000000000 +0000 @@ -30,6 +30,7 @@ #include #include #include +#include #include "User.h" #include "SeedlessAnnouncer.h" @@ -40,17 +41,8 @@ #define SEEDLESS_SERVICE_NAME "i2p-messenger" #define SEEDLESS_SERVICE_STRUCT_VERSION "X01X" -#define SEEDLESSFALLBACK1 "eaq3jag3crgljljkczky5wa3zhuiqvcbv3m5cp62av6qgugtodmq.b32.i2p" -#define SEEDLESSFALLBACK2 "eomdwleo4rs3n4xfmeja6sbdaauqj75hlfchxkzl4jmqpgziyexa.b32.i2p" -#define SEEDLESSFALLBACK3 "nrg4ys4hjqljnh6pq7ww7pyy3v6f47i7hfs4cmxiwrb3anl6zxda.b32.i2p" -#define SEEDLESSFALLBACK4 "o5hu7phy7udffuhts6w5wn5mw3sepwe3hyvw6kthti33wa2xn5tq.b32.i2p" - -#define COUNT_FOR_SEEDLESSSERVER_SEARCH 3 -#define COUNT_FOR_SEEDLESSSERVER_ANNOUNCE 3 -#define COUNT_FOR_SEEDLESSMESSENGER_SEARCH 3 - -#define MAX_FAILCOUNT 6 +#define MAX_FAILCOUNT 3 using namespace User; class CSeedlessAnnouncer; @@ -72,7 +64,7 @@ QString b32Dest; QString b64Dest; int TTL; - void operator =(const SeedlessSearchStruct& str){ + SeedlessSearchStruct& operator =(const SeedlessSearchStruct& str){ this->NickName=str.NickName; this->Age=str.Age; this->Gender=str.Gender; @@ -80,11 +72,11 @@ this->b32Dest=str.b32Dest; this->b64Dest=str.b64Dest; this->TTL=str.TTL; + return *this; } }; - Q_OBJECT public: CSeedlessManager( CCore& Core, @@ -98,7 +90,7 @@ void doStart(); void printSeedlessServerList(); QMap getSeedlessServer(){return mSeedlessServerList;}; - bool addNewUser(const SeedlessSearchStruct str); + bool addNewUser(const SeedlessSearchStruct& str); void doStop(); @@ -127,7 +119,11 @@ void SearchForMoreUseFullSeedlessServer(); void CheckForMax_FailCount(); void CheckAndFilterResult(); + int doCheckForValidB32(const QString B32Address)const; QString getMetaDataForAnnouncing(); + int getCountForSeedlessserverSearch()const; + int getCountForSeedlessAnncounce()const{return getCountForSeedlessserverSearch();} + int getCountForSeedlessMessengerSearch()const{return getCountForSeedlessserverSearch();} CCore& mCore; const QString mFilePathToSeedlessList; @@ -136,7 +132,7 @@ QMap mSeedlessServerSearchList; QMap mSeedlessUserSearcherList; QMap mSeedlessAnnouncerList; - QMap mSeedlessServerList; + QMap mSeedlessServerList; bool mFirstServerSearch; SeedlessSearchStruct mCurrentSearch; diff -Nru i2p-messenger-0.2.24/src/backend/SeedlessSearcher.h i2p-messenger-0.2.25/src/backend/SeedlessSearcher.h --- i2p-messenger-0.2.24/src/backend/SeedlessSearcher.h 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/backend/SeedlessSearcher.h 2014-12-26 20:46:32.000000000 +0000 @@ -35,8 +35,8 @@ public: CSeedlessSearcher(CCore& Core,QString ID); ~CSeedlessSearcher(); - QString getID(){return mID;}; - QString getDestination(){return mDestination;}; + QString getID()const {return mID;}; + QString getDestination() const {return mDestination;}; void doSearch(QString ServerAddress,QString ServiceName,QByteArray DataForSearch); signals: diff -Nru i2p-messenger-0.2.24/src/backend/SessionController.cpp i2p-messenger-0.2.25/src/backend/SessionController.cpp --- i2p-messenger-0.2.24/src/backend/SessionController.cpp 1970-01-01 00:00:00.000000000 +0000 +++ i2p-messenger-0.2.25/src/backend/SessionController.cpp 2014-12-26 20:46:32.000000000 +0000 @@ -0,0 +1,267 @@ +/*************************************************************************** + * Copyright (C) 2008 by I2P-Messenger * + * Messenger-Dev@I2P-Messenger * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + + + +#include "SessionController.h" + +const QString SAM_HANDSHAKE_V3="HELLO VERSION MIN=3.1 MAX=3.1\n"; + +CSessionController::CSessionController(QString SamHost, QString SamPort, QString BridgeName, QString SamPrivKey, QString ConfigPath,QString SessionOptions) +:mSamHost(SamHost),mSamPort(SamPort),mBridgeName(BridgeName),mConfigPath(ConfigPath),mSessionOptions(SessionOptions) +{ + + mIncomingPackets=new QByteArray(); + mDoneDisconnect=false; + + mAnalyser= new CI2PSamMessageAnalyser("CStreamController"); + mHandShakeWasSuccesfullDone=false; + mSessionWasSuccesfullCreated=false; + mSamPrivKey=SamPrivKey; + + connect(&mTcpSocket,SIGNAL(connected() ),this, + SLOT(slotConnected() ),Qt::DirectConnection ); + + connect(&mTcpSocket,SIGNAL(disconnected()),this, + SLOT(slotDisconnected()),Qt::DirectConnection ); + + connect(&mTcpSocket,SIGNAL(readyRead() ),this, + SLOT(slotReadFromSocket()),Qt::DirectConnection); + + emit signDebugMessages("<-- StreamController (I2P) started -->"); +} + +CSessionController::~ CSessionController() +{ + doDisconnect(); + mTcpSocket.deleteLater(); + emit signDebugMessages("<-- StreamController (I2P) stopped -->"); +} + +void CSessionController::slotConnected() +{ + emit signDebugMessages("<-- StreamController (I2P) Connected -->\n"); + emit signDebugMessages(SAM_HANDSHAKE_V3); + if(mTcpSocket.state()==QAbstractSocket::ConnectedState){ + mTcpSocket.write(SAM_HANDSHAKE_V3.toUtf8()); + mTcpSocket.flush(); + } +} + +void CSessionController::slotDisconnected() +{ + if(mDoneDisconnect==false) + { + mTcpSocket.close(); + emit signDebugMessages("<-- StreamController (I2P) can't connect I2P(sam) or I2P crashed -->\nSamHost:\t"+mSamHost+"\nSamPort:\t" +mSamPort+"\n"); + emit signSessionStreamStatusOK(false); + + QMessageBox msgBox(NULL); + msgBox.setIcon(QMessageBox::Critical); + msgBox.setInformativeText("<-- StreamController (I2P) can't connect I2P(sam) or I2P crashed -->\nSamHost:\t"+mSamHost+"\nSamPort:\t" +mSamPort+"\n"); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.setDefaultButton(QMessageBox::Ok); + msgBox.setWindowModality(Qt::NonModal); + msgBox.exec(); + + //emit SamConnectionClosed(); + } +} + +void CSessionController::slotReadFromSocket() +{ + using namespace SAM_Message_Types; + + QByteArray newData =mTcpSocket.readAll(); + QByteArray CurrentPacket; + mIncomingPackets->append(newData); + + while(mIncomingPackets->contains("\n")==true){ + + if(mIncomingPackets->indexOf("\n",0)==-1){ + //Not the complead Packet recived ??? maybe possible ??? + return; + } + CurrentPacket=mIncomingPackets->left(mIncomingPackets->indexOf("\n",0)+1); + + + QString t(CurrentPacket.data()); + + SAM_MESSAGE sam=mAnalyser->Analyse(t); + switch(sam.type) + { //emit the signals + case HELLO_REPLAY:{ + emit signDebugMessages(t); + if(sam.result==OK){ + this->mHandShakeWasSuccesfullDone=true; + if(mSamPrivKey==""){ + QSettings settings(mConfigPath+"/application.ini",QSettings::IniFormat); + QString Signature="SIGNATURE_TYPE=%s"; + settings.beginGroup("Network"); + Signature.replace("%s",settings.value("Signature_Type","DSA_SHA1").toString()); + this->doDestGenerate(Signature); + settings.endGroup(); + + } + else{ + doSessionCreate(); + } + } + else{ + emit signSessionStreamStatusOK(false); + } + + break; + } + case SESSION_STATUS:{ + emit signDebugMessages(t); + if(sam.result==OK){ + mSessionWasSuccesfullCreated=true; + emit signSessionStreamStatusOK(true); + } + else{ + if(sam.result==DUPLICATED_DEST){ + QMessageBox msgBox(NULL); + msgBox.setIcon(QMessageBox::Critical); + msgBox.setText(tr("I2P-Messenger")); + msgBox.setInformativeText(tr("Session: DUPLICATED_DEST\n\nOnly one Messenger per Destination,\nor SAMv3 crashed(Tunnel stay if Messenger were closed)\n ")); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.setDefaultButton(QMessageBox::Ok); + msgBox.setWindowModality(Qt::NonModal); + msgBox.exec(); + + qCritical()<<"File\t"<<__FILE__<\n"+t); + break; + } + default: + { + emit signDebugMessages("CStreamController: \n"+t); + break; + } + } + mIncomingPackets->remove(0,mIncomingPackets->indexOf("\n",0)+1); + }//while + +} + +void CSessionController::doConnect() +{ + mDoneDisconnect=false; + + if(mTcpSocket.state()==QAbstractSocket::UnconnectedState) + { + mTcpSocket.connectToHost(mSamHost,mSamPort.toInt( )); + } + if(!mTcpSocket.waitForConnected(1000)) + slotDisconnected(); +} + +void CSessionController::doDisconnect() +{ + mDoneDisconnect=true; + + if(mTcpSocket.state()!=0){ + mTcpSocket.disconnectFromHost(); + emit signDebugMessages("<-- StreamController (I2P) Socket Disconnected -->\n"); + } + else if(mTcpSocket.state()==QAbstractSocket::UnconnectedState){ + emit signDebugMessages("<-- StreamController (I2P) Socket allready Disconnected -->\n"); + } + +} + +void CSessionController::doNamingLookUP(QString Name) +{ + ConnectionReadyCheck(); + + QByteArray Message="NAMING LOOKUP NAME="; + Message+=Name+"\n"; + emit signDebugMessages(Message); + mTcpSocket.write(Message); + mTcpSocket.flush(); + +} + +void CSessionController::doSessionCreate() +{ + ConnectionReadyCheck(); + + QByteArray Message="SESSION CREATE STYLE=STREAM ID="; + Message+=mBridgeName+" DESTINATION="+mSamPrivKey; + + if(mSessionOptions.isEmpty()==false){ + Message+=" "+mSessionOptions; + } + + Message+="\n"; + emit signDebugMessages(Message); + + mTcpSocket.write(Message); + mTcpSocket.flush(); +} + +void CSessionController::doDestGenerate(const QString Options) +{ + ConnectionReadyCheck(); + QByteArray Message="DEST GENERATE "; + if(Options.isEmpty()==false){ + Message+=Options; + } + Message+="\n"; + + emit signDebugMessages(Message); + + mTcpSocket.write(Message); + mTcpSocket.flush(); +} + diff -Nru i2p-messenger-0.2.24/src/backend/SessionController.h i2p-messenger-0.2.25/src/backend/SessionController.h --- i2p-messenger-0.2.24/src/backend/SessionController.h 1970-01-01 00:00:00.000000000 +0000 +++ i2p-messenger-0.2.25/src/backend/SessionController.h 2014-12-26 20:46:32.000000000 +0000 @@ -0,0 +1,92 @@ +/*************************************************************************** + * Copyright (C) 2008 by I2P-Messenger * + * Messenger-Dev@I2P-Messenger * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef SESSIONCONTROLLER_H +#define SESSIONCONTROLLER_H + +#include +#include +#include + +#include "I2PSamMessageAnalyser.h" + + + +class CSessionController:public QObject +{ + Q_OBJECT + public: + CSessionController( + QString SamHost, + QString SamPort, + QString BridgeName, + QString SamPrivKey, + QString ConfigPath, + QString SessionOptions= ""); + + ~CSessionController(); + + QString getBridgeName()const {return mBridgeName;} + QString getSamPrivKey()const {return mSamPrivKey;} + + void doConnect(); + void doDisconnect(); + void doNamingLookUP(QString Name); + void doDestGenerate(const QString Options=""); + + + signals: + void signDebugMessages(const QString Message); + void signNamingReplyRecived(const SAM_Message_Types::RESULT result,QString Name,QString Value="",QString Message=""); + void signSessionStreamStatusOK(bool Status); + void signNewSamPrivKeyGenerated(const QString SamPrivKey); + + + private slots: + void slotConnected(); + void slotDisconnected(); + void slotReadFromSocket(); + + private: + void doSessionCreate(); + + const QString mSamHost; + const QString mSamPort; + const QString mBridgeName; + QString mSamPrivKey; + const QString mConfigPath; + const QString mSessionOptions; + + QTcpSocket mTcpSocket; + CI2PSamMessageAnalyser* mAnalyser; + QByteArray* mIncomingPackets; + + bool mHandShakeWasSuccesfullDone; + bool mSessionWasSuccesfullCreated; + bool mDoneDisconnect; + + inline void ConnectionReadyCheck() + { + if( mHandShakeWasSuccesfullDone==false || + mSessionWasSuccesfullCreated==false|| + mTcpSocket.state()!=QAbstractSocket::ConnectedState) + return; + } +}; +#endif diff -Nru i2p-messenger-0.2.24/src/backend/StreamController.cpp i2p-messenger-0.2.25/src/backend/StreamController.cpp --- i2p-messenger-0.2.24/src/backend/StreamController.cpp 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/backend/StreamController.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,270 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2008 by I2P-Messenger * - * Messenger-Dev@I2P-Messenger * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - - - -#include "StreamController.h" - -#define SAM_HANDSHAKE_V3 "HELLO VERSION MIN=3.0 MAX=3.0\n" - -CStreamController::CStreamController(QString SamHost, QString SamPort, QString BridgeName, QString SamPrivKey, QString SessionOptions) -:mSamHost(SamHost),mSamPort(SamPort),mBridgeName(BridgeName),mSessionOptions(SessionOptions) -{ - - mIncomingPackets=new QByteArray(); - mDoneDisconnect=false; - - mAnalyser= new CI2PSamMessageAnalyser(); - mHandShakeWasSuccesfullDone=false; - mSessionWasSuccesfullCreated=false; - mSamPrivKey=SamPrivKey; - - connect(&mTcpSocket,SIGNAL(connected() ),this, - SLOT(slotConnected() ),Qt::DirectConnection ); - - connect(&mTcpSocket,SIGNAL(disconnected()),this, - SLOT(slotDisconnected()),Qt::DirectConnection ); - - connect(&mTcpSocket,SIGNAL(readyRead() ),this, - SLOT(slotReadFromSocket()),Qt::DirectConnection); - - emit signDebugMessages("<-- StreamController (I2P) started -->"); -} - -CStreamController::~ CStreamController() -{ - doDisconnect(); - mTcpSocket.deleteLater(); - emit signDebugMessages("<-- StreamController (I2P) stopped -->"); -} - -void CStreamController::slotConnected() -{ - emit signDebugMessages("<-- StreamController (I2P) Connected -->\n"); - emit signDebugMessages(SAM_HANDSHAKE_V3); - if(mTcpSocket.state()==QAbstractSocket::ConnectedState){ - mTcpSocket.write(SAM_HANDSHAKE_V3); - mTcpSocket.flush(); - } -} - -void CStreamController::slotDisconnected() -{ - if(mDoneDisconnect==false) - { - mTcpSocket.close(); - emit signDebugMessages("<-- StreamController (I2P) can't connect I2P(sam) or I2P crashed -->\nSamHost:\t"+mSamHost+"\nSamPort:\t" +mSamPort+"\n"); - emit signSessionStreamStatusOK(false); - - QMessageBox msgBox(NULL); - msgBox.setIcon(QMessageBox::Critical); - msgBox.setInformativeText("<-- StreamController (I2P) can't connect I2P(sam) or I2P crashed -->\nSamHost:\t"+mSamHost+"\nSamPort:\t" +mSamPort+"\n"); - msgBox.setStandardButtons(QMessageBox::Ok); - msgBox.setDefaultButton(QMessageBox::Ok); - msgBox.setWindowModality(Qt::NonModal); - msgBox.exec(); - - //emit SamConnectionClosed(); - } -} - -void CStreamController::slotReadFromSocket() -{ - using namespace SAM_Message_Types; - - QByteArray newData =mTcpSocket.readAll(); - QByteArray CurrentPacket; - mIncomingPackets->append(newData); - - while(mIncomingPackets->contains("\n")==true){ - - if(mIncomingPackets->indexOf("\n",0)==-1){ - //Not the complead Packet recived ??? maybe possible ??? - return; - } - CurrentPacket=mIncomingPackets->left(mIncomingPackets->indexOf("\n",0)+1); - - - QString t(CurrentPacket.data()); - - SAM_MESSAGE sam=mAnalyser->Analyse(t); - switch(sam.type) - { //emit the signals - case HELLO_REPLAY:{ - emit signDebugMessages(t); - if(sam.result==OK){ - this->mHandShakeWasSuccesfullDone=true; - if(mSamPrivKey==""){ - this->doDestGenerate(); - } - else{ - doSessionCreate(); - } - } - else{ - emit signSessionStreamStatusOK(false); - } - - break; - } - case SESSION_STATUS:{ - emit signDebugMessages(t); - if(sam.result==OK){ - mSessionWasSuccesfullCreated=true; - emit signSessionStreamStatusOK(true); - } - else{ - if(sam.result==DUPLICATED_DEST){ - QMessageBox msgBox(NULL); - msgBox.setIcon(QMessageBox::Critical); - msgBox.setText(tr("I2P-Messenger")); - msgBox.setInformativeText(tr("Session: DUPLICATED_DEST\n\nOnly one Messenger per Destination,\nor SAMv3 crashed(Tunnel stay if Messenger were closed)\n ")); - msgBox.setStandardButtons(QMessageBox::Ok); - msgBox.setDefaultButton(QMessageBox::Ok); - msgBox.setWindowModality(Qt::NonModal); - msgBox.exec(); - - qCritical()<<"File\t"<<__FILE__<\n"+t); - break; - } - default: - { - emit signDebugMessages("\n"+t); - break; - } - } - mIncomingPackets->remove(0,mIncomingPackets->indexOf("\n",0)+1); - }//while - -} - -void CStreamController::doConnect() -{ - mDoneDisconnect=false; - - if(mTcpSocket.state()==QAbstractSocket::UnconnectedState) - { - mTcpSocket.connectToHost(mSamHost,mSamPort.toInt( )); - } - if(!mTcpSocket.waitForConnected(1000)) - slotDisconnected(); -} - -void CStreamController::doDisconnect() -{ - mDoneDisconnect=true; - - if(mTcpSocket.state()!=0){ - mTcpSocket.disconnectFromHost(); - emit signDebugMessages("<-- StreamController (I2P) Socket Disconnected -->\n"); - } - else if(mTcpSocket.state()==QAbstractSocket::UnconnectedState){ - emit signDebugMessages("<-- StreamController (I2P) Socket allready Disconnected -->\n"); - } - -} - -void CStreamController::doNamingLookUP(QString Name) -{ - ConnectionReadyCheck(); - - QByteArray Message="NAMING LOOKUP NAME="; - Message+=Name+"\n"; - emit signDebugMessages(Message); - mTcpSocket.write(Message); - mTcpSocket.flush(); - -} - -void CStreamController::doSessionCreate() -{ - ConnectionReadyCheck(); - //this->doDestGenerate(); - - QByteArray Message="SESSION CREATE STYLE=STREAM ID="; - Message+=mBridgeName+" DESTINATION="+mSamPrivKey; - - if(mSessionOptions.isEmpty()==false) - Message+=" "+mSessionOptions; - - Message+="\n"; - emit signDebugMessages(Message); - - mTcpSocket.write(Message); - mTcpSocket.flush(); -} - -void CStreamController::doDestGenerate() -{ - ConnectionReadyCheck(); - QByteArray Message="DEST GENERATE\n"; - emit signDebugMessages(Message); - - mTcpSocket.write(Message); - mTcpSocket.flush(); -} - -QString CStreamController::getBridgeName() -{ - return mBridgeName; -} - -QString CStreamController::getSamPrivKey() -{ - return mSamPrivKey; -} - - -#undef SAM_HANDSHAKE_V3 - - diff -Nru i2p-messenger-0.2.24/src/backend/StreamController.h i2p-messenger-0.2.25/src/backend/StreamController.h --- i2p-messenger-0.2.24/src/backend/StreamController.h 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/backend/StreamController.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,89 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2008 by I2P-Messenger * - * Messenger-Dev@I2P-Messenger * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#ifndef STREAMCONTROLLER_H -#define STREAMCONTROLLER_H - -#include -#include -#include - -#include "I2PSamMessageAnalyser.h" - - - -class CStreamController:public QObject -{ - Q_OBJECT - public: - CStreamController( - QString SamHost, - QString SamPort, - QString BridgeName, - QString SamPrivKey, - QString SessionOptions= ""); - ~CStreamController(); - - QString getBridgeName(); - QString getSamPrivKey(); - - void doConnect(); - void doDisconnect(); - void doNamingLookUP(QString Name); - void doDestGenerate(); - - - signals: - void signDebugMessages(const QString Message); - void signSessionStatusRecived(const SAM_Message_Types::RESULT result,const QString Destination,const QString Message); - void signNamingReplyRecived(const SAM_Message_Types::RESULT result,QString Name,QString Value="",QString Message=""); - void signSessionStreamStatusOK(bool Status); - void signNewSamPrivKeyGenerated(const QString SamPrivKey); - - - private slots: - void slotConnected(); - void slotDisconnected(); - void slotReadFromSocket(); - - private: - void doSessionCreate(); - - const QString mSamHost; - const QString mSamPort; - const QString mBridgeName; - QString mSamPrivKey; - const QString mSessionOptions; - QTcpSocket mTcpSocket; - CI2PSamMessageAnalyser* mAnalyser; - QByteArray* mIncomingPackets; - - bool mHandShakeWasSuccesfullDone; - bool mSessionWasSuccesfullCreated; - bool mDoneDisconnect; - - inline void ConnectionReadyCheck() - { - if( mHandShakeWasSuccesfullDone==false || - mSessionWasSuccesfullCreated==false|| - mTcpSocket.state()!=QAbstractSocket::ConnectedState) - return; - } -}; -#endif diff -Nru i2p-messenger-0.2.24/src/backend/TextEmotionChanger.cpp i2p-messenger-0.2.25/src/backend/TextEmotionChanger.cpp --- i2p-messenger-0.2.24/src/backend/TextEmotionChanger.cpp 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/backend/TextEmotionChanger.cpp 2014-12-26 20:46:32.000000000 +0000 @@ -22,7 +22,7 @@ setEmoticonPath(m_emoticons_path); } -void CTextEmotionChanger::checkMessageForEmoticons(QString& message) +void CTextEmotionChanger::checkMessageForEmoticons(QString& message) { CTextEmotionChanger::HtmlState state = OutsideHtml; bool at_amp = false; @@ -69,12 +69,12 @@ } else if(state != TagText) { - bool found = false; at_amp = cur == '&'; if(!m_check_space || chars == begin || (chars-1)->isSpace()) { + bool found = false; it = m_emoticons.constBegin(); - for( ; it != m_emoticons.constEnd(); it++ ) + for( ; it != m_emoticons.constEnd(); ++it ) { int length = (*it).first.length(); if(compareEmoticon(chars, (*it).first) @@ -103,7 +103,7 @@ -bool CTextEmotionChanger::compareEmoticon(const QChar* c, const QString& smile) +bool CTextEmotionChanger::compareEmoticon(const QChar* c, const QString& smile) const { const QChar *s = smile.constData(); while(c->toLower() == *s) @@ -116,7 +116,7 @@ return s->isNull(); } -void CTextEmotionChanger::appendEmoticon(QString& text, const QString& url, const QStringRef& emo) +void CTextEmotionChanger::appendEmoticon(QString& text, const QString& url, const QStringRef& emo) const { int i = 0, last = 0; while((i = url.indexOf(QLatin1String("%4"), last)) != -1) diff -Nru i2p-messenger-0.2.24/src/backend/TextEmotionChanger.h i2p-messenger-0.2.25/src/backend/TextEmotionChanger.h --- i2p-messenger-0.2.24/src/backend/TextEmotionChanger.h 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/backend/TextEmotionChanger.h 2014-12-26 20:46:32.000000000 +0000 @@ -57,18 +57,18 @@ static CTextEmotionChanger* exemplar(); ~CTextEmotionChanger(); - QHash getEmoticonsList() { return m_emoticon_list; } + QHash getEmoticonsList()const { return m_emoticon_list; } void checkMessageForEmoticons(QString &message); static bool lengthLessThan(const QString &s1, const QString &s2); - QString getEmoticonsPath() { return m_dir_path; } + QString getEmoticonsPath()const { return m_dir_path; } private: static CTextEmotionChanger* instanz; CTextEmotionChanger(); CTextEmotionChanger(const CTextEmotionChanger&); void setEmoticonPath(const QString &path); - void appendEmoticon(QString &text, const QString &url, const QStringRef &emo); - bool compareEmoticon(const QChar *c, const QString &smile); + void appendEmoticon(QString &text, const QString &url, const QStringRef &emo) const; + bool compareEmoticon(const QChar *c, const QString &smile) const; QString m_profile_name; QString m_emoticons_path; diff -Nru i2p-messenger-0.2.24/src/backend/UserBlockManager.cpp i2p-messenger-0.2.25/src/backend/UserBlockManager.cpp --- i2p-messenger-0.2.24/src/backend/UserBlockManager.cpp 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/backend/UserBlockManager.cpp 2014-12-26 20:46:32.000000000 +0000 @@ -80,12 +80,10 @@ QMapIterator i(mUserBlockMap); - CUserBlockEntity* currentEntity; - while(i.hasNext()){ i.next(); - currentEntity=i.value(); + CUserBlockEntity* currentEntity=i.value(); out<<"NickName:\t" <mNickName<mDestination< getBlockList(){return mUserBlockMap;}; + const QMap getBlockList()const{return mUserBlockMap;}; private: CCore& mCore; diff -Nru i2p-messenger-0.2.24/src/backend/User.cpp i2p-messenger-0.2.25/src/backend/User.cpp --- i2p-messenger-0.2.24/src/backend/User.cpp 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/backend/User.cpp 2014-12-26 20:46:32.000000000 +0000 @@ -23,8 +23,6 @@ #include "FileTransferSend.h" #include "Core.h" #include "UserManager.h" -#include "ChatMessageAckEntry.h" -#include "CMessageAckManager.h" CUser::CUser( CCore& Core, CProtocol& Protocol, @@ -43,7 +41,6 @@ this->mCurrentOnlineState=USEROFFLINE; this->mHaveNewUnreadMessages=false; this->mHaveNewUnreadChatmessage=false; -// this->mChatMessageAckManager=NULL; settings.beginGroup("Chat"); this->mTextFont.fromString(settings.value("DefaultFont","Comic Sans MS,10").toString()); @@ -65,28 +62,8 @@ } CUser::~CUser() { -// if(mChatMessageAckManager!=NULL){ -// disconnect(mChatMessageAckManager,SIGNAL(signChatMessageTimeOut(QString,bool)), -// this,SLOT(slotIncomingMessageFromSystem(QString,bool))); -// mChatMessageAckManager->deleteLater(); -// mChatMessageAckManager=NULL; -// } - - emit signUserDeleted(); -} -const QString CUser::getName()const{ - return this->mName; -} -const QString CUser::getI2PDestination()const{ - return this->mI2PDestination; -} -qint32 CUser::getI2PStreamID()const{ - return this->mI2PStream_ID; -} - -CONNECTIONTOUSER CUser::getConnectionStatus()const{ - return this->mConnectionStatus; + emit signUserDeleted(); } void CUser::setName(QString newName){ @@ -120,20 +97,6 @@ mProtocol.send(GET_AVATARIMAGE,mI2PStream_ID); } } -// if(getProtocolVersion_D()>=0.7){ -// if(mChatMessageAckManager==NULL){ -// QSettings settings(mCore.getConfigPath()+"/application.ini",QSettings::IniFormat); -// settings.beginGroup("Chat"); -// int ackTimeInSec=settings.value("MaxChatmessageACKTimeInSec","10").toInt(); -// -// mChatMessageAckManager= new CCMessageAckManager(ackTimeInSec); -// connect(mChatMessageAckManager,SIGNAL(signChatMessageTimeOut(QString,bool)), -// this,SLOT(slotIncomingMessageFromSystem(QString,bool))); -// -// slotIncomingMessageFromSystem(tr("Chatmessage acknowledgements available"),false); -// settings.endGroup(); -// } -// } } if(Status==OFFLINE ||Status==ERROR){ @@ -142,9 +105,6 @@ if(mCurrentOnlineState!=USERBLOCKEDYOU){ setOnlineState(USEROFFLINE); } -// if(mChatMessageAckManager!=NULL){ -// mChatMessageAckManager->doReset(); -// } } emit signOnlineStateChanged(); } @@ -156,9 +116,7 @@ void CUser::setProtocolVersion(QString Version){ this->mProtocolVersion=Version; } -const QString CUser::getProtocolVersion()const{ - return this->mProtocolVersion; -} + void CUser::slotIncomingNewChatMessage(QString newMessage){ @@ -175,19 +133,6 @@ emit signOnlineStateChanged(); } -// void CUser::slotIncomingNewChatMessageForACK(QByteArray newMessage) -// { -// if(getProtocolVersion_D()>=0.6 && mChatMessageAckManager!=NULL){ -// QByteArray Hash=mChatMessageAckManager->doCalcHash(newMessage); -// mProtocol.send(ANSWER_OF_CHATMESSAGE_ACK,mI2PStream_ID,Hash); -// -// newMessage.remove(0,5); -// slotIncomingNewChatMessage(newMessage); -// }else{ -// qDebug()<<"File\t"<<__FILE__<<"\n"<<"Line:\t"<<__LINE__<<"\n"<<"wrong Protocolversion or no mChatMessageAckManager"; -// } -// } - void CUser::slotSendChatMessage(QString Message){ using namespace PROTOCOL_TAGS; QString Nickname; @@ -197,15 +142,7 @@ mCurrentOnlineState != USERINVISIBLE ){ QByteArray ByteMessage=Message.toUtf8(); - -// if(getProtocolVersion_D()>=0.7 && mChatMessageAckManager!=NULL){ -// ByteMessage=mChatMessageAckManager->inputNewChatMessage(ByteMessage); -// mProtocol.send(CHATMESSAGE_WITH_ACK,mI2PStream_ID,ByteMessage); -// } -// else{ - mProtocol.send(CHATMESSAGE,mI2PStream_ID,ByteMessage); -// } - + mProtocol.send(CHATMESSAGE,mI2PStream_ID,ByteMessage); if(mCore.getUserInfos().Nickname.isEmpty()==true){ Nickname=tr("Me "); @@ -225,14 +162,9 @@ } } -// void CUser::slotIncomingChatMessageACK(QByteArray ChatmessageACK) -// { -// if(getProtocolVersion_D()>=0.6 && mChatMessageAckManager!=NULL){ -// mChatMessageAckManager->inputNewAckMessage(ChatmessageACK); -// } -// } -const QStringList& CUser::getAllChatMessages(){ +const QStringList& CUser::getAllChatMessages() +{ mNewMessages.clear(); mHaveNewUnreadMessages=false; mHaveNewUnreadChatmessage=false; @@ -240,7 +172,8 @@ emit signOnlineStateChanged(); return mAllMessages; } -void CUser::SendAllunsendedMessages(){ +void CUser::SendAllunsendedMessages() +{ using namespace PROTOCOL_TAGS; if(mUnsentedMessages.empty())return; @@ -252,26 +185,12 @@ slotIncomingMessageFromSystem("All previously unsent messages have been sent.",true); } -bool CUser::getHaveNewUnreadMessages(){ - return mHaveNewUnreadMessages; -} - -const QString CUser::getClientName() const -{ - return mClientName; -} void CUser::setClientName(QString Name) { mClientName=Name; } - -const QString CUser::getClientVersion() const -{ - return mClientVersion; -} - void CUser::setClientVersion(QString Version) { this->mClientVersion=Version; @@ -280,11 +199,6 @@ } } -ONLINESTATE CUser::getOnlineState() const -{ - return mCurrentOnlineState; -} - void CUser::setOnlineState(const ONLINESTATE newState) { if(mCurrentOnlineState==newState)return; @@ -314,11 +228,6 @@ emit signOnlineStateChanged(); } -QColor CUser::getTextColor() -{ - return mTextColor; -} - void CUser::setTextColor(QColor textColor) { this->mTextColor=textColor; @@ -329,10 +238,6 @@ this->mTextFont=textFont; } -QFont CUser::getTextFont() -{ - return mTextFont; -} void CUser::slotIncomingMessageFromSystem(QString newMessage,bool indicateWithSoundAndIcon) { @@ -363,7 +268,6 @@ emit signOnlineStateChanged(); } - const QStringList CUser::getNewMessages(bool haveFocus) { QStringList tmp(mNewMessages); @@ -378,23 +282,10 @@ return tmp; } - - -const CRecivedInfos CUser::getRecivedUserInfos() const -{ - return mRecivedUserInfos; -} - -const QString CUser::getRecivedUserNickname() const -{ - return mRecivedUserInfos.Nickname; -} - double CUser::getProtocolVersion_D() const { - double tmp=0.0; bool OK=false; - tmp=mProtocolVersion.toDouble(&OK); + bool tmp=mProtocolVersion.toDouble(&OK); if(OK==false){ qCritical()<<"File\t"<<__FILE__<getName()+"\n"; Infos+="Clientname:\t\t" +theUser->getClientName()+"\n"; - Infos+="Clientversion:\t" +theUser->getClientVersion()+"\n"; - Infos+="Protocolversion:\t" +theUser->getProtocolVersion()+"\n"; - Infos+="Protocolversion min (Filetransfer):"+theUser->getMinProtocolVersionFiletransfer()+"\n"; - Infos+="Protocolversion max (Filetransfer):"+theUser->getMaxProtocolVersionFiletransfer()+"\n"; + Infos+="Clientversion:\t\t" +theUser->getClientVersion()+"\n"; + Infos+="Prot. version:\t\t" +theUser->getProtocolVersion()+"\n"; + Infos+="Prot. version min (Filetransfer):\t"+theUser->getMinProtocolVersionFiletransfer()+"\n"; + Infos+="Prot. version max (Filetransfer):\t"+theUser->getMaxProtocolVersionFiletransfer()+"\n"; if(theUser->getProtocolVersion_D()>=0.3){ CRecivedInfos recivedInfos=theUser->getRecivedUserInfos(); @@ -174,55 +174,74 @@ return mUsers; } +bool CUserManager::validateI2PDestination(const QString I2PDestination) const +{ + auto validateB64 = [] (QString Dest) { + if(Dest.length() == 516 && Dest.right(4).contains("AAAA",Qt::CaseInsensitive)) + return true; + else + return false; + }; + + auto validateB32 = [] (QString Dest) { + if(Dest.length() == 60 && Dest.right(8).contains(".b32.i2p",Qt::CaseInsensitive)) + return true; + else + return false; + }; + + auto validateECDSA_SHA256_P256 = [] (QString Dest) { + if(Dest.length() == 524 && Dest.right(10).contains("AEAAEAAA==",Qt::CaseInsensitive)) + return true; + else + return false; + }; + + auto validateECDSA_SHA384_P384 = [] (QString Dest) { + if(Dest.length() == 524 && Dest.right(10).contains("AEAAIAAA==",Qt::CaseInsensitive)) + return true; + else + return false; + }; + + auto validateECDSA_SHA512_P512 = [] (QString Dest) { + if(Dest.length() == 528 && Dest.right(1).contains("=",Qt::CaseInsensitive) && + Dest.mid(512,9).contains("BQAIAAMAA",Qt::CaseInsensitive) + ) + return true; + else + return false; + }; + + + if(I2PDestination.right(4).contains("AAAA",Qt::CaseInsensitive)) {return validateB64(I2PDestination);} + else if(I2PDestination.right(8).contains(".b32.i2p",Qt::CaseInsensitive)) {return validateB32(I2PDestination);} + else if(I2PDestination.right(10).contains("AEAAEAAA==",Qt::CaseInsensitive)){return validateECDSA_SHA256_P256(I2PDestination);} + else if(I2PDestination.right(10).contains("AEAAIAAA==",Qt::CaseInsensitive)){return validateECDSA_SHA384_P384(I2PDestination);} + else if(I2PDestination.length()==528 && I2PDestination.mid(512,9).contains("BQAIAAMAA",Qt::CaseInsensitive)) + {return validateECDSA_SHA512_P512(I2PDestination);} + else + return false; +} bool CUserManager::addNewUser(QString Name,QString I2PDestination,qint32 I2PStream_ID,bool SaveUserList){ CUserBlockManager& UserBlockManager=*(mCore.getUserBlockManager()); CProtocol& Protocol=*(mCore.getProtocol()); - - - if(I2PDestination.length() != 516 && I2PDestination.length() != 60){ + + bool isValid=validateI2PDestination(I2PDestination); + + if(isValid==false){ qCritical()<<"File\t"<<__FILE__<checkIfUserExitsByI2PDestination(I2PDestination)==true){ qCritical()<<"File\t"<<__FILE__<getOnlineState()!= USEROFFLINE && User->getOnlineState()!= USERTRYTOCONNECT && diff -Nru i2p-messenger-0.2.24/src/backend/UserManager.h i2p-messenger-0.2.25/src/backend/UserManager.h --- i2p-messenger-0.2.24/src/backend/UserManager.h 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/backend/UserManager.h 2014-12-26 20:46:32.000000000 +0000 @@ -47,6 +47,7 @@ CUser* getUserByI2P_Destination ( QString Destination )const; QString getUserInfosByI2P_Destination(QString Destination)const; const QList getUserList()const; + bool validateI2PDestination(const QString I2PDestination)const; signals: @@ -60,8 +61,6 @@ CCore& mCore; const QString mUserFileWithPath; CUnsentChatMessageStorage& mUnsentMessageStorage; - QList mUsers; - - + QList mUsers; }; #endif // CUSERMANAGER_H diff -Nru i2p-messenger-0.2.24/src/gui/form_chatwidget.h i2p-messenger-0.2.25/src/gui/form_chatwidget.h --- i2p-messenger-0.2.24/src/gui/form_chatwidget.h 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/gui/form_chatwidget.h 2014-12-26 20:46:32.000000000 +0000 @@ -42,7 +42,6 @@ public: ChatEventEater(QWidget *parent = 0) : QObject(parent){ } - bool m_send_on_enter; signals: void sendMessage(); diff -Nru i2p-messenger-0.2.24/src/gui/form_Main.cpp i2p-messenger-0.2.25/src/gui/form_Main.cpp --- i2p-messenger-0.2.24/src/gui/form_Main.cpp 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/gui/form_Main.cpp 2014-12-26 20:46:32.000000000 +0000 @@ -46,6 +46,12 @@ SLOT(onlineComboBoxChanged())); + connect(Core,SIGNAL(signOwnAvatarImageChanged()),this, + SLOT(eventAvatarImageChanged())); + + connect(Core,SIGNAL(signNicknameChanged()),this, + SLOT(eventNicknameChanged())); + mUserSearchWindow=NULL; mAboutWindow=NULL; mDebugWindow=NULL; @@ -58,10 +64,13 @@ initTryIconMenu(); initTryIcon(); initToolBars(); + Core->setOnlineStatus(USEROFFLINE); - this->eventUserChanged(); - + eventUserChanged(); + eventNicknameChanged(); + eventAvatarImageChanged(); + } @@ -106,8 +115,8 @@ else{ QMessageBox* msgBox= new QMessageBox(NULL); msgBox->setIcon(QMessageBox::Information); - msgBox->setText(""); - msgBox->setInformativeText(tr("Sorry a Filetransfer or Filerecive ist active,\nclosing aborted")); + msgBox->setText(tr("I2P-Messenger")); + msgBox->setInformativeText(tr("Sorry a File transfer or File receive is active,\nclosing aborted")); msgBox->setStandardButtons(QMessageBox::Ok); msgBox->setDefaultButton(QMessageBox::Ok); msgBox->setWindowModality(Qt::NonModal); @@ -138,7 +147,7 @@ QMessageBox* msgBox= new QMessageBox(NULL); msgBox->setIcon(QMessageBox::Information); msgBox->setText(tr("I2P-Messenger")); - msgBox->setInformativeText(tr("Sorry you have to enter a Nickname(at User-details) for UserSearch,UserSearch deaktivated")); + msgBox->setInformativeText(tr("Sorry you have to enter a Nickname (at User-details) for UserSearch, UserSearch deactivated")); msgBox->setStandardButtons(QMessageBox::Ok); msgBox->setDefaultButton(QMessageBox::Ok); msgBox->setWindowModality(Qt::NonModal); @@ -195,7 +204,7 @@ if(Destination!=""){ clipboard->setText(Destination); QMessageBox::information(this, "", - tr("Your Destination is in the clipboard"),QMessageBox::Close); + tr("Your Destination has been copied to the clipboard"),QMessageBox::Close); } else QMessageBox::information(this, "", @@ -208,7 +217,7 @@ QMessageBox* msgBox= new QMessageBox(this); msgBox->setIcon(QMessageBox::Question); - msgBox->setText(tr("Closing I2P-Messenger")); + msgBox->setText(tr("I2P-Messenger")); msgBox->setInformativeText(tr("Are you sure ?")); msgBox->setStandardButtons(QMessageBox::Yes | QMessageBox::No); msgBox->setDefaultButton(QMessageBox::Yes); @@ -231,8 +240,8 @@ QMessageBox* msgBox= new QMessageBox(NULL); msgBox->setIcon(QMessageBox::Information); - msgBox->setText(""); - msgBox->setInformativeText(tr("Sorry a Filetransfer or Filerecive ist active,\nClosing aborted")); + msgBox->setText(tr("I2P-Messenger")); + msgBox->setInformativeText(tr("Sorry a File transfer or File receive is active,\nClosing aborted")); msgBox->setStandardButtons(QMessageBox::Ok); msgBox->setDefaultButton(QMessageBox::Ok); msgBox->setWindowModality(Qt::NonModal); @@ -548,26 +557,23 @@ void form_MainWindow::closeEvent(QCloseEvent *e) { - static bool firstTime = true; - if(applicationIsClosing==true) { - e->accept(); - QApplication::exit(0); - return; - } - if (trayIcon->isVisible()) { + static bool firstTime = true; if (firstTime) { -/***** - QMessageBox::information(this, tr("I2PChat System tray"), - tr("Application will continue running. Quit using context menu in the system tray")); -*****/ + +// QMessageBox::information(this, tr("I2PChat System tray"), +// tr("Application will continue running. Quit using context menu in the system tray")); firstTime = false; } hide(); e->ignore(); } - + + if(applicationIsClosing==true) { + e->accept(); + QApplication::exit(0); + } } void form_MainWindow::updateMenu() @@ -816,12 +822,21 @@ { QListWidgetItem* t=listWidget->item(listWidget->currentRow()+1); QString Destination =t->text(); - QString UserInfos=""; + QString UserInfos; + QPixmap avatar; + CUser* user; + user=Core->getUserManager()->getUserByI2P_Destination(Destination); UserInfos=Core->getUserManager()->getUserInfosByI2P_Destination(Destination); + avatar.loadFromData(user->getRecivedUserInfos().AvatarImage); + QMessageBox msgBox; - msgBox.setIcon(QMessageBox::Information); + if(avatar.isNull()==true){ + msgBox.setIcon(QMessageBox::Information); + }else{ + msgBox.setIconPixmap(avatar); + } msgBox.setText(""); msgBox.setInformativeText(UserInfos); msgBox.setStandardButtons(QMessageBox::Ok); @@ -883,7 +898,7 @@ CUser* User; User=Core->getUserManager()->getUserByI2P_Destination(Destination); if(User==NULL){ - qCritical()<<"form_MainWindow::openChatWindow"<<"try to open a Chatwindow,but the user don't exists"; + qCritical()<<"form_MainWindow::openChatWindow"<<"try to open a Chatwindow, but the user doesn't exist"; return; } @@ -986,20 +1001,16 @@ } void form_MainWindow::addUserToBlockList() -{ - CUser* User; - CUserBlockManager* BlockManager; - QString Destination; - +{ QListWidgetItem* t=listWidget->item(listWidget->currentRow()+2); if(t->text()=="U"){ //open Chatwindow t= listWidget->item(listWidget->currentRow()+1); - Destination =t->text(); + QString Destination =t->text(); - User=Core->getUserManager()->getUserByI2P_Destination(Destination); - BlockManager= Core->getUserBlockManager(); + CUser* User=Core->getUserManager()->getUserByI2P_Destination(Destination); + CUserBlockManager* BlockManager= Core->getUserBlockManager(); if(User!=NULL && BlockManager!=NULL){ BlockManager->addNewBlockEntity(User->getName(),Destination); @@ -1046,4 +1057,20 @@ mDebugWindow=NULL; } +void form_MainWindow::eventNicknameChanged() +{ + nicknamelabel->setText(Core->getUserInfos().Nickname); +} + +void form_MainWindow::eventAvatarImageChanged() +{ + if(Core->getUserInfos().AvatarImage.isEmpty()==false){ + QPixmap avatar; + avatar.loadFromData(Core->getUserInfos().AvatarImage); + avatar=avatar.scaled(avatarlabel->width(),avatarlabel->height(),Qt::KeepAspectRatio); + avatarlabel->setAlignment(Qt::AlignCenter); + avatarlabel->setPixmap(avatar); + } +} + \ No newline at end of file diff -Nru i2p-messenger-0.2.24/src/gui/form_Main.h i2p-messenger-0.2.25/src/gui/form_Main.h --- i2p-messenger-0.2.24/src/gui/form_Main.h 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/gui/form_Main.h 2014-12-26 20:46:32.000000000 +0000 @@ -73,6 +73,8 @@ void eventTryIconDoubleClicked(enum QSystemTrayIcon::ActivationReason Reason); void eventUserSearchWindowClosed(); void eventDebugWindowClosed(); + void eventAvatarImageChanged(); + void eventNicknameChanged(); private slots: //Windows @@ -85,6 +87,10 @@ void openFileReciveWindow(qint32 StreamID); void openFileSendWindow(qint32 StreamID); void openUserSearchWindow(); + + + + //Windows end void namingMe(); void copyDestination(); @@ -105,13 +111,17 @@ void onlineComboBoxChanged(); void toggleVisibility(QSystemTrayIcon::ActivationReason e); void toggleVisibilitycontextmenu(); - void OnlineStateChanged(); + void OnlineStateChanged(); + private: void initStyle(); void initTryIconMenu(); void initTryIcon(); void initToolBars(); + + + CCore* Core; bool applicationIsClosing; @@ -131,6 +141,8 @@ form_About* mAboutWindow; form_DebugMessages* mDebugWindow; + QByteArray avatarImageByteArray2; + bool Mute; }; diff -Nru i2p-messenger-0.2.24/src/gui/form_Main.ui i2p-messenger-0.2.25/src/gui/form_Main.ui --- i2p-messenger-0.2.24/src/gui/form_Main.ui 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/gui/form_Main.ui 2014-12-26 20:46:32.000000000 +0000 @@ -6,8 +6,8 @@ 0 0 - 233 - 427 + 237 + 459 @@ -21,8 +21,79 @@ - + + + 6 + + + 0 + + + 0 + + + + + + + QFrame::NoFrame + + + QFrame::Raised + + + + 6 + + + + + + 50 + 50 + + + + + 50 + 50 + + + + QLabel{ +border: 3px solid #CCCCCC; +border-radius: 10px; +} + + + + + + + + + + QComboBox::NoInsert + + + + + + + + 10 + + + + TextLabel + + + + + + + Qt::CustomContextMenu @@ -32,13 +103,6 @@ - - - - QComboBox::NoInsert - - - diff -Nru i2p-messenger-0.2.24/src/gui/form_newUser.cpp i2p-messenger-0.2.25/src/gui/form_newUser.cpp --- i2p-messenger-0.2.24/src/gui/form_newUser.cpp 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/gui/form_newUser.cpp 2014-12-26 20:46:32.000000000 +0000 @@ -52,50 +52,21 @@ return; } - if(I2PDestination.length()!=516 && I2PDestination.length() != 60) - { + if(Core.getUserManager()->validateI2PDestination(I2PDestination)==false){ + QMessageBox* msgBox= new QMessageBox(this); msgBox->setIcon(QMessageBox::Warning); msgBox->setText(tr("Adding User")); - msgBox->setInformativeText(tr("The Destination length must be 516(for B64) or 60(for B32)\nadding abborted")); + msgBox->setInformativeText(tr("The Destination isn't valid\nadding abborted")); msgBox->setStandardButtons(QMessageBox::Ok); msgBox->setDefaultButton(QMessageBox::Ok); msgBox->setWindowModality(Qt::NonModal); msgBox->show(); return; - } - - - if(I2PDestination.length() == 516){ - if(!I2PDestination.right(4).contains("AAAA",Qt::CaseInsensitive)){ - //the last 4 char must be "AAAA" - QMessageBox* msgBox= new QMessageBox(this); - msgBox->setIcon(QMessageBox::Warning); - msgBox->setText(tr("Adding User")); - msgBox->setInformativeText(tr("The Destination must end with AAAA\nadding abborted")); - msgBox->setStandardButtons(QMessageBox::Ok); - msgBox->setDefaultButton(QMessageBox::Ok); - msgBox->setWindowModality(Qt::NonModal); - msgBox->show(); - return; - } - }else{ - if(!I2PDestination.right(8).contains(".b32.i2p",Qt::CaseInsensitive)){ - QMessageBox* msgBox= new QMessageBox(this); - msgBox->setIcon(QMessageBox::Warning); - msgBox->setText(tr("Adding User")); - msgBox->setInformativeText(tr("The Destination must end with .b32.i2p\nadding abborted")); - msgBox->setStandardButtons(QMessageBox::Ok); - msgBox->setDefaultButton(QMessageBox::Ok); - msgBox->setWindowModality(Qt::NonModal); - msgBox->show(); - - return; - } } - + if(I2PDestination==Core.getMyDestination()) { @@ -128,7 +99,7 @@ QMessageBox* msgBox= new QMessageBox(NULL); msgBox->setIcon(QMessageBox::Warning); - msgBox->setInformativeText(tr("There allready exits one user with the same I2P - Destination")); + msgBox->setInformativeText(tr("There allready exits one user with the same Destination, adding aborted !")); msgBox->setStandardButtons(QMessageBox::Ok); msgBox->setDefaultButton(QMessageBox::Ok); msgBox->setWindowModality(Qt::NonModal); diff -Nru i2p-messenger-0.2.24/src/gui/form_newUser.ui i2p-messenger-0.2.25/src/gui/form_newUser.ui --- i2p-messenger-0.2.24/src/gui/form_newUser.ui 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/gui/form_newUser.ui 2014-12-26 20:46:32.000000000 +0000 @@ -104,7 +104,11 @@ - + + + Type here nickname + + diff -Nru i2p-messenger-0.2.24/src/gui/form_settingsgui.cpp i2p-messenger-0.2.25/src/gui/form_settingsgui.cpp --- i2p-messenger-0.2.24/src/gui/form_settingsgui.cpp 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/gui/form_settingsgui.cpp 2014-12-26 20:46:32.000000000 +0000 @@ -193,6 +193,9 @@ spinBox_9->setMinimum(0); spinBox_9->setValue(settings->value("outbound.quantity","1").toInt()); spinBox_9->setMaximum(3); + + comboBox_Signature->setEditable(false); + comboBox_Signature->setCurrentIndex(comboBox_Signature->findText(settings->value("SIGNATURE_TYPE","DSA_SHA1").toString())); settings->endGroup(); @@ -334,35 +337,6 @@ } void form_settingsgui::saveSettings() { - QString SessionOptionString; - QString temp; - - SessionOptionString="inbound.nickname="+lineEdit->text(); - - SessionOptionString+=" inbound.quantity="; - temp.setNum(spinBox_5->value()); - SessionOptionString+=temp; - - SessionOptionString+=" inbound.backupQuantity="; - temp.setNum(spinBox_6->value()); - SessionOptionString+=temp; - - SessionOptionString+=" inbound.length="; - temp.setNum(spinBox_4->value()); - SessionOptionString+=temp; - - SessionOptionString+=" outbound.quantity="; - temp.setNum(spinBox_9->value()); - SessionOptionString+=temp; - - SessionOptionString+=" outbound.backupQuantity="; - temp.setNum(spinBox_7->value()); - SessionOptionString+=temp; - - SessionOptionString+=" outbound.length="; - temp.setNum(spinBox_8->value()); - SessionOptionString+=temp; - settings->beginGroup("General"); settings->setValue("Debug_Max_Message_count",spinBox->value()); settings->setValue("Waittime_between_rechecking_offline_users",spinBox_3->value()*1000); @@ -387,8 +361,10 @@ settings->setValue("outbound.backupQuantity",spinBox_7->value()); settings->setValue("outbound.length",spinBox_8->value()); - settings->setValue("SessionOptionString",SessionOptionString); + //Signature_type + settings->setValue("SIGNATURE_TYPE",comboBox_Signature->currentText()); settings->endGroup(); + settings->beginGroup("Sound"); settings->beginGroup("Enable"); settings->setValue("User_go_Online",checkBoxSound->isChecked()); @@ -698,17 +674,10 @@ void form_settingsgui::showUserBlockList() { QTreeWidget* UserBlockTreeWidget= this->UserBlockTreeWidget; - QTreeWidgetItem *itemTopLevel; - QTreeWidgetItem *itemNickname; - QTreeWidgetItem *itemBlockDate; - QTreeWidgetItem *itemDestination; QMap UserBlockMap; UserBlockMap=mCore.getUserBlockManager()->getBlockList(); QMapIterator i(UserBlockMap); - - CUserBlockManager::CUserBlockEntity* currentEntity; - UserBlockTreeWidget->setColumnCount(2); UserBlockTreeWidget->setHeaderLabels(QStringList()<setText(0,currentEntity->mNickName); diff -Nru i2p-messenger-0.2.24/src/gui/form_settingsgui.h i2p-messenger-0.2.25/src/gui/form_settingsgui.h --- i2p-messenger-0.2.24/src/gui/form_settingsgui.h 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/gui/form_settingsgui.h 2014-12-26 20:46:32.000000000 +0000 @@ -89,5 +89,4 @@ void loadqss(); }; - #endif diff -Nru i2p-messenger-0.2.24/src/gui/form_settingsgui.ui i2p-messenger-0.2.25/src/gui/form_settingsgui.ui --- i2p-messenger-0.2.24/src/gui/form_settingsgui.ui 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/gui/form_settingsgui.ui 2014-12-26 20:46:32.000000000 +0000 @@ -113,6 +113,22 @@ 6 + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 16 + 25 + + + + @@ -138,21 +154,24 @@ - - - - Qt::Horizontal - - - QSizePolicy::Expanding + + + + + 75 + 24 + - + - 16 - 25 + 75 + 16777215 - + + Cancel + + @@ -170,25 +189,6 @@ - - - - - 75 - 24 - - - - - 75 - 16777215 - - - - Cancel - - - @@ -342,7 +342,7 @@ - 2 + 1 @@ -700,116 +700,6 @@ Tunnel - Options - - - - 10 - 160 - 401 - 121 - - - - Outbound - - - - - 10 - 20 - 271 - 95 - - - - - - - Length: - - - - - - - - - - Quantity: - - - - - - - - - - Backup Quantity: - - - - - - - - - - - - - 10 - 51 - 401 - 111 - - - - Inbound - - - - - 10 - 20 - 271 - 95 - - - - - - - Length: - - - - - - - - - - Quantity: - - - - - - - - - - Backup Quantity: - - - - - - - - - @@ -832,6 +722,117 @@ + + + + 10 + 60 + 391 + 102 + + + + + + + + + + + + + Backup Quantity: + + + + + + + Outbound + + + + + + + + + + + + + + + + + + + Length: + + + + + + + Quantity: + + + + + + + Inbound + + + + + + + + true + + + + 150 + 180 + 251 + 23 + + + + + DSA_SHA1 + + + + + ECDSA_SHA256_P256 + + + + + ECDSA_SHA384_P384 + + + + + ECDSA_SHA512_P521 + + + + + + + 10 + 180 + 148 + 27 + + + + Signaturetype + + diff -Nru i2p-messenger-0.2.24/src/gui/form_UserSearch.cpp i2p-messenger-0.2.25/src/gui/form_UserSearch.cpp --- i2p-messenger-0.2.24/src/gui/form_UserSearch.cpp 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/src/gui/form_UserSearch.cpp 2014-12-26 20:46:32.000000000 +0000 @@ -11,6 +11,8 @@ treeWidget_SearchResults->setColumnCount(2); treeWidget_SearchResults->setHeaderLabels(QStringList()<setContextMenuPolicy(Qt::CustomContextMenu); + treeWidget_SearchResults->setColumnWidth(0,250); + treeWidget_SearchResults->setColumnWidth(1,250); slot_onlineStateChanged(); @@ -86,27 +88,17 @@ mSearchResults=SearchResults; treeWidget_SearchResults->clear(); - QTreeWidgetItem *itemTopLevel; - QTreeWidgetItem *itemNickname; - QTreeWidgetItem *itemAge; - QTreeWidgetItem *itemGender; - QTreeWidgetItem *itemInterests; - QTreeWidgetItem *itemTTL; - QTreeWidgetItem *itemB32Dest; - - label_ResultCount->setText(QString::number(SearchResults.count())); - for(int i=0;isetText(0,currentResult.NickName); diff -Nru i2p-messenger-0.2.24/Unix_build.sh i2p-messenger-0.2.25/Unix_build.sh --- i2p-messenger-0.2.24/Unix_build.sh 2013-04-28 01:49:45.000000000 +0000 +++ i2p-messenger-0.2.25/Unix_build.sh 2014-12-26 20:46:32.000000000 +0000 @@ -3,7 +3,7 @@ COUNT=$(cat /proc/cpuinfo | grep 'model name' | sed -e 's/.*: //' | wc -l) - echo "\nCompiling - Script(Unix/Linux) for I2P-Messenger v.03" + echo "\nCompiling - Script(Unix/Linux) for I2P-Messenger v.04" echo "\n\nNeeded software:" echo "\t QT4" echo "\t QT4-devs" @@ -49,6 +49,7 @@ ${make_qt} I2P-Messenger_release.pro make -j $COUNT mv I2P-Messenger_release I2P-Messenger + strip I2P-Messenger else echo "Select a option:" echo "\t--R vor Release"