Commit 8abd08b0 authored by fred's avatar fred

added the xmpp port to connect to the xmpp server

parent 7ac40f25
......@@ -40,7 +40,8 @@ MainWindow::MainWindow(QWidget *parent) :
if (settings->value("server").toString() != "") ui->lineEdit_server->setText(settings->value("server").toString());
if (settings->value("port").toString() != "") ui->spinBox_port->setValue(settings->value("port").toInt());
if (settings->value("http_port").toString() != "") ui->http_spinBox_port->setValue(settings->value("http_port").toInt());
if (settings->value("xmpp_port").toString() != "") ui->xmpp_spinBox_port->setValue(settings->value("xmpp_port").toInt());
ui->lineEdit_login->setText(settings->value("login").toString());
......@@ -52,10 +53,11 @@ MainWindow::MainWindow(QWidget *parent) :
m_push->m_credentials = settings->value("login").toString()+":"+settings->value("password").toString();
m_push->m_server = settings->value("server").toString();
m_push->m_port = settings->value("port").toString();
m_push->m_http_port = settings->value("http_port").toString();
m_push->m_uuid = settings->value("uuid").toString();
m_push->m_xmpp_client->m_xmpp_port = settings->value("xmpp_port").toInt();
m_push->m_xmpp_client->m_jid = settings->value("pub_uuid").toString() + "@" + settings->value("server").toString();;
m_push->m_xmpp_client->m_password = settings->value("uuid").toString();
m_push->m_xmpp_client->connection();
......@@ -483,8 +485,14 @@ void MainWindow::push_data()
}
void MainWindow::on_spinBox_port_valueChanged(int port)
void MainWindow::on_http_spinBox_port_valueChanged(int port)
{
settings->setValue("port", QString::number(port));
m_push->m_port = QString::number(port);
settings->setValue("http_port", QString::number(port));
m_push->m_http_port = QString::number(port);
}
void MainWindow::on_xmpp_spinBox_port_valueChanged(int port)
{
settings->setValue("xmpp_port", QString::number(port));
//m_push->m_xmpp_port = QString::number(port);
}
......@@ -95,7 +95,8 @@ private slots:
void on_pushButton_xmpp_clicked();
void on_xmpp_connected(bool connected);
void push_data();
void on_spinBox_port_valueChanged(int port);
void on_http_spinBox_port_valueChanged(int port);
void on_xmpp_spinBox_port_valueChanged(int port);
};
#endif // MAINWINDOW_H
......@@ -40,96 +40,113 @@
</property>
</widget>
</item>
<item row="2" column="0">
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>HTTP port</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="http_spinBox_port">
<property name="maximum">
<number>9999</number>
</property>
<property name="value">
<number>80</number>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_login">
<property name="text">
<string>email</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="3" column="1">
<widget class="QLineEdit" name="lineEdit_login"/>
</item>
<item row="3" column="0">
<item row="4" column="0">
<widget class="QLabel" name="label_password">
<property name="text">
<string>API key</string>
</property>
</widget>
</item>
<item row="3" column="1">
<item row="4" column="1">
<widget class="QLineEdit" name="lineEdit_password">
<property name="echoMode">
<enum>QLineEdit::Normal</enum>
</property>
</widget>
</item>
<item row="5" column="0">
<item row="6" column="0">
<widget class="QLabel" name="label_uuid">
<property name="text">
<string>private host UUID</string>
</property>
</widget>
</item>
<item row="5" column="1">
<item row="6" column="1">
<widget class="QLineEdit" name="lineEdit_uuid">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
<item row="6" column="0">
<item row="7" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Public host</string>
</property>
</widget>
</item>
<item row="6" column="1">
<item row="7" column="1">
<widget class="QCheckBox" name="checkBox_public_host">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="7" column="0">
<item row="8" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Profil</string>
</property>
</widget>
</item>
<item row="7" column="1">
<item row="8" column="1">
<widget class="QComboBox" name="comboBox_profil"/>
</item>
<item row="8" column="0">
<item row="9" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Refresh rate (minutes)</string>
</property>
</widget>
</item>
<item row="8" column="1">
<item row="9" column="1">
<widget class="QSpinBox" name="spinBox_refresh">
<property name="minimum">
<number>5</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<item row="2" column="0">
<widget class="QLabel" name="xMPPPortLabel">
<property name="text">
<string>port</string>
<string>XMPP port</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="spinBox_port">
<item row="2" column="1">
<widget class="QSpinBox" name="xmpp_spinBox_port">
<property name="maximum">
<number>9999</number>
<number>10000</number>
</property>
<property name="value">
<number>80</number>
<number>5222</number>
</property>
</widget>
</item>
......
......@@ -68,7 +68,7 @@ void Push::Payload_http(QVariantMap *ldatas, QMutex *m_pushdatas_mutex) {
if (m_uuid != "")
{
// UPDATE
url.setUrl("http://" + m_server + ":" + m_port + "/host/update/" + m_uuid);
url.setUrl("http://" + m_server + ":" + m_http_port + "/host/update/" + m_uuid);
//url.setUrl(m_server + "/host/update/");
qDebug() << "PAYLOAD UPDATE" << m_uuid << " SERVER : " << m_server << "pass : " << m_credentials;
m_request.setUrl(url);
......@@ -80,7 +80,7 @@ void Push::Payload_http(QVariantMap *ldatas, QMutex *m_pushdatas_mutex) {
// CREATE
qDebug() << "PAYLOAD CREATE" << m_uuid << " SERVER : " << m_server;
//url.setUrl("http://127.0.0.1:3000/hosts.xml");
url.setUrl("http://" + m_server + ":" + m_port + "/host/create");
url.setUrl("http://" + m_server + ":" + m_http_port + "/host/create");
m_request.setUrl(url);
m_reply = m_network->post(m_request, json.toUtf8().toBase64());
......
......@@ -43,7 +43,7 @@ public:
void Payload_xmpp(QVariantMap *ldatas, QMutex *a_mutex);
QString m_credentials;
QString m_server;
QString m_port;
QString m_http_port;
QString m_uuid;
QString m_pub_uuid;
QString m_jid;
......
......@@ -75,6 +75,7 @@ Xmpp_client::~Xmpp_client()
void Xmpp_client::connection()
{
this->configuration().setPort(m_xmpp_port);
this->configuration().setJid(m_jid);
this->configuration().setPassword(m_password);
this->configuration().setResource("geekast");
......
......@@ -41,6 +41,7 @@ public:
QString m_uuid;
QString m_pub_uuid;
bool m_connected;
int m_xmpp_port;
QString m_jid;
QString m_password;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment