File indexing completed on 2024-04-21 15:43:00
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 0021 #include "text-event.h" 0022 0023 #include <telepathy-logger/text-event.h> 0024 0025 using namespace Tpl; 0026 0027 Tp::ChannelTextMessageType TextEvent::messageType() const 0028 { 0029 return (Tp::ChannelTextMessageType) tpl_text_event_get_message_type(object<TplTextEvent>()); 0030 } 0031 0032 QString TextEvent::message() const 0033 { 0034 const gchar *s = tpl_text_event_get_message(object<TplTextEvent>()); 0035 QString str = QString::fromUtf8(s); 0036 return str; 0037 } 0038 0039 QString TextEvent::messageToken() const 0040 { 0041 const gchar *s = tpl_text_event_get_message_token(object<TplTextEvent>()); 0042 QString str = QString::fromUtf8(s); 0043 return str; 0044 } 0045 0046 QDateTime TextEvent::editTimestamp() const 0047 { 0048 // FIXME See http://bugs.freedesktop.org/show_bug.cgi?id=21690 0049 uint seconds = (uint) tpl_text_event_get_edit_timestamp(object<TplTextEvent>()); 0050 QDateTime dateTime; 0051 dateTime.setTime_t(seconds); 0052 return dateTime; 0053 } 0054 0055 QString TextEvent::supersedesToken() const 0056 { 0057 const gchar *s = tpl_text_event_get_supersedes_token(object<TplTextEvent>()); 0058 QString str = QString::fromUtf8(s); 0059 return str; 0060 } 0061 0062 0063 QList< TextEventPtr > TextEvent::supersedes() const 0064 { 0065 GList *tplEvents = tpl_text_event_get_supersedes(object<TplTextEvent>()); 0066 GList *iter; 0067 QList<TextEventPtr> events; 0068 for (iter = tplEvents; iter; iter = g_list_next(iter)) { 0069 events << TPLoggerQtWrapper::wrap<TplTextEvent, TextEvent>((TplTextEvent*) iter->data, true); 0070 } 0071 0072 return events; 0073 }