libpurple/purpleimconversation.c

Fri, 11 Mar 2022 03:29:48 -0600

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Fri, 11 Mar 2022 03:29:48 -0600
changeset 41281
aa8fc0497d6d
parent 41137
3c1574216aed
child 41960
c8a4853205e3
permissions
-rw-r--r--

Add an echo user to the demo protocol

Testing Done:
Opened a conversation and typed a few message.

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

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
40870
e3397381fd35 Remove includes from protocol.h that weren't used there and deal with the fallout
Gary Kramlich <grim@reaperworld.com>
parents: 40765
diff changeset
24 #include <libpurple/debug.h>
41137
3c1574216aed Now that the History API is here, remove the purple logging api
Gary Kramlich <grim@reaperworld.com>
parents: 41007
diff changeset
25 #include <libpurple/conversations.h>
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40885
diff changeset
26 #include <libpurple/purpleconversationmanager.h>
41007
90d2dee9b3dc Fix the includes for the purpleenums rename
Gary Kramlich <grim@reaperworld.com>
parents: 40992
diff changeset
27 #include <libpurple/purpleenums.h>
40506
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28 #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
29 #include <libpurple/purpleprotocolclient.h>
40506
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 struct _PurpleIMConversation {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 PurpleConversation parent;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 PurpleIMTypingState typing_state;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 guint typing_timeout;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 time_t type_again;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 guint send_typed_timeout;
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 PurpleBuddyIcon *icon;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 };
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 enum {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 PROP_0 = 0,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 PROP_TYPING_STATE,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 PROP_ICON,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46 N_PROPERTIES,
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 static GParamSpec *properties[N_PROPERTIES];
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 #define SEND_TYPED_TIMEOUT_SECONDS 5
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 /******************************************************************************
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 * Callbacks
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 static gboolean
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 purple_im_conversation_reset_typing_cb(gpointer data)
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 PurpleIMConversation *im = PURPLE_IM_CONVERSATION(data);
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 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
61 purple_im_conversation_stop_typing_timeout(im);
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 return FALSE;
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
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 static gboolean
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 purple_im_conversation_send_typed_cb(gpointer data)
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 PurpleIMConversation *im = PURPLE_IM_CONVERSATION(data);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70 PurpleConnection *pc = NULL;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71 const gchar *name;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73 g_return_val_if_fail(im != NULL, FALSE);
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 pc = purple_conversation_get_connection(PURPLE_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76 name = purple_conversation_get_name(PURPLE_CONVERSATION(im));
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 if(pc != NULL && name != NULL) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79 /* 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
80 * user types anything else.
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_im_conversation_set_type_again(im, 1);
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 purple_serv_send_typing(pc, name, PURPLE_IM_TYPED);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85
40765
a5381c20e802 Use specific purple_debug_* functions
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40634
diff changeset
86 purple_debug_misc("purple-im-conversation", "typed...");
40506
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 return FALSE;
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
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92 /******************************************************************************
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93 * PurpleConversation Implementation
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94 *****************************************************************************/
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95 static void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96 im_conversation_write_message(PurpleConversation *conv, PurpleMessage *msg) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 PurpleIMConversation *im = PURPLE_IM_CONVERSATION(conv);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
98 gboolean is_recv = FALSE;
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 g_return_if_fail(im != NULL);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
101 g_return_if_fail(msg != NULL);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
102
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
103 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
104
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
105 if(is_recv) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
106 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
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 _purple_conversation_write_common(conv, msg);
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
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
112 /******************************************************************************
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
113 * GObject Implementation
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 G_DEFINE_TYPE(PurpleIMConversation, purple_im_conversation,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
116 PURPLE_TYPE_CONVERSATION);
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 static void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
119 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
120 GParamSpec *pspec)
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
121 {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
122 PurpleIMConversation *im = PURPLE_IM_CONVERSATION(obj);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
123
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
124 switch (param_id) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
125 case PROP_TYPING_STATE:
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
126 g_value_set_enum(value,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
127 purple_im_conversation_get_typing_state(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 case PROP_ICON:
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
130 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
131 break;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
132 default:
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
133 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
134 break;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
135 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
136 }
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 static void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
139 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
140 const GValue *value, GParamSpec *pspec)
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
141 {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
142 PurpleIMConversation *im = PURPLE_IM_CONVERSATION(obj);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
143
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
144 switch (param_id) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
145 case PROP_TYPING_STATE:
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
146 purple_im_conversation_set_typing_state(im,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
147 g_value_get_enum(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 case PROP_ICON:
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
150 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
151 break;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
152 default:
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
153 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
154 break;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
155 }
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_init(PurpleIMConversation *im) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
160 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
161
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
162 static void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
163 purple_im_conversation_constructed(GObject *object) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
164 PurpleIMConversation *im = PURPLE_IM_CONVERSATION(object);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
165 PurpleAccount *account = NULL;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
166 PurpleBuddyIcon *icon = NULL;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
167 gchar *name = NULL;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
168
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
169 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
170
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
171 g_object_get(object,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
172 "account", &account,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
173 "name", &name,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
174 NULL);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
175
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
176 if((icon = purple_buddy_icons_find(account, name))) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
177 purple_im_conversation_set_icon(im, icon);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
178 /* purple_im_conversation_set_icon refs the icon. */
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
179 purple_buddy_icon_unref(icon);
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
40634
4d3018b00ad4 Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40506
diff changeset
210 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
211 pc, name);
40506
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
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
214 purple_im_conversation_stop_typing_timeout(im);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
215 purple_im_conversation_stop_send_typed_timeout(im);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
216
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
217 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
218 }
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 static void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
221 purple_im_conversation_class_init(PurpleIMConversationClass *klass) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
222 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
223 PurpleConversationClass *conv_class = PURPLE_CONVERSATION_CLASS(klass);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
224
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
225 obj_class->get_property = purple_im_conversation_get_property;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
226 obj_class->set_property = purple_im_conversation_set_property;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
227 obj_class->dispose = purple_im_conversation_dispose;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
228 obj_class->finalize = purple_im_conversation_finalize;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
229 obj_class->constructed = purple_im_conversation_constructed;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
230
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
231 conv_class->write_message = im_conversation_write_message;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
232
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
233 properties[PROP_TYPING_STATE] = g_param_spec_enum(
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
234 "typing-state", "Typing state",
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
235 "Status of the user's typing of a message.",
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
236 PURPLE_TYPE_IM_TYPING_STATE, PURPLE_IM_NOT_TYPING,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
237 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
238
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
239 properties[PROP_ICON] = g_param_spec_pointer(
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
240 "icon", "Buddy icon", "The buddy icon for the IM.",
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
241 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
242
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
243 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
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 /******************************************************************************
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
247 * Public API
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
248 *****************************************************************************/
40885
87f6241da196 Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents: 40870
diff changeset
249 PurpleConversation *
40506
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
250 purple_im_conversation_new(PurpleAccount *account, const char *name)
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
251 {
40885
87f6241da196 Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents: 40870
diff changeset
252 PurpleConversation *im = NULL;
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40885
diff changeset
253 PurpleConversationManager *manager = NULL;
40506
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. */
40992
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40885
diff changeset
259 manager = purple_conversation_manager_get_default();
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40885
diff changeset
260 im = purple_conversation_manager_find_im(manager, account, name);
3a973a9c5a64 migrate libpurple to the ConversationManager API
Gary Kramlich <grim@reaperworld.com>
parents: 40885
diff changeset
261 if(PURPLE_IS_IM_CONVERSATION(im)) {
40506
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
262 return g_object_ref(im);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
263 }
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
264
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
265 im = g_object_new(PURPLE_TYPE_IM_CONVERSATION,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
266 "account", account,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
267 "name", name,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
268 "title", name,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
269 NULL);
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 return im;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
272 }
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 void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
275 purple_im_conversation_set_icon(PurpleIMConversation *im,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
276 PurpleBuddyIcon *icon)
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 g_return_if_fail(PURPLE_IS_IM_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
279
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
280 if(im->icon != icon) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
281 purple_buddy_icon_unref(im->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 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
284
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
285 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
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 purple_conversation_update(PURPLE_CONVERSATION(im),
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
289 PURPLE_CONVERSATION_UPDATE_ICON);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
290 }
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 PurpleBuddyIcon *
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
293 purple_im_conversation_get_icon(PurpleIMConversation *im) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
294 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
295
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
296 return im->icon;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
297 }
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 void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
300 purple_im_conversation_set_typing_state(PurpleIMConversation *im,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
301 PurpleIMTypingState state)
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
302 {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
303 PurpleAccount *account = NULL;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
304 const gchar *name = NULL;
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 g_return_if_fail(PURPLE_IS_IM_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
307
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
308 name = purple_conversation_get_name(PURPLE_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
309 account = purple_conversation_get_account(PURPLE_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
310
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
311 if(im->typing_state != state) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
312 im->typing_state = 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 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
315
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
316 switch (state) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
317 case PURPLE_IM_TYPING:
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-typing", 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_TYPED:
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-typed", 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 case PURPLE_IM_NOT_TYPING:
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
326 purple_signal_emit(purple_conversations_get_handle(),
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
327 "buddy-typing-stopped", account, name);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
328 break;
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 purple_im_conversation_update_typing(im);
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 }
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 PurpleIMTypingState
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
336 purple_im_conversation_get_typing_state(PurpleIMConversation *im) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
337 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
338
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
339 return im->typing_state;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
340 }
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 void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
343 purple_im_conversation_start_typing_timeout(PurpleIMConversation *im,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
344 gint timeout)
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 g_return_if_fail(PURPLE_IS_IM_CONVERSATION(im));
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 if(im->typing_timeout > 0) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
349 purple_im_conversation_stop_typing_timeout(im);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
350 }
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 im->typing_timeout =
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
353 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
354 im);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
355 }
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 void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
358 purple_im_conversation_stop_typing_timeout(PurpleIMConversation *im) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
359 g_return_if_fail(PURPLE_IS_IM_CONVERSATION(im));
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 if(im->typing_timeout == 0) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
362 return;
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 g_source_remove(im->typing_timeout);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
366 im->typing_timeout = 0;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
367 }
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 guint
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
370 purple_im_conversation_get_typing_timeout(PurpleIMConversation *im) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
371 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
372
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
373 return im->typing_timeout;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
374 }
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 void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
377 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
378 g_return_if_fail(PURPLE_IS_IM_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
379
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
380 if(val == 0) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
381 im->type_again = 0;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
382 } else {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
383 im->type_again = time(NULL) + val;
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 }
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 time_t
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
388 purple_im_conversation_get_type_again(PurpleIMConversation *im) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
389 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
390
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
391 return im->type_again;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
392 }
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 void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
395 purple_im_conversation_start_send_typed_timeout(PurpleIMConversation *im) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
396 g_return_if_fail(PURPLE_IS_IM_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
397
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
398 purple_im_conversation_stop_send_typed_timeout(im);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
399 im->send_typed_timeout =
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
400 g_timeout_add_seconds(SEND_TYPED_TIMEOUT_SECONDS,
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
401 purple_im_conversation_send_typed_cb, im);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
402 }
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 void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
405 purple_im_conversation_stop_send_typed_timeout(PurpleIMConversation *im) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
406 g_return_if_fail(PURPLE_IS_IM_CONVERSATION(im));
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 if(im->send_typed_timeout == 0) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
409 return;
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 g_source_remove(im->send_typed_timeout);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
413 im->send_typed_timeout = 0;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
414 }
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 guint
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
417 purple_im_conversation_get_send_typed_timeout(PurpleIMConversation *im) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
418 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
419
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
420 return im->send_typed_timeout;
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
421 }
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 void
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
424 purple_im_conversation_update_typing(PurpleIMConversation *im) {
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
425 g_return_if_fail(PURPLE_IS_IM_CONVERSATION(im));
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
426
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
427 purple_conversation_update(PURPLE_CONVERSATION(im),
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
428 PURPLE_CONVERSATION_UPDATE_TYPING);
cb26b9c6d4d0 Move PurpleIMConversation to its own file
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
429 }

mercurial