summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2023-01-16 13:39:09 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2023-01-16 13:39:09 +0800
commit3b19e10342400cd26a8d60bc525a197c27b8514c (patch)
tree7c4505587c1263dc58b698b517eda5f60614dbfc
parentfa5129b1b4443c948c998f8eeb6dd191cf2a549e (diff)
Emits response when attempting to log in
-rw-r--r--interchange/member.hxx31
-rw-r--r--member.cxx33
2 files changed, 40 insertions, 24 deletions
diff --git a/interchange/member.hxx b/interchange/member.hxx
index 2cd9c49..1760860 100644
--- a/interchange/member.hxx
+++ b/interchange/member.hxx
@@ -32,29 +32,7 @@ namespace QInterchange {
Q_PROPERTY(QString email READ email WRITE setEmail NOTIFY emailChanged)
public:
- explicit Member(QObject* parent = nullptr) :
- QObject{parent},
- m_userName{""},
- m_userNick{""},
- m_password{""},
- m_expiration{""},
- m_acl{""},
- m_modTime{""},
- m_sNickName{""},
- m_company{""},
- m_fName{""},
- m_lName{""},
- m_address1{""},
- m_address2{""},
- m_address3{""},
- m_city{""},
- m_state{""},
- m_zip{""},
- m_country{""},
- m_phoneDay{""},
- m_email{""},
- m_data{nullptr}
- {}
+ Member(QObject* parent = nullptr);
~Member() {}
QString const& userName() const { return m_userName; }
@@ -97,6 +75,7 @@ namespace QInterchange {
void setCountry(QString const& country);
void setPhoneDay(QString const& phoneDay);
void setEmail(QString const& email);
+ void setData(interchange_member* data);
public slots:
void newAccount(QString const& username,
@@ -106,6 +85,7 @@ namespace QInterchange {
void logIn(QString const& username,
QString const& password,
QString const& failPage = nullptr);
+
void account(QString const& firstName, QString const& lastName,
QString const& address1, QString const& address2,
QString const& city, QString const& state,
@@ -116,6 +96,7 @@ namespace QInterchange {
void logOut();
signals:
+ void loggedIn(QString const& response);
void userNameChanged();
void userNickChanged();
void passwordChanged();
@@ -136,6 +117,9 @@ namespace QInterchange {
void phoneDayChanged();
void emailChanged();
+ protected:
+ void emitLogin(QString const& response);
+
private:
QString m_userName;
QString m_userNick;
@@ -157,7 +141,6 @@ namespace QInterchange {
QString m_phoneDay;
QString m_email;
interchange_member* m_data;
- inline void setData(interchange_member* data);
};
}
diff --git a/member.cxx b/member.cxx
index c38dc32..610d7f0 100644
--- a/member.cxx
+++ b/member.cxx
@@ -4,8 +4,35 @@
namespace QInterchange {
+ static Member* member;
static char *unCopy, *pwCopy, *vCopy, *fpCopy;
+ Member::Member(QObject* parent) :
+ QObject{parent},
+ m_userName{""},
+ m_userNick{""},
+ m_password{""},
+ m_expiration{""},
+ m_acl{""},
+ m_modTime{""},
+ m_sNickName{""},
+ m_company{""},
+ m_fName{""},
+ m_lName{""},
+ m_address1{""},
+ m_address2{""},
+ m_address3{""},
+ m_city{""},
+ m_state{""},
+ m_zip{""},
+ m_country{""},
+ m_phoneDay{""},
+ m_email{""},
+ m_data{nullptr}
+ {
+ member = this;
+ }
+
void Member::newAccount(QString const& username,
QString const& password, QString const& verify,
QString const& failPage)
@@ -49,6 +76,7 @@ namespace QInterchange {
free(unCopy);
free(pwCopy);
free(fpCopy);
+ member->emitLogin(QString{response->data});
interchange_free_response(response);
}, nullptr);
}
@@ -333,4 +361,9 @@ namespace QInterchange {
setData(nullptr);
}
+ void Member::emitLogin(QString const& response)
+ {
+ emit loggedIn(response);
+ }
+
}