PageRenderTime 17ms CodeModel.GetById 8ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/src/libtomahawk/sip/SipPlugin.cpp

http://github.com/tomahawk-player/tomahawk
C++ | 102 lines | 60 code | 22 blank | 20 comment | 2 complexity | 34e05e4fc136af229b382905d51bd41f MD5 | raw file
  1/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
  2 *
  3 *   Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
  4 *             2011, Dominik Schmidt <dev@dominik-schmidt.de>
  5 *             2010-2011, Leo Franchi <lfranchi@kde.org>
  6 *   Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
  7 *
  8 *   Tomahawk is free software: you can redistribute it and/or modify
  9 *   it under the terms of the GNU General Public License as published by
 10 *   the Free Software Foundation, either version 3 of the License, or
 11 *   (at your option) any later version.
 12 *
 13 *   Tomahawk is distributed in the hope that it will be useful,
 14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 16 *   GNU General Public License for more details.
 17 *
 18 *   You should have received a copy of the GNU General Public License
 19 *   along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
 20 */
 21
 22#include "sip/SipPlugin.h"
 23
 24#include "utils/Logger.h"
 25#include "Source.h"
 26#include "sip/PeerInfo.h"
 27
 28
 29SipPlugin::SipPlugin() : QObject() {}
 30SipPlugin::~SipPlugin() {}
 31
 32SipPlugin::SipPlugin( Tomahawk::Accounts::Account *account, QObject* parent )
 33    : QObject( parent )
 34    , m_account( account )
 35{
 36    connect( account, SIGNAL( configurationChanged() ), SLOT( configurationChanged() ) );
 37}
 38
 39
 40QString
 41SipPlugin::pluginId() const
 42{
 43    return m_account->accountId();
 44}
 45
 46
 47const QString
 48SipPlugin::friendlyName() const
 49{
 50    return m_account->accountFriendlyName();
 51}
 52
 53
 54const QString
 55SipPlugin::serviceName() const
 56{
 57    return m_account->accountServiceName();
 58}
 59
 60QString
 61SipPlugin::inviteString() const
 62{
 63    return QString();
 64}
 65
 66
 67QMenu*
 68SipPlugin::menu()
 69{
 70    return nullptr;
 71}
 72
 73
 74Tomahawk::Accounts::Account*
 75SipPlugin::account() const
 76{
 77    return m_account;
 78}
 79
 80
 81const QList< Tomahawk::peerinfo_ptr >
 82SipPlugin::peersOnline() const
 83{
 84    QList< Tomahawk::peerinfo_ptr > result;
 85
 86    foreach( const Tomahawk::peerinfo_ptr& peerInfo, Tomahawk::PeerInfo::getAll() )
 87    {
 88        if(peerInfo->sipPlugin() == this)
 89            result.append( peerInfo );
 90    }
 91
 92    return result;
 93}
 94
 95
 96void SipPlugin::setAllPeersOffline()
 97{
 98    foreach( const Tomahawk::peerinfo_ptr& peerInfo, peersOnline() )
 99    {
100        peerInfo->setStatus( Tomahawk::PeerInfo::Offline );
101    }
102}