summaryrefslogtreecommitdiffstats
path: root/konversation/src/connectionsettings.cpp
blob: c1da973ec45e20673ca1b28f2af50ff2bcab0709 (plain)
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
44
45
46
47
48
49
50
51
52
53
54
55
/*
  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.
*/

/*
  Copyright (C) 2008 Eike Hein <hein@kde.org>
*/

#include "connectionsettings.h"
#include "config/preferences.h"


ConnectionSettings::ConnectionSettings()
{
    m_reconnectCount = 0;
}

ConnectionSettings::~ConnectionSettings()
{
}

bool ConnectionSettings::isValid()
{
    if (m_server.host().isEmpty()) return false;

    return true;
}

TQString ConnectionSettings::name() const
{
    if (m_serverGroup)
        return m_serverGroup->name();
    else
        return m_server.host();
}

IdentityPtr ConnectionSettings::identity() const
{
    if (m_serverGroup)
        return m_serverGroup->identity();

    return Preferences::identityById(0);
}

TQString ConnectionSettings::initialNick() const
{
    if (!m_initialNick.isEmpty())
        return m_initialNick;

    return identity()->getNickname(0);
}