/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. #include "sip/SipPlugin.h"
  22. #include "utils/Logger.h"
  23. #include "Source.h"
  24. #include "sip/PeerInfo.h"
  25. SipPlugin::SipPlugin() : QObject() {}
  26. SipPlugin::~SipPlugin() {}
  27. SipPlugin::SipPlugin( Tomahawk::Accounts::Account *account, QObject* parent )
  28. : QObject( parent )
  29. , m_account( account )
  30. {
  31. connect( account, SIGNAL( configurationChanged() ), SLOT( configurationChanged() ) );
  32. }
  33. QString
  34. SipPlugin::pluginId() const
  35. {
  36. return m_account->accountId();
  37. }
  38. const QString
  39. SipPlugin::friendlyName() const
  40. {
  41. return m_account->accountFriendlyName();
  42. }
  43. const QString
  44. SipPlugin::serviceName() const
  45. {
  46. return m_account->accountServiceName();
  47. }
  48. QString
  49. SipPlugin::inviteString() const
  50. {
  51. return QString();
  52. }
  53. QMenu*
  54. SipPlugin::menu()
  55. {
  56. return nullptr;
  57. }
  58. Tomahawk::Accounts::Account*
  59. SipPlugin::account() const
  60. {
  61. return m_account;
  62. }
  63. const QList< Tomahawk::peerinfo_ptr >
  64. SipPlugin::peersOnline() const
  65. {
  66. QList< Tomahawk::peerinfo_ptr > result;
  67. foreach( const Tomahawk::peerinfo_ptr& peerInfo, Tomahawk::PeerInfo::getAll() )
  68. {
  69. if(peerInfo->sipPlugin() == this)
  70. result.append( peerInfo );
  71. }
  72. return result;
  73. }
  74. void SipPlugin::setAllPeersOffline()
  75. {
  76. foreach( const Tomahawk::peerinfo_ptr& peerInfo, peersOnline() )
  77. {
  78. peerInfo->setStatus( Tomahawk::PeerInfo::Offline );
  79. }
  80. }