summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/JabberG/src/jabber_opt.cpp22
-rw-r--r--protocols/JabberG/src/jabber_proto.h1
-rw-r--r--protocols/JabberG/src/jabber_thread.cpp39
3 files changed, 37 insertions, 25 deletions
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp
index 7755e0bfca..e76dd082e2 100644
--- a/protocols/JabberG/src/jabber_opt.cpp
+++ b/protocols/JabberG/src/jabber_opt.cpp
@@ -541,17 +541,6 @@ private:
void btnRegister_OnClick(CCtrlButton *)
{
- CMString buf;
- TCHAR pass[512];
- if (!m_proto->EnterString(buf, TranslateT("Confirm password"), ESF_PASSWORD))
- return;
-
- m_txtPassword.GetText(pass, _countof(pass));
- if (mir_tstrcmp(buf, pass)) {
- MessageBox(m_hwnd, TranslateT("Passwords do not match."), _T("Miranda NG"), MB_ICONSTOP|MB_OK);
- return;
- }
-
PSHNOTIFY pshn = {0};
pshn.hdr.code = PSN_APPLY;
pshn.hdr.hwndFrom = m_hwnd;
@@ -1795,17 +1784,6 @@ private:
void btnRegister_OnClick(CCtrlButton *)
{
- CMString buf;
- if (!m_proto->EnterString(buf, TranslateT("Confirm password"), ESF_PASSWORD))
- return;
-
- TCHAR pass[512];
- m_txtPassword.GetText(pass, _countof(pass));
- if (mir_tstrcmp(buf, pass)) {
- MessageBox(m_hwnd, TranslateT("Passwords do not match."), _T("Miranda NG"), MB_ICONSTOP|MB_OK);
- return;
- }
-
PSHNOTIFY pshn = {0};
pshn.hdr.code = PSN_APPLY;
pshn.hdr.hwndFrom = m_hwnd;
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h
index 1f0ee12510..80070ab9db 100644
--- a/protocols/JabberG/src/jabber_proto.h
+++ b/protocols/JabberG/src/jabber_proto.h
@@ -731,6 +731,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
BOOL OnProcessJingle(HXML node);
void OnProcessIq(HXML node);
+ void SetRegConfig(HXML node, void *from);
void OnProcessRegIq(HXML node, ThreadData *info);
void OnPingReply(HXML node, CJabberIqInfo *pInfo);
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp
index e02a190684..34e1f98944 100644
--- a/protocols/JabberG/src/jabber_thread.cpp
+++ b/protocols/JabberG/src/jabber_thread.cpp
@@ -1831,16 +1831,49 @@ void CJabberProto::OnProcessIq(HXML node)
}
}
-void CJabberProto::OnProcessRegIq(HXML node, ThreadData *info)
+ThreadData *m_regInfo;
+void CJabberProto::SetRegConfig(HXML node, void *from)
{
- const TCHAR *type;
+ if (m_regInfo && from) {
+ TCHAR text[MAX_PATH];
+ mir_sntprintf(text, MAX_PATH, _T("%s@%S"), m_regInfo->conn.username, m_regInfo->conn.server);
+ XmlNodeIq iq(_T("set"), SerialNext(), (TCHAR*)from);
+ iq << XATTR(_T("from"), text);
+ HXML query = iq << XQUERY(JABBER_FEAT_REGISTER);
+ XmlAddChild(query, node);
+ m_regInfo->send(iq);
+ }
+}
+void CJabberProto::OnProcessRegIq(HXML node, ThreadData *info)
+{
if (!XmlGetName(node) || mir_tstrcmp(XmlGetName(node), _T("iq"))) return;
- if ((type = XmlGetAttrValue(node, _T("type"))) == NULL) return;
+ LPCTSTR type = XmlGetAttrValue(node, _T("type"));
+ if (type == NULL)
+ return;
int id = JabberGetPacketID(node);
+ LPCTSTR from = XmlGetAttrValue(node, _T("from"));
+ if (from == NULL)
+ return;
+
if (!mir_tstrcmp(type, _T("result"))) {
+ HXML queryNode = XmlGetChild(node, _T("query"));
+ if (queryNode != NULL) {
+ LPCTSTR str = XmlGetAttrValue(queryNode, _T("xmlns"));
+ if (!mir_tstrcmp(str, JABBER_FEAT_REGISTER)) {
+ HXML xNode = XmlGetChild(queryNode, _T("x"));
+ if (xNode != NULL) {
+ str = XmlGetAttrValue(xNode, _T("xmlns"));
+ if (!mir_tstrcmp(str, JABBER_FEAT_DATA_FORMS)) {
+ m_regInfo = info;
+ FormCreateDialog(xNode, _T("Jabber register new user"), &CJabberProto::SetRegConfig, mir_tstrdup(from));
+ return;
+ }
+ }
+ }
+ }
// RECVED: result of the request for registration mechanism
// ACTION: send account registration information
if (id == iqIdRegGetReg) {