pidgin/pidginmessage.c

Thu, 03 Sep 2020 20:16:32 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Thu, 03 Sep 2020 20:16:32 -0500
changeset 40526
c8cc1a4c4a02
parent 39825
ccf8ca59d347
child 40541
9ceb8d25d4d9
permissions
-rw-r--r--

Add support for message attachments

Add a PurpleAttachment for storing message attachments

A start to implementing the attachment api in PidginMessage

Add PidginAttachment that wraps PurpleAttachment.

Finish implementing the attachment management api in PidginMessage

Add PidginAttachment to the docs

Testing Done:
Compiled and ran. Messaged with bonjour.

Reviewed at https://reviews.imfreedom.org/r/76/

39702
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /* pidgin
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 *
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * Pidgin is the legal property of its developers, whose names are too numerous
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 * to list here. Please refer to the COPYRIGHT file distributed with this
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * source distribution.
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 *
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * (at your option) any later version.
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 *
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * GNU General Public License for more details.
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 *
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 */
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22 #include "pidginmessage.h"
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23
40526
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
24 #include "pidginattachment.h"
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
25
39702
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26 struct _PidginMessage {
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 GObject parent;
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28
40526
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
29 PurpleMessage *message;
39702
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 GDateTime *timestamp;
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 };
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32
40526
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
33 typedef struct {
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
34 TalkatuAttachmentForeachFunc func;
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
35 gpointer data;
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
36 } PidginMessageAttachmentForeachData;
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
37
39702
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 enum {
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 PROP_0,
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 PROP_MESSAGE,
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 N_PROPERTIES,
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 /* overrides */
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 PROP_ID = N_PROPERTIES,
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 PROP_CONTENT_TYPE,
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 PROP_AUTHOR,
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46 PROP_CONTENTS,
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47 PROP_TIMESTAMP,
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 PROP_EDITED,
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 };
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 static GParamSpec *properties[N_PROPERTIES] = {NULL, };
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 /******************************************************************************
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 * Helpers
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 *****************************************************************************/
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 static void
40526
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
56 pidgin_message_set_message(PidginMessage *message, PurpleMessage *purple_msg) {
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
57 if(g_set_object(&message->message, purple_msg)) {
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
58 g_clear_pointer(&message->timestamp, g_date_time_unref);
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
59 message->timestamp = g_date_time_new_from_unix_local(purple_message_get_time(purple_msg));
39702
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60
40526
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
61 g_object_freeze_notify(G_OBJECT(message));
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
62 g_object_notify_by_pspec(G_OBJECT(message), properties[PROP_MESSAGE]);
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
63 g_object_notify(G_OBJECT(message), "timestamp");
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
64 g_object_thaw_notify(G_OBJECT(message));
39702
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65 }
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 }
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68 /******************************************************************************
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69 * TalkatuMessage Implementation
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70 *****************************************************************************/
40526
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
71 static gboolean
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
72 pidgin_message_add_attachment(TalkatuMessage *tmessage,
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
73 TalkatuAttachment *tattachment)
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
74 {
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
75 PidginMessage *pmessage = PIDGIN_MESSAGE(tmessage);
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
76 PurpleAttachment *pattachment = NULL;
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
77 gboolean ret = FALSE;
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
78
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
79 pattachment = purple_attachment_new(
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
80 talkatu_attachment_get_id(tattachment),
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
81 talkatu_attachment_get_content_type(tattachment)
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
82 );
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
83
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
84 ret = purple_message_add_attachment(pmessage->message, pattachment);
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
85
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
86 g_object_unref(G_OBJECT(pattachment));
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
87
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
88 return ret;
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
89 }
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
90
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
91 static gboolean
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
92 pidgin_message_remove_attachment(TalkatuMessage *tmessage, guint64 id) {
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
93 PidginMessage *pmessage = PIDGIN_MESSAGE(tmessage);
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
94
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
95 return purple_message_remove_attachment(pmessage->message, id);
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
96 }
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
97
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
98 static TalkatuAttachment *
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
99 pidgin_message_get_attachment(TalkatuMessage *tmessage, guint64 id) {
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
100 PidginMessage *pmessage = PIDGIN_MESSAGE(tmessage);
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
101 PidginAttachment *pidgin_attachment = NULL;
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
102 PurpleAttachment *purple_attachment = NULL;
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
103
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
104 purple_attachment = purple_message_get_attachment(pmessage->message, id);
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
105 pidgin_attachment = pidgin_attachment_new(purple_attachment);
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
106 g_object_unref(G_OBJECT(purple_attachment));
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
107
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
108 return TALKATU_ATTACHMENT(pidgin_attachment);
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
109 }
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
110
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
111 static void
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
112 pidgin_message_foreach_attachment_helper(PurpleAttachment *attachment,
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
113 gpointer data)
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
114 {
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
115 PidginAttachment *pidgin_attachment = NULL;
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
116 PidginMessageAttachmentForeachData *d = NULL;
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
117
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
118 d = (PidginMessageAttachmentForeachData *)data;
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
119 pidgin_attachment = pidgin_attachment_new(attachment);
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
120
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
121 d->func(TALKATU_ATTACHMENT(pidgin_attachment), d->data);
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
122
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
123 g_object_unref(G_OBJECT(pidgin_attachment));
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
124 }
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
125
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
126 static void
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
127 pidgin_message_foreach_attachment(TalkatuMessage *tmessage,
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
128 TalkatuAttachmentForeachFunc func,
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
129 gpointer data)
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
130 {
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
131 PidginMessage *pmessage = PIDGIN_MESSAGE(tmessage);
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
132 PidginMessageAttachmentForeachData *d = NULL;
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
133
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
134 /* PurpleAttachmentForeachFunc and TalkatuAttachmentForeachFunc may not
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
135 * always have the same signature. So to work around that, we use a helper
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
136 * function that has the signature of PurpleAttachmentForeachFunc but will
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
137 * call the TalkatuAttachmentForeachFunc while also wrapping the
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
138 * PurpleAttachments.
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
139 */
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
140
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
141 d = g_new(PidginMessageAttachmentForeachData, 1);
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
142 d->func = func;
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
143 d->data = data;
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
144
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
145 purple_message_foreach_attachment(
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
146 pmessage->message,
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
147 pidgin_message_foreach_attachment_helper,
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
148 d
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
149 );
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
150
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
151 g_free(d);
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
152 }
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
153
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
154 static void
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
155 pidgin_message_clear_attachments(TalkatuMessage *tmessage) {
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
156 PidginMessage *pmessage = PIDGIN_MESSAGE(tmessage);
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
157
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
158 purple_message_clear_attachments(pmessage->message);
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
159 }
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
160
39702
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
161 static void
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
162 pidgin_message_talkatu_message_init(TalkatuMessageInterface *iface) {
40526
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
163 iface->add_attachment = pidgin_message_add_attachment;
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
164 iface->remove_attachment = pidgin_message_remove_attachment;
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
165 iface->get_attachment = pidgin_message_get_attachment;
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
166 iface->foreach_attachment = pidgin_message_foreach_attachment;
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
167 iface->clear_attachments = pidgin_message_clear_attachments;
39702
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
168 }
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
169
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
170 /******************************************************************************
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
171 * GObject Implementation
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
172 *****************************************************************************/
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
173 G_DEFINE_TYPE_EXTENDED(
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
174 PidginMessage,
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
175 pidgin_message,
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
176 G_TYPE_OBJECT,
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
177 0,
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
178 G_IMPLEMENT_INTERFACE(TALKATU_TYPE_MESSAGE, pidgin_message_talkatu_message_init)
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
179 );
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
180
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
181 static void
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
182 pidgin_message_get_property(GObject *obj, guint param_id, GValue *value, GParamSpec *pspec) {
40526
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
183 PidginMessage *message = PIDGIN_MESSAGE(obj);
39702
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
184
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
185 switch(param_id) {
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
186 case PROP_MESSAGE:
40526
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
187 g_value_set_object(value, message->message);
39702
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
188 break;
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
189 case PROP_ID:
40526
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
190 g_value_set_uint(value, purple_message_get_id(message->message));
39702
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
191 break;
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
192 case PROP_CONTENT_TYPE:
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
193 g_value_set_enum(value, TALKATU_CONTENT_TYPE_PLAIN);
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
194 break;
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
195 case PROP_AUTHOR:
40526
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
196 g_value_set_string(value, purple_message_get_author(message->message));
39702
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
197 break;
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
198 case PROP_CONTENTS:
40526
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
199 g_value_set_string(value, purple_message_get_contents(message->message));
39702
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
200 break;
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
201 case PROP_TIMESTAMP:
40526
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
202 g_value_set_pointer(value, message->timestamp);
39702
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
203 break;
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
204 case PROP_EDITED:
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
205 g_value_set_boolean(value, FALSE);
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
206 break;
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
207 default:
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
208 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
209 break;
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
210 }
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
211 }
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
212
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
213 static void
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
214 pidgin_message_set_property(GObject *obj, guint param_id, const GValue *value, GParamSpec *pspec) {
40526
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
215 PidginMessage *message = PIDGIN_MESSAGE(obj);
39702
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
216
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
217 switch(param_id) {
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
218 case PROP_MESSAGE:
40526
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
219 pidgin_message_set_message(message, g_value_get_object(value));
39702
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
220 break;
39704
8f0ffe559ea0 Some additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 39702
diff changeset
221 case PROP_ID:
8f0ffe559ea0 Some additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 39702
diff changeset
222 case PROP_CONTENT_TYPE:
8f0ffe559ea0 Some additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 39702
diff changeset
223 case PROP_TIMESTAMP:
8f0ffe559ea0 Some additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 39702
diff changeset
224 case PROP_AUTHOR:
8f0ffe559ea0 Some additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 39702
diff changeset
225 case PROP_CONTENTS:
8f0ffe559ea0 Some additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 39702
diff changeset
226 case PROP_EDITED:
8f0ffe559ea0 Some additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 39702
diff changeset
227 /* we don't allow settings these */
8f0ffe559ea0 Some additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 39702
diff changeset
228 break;
39702
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
229 default:
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
230 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
231 break;
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
232 }
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
233 }
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
234
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
235 static void
40526
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
236 pidgin_message_init(PidginMessage *message) {
39702
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
237 }
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
238
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
239 static void
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
240 pidgin_message_finalize(GObject *obj) {
40526
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
241 PidginMessage *message = PIDGIN_MESSAGE(obj);
39702
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
242
40526
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
243 g_clear_object(&message->message);
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
244 g_clear_pointer(&message->timestamp, g_date_time_unref);
39702
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
245
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
246 G_OBJECT_CLASS(pidgin_message_parent_class)->finalize(obj);
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
247 }
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
248
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
249 static void
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
250 pidgin_message_class_init(PidginMessageClass *klass) {
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
251 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
252
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
253 obj_class->get_property = pidgin_message_get_property;
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
254 obj_class->set_property = pidgin_message_set_property;
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
255 obj_class->finalize = pidgin_message_finalize;
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
256
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
257 /* add our custom properties */
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
258 properties[PROP_MESSAGE] = g_param_spec_object(
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
259 "message", "message", "The purple message",
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
260 PURPLE_TYPE_MESSAGE,
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
261 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
262 );
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
263
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
264 g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
265
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
266 /* add our overridden properties */
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
267 g_object_class_override_property(obj_class, PROP_ID, "id");
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
268 g_object_class_override_property(obj_class, PROP_TIMESTAMP, "timestamp");
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
269 g_object_class_override_property(obj_class, PROP_CONTENT_TYPE, "content-type");
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
270 g_object_class_override_property(obj_class, PROP_AUTHOR, "author");
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
271 g_object_class_override_property(obj_class, PROP_CONTENTS, "contents");
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
272 g_object_class_override_property(obj_class, PROP_EDITED, "edited");
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
273 }
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
274
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
275 /******************************************************************************
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
276 * API
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
277 *****************************************************************************/
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
278 PidginMessage *
40526
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
279 pidgin_message_new(PurpleMessage *message) {
39702
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
280 return g_object_new(
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
281 PIDGIN_TYPE_MESSAGE,
40526
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
282 "message", message,
39702
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
283 NULL
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
284 );
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
285 }
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
286
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
287 PurpleMessage *
40526
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
288 pidgin_message_get_message(PidginMessage *message) {
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
289 g_return_val_if_fail(PIDGIN_IS_MESSAGE(message), NULL);
39702
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
290
40526
c8cc1a4c4a02 Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents: 39825
diff changeset
291 return message->message;
39702
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
292 }

mercurial