-
Notifications
You must be signed in to change notification settings - Fork 0
/
auth.cpp
43 lines (34 loc) · 986 Bytes
/
auth.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "auth.h"
namespace qtxmpp {
Auth::Auth(QString domain, Authentification *authentification, User *user)
{
setText(false);
setName("auth");
setDomain(domain);
//setAttribute("xmlns:stream", "http://etherx.jabber.org/streams");
setXmlns("urn:ietf:params:xml:ns:xmpp-sasl");
setMechanism(authentification);
Serializable serializable;
serializable.setText(true);
QByteArray array;
array.append(user->getNick());
array.append('@');
array.append(m_domain);
array.append('\0');
array.append(user->getNick());
array.append('\0');
array.append(user->getPassPrefix() + user->getPassword());
serializable.setName(QString(array.toBase64()));
addChild(serializable);
}
void Auth::setDomain(QString domain)
{
m_domain = domain;
m_attributes["to"] = m_domain;
}
void Auth::setMechanism(Authentification *mechanism)
{
m_mechanism = mechanism;
m_attributes["mechanism"] = mechanism->getName();
}
}