• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

TelepathyBuddy.h

Go to the documentation of this file.
00001 /* Copyright (C) 2009 Marc Maurer <uwog@uwog.net>
00002  *
00003  * This program is free software; you can redistribute it and/or
00004  * modify it under the terms of the GNU General Public License
00005  * as published by the Free Software Foundation; either version 2
00006  * of the License, or (at your option) any later version.
00007  *
00008  * This program is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011  * GNU General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * along with this program; if not, write to the Free Software
00015  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00016  * 02110-1301 USA.
00017  */
00018 
00019 #ifndef __TELEPATHY_BUDDY_H__
00020 #define __TELEPATHY_BUDDY_H__
00021 
00022 #include <map>
00023 #include <account/xp/Buddy.h>
00024 #include <account/xp/DocTreeItem.h>
00025 #include <account/xp/AccountHandler.h>
00026 
00027 #include <telepathy-glib/contact.h>
00028 
00029 class DocHandle;
00030 class TelepathyBuddy;
00031 
00032 typedef boost::shared_ptr<TelepathyBuddy> TelepathyBuddyPtr;
00033 
00034 class TelepathyBuddy : public Buddy
00035 {
00036 public:
00037     TelepathyBuddy(AccountHandler* handler, TpContact* pContact)
00038         : Buddy(handler),
00039         m_pContact(pContact)
00040     {
00041         setVolatile(true);
00042         g_object_ref(m_pContact);
00043     }
00044 
00045     virtual ~TelepathyBuddy()
00046     {
00047         g_object_unref(m_pContact);
00048     }
00049 
00050     virtual UT_UTF8String getDescriptor(bool /*include_session_info = false*/) const
00051     {
00052         return UT_UTF8String("telepathy://") + tp_contact_get_identifier (m_pContact);
00053     }
00054 
00055     virtual UT_UTF8String getDescription() const
00056     {
00057         UT_UTF8String description = tp_contact_get_identifier (m_pContact);
00058         return description;
00059     }
00060 
00061     virtual const DocTreeItem* getDocTreeItems() const
00062     {
00063         UT_ASSERT_HARMLESS(UT_NOT_REACHED);
00064         return NULL;
00065     }
00066 
00067     TpContact* getContact()
00068     {
00069         return m_pContact;
00070     }
00071 
00072     bool equals(TelepathyBuddyPtr pBuddy)
00073     {
00074         UT_return_val_if_fail(pBuddy, false);
00075         TpContact* pContact = pBuddy->getContact();
00076         return strcmp(tp_contact_get_identifier(pContact), tp_contact_get_identifier (m_pContact)) == 0;
00077     }
00078 
00079 private:
00080 
00081     TpContact*          m_pContact;
00082 };
00083 
00084 #endif /* __TELEPATHY_BUDDY_H__ */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1