summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--admin.cxx15
-rw-r--r--member.cxx15
2 files changed, 28 insertions, 2 deletions
diff --git a/admin.cxx b/admin.cxx
index b391ff8..2cbd7ae 100644
--- a/admin.cxx
+++ b/admin.cxx
@@ -1,11 +1,24 @@
+#include <icclient.h>
#include <icclient/admin.h>
#include "qicclient/admin.hxx"
namespace QICClient {
+ static char *unCopy, *pwCopy;
+
void Admin::logIn(QString const& username, QString const& password)
{
- icclient_admin_login(username.toLatin1().constData(), password.toLatin1().constData(), nullptr, nullptr);
+ auto unData = username.toLatin1().constData();
+ unCopy = (char*)malloc(strlen(unData) + 1);
+ strcpy(unCopy, unData);
+ auto pwData = password.toLatin1().constData();
+ pwCopy = (char*)malloc(strlen(pwData) + 1);
+ strcpy(pwCopy, pwData);
+ icclient_admin_login(unCopy, pwCopy, [](icclient_response* response) {
+ free(unCopy);
+ free(pwCopy);
+ icclient_free_response(response);
+ }, nullptr);
}
void Admin::setUserName(QString const& userName)
diff --git a/member.cxx b/member.cxx
index da5c529..fb473ea 100644
--- a/member.cxx
+++ b/member.cxx
@@ -1,11 +1,24 @@
+#include <icclient.h>
#include <icclient/member.h>
#include "qicclient/member.hxx"
namespace QICClient {
+ static char *unCopy, *pwCopy;
+
void Member::logIn(QString const& username, QString const& password)
{
- icclient_member_login(username.toLatin1().constData(), password.toLatin1().constData(), nullptr, nullptr);
+ auto unData = username.toLatin1().constData();
+ unCopy = (char*)malloc(strlen(unData) + 1);
+ strcpy(unCopy, unData);
+ auto pwData = password.toLatin1().constData();
+ pwCopy = (char*)malloc(strlen(pwData) + 1);
+ strcpy(pwCopy, pwData);
+ icclient_member_login(unCopy, pwCopy, [](icclient_response* response) {
+ free(unCopy);
+ free(pwCopy);
+ icclient_free_response(response);
+ }, nullptr);
}
void Member::setUserName(QString const& userName)