mirror of
https://github.com/ChronosX88/Influence-cjdns.git
synced 2024-11-08 08:51:00 +00:00
Now the application does not start if it does not find ip, which starts with "fc" (ie, before starting the messenger, you need to run the cjdns daemon)
This commit is contained in:
parent
3b58f486ec
commit
5231302217
@ -37,11 +37,19 @@ void Network::processTheDatagram()
|
||||
QString Network::localIPv6()
|
||||
{
|
||||
QHostAddress address;
|
||||
QString addressString;
|
||||
foreach (address, QNetworkInterface::allAddresses()) {
|
||||
if (address.protocol() == QAbstractSocket::IPv6Protocol && address != QHostAddress(QHostAddress::LocalHostIPv6) && (address.toString()).contains("fc"))
|
||||
break;
|
||||
{
|
||||
addressString = address.toString();
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
addressString = "null";
|
||||
}
|
||||
}
|
||||
return(address.toString());
|
||||
return(addressString);
|
||||
}
|
||||
|
||||
Network::~Network()
|
||||
|
@ -5,6 +5,10 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
MainWindow w;
|
||||
if(w.doQuit())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
w.show();
|
||||
|
||||
return a.exec();
|
||||
|
@ -5,8 +5,13 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::MainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
network = new Network(false);
|
||||
if(*network->myIPv6 == "null")
|
||||
{
|
||||
QMessageBox::critical(parent, tr("Cjdns is not running!"), tr("Cjdns is not running, so the application will be closed."));
|
||||
mDoQuit = true;
|
||||
}
|
||||
ui->setupUi(this);
|
||||
handler = new Handler();
|
||||
timer = new QTimer();
|
||||
connect(timer, SIGNAL(timeout()), this, SLOT(slotTimerAlarm()));
|
||||
|
@ -25,6 +25,7 @@ class MainWindow : public QMainWindow
|
||||
QVector<ChatWindow*> pChatWindows;
|
||||
void setButtonToWaiting();
|
||||
void setButtonToConnect();
|
||||
inline bool doQuit() const { return mDoQuit; }
|
||||
public slots:
|
||||
void peerReceiverAvailable();
|
||||
private slots:
|
||||
@ -42,4 +43,5 @@ class MainWindow : public QMainWindow
|
||||
Network *network;
|
||||
Handler *handler;
|
||||
bool receive = false;
|
||||
bool mDoQuit = false;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user