File indexing completed on 2024-04-14 15:05:39
0001 /* 0002 * This file is part of TelepathyLoggerQt 0003 * 0004 * Copyright (C) 2011 Stefano Sanfilippo <stefano.k.sanfilippo@gmail.com> 0005 * Copyright (C) 2011 Collabora Ltd. <http://www.collabora.co.uk/> 0006 * 0007 * This library is free software; you can redistribute it and/or modify 0008 * it under the terms of the GNU Lesser General Public License as published 0009 * by the Free Software Foundation; either version 2.1 of the License, or 0010 * (at your option) any later version. 0011 * 0012 * This program is distributed in the hope that it will be useful, 0013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0015 * GNU General Public License for more details. 0016 * 0017 * You should have received a copy of the GNU Lesser General Public License 0018 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0019 */ 0020 #ifndef _TelepathyLoggerQt_entity_h_HEADER_GUARD_ 0021 #define _TelepathyLoggerQt_entity_h_HEADER_GUARD_ 0022 0023 #include "object.h" 0024 #include "types.h" 0025 #include <TelepathyLoggerQt_export.h> 0026 0027 namespace Tpl 0028 { 0029 0030 /** 0031 * \headerfile entity.h <TelepathyLoggerQt/Entity> 0032 * \brief An object representing a contact or room. 0033 */ 0034 class TELEPATHY_LOGGER_QT_EXPORT Entity : public Tpl::Object 0035 { 0036 public: 0037 /** 0038 * \brief Constructs a new entity 0039 * 0040 * \param id 0041 * \param type 0042 * \param alias 0043 * \param avatarToken 0044 */ 0045 static EntityPtr create(const char *id, EntityType type, const char *alias, 0046 const char *avatarToken); 0047 0048 /** 0049 * \brief Constructs a new entity from Tp::Contact 0050 * 0051 * \param contact 0052 * \param type 0053 */ 0054 static EntityPtr create(const Tp::ContactPtr & contact, EntityType type); 0055 0056 /** 0057 * \brief Constructs a new for a room 0058 * 0059 * \param room_id 0060 */ 0061 static EntityPtr create(const char *room_id); 0062 0063 /** 0064 * \brief Returns entity's alias 0065 */ 0066 QString alias() const; 0067 0068 /** 0069 * \brief Returns entity's unique identifier 0070 */ 0071 QString identifier() const; 0072 0073 /** 0074 * \brief Returns whether the entity is a contact, a room or account owner 0075 */ 0076 EntityType entityType() const; 0077 0078 /** 0079 * \brief Returns entity's avatar token 0080 */ 0081 QString avatarToken() const; 0082 0083 private: 0084 QTELEPATHYLOGGERQT_WRAPPER(Entity) 0085 }; 0086 0087 } //namespace 0088 0089 #endif