summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--interchange/member.hxx3
-rw-r--r--member.cxx23
2 files changed, 25 insertions, 1 deletions
diff --git a/interchange/member.hxx b/interchange/member.hxx
index bd569c6..c75c7a3 100644
--- a/interchange/member.hxx
+++ b/interchange/member.hxx
@@ -99,6 +99,9 @@ namespace QInterchange {
void setEmail(QString const& email);
public slots:
+ void newAccount(QString const& username,
+ QString const& password,
+ QString const& confirm);
void logIn(QString const& username, QString const& password);
void account(QString const& firstName, QString const& lastName,
QString const& address1, QString const& address2,
diff --git a/member.cxx b/member.cxx
index ee05be8..ab772d0 100644
--- a/member.cxx
+++ b/member.cxx
@@ -4,7 +4,28 @@
namespace QInterchange {
- static char *unCopy, *pwCopy;
+ static char *unCopy, *pwCopy, *cfCopy;
+
+ void Member::newAccount(QString const& username,
+ QString const& password, QString const& confirm)
+ {
+ 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);
+ auto cfData = confirm.toLatin1().constData();
+ cfCopy = (char*)malloc(strlen(cfData) + 1);
+ strcpy(cfCopy, cfData);
+ interchange_member_newaccount(unCopy, pwCopy, cfCopy,
+ [](interchange_response* response) {
+ free(unCopy);
+ free(pwCopy);
+ free(cfCopy);
+ interchange_free_response(response);
+ }, nullptr);
+ }
void Member::logIn(QString const& username, QString const& password)
{