Sat, 03 Oct 2020 05:58:21 -0500
PurpleMessage cleanups from hell
Clean up libpurple/message.[ch] and remove the messages hash table as its current implementation will not fit our future needs
add a content-type property to PurpleMessage
Convert message timestamps from time_t to GDateTime and set default values
Make purple_message_new_outgoing take a parameter for the author.
Testing Done:
messages sent on bonjour, irc privmsg, irc chat, `/me` is broken i think unrelated.
Reviewed at https://reviews.imfreedom.org/r/124/
|
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 | }; |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | |
|
40526
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
32 | typedef struct { |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
33 | TalkatuAttachmentForeachFunc func; |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
34 | gpointer data; |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
35 | } PidginMessageAttachmentForeachData; |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
36 | |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | enum { |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | PROP_0, |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | PROP_MESSAGE, |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | N_PROPERTIES, |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | /* overrides */ |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | PROP_ID = N_PROPERTIES, |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | PROP_CONTENT_TYPE, |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | PROP_AUTHOR, |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | PROP_CONTENTS, |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | PROP_TIMESTAMP, |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | PROP_EDITED, |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | }; |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | static GParamSpec *properties[N_PROPERTIES] = {NULL, }; |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | |
|
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 | * Helpers |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | *****************************************************************************/ |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
54 | static void |
|
40526
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
55 | pidgin_message_set_message(PidginMessage *message, PurpleMessage *purple_msg) { |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
56 | if(g_set_object(&message->message, purple_msg)) { |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
57 | g_object_notify_by_pspec(G_OBJECT(message), properties[PROP_MESSAGE]); |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | } |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | } |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
60 | |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | /****************************************************************************** |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | * TalkatuMessage Implementation |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | *****************************************************************************/ |
|
40526
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
64 | static gboolean |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
65 | pidgin_message_add_attachment(TalkatuMessage *tmessage, |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
66 | TalkatuAttachment *tattachment) |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
67 | { |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
68 | PidginMessage *pmessage = PIDGIN_MESSAGE(tmessage); |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
69 | PurpleAttachment *pattachment = NULL; |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
70 | gboolean ret = FALSE; |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
71 | |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
72 | pattachment = purple_attachment_new( |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
73 | talkatu_attachment_get_id(tattachment), |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
74 | talkatu_attachment_get_content_type(tattachment) |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
75 | ); |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
76 | |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
77 | ret = purple_message_add_attachment(pmessage->message, pattachment); |
|
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 | g_object_unref(G_OBJECT(pattachment)); |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
80 | |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
81 | return ret; |
|
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 | static gboolean |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
85 | pidgin_message_remove_attachment(TalkatuMessage *tmessage, guint64 id) { |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
86 | PidginMessage *pmessage = PIDGIN_MESSAGE(tmessage); |
|
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 purple_message_remove_attachment(pmessage->message, id); |
|
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 TalkatuAttachment * |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
92 | pidgin_message_get_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 | PidginAttachment *pidgin_attachment = NULL; |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
95 | PurpleAttachment *purple_attachment = NULL; |
|
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 | purple_attachment = purple_message_get_attachment(pmessage->message, id); |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
98 | pidgin_attachment = pidgin_attachment_new(purple_attachment); |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
99 | g_object_unref(G_OBJECT(purple_attachment)); |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
100 | |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
101 | return TALKATU_ATTACHMENT(pidgin_attachment); |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
102 | } |
|
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 | static void |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
105 | pidgin_message_foreach_attachment_helper(PurpleAttachment *attachment, |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
106 | gpointer data) |
|
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 | PidginAttachment *pidgin_attachment = NULL; |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
109 | PidginMessageAttachmentForeachData *d = NULL; |
|
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 | d = (PidginMessageAttachmentForeachData *)data; |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
112 | pidgin_attachment = pidgin_attachment_new(attachment); |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
113 | |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
114 | d->func(TALKATU_ATTACHMENT(pidgin_attachment), d->data); |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
115 | |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
116 | g_object_unref(G_OBJECT(pidgin_attachment)); |
|
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 | |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
119 | static void |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
120 | pidgin_message_foreach_attachment(TalkatuMessage *tmessage, |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
121 | TalkatuAttachmentForeachFunc func, |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
122 | gpointer data) |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
123 | { |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
124 | PidginMessage *pmessage = PIDGIN_MESSAGE(tmessage); |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
125 | PidginMessageAttachmentForeachData *d = NULL; |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
126 | |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
127 | /* PurpleAttachmentForeachFunc and TalkatuAttachmentForeachFunc may not |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
128 | * 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
|
129 | * function that has the signature of PurpleAttachmentForeachFunc but will |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
130 | * call the TalkatuAttachmentForeachFunc while also wrapping the |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
131 | * PurpleAttachments. |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
132 | */ |
|
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 | d = g_new(PidginMessageAttachmentForeachData, 1); |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
135 | d->func = func; |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
136 | d->data = data; |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
137 | |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
138 | purple_message_foreach_attachment( |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
139 | pmessage->message, |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
140 | pidgin_message_foreach_attachment_helper, |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
141 | d |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
142 | ); |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
143 | |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
144 | g_free(d); |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
145 | } |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
146 | |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
147 | static void |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
148 | pidgin_message_clear_attachments(TalkatuMessage *tmessage) { |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
149 | PidginMessage *pmessage = PIDGIN_MESSAGE(tmessage); |
|
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 | purple_message_clear_attachments(pmessage->message); |
|
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 | |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
154 | static void |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
155 | pidgin_message_talkatu_message_init(TalkatuMessageInterface *iface) { |
|
40526
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
156 | iface->add_attachment = pidgin_message_add_attachment; |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
157 | iface->remove_attachment = pidgin_message_remove_attachment; |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
158 | iface->get_attachment = pidgin_message_get_attachment; |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
159 | iface->foreach_attachment = pidgin_message_foreach_attachment; |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
160 | iface->clear_attachments = pidgin_message_clear_attachments; |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
161 | } |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
162 | |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
163 | /****************************************************************************** |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
164 | * GObject Implementation |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
165 | *****************************************************************************/ |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
166 | G_DEFINE_TYPE_EXTENDED( |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
167 | PidginMessage, |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
168 | pidgin_message, |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
169 | G_TYPE_OBJECT, |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
170 | 0, |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
171 | 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
|
172 | ); |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
173 | |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
174 | static void |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
175 | 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
|
176 | PidginMessage *message = PIDGIN_MESSAGE(obj); |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
177 | |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
178 | switch(param_id) { |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
179 | case PROP_MESSAGE: |
|
40526
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
180 | g_value_set_object(value, message->message); |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
181 | break; |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
182 | case PROP_ID: |
|
40526
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
183 | 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
|
184 | break; |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
185 | case PROP_CONTENT_TYPE: |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
186 | g_value_set_enum(value, TALKATU_CONTENT_TYPE_PLAIN); |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
187 | break; |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
188 | case PROP_AUTHOR: |
|
40526
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
189 | 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
|
190 | break; |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
191 | case PROP_CONTENTS: |
|
40526
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
192 | 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
|
193 | break; |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
194 | case PROP_TIMESTAMP: |
|
40541
9ceb8d25d4d9
PurpleMessage cleanups from hell
Gary Kramlich <grim@reaperworld.com>
parents:
40526
diff
changeset
|
195 | g_value_set_boxed(value, purple_message_get_timestamp(message->message)); |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
196 | break; |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
197 | case PROP_EDITED: |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
198 | g_value_set_boolean(value, FALSE); |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
199 | break; |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
200 | default: |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
201 | 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
|
202 | break; |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
203 | } |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
204 | } |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
205 | |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
206 | static void |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
207 | 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
|
208 | PidginMessage *message = PIDGIN_MESSAGE(obj); |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
209 | |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
210 | switch(param_id) { |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
211 | case PROP_MESSAGE: |
|
40526
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
212 | 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
|
213 | break; |
|
39704
8f0ffe559ea0
Some additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents:
39702
diff
changeset
|
214 | case PROP_ID: |
|
8f0ffe559ea0
Some additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents:
39702
diff
changeset
|
215 | case PROP_CONTENT_TYPE: |
|
8f0ffe559ea0
Some additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents:
39702
diff
changeset
|
216 | case PROP_TIMESTAMP: |
|
8f0ffe559ea0
Some additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents:
39702
diff
changeset
|
217 | case PROP_AUTHOR: |
|
8f0ffe559ea0
Some additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents:
39702
diff
changeset
|
218 | case PROP_CONTENTS: |
|
8f0ffe559ea0
Some additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents:
39702
diff
changeset
|
219 | case PROP_EDITED: |
|
8f0ffe559ea0
Some additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents:
39702
diff
changeset
|
220 | /* we don't allow settings these */ |
|
8f0ffe559ea0
Some additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents:
39702
diff
changeset
|
221 | break; |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
222 | default: |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
223 | 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
|
224 | break; |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
225 | } |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
226 | } |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
227 | |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
228 | static void |
|
40526
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
229 | pidgin_message_init(PidginMessage *message) { |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
230 | } |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
231 | |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
232 | static void |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
233 | pidgin_message_finalize(GObject *obj) { |
|
40526
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
234 | PidginMessage *message = PIDGIN_MESSAGE(obj); |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
235 | |
|
40526
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
236 | g_clear_object(&message->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 | G_OBJECT_CLASS(pidgin_message_parent_class)->finalize(obj); |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
239 | } |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
240 | |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
241 | static void |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
242 | pidgin_message_class_init(PidginMessageClass *klass) { |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
243 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
244 | |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
245 | obj_class->get_property = pidgin_message_get_property; |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
246 | obj_class->set_property = pidgin_message_set_property; |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
247 | obj_class->finalize = pidgin_message_finalize; |
|
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 | /* add our custom properties */ |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
250 | properties[PROP_MESSAGE] = g_param_spec_object( |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
251 | "message", "message", "The purple message", |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
252 | PURPLE_TYPE_MESSAGE, |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
253 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
254 | ); |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
255 | |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
256 | 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
|
257 | |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
258 | /* add our overridden properties */ |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
259 | 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
|
260 | 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
|
261 | 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
|
262 | 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
|
263 | 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
|
264 | 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
|
265 | } |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
266 | |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
267 | /****************************************************************************** |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
268 | * API |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
269 | *****************************************************************************/ |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
270 | PidginMessage * |
|
40526
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
271 | pidgin_message_new(PurpleMessage *message) { |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
272 | return g_object_new( |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
273 | PIDGIN_TYPE_MESSAGE, |
|
40526
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
274 | "message", message, |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
275 | NULL |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
276 | ); |
|
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 | |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
279 | PurpleMessage * |
|
40526
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
280 | pidgin_message_get_message(PidginMessage *message) { |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
281 | 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
|
282 | |
|
40526
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
283 | return message->message; |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
284 | } |