pidgin/pidginmessage.c

Wed, 05 Feb 2020 02:01:25 -0600

author
Koosha Khajehmoogahi <koosha@posteo.de>
date
Wed, 05 Feb 2020 02:01:25 -0600
changeset 40288
b72d9137eca7
parent 39825
ccf8ca59d347
child 40526
c8cc1a4c4a02
permissions
-rw-r--r--

Fix whitespace

Signed-off-by: Richard Laager <rlaager@pidgin.im>

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
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24 struct _PidginMessage {
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25 GObject parent;
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 PurpleMessage *msg;
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28 GDateTime *timestamp;
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29 };
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 enum {
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 PROP_0,
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33 PROP_MESSAGE,
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 N_PROPERTIES,
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 /* overrides */
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 PROP_ID = N_PROPERTIES,
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 PROP_CONTENT_TYPE,
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 PROP_AUTHOR,
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 PROP_CONTENTS,
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 PROP_TIMESTAMP,
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 PROP_EDITED,
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 };
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 static GParamSpec *properties[N_PROPERTIES] = {NULL, };
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 /******************************************************************************
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46 * Helpers
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47 *****************************************************************************/
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 static void
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 pidgin_message_set_message(PidginMessage *msg, PurpleMessage *purple_msg) {
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 if(g_set_object(&msg->msg, purple_msg)) {
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51 g_clear_pointer(&msg->timestamp, g_date_time_unref);
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 msg->timestamp = g_date_time_new_from_unix_local(purple_message_get_time(purple_msg));
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 g_object_freeze_notify(G_OBJECT(msg));
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 g_object_notify_by_pspec(G_OBJECT(msg), properties[PROP_MESSAGE]);
39825
ccf8ca59d347 Fix a few g_warning messages that were legit errors
Gary Kramlich <grim@reaperworld.com>
parents: 39712
diff changeset
56 g_object_notify(G_OBJECT(msg), "timestamp");
39702
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 g_object_thaw_notify(G_OBJECT(msg));
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 *****************************************************************************/
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 static void
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65 pidgin_message_talkatu_message_init(TalkatuMessageInterface *iface) {
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 /* we don't actually change behavior, we just override properties */
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 /******************************************************************************
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70 * GObject Implementation
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71 *****************************************************************************/
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72 G_DEFINE_TYPE_EXTENDED(
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73 PidginMessage,
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74 pidgin_message,
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 G_TYPE_OBJECT,
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76 0,
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77 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
78 );
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80 static void
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81 pidgin_message_get_property(GObject *obj, guint param_id, GValue *value, GParamSpec *pspec) {
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
82 PidginMessage *msg = PIDGIN_MESSAGE(obj);
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84 switch(param_id) {
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85 case PROP_MESSAGE:
39712
0534fc3f2891 Avoid calling a function that we don't need to
Gary Kramlich <grim@reaperworld.com>
parents: 39704
diff changeset
86 g_value_set_object(value, msg->msg);
39702
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87 break;
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88 case PROP_ID:
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89 g_value_set_uint(value, purple_message_get_id(msg->msg));
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 break;
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91 case PROP_CONTENT_TYPE:
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92 g_value_set_enum(value, TALKATU_CONTENT_TYPE_PLAIN);
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93 break;
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94 case PROP_AUTHOR:
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95 g_value_set_string(value, purple_message_get_author(msg->msg));
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96 break;
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 case PROP_CONTENTS:
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
98 g_value_set_string(value, purple_message_get_contents(msg->msg));
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
99 break;
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100 case PROP_TIMESTAMP:
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
101 g_value_set_pointer(value, msg->timestamp);
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
102 break;
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
103 case PROP_EDITED:
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
104 g_value_set_boolean(value, FALSE);
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
105 break;
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
106 default:
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
107 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
108 break;
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
109 }
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
110 }
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
111
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
112 static void
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
113 pidgin_message_set_property(GObject *obj, guint param_id, const GValue *value, GParamSpec *pspec) {
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
114 PidginMessage *msg = PIDGIN_MESSAGE(obj);
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
115
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
116 switch(param_id) {
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
117 case PROP_MESSAGE:
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
118 pidgin_message_set_message(msg, g_value_get_object(value));
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
119 break;
39704
8f0ffe559ea0 Some additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 39702
diff changeset
120 case PROP_ID:
8f0ffe559ea0 Some additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 39702
diff changeset
121 case PROP_CONTENT_TYPE:
8f0ffe559ea0 Some additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 39702
diff changeset
122 case PROP_TIMESTAMP:
8f0ffe559ea0 Some additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 39702
diff changeset
123 case PROP_AUTHOR:
8f0ffe559ea0 Some additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 39702
diff changeset
124 case PROP_CONTENTS:
8f0ffe559ea0 Some additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 39702
diff changeset
125 case PROP_EDITED:
8f0ffe559ea0 Some additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 39702
diff changeset
126 /* we don't allow settings these */
8f0ffe559ea0 Some additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents: 39702
diff changeset
127 break;
39702
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
128 default:
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
129 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
130 break;
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
131 }
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
132 }
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
133
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
134 static void
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
135 pidgin_message_init(PidginMessage *msg) {
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
136 }
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
137
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
138 static void
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
139 pidgin_message_finalize(GObject *obj) {
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
140 PidginMessage *msg = PIDGIN_MESSAGE(obj);
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
141
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
142 g_clear_object(&msg->msg);
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
143 g_clear_pointer(&msg->timestamp, g_date_time_unref);
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
144
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
145 G_OBJECT_CLASS(pidgin_message_parent_class)->finalize(obj);
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
146 }
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
147
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
148 static void
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
149 pidgin_message_class_init(PidginMessageClass *klass) {
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
150 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
151
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
152 obj_class->get_property = pidgin_message_get_property;
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
153 obj_class->set_property = pidgin_message_set_property;
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
154 obj_class->finalize = pidgin_message_finalize;
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
155
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
156 /* add our custom properties */
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
157 properties[PROP_MESSAGE] = g_param_spec_object(
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
158 "message", "message", "The purple message",
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
159 PURPLE_TYPE_MESSAGE,
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
160 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY
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 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
164
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
165 /* add our overridden properties */
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
166 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
167 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
168 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
169 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
170 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
171 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
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 /******************************************************************************
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
175 * API
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
176 *****************************************************************************/
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
177 PidginMessage *
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
178 pidgin_message_new(PurpleMessage *msg) {
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
179 return g_object_new(
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
180 PIDGIN_TYPE_MESSAGE,
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
181 "message", msg,
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
182 NULL
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
183 );
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
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
186 PurpleMessage *
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
187 pidgin_message_get_message(PidginMessage *msg) {
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
188 g_return_val_if_fail(PIDGIN_IS_MESSAGE(msg), NULL);
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
189
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
190 return msg->msg;
8102041c0288 Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
191 }

mercurial