/* Copyright (C) 2010 AbiSource Corporation B.V. * * 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., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. */ #ifndef __TELEPATHY_CHATROOM_H__ #define __TELEPATHY_CHATROOM_H__ #include #include #include #include #include #include #include #include #include #include "TelepathyBuddy.h" class TelepathyAccountHandler; class DTubeBuddy; typedef boost::shared_ptr DTubeBuddyPtr; class TelepathyChatroom : public boost::enable_shared_from_this { public: TelepathyChatroom(TelepathyAccountHandler* pHandler, DBusConnection* pTube, const UT_UTF8String& sSessionId) : m_pHandler(pHandler), m_pTube(pTube), m_sSessionId(sSessionId) { // TODO: we should prolly ref the tube // dbus_connection_unref(m_pTube); } boost::shared_ptr ptr() { return shared_from_this(); } TelepathyAccountHandler* getHandler() { return m_pHandler; } void addBuddy(DTubeBuddyPtr pBuddy); const std::vector& getBuddies() { return m_buddies; } DTubeBuddyPtr getBuddy(TpHandle handle); DTubeBuddyPtr getBuddy(UT_UTF8String dbusName); void removeBuddy(TpHandle handle); DBusConnection* getTube() { return m_pTube; } void setTube(DBusConnection* pTube) { m_pTube = pTube; } const UT_UTF8String& getSessionId() { return m_sSessionId; } void queue(const std::string& dbusName, const std::string& packet); // TODO: hide the fact that you need to invite the people yourself void invite(TelepathyBuddyPtr pBuddy) { m_invitees.push_back(pBuddy); } std::vector& getInvitees() { return m_invitees; } private: TelepathyAccountHandler* m_pHandler; DBusConnection* m_pTube; UT_UTF8String m_sSessionId; std::vector m_buddies; std::vector m_invitees; std::map > m_packet_queue; }; typedef boost::shared_ptr TelepathyChatroomPtr; #endif /* __TELEPATHY_CHATROOM_H__ */