source: qutecom-coip/libs/coipmanager_base/src/account/JabberAccount.cpp @ 125:d648f4cb122f

Last change on this file since 125:d648f4cb122f was 125:d648f4cb122f, checked in by laurent, 3 years ago

wengo => qutecom

File size: 4.5 KB
Line 
1/*
2 * QuteCom, a voice over Internet phone
3 * Copyright (C) 2004-2010 Mbdsys
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18 */
19
20#include <coipmanager_base/account/JabberAccount.h>
21
22#include <util/Logger.h>
23#include <util/String.h>
24
25const std::string JabberAccount::DEFAULT_JABBER_SERVER = String::null;
26const int JabberAccount::DEFAULT_JABBER_PORT = 5222;
27const std::string JabberAccount::DEFAULT_JABBER_RESOURCE = "QuteCom";
28const bool JabberAccount::DEFAULT_JABBER_USE_TLS = true;
29const bool JabberAccount::DEFAULT_JABBER_REQUIRE_TLS = true;
30const bool JabberAccount::DEFAULT_JABBER_USE_OLD_SSL = false;
31const bool JabberAccount::DEFAULT_JABBER_AUTH_PLAIN_IN_CLEAR = false;
32const std::string JabberAccount::DEFAULT_JABBER_CONNECTION_SERVER = String::null;
33
34JabberAccount::JabberAccount()
35        : IAccount(String::null, String::null, EnumAccountType::AccountTypeJabber) {
36
37        _jabberServer = DEFAULT_JABBER_SERVER;
38        _jabberServerPort = DEFAULT_JABBER_PORT;
39        _resource = DEFAULT_JABBER_RESOURCE;
40        _tlsUsed = DEFAULT_JABBER_USE_TLS;
41        _tlsRequired = DEFAULT_JABBER_REQUIRE_TLS;
42        _oldSSLUsed = DEFAULT_JABBER_USE_OLD_SSL;
43        _authPlainInClearUsed = DEFAULT_JABBER_AUTH_PLAIN_IN_CLEAR;
44        _connectionServer = DEFAULT_JABBER_CONNECTION_SERVER;
45}
46
47JabberAccount::JabberAccount(const std::string & login, const std::string & password)
48        : IAccount(login, password, EnumAccountType::AccountTypeJabber) {
49
50        _jabberServer = DEFAULT_JABBER_SERVER;
51        _jabberServerPort = DEFAULT_JABBER_PORT;
52        _resource = DEFAULT_JABBER_RESOURCE;
53        _tlsUsed = DEFAULT_JABBER_USE_TLS;
54        _tlsRequired = DEFAULT_JABBER_REQUIRE_TLS;
55        _oldSSLUsed = DEFAULT_JABBER_USE_OLD_SSL;
56        _authPlainInClearUsed = DEFAULT_JABBER_AUTH_PLAIN_IN_CLEAR;
57        _connectionServer = DEFAULT_JABBER_CONNECTION_SERVER;
58}
59
60JabberAccount::JabberAccount(const JabberAccount & account)
61        : IAccount(account) {
62        copy(account);
63}
64
65JabberAccount::JabberAccount(const IAccount * iAccount) {
66        const JabberAccount * account = dynamic_cast<const JabberAccount *>(iAccount);
67        if (account) {
68                copy(*account);
69        } else {
70                LOG_FATAL("given IAccount is not an JabberAccount");
71        }
72}
73
74void JabberAccount::copy(const JabberAccount & account) {
75        IAccount::copy(account);
76        _jabberServer = account._jabberServer;
77        _jabberServerPort = account._jabberServerPort;
78        _resource = account._resource;
79        _tlsUsed = account._tlsUsed;
80        _tlsRequired = account._tlsRequired;
81        _oldSSLUsed = account._oldSSLUsed;
82        _authPlainInClearUsed = account._authPlainInClearUsed;
83        _connectionServer = account._connectionServer;
84}
85
86JabberAccount::~JabberAccount() {
87}
88
89JabberAccount * JabberAccount::clone() const {
90        return new JabberAccount(*this);
91}
92
93void JabberAccount::setServer(const std::string & jabberServer) {
94        _jabberServer = jabberServer;
95}
96
97std::string JabberAccount::getServer() const {
98        return _jabberServer;
99}
100
101void JabberAccount::setServerPort(int jabberServerPort) {
102        _jabberServerPort = jabberServerPort;
103}
104
105int JabberAccount::getServerPort() const {
106        return _jabberServerPort;
107}
108
109void JabberAccount::setResource(const std::string & resource) {
110        _resource = resource;
111}
112
113std::string JabberAccount::getResource() const {
114        return _resource;
115}
116
117void JabberAccount::setTLS(bool useTLS) {
118        _tlsUsed = useTLS;
119}
120
121bool JabberAccount::isTLSUsed() const {
122        return _tlsUsed;
123}
124
125void JabberAccount::setTLSRequired(bool requireTLS) {
126        _tlsRequired = requireTLS;
127}
128
129bool JabberAccount::isTLSRequired() const {
130        return _tlsRequired;
131}
132
133void JabberAccount::setOldSSLUsed(bool oldSSLUsed) {
134        _oldSSLUsed = oldSSLUsed;
135}
136
137bool JabberAccount::isOldSSLUsed() const {
138        return _oldSSLUsed;
139}
140
141void JabberAccount::setAuthPlainInClearUsed(bool useAuthPlainInClear) {
142        _authPlainInClearUsed = useAuthPlainInClear;
143}
144
145bool JabberAccount::isAuthPlainInClearUsed() const {
146        return _authPlainInClearUsed;
147}
148
149void JabberAccount::setConnectionServer(const std::string & connectionServer) {
150        _connectionServer = connectionServer;
151}
152
153std::string JabberAccount::getConnectionServer() const {
154        return _connectionServer;
155}
Note: See TracBrowser for help on using the repository browser.