libpurple/purpleimconversation.c

Mon, 11 Jan 2021 01:51:14 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Mon, 11 Jan 2021 01:51:14 -0600
changeset 40697
81f81f5d2f39
parent 40634
4d3018b00ad4
child 40765
a5381c20e802
permissions
-rw-r--r--

Split PurpleProtocolChat to its own file and clean up the API.

Testing Done:
* Compiled and tested bonjour (not affected) and irc locally.
* Built and verified the docs.
* verified `ninja pidgin-pot` was successful.

Bugs closed: 17457

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

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>
40634
4d3018b00ad4 Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40506
diff changeset
26 #include <libpurple/purpleprotocolclient.h>
40506
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28 struct _PurpleIMConversation {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29 PurpleConversation parent;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 PurpleIMTypingState typing_state;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 guint typing_timeout;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33 time_t type_again;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 guint send_typed_timeout;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 PurpleBuddyIcon *icon;
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
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 enum {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 PROP_0 = 0,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 PROP_TYPING_STATE,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 PROP_ICON,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 N_PROPERTIES,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 };
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 static GParamSpec *properties[N_PROPERTIES];
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47 #define SEND_TYPED_TIMEOUT_SECONDS 5
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 /******************************************************************************
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 * Callbacks
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51 *****************************************************************************/
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 static gboolean
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 purple_im_conversation_reset_typing_cb(gpointer data)
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 PurpleIMConversation *im = PURPLE_IM_CONVERSATION(data);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 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
58 purple_im_conversation_stop_typing_timeout(im);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 return FALSE;
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
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63 static gboolean
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 purple_im_conversation_send_typed_cb(gpointer data)
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65 {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 PurpleIMConversation *im = PURPLE_IM_CONVERSATION(data);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 PurpleConnection *pc = NULL;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68 const gchar *name;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70 g_return_val_if_fail(im != NULL, FALSE);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72 pc = purple_conversation_get_connection(PURPLE_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73 name = purple_conversation_get_name(PURPLE_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 if(pc != NULL && name != NULL) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76 /* 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
77 * user types anything else.
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 */
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79 purple_im_conversation_set_type_again(im, 1);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81 purple_serv_send_typing(pc, name, PURPLE_IM_TYPED);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
82
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83 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
84 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86 return FALSE;
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 /******************************************************************************
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 * PurpleConversation Implementation
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91 *****************************************************************************/
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92 static void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93 im_conversation_write_message(PurpleConversation *conv, PurpleMessage *msg) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94 PurpleIMConversation *im = PURPLE_IM_CONVERSATION(conv);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95 gboolean is_recv = FALSE;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 g_return_if_fail(im != NULL);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
98 g_return_if_fail(msg != NULL);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
99
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100 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
101
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
102 if(is_recv) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
103 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
104 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
105
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
106 _purple_conversation_write_common(conv, msg);
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 /******************************************************************************
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
110 * GObject Implementation
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
111 *****************************************************************************/
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
112 G_DEFINE_TYPE(PurpleIMConversation, purple_im_conversation,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
113 PURPLE_TYPE_CONVERSATION);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
114
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
115 static void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
116 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
117 GParamSpec *pspec)
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
118 {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
119 PurpleIMConversation *im = PURPLE_IM_CONVERSATION(obj);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
120
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
121 switch (param_id) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
122 case PROP_TYPING_STATE:
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
123 g_value_set_enum(value,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
124 purple_im_conversation_get_typing_state(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
125 break;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
126 case PROP_ICON:
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
127 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
128 break;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
129 default:
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
130 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
131 break;
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
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
135 static void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
136 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
137 const GValue *value, GParamSpec *pspec)
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
138 {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
139 PurpleIMConversation *im = PURPLE_IM_CONVERSATION(obj);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
140
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
141 switch (param_id) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
142 case PROP_TYPING_STATE:
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
143 purple_im_conversation_set_typing_state(im,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
144 g_value_get_enum(value));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
145 break;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
146 case PROP_ICON:
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
147 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
148 break;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
149 default:
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
150 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
151 break;
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
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
155 static void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
156 purple_im_conversation_init(PurpleIMConversation *im) {
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
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
159 static void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
160 purple_im_conversation_constructed(GObject *object) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
161 PurpleIMConversation *im = PURPLE_IM_CONVERSATION(object);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
162 PurpleAccount *account = NULL;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
163 PurpleBuddyIcon *icon = NULL;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
164 gchar *name = NULL;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
165
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
166 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
167
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
168 g_object_get(object,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
169 "account", &account,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
170 "name", &name,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
171 NULL);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
172
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
173 if((icon = purple_buddy_icons_find(account, name))) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
174 purple_im_conversation_set_icon(im, icon);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
175 /* purple_im_conversation_set_icon refs the icon. */
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
176 purple_buddy_icon_unref(icon);
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
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
179 if(purple_prefs_get_bool("/purple/logging/log_ims")) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
180 purple_conversation_set_logging(PURPLE_CONVERSATION(im), TRUE);
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
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
183 g_object_unref(account);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
184 g_free(name);
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
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
187 static void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
188 purple_im_conversation_dispose(GObject *obj) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
189 PurpleIMConversation *im = PURPLE_IM_CONVERSATION(obj);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
190
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
191 g_clear_pointer(&im->icon, purple_buddy_icon_unref);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
192
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
193 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
194 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
195
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
196 static void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
197 purple_im_conversation_finalize(GObject *obj) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
198 PurpleIMConversation *im = PURPLE_IM_CONVERSATION(obj);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
199 PurpleConnection *pc = purple_conversation_get_connection(PURPLE_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
200 PurpleProtocol *protocol = NULL;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
201 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
202
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
203 if(pc != NULL) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
204 /* Still connected */
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
205 protocol = purple_connection_get_protocol(pc);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
206
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
207 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
208 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
209 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
210
40634
4d3018b00ad4 Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40506
diff changeset
211 purple_protocol_client_convo_closed(PURPLE_PROTOCOL_CLIENT(protocol),
4d3018b00ad4 Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40506
diff changeset
212 pc, name);
40506
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
213 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
214
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
215 purple_im_conversation_stop_typing_timeout(im);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
216 purple_im_conversation_stop_send_typed_timeout(im);
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 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
219 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
220
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
221 static void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
222 purple_im_conversation_class_init(PurpleIMConversationClass *klass) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
223 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
224 PurpleConversationClass *conv_class = PURPLE_CONVERSATION_CLASS(klass);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
225
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
226 obj_class->get_property = purple_im_conversation_get_property;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
227 obj_class->set_property = purple_im_conversation_set_property;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
228 obj_class->dispose = purple_im_conversation_dispose;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
229 obj_class->finalize = purple_im_conversation_finalize;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
230 obj_class->constructed = purple_im_conversation_constructed;
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 conv_class->write_message = im_conversation_write_message;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
233
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
234 properties[PROP_TYPING_STATE] = g_param_spec_enum(
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
235 "typing-state", "Typing state",
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
236 "Status of the user's typing of a message.",
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
237 PURPLE_TYPE_IM_TYPING_STATE, PURPLE_IM_NOT_TYPING,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
238 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
239
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
240 properties[PROP_ICON] = g_param_spec_pointer(
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
241 "icon", "Buddy icon", "The buddy icon for the IM.",
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
242 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
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 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
245 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
246
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 * Public API
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
249 *****************************************************************************/
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
250 PurpleIMConversation *
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
251 purple_im_conversation_new(PurpleAccount *account, const char *name)
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 PurpleIMConversation *im = NULL;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
254
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
255 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
256 g_return_val_if_fail(name != NULL, NULL);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
257
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
258 /* Check if this conversation already exists. */
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
259 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
260 return g_object_ref(im);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
261 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
262
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
263 im = g_object_new(PURPLE_TYPE_IM_CONVERSATION,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
264 "account", account,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
265 "name", name,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
266 "title", name,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
267 NULL);
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 return im;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
270 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
271
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
272 void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
273 purple_im_conversation_set_icon(PurpleIMConversation *im,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
274 PurpleBuddyIcon *icon)
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 g_return_if_fail(PURPLE_IS_IM_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
277
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
278 if(im->icon != icon) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
279 purple_buddy_icon_unref(im->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 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
282
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
283 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
284 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
285
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
286 purple_conversation_update(PURPLE_CONVERSATION(im),
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
287 PURPLE_CONVERSATION_UPDATE_ICON);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
288 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
289
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
290 PurpleBuddyIcon *
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
291 purple_im_conversation_get_icon(PurpleIMConversation *im) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
292 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
293
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
294 return im->icon;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
295 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
296
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
297 void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
298 purple_im_conversation_set_typing_state(PurpleIMConversation *im,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
299 PurpleIMTypingState state)
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
300 {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
301 PurpleAccount *account = NULL;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
302 const gchar *name = NULL;
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 g_return_if_fail(PURPLE_IS_IM_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
305
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
306 name = purple_conversation_get_name(PURPLE_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
307 account = purple_conversation_get_account(PURPLE_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
308
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
309 if(im->typing_state != state) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
310 im->typing_state = 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 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
313
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
314 switch (state) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
315 case PURPLE_IM_TYPING:
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
316 purple_signal_emit(purple_conversations_get_handle(),
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
317 "buddy-typing", account, name);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
318 break;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
319 case PURPLE_IM_TYPED:
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
320 purple_signal_emit(purple_conversations_get_handle(),
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
321 "buddy-typed", account, name);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
322 break;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
323 case PURPLE_IM_NOT_TYPING:
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
324 purple_signal_emit(purple_conversations_get_handle(),
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
325 "buddy-typing-stopped", account, name);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
326 break;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
327 }
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 purple_im_conversation_update_typing(im);
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 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
332
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
333 PurpleIMTypingState
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
334 purple_im_conversation_get_typing_state(PurpleIMConversation *im) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
335 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
336
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
337 return im->typing_state;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
338 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
339
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
340 void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
341 purple_im_conversation_start_typing_timeout(PurpleIMConversation *im,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
342 gint timeout)
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 g_return_if_fail(PURPLE_IS_IM_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
345
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
346 if(im->typing_timeout > 0) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
347 purple_im_conversation_stop_typing_timeout(im);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
348 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
349
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
350 im->typing_timeout =
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
351 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
352 im);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
353 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
354
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
355 void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
356 purple_im_conversation_stop_typing_timeout(PurpleIMConversation *im) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
357 g_return_if_fail(PURPLE_IS_IM_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
358
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
359 if(im->typing_timeout == 0) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
360 return;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
361 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
362
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
363 g_source_remove(im->typing_timeout);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
364 im->typing_timeout = 0;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
365 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
366
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
367 guint
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
368 purple_im_conversation_get_typing_timeout(PurpleIMConversation *im) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
369 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
370
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
371 return im->typing_timeout;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
372 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
373
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
374 void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
375 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
376 g_return_if_fail(PURPLE_IS_IM_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
377
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
378 if(val == 0) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
379 im->type_again = 0;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
380 } else {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
381 im->type_again = time(NULL) + val;
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 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
384
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
385 time_t
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
386 purple_im_conversation_get_type_again(PurpleIMConversation *im) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
387 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
388
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
389 return im->type_again;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
390 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
391
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
392 void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
393 purple_im_conversation_start_send_typed_timeout(PurpleIMConversation *im) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
394 g_return_if_fail(PURPLE_IS_IM_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
395
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
396 purple_im_conversation_stop_send_typed_timeout(im);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
397 im->send_typed_timeout =
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
398 g_timeout_add_seconds(SEND_TYPED_TIMEOUT_SECONDS,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
399 purple_im_conversation_send_typed_cb, im);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
400 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
401
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
402 void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
403 purple_im_conversation_stop_send_typed_timeout(PurpleIMConversation *im) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
404 g_return_if_fail(PURPLE_IS_IM_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
405
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
406 if(im->send_typed_timeout == 0) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
407 return;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
408 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
409
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
410 g_source_remove(im->send_typed_timeout);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
411 im->send_typed_timeout = 0;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
412 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
413
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
414 guint
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
415 purple_im_conversation_get_send_typed_timeout(PurpleIMConversation *im) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
416 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
417
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
418 return im->send_typed_timeout;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
419 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
420
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
421 void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
422 purple_im_conversation_update_typing(PurpleIMConversation *im) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
423 g_return_if_fail(PURPLE_IS_IM_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
424
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
425 purple_conversation_update(PURPLE_CONVERSATION(im),
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
426 PURPLE_CONVERSATION_UPDATE_TYPING);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
427 }

mercurial