diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2015-08-09 10:47:43 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2015-08-09 10:47:43 +0000 |
commit | 6dde4172bb2a84ca76a2e6541f6788ab613797ab (patch) | |
tree | 64bf043a6508d26367751b70a13b5ac0d9e1b602 /protocols/JabberG/src/jabber_thread.cpp | |
parent | 45898e008336c419f9d4b07ccfa46fde30226db0 (diff) |
First attempt to support registration forms (can someone test and fix it please?)
git-svn-id: http://svn.miranda-ng.org/main/trunk@14881 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG/src/jabber_thread.cpp')
-rw-r--r-- | protocols/JabberG/src/jabber_thread.cpp | 39 |
1 files changed, 36 insertions, 3 deletions
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) {
|