updated on Thu Jan 19 16:10:29 UTC 2012
[aur-mirror.git] / abiword-devel / TelepathyBuddy.h
blob05761f374077c5c9cc678645782eb4d512e91559
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
16 * 02111-1307, USA.
19 #ifndef __TELEPATHY_BUDDY_H__
20 #define __TELEPATHY_BUDDY_H__
22 #include <map>
23 #include <account/xp/Buddy.h>
24 #include <account/xp/DocTreeItem.h>
25 #include <account/xp/AccountHandler.h>
27 #include <telepathy-glib/contact.h>
29 class DocHandle;
30 class TelepathyBuddy;
32 typedef boost::shared_ptr<TelepathyBuddy> TelepathyBuddyPtr;
34 class TelepathyBuddy : public Buddy
36 public:
37 TelepathyBuddy(AccountHandler* handler, TpContact* pContact)
38 : Buddy(handler),
39 m_pContact(pContact)
41 setVolatile(true);
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);
58 return description;
61 virtual const DocTreeItem* getDocTreeItems() const
63 UT_ASSERT_HARMLESS(UT_NOT_REACHED);
64 return NULL;
67 TpContact* getContact()
69 return m_pContact;
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;
79 private:
81 TpContact* m_pContact;
84 #endif /* __TELEPATHY_BUDDY_H__ */