summaryrefslogtreecommitdiffstats
path: root/pica-client
diff options
context:
space:
mode:
authorAnton <anton@picapica>2018-07-03 17:07:10 +0400
committerAnton <anton@picapica>2018-07-03 17:07:10 +0400
commitcb2b4d833d4852a3e54cdb2394422ad7aeb24166 (patch)
treef500e0c11e983b19fb98001b37ea884b845a312b /pica-client
parentd154f1f79ddce2bdccc0c600251c5e2e7df3d14f (diff)
downloadpica-pica-cb2b4d833d4852a3e54cdb2394422ad7aeb24166.tar.gz
pica-pica-cb2b4d833d4852a3e54cdb2394422ad7aeb24166.zip
add multilogin policy to protocol and client settings
Diffstat (limited to 'pica-client')
-rw-r--r--pica-client/dialogs/settingsdialog.cpp13
-rw-r--r--pica-client/skynet.cpp6
2 files changed, 11 insertions, 8 deletions
diff --git a/pica-client/dialogs/settingsdialog.cpp b/pica-client/dialogs/settingsdialog.cpp
index 287569d..6850f5e 100644
--- a/pica-client/dialogs/settingsdialog.cpp
+++ b/pica-client/dialogs/settingsdialog.cpp
@@ -2,6 +2,7 @@
#include "../settings.h"
#include "../globals.h"
#include "../../PICA_netconf.h"
+#include "../../PICA_proto.h"
#include <QGroupBox>
#include <QVBoxLayout>
@@ -216,15 +217,15 @@ void SettingsDialog::loadSettings()
switch(mlpstate)
{
- case 0:
+ case PICA_MULTILOGIN_PROHIBIT:
rbMLPProhibit->setChecked(true);
break;
- case 1:
+ case PICA_MULTILOGIN_REPLACE:
rbMLPReplace->setChecked(true);
break;
- case 2:
+ case PICA_MULTILOGIN_ALLOW:
rbMLPAllowMultiple->setChecked(true);
break;
@@ -262,11 +263,11 @@ void SettingsDialog::storeSettings()
int mlpstate;
if (rbMLPProhibit->isChecked())
- mlpstate = 0;
+ mlpstate = PICA_MULTILOGIN_PROHIBIT;
else if (rbMLPReplace->isChecked())
- mlpstate = 1;
+ mlpstate = PICA_MULTILOGIN_REPLACE;
else if (rbMLPAllowMultiple->isChecked())
- mlpstate = 2;
+ mlpstate = PICA_MULTILOGIN_ALLOW;
st.storeValue("multiple_logins.state", QString::number(mlpstate));
}
diff --git a/pica-client/skynet.cpp b/pica-client/skynet.cpp
index d2abb64..9092cc0 100644
--- a/pica-client/skynet.cpp
+++ b/pica-client/skynet.cpp
@@ -322,6 +322,7 @@ bool SkyNet::open_account()
void SkyNet::Join(Accounts::AccountRecord &accrec)
{
PICA_directc2c_config directc2c_cfg = PICA_DIRECTC2C_CFG_DISABLED;
+ int multilogin = PICA_MULTILOGIN_PROHIBIT;
Settings st(config_dbname);
skynet_account = accrec;
@@ -341,6 +342,7 @@ void SkyNet::Join(Accounts::AccountRecord &accrec)
}
directc2c_cfg = (PICA_directc2c_config)st.loadValue("direct_c2c.state", 1).toInt();
+ multilogin = st.loadValue("multiple_logins.state", PICA_MULTILOGIN_PROHIBIT).toInt();
if (!listener && directc2c_cfg == PICA_DIRECTC2C_CFG_ALLOWINCOMING)
{
@@ -373,7 +375,7 @@ void SkyNet::Join(Accounts::AccountRecord &accrec)
}
int ret = PICA_new_listener(acc,
- public_addr.toAscii().constData(),
+ public_addr.toAscii().constData(),
pub_port,
loc_port, &listener);
if (ret != PICA_OK)
@@ -397,7 +399,7 @@ void SkyNet::Join(Accounts::AccountRecord &accrec)
struct PICA_c2n *c2n = NULL;
ret = PICA_new_c2n(acc, noderecords[i].address.toUtf8().constData(), noderecords[i].port,
- directc2c_cfg, listener, &c2n);
+ directc2c_cfg, multilogin, listener, &c2n);
if (ret == PICA_OK)
{