libpurple/purpleimconversation.c

Thu, 13 Aug 2020 18:29:17 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Thu, 13 Aug 2020 18:29:17 -0500
changeset 40506
cb26b9c6d4d0
child 40634
4d3018b00ad4
permissions
-rw-r--r--

Move PurpleIMConversation to its own file

Move PurpleIMConversation to it's own file.

Testing Done:
Compiled and was able to send an IM. It's not yet using `G_DECLARE_FINAL_TYPE` because `PurpleConversation` is not using `G_DECLARE_*` so it fails if I try to use it. I didn't clean up too much of the code yet, but I tried to get most of the formatting changes we have.

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

40506
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * purple
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 *
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 * Purple is the legal property of its developers, whose names are too numerous
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * source distribution.
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 *
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * (at your option) any later version.
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 *
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * GNU General Public License for more details.
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 *
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 * along with this program; if not, see <https://www.gnu.org/licenses/>.
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 */
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22 #include <libpurple/purpleimconversation.h>
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24 #include <libpurple/enums.h>
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25 #include <libpurple/purpleprivate.h>
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 struct _PurpleIMConversation {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28 PurpleConversation parent;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 PurpleIMTypingState typing_state;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 guint typing_timeout;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 time_t type_again;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33 guint send_typed_timeout;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 PurpleBuddyIcon *icon;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 };
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 enum {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 PROP_0 = 0,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 PROP_TYPING_STATE,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 PROP_ICON,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 N_PROPERTIES,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 };
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 static GParamSpec *properties[N_PROPERTIES];
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46 #define SEND_TYPED_TIMEOUT_SECONDS 5
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 /******************************************************************************
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 * Callbacks
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 *****************************************************************************/
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51 static gboolean
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 purple_im_conversation_reset_typing_cb(gpointer data)
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 PurpleIMConversation *im = PURPLE_IM_CONVERSATION(data);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 purple_im_conversation_set_typing_state(im, PURPLE_IM_NOT_TYPING);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 purple_im_conversation_stop_typing_timeout(im);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59 return FALSE;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62 static gboolean
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63 purple_im_conversation_send_typed_cb(gpointer data)
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65 PurpleIMConversation *im = PURPLE_IM_CONVERSATION(data);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 PurpleConnection *pc = NULL;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 const gchar *name;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69 g_return_val_if_fail(im != NULL, FALSE);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71 pc = purple_conversation_get_connection(PURPLE_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72 name = purple_conversation_get_name(PURPLE_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74 if(pc != NULL && name != NULL) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 /* We set this to 1 so that PURPLE_IM_TYPING will be sent if the Purple
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76 * user types anything else.
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77 */
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 purple_im_conversation_set_type_again(im, 1);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80 purple_serv_send_typing(pc, name, PURPLE_IM_TYPED);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
82 purple_debug(PURPLE_DEBUG_MISC, "purple-im-conversation", "typed...\n");
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85 return FALSE;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88 /******************************************************************************
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89 * PurpleConversation Implementation
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 *****************************************************************************/
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91 static void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92 im_conversation_write_message(PurpleConversation *conv, PurpleMessage *msg) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93 PurpleIMConversation *im = PURPLE_IM_CONVERSATION(conv);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94 gboolean is_recv = FALSE;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96 g_return_if_fail(im != NULL);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 g_return_if_fail(msg != NULL);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
98
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
99 is_recv = (purple_message_get_flags(msg) & PURPLE_MESSAGE_RECV);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
101 if(is_recv) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
102 purple_im_conversation_set_typing_state(im, PURPLE_IM_NOT_TYPING);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
103 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
104
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
105 _purple_conversation_write_common(conv, msg);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
106 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
107
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
108 /******************************************************************************
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
109 * GObject Implementation
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
110 *****************************************************************************/
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
111 G_DEFINE_TYPE(PurpleIMConversation, purple_im_conversation,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
112 PURPLE_TYPE_CONVERSATION);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
113
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
114 static void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
115 purple_im_conversation_get_property(GObject *obj, guint param_id, GValue *value,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
116 GParamSpec *pspec)
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
117 {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
118 PurpleIMConversation *im = PURPLE_IM_CONVERSATION(obj);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
119
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
120 switch (param_id) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
121 case PROP_TYPING_STATE:
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
122 g_value_set_enum(value,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
123 purple_im_conversation_get_typing_state(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
124 break;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
125 case PROP_ICON:
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
126 g_value_set_pointer(value, purple_im_conversation_get_icon(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
127 break;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
128 default:
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
129 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
130 break;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
131 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
132 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
133
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
134 static void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
135 purple_im_conversation_set_property(GObject *obj, guint param_id,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
136 const GValue *value, GParamSpec *pspec)
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
137 {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
138 PurpleIMConversation *im = PURPLE_IM_CONVERSATION(obj);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
139
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
140 switch (param_id) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
141 case PROP_TYPING_STATE:
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
142 purple_im_conversation_set_typing_state(im,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
143 g_value_get_enum(value));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
144 break;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
145 case PROP_ICON:
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
146 purple_im_conversation_set_icon(im, g_value_get_pointer(value));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
147 break;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
148 default:
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
149 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
150 break;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
151 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
152 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
153
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
154 static void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
155 purple_im_conversation_init(PurpleIMConversation *im) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
156 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
157
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
158 static void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
159 purple_im_conversation_constructed(GObject *object) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
160 PurpleIMConversation *im = PURPLE_IM_CONVERSATION(object);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
161 PurpleAccount *account = NULL;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
162 PurpleBuddyIcon *icon = NULL;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
163 gchar *name = NULL;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
164
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
165 G_OBJECT_CLASS(purple_im_conversation_parent_class)->constructed(object);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
166
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
167 g_object_get(object,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
168 "account", &account,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
169 "name", &name,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
170 NULL);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
171
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
172 if((icon = purple_buddy_icons_find(account, name))) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
173 purple_im_conversation_set_icon(im, icon);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
174 /* purple_im_conversation_set_icon refs the icon. */
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
175 purple_buddy_icon_unref(icon);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
176 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
177
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
178 if(purple_prefs_get_bool("/purple/logging/log_ims")) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
179 purple_conversation_set_logging(PURPLE_CONVERSATION(im), TRUE);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
180 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
181
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
182 g_object_unref(account);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
183 g_free(name);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
184 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
185
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
186 static void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
187 purple_im_conversation_dispose(GObject *obj) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
188 PurpleIMConversation *im = PURPLE_IM_CONVERSATION(obj);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
189
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
190 g_clear_pointer(&im->icon, purple_buddy_icon_unref);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
191
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
192 G_OBJECT_CLASS(purple_im_conversation_parent_class)->dispose(obj);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
193 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
194
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
195 static void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
196 purple_im_conversation_finalize(GObject *obj) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
197 PurpleIMConversation *im = PURPLE_IM_CONVERSATION(obj);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
198 PurpleConnection *pc = purple_conversation_get_connection(PURPLE_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
199 PurpleProtocol *protocol = NULL;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
200 const gchar *name = purple_conversation_get_name(PURPLE_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
201
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
202 if(pc != NULL) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
203 /* Still connected */
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
204 protocol = purple_connection_get_protocol(pc);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
205
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
206 if(purple_prefs_get_bool("/purple/conversations/im/send_typing")) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
207 purple_serv_send_typing(pc, name, PURPLE_IM_NOT_TYPING);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
208 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
209
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
210 purple_protocol_client_iface_convo_closed(protocol, pc, name);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
211 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
212
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
213 purple_im_conversation_stop_typing_timeout(im);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
214 purple_im_conversation_stop_send_typed_timeout(im);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
215
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
216 G_OBJECT_CLASS(purple_im_conversation_parent_class)->finalize(obj);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
217 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
218
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
219 static void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
220 purple_im_conversation_class_init(PurpleIMConversationClass *klass) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
221 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
222 PurpleConversationClass *conv_class = PURPLE_CONVERSATION_CLASS(klass);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
223
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
224 obj_class->get_property = purple_im_conversation_get_property;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
225 obj_class->set_property = purple_im_conversation_set_property;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
226 obj_class->dispose = purple_im_conversation_dispose;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
227 obj_class->finalize = purple_im_conversation_finalize;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
228 obj_class->constructed = purple_im_conversation_constructed;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
229
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
230 conv_class->write_message = im_conversation_write_message;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
231
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
232 properties[PROP_TYPING_STATE] = g_param_spec_enum(
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
233 "typing-state", "Typing state",
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
234 "Status of the user's typing of a message.",
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
235 PURPLE_TYPE_IM_TYPING_STATE, PURPLE_IM_NOT_TYPING,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
236 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
237
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
238 properties[PROP_ICON] = g_param_spec_pointer(
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
239 "icon", "Buddy icon", "The buddy icon for the IM.",
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
240 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
241
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
242 g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
243 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
244
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
245 /******************************************************************************
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
246 * Public API
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
247 *****************************************************************************/
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
248 PurpleIMConversation *
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
249 purple_im_conversation_new(PurpleAccount *account, const char *name)
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
250 {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
251 PurpleIMConversation *im = NULL;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
252
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
253 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
254 g_return_val_if_fail(name != NULL, NULL);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
255
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
256 /* Check if this conversation already exists. */
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
257 if((im = purple_conversations_find_im_with_account(name, account)) != NULL) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
258 return g_object_ref(im);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
259 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
260
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
261 im = g_object_new(PURPLE_TYPE_IM_CONVERSATION,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
262 "account", account,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
263 "name", name,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
264 "title", name,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
265 NULL);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
266
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
267 return im;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
268 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
269
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
270 void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
271 purple_im_conversation_set_icon(PurpleIMConversation *im,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
272 PurpleBuddyIcon *icon)
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
273 {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
274 g_return_if_fail(PURPLE_IS_IM_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
275
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
276 if(im->icon != icon) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
277 purple_buddy_icon_unref(im->icon);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
278
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
279 im->icon = (icon == NULL) ? NULL : purple_buddy_icon_ref(icon);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
280
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
281 g_object_notify_by_pspec(G_OBJECT(im), properties[PROP_ICON]);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
282 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
283
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
284 purple_conversation_update(PURPLE_CONVERSATION(im),
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
285 PURPLE_CONVERSATION_UPDATE_ICON);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
286 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
287
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
288 PurpleBuddyIcon *
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
289 purple_im_conversation_get_icon(PurpleIMConversation *im) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
290 g_return_val_if_fail(PURPLE_IS_IM_CONVERSATION(im), NULL);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
291
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
292 return im->icon;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
293 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
294
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
295 void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
296 purple_im_conversation_set_typing_state(PurpleIMConversation *im,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
297 PurpleIMTypingState state)
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
298 {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
299 PurpleAccount *account = NULL;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
300 const gchar *name = NULL;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
301
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
302 g_return_if_fail(PURPLE_IS_IM_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
303
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
304 name = purple_conversation_get_name(PURPLE_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
305 account = purple_conversation_get_account(PURPLE_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
306
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
307 if(im->typing_state != state) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
308 im->typing_state = state;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
309
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
310 g_object_notify_by_pspec(G_OBJECT(im), properties[PROP_TYPING_STATE]);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
311
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
312 switch (state) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
313 case PURPLE_IM_TYPING:
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
314 purple_signal_emit(purple_conversations_get_handle(),
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
315 "buddy-typing", account, name);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
316 break;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
317 case PURPLE_IM_TYPED:
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
318 purple_signal_emit(purple_conversations_get_handle(),
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
319 "buddy-typed", account, name);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
320 break;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
321 case PURPLE_IM_NOT_TYPING:
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
322 purple_signal_emit(purple_conversations_get_handle(),
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
323 "buddy-typing-stopped", account, name);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
324 break;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
325 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
326
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
327 purple_im_conversation_update_typing(im);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
328 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
329 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
330
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
331 PurpleIMTypingState
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
332 purple_im_conversation_get_typing_state(PurpleIMConversation *im) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
333 g_return_val_if_fail(PURPLE_IS_IM_CONVERSATION(im), 0);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
334
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
335 return im->typing_state;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
336 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
337
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
338 void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
339 purple_im_conversation_start_typing_timeout(PurpleIMConversation *im,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
340 gint timeout)
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
341 {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
342 g_return_if_fail(PURPLE_IS_IM_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
343
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
344 if(im->typing_timeout > 0) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
345 purple_im_conversation_stop_typing_timeout(im);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
346 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
347
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
348 im->typing_timeout =
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
349 g_timeout_add_seconds(timeout, purple_im_conversation_reset_typing_cb,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
350 im);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
351 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
352
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
353 void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
354 purple_im_conversation_stop_typing_timeout(PurpleIMConversation *im) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
355 g_return_if_fail(PURPLE_IS_IM_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
356
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
357 if(im->typing_timeout == 0) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
358 return;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
359 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
360
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
361 g_source_remove(im->typing_timeout);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
362 im->typing_timeout = 0;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
363 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
364
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
365 guint
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
366 purple_im_conversation_get_typing_timeout(PurpleIMConversation *im) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
367 g_return_val_if_fail(PURPLE_IS_IM_CONVERSATION(im), 0);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
368
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
369 return im->typing_timeout;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
370 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
371
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
372 void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
373 purple_im_conversation_set_type_again(PurpleIMConversation *im, guint val) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
374 g_return_if_fail(PURPLE_IS_IM_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
375
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
376 if(val == 0) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
377 im->type_again = 0;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
378 } else {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
379 im->type_again = time(NULL) + val;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
380 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
381 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
382
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
383 time_t
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
384 purple_im_conversation_get_type_again(PurpleIMConversation *im) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
385 g_return_val_if_fail(PURPLE_IS_IM_CONVERSATION(im), 0);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
386
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
387 return im->type_again;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
388 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
389
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
390 void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
391 purple_im_conversation_start_send_typed_timeout(PurpleIMConversation *im) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
392 g_return_if_fail(PURPLE_IS_IM_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
393
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
394 purple_im_conversation_stop_send_typed_timeout(im);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
395 im->send_typed_timeout =
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
396 g_timeout_add_seconds(SEND_TYPED_TIMEOUT_SECONDS,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
397 purple_im_conversation_send_typed_cb, im);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
398 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
399
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
400 void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
401 purple_im_conversation_stop_send_typed_timeout(PurpleIMConversation *im) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
402 g_return_if_fail(PURPLE_IS_IM_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
403
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
404 if(im->send_typed_timeout == 0) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
405 return;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
406 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
407
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
408 g_source_remove(im->send_typed_timeout);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
409 im->send_typed_timeout = 0;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
410 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
411
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
412 guint
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
413 purple_im_conversation_get_send_typed_timeout(PurpleIMConversation *im) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
414 g_return_val_if_fail(PURPLE_IS_IM_CONVERSATION(im), 0);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
415
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
416 return im->send_typed_timeout;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
417 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
418
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
419 void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
420 purple_im_conversation_update_typing(PurpleIMConversation *im) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
421 g_return_if_fail(PURPLE_IS_IM_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
422
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
423 purple_conversation_update(PURPLE_CONVERSATION(im),
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
424 PURPLE_CONVERSATION_UPDATE_TYPING);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
425 }

mercurial