1 /* Copyright (C) 2009 Marc Maurer <uwog@uwog.net>
3 * This program is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU General Public License
5 * as published by the Free Software Foundation; either version 2
6 * of the License, or (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 #ifndef __TELEPATHY_BUDDY_H__
20 #define __TELEPATHY_BUDDY_H__
23 #include <account/xp/Buddy.h>
24 #include <account/xp/DocTreeItem.h>
25 #include <account/xp/AccountHandler.h>
27 #include <telepathy-glib/contact.h>
32 typedef boost::shared_ptr
<TelepathyBuddy
> TelepathyBuddyPtr
;
34 class TelepathyBuddy
: public Buddy
37 TelepathyBuddy(AccountHandler
* handler
, TpContact
* pContact
)
42 g_object_ref(m_pContact
);
45 virtual ~TelepathyBuddy()
47 g_object_unref(m_pContact
);
50 virtual UT_UTF8String
getDescriptor(bool /*include_session_info = false*/) const
52 return UT_UTF8String("telepathy://") + tp_contact_get_identifier (m_pContact
);
55 virtual UT_UTF8String
getDescription() const
57 UT_UTF8String description
= tp_contact_get_identifier (m_pContact
);
61 virtual const DocTreeItem
* getDocTreeItems() const
63 UT_ASSERT_HARMLESS(UT_NOT_REACHED
);
67 TpContact
* getContact()
72 bool equals(TelepathyBuddyPtr pBuddy
)
74 UT_return_val_if_fail(pBuddy
, false);
75 TpContact
* pContact
= pBuddy
->getContact();
76 return strcmp(tp_contact_get_identifier(pContact
), tp_contact_get_identifier (m_pContact
)) == 0;
81 TpContact
* m_pContact
;
84 #endif /* __TELEPATHY_BUDDY_H__ */