1 /*
2  *  Kaidan - A user-friendly XMPP client for every device!
3  *
4  *  Copyright (C) 2016-2021 Kaidan developers and contributors
5  *  (see the LICENSE file for a full list of copyright authors)
6  *
7  *  Kaidan is free software: you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation, either version 3 of the License, or
10  *  (at your option) any later version.
11  *
12  *  In addition, as a special exception, the author of Kaidan gives
13  *  permission to link the code of its release with the OpenSSL
14  *  project's "OpenSSL" library (or with modified versions of it that
15  *  use the same license as the "OpenSSL" library), and distribute the
16  *  linked executables. You must obey the GNU General Public License in
17  *  all respects for all of the code used other than "OpenSSL". If you
18  *  modify this file, you may extend this exception to your version of
19  *  the file, but you are not obligated to do so.  If you do not wish to
20  *  do so, delete this exception statement from your version.
21  *
22  *  Kaidan is distributed in the hope that it will be useful,
23  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
24  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25  *  GNU General Public License for more details.
26  *
27  *  You should have received a copy of the GNU General Public License
28  *  along with Kaidan.  If not, see <http://www.gnu.org/licenses/>.
29  */
30 
31 #include "ServerFeaturesCache.h"
32 // Qt
33 #include <QMutexLocker>
34 
ServerFeaturesCache(QObject * parent)35 ServerFeaturesCache::ServerFeaturesCache(QObject *parent)
36     : QObject(parent)
37 {
38 }
39 
inBandRegistrationSupported()40 bool ServerFeaturesCache::inBandRegistrationSupported()
41 {
42 	QMutexLocker locker(&m_mutex);
43 	return m_inBandRegistrationSupported;
44 }
45 
setInBandRegistrationSupported(bool supported)46 void ServerFeaturesCache::setInBandRegistrationSupported(bool supported)
47 {
48 	QMutexLocker locker(&m_mutex);
49 	if (m_inBandRegistrationSupported != supported) {
50 		m_inBandRegistrationSupported = supported;
51 		locker.unlock();
52 		emit inBandRegistrationSupportedChanged();
53 	}
54 }
55 
httpUploadSupported()56 bool ServerFeaturesCache::httpUploadSupported()
57 {
58 	QMutexLocker locker(&m_mutex);
59 	return m_httpUploadSupported;
60 }
61 
setHttpUploadSupported(bool supported)62 void ServerFeaturesCache::setHttpUploadSupported(bool supported)
63 {
64 	QMutexLocker locker(&m_mutex);
65 	if (m_httpUploadSupported != supported) {
66 		m_httpUploadSupported = supported;
67 		locker.unlock();
68 		emit httpUploadSupportedChanged();
69 	}
70 }
71