account.cpp 1.91 KB
Newer Older
yanmorin's avatar
 
yanmorin committed
1
/*
2
3
 *  Copyright (C) 2006-2007 Savoir-Faire Linux inc.
 *  Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com>
yanmorin's avatar
 
yanmorin committed
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 *  Author: Yan Morin <yan.morin@savoirfairelinux.com>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
#include "account.h"
21
#include "voiplink.h"
22
#include "manager.h"
yanmorin's avatar
 
yanmorin committed
23
24
25

Account::Account(const AccountID& accountID) : _accountID(accountID)
{
26
  _link = NULL;
yanmorin's avatar
   
yanmorin committed
27

yanmorin's avatar
 
yanmorin committed
28
  _shouldInitOnStart = false;
yanmorin's avatar
   
yanmorin committed
29
  _shouldRegisterOnStart = false;
yanmorin's avatar
 
yanmorin committed
30
31
  _enabled = false;
  _registered = false;
32
  _state = false;
yanmorin's avatar
 
yanmorin committed
33
34
35
36
37
}


Account::~Account()
{
38
  delete _link; _link = NULL;
yanmorin's avatar
 
yanmorin committed
39
}
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61


void
Account::initConfig(Conf::ConfigTree& config) {
  std::string section(_accountID);
  std::string type_str("string");
  std::string type_int("int");

  config.addConfigTreeItem(section, Conf::ConfigTreeItem(CONFIG_ACCOUNT_ENABLE,"1", type_int));
  config.addConfigTreeItem(section, Conf::ConfigTreeItem(CONFIG_ACCOUNT_AUTO_REGISTER, "1", type_int));
  config.addConfigTreeItem(section, Conf::ConfigTreeItem(CONFIG_ACCOUNT_ALIAS, _("My account"), type_str));
}



void
Account::loadConfig() 
{
  _shouldInitOnStart = Manager::instance().getConfigInt(_accountID, CONFIG_ACCOUNT_ENABLE) ? true : false;
  _shouldRegisterOnStart = Manager::instance().getConfigInt(_accountID, CONFIG_ACCOUNT_AUTO_REGISTER) ? true : false;
}