summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
m---------libicclient0
-rw-r--r--member.cxx231
-rw-r--r--qicclient/member.hxx5
3 files changed, 94 insertions, 142 deletions
diff --git a/libicclient b/libicclient
-Subproject 3f5ece56ba0aa55be5c6a7973866ffda432de1c
+Subproject 345d1a62fcf5ac82189196c74b3d5e40c6d08df
diff --git a/member.cxx b/member.cxx
index 1652f52..439f205 100644
--- a/member.cxx
+++ b/member.cxx
@@ -9,145 +9,18 @@ namespace QICClient {
QString const& failPage,
size_t (*handler)(void*, size_t, size_t, void*))
{
- m_data = icclient_member_login(username.toLatin1().constData(),
- password.toLatin1().constData(),
- successPage.toLatin1().constData(),
- nextPage.toLatin1().constData(),
- failPage.toLatin1().constData(),
- handler);
- if (m_data->username && m_userName != m_data->username) {
- m_userName = QString{m_data->username};
- emit userNameChanged();
- } else if (m_userName != "") {
- m_userName = "";
- emit userNameChanged();
- }
- if (m_data->usernick && m_userNick != m_data->usernick) {
- m_userNick = QString{m_data->usernick};
- emit userNickChanged();
- } else if (m_userNick != "") {
- m_userNick = "";
- emit userNickChanged();
- }
- if (m_data->password && m_password != m_data->password) {
- m_password = QString{m_data->password};
- emit passwordChanged();
- } else if (m_password != "") {
- m_password = "";
- emit passwordChanged();
- }
- if (m_data->expiration && m_expiration != m_data->expiration) {
- m_expiration = QString{m_data->expiration};
- emit expirationChanged();
- } else if (m_expiration != "") {
- m_expiration = "";
- emit expirationChanged();
- }
- if (m_data->acl && m_acl != m_data->acl) {
- m_acl = QString{m_data->acl};
- emit aclChanged();
- } else if (m_acl != "") {
- m_acl = "";
- emit aclChanged();
- }
- if (m_data->mod_time && m_modTime != m_data->mod_time) {
- m_modTime = QString{m_data->mod_time};
- emit modTimeChanged();
- } else if (m_modTime != "") {
- m_modTime = "";
- emit modTimeChanged();
- }
- if (m_data->s_nickname && m_sNickName != m_data->s_nickname) {
- m_sNickName = QString{m_data->s_nickname};
- emit sNickNameChanged();
- } else if (m_sNickName != "") {
- m_sNickName = "";
- emit sNickNameChanged();
- }
- if (m_data->company && m_company != m_data->company) {
- m_company = QString{m_data->company};
- emit companyChanged();
- } else if (m_company != "") {
- m_company = "";
- emit companyChanged();
- }
- if (m_data->fname && m_fName != m_data->fname) {
- m_fName = QString{m_data->fname};
- emit fNameChanged();
- } else if (m_fName != "") {
- m_fName = "";
- emit fNameChanged();
- }
- if (m_data->lname && m_lName != m_data->lname) {
- m_lName = QString{m_data->lname};
- emit lNameChanged();
- } else if (m_lName != "") {
- m_lName = "";
- emit lNameChanged();
- }
- if (m_data->address1 && m_address1 != m_data->address1) {
- m_address1 = QString{m_data->address1};
- emit address1Changed();
- } else if (m_address1 != "") {
- m_address1 = "";
- emit address1Changed();
- }
- if (m_data->address2 && m_address2 != m_data->address2) {
- m_address2 = QString{m_data->address2};
- emit address2Changed();
- } else if (m_address2 != "") {
- m_address2 = "";
- emit address2Changed();
- }
- if (m_data->address3 && m_address3 != m_data->address3) {
- m_address3 = QString{m_data->address3};
- emit address3Changed();
- } else if (m_address3 != "") {
- m_address3 = "";
- emit address3Changed();
- }
- if (m_data->city && m_city != m_data->city) {
- m_city = QString{m_data->city};
- emit cityChanged();
- } else if (m_city != "") {
- m_city = "";
- emit cityChanged();
- }
- if (m_data->state && m_state != m_data->state) {
- m_state = QString{m_data->state};
- emit stateChanged();
- } else if (m_state != "") {
- m_state = "";
- emit stateChanged();
- }
- if (m_data->zip && m_zip != m_data->zip) {
- m_zip = QString{m_data->zip};
- emit zipChanged();
- } else if (m_zip != "") {
- m_zip = "";
- emit zipChanged();
- }
- if (m_data->country && m_country != m_data->country) {
- m_country = QString{m_data->country};
- emit countryChanged();
- } else if (m_country != "") {
- m_country = "";
- emit countryChanged();
- }
- if (m_data->phone_day && m_phoneDay != m_data->phone_day) {
- m_phoneDay = QString{m_data->phone_day};
- emit phoneDayChanged();
- } else if (m_phoneDay != "") {
- m_phoneDay = "";
- emit phoneDayChanged();
- }
- if (m_data->email && m_email != m_data->email) {
- m_email = QString{m_data->email};
- emit emailChanged();
- } else if (m_email != "") {
- m_email = "";
- emit emailChanged();
- }
+ setData(icclient_member_login(username.toLatin1().constData(),
+ password.toLatin1().constData(),
+ successPage.toLatin1().constData(),
+ nextPage.toLatin1().constData(),
+ failPage.toLatin1().constData(),
+ handler));
+ }
+
+ void Member::logOut()
+ {
+ icclient_member_logout(m_data);
+ setData(nullptr);
}
void Member::setUserName(QString const& userName)
@@ -302,9 +175,85 @@ namespace QICClient {
}
}
- void Member::logOut()
+ void Member::setData(icclient_member* data)
{
- icclient_member_logout(m_data);
+ if (m_data != data) m_data = data;
+ if (m_data && m_data->username && m_userName != m_data->username) {
+ m_userName = QString{m_data->username};
+ emit userNameChanged();
+ } else setUserName("");
+ if (m_data && m_data->usernick && m_userNick != m_data->usernick) {
+ m_userNick = QString{m_data->usernick};
+ emit userNickChanged();
+ } else setUserNick("");
+ if (m_data && m_data->password && m_password != m_data->password) {
+ m_password = QString{m_data->password};
+ emit passwordChanged();
+ } else setPassword("");
+ if (m_data && m_data->expiration && m_expiration != m_data->expiration) {
+ m_expiration = QString{m_data->expiration};
+ emit expirationChanged();
+ } else setExpiration("");
+ if (m_data && m_data->acl && m_acl != m_data->acl) {
+ m_acl = QString{m_data->acl};
+ emit aclChanged();
+ } else setAcl("");
+ if (m_data && m_data->mod_time && m_modTime != m_data->mod_time) {
+ m_modTime = QString{m_data->mod_time};
+ emit modTimeChanged();
+ } else setModTime("");
+ if (m_data && m_data->s_nickname && m_sNickName != m_data->s_nickname) {
+ m_sNickName = QString{m_data->s_nickname};
+ emit sNickNameChanged();
+ } else setSNickName("");
+ if (m_data && m_data->company && m_company != m_data->company) {
+ m_company = QString{m_data->company};
+ emit companyChanged();
+ } else setCompany("");
+ if (m_data && m_data->fname && m_fName != m_data->fname) {
+ m_fName = QString{m_data->fname};
+ emit fNameChanged();
+ } else setFName("");
+ if (m_data && m_data->lname && m_lName != m_data->lname) {
+ m_lName = QString{m_data->lname};
+ emit lNameChanged();
+ } else setLName("");
+ if (m_data && m_data->address1 && m_address1 != m_data->address1) {
+ m_address1 = QString{m_data->address1};
+ emit address1Changed();
+ } else setAddress1("");
+ if (m_data && m_data->address2 && m_address2 != m_data->address2) {
+ m_address2 = QString{m_data->address2};
+ emit address2Changed();
+ } else setAddress2("");
+ if (m_data && m_data->address3 && m_address3 != m_data->address3) {
+ m_address3 = QString{m_data->address3};
+ emit address3Changed();
+ } else setAddress3("");
+ if (m_data && m_data->city && m_city != m_data->city) {
+ m_city = QString{m_data->city};
+ emit cityChanged();
+ } else setCity("");
+ if (m_data && m_data->state && m_state != m_data->state) {
+ m_state = QString{m_data->state};
+ emit stateChanged();
+ } else setState("");
+ if (m_data && m_data->zip && m_zip != m_data->zip) {
+ m_zip = QString{m_data->zip};
+ emit zipChanged();
+ } else setZip("");
+ if (m_data && m_data->country && m_country != m_data->country) {
+ m_country = QString{m_data->country};
+ emit countryChanged();
+ } else setCountry("");
+ if (m_data && m_data->phone_day && m_phoneDay != m_data->phone_day) {
+ m_phoneDay = QString{m_data->phone_day};
+ emit phoneDayChanged();
+ } else setPhoneDay("");
+ if (m_data && m_data->email && m_email != m_data->email) {
+ m_email = QString{m_data->email};
+ emit emailChanged();
+ } else setEmail("");
}
}
diff --git a/qicclient/member.hxx b/qicclient/member.hxx
index b81d4ea..631a8aa 100644
--- a/qicclient/member.hxx
+++ b/qicclient/member.hxx
@@ -75,7 +75,6 @@ namespace QICClient {
void changePassword(QString const& passwordOld,
QString const& password,
QString const& verify) {}
- void logOut();
QString const& userName() const { return m_userName; }
QString const& userNick() const { return m_userNick; }
@@ -117,6 +116,9 @@ namespace QICClient {
void setPhoneDay(QString const& phoneDay);
void setEmail(QString const& email);
+ public slots:
+ void logOut();
+
signals:
void userNameChanged();
void userNickChanged();
@@ -159,6 +161,7 @@ namespace QICClient {
QString m_phoneDay;
QString m_email;
icclient_member* m_data;
+ void setData(icclient_member* data);
};
}