annotate src/conversation.c @ 12370:0d4484b7a46a

[gaim-migrate @ 14674] Changing the prototypes here broke FreeBSD. Looking at what was changed, I think reverting the changes for this file is best. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Tue, 06 Dec 2005 07:59:07 +0000
parents f9629b994b27
children b1717befbb26
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1 /*
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2 * gaim
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3 *
8046
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 8015
diff changeset
4 * Gaim is the legal property of its developers, whose names are too numerous
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 8015
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 8015
diff changeset
6 * source distribution.
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
7 *
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
11 * (at your option) any later version.
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
12 *
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
16 * GNU General Public License for more details.
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
17 *
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
21 */
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5860
diff changeset
22 #include "internal.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5860
diff changeset
23 #include "blist.h"
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
24 #include "conversation.h"
11146
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents: 11137
diff changeset
25 #include "dbus-maybe.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5860
diff changeset
26 #include "debug.h"
6982
083d1e4a9c78 [gaim-migrate @ 7538]
Mark Doliner <mark@kingant.net>
parents: 6846
diff changeset
27 #include "imgstore.h"
5436
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5350
diff changeset
28 #include "notify.h"
5539
de09863bd4b5 [gaim-migrate @ 5939]
Christian Hammond <chipx86@chipx86.com>
parents: 5436
diff changeset
29 #include "prefs.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5860
diff changeset
30 #include "prpl.h"
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
31 #include "signals.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5860
diff changeset
32 #include "util.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5860
diff changeset
33
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
34 #define SEND_TYPED_TIMEOUT 5000
4241
cc14954cc399 [gaim-migrate @ 4491]
Luke Schierer <lschiere@pidgin.im>
parents: 4228
diff changeset
35
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
36 static GList *conversations = NULL;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
37 static GList *ims = NULL;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
38 static GList *chats = NULL;
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11552
diff changeset
39 static GaimConversationUiOps *default_ops = NULL;
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11552
diff changeset
40
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11552
diff changeset
41
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11552
diff changeset
42 void
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11552
diff changeset
43 gaim_conversations_set_ui_ops(GaimConversationUiOps *ops)
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11552
diff changeset
44 {
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11552
diff changeset
45 default_ops = ops;
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11552
diff changeset
46 }
7602
df5b0937ea47 [gaim-migrate @ 8225]
Christian Hammond <chipx86@chipx86.com>
parents: 7562
diff changeset
47
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
48 static gboolean
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
49 reset_typing(gpointer data)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
50 {
6640
314111e7b601 [gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents: 6637
diff changeset
51 GaimConversation *c = (GaimConversation *)data;
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
52 GaimConvIm *im;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
53
6640
314111e7b601 [gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents: 6637
diff changeset
54 if (!g_list_find(conversations, c))
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
55 return FALSE;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
56
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
57 im = GAIM_CONV_IM(c);
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
58
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
59 gaim_conv_im_set_typing_state(im, GAIM_NOT_TYPING);
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
60 gaim_conv_im_update_typing(im);
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
61 gaim_conv_im_stop_typing_timeout(im);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
62
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
63 return FALSE;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
64 }
3159
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
65
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
66 static gboolean
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
67 send_typed(gpointer data)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
68 {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
69 GaimConversation *conv = (GaimConversation *)data;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
70 GaimConnection *gc;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
71 const char *name;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
72
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
73 gc = gaim_conversation_get_gc(conv);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
74 name = gaim_conversation_get_name(conv);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
75
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
76 if (conv != NULL && gc != NULL && name != NULL) {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
77 gaim_conv_im_set_type_again(GAIM_CONV_IM(conv), TRUE);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
78
6402
cc35d07a0dcc [gaim-migrate @ 6907]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
79 serv_send_typing(gc, name, GAIM_TYPED);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
80
5213
1cf4eb75e3ee [gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
81 gaim_debug(GAIM_DEBUG_MISC, "conversation", "typed...\n");
573
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 570
diff changeset
82 }
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
83
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2722
diff changeset
84 return FALSE;
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
85 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
86
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
87 static void
11921
8140885c022c [gaim-migrate @ 14212]
Mark Doliner <mark@kingant.net>
parents: 11869
diff changeset
88 common_send(GaimConversation *conv, const char *message, GaimMessageFlags msgflags)
3790
12b29552f1d7 [gaim-migrate @ 3930]
Rob Flynn <gaim@robflynn.com>
parents: 3789
diff changeset
89 {
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
90 GaimConversationType type;
10132
f55a64945e77 [gaim-migrate @ 11196]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
91 GaimAccount *account;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
92 GaimConnection *gc;
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
93 GaimConversationUiOps *ops;
8076
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
94 char *displayed = NULL, *sent = NULL;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
95 int plugin_return;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
96 int err = 0;
3790
12b29552f1d7 [gaim-migrate @ 3930]
Rob Flynn <gaim@robflynn.com>
parents: 3789
diff changeset
97
7947
746404b12236 [gaim-migrate @ 8621]
Mark Doliner <mark@kingant.net>
parents: 7930
diff changeset
98 if (strlen(message) == 0)
746404b12236 [gaim-migrate @ 8621]
Mark Doliner <mark@kingant.net>
parents: 7930
diff changeset
99 return;
746404b12236 [gaim-migrate @ 8621]
Mark Doliner <mark@kingant.net>
parents: 7930
diff changeset
100
10132
f55a64945e77 [gaim-migrate @ 11196]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
101 account = gaim_conversation_get_account(conv);
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
102 gc = gaim_conversation_get_gc(conv);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
103
10132
f55a64945e77 [gaim-migrate @ 11196]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
104 g_return_if_fail(account != NULL);
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
105 g_return_if_fail(gc != NULL);
3731
d3592d407c9b [gaim-migrate @ 3869]
Sean Egan <seanegan@gmail.com>
parents: 3716
diff changeset
106
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
107 type = gaim_conversation_get_type(conv);
4465
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
108 ops = gaim_conversation_get_ui_ops(conv);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
109
11921
8140885c022c [gaim-migrate @ 14212]
Mark Doliner <mark@kingant.net>
parents: 11869
diff changeset
110 if ((conv->features & GAIM_CONNECTION_HTML) &&
8140885c022c [gaim-migrate @ 14212]
Mark Doliner <mark@kingant.net>
parents: 11869
diff changeset
111 !(msgflags & GAIM_MESSAGE_RAW))
8140885c022c [gaim-migrate @ 14212]
Mark Doliner <mark@kingant.net>
parents: 11869
diff changeset
112 {
8076
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
113 displayed = gaim_markup_linkify(message);
11921
8140885c022c [gaim-migrate @ 14212]
Mark Doliner <mark@kingant.net>
parents: 11869
diff changeset
114 }
5136
381da05cb5ed [gaim-migrate @ 5500]
Nathan Walp <nwalp@pidgin.im>
parents: 5103
diff changeset
115 else
8076
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
116 displayed = g_strdup(message);
5136
381da05cb5ed [gaim-migrate @ 5500]
Nathan Walp <nwalp@pidgin.im>
parents: 5103
diff changeset
117
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
118 plugin_return =
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
119 GPOINTER_TO_INT(gaim_signal_emit_return_1(
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
120 gaim_conversations_get_handle(),
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11292
diff changeset
121 (type == GAIM_CONV_TYPE_IM ? "writing-im-msg" : "writing-chat-msg"),
10132
f55a64945e77 [gaim-migrate @ 11196]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
122 account, conv, &displayed));
8076
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
123
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
124 if (displayed == NULL)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
125 return;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
126
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
127 if (plugin_return) {
8076
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
128 g_free(displayed);
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
129 return;
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
130 }
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
131
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
132 gaim_signal_emit(gaim_conversations_get_handle(),
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11292
diff changeset
133 (type == GAIM_CONV_TYPE_IM ? "wrote-im-msg" : "wrote-chat-msg"),
10132
f55a64945e77 [gaim-migrate @ 11196]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
134 account, conv, displayed);
8076
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
135
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
136 sent = g_strdup(displayed);
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
137
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
138 plugin_return =
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
139 GPOINTER_TO_INT(gaim_signal_emit_return_1(
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11292
diff changeset
140 gaim_conversations_get_handle(), (type == GAIM_CONV_TYPE_IM ?
8076
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
141 "displaying-im-msg" : "displaying-chat-msg"),
10132
f55a64945e77 [gaim-migrate @ 11196]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
142 account, conv, &displayed));
8076
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
143
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
144 if (plugin_return) {
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
145 g_free(displayed);
8078
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
146 displayed = NULL;
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
147 } else {
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
148 gaim_signal_emit(gaim_conversations_get_handle(),
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11292
diff changeset
149 (type == GAIM_CONV_TYPE_IM ? "displayed-im-msg" : "displayed-chat-msg"),
10132
f55a64945e77 [gaim-migrate @ 11196]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
150 account, conv, displayed);
796
4783a3b6859d [gaim-migrate @ 806]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 795
diff changeset
151 }
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
152
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12018
diff changeset
153 msgflags |= GAIM_MESSAGE_SEND;
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12018
diff changeset
154
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11292
diff changeset
155 if (type == GAIM_CONV_TYPE_IM) {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
156 GaimConvIm *im = GAIM_CONV_IM(conv);
2102
899c22dcee42 [gaim-migrate @ 2112]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2094
diff changeset
157
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
158 gaim_signal_emit(gaim_conversations_get_handle(), "sending-im-msg",
10132
f55a64945e77 [gaim-migrate @ 11196]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
159 account,
8076
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
160 gaim_conversation_get_name(conv), &sent);
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
161
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
162 if (sent != NULL && sent[0] != '\0') {
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12018
diff changeset
163
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12018
diff changeset
164 err = serv_send_im(gc, gaim_conversation_get_name(conv),
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12018
diff changeset
165 sent, msgflags);
6982
083d1e4a9c78 [gaim-migrate @ 7538]
Mark Doliner <mark@kingant.net>
parents: 6846
diff changeset
166
8078
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
167 if ((err > 0) && (displayed != NULL))
8076
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
168 gaim_conv_im_write(im, NULL, displayed, msgflags, time(NULL));
6982
083d1e4a9c78 [gaim-migrate @ 7538]
Mark Doliner <mark@kingant.net>
parents: 6846
diff changeset
169
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
170 gaim_signal_emit(gaim_conversations_get_handle(), "sent-im-msg",
10132
f55a64945e77 [gaim-migrate @ 11196]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
171 account,
8076
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
172 gaim_conversation_get_name(conv), sent);
2102
899c22dcee42 [gaim-migrate @ 2112]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2094
diff changeset
173 }
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
174 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
175 else {
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
176 gaim_signal_emit(gaim_conversations_get_handle(), "sending-chat-msg",
10132
f55a64945e77 [gaim-migrate @ 11196]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
177 account, &sent,
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
178 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)));
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
179
8076
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
180 if (sent != NULL && sent[0] != '\0') {
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12018
diff changeset
181 err = serv_chat_send(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), sent, msgflags);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
182
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
183 gaim_signal_emit(gaim_conversations_get_handle(), "sent-chat-msg",
10132
f55a64945e77 [gaim-migrate @ 11196]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
184 account, sent,
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
185 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)));
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
186 }
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
187 }
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
188
2123
56c4382f2909 [gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2111
diff changeset
189 if (err < 0) {
10132
f55a64945e77 [gaim-migrate @ 11196]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
190 const char *who;
f55a64945e77 [gaim-migrate @ 11196]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
191 char *msg;
f55a64945e77 [gaim-migrate @ 11196]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
192
f55a64945e77 [gaim-migrate @ 11196]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
193 who = gaim_conversation_get_name(conv);
f55a64945e77 [gaim-migrate @ 11196]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
194
5213
1cf4eb75e3ee [gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
195 if (err == -E2BIG) {
10132
f55a64945e77 [gaim-migrate @ 11196]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
196 msg = _("Unable to send message: The message is too large.");
f55a64945e77 [gaim-migrate @ 11196]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
197
f55a64945e77 [gaim-migrate @ 11196]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
198 if (!gaim_conv_present_error(who, account, msg)) {
f55a64945e77 [gaim-migrate @ 11196]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
199 msg = g_strdup_printf(_("Unable to send message to %s."), who);
f55a64945e77 [gaim-migrate @ 11196]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
200 gaim_notify_error(gc, NULL, msg, _("The message is too large."));
f55a64945e77 [gaim-migrate @ 11196]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
201 g_free(msg);
f55a64945e77 [gaim-migrate @ 11196]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
202 }
5213
1cf4eb75e3ee [gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
203 }
1cf4eb75e3ee [gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
204 else if (err == -ENOTCONN) {
1cf4eb75e3ee [gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
205 gaim_debug(GAIM_DEBUG_ERROR, "conversation",
1cf4eb75e3ee [gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
206 "Not yet connected.\n");
1cf4eb75e3ee [gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
207 }
1cf4eb75e3ee [gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
208 else {
10132
f55a64945e77 [gaim-migrate @ 11196]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
209 msg = _("Unable to send message.");
f55a64945e77 [gaim-migrate @ 11196]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
210
f55a64945e77 [gaim-migrate @ 11196]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
211 if (!gaim_conv_present_error(who, account, msg)) {
10962
ee4ca56ed8a5 [gaim-migrate @ 12765]
Gary Kramlich <grim@reaperworld.com>
parents: 10958
diff changeset
212 msg = g_strdup_printf(_("Unable to send message to %s."), who);
10132
f55a64945e77 [gaim-migrate @ 11196]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
213 gaim_notify_error(gc, NULL, msg, NULL);
f55a64945e77 [gaim-migrate @ 11196]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
214 g_free(msg);
f55a64945e77 [gaim-migrate @ 11196]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
215 }
5213
1cf4eb75e3ee [gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
216 }
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
217 }
8076
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
218
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
219 g_free(displayed);
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
220 g_free(sent);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
221 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
222
11672
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
223 static void
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
224 open_log(GaimConversation *conv)
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
225 {
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
226 conv->logs = g_list_append(NULL, gaim_log_new(conv->type == GAIM_CONV_TYPE_CHAT ? GAIM_LOG_CHAT :
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
227 GAIM_LOG_IM, conv->name, conv->account,
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
228 conv, time(NULL)));
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
229 }
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
230
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
231
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
232 /**************************************************************************
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
233 * Conversation API
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
234 **************************************************************************/
8256
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
235 static void
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
236 gaim_conversation_chat_cleanup_for_rejoin(GaimConversation *conv)
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
237 {
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
238 const char *disp;
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
239 GaimAccount *account;
8373
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
240 GaimConnection *gc;
8256
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
241
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
242 account = gaim_conversation_get_account(conv);
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
243
11672
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
244 gaim_conversation_close_logs(conv);
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
245 open_log(conv);
8373
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
246
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
247 gc = gaim_account_get_connection(account);
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
248
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
249 if ((disp = gaim_connection_get_display_name(gc)) != NULL)
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
250 gaim_conv_chat_set_nick(GAIM_CONV_CHAT(conv), disp);
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
251 else
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
252 {
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
253 gaim_conv_chat_set_nick(GAIM_CONV_CHAT(conv),
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
254 gaim_account_get_username(account));
8256
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
255 }
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
256
8373
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
257 gaim_conv_chat_clear_users(GAIM_CONV_CHAT(conv));
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
258 gaim_conv_chat_set_topic(GAIM_CONV_CHAT(conv), NULL, NULL);
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
259 GAIM_CONV_CHAT(conv)->left = FALSE;
8256
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
260
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
261 gaim_conversation_update(conv, GAIM_CONV_UPDATE_CHATLEFT);
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
262 }
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
263
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
264 GaimConversation *
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
265 gaim_conversation_new(GaimConversationType type, GaimAccount *account,
4476
62c1e5e656d0 [gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents: 4471
diff changeset
266 const char *name)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
267 {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
268 GaimConversation *conv;
10665
4829abdc5c35 [gaim-migrate @ 12205]
Sean Egan <seanegan@gmail.com>
parents: 10526
diff changeset
269 GaimConnection *gc;
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11552
diff changeset
270 GaimConversationUiOps *ops;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
271
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11292
diff changeset
272 g_return_val_if_fail(type != GAIM_CONV_TYPE_UNKNOWN, NULL);
7088
7fd2fd7c6980 [gaim-migrate @ 7653]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
273 g_return_val_if_fail(account != NULL, NULL);
7fd2fd7c6980 [gaim-migrate @ 7653]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
274 g_return_val_if_fail(name != NULL, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
275
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
276 /* Check if this conversation already exists. */
10246
a66cf83552dc [gaim-migrate @ 11386]
Mark Doliner <mark@kingant.net>
parents: 10132
diff changeset
277 if ((conv = gaim_find_conversation_with_account(type, name, account)) != NULL)
8271
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
278 {
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11292
diff changeset
279 if (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_CHAT ||
8271
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
280 gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv)))
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
281 {
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11292
diff changeset
282 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT)
8256
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
283 gaim_conversation_chat_cleanup_for_rejoin(conv);
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
284
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
285 return conv;
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
286 }
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
287 }
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
288
10665
4829abdc5c35 [gaim-migrate @ 12205]
Sean Egan <seanegan@gmail.com>
parents: 10526
diff changeset
289 gc = gaim_account_get_connection(account);
4829abdc5c35 [gaim-migrate @ 12205]
Sean Egan <seanegan@gmail.com>
parents: 10526
diff changeset
290 g_return_val_if_fail(gc != NULL, NULL);
4829abdc5c35 [gaim-migrate @ 12205]
Sean Egan <seanegan@gmail.com>
parents: 10526
diff changeset
291
6402
cc35d07a0dcc [gaim-migrate @ 6907]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
292 conv = g_new0(GaimConversation, 1);
11146
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents: 11137
diff changeset
293 GAIM_DBUS_REGISTER_POINTER(conv, GaimConversation);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
294
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
295 conv->type = type;
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4481
diff changeset
296 conv->account = account;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
297 conv->name = g_strdup(name);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
298 conv->title = g_strdup(name);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
299 conv->send_history = g_list_append(NULL, NULL);
5139
d0182ae31ab8 [gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
300 conv->data = g_hash_table_new_full(g_str_hash, g_str_equal,
4876
9567b13d0e98 [gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents: 4818
diff changeset
301 g_free, NULL);
10665
4829abdc5c35 [gaim-migrate @ 12205]
Sean Egan <seanegan@gmail.com>
parents: 10526
diff changeset
302 /* copy features from the connection. */
4829abdc5c35 [gaim-migrate @ 12205]
Sean Egan <seanegan@gmail.com>
parents: 10526
diff changeset
303 conv->features = gc->flags;
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11552
diff changeset
304
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11292
diff changeset
305 if (type == GAIM_CONV_TYPE_IM)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
306 {
9324
af707cc1e229 [gaim-migrate @ 10132]
Tim Ringenbach <marv@pidgin.im>
parents: 9261
diff changeset
307 GaimBuddyIcon *icon;
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
308 conv->u.im = g_new0(GaimConvIm, 1);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
309 conv->u.im->conv = conv;
11146
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents: 11137
diff changeset
310 GAIM_DBUS_REGISTER_POINTER(conv->u.im, GaimConvIm);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
311
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
312 ims = g_list_append(ims, conv);
9324
af707cc1e229 [gaim-migrate @ 10132]
Tim Ringenbach <marv@pidgin.im>
parents: 9261
diff changeset
313 if ((icon = gaim_buddy_icons_find(account, name)))
af707cc1e229 [gaim-migrate @ 10132]
Tim Ringenbach <marv@pidgin.im>
parents: 9261
diff changeset
314 gaim_conv_im_set_icon(conv->u.im, icon);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
315
11672
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
316 if (gaim_prefs_get_bool("/core/logging/log_ims"))
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
317 {
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
318 gaim_conversation_set_logging(conv, TRUE);
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
319 open_log(conv);
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
320 }
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
321 }
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11292
diff changeset
322 else if (type == GAIM_CONV_TYPE_CHAT)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
323 {
8158
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
324 const char *disp;
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
325
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
326 conv->u.chat = g_new0(GaimConvChat, 1);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
327 conv->u.chat->conv = conv;
11146
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents: 11137
diff changeset
328 GAIM_DBUS_REGISTER_POINTER(conv->u.chat, GaimConvChat);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
329
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
330 chats = g_list_append(chats, conv);
8271
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
331
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
332 if ((disp = gaim_connection_get_display_name(account->gc)))
8158
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
333 gaim_conv_chat_set_nick(conv->u.chat, disp);
8271
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
334 else
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
335 gaim_conv_chat_set_nick(conv->u.chat,
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
336 gaim_account_get_username(account));
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
337
11672
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
338 if (gaim_prefs_get_bool("/core/logging/log_chats"))
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
339 {
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
340 gaim_conversation_set_logging(conv, TRUE);
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
341 open_log(conv);
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
342 }
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
343 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
344
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
345 conversations = g_list_append(conversations, conv);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
346
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
347 /* Auto-set the title. */
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
348 gaim_conversation_autoset_title(conv);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
349
11602
24274a79d6b0 [gaim-migrate @ 13873]
Gary Kramlich <grim@reaperworld.com>
parents: 11598
diff changeset
350 /* Don't move this.. it needs to be one of the last things done otherwise
24274a79d6b0 [gaim-migrate @ 13873]
Gary Kramlich <grim@reaperworld.com>
parents: 11598
diff changeset
351 * it causes mysterious crashes on my system.
24274a79d6b0 [gaim-migrate @ 13873]
Gary Kramlich <grim@reaperworld.com>
parents: 11598
diff changeset
352 * -- Gary
24274a79d6b0 [gaim-migrate @ 13873]
Gary Kramlich <grim@reaperworld.com>
parents: 11598
diff changeset
353 */
24274a79d6b0 [gaim-migrate @ 13873]
Gary Kramlich <grim@reaperworld.com>
parents: 11598
diff changeset
354 ops = conv->ui_ops = default_ops;
24274a79d6b0 [gaim-migrate @ 13873]
Gary Kramlich <grim@reaperworld.com>
parents: 11598
diff changeset
355 if (ops != NULL && ops->create_conversation != NULL)
24274a79d6b0 [gaim-migrate @ 13873]
Gary Kramlich <grim@reaperworld.com>
parents: 11598
diff changeset
356 ops->create_conversation(conv);
24274a79d6b0 [gaim-migrate @ 13873]
Gary Kramlich <grim@reaperworld.com>
parents: 11598
diff changeset
357
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
358 gaim_signal_emit(gaim_conversations_get_handle(),
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
359 "conversation-created", conv);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
360
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
361 return conv;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
362 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
363
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
364 void
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
365 gaim_conversation_destroy(GaimConversation *conv)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
366 {
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5139
diff changeset
367 GaimPluginProtocolInfo *prpl_info = NULL;
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
368 GaimConversationUiOps *ops;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
369 GaimConnection *gc;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
370 const char *name;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
371 GList *node;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
372
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
373 g_return_if_fail(conv != NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
374
4465
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
375 ops = gaim_conversation_get_ui_ops(conv);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
376 gc = gaim_conversation_get_gc(conv);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
377 name = gaim_conversation_get_name(conv);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
378
8373
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
379 if (gc != NULL)
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
380 {
5262
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
381 /* Still connected */
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
382 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
383
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11292
diff changeset
384 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM)
8373
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
385 {
5545
7a64114641c3 [gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents: 5539
diff changeset
386 if (gaim_prefs_get_bool("/core/conversations/im/send_typing"))
6403
01963a303f43 [gaim-migrate @ 6908]
Christian Hammond <chipx86@chipx86.com>
parents: 6402
diff changeset
387 serv_send_typing(gc, name, GAIM_NOT_TYPING);
5262
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
388
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
389 if (gc && prpl_info->convo_closed != NULL)
6403
01963a303f43 [gaim-migrate @ 6908]
Christian Hammond <chipx86@chipx86.com>
parents: 6402
diff changeset
390 prpl_info->convo_closed(gc, name);
5262
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
391 }
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11292
diff changeset
392 else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT)
8373
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
393 {
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
394 int chat_id = gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv));
8271
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
395 #if 0
5262
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
396 /*
6030
54c37db13279 [gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents: 6020
diff changeset
397 * This is unfortunately necessary, because calling
54c37db13279 [gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents: 6020
diff changeset
398 * serv_chat_leave() calls this gaim_conversation_destroy(),
54c37db13279 [gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents: 6020
diff changeset
399 * which leads to two calls here.. We can't just return after
54c37db13279 [gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents: 6020
diff changeset
400 * this, because then it'll return on the next pass. So, since
54c37db13279 [gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents: 6020
diff changeset
401 * serv_got_chat_left(), which is eventually called from the
54c37db13279 [gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents: 6020
diff changeset
402 * prpl that serv_chat_leave() calls, removes this conversation
54c37db13279 [gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents: 6020
diff changeset
403 * from the gc's buddy_chats list, we're going to check to see
54c37db13279 [gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents: 6020
diff changeset
404 * if this exists in the list. If so, we want to return after
54c37db13279 [gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents: 6020
diff changeset
405 * calling this, because it'll be called again. If not, fall
54c37db13279 [gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents: 6020
diff changeset
406 * through, because it'll have already been removed, and we'd
5262
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
407 * be on the 2nd pass.
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
408 *
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
409 * Long paragraph. <-- Short sentence.
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
410 *
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
411 * -- ChipX86
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
412 */
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
413
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
414 if (gc && g_slist_find(gc->buddy_chats, conv) != NULL) {
8373
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
415 serv_chat_leave(gc, chat_id);
5262
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
416
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
417 return;
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
418 }
8271
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
419 #endif
8373
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
420 /*
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
421 * Instead of all of that, lets just close the window when
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
422 * the user tells us to, and let the prpl deal with the
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
423 * internals on it's own time. Don't do this if the prpl already
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
424 * knows it left the chat.
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
425 */
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
426 if (!gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv)))
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
427 serv_chat_leave(gc, chat_id);
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
428
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
429 /*
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
430 * If they didn't call serv_got_chat_left by now, it's too late.
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
431 * So we better do it for them before we destroy the thing.
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
432 */
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
433 if (!gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv)))
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
434 serv_got_chat_left(gc, chat_id);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
435 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
436 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
437
12018
014c22dd9d06 [gaim-migrate @ 14311]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11921
diff changeset
438 /* remove from conversations and im/chats lists prior to emit */
014c22dd9d06 [gaim-migrate @ 14311]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11921
diff changeset
439 conversations = g_list_remove(conversations, conv);
014c22dd9d06 [gaim-migrate @ 14311]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11921
diff changeset
440
014c22dd9d06 [gaim-migrate @ 14311]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11921
diff changeset
441 if(conv->type==GAIM_CONV_TYPE_IM)
014c22dd9d06 [gaim-migrate @ 14311]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11921
diff changeset
442 ims = g_list_remove(ims, conv);
014c22dd9d06 [gaim-migrate @ 14311]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11921
diff changeset
443 else if(conv->type==GAIM_CONV_TYPE_CHAT)
014c22dd9d06 [gaim-migrate @ 14311]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11921
diff changeset
444 chats = g_list_remove(chats, conv);
014c22dd9d06 [gaim-migrate @ 14311]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11921
diff changeset
445
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
446 gaim_signal_emit(gaim_conversations_get_handle(),
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
447 "deleting-conversation", conv);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
448
11606
243dd81341a7 [gaim-migrate @ 13877]
Tim Ringenbach <marv@pidgin.im>
parents: 11602
diff changeset
449 g_free(conv->name);
243dd81341a7 [gaim-migrate @ 13877]
Tim Ringenbach <marv@pidgin.im>
parents: 11602
diff changeset
450 g_free(conv->title);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
451
10116
9f358a718f38 [gaim-migrate @ 11153]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10104
diff changeset
452 conv->name = NULL;
9f358a718f38 [gaim-migrate @ 11153]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10104
diff changeset
453 conv->title = NULL;
9f358a718f38 [gaim-migrate @ 11153]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10104
diff changeset
454
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
455 for (node = g_list_first(conv->send_history);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
456 node != NULL;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
457 node = g_list_next(node)) {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
458
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
459 if (node->data != NULL)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
460 g_free(node->data);
10116
9f358a718f38 [gaim-migrate @ 11153]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10104
diff changeset
461 node->data = NULL;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
462 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
463
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
464 g_list_free(g_list_first(conv->send_history));
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
465
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11292
diff changeset
466 if (conv->type == GAIM_CONV_TYPE_IM) {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
467 gaim_conv_im_stop_typing_timeout(conv->u.im);
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
468 gaim_conv_im_stop_type_again_timeout(conv->u.im);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
469
6846
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
470 if (conv->u.im->icon != NULL)
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
471 gaim_buddy_icon_unref(conv->u.im->icon);
10116
9f358a718f38 [gaim-migrate @ 11153]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10104
diff changeset
472 conv->u.im->icon = NULL;
6846
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
473
11171
ebb02ea3c789 [gaim-migrate @ 13272]
Piotr Zielinski <zielaj>
parents: 11146
diff changeset
474 GAIM_DBUS_UNREGISTER_POINTER(conv->u.im);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
475 g_free(conv->u.im);
10116
9f358a718f38 [gaim-migrate @ 11153]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10104
diff changeset
476 conv->u.im = NULL;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
477 }
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11292
diff changeset
478 else if (conv->type == GAIM_CONV_TYPE_CHAT) {
4572
06084165a966 [gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents: 4522
diff changeset
479
06084165a966 [gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents: 4522
diff changeset
480 for (node = conv->u.chat->in_room; node != NULL; node = node->next) {
06084165a966 [gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents: 4522
diff changeset
481 if (node->data != NULL)
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10385
diff changeset
482 gaim_conv_chat_cb_destroy((GaimConvChatBuddy *)node->data);
10116
9f358a718f38 [gaim-migrate @ 11153]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10104
diff changeset
483 node->data = NULL;
4572
06084165a966 [gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents: 4522
diff changeset
484 }
06084165a966 [gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents: 4522
diff changeset
485
06084165a966 [gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents: 4522
diff changeset
486 for (node = conv->u.chat->ignored; node != NULL; node = node->next) {
06084165a966 [gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents: 4522
diff changeset
487 if (node->data != NULL)
06084165a966 [gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents: 4522
diff changeset
488 g_free(node->data);
10116
9f358a718f38 [gaim-migrate @ 11153]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10104
diff changeset
489 node->data = NULL;
4572
06084165a966 [gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents: 4522
diff changeset
490 }
06084165a966 [gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents: 4522
diff changeset
491
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
492 g_list_free(conv->u.chat->in_room);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
493 g_list_free(conv->u.chat->ignored);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
494
10116
9f358a718f38 [gaim-migrate @ 11153]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10104
diff changeset
495 conv->u.chat->in_room = NULL;
9f358a718f38 [gaim-migrate @ 11153]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10104
diff changeset
496 conv->u.chat->ignored = NULL;
9f358a718f38 [gaim-migrate @ 11153]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10104
diff changeset
497
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
498 if (conv->u.chat->who != NULL)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
499 g_free(conv->u.chat->who);
10116
9f358a718f38 [gaim-migrate @ 11153]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10104
diff changeset
500 conv->u.chat->who = NULL;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
501
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
502 if (conv->u.chat->topic != NULL)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
503 g_free(conv->u.chat->topic);
10116
9f358a718f38 [gaim-migrate @ 11153]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10104
diff changeset
504 conv->u.chat->topic = NULL;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
505
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10385
diff changeset
506 if(conv->u.chat->nick)
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10385
diff changeset
507 g_free(conv->u.chat->nick);
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10385
diff changeset
508
11146
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents: 11137
diff changeset
509 GAIM_DBUS_UNREGISTER_POINTER(conv->u.chat);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
510 g_free(conv->u.chat);
10116
9f358a718f38 [gaim-migrate @ 11153]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10104
diff changeset
511 conv->u.chat = NULL;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
512 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
513
4877
249382064693 [gaim-migrate @ 5207]
Christian Hammond <chipx86@chipx86.com>
parents: 4876
diff changeset
514 g_hash_table_destroy(conv->data);
10116
9f358a718f38 [gaim-migrate @ 11153]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10104
diff changeset
515 conv->data = NULL;
4876
9567b13d0e98 [gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents: 4818
diff changeset
516
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
517 if (ops != NULL && ops->destroy_conversation != NULL)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
518 ops->destroy_conversation(conv);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
519
11672
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
520 gaim_conversation_close_logs(conv);
11454
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
521
11146
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents: 11137
diff changeset
522 GAIM_DBUS_UNREGISTER_POINTER(conv);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
523 g_free(conv);
10116
9f358a718f38 [gaim-migrate @ 11153]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10104
diff changeset
524 conv = NULL;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
525 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
526
10665
4829abdc5c35 [gaim-migrate @ 12205]
Sean Egan <seanegan@gmail.com>
parents: 10526
diff changeset
527
4829abdc5c35 [gaim-migrate @ 12205]
Sean Egan <seanegan@gmail.com>
parents: 10526
diff changeset
528 void
4829abdc5c35 [gaim-migrate @ 12205]
Sean Egan <seanegan@gmail.com>
parents: 10526
diff changeset
529 gaim_conversation_set_features(GaimConversation *conv, GaimConnectionFlags features)
4829abdc5c35 [gaim-migrate @ 12205]
Sean Egan <seanegan@gmail.com>
parents: 10526
diff changeset
530 {
4829abdc5c35 [gaim-migrate @ 12205]
Sean Egan <seanegan@gmail.com>
parents: 10526
diff changeset
531 g_return_if_fail(conv != NULL);
4829abdc5c35 [gaim-migrate @ 12205]
Sean Egan <seanegan@gmail.com>
parents: 10526
diff changeset
532
4829abdc5c35 [gaim-migrate @ 12205]
Sean Egan <seanegan@gmail.com>
parents: 10526
diff changeset
533 conv->features = features;
4829abdc5c35 [gaim-migrate @ 12205]
Sean Egan <seanegan@gmail.com>
parents: 10526
diff changeset
534
11671
4ebd27e664c4 [gaim-migrate @ 13957]
Luke Schierer <lschiere@pidgin.im>
parents: 11669
diff changeset
535 gaim_conversation_update(conv, GAIM_CONV_UPDATE_FEATURES);
10665
4829abdc5c35 [gaim-migrate @ 12205]
Sean Egan <seanegan@gmail.com>
parents: 10526
diff changeset
536 }
4829abdc5c35 [gaim-migrate @ 12205]
Sean Egan <seanegan@gmail.com>
parents: 10526
diff changeset
537
4829abdc5c35 [gaim-migrate @ 12205]
Sean Egan <seanegan@gmail.com>
parents: 10526
diff changeset
538
4829abdc5c35 [gaim-migrate @ 12205]
Sean Egan <seanegan@gmail.com>
parents: 10526
diff changeset
539 GaimConnectionFlags
4829abdc5c35 [gaim-migrate @ 12205]
Sean Egan <seanegan@gmail.com>
parents: 10526
diff changeset
540 gaim_conversation_get_features(GaimConversation *conv)
4829abdc5c35 [gaim-migrate @ 12205]
Sean Egan <seanegan@gmail.com>
parents: 10526
diff changeset
541 {
4829abdc5c35 [gaim-migrate @ 12205]
Sean Egan <seanegan@gmail.com>
parents: 10526
diff changeset
542 g_return_val_if_fail(conv != NULL, 0);
4829abdc5c35 [gaim-migrate @ 12205]
Sean Egan <seanegan@gmail.com>
parents: 10526
diff changeset
543 return conv->features;
4829abdc5c35 [gaim-migrate @ 12205]
Sean Egan <seanegan@gmail.com>
parents: 10526
diff changeset
544 }
4829abdc5c35 [gaim-migrate @ 12205]
Sean Egan <seanegan@gmail.com>
parents: 10526
diff changeset
545
4829abdc5c35 [gaim-migrate @ 12205]
Sean Egan <seanegan@gmail.com>
parents: 10526
diff changeset
546
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
547 GaimConversationType
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
548 gaim_conversation_get_type(const GaimConversation *conv)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
549 {
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11292
diff changeset
550 g_return_val_if_fail(conv != NULL, GAIM_CONV_TYPE_UNKNOWN);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
551
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
552 return conv->type;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
553 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
554
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
555 void
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
556 gaim_conversation_set_ui_ops(GaimConversation *conv,
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
557 GaimConversationUiOps *ops)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
558 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
559 g_return_if_fail(conv != NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
560
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
561 if (conv->ui_ops == ops)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
562 return;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
563
4465
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
564 if (conv->ui_ops != NULL && conv->ui_ops->destroy_conversation != NULL)
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
565 conv->ui_ops->destroy_conversation(conv);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
566
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
567 conv->ui_data = NULL;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
568
4465
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
569 conv->ui_ops = ops;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
570 }
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
571
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
572 GaimConversationUiOps *
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
573 gaim_conversation_get_ui_ops(const GaimConversation *conv)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
574 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
575 g_return_val_if_fail(conv != NULL, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
576
4465
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
577 return conv->ui_ops;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
578 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
579
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
580 void
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
581 gaim_conversation_set_account(GaimConversation *conv, GaimAccount *account)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
582 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
583 g_return_if_fail(conv != NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
584
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
585 if (account == gaim_conversation_get_account(conv))
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
586 return;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
587
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4481
diff changeset
588 conv->account = account;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4481
diff changeset
589
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4481
diff changeset
590 gaim_conversation_update(conv, GAIM_CONV_UPDATE_ACCOUNT);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
591 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
592
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
593 GaimAccount *
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
594 gaim_conversation_get_account(const GaimConversation *conv)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
595 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
596 g_return_val_if_fail(conv != NULL, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
597
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4481
diff changeset
598 return conv->account;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
599 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
600
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
601 GaimConnection *
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
602 gaim_conversation_get_gc(const GaimConversation *conv)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
603 {
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
604 GaimAccount *account;
4425
be8f9ca74ddf [gaim-migrate @ 4700]
Christian Hammond <chipx86@chipx86.com>
parents: 4415
diff changeset
605
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
606 g_return_val_if_fail(conv != NULL, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
607
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4481
diff changeset
608 account = gaim_conversation_get_account(conv);
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4481
diff changeset
609
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4481
diff changeset
610 if (account == NULL)
4425
be8f9ca74ddf [gaim-migrate @ 4700]
Christian Hammond <chipx86@chipx86.com>
parents: 4415
diff changeset
611 return NULL;
be8f9ca74ddf [gaim-migrate @ 4700]
Christian Hammond <chipx86@chipx86.com>
parents: 4415
diff changeset
612
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4481
diff changeset
613 return account->gc;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
614 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
615
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
616 void
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
617 gaim_conversation_set_title(GaimConversation *conv, const char *title)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
618 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
619 g_return_if_fail(conv != NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
620 g_return_if_fail(title != NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
621
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
622 if (conv->title != NULL)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
623 g_free(conv->title);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
624
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
625 conv->title = g_strdup(title);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
626
11671
4ebd27e664c4 [gaim-migrate @ 13957]
Luke Schierer <lschiere@pidgin.im>
parents: 11669
diff changeset
627 gaim_conversation_update(conv, GAIM_CONV_UPDATE_TITLE);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
628 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
629
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
630 const char *
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
631 gaim_conversation_get_title(const GaimConversation *conv)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
632 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
633 g_return_val_if_fail(conv != NULL, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
634
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
635 return conv->title;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
636 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
637
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
638 void
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
639 gaim_conversation_autoset_title(GaimConversation *conv)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
640 {
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
641 GaimAccount *account;
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6640
diff changeset
642 GaimBuddy *b;
8015
5f86d21b6232 [gaim-migrate @ 8695]
Nathan Walp <nwalp@pidgin.im>
parents: 7947
diff changeset
643 GaimChat *chat;
5f86d21b6232 [gaim-migrate @ 8695]
Nathan Walp <nwalp@pidgin.im>
parents: 7947
diff changeset
644 const char *text = NULL, *name;
3799
3163a8825063 [gaim-migrate @ 3941]
Luke Schierer <lschiere@pidgin.im>
parents: 3790
diff changeset
645
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
646 g_return_if_fail(conv != NULL);
2267
837aa71710c5 [gaim-migrate @ 2277]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2264
diff changeset
647
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4481
diff changeset
648 account = gaim_conversation_get_account(conv);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
649 name = gaim_conversation_get_name(conv);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
650
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11292
diff changeset
651 if(gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) {
10364
db5e8c8b2abb [gaim-migrate @ 11582]
Sean Egan <seanegan@gmail.com>
parents: 10349
diff changeset
652 if(account && ((b = gaim_find_buddy(account, name)) != NULL))
12313
f9629b994b27 [gaim-migrate @ 14617]
Christopher O'Brien <siege@pidgin.im>
parents: 12216
diff changeset
653 text = gaim_buddy_get_contact_alias(b);
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11292
diff changeset
654 } else if(gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) {
10364
db5e8c8b2abb [gaim-migrate @ 11582]
Sean Egan <seanegan@gmail.com>
parents: 10349
diff changeset
655 if(account && ((chat = gaim_blist_find_chat(account, name)) != NULL))
db5e8c8b2abb [gaim-migrate @ 11582]
Sean Egan <seanegan@gmail.com>
parents: 10349
diff changeset
656 text = chat->alias;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
657 }
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11552
diff changeset
658
8015
5f86d21b6232 [gaim-migrate @ 8695]
Nathan Walp <nwalp@pidgin.im>
parents: 7947
diff changeset
659
10116
9f358a718f38 [gaim-migrate @ 11153]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10104
diff changeset
660 if(text == NULL)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
661 text = name;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
662
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
663 gaim_conversation_set_title(conv, text);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
664 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
665
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
666 void
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
667 gaim_conversation_foreach(void (*func)(GaimConversation *conv))
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
668 {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
669 GaimConversation *conv;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
670 GList *l;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
671
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
672 g_return_if_fail(func != NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
673
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
674 for (l = gaim_get_conversations(); l != NULL; l = l->next) {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
675 conv = (GaimConversation *)l->data;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
676
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
677 func(conv);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
678 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
679 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
680
7256
c93493c59ac3 [gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents: 7125
diff changeset
681 void
c93493c59ac3 [gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents: 7125
diff changeset
682 gaim_conversation_set_name(GaimConversation *conv, const char *name)
c93493c59ac3 [gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents: 7125
diff changeset
683 {
c93493c59ac3 [gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents: 7125
diff changeset
684 g_return_if_fail(conv != NULL);
c93493c59ac3 [gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents: 7125
diff changeset
685
c93493c59ac3 [gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents: 7125
diff changeset
686 if (conv->name != NULL)
c93493c59ac3 [gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents: 7125
diff changeset
687 g_free(conv->name);
c93493c59ac3 [gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents: 7125
diff changeset
688
c93493c59ac3 [gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents: 7125
diff changeset
689 conv->name = (name == NULL ? NULL : g_strdup(name));
7257
31abca48a631 [gaim-migrate @ 7834]
Christian Hammond <chipx86@chipx86.com>
parents: 7256
diff changeset
690
31abca48a631 [gaim-migrate @ 7834]
Christian Hammond <chipx86@chipx86.com>
parents: 7256
diff changeset
691 gaim_conversation_autoset_title(conv);
7256
c93493c59ac3 [gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents: 7125
diff changeset
692 }
c93493c59ac3 [gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents: 7125
diff changeset
693
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
694 const char *
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
695 gaim_conversation_get_name(const GaimConversation *conv)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
696 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
697 g_return_val_if_fail(conv != NULL, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
698
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
699 return conv->name;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
700 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
701
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
702 void
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
703 gaim_conversation_set_logging(GaimConversation *conv, gboolean log)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
704 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
705 g_return_if_fail(conv != NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
706
11672
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
707 if (conv->logging != log)
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
708 {
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
709 conv->logging = log;
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
710 gaim_conversation_update(conv, GAIM_CONV_UPDATE_LOGGING);
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
711 }
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
712 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
713
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
714 gboolean
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
715 gaim_conversation_is_logging(const GaimConversation *conv)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
716 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
717 g_return_val_if_fail(conv != NULL, FALSE);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
718
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
719 return conv->logging;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
720 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
721
11672
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
722 void
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
723 gaim_conversation_close_logs(GaimConversation *conv)
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
724 {
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
725 g_return_if_fail(conv != NULL);
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
726
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
727 g_list_foreach(conv->logs, (GFunc)gaim_log_free, NULL);
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
728 g_list_free(conv->logs);
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
729 conv->logs = NULL;
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
730 }
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
731
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
732 GList *
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
733 gaim_conversation_get_send_history(const GaimConversation *conv)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
734 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
735 g_return_val_if_fail(conv != NULL, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
736
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
737 return conv->send_history;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
738 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
739
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
740 GaimConvIm *
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
741 gaim_conversation_get_im_data(const GaimConversation *conv)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
742 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
743 g_return_val_if_fail(conv != NULL, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
744
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11292
diff changeset
745 if (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_IM)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
746 return NULL;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
747
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
748 return conv->u.im;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
749 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
750
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
751 GaimConvChat *
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
752 gaim_conversation_get_chat_data(const GaimConversation *conv)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
753 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
754 g_return_val_if_fail(conv != NULL, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
755
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11292
diff changeset
756 if (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_CHAT)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
757 return NULL;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
758
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
759 return conv->u.chat;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
760 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
761
4876
9567b13d0e98 [gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents: 4818
diff changeset
762 void
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
763 gaim_conversation_set_data(GaimConversation *conv, const char *key,
4877
249382064693 [gaim-migrate @ 5207]
Christian Hammond <chipx86@chipx86.com>
parents: 4876
diff changeset
764 gpointer data)
4876
9567b13d0e98 [gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents: 4818
diff changeset
765 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
766 g_return_if_fail(conv != NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
767 g_return_if_fail(key != NULL);
4876
9567b13d0e98 [gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents: 4818
diff changeset
768
4877
249382064693 [gaim-migrate @ 5207]
Christian Hammond <chipx86@chipx86.com>
parents: 4876
diff changeset
769 g_hash_table_replace(conv->data, g_strdup(key), data);
4876
9567b13d0e98 [gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents: 4818
diff changeset
770 }
9567b13d0e98 [gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents: 4818
diff changeset
771
9567b13d0e98 [gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents: 4818
diff changeset
772 gpointer
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
773 gaim_conversation_get_data(GaimConversation *conv, const char *key)
4876
9567b13d0e98 [gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents: 4818
diff changeset
774 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
775 g_return_val_if_fail(conv != NULL, NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
776 g_return_val_if_fail(key != NULL, NULL);
4876
9567b13d0e98 [gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents: 4818
diff changeset
777
4877
249382064693 [gaim-migrate @ 5207]
Christian Hammond <chipx86@chipx86.com>
parents: 4876
diff changeset
778 return g_hash_table_lookup(conv->data, key);
4876
9567b13d0e98 [gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents: 4818
diff changeset
779 }
9567b13d0e98 [gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents: 4818
diff changeset
780
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
781 GList *
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
782 gaim_get_conversations(void)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
783 {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
784 return conversations;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
785 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
786
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
787 GList *
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
788 gaim_get_ims(void)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
789 {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
790 return ims;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
791 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
792
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
793 GList *
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
794 gaim_get_chats(void)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
795 {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
796 return chats;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
797 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
798
7261
1930e3d00ecd [gaim-migrate @ 7838]
Nathan Walp <nwalp@pidgin.im>
parents: 7257
diff changeset
799
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
800 GaimConversation *
10246
a66cf83552dc [gaim-migrate @ 11386]
Mark Doliner <mark@kingant.net>
parents: 10132
diff changeset
801 gaim_find_conversation_with_account(GaimConversationType type,
a66cf83552dc [gaim-migrate @ 11386]
Mark Doliner <mark@kingant.net>
parents: 10132
diff changeset
802 const char *name,
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
803 const GaimAccount *account)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
804 {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
805 GaimConversation *c = NULL;
10246
a66cf83552dc [gaim-migrate @ 11386]
Mark Doliner <mark@kingant.net>
parents: 10132
diff changeset
806 gchar *name1;
a66cf83552dc [gaim-migrate @ 11386]
Mark Doliner <mark@kingant.net>
parents: 10132
diff changeset
807 const gchar *name2;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
808 GList *cnv;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
809
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
810 g_return_val_if_fail(name != NULL, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
811
10246
a66cf83552dc [gaim-migrate @ 11386]
Mark Doliner <mark@kingant.net>
parents: 10132
diff changeset
812 name1 = g_strdup(gaim_normalize(account, name));
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
813
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
814 for (cnv = gaim_get_conversations(); cnv != NULL; cnv = cnv->next) {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
815 c = (GaimConversation *)cnv->data;
10246
a66cf83552dc [gaim-migrate @ 11386]
Mark Doliner <mark@kingant.net>
parents: 10132
diff changeset
816 name2 = gaim_normalize(account, gaim_conversation_get_name(c));
a66cf83552dc [gaim-migrate @ 11386]
Mark Doliner <mark@kingant.net>
parents: 10132
diff changeset
817
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11292
diff changeset
818 if (((type == GAIM_CONV_TYPE_ANY) || (type == gaim_conversation_get_type(c))) &&
10246
a66cf83552dc [gaim-migrate @ 11386]
Mark Doliner <mark@kingant.net>
parents: 10132
diff changeset
819 (account == gaim_conversation_get_account(c)) &&
a66cf83552dc [gaim-migrate @ 11386]
Mark Doliner <mark@kingant.net>
parents: 10132
diff changeset
820 !gaim_utf8_strcasecmp(name1, name2)) {
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
821
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
822 break;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
823 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
824
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
825 c = NULL;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
826 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
827
10246
a66cf83552dc [gaim-migrate @ 11386]
Mark Doliner <mark@kingant.net>
parents: 10132
diff changeset
828 g_free(name1);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
829
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
830 return c;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
831 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
832
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
833 void
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
834 gaim_conversation_write(GaimConversation *conv, const char *who,
6982
083d1e4a9c78 [gaim-migrate @ 7538]
Mark Doliner <mark@kingant.net>
parents: 6846
diff changeset
835 const char *message, GaimMessageFlags flags,
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
836 time_t mtime)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
837 {
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5139
diff changeset
838 GaimPluginProtocolInfo *prpl_info = NULL;
6496
e0c80bec996a [gaim-migrate @ 7011]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
839 GaimConnection *gc = NULL;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
840 GaimAccount *account;
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
841 GaimConversationUiOps *ops;
11468
c3cb62d33f53 [gaim-migrate @ 13708]
Richard Laager <rlaager@wiktel.com>
parents: 11454
diff changeset
842 const char *alias;
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6640
diff changeset
843 GaimBuddy *b;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
844 /* int logging_font_options = 0; */
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
845
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
846 g_return_if_fail(conv != NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
847 g_return_if_fail(message != NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
848
4465
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
849 ops = gaim_conversation_get_ui_ops(conv);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
850
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
851 if (ops == NULL || ops->write_conv == NULL)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
852 return;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
853
4608
5fcb44d771d2 [gaim-migrate @ 4896]
Nathan Walp <nwalp@pidgin.im>
parents: 4574
diff changeset
854 account = gaim_conversation_get_account(conv);
6496
e0c80bec996a [gaim-migrate @ 7011]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
855
e0c80bec996a [gaim-migrate @ 7011]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
856 if (account != NULL)
e0c80bec996a [gaim-migrate @ 7011]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
857 gc = gaim_account_get_connection(account);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
858
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11292
diff changeset
859 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT &&
6496
e0c80bec996a [gaim-migrate @ 7011]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
860 (gc == NULL || !g_slist_find(gc->buddy_chats, conv)))
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
861 return;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
862
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11292
diff changeset
863 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM &&
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
864 !g_list_find(gaim_get_conversations(), conv))
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
865 return;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
866
11468
c3cb62d33f53 [gaim-migrate @ 13708]
Richard Laager <rlaager@wiktel.com>
parents: 11454
diff changeset
867 if (who == NULL || *who == '\0')
c3cb62d33f53 [gaim-migrate @ 13708]
Richard Laager <rlaager@wiktel.com>
parents: 11454
diff changeset
868 who = gaim_conversation_get_name(conv);
c3cb62d33f53 [gaim-migrate @ 13708]
Richard Laager <rlaager@wiktel.com>
parents: 11454
diff changeset
869
c3cb62d33f53 [gaim-migrate @ 13708]
Richard Laager <rlaager@wiktel.com>
parents: 11454
diff changeset
870 alias = who;
c3cb62d33f53 [gaim-migrate @ 13708]
Richard Laager <rlaager@wiktel.com>
parents: 11454
diff changeset
871
9613
1b13160bf5a4 [gaim-migrate @ 10456]
Luke Schierer <lschiere@pidgin.im>
parents: 9607
diff changeset
872 if (account != NULL) {
1b13160bf5a4 [gaim-migrate @ 10456]
Luke Schierer <lschiere@pidgin.im>
parents: 9607
diff changeset
873 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gaim_find_prpl(gaim_account_get_protocol_id(account)));
5350
a6146cbae03b [gaim-migrate @ 5726]
Christian Hammond <chipx86@chipx86.com>
parents: 5262
diff changeset
874
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11292
diff changeset
875 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM ||
5350
a6146cbae03b [gaim-migrate @ 5726]
Christian Hammond <chipx86@chipx86.com>
parents: 5262
diff changeset
876 !(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) {
a6146cbae03b [gaim-migrate @ 5726]
Christian Hammond <chipx86@chipx86.com>
parents: 5262
diff changeset
877
11454
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
878 if (flags & GAIM_MESSAGE_SEND) {
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
879 b = gaim_find_buddy(account,
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
880 gaim_account_get_username(account));
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
881
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
882 if (gaim_account_get_alias(account) != NULL)
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
883 alias = account->alias;
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
884 else if (b != NULL && strcmp(b->name, gaim_buddy_get_contact_alias(b)))
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
885 alias = gaim_buddy_get_contact_alias(b);
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
886 else if (gaim_connection_get_display_name(gc) != NULL)
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
887 alias = gaim_connection_get_display_name(gc);
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
888 else
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
889 alias = gaim_account_get_username(account);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
890 }
11454
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
891 else
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
892 {
5350
a6146cbae03b [gaim-migrate @ 5726]
Christian Hammond <chipx86@chipx86.com>
parents: 5262
diff changeset
893 b = gaim_find_buddy(account, who);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
894
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
895 if (b != NULL)
11454
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
896 alias = gaim_buddy_get_contact_alias(b);
1772
896432d66303 [gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1764
diff changeset
897 }
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
898 }
474
7720d0f9da8e [gaim-migrate @ 484]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 473
diff changeset
899 }
8256
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
900
11804
648637d0a931 [gaim-migrate @ 14095]
Richard Laager <rlaager@wiktel.com>
parents: 11793
diff changeset
901 if (!(flags & GAIM_MESSAGE_NO_LOG) && gaim_conversation_is_logging(conv)) {
11672
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
902 GList *log;
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
903
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
904 if (conv->logs == NULL)
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
905 open_log(conv);
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
906
04e0189bb519 [gaim-migrate @ 13958]
Richard Laager <rlaager@wiktel.com>
parents: 11671
diff changeset
907 log = conv->logs;
11454
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
908 while (log != NULL) {
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
909 gaim_log_write((GaimLog *)log->data, flags, alias, mtime, message);
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
910 log = log->next;
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
911 }
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
912 }
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
913 ops->write_conv(conv, who, alias, message, flags, mtime);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
914
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
915
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11292
diff changeset
916 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) {
11664
38bbb0f15453 [gaim-migrate @ 13949]
Luke Schierer <lschiere@pidgin.im>
parents: 11606
diff changeset
917 if ((flags & GAIM_MESSAGE_RECV) == GAIM_MESSAGE_RECV) {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
918 gaim_conv_im_set_typing_state(GAIM_CONV_IM(conv), GAIM_NOT_TYPING);
11664
38bbb0f15453 [gaim-migrate @ 13949]
Luke Schierer <lschiere@pidgin.im>
parents: 11606
diff changeset
919 gaim_conversation_update(conv, GAIM_CONV_UPDATE_TITLE);
38bbb0f15453 [gaim-migrate @ 13949]
Luke Schierer <lschiere@pidgin.im>
parents: 11606
diff changeset
920 }
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
921 }
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
922 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
923
9260
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
924 gboolean
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
925 gaim_conversation_has_focus(GaimConversation *conv)
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
926 {
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
927 gboolean ret = FALSE;
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
928 GaimConversationUiOps *ops;
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
929
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
930 g_return_val_if_fail(conv != NULL, FALSE);
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
931
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
932 ops = gaim_conversation_get_ui_ops(conv);
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
933
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
934 if (ops != NULL && ops->has_focus != NULL)
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
935 ret = ops->has_focus(conv);
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
936
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
937 return ret;
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
938 }
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
939
7930
68f70cf074d0 [gaim-migrate @ 8601]
Mark Doliner <mark@kingant.net>
parents: 7879
diff changeset
940 /*
8256
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
941 * TODO: Need to make sure calls to this function happen in the core
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
942 * instead of the UI. That way UIs have less work to do, and the
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
943 * core/UI split is cleaner. Also need to make sure this is called
7930
68f70cf074d0 [gaim-migrate @ 8601]
Mark Doliner <mark@kingant.net>
parents: 7879
diff changeset
944 * when chats are added/removed from the blist.
68f70cf074d0 [gaim-migrate @ 8601]
Mark Doliner <mark@kingant.net>
parents: 7879
diff changeset
945 */
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
946 void
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
947 gaim_conversation_update(GaimConversation *conv, GaimConvUpdateType type)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
948 {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
949 GaimConversationUiOps *ops;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
950
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
951 g_return_if_fail(conv != NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
952
4465
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
953 ops = gaim_conversation_get_ui_ops(conv);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
954
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
955 if (ops != NULL && ops->updated != NULL)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
956 ops->updated(conv, type);
9734
676cf082d29c [gaim-migrate @ 10595]
Mark Doliner <mark@kingant.net>
parents: 9633
diff changeset
957
676cf082d29c [gaim-migrate @ 10595]
Mark Doliner <mark@kingant.net>
parents: 9633
diff changeset
958 gaim_signal_emit(gaim_conversations_get_handle(),
676cf082d29c [gaim-migrate @ 10595]
Mark Doliner <mark@kingant.net>
parents: 9633
diff changeset
959 "conversation-updated", conv, type);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
960 }
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
961
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
962 /**************************************************************************
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
963 * IM Conversation API
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
964 **************************************************************************/
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
965 GaimConversation *
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
966 gaim_conv_im_get_conversation(const GaimConvIm *im)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
967 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
968 g_return_val_if_fail(im != NULL, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
969
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
970 return im->conv;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
971 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
972
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
973 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
974 gaim_conv_im_set_icon(GaimConvIm *im, GaimBuddyIcon *icon)
6846
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
975 {
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
976 g_return_if_fail(im != NULL);
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
977
9261
77fdeb4c459f [gaim-migrate @ 10060]
Christian Hammond <chipx86@chipx86.com>
parents: 9260
diff changeset
978 if (im->icon != icon)
77fdeb4c459f [gaim-migrate @ 10060]
Christian Hammond <chipx86@chipx86.com>
parents: 9260
diff changeset
979 {
77fdeb4c459f [gaim-migrate @ 10060]
Christian Hammond <chipx86@chipx86.com>
parents: 9260
diff changeset
980 if (im->icon != NULL)
77fdeb4c459f [gaim-migrate @ 10060]
Christian Hammond <chipx86@chipx86.com>
parents: 9260
diff changeset
981 gaim_buddy_icon_unref(im->icon);
77fdeb4c459f [gaim-migrate @ 10060]
Christian Hammond <chipx86@chipx86.com>
parents: 9260
diff changeset
982
77fdeb4c459f [gaim-migrate @ 10060]
Christian Hammond <chipx86@chipx86.com>
parents: 9260
diff changeset
983 im->icon = (icon == NULL ? NULL : gaim_buddy_icon_ref(icon));
77fdeb4c459f [gaim-migrate @ 10060]
Christian Hammond <chipx86@chipx86.com>
parents: 9260
diff changeset
984 }
6846
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
985
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
986 gaim_conversation_update(gaim_conv_im_get_conversation(im),
6846
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
987 GAIM_CONV_UPDATE_ICON);
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
988 }
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
989
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
990 GaimBuddyIcon *
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
991 gaim_conv_im_get_icon(const GaimConvIm *im)
6846
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
992 {
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
993 g_return_val_if_fail(im != NULL, NULL);
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
994
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
995 return im->icon;
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
996 }
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
997
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
998 void
8288
dde73afb3283 [gaim-migrate @ 9012]
Christian Hammond <chipx86@chipx86.com>
parents: 8287
diff changeset
999 gaim_conv_im_set_typing_state(GaimConvIm *im, GaimTypingState state)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1000 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1001 g_return_if_fail(im != NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1002
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1003 im->typing_state = state;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
1004 }
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1005
8288
dde73afb3283 [gaim-migrate @ 9012]
Christian Hammond <chipx86@chipx86.com>
parents: 8287
diff changeset
1006 GaimTypingState
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1007 gaim_conv_im_get_typing_state(const GaimConvIm *im)
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1008 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1009 g_return_val_if_fail(im != NULL, 0);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1010
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1011 return im->typing_state;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1012 }
3704
04a911e7dfc9 [gaim-migrate @ 3835]
Rob Flynn <gaim@robflynn.com>
parents: 3699
diff changeset
1013
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1014 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1015 gaim_conv_im_start_typing_timeout(GaimConvIm *im, int timeout)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1016 {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1017 GaimConversation *conv;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1018 const char *name;
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1019
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1020 g_return_if_fail(im != NULL);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1021
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1022 if (im->typing_timeout > 0)
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1023 gaim_conv_im_stop_typing_timeout(im);
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1024
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1025 conv = gaim_conv_im_get_conversation(im);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1026 name = gaim_conversation_get_name(conv);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1027
8273
f24172f53650 [gaim-migrate @ 8997]
Christian Hammond <chipx86@chipx86.com>
parents: 8271
diff changeset
1028 im->typing_timeout = gaim_timeout_add(timeout * 1000, reset_typing, conv);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1029 }
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1030
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1031 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1032 gaim_conv_im_stop_typing_timeout(GaimConvIm *im)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1033 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1034 g_return_if_fail(im != NULL);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1035
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1036 if (im->typing_timeout == 0)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1037 return;
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1038
8287
ef881489396e [gaim-migrate @ 9011]
Christian Hammond <chipx86@chipx86.com>
parents: 8273
diff changeset
1039 gaim_timeout_remove(im->typing_timeout);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1040 im->typing_timeout = 0;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1041 }
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1042
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1043 guint
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1044 gaim_conv_im_get_typing_timeout(const GaimConvIm *im)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1045 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1046 g_return_val_if_fail(im != NULL, 0);
3699
b401bd1701b4 [gaim-migrate @ 3830]
Rob Flynn <gaim@robflynn.com>
parents: 3696
diff changeset
1047
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1048 return im->typing_timeout;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1049 }
3699
b401bd1701b4 [gaim-migrate @ 3830]
Rob Flynn <gaim@robflynn.com>
parents: 3696
diff changeset
1050
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1051 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1052 gaim_conv_im_set_type_again(GaimConvIm *im, time_t val)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1053 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1054 g_return_if_fail(im != NULL);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1055
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1056 im->type_again = val;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1057 }
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1058
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1059 time_t
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1060 gaim_conv_im_get_type_again(const GaimConvIm *im)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1061 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1062 g_return_val_if_fail(im != NULL, 0);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1063
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1064 return im->type_again;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1065 }
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1066
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1067 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1068 gaim_conv_im_start_type_again_timeout(GaimConvIm *im)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1069 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1070 g_return_if_fail(im != NULL);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1071
8273
f24172f53650 [gaim-migrate @ 8997]
Christian Hammond <chipx86@chipx86.com>
parents: 8271
diff changeset
1072 im->type_again_timeout = gaim_timeout_add(SEND_TYPED_TIMEOUT, send_typed,
f24172f53650 [gaim-migrate @ 8997]
Christian Hammond <chipx86@chipx86.com>
parents: 8271
diff changeset
1073 gaim_conv_im_get_conversation(im));
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1074 }
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1075
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1076 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1077 gaim_conv_im_stop_type_again_timeout(GaimConvIm *im)
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1078 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1079 g_return_if_fail(im != NULL);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1080
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1081 if (im->type_again_timeout == 0)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1082 return;
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1083
8287
ef881489396e [gaim-migrate @ 9011]
Christian Hammond <chipx86@chipx86.com>
parents: 8273
diff changeset
1084 gaim_timeout_remove(im->type_again_timeout);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1085 im->type_again_timeout = 0;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1086 }
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1087
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1088 guint
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1089 gaim_conv_im_get_type_again_timeout(const GaimConvIm *im)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1090 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1091 g_return_val_if_fail(im != NULL, 0);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1092
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1093 return im->type_again_timeout;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1094 }
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1095
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1096 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1097 gaim_conv_im_update_typing(GaimConvIm *im)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1098 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1099 g_return_if_fail(im != NULL);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1100
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1101 gaim_conversation_update(gaim_conv_im_get_conversation(im),
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1102 GAIM_CONV_UPDATE_TYPING);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1103 }
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1104
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1105 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1106 gaim_conv_im_write(GaimConvIm *im, const char *who, const char *message,
6982
083d1e4a9c78 [gaim-migrate @ 7538]
Mark Doliner <mark@kingant.net>
parents: 6846
diff changeset
1107 GaimMessageFlags flags, time_t mtime)
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
1108 {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1109 GaimConversation *c;
1898
73d73939f698 [gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1889
diff changeset
1110
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1111 g_return_if_fail(im != NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1112 g_return_if_fail(message != NULL);
1898
73d73939f698 [gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1889
diff changeset
1113
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1114 c = gaim_conv_im_get_conversation(im);
2787
feea7103a235 [gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2773
diff changeset
1115
4382
76223649765b [gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents: 4378
diff changeset
1116 /* Raise the window, if specified in prefs. */
4465
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
1117 if (c->ui_ops != NULL && c->ui_ops->write_im != NULL)
6982
083d1e4a9c78 [gaim-migrate @ 7538]
Mark Doliner <mark@kingant.net>
parents: 6846
diff changeset
1118 c->ui_ops->write_im(c, who, message, flags, mtime);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1119 else
6982
083d1e4a9c78 [gaim-migrate @ 7538]
Mark Doliner <mark@kingant.net>
parents: 6846
diff changeset
1120 gaim_conversation_write(c, who, message, flags, mtime);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
1121 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
1122
9627
8a540b8a5f70 [gaim-migrate @ 10471]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1123 gboolean gaim_conv_present_error(const char *who, GaimAccount *account, const char *what)
8a540b8a5f70 [gaim-migrate @ 10471]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1124 {
8a540b8a5f70 [gaim-migrate @ 10471]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1125 GaimConversation *conv;
8a540b8a5f70 [gaim-migrate @ 10471]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1126
8a540b8a5f70 [gaim-migrate @ 10471]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1127 g_return_val_if_fail(who != NULL, FALSE);
8a540b8a5f70 [gaim-migrate @ 10471]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1128 g_return_val_if_fail(account !=NULL, FALSE);
8a540b8a5f70 [gaim-migrate @ 10471]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1129 g_return_val_if_fail(what != NULL, FALSE);
8a540b8a5f70 [gaim-migrate @ 10471]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1130
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11292
diff changeset
1131 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_ANY, who, account);
9627
8a540b8a5f70 [gaim-migrate @ 10471]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1132 if (conv != NULL)
8a540b8a5f70 [gaim-migrate @ 10471]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1133 gaim_conversation_write(conv, NULL, what, GAIM_MESSAGE_ERROR, time(NULL));
8a540b8a5f70 [gaim-migrate @ 10471]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1134 else
8a540b8a5f70 [gaim-migrate @ 10471]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1135 return FALSE;
8a540b8a5f70 [gaim-migrate @ 10471]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1136
8a540b8a5f70 [gaim-migrate @ 10471]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1137 return TRUE;
8a540b8a5f70 [gaim-migrate @ 10471]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1138 }
8a540b8a5f70 [gaim-migrate @ 10471]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1139
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1140 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1141 gaim_conv_im_send(GaimConvIm *im, const char *message)
2379
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
1142 {
11921
8140885c022c [gaim-migrate @ 14212]
Mark Doliner <mark@kingant.net>
parents: 11869
diff changeset
1143 gaim_conv_im_send_with_flags(im, message, 0);
8140885c022c [gaim-migrate @ 14212]
Mark Doliner <mark@kingant.net>
parents: 11869
diff changeset
1144 }
8140885c022c [gaim-migrate @ 14212]
Mark Doliner <mark@kingant.net>
parents: 11869
diff changeset
1145
8140885c022c [gaim-migrate @ 14212]
Mark Doliner <mark@kingant.net>
parents: 11869
diff changeset
1146 void
8140885c022c [gaim-migrate @ 14212]
Mark Doliner <mark@kingant.net>
parents: 11869
diff changeset
1147 gaim_conv_im_send_with_flags(GaimConvIm *im, const char *message, GaimMessageFlags flags)
8140885c022c [gaim-migrate @ 14212]
Mark Doliner <mark@kingant.net>
parents: 11869
diff changeset
1148 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1149 g_return_if_fail(im != NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1150 g_return_if_fail(message != NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1151
11921
8140885c022c [gaim-migrate @ 14212]
Mark Doliner <mark@kingant.net>
parents: 11869
diff changeset
1152 common_send(gaim_conv_im_get_conversation(im), message, flags);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1153 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1154
10526
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1155 gboolean
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1156 gaim_conv_custom_smiley_add(GaimConversation *conv, const char *smile,
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1157 const char *cksum_type, const char *chksum)
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1158 {
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1159 if (conv == NULL || smile == NULL || !*smile) {
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1160 return FALSE;
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1161 }
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1162
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1163 /* TODO: check if the icon is in the cache and return false if so */
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1164 /* TODO: add an icon cache (that doesn't suck) */
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1165 if (conv->ui_ops != NULL && conv->ui_ops->custom_smiley_add !=NULL) {
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1166 return conv->ui_ops->custom_smiley_add(conv, smile);
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1167 } else {
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1168 gaim_debug_info("conversation", "Could not find add custom smiley function");
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1169 return FALSE;
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1170 }
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1171
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1172 }
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1173
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1174 void
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1175 gaim_conv_custom_smiley_write(GaimConversation *conv, const char *smile,
11137
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 11064
diff changeset
1176 const guchar *data, gsize size)
10526
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1177 {
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1178 g_return_if_fail(conv != NULL);
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1179 g_return_if_fail(smile != NULL && *smile);
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1180
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1181 if (conv->ui_ops != NULL && conv->ui_ops->custom_smiley_write != NULL)
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1182 conv->ui_ops->custom_smiley_write(conv, smile, data, size);
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1183 else
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1184 gaim_debug_info("conversation", "Could not find the smiley write function");
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1185 }
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1186
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1187 void
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1188 gaim_conv_custom_smiley_close(GaimConversation *conv, const char *smile)
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1189 {
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1190 g_return_if_fail(conv != NULL);
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1191 g_return_if_fail(smile != NULL && *smile);
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1192
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1193 if (conv->ui_ops != NULL && conv->ui_ops->custom_smiley_close != NULL)
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1194 conv->ui_ops->custom_smiley_close(conv, smile);
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1195 else
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1196 gaim_debug_info("conversation", "Could not find custom smiley close function");
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1197 }
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1198
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
1199
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1200 /**************************************************************************
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1201 * Chat Conversation API
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1202 **************************************************************************/
2379
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
1203
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1204 GaimConversation *
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1205 gaim_conv_chat_get_conversation(const GaimConvChat *chat)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1206 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1207 g_return_val_if_fail(chat != NULL, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1208
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1209 return chat->conv;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1210 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1211
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1212 GList *
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1213 gaim_conv_chat_set_users(GaimConvChat *chat, GList *users)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1214 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1215 g_return_val_if_fail(chat != NULL, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1216
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1217 chat->in_room = users;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1218
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1219 return users;
2379
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
1220 }
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
1221
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1222 GList *
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1223 gaim_conv_chat_get_users(const GaimConvChat *chat)
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1224 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1225 g_return_val_if_fail(chat != NULL, NULL);
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1226
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1227 return chat->in_room;
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1228 }
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1229
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1230 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1231 gaim_conv_chat_ignore(GaimConvChat *chat, const char *name)
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
1232 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1233 g_return_if_fail(chat != NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1234 g_return_if_fail(name != NULL);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
1235
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1236 /* Make sure the user isn't already ignored. */
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1237 if (gaim_conv_chat_is_user_ignored(chat, name))
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1238 return;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1239
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1240 gaim_conv_chat_set_ignored(chat,
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1241 g_list_append(gaim_conv_chat_get_ignored(chat), g_strdup(name)));
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1242 }
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
1243
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1244 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1245 gaim_conv_chat_unignore(GaimConvChat *chat, const char *name)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1246 {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1247 GList *item;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1248
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1249 g_return_if_fail(chat != NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1250 g_return_if_fail(name != NULL);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
1251
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1252 /* Make sure the user is actually ignored. */
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1253 if (!gaim_conv_chat_is_user_ignored(chat, name))
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1254 return;
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
1255
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1256 item = g_list_find(gaim_conv_chat_get_ignored(chat),
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1257 gaim_conv_chat_get_ignored_user(chat, name));
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1258
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1259 gaim_conv_chat_set_ignored(chat,
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1260 g_list_remove_link(gaim_conv_chat_get_ignored(chat), item));
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1261
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1262 g_free(item->data);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1263 g_list_free_1(item);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
1264 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
1265
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1266 GList *
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1267 gaim_conv_chat_set_ignored(GaimConvChat *chat, GList *ignored)
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
1268 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1269 g_return_val_if_fail(chat != NULL, NULL);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
1270
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1271 chat->ignored = ignored;
993
eacd93d0089a [gaim-migrate @ 1003]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1272
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1273 return ignored;
2111
109669b3887e [gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2109
diff changeset
1274 }
109669b3887e [gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2109
diff changeset
1275
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1276 GList *
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1277 gaim_conv_chat_get_ignored(const GaimConvChat *chat)
2111
109669b3887e [gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2109
diff changeset
1278 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1279 g_return_val_if_fail(chat != NULL, NULL);
1898
73d73939f698 [gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1889
diff changeset
1280
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1281 return chat->ignored;
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
1282 }
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
1283
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1284 const char *
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1285 gaim_conv_chat_get_ignored_user(const GaimConvChat *chat, const char *user)
1340
1526caa87138 [gaim-migrate @ 1350]
Rob Flynn <gaim@robflynn.com>
parents: 1253
diff changeset
1286 {
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1287 GList *ignored;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1288
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1289 g_return_val_if_fail(chat != NULL, NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1290 g_return_val_if_fail(user != NULL, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1291
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1292 for (ignored = gaim_conv_chat_get_ignored(chat);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1293 ignored != NULL;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1294 ignored = ignored->next) {
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
1295
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1296 const char *ign = (const char *)ignored->data;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1297
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4687
diff changeset
1298 if (!gaim_utf8_strcasecmp(user, ign) ||
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4687
diff changeset
1299 ((*ign == '+' || *ign == '%') && !gaim_utf8_strcasecmp(user, ign + 1)))
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1300 return ign;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1301
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1302 if (*ign == '@') {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1303 ign++;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1304
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4687
diff changeset
1305 if ((*ign == '+' && !gaim_utf8_strcasecmp(user, ign + 1)) ||
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4687
diff changeset
1306 (*ign != '+' && !gaim_utf8_strcasecmp(user, ign)))
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1307 return ign;
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1308 }
2094
be10a1243ed7 [gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2090
diff changeset
1309 }
1341
6ec45c45157c [gaim-migrate @ 1351]
Rob Flynn <gaim@robflynn.com>
parents: 1340
diff changeset
1310
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1311 return NULL;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1312 }
1341
6ec45c45157c [gaim-migrate @ 1351]
Rob Flynn <gaim@robflynn.com>
parents: 1340
diff changeset
1313
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1314 gboolean
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1315 gaim_conv_chat_is_user_ignored(const GaimConvChat *chat, const char *user)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1316 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1317 g_return_val_if_fail(chat != NULL, FALSE);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1318 g_return_val_if_fail(user != NULL, FALSE);
1341
6ec45c45157c [gaim-migrate @ 1351]
Rob Flynn <gaim@robflynn.com>
parents: 1340
diff changeset
1319
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1320 return (gaim_conv_chat_get_ignored_user(chat, user) != NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1321 }
1343
a0d89bdc733e [gaim-migrate @ 1353]
Rob Flynn <gaim@robflynn.com>
parents: 1342
diff changeset
1322
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1323 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1324 gaim_conv_chat_set_topic(GaimConvChat *chat, const char *who, const char *topic)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1325 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1326 g_return_if_fail(chat != NULL);
1343
a0d89bdc733e [gaim-migrate @ 1353]
Rob Flynn <gaim@robflynn.com>
parents: 1342
diff changeset
1327
7606
08c9d0dcf906 [gaim-migrate @ 8229]
Luke Schierer <lschiere@pidgin.im>
parents: 7602
diff changeset
1328 if (chat->who != NULL) g_free(chat->who);
08c9d0dcf906 [gaim-migrate @ 8229]
Luke Schierer <lschiere@pidgin.im>
parents: 7602
diff changeset
1329 if (chat->topic != NULL) g_free(chat->topic);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1330
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1331 chat->who = (who == NULL ? NULL : g_strdup(who));
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1332 chat->topic = (topic == NULL ? NULL : g_strdup(topic));
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1333
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1334 gaim_conversation_update(gaim_conv_chat_get_conversation(chat),
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1335 GAIM_CONV_UPDATE_TOPIC);
9517
0524b36c701a [gaim-migrate @ 10344]
Luke Schierer <lschiere@pidgin.im>
parents: 9514
diff changeset
1336
0524b36c701a [gaim-migrate @ 10344]
Luke Schierer <lschiere@pidgin.im>
parents: 9514
diff changeset
1337 gaim_signal_emit(gaim_conversations_get_handle(), "chat-topic-changed",
0524b36c701a [gaim-migrate @ 10344]
Luke Schierer <lschiere@pidgin.im>
parents: 9514
diff changeset
1338 chat->conv, chat->who, chat->topic);
1340
1526caa87138 [gaim-migrate @ 1350]
Rob Flynn <gaim@robflynn.com>
parents: 1253
diff changeset
1339 }
1526caa87138 [gaim-migrate @ 1350]
Rob Flynn <gaim@robflynn.com>
parents: 1253
diff changeset
1340
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1341 const char *
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1342 gaim_conv_chat_get_topic(const GaimConvChat *chat)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1343 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1344 g_return_val_if_fail(chat != NULL, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1345
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1346 return chat->topic;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1347 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1348
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1349 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1350 gaim_conv_chat_set_id(GaimConvChat *chat, int id)
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
1351 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1352 g_return_if_fail(chat != NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1353
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1354 chat->id = id;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1355 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1356
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1357 int
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1358 gaim_conv_chat_get_id(const GaimConvChat *chat)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1359 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1360 g_return_val_if_fail(chat != NULL, -1);
3951
32942c49dced [gaim-migrate @ 4132]
Luke Schierer <lschiere@pidgin.im>
parents: 3925
diff changeset
1361
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1362 return chat->id;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1363 }
3951
32942c49dced [gaim-migrate @ 4132]
Luke Schierer <lschiere@pidgin.im>
parents: 3925
diff changeset
1364
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1365 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1366 gaim_conv_chat_write(GaimConvChat *chat, const char *who, const char *message,
6621
42fdf16f1dad [gaim-migrate @ 7145]
Mark Doliner <mark@kingant.net>
parents: 6607
diff changeset
1367 GaimMessageFlags flags, time_t mtime)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1368 {
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
1369 GaimAccount *account;
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1370 GaimConversation *conv;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
1371 GaimConnection *gc;
11454
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1372 GaimPluginProtocolInfo *prpl_info;
3866
994b5c4d15dd [gaim-migrate @ 4018]
Rob Flynn <gaim@robflynn.com>
parents: 3846
diff changeset
1373
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1374 g_return_if_fail(chat != NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1375 g_return_if_fail(who != NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1376 g_return_if_fail(message != NULL);
3866
994b5c4d15dd [gaim-migrate @ 4018]
Rob Flynn <gaim@robflynn.com>
parents: 3846
diff changeset
1377
11454
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1378 conv = gaim_conv_chat_get_conversation(chat);
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1379 gc = gaim_conversation_get_gc(conv);
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1380 account = gaim_connection_get_account(gc);
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1381 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1382
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1383 /* Don't display this if the person who wrote it is ignored. */
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1384 if (gaim_conv_chat_is_user_ignored(chat, who))
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
1385 return;
3677
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
1386
6621
42fdf16f1dad [gaim-migrate @ 7145]
Mark Doliner <mark@kingant.net>
parents: 6607
diff changeset
1387 if (!(flags & GAIM_MESSAGE_WHISPER)) {
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1388 char *str;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1389
7261
1930e3d00ecd [gaim-migrate @ 7838]
Nathan Walp <nwalp@pidgin.im>
parents: 7257
diff changeset
1390 str = g_strdup(gaim_normalize(account, who));
11454
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1391
11500
9fc7d0153332 [gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents: 11485
diff changeset
1392 if (!strcmp(str, gaim_normalize(account, chat->nick))) {
6621
42fdf16f1dad [gaim-migrate @ 7145]
Mark Doliner <mark@kingant.net>
parents: 6607
diff changeset
1393 flags |= GAIM_MESSAGE_SEND;
8158
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
1394 } else {
6621
42fdf16f1dad [gaim-migrate @ 7145]
Mark Doliner <mark@kingant.net>
parents: 6607
diff changeset
1395 flags |= GAIM_MESSAGE_RECV;
3677
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
1396
11552
11d30825c1bb [gaim-migrate @ 13812]
Gary Kramlich <grim@reaperworld.com>
parents: 11500
diff changeset
1397 if (gaim_utf8_has_word(message, chat->nick))
6621
42fdf16f1dad [gaim-migrate @ 7145]
Mark Doliner <mark@kingant.net>
parents: 6607
diff changeset
1398 flags |= GAIM_MESSAGE_NICK;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1399 }
6060
6b4a12cd4caf [gaim-migrate @ 6510]
Nathan Walp <nwalp@pidgin.im>
parents: 6054
diff changeset
1400
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1401 g_free(str);
3677
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
1402 }
3705
91498932cea7 [gaim-migrate @ 3838]
Luke Schierer <lschiere@pidgin.im>
parents: 3704
diff changeset
1403
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1404 /* Pass this on to either the ops structure or the default write func. */
4465
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
1405 if (conv->ui_ops != NULL && conv->ui_ops->write_chat != NULL)
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
1406 conv->ui_ops->write_chat(conv, who, message, flags, mtime);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1407 else
6982
083d1e4a9c78 [gaim-migrate @ 7538]
Mark Doliner <mark@kingant.net>
parents: 6846
diff changeset
1408 gaim_conversation_write(conv, who, message, flags, mtime);
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
1409 }
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
1410
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1411 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1412 gaim_conv_chat_send(GaimConvChat *chat, const char *message)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1413 {
11921
8140885c022c [gaim-migrate @ 14212]
Mark Doliner <mark@kingant.net>
parents: 11869
diff changeset
1414 gaim_conv_chat_send_with_flags(chat, message, 0);
8140885c022c [gaim-migrate @ 14212]
Mark Doliner <mark@kingant.net>
parents: 11869
diff changeset
1415 }
8140885c022c [gaim-migrate @ 14212]
Mark Doliner <mark@kingant.net>
parents: 11869
diff changeset
1416
8140885c022c [gaim-migrate @ 14212]
Mark Doliner <mark@kingant.net>
parents: 11869
diff changeset
1417 void
8140885c022c [gaim-migrate @ 14212]
Mark Doliner <mark@kingant.net>
parents: 11869
diff changeset
1418 gaim_conv_chat_send_with_flags(GaimConvChat *chat, const char *message, GaimMessageFlags flags)
8140885c022c [gaim-migrate @ 14212]
Mark Doliner <mark@kingant.net>
parents: 11869
diff changeset
1419 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1420 g_return_if_fail(chat != NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1421 g_return_if_fail(message != NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1422
11921
8140885c022c [gaim-migrate @ 14212]
Mark Doliner <mark@kingant.net>
parents: 11869
diff changeset
1423 common_send(gaim_conv_chat_get_conversation(chat), message, flags);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1424 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1425
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1426 void
11454
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1427 gaim_conv_chat_add_user(GaimConvChat *chat, const char *user,
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1428 const char *extra_msg, GaimConvChatBuddyFlags flags,
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1429 gboolean new_arrival)
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1430 {
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1431 GList *users = g_list_append(NULL, (char *)user);
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1432 GList *extra_msgs = g_list_append(NULL, (char *)extra_msg);
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1433 GList *flags2 = g_list_append(NULL, GINT_TO_POINTER(flags));
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11552
diff changeset
1434
11454
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1435 gaim_conv_chat_add_users(chat, users, extra_msgs, flags2, new_arrival);
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1436
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1437 g_list_free(users);
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1438 g_list_free(extra_msgs);
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1439 g_list_free(flags2);
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1440 }
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1441
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1442 void
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1443 gaim_conv_chat_add_users(GaimConvChat *chat, GList *users, GList *extra_msgs,
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1444 GList *flags, gboolean new_arrivals)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1445 {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1446 GaimConversation *conv;
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1447 GaimConversationUiOps *ops;
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1448 GaimConvChatBuddy *cb;
11454
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1449 GaimConnection *gc;
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1450 GaimPluginProtocolInfo *prpl_info;
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1451 GList *ul, *fl;
11454
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1452 GList *aliases = NULL;
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1453
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1454 g_return_if_fail(chat != NULL);
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1455 g_return_if_fail(users != NULL);
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1456
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1457 conv = gaim_conv_chat_get_conversation(chat);
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1458 ops = gaim_conversation_get_ui_ops(conv);
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1459
11454
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1460 gc = gaim_conversation_get_gc(conv);
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1461 if (!gc || !(prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)))
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1462 return;
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1463
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1464 ul = users;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1465 fl = flags;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1466 while ((ul != NULL) && (fl != NULL)) {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1467 const char *user = (const char *)ul->data;
11454
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1468 const char *alias = user;
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1469 gboolean quiet;
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1470 GaimConvChatBuddyFlags flags = GPOINTER_TO_INT(fl->data);
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1471 const char *extra_msg = (extra_msgs ? extra_msgs->data : NULL);
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1472
11500
9fc7d0153332 [gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents: 11485
diff changeset
1473 if (!strcmp(chat->nick, gaim_normalize(conv->account, user))) {
9fc7d0153332 [gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents: 11485
diff changeset
1474 const char *alias2 = gaim_account_get_alias(conv->account);
9fc7d0153332 [gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents: 11485
diff changeset
1475 if (alias2 != NULL)
9fc7d0153332 [gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents: 11485
diff changeset
1476 alias = alias2;
11454
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1477 else
11500
9fc7d0153332 [gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents: 11485
diff changeset
1478 {
9fc7d0153332 [gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents: 11485
diff changeset
1479 const char *display_name = gaim_connection_get_display_name(gc);
9fc7d0153332 [gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents: 11485
diff changeset
1480 if (display_name != NULL)
9fc7d0153332 [gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents: 11485
diff changeset
1481 alias = display_name;
11454
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1482 }
11500
9fc7d0153332 [gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents: 11485
diff changeset
1483 } else if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) {
9fc7d0153332 [gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents: 11485
diff changeset
1484 GaimBuddy *buddy;
9fc7d0153332 [gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents: 11485
diff changeset
1485 if ((buddy = gaim_find_buddy(gc->account, user)) != NULL)
9fc7d0153332 [gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents: 11485
diff changeset
1486 alias = gaim_buddy_get_contact_alias(buddy);
11454
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1487 }
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1488
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1489 quiet = GPOINTER_TO_INT(gaim_signal_emit_return_1(gaim_conversations_get_handle(),
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1490 "chat-buddy-joining", conv, user, flags)) |
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1491 gaim_conv_chat_is_user_ignored(chat, user);
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1492
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1493 cb = gaim_conv_chat_cb_new(user, flags);
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1494 gaim_conv_chat_set_users(chat,
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1495 g_list_prepend(gaim_conv_chat_get_users(chat), cb));
11866
2bee8d023e23 [gaim-migrate @ 14157]
Richard Laager <rlaager@wiktel.com>
parents: 11804
diff changeset
1496 /* We reverse this later to keep it in the same order as users. */
2bee8d023e23 [gaim-migrate @ 14157]
Richard Laager <rlaager@wiktel.com>
parents: 11804
diff changeset
1497 aliases = g_list_prepend(aliases, (char *)alias);
11454
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1498
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1499 if (!quiet && new_arrivals) {
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1500 char *tmp;
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1501
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1502 if (extra_msg == NULL)
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1503 tmp = g_strdup_printf(_("%s entered the room."), alias);
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1504 else
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1505 tmp = g_strdup_printf(_("%s [<I>%s</I>] entered the room."),
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1506 alias, extra_msg);
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1507
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1508 gaim_conversation_write(conv, NULL, tmp, GAIM_MESSAGE_SYSTEM, time(NULL));
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1509 g_free(tmp);
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1510 }
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1511
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1512 gaim_signal_emit(gaim_conversations_get_handle(),
11454
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1513 "chat-buddy-joined", conv, user, flags);
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1514 ul = ul->next;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1515 fl = fl->next;
11454
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1516 if (extra_msgs != NULL)
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1517 extra_msgs = extra_msgs->next;
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1518 }
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1519
11866
2bee8d023e23 [gaim-migrate @ 14157]
Richard Laager <rlaager@wiktel.com>
parents: 11804
diff changeset
1520 /* This needs to be in the same order as users, but it's faster
2bee8d023e23 [gaim-migrate @ 14157]
Richard Laager <rlaager@wiktel.com>
parents: 11804
diff changeset
1521 * to prepend, so we do that above. */
2bee8d023e23 [gaim-migrate @ 14157]
Richard Laager <rlaager@wiktel.com>
parents: 11804
diff changeset
1522 aliases = g_list_reverse(aliases);
2bee8d023e23 [gaim-migrate @ 14157]
Richard Laager <rlaager@wiktel.com>
parents: 11804
diff changeset
1523
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1524 if (ops != NULL && ops->chat_add_users != NULL)
11869
3ba50c385299 [gaim-migrate @ 14160]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11866
diff changeset
1525 ops->chat_add_users(conv, users, flags, aliases);
11454
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1526
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1527 g_list_free(aliases);
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1528 }
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1529
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1530 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1531 gaim_conv_chat_rename_user(GaimConvChat *chat, const char *old_user,
11454
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1532 const char *new_user)
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
1533 {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1534 GaimConversation *conv;
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1535 GaimConversationUiOps *ops;
11485
16b0da1f376f [gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents: 11481
diff changeset
1536 GaimConnection *gc;
16b0da1f376f [gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents: 11481
diff changeset
1537 GaimPluginProtocolInfo *prpl_info;
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1538 GaimConvChatBuddy *cb;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1539 GaimConvChatBuddyFlags flags;
11485
16b0da1f376f [gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents: 11481
diff changeset
1540 const char *new_alias = new_user;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1541 char tmp[BUF_LONG];
11485
16b0da1f376f [gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents: 11481
diff changeset
1542 gboolean is_me = FALSE;
3866
994b5c4d15dd [gaim-migrate @ 4018]
Rob Flynn <gaim@robflynn.com>
parents: 3846
diff changeset
1543
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1544 g_return_if_fail(chat != NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1545 g_return_if_fail(old_user != NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1546 g_return_if_fail(new_user != NULL);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
1547
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1548 conv = gaim_conv_chat_get_conversation(chat);
4465
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
1549 ops = gaim_conversation_get_ui_ops(conv);
3304
7c5325f460de [gaim-migrate @ 3322]
Sean Egan <seanegan@gmail.com>
parents: 3300
diff changeset
1550
11485
16b0da1f376f [gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents: 11481
diff changeset
1551 gc = gaim_conversation_get_gc(conv);
16b0da1f376f [gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents: 11481
diff changeset
1552 g_return_if_fail(gc != NULL);
16b0da1f376f [gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents: 11481
diff changeset
1553 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
16b0da1f376f [gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents: 11481
diff changeset
1554 g_return_if_fail(prpl_info != NULL);
16b0da1f376f [gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents: 11481
diff changeset
1555
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1556 flags = gaim_conv_chat_user_get_flags(chat, old_user);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1557 cb = gaim_conv_chat_cb_new(new_user, flags);
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1558 gaim_conv_chat_set_users(chat,
11454
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1559 g_list_prepend(gaim_conv_chat_get_users(chat), cb));
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1560
11500
9fc7d0153332 [gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents: 11485
diff changeset
1561 if (!strcmp(chat->nick, gaim_normalize(conv->account, old_user))) {
9fc7d0153332 [gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents: 11485
diff changeset
1562 const char *alias;
9fc7d0153332 [gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents: 11485
diff changeset
1563
9fc7d0153332 [gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents: 11485
diff changeset
1564 /* Note this for later. */
9fc7d0153332 [gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents: 11485
diff changeset
1565 is_me = TRUE;
9fc7d0153332 [gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents: 11485
diff changeset
1566
9fc7d0153332 [gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents: 11485
diff changeset
1567 alias = gaim_account_get_alias(conv->account);
9fc7d0153332 [gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents: 11485
diff changeset
1568 if (alias != NULL)
9fc7d0153332 [gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents: 11485
diff changeset
1569 new_alias = alias;
9fc7d0153332 [gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents: 11485
diff changeset
1570 else
9fc7d0153332 [gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents: 11485
diff changeset
1571 {
9fc7d0153332 [gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents: 11485
diff changeset
1572 const char *display_name = gaim_connection_get_display_name(gc);
9fc7d0153332 [gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents: 11485
diff changeset
1573 if (display_name != NULL)
9fc7d0153332 [gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents: 11485
diff changeset
1574 alias = display_name;
9fc7d0153332 [gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents: 11485
diff changeset
1575 }
9fc7d0153332 [gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents: 11485
diff changeset
1576 } else if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) {
11485
16b0da1f376f [gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents: 11481
diff changeset
1577 GaimBuddy *buddy;
16b0da1f376f [gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents: 11481
diff changeset
1578 if ((buddy = gaim_find_buddy(gc->account, new_user)) != NULL)
16b0da1f376f [gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents: 11481
diff changeset
1579 new_alias = gaim_buddy_get_contact_alias(buddy);
16b0da1f376f [gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents: 11481
diff changeset
1580 }
16b0da1f376f [gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents: 11481
diff changeset
1581
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1582 if (ops != NULL && ops->chat_rename_user != NULL)
11485
16b0da1f376f [gaim-migrate @ 13727]
Richard Laager <rlaager@wiktel.com>
parents: 11481
diff changeset
1583 ops->chat_rename_user(conv, old_user, new_user, new_alias);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1584
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1585 cb = gaim_conv_chat_cb_find(chat, old_user);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1586
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1587 if (cb) {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1588 gaim_conv_chat_set_users(chat,
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1589 g_list_remove(gaim_conv_chat_get_users(chat), cb));
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1590 gaim_conv_chat_cb_destroy(cb);
4506
f3afcc4dd133 [gaim-migrate @ 4781]
Christian Hammond <chipx86@chipx86.com>
parents: 4491
diff changeset
1591 }
1428
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
1592
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1593 if (gaim_conv_chat_is_user_ignored(chat, old_user)) {
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1594 gaim_conv_chat_unignore(chat, old_user);
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1595 gaim_conv_chat_ignore(chat, new_user);
1428
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
1596 }
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1597 else if (gaim_conv_chat_is_user_ignored(chat, new_user))
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1598 gaim_conv_chat_unignore(chat, new_user);
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
1599
11500
9fc7d0153332 [gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents: 11485
diff changeset
1600 if (is_me)
8158
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
1601 gaim_conv_chat_set_nick(chat, new_user);
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
1602
11481
c80edbd8961a [gaim-migrate @ 13723]
Richard Laager <rlaager@wiktel.com>
parents: 11478
diff changeset
1603 if (gaim_prefs_get_bool("/core/conversations/chat/show_nick_change") &&
c80edbd8961a [gaim-migrate @ 13723]
Richard Laager <rlaager@wiktel.com>
parents: 11478
diff changeset
1604 !gaim_conv_chat_is_user_ignored(chat, new_user)) {
c80edbd8961a [gaim-migrate @ 13723]
Richard Laager <rlaager@wiktel.com>
parents: 11478
diff changeset
1605
11500
9fc7d0153332 [gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents: 11485
diff changeset
1606 if (is_me) {
8158
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
1607 g_snprintf(tmp, sizeof(tmp),
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
1608 _("You are now known as %s"), new_user);
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
1609 } else {
11454
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1610 const char *old_alias = old_user;
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1611 const char *new_alias = new_user;
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11552
diff changeset
1612
11454
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1613 if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) {
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1614 GaimBuddy *buddy;
11581
9b3833da6840 [gaim-migrate @ 13851]
Tim Ringenbach <marv@pidgin.im>
parents: 11552
diff changeset
1615
11454
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1616 if ((buddy = gaim_find_buddy(gc->account, old_user)) != NULL)
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1617 old_alias = gaim_buddy_get_contact_alias(buddy);
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1618 if ((buddy = gaim_find_buddy(gc->account, new_user)) != NULL)
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1619 new_alias = gaim_buddy_get_contact_alias(buddy);
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1620 }
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1621
8158
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
1622 g_snprintf(tmp, sizeof(tmp),
11454
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1623 _("%s is now known as %s"), old_alias, new_alias);
8158
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
1624 }
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
1625
6982
083d1e4a9c78 [gaim-migrate @ 7538]
Mark Doliner <mark@kingant.net>
parents: 6846
diff changeset
1626 gaim_conversation_write(conv, NULL, tmp, GAIM_MESSAGE_SYSTEM, time(NULL));
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
1627 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
1628 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
1629
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1630 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1631 gaim_conv_chat_remove_user(GaimConvChat *chat, const char *user, const char *reason)
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
1632 {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1633 GaimConversation *conv;
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1634 GaimConversationUiOps *ops;
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1635 GaimConvChatBuddy *cb;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1636 char tmp[BUF_LONG];
9587
5e1c76f3d232 [gaim-migrate @ 10430]
Luke Schierer <lschiere@pidgin.im>
parents: 9554
diff changeset
1637 gboolean quiet;
11454
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1638 const char *alias = user;
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
1639
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1640 g_return_if_fail(chat != NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1641 g_return_if_fail(user != NULL);
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
1642
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1643 conv = gaim_conv_chat_get_conversation(chat);
4465
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
1644 ops = gaim_conversation_get_ui_ops(conv);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1645
9587
5e1c76f3d232 [gaim-migrate @ 10430]
Luke Schierer <lschiere@pidgin.im>
parents: 9554
diff changeset
1646 quiet = GPOINTER_TO_INT(gaim_signal_emit_return_1(gaim_conversations_get_handle(),
10955
83a79d69160c [gaim-migrate @ 12755]
Mark Doliner <mark@kingant.net>
parents: 10849
diff changeset
1647 "chat-buddy-leaving", conv, user, reason)) |
83a79d69160c [gaim-migrate @ 12755]
Mark Doliner <mark@kingant.net>
parents: 10849
diff changeset
1648 gaim_conv_chat_is_user_ignored(chat, user);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1649
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1650 if (ops != NULL && ops->chat_remove_user != NULL)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1651 ops->chat_remove_user(conv, user);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1652
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1653 cb = gaim_conv_chat_cb_find(chat, user);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1654
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1655 if (cb) {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1656 gaim_conv_chat_set_users(chat,
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1657 g_list_remove(gaim_conv_chat_get_users(chat), cb));
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1658 gaim_conv_chat_cb_destroy(cb);
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
1659 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
1660
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1661 /* NOTE: Don't remove them from ignored in case they re-enter. */
2787
feea7103a235 [gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2773
diff changeset
1662
9587
5e1c76f3d232 [gaim-migrate @ 10430]
Luke Schierer <lschiere@pidgin.im>
parents: 9554
diff changeset
1663 if (!quiet) {
11454
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1664 GaimConnection *gc = gaim_conversation_get_gc(conv);
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1665 GaimPluginProtocolInfo *prpl_info;
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1666
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1667 if (!gc || !(prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)))
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1668 return;
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1669
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1670 if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) {
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1671 GaimBuddy *buddy;
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1672
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1673 if ((buddy = gaim_find_buddy(gc->account, user)) != NULL)
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1674 alias = gaim_buddy_get_contact_alias(buddy);
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1675 }
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1676
9587
5e1c76f3d232 [gaim-migrate @ 10430]
Luke Schierer <lschiere@pidgin.im>
parents: 9554
diff changeset
1677 if (reason != NULL && *reason != '\0')
5e1c76f3d232 [gaim-migrate @ 10430]
Luke Schierer <lschiere@pidgin.im>
parents: 9554
diff changeset
1678 g_snprintf(tmp, sizeof(tmp),
11454
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1679 _("%s left the room (%s)."), alias, reason);
9587
5e1c76f3d232 [gaim-migrate @ 10430]
Luke Schierer <lschiere@pidgin.im>
parents: 9554
diff changeset
1680 else
11454
201617d49573 [gaim-migrate @ 13693]
Richard Laager <rlaager@wiktel.com>
parents: 11338
diff changeset
1681 g_snprintf(tmp, sizeof(tmp), _("%s left the room."), alias);
9587
5e1c76f3d232 [gaim-migrate @ 10430]
Luke Schierer <lschiere@pidgin.im>
parents: 9554
diff changeset
1682
5e1c76f3d232 [gaim-migrate @ 10430]
Luke Schierer <lschiere@pidgin.im>
parents: 9554
diff changeset
1683 gaim_conversation_write(conv, NULL, tmp, GAIM_MESSAGE_SYSTEM, time(NULL));
5e1c76f3d232 [gaim-migrate @ 10430]
Luke Schierer <lschiere@pidgin.im>
parents: 9554
diff changeset
1684 }
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1685
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1686 gaim_signal_emit(gaim_conversations_get_handle(), "chat-buddy-left",
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1687 conv, user, reason);
1759
e0f936b4c91a [gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1757
diff changeset
1688 }
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
1689
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1690 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1691 gaim_conv_chat_remove_users(GaimConvChat *chat, GList *users, const char *reason)
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1692 {
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1693 GaimConversation *conv;
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1694 GaimConversationUiOps *ops;
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1695 GaimConvChatBuddy *cb;
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1696 char tmp[BUF_LONG];
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1697 GList *l;
9606
03be9d653123 [gaim-migrate @ 10449]
Luke Schierer <lschiere@pidgin.im>
parents: 9587
diff changeset
1698 gboolean quiet = FALSE;
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1699
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1700 g_return_if_fail(chat != NULL);
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1701 g_return_if_fail(users != NULL);
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1702
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1703 conv = gaim_conv_chat_get_conversation(chat);
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1704 ops = gaim_conversation_get_ui_ops(conv);
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1705
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1706 for (l = users; l != NULL; l = l->next) {
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1707 const char *user = (const char *)l->data;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1708
9587
5e1c76f3d232 [gaim-migrate @ 10430]
Luke Schierer <lschiere@pidgin.im>
parents: 9554
diff changeset
1709 quiet = GPOINTER_TO_INT(gaim_signal_emit_return_1(gaim_conversations_get_handle(),
5e1c76f3d232 [gaim-migrate @ 10430]
Luke Schierer <lschiere@pidgin.im>
parents: 9554
diff changeset
1710 "chat-buddy-leaving", conv, user, reason));
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1711 }
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1712
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1713 if (ops != NULL && ops->chat_remove_users != NULL)
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1714 ops->chat_remove_users(conv, users);
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1715
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1716 for (l = users; l != NULL; l = l->next) {
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1717 const char *user = (const char *)l->data;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1718
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1719 cb = gaim_conv_chat_cb_find(chat, user);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1720
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1721 if (cb) {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1722 gaim_conv_chat_set_users(chat,
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1723 g_list_remove(gaim_conv_chat_get_users(chat), cb));
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1724 gaim_conv_chat_cb_destroy(cb);
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1725 }
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1726
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1727 gaim_signal_emit(gaim_conversations_get_handle(), "chat-buddy-left",
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1728 conv, user, reason);
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1729 }
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1730
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1731 /* NOTE: Don't remove them from ignored in case they re-enter. */
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1732
9587
5e1c76f3d232 [gaim-migrate @ 10430]
Luke Schierer <lschiere@pidgin.im>
parents: 9554
diff changeset
1733 if (!quiet && reason != NULL && *reason != '\0') {
8998
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
1734 int i;
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
1735 int size = g_list_length(users);
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
1736 int max = MIN(10, size);
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
1737 GList *l;
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
1738
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
1739 *tmp = '\0';
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
1740
10958
90d22e1b68df [gaim-migrate @ 12759]
Mark Doliner <mark@kingant.net>
parents: 10955
diff changeset
1741 for (l = users, i = 0; i < max; i++, l = l->next)
90d22e1b68df [gaim-migrate @ 12759]
Mark Doliner <mark@kingant.net>
parents: 10955
diff changeset
1742 {
90d22e1b68df [gaim-migrate @ 12759]
Mark Doliner <mark@kingant.net>
parents: 10955
diff changeset
1743 if (!gaim_conv_chat_is_user_ignored(chat, (char *)l->data))
90d22e1b68df [gaim-migrate @ 12759]
Mark Doliner <mark@kingant.net>
parents: 10955
diff changeset
1744 {
90d22e1b68df [gaim-migrate @ 12759]
Mark Doliner <mark@kingant.net>
parents: 10955
diff changeset
1745 g_strlcat(tmp, (char *)l->data, sizeof(tmp));
90d22e1b68df [gaim-migrate @ 12759]
Mark Doliner <mark@kingant.net>
parents: 10955
diff changeset
1746
90d22e1b68df [gaim-migrate @ 12759]
Mark Doliner <mark@kingant.net>
parents: 10955
diff changeset
1747 if (i < max - 1)
90d22e1b68df [gaim-migrate @ 12759]
Mark Doliner <mark@kingant.net>
parents: 10955
diff changeset
1748 g_strlcat(tmp, ", ", sizeof(tmp));
90d22e1b68df [gaim-migrate @ 12759]
Mark Doliner <mark@kingant.net>
parents: 10955
diff changeset
1749 }
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1750 }
8998
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
1751
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
1752 if (size > 10)
10324
1034e77ff0ce [gaim-migrate @ 11531]
Mark Doliner <mark@kingant.net>
parents: 10247
diff changeset
1753 /*
1034e77ff0ce [gaim-migrate @ 11531]
Mark Doliner <mark@kingant.net>
parents: 10247
diff changeset
1754 * This should probably use ngettext(), but this function
1034e77ff0ce [gaim-migrate @ 11531]
Mark Doliner <mark@kingant.net>
parents: 10247
diff changeset
1755 * isn't called from anywhere, so I'm going to leave it.
1034e77ff0ce [gaim-migrate @ 11531]
Mark Doliner <mark@kingant.net>
parents: 10247
diff changeset
1756 */
8998
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
1757 g_snprintf(tmp, sizeof(tmp),
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
1758 _("(+%d more)"), size - 10);
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
1759
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
1760 g_snprintf(tmp, sizeof(tmp), _(" left the room (%s)."), reason);
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
1761
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
1762 gaim_conversation_write(conv, NULL, tmp,
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
1763 GAIM_MESSAGE_SYSTEM, time(NULL));
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1764 }
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1765 }
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1766
6414
874a5c9f4eb8 [gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents: 6407
diff changeset
1767 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1768 gaim_conv_chat_clear_users(GaimConvChat *chat)
6414
874a5c9f4eb8 [gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents: 6407
diff changeset
1769 {
874a5c9f4eb8 [gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents: 6407
diff changeset
1770 GaimConversation *conv;
874a5c9f4eb8 [gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents: 6407
diff changeset
1771 GaimConversationUiOps *ops;
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1772 GList *users, *names = NULL;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1773 GList *l;
6414
874a5c9f4eb8 [gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents: 6407
diff changeset
1774
874a5c9f4eb8 [gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents: 6407
diff changeset
1775 g_return_if_fail(chat != NULL);
874a5c9f4eb8 [gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents: 6407
diff changeset
1776
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1777 conv = gaim_conv_chat_get_conversation(chat);
6414
874a5c9f4eb8 [gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents: 6407
diff changeset
1778 ops = gaim_conversation_get_ui_ops(conv);
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1779 users = gaim_conv_chat_get_users(chat);
6414
874a5c9f4eb8 [gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents: 6407
diff changeset
1780
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1781 if (ops != NULL && ops->chat_remove_users != NULL) {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1782 for (l = users; l; l = l->next) {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1783 GaimConvChatBuddy *cb = l->data;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1784 names = g_list_append(names, cb->name);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1785 }
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1786 ops->chat_remove_users(conv, names);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1787 g_list_free(names);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1788 }
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1789
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1790 for (l = users; l; l = l->next)
6414
874a5c9f4eb8 [gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents: 6407
diff changeset
1791 {
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1792 GaimConvChatBuddy *cb = l->data;
6414
874a5c9f4eb8 [gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents: 6407
diff changeset
1793
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1794 gaim_signal_emit(gaim_conversations_get_handle(),
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1795 "chat-buddy-leaving", conv, cb->name, NULL);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1796 gaim_signal_emit(gaim_conversations_get_handle(),
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1797 "chat-buddy-left", conv, cb->name, NULL);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1798
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1799 gaim_conv_chat_cb_destroy(cb);
6414
874a5c9f4eb8 [gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents: 6407
diff changeset
1800 }
874a5c9f4eb8 [gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents: 6407
diff changeset
1801
874a5c9f4eb8 [gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents: 6407
diff changeset
1802 g_list_free(users);
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1803 gaim_conv_chat_set_users(chat, NULL);
6414
874a5c9f4eb8 [gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents: 6407
diff changeset
1804 }
874a5c9f4eb8 [gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents: 6407
diff changeset
1805
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1806
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1807 gboolean
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1808 gaim_conv_chat_find_user(GaimConvChat *chat, const char *user)
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1809 {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1810 g_return_val_if_fail(chat != NULL, FALSE);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1811 g_return_val_if_fail(user != NULL, FALSE);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1812
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1813 return (gaim_conv_chat_cb_find(chat, user) != NULL);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1814 }
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1815
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1816 void
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1817 gaim_conv_chat_user_set_flags(GaimConvChat *chat, const char *user,
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1818 GaimConvChatBuddyFlags flags)
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1819 {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1820 GaimConversation *conv;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1821 GaimConversationUiOps *ops;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1822 GaimConvChatBuddy *cb;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1823 GaimConvChatBuddyFlags oldflags;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1824
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1825 g_return_if_fail(chat != NULL);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1826 g_return_if_fail(user != NULL);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1827
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1828 cb = gaim_conv_chat_cb_find(chat, user);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1829
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1830 if (!cb)
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1831 return;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1832
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1833 if (flags == cb->flags)
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1834 return;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1835
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1836 oldflags = cb->flags;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1837 cb->flags = flags;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1838
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1839 conv = gaim_conv_chat_get_conversation(chat);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1840 ops = gaim_conversation_get_ui_ops(conv);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1841
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1842 if (ops != NULL && ops->chat_update_user != NULL)
11500
9fc7d0153332 [gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents: 11485
diff changeset
1843 ops->chat_update_user(conv, user);
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1844
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1845 gaim_signal_emit(gaim_conversations_get_handle(),
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1846 "chat-buddy-flags", conv, user, oldflags, flags);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1847 }
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1848
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1849 GaimConvChatBuddyFlags
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1850 gaim_conv_chat_user_get_flags(GaimConvChat *chat, const char *user)
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1851 {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1852 GaimConvChatBuddy *cb;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1853
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1854 g_return_val_if_fail(chat != NULL, 0);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1855 g_return_val_if_fail(user != NULL, 0);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1856
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1857 cb = gaim_conv_chat_cb_find(chat, user);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1858
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1859 if (!cb)
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1860 return GAIM_CBFLAGS_NONE;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1861
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1862 return cb->flags;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1863 }
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1864
8158
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
1865 void gaim_conv_chat_set_nick(GaimConvChat *chat, const char *nick) {
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
1866 g_return_if_fail(chat != NULL);
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
1867
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
1868 if(chat->nick)
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
1869 g_free(chat->nick);
11500
9fc7d0153332 [gaim-migrate @ 13745]
Richard Laager <rlaager@wiktel.com>
parents: 11485
diff changeset
1870 chat->nick = g_strdup(gaim_normalize(chat->conv->account, nick));
8158
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
1871 }
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
1872
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
1873 const char *gaim_conv_chat_get_nick(GaimConvChat *chat) {
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
1874 g_return_val_if_fail(chat != NULL, NULL);
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
1875
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
1876 return chat->nick;
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
1877 }
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
1878
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1879 GaimConversation *
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1880 gaim_find_chat(const GaimConnection *gc, int id)
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
1881 {
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1882 GList *l;
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1883 GaimConversation *conv;
2499
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
1884
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1885 for (l = gaim_get_chats(); l != NULL; l = l->next) {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1886 conv = (GaimConversation *)l->data;
2499
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
1887
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1888 if (gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)) == id &&
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1889 gaim_conversation_get_gc(conv) == gc)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1890 return conv;
2499
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
1891 }
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
1892
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1893 return NULL;
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
1894 }
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
1895
8256
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
1896 void
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
1897 gaim_conv_chat_left(GaimConvChat *chat)
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
1898 {
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
1899 g_return_if_fail(chat != NULL);
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
1900
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
1901 chat->left = TRUE;
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
1902 gaim_conversation_update(chat->conv, GAIM_CONV_UPDATE_CHATLEFT);
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
1903 }
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
1904
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
1905 gboolean
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
1906 gaim_conv_chat_has_left(GaimConvChat *chat)
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
1907 {
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
1908 g_return_val_if_fail(chat != NULL, TRUE);
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
1909
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
1910 return chat->left;
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
1911 }
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
1912
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1913 GaimConvChatBuddy *
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1914 gaim_conv_chat_cb_new(const char *name, GaimConvChatBuddyFlags flags)
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1915 {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1916 GaimConvChatBuddy *cb;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1917
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1918 g_return_val_if_fail(name != NULL, NULL);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1919
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1920 cb = g_new0(GaimConvChatBuddy, 1);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1921 cb->name = g_strdup(name);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1922 cb->flags = flags;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1923
11146
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents: 11137
diff changeset
1924 GAIM_DBUS_REGISTER_POINTER(cb, GaimConvChatBuddy);
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1925 return cb;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1926 }
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1927
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1928 GaimConvChatBuddy *
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1929 gaim_conv_chat_cb_find(GaimConvChat *chat, const char *name)
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1930 {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1931 GList *l;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1932 GaimConvChatBuddy *cb = NULL;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1933
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1934 g_return_val_if_fail(chat != NULL, NULL);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1935 g_return_val_if_fail(name != NULL, NULL);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1936
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1937 for (l = gaim_conv_chat_get_users(chat); l; l = l->next) {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1938 cb = l->data;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1939 if (!gaim_utf8_strcasecmp(cb->name, name))
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1940 return cb;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1941 }
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1942
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1943 return NULL;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1944 }
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1945
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1946 void
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1947 gaim_conv_chat_cb_destroy(GaimConvChatBuddy *cb)
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1948 {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1949 g_return_if_fail(cb != NULL);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1950
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1951 if (cb->name)
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1952 g_free(cb->name);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1953 cb->name = NULL;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1954 cb->flags = 0;
11146
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents: 11137
diff changeset
1955
1c5398ccbeb0 [gaim-migrate @ 13217]
Piotr Zielinski <zielaj>
parents: 11137
diff changeset
1956 GAIM_DBUS_UNREGISTER_POINTER(cb);
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1957 g_free(cb);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1958 }
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1959
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1960 const char *
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1961 gaim_conv_chat_cb_get_name(GaimConvChatBuddy *cb)
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1962 {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1963 g_return_val_if_fail(cb != NULL, NULL);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1964
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1965 return cb->name;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1966 }
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1967
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1968 void *
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1969 gaim_conversations_get_handle(void)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1970 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1971 static int handle;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1972
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1973 return &handle;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1974 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1975
5858
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
1976 void
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1977 gaim_conversations_init(void)
5858
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
1978 {
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1979 void *handle = gaim_conversations_get_handle();
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1980
6846
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
1981 /**********************************************************************
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
1982 * Register preferences
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
1983 **********************************************************************/
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1984
5858
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
1985 /* Conversations */
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
1986 gaim_prefs_add_none("/core/conversations");
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
1987
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
1988 /* Conversations -> Chat */
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
1989 gaim_prefs_add_none("/core/conversations/chat");
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
1990 gaim_prefs_add_bool("/core/conversations/chat/show_nick_change", TRUE);
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
1991
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
1992 /* Conversations -> IM */
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
1993 gaim_prefs_add_none("/core/conversations/im");
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
1994 gaim_prefs_add_bool("/core/conversations/im/send_typing", TRUE);
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
1995
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1996
6846
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
1997 /**********************************************************************
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
1998 * Register signals
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
1999 **********************************************************************/
8078
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2000 gaim_signal_register(handle, "writing-im-msg",
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2001 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER,
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2002 gaim_value_new(GAIM_TYPE_BOOLEAN), 3,
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2003 gaim_value_new(GAIM_TYPE_SUBTYPE,
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2004 GAIM_SUBTYPE_ACCOUNT),
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2005 gaim_value_new(GAIM_TYPE_SUBTYPE,
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2006 GAIM_SUBTYPE_CONVERSATION),
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2007 gaim_value_new_outgoing(GAIM_TYPE_STRING));
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2008
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2009 gaim_signal_register(handle, "wrote-im-msg",
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2010 gaim_marshal_VOID__POINTER_POINTER_POINTER,
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2011 NULL, 3,
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2012 gaim_value_new(GAIM_TYPE_SUBTYPE,
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2013 GAIM_SUBTYPE_ACCOUNT),
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2014 gaim_value_new(GAIM_TYPE_SUBTYPE,
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2015 GAIM_SUBTYPE_CONVERSATION),
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2016 gaim_value_new(GAIM_TYPE_STRING));
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2017
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2018 gaim_signal_register(handle, "displaying-im-msg",
6780
e9a730ad5a3c [gaim-migrate @ 7319]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2019 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER,
e9a730ad5a3c [gaim-migrate @ 7319]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2020 gaim_value_new(GAIM_TYPE_BOOLEAN), 3,
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2021 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2022 GAIM_SUBTYPE_ACCOUNT),
6780
e9a730ad5a3c [gaim-migrate @ 7319]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2023 gaim_value_new(GAIM_TYPE_SUBTYPE,
e9a730ad5a3c [gaim-migrate @ 7319]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2024 GAIM_SUBTYPE_CONVERSATION),
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2025 gaim_value_new_outgoing(GAIM_TYPE_STRING));
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2026
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2027 gaim_signal_register(handle, "displayed-im-msg",
6780
e9a730ad5a3c [gaim-migrate @ 7319]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2028 gaim_marshal_VOID__POINTER_POINTER_POINTER,
e9a730ad5a3c [gaim-migrate @ 7319]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2029 NULL, 3,
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2030 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2031 GAIM_SUBTYPE_ACCOUNT),
6780
e9a730ad5a3c [gaim-migrate @ 7319]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2032 gaim_value_new(GAIM_TYPE_SUBTYPE,
e9a730ad5a3c [gaim-migrate @ 7319]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2033 GAIM_SUBTYPE_CONVERSATION),
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2034 gaim_value_new(GAIM_TYPE_STRING));
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2035
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2036 gaim_signal_register(handle, "sending-im-msg",
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2037 gaim_marshal_VOID__POINTER_POINTER_POINTER,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2038 NULL, 3,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2039 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2040 GAIM_SUBTYPE_ACCOUNT),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2041 gaim_value_new(GAIM_TYPE_STRING),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2042 gaim_value_new_outgoing(GAIM_TYPE_STRING));
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2043
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2044 gaim_signal_register(handle, "sent-im-msg",
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2045 gaim_marshal_VOID__POINTER_POINTER_POINTER,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2046 NULL, 3,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2047 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2048 GAIM_SUBTYPE_ACCOUNT),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2049 gaim_value_new(GAIM_TYPE_STRING),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2050 gaim_value_new(GAIM_TYPE_STRING));
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2051
8999
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2052 gaim_signal_register(handle, "receiving-im-msg",
10104
60db14d54914 [gaim-migrate @ 11131]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10087
diff changeset
2053 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER,
60db14d54914 [gaim-migrate @ 11131]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10087
diff changeset
2054 gaim_value_new(GAIM_TYPE_BOOLEAN), 5,
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2055 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2056 GAIM_SUBTYPE_ACCOUNT),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2057 gaim_value_new_outgoing(GAIM_TYPE_STRING),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2058 gaim_value_new_outgoing(GAIM_TYPE_STRING),
10104
60db14d54914 [gaim-migrate @ 11131]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10087
diff changeset
2059 gaim_value_new(GAIM_TYPE_SUBTYPE,
60db14d54914 [gaim-migrate @ 11131]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10087
diff changeset
2060 GAIM_SUBTYPE_CONVERSATION),
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2061 gaim_value_new_outgoing(GAIM_TYPE_UINT));
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2062
8999
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2063 gaim_signal_register(handle, "received-im-msg",
10104
60db14d54914 [gaim-migrate @ 11131]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10087
diff changeset
2064 gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT,
60db14d54914 [gaim-migrate @ 11131]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10087
diff changeset
2065 NULL, 5,
8999
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2066 gaim_value_new(GAIM_TYPE_SUBTYPE,
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2067 GAIM_SUBTYPE_ACCOUNT),
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2068 gaim_value_new(GAIM_TYPE_STRING),
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2069 gaim_value_new(GAIM_TYPE_STRING),
10104
60db14d54914 [gaim-migrate @ 11131]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10087
diff changeset
2070 gaim_value_new(GAIM_TYPE_SUBTYPE,
60db14d54914 [gaim-migrate @ 11131]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10087
diff changeset
2071 GAIM_SUBTYPE_CONVERSATION),
8999
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2072 gaim_value_new(GAIM_TYPE_UINT));
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2073
8078
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2074 gaim_signal_register(handle, "writing-chat-msg",
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2075 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER,
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2076 gaim_value_new(GAIM_TYPE_BOOLEAN), 3,
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2077 gaim_value_new(GAIM_TYPE_SUBTYPE,
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2078 GAIM_SUBTYPE_ACCOUNT),
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2079 gaim_value_new(GAIM_TYPE_SUBTYPE,
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2080 GAIM_SUBTYPE_CONVERSATION),
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2081 gaim_value_new_outgoing(GAIM_TYPE_STRING));
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2082
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2083 gaim_signal_register(handle, "wrote-chat-msg",
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2084 gaim_marshal_VOID__POINTER_POINTER_POINTER,
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2085 NULL, 3,
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2086 gaim_value_new(GAIM_TYPE_SUBTYPE,
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2087 GAIM_SUBTYPE_ACCOUNT),
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2088 gaim_value_new(GAIM_TYPE_SUBTYPE,
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2089 GAIM_SUBTYPE_CONVERSATION),
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2090 gaim_value_new(GAIM_TYPE_STRING));
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2091
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2092 gaim_signal_register(handle, "displaying-chat-msg",
6780
e9a730ad5a3c [gaim-migrate @ 7319]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2093 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER,
e9a730ad5a3c [gaim-migrate @ 7319]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2094 gaim_value_new(GAIM_TYPE_BOOLEAN), 3,
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2095 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2096 GAIM_SUBTYPE_ACCOUNT),
6780
e9a730ad5a3c [gaim-migrate @ 7319]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2097 gaim_value_new(GAIM_TYPE_SUBTYPE,
e9a730ad5a3c [gaim-migrate @ 7319]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2098 GAIM_SUBTYPE_CONVERSATION),
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2099 gaim_value_new_outgoing(GAIM_TYPE_STRING));
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2100
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2101 gaim_signal_register(handle, "displayed-chat-msg",
6780
e9a730ad5a3c [gaim-migrate @ 7319]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2102 gaim_marshal_VOID__POINTER_POINTER_POINTER,
e9a730ad5a3c [gaim-migrate @ 7319]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2103 NULL, 3,
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2104 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2105 GAIM_SUBTYPE_ACCOUNT),
6780
e9a730ad5a3c [gaim-migrate @ 7319]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2106 gaim_value_new(GAIM_TYPE_SUBTYPE,
e9a730ad5a3c [gaim-migrate @ 7319]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2107 GAIM_SUBTYPE_CONVERSATION),
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2108 gaim_value_new(GAIM_TYPE_STRING));
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2109
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2110 gaim_signal_register(handle, "sending-chat-msg",
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2111 gaim_marshal_VOID__POINTER_POINTER_UINT, NULL, 3,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2112 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2113 GAIM_SUBTYPE_ACCOUNT),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2114 gaim_value_new_outgoing(GAIM_TYPE_STRING),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2115 gaim_value_new(GAIM_TYPE_UINT));
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2116
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2117 gaim_signal_register(handle, "sent-chat-msg",
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2118 gaim_marshal_VOID__POINTER_POINTER_UINT, NULL, 3,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2119 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2120 GAIM_SUBTYPE_ACCOUNT),
6607
d8fd7c29eaf0 [gaim-migrate @ 7131]
Christian Hammond <chipx86@chipx86.com>
parents: 6605
diff changeset
2121 gaim_value_new(GAIM_TYPE_STRING),
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2122 gaim_value_new(GAIM_TYPE_UINT));
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2123
8999
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2124 gaim_signal_register(handle, "receiving-chat-msg",
10104
60db14d54914 [gaim-migrate @ 11131]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10087
diff changeset
2125 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER,
60db14d54914 [gaim-migrate @ 11131]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10087
diff changeset
2126 gaim_value_new(GAIM_TYPE_BOOLEAN), 5,
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2127 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2128 GAIM_SUBTYPE_ACCOUNT),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2129 gaim_value_new_outgoing(GAIM_TYPE_STRING),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2130 gaim_value_new_outgoing(GAIM_TYPE_STRING),
7511
a899742289c2 [gaim-migrate @ 8124]
Christian Hammond <chipx86@chipx86.com>
parents: 7431
diff changeset
2131 gaim_value_new(GAIM_TYPE_SUBTYPE,
10104
60db14d54914 [gaim-migrate @ 11131]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10087
diff changeset
2132 GAIM_SUBTYPE_CONVERSATION),
60db14d54914 [gaim-migrate @ 11131]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10087
diff changeset
2133 gaim_value_new_outgoing(GAIM_TYPE_UINT));
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2134
8999
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2135 gaim_signal_register(handle, "received-chat-msg",
10104
60db14d54914 [gaim-migrate @ 11131]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10087
diff changeset
2136 gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT,
60db14d54914 [gaim-migrate @ 11131]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10087
diff changeset
2137 NULL, 5,
8999
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2138 gaim_value_new(GAIM_TYPE_SUBTYPE,
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2139 GAIM_SUBTYPE_ACCOUNT),
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2140 gaim_value_new(GAIM_TYPE_STRING),
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2141 gaim_value_new(GAIM_TYPE_STRING),
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2142 gaim_value_new(GAIM_TYPE_SUBTYPE,
10104
60db14d54914 [gaim-migrate @ 11131]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10087
diff changeset
2143 GAIM_SUBTYPE_CONVERSATION),
60db14d54914 [gaim-migrate @ 11131]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10087
diff changeset
2144 gaim_value_new(GAIM_TYPE_UINT));
8999
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2145
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2146 gaim_signal_register(handle, "conversation-switching",
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2147 gaim_marshal_VOID__POINTER_POINTER, NULL, 2,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2148 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2149 GAIM_SUBTYPE_CONVERSATION),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2150 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2151 GAIM_SUBTYPE_CONVERSATION));
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2152
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2153 gaim_signal_register(handle, "conversation-switched",
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2154 gaim_marshal_VOID__POINTER_POINTER, NULL, 2,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2155 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2156 GAIM_SUBTYPE_CONVERSATION),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2157 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2158 GAIM_SUBTYPE_CONVERSATION));
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2159
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2160 gaim_signal_register(handle, "conversation-created",
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2161 gaim_marshal_VOID__POINTER, NULL, 1,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2162 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2163 GAIM_SUBTYPE_CONVERSATION));
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2164
9734
676cf082d29c [gaim-migrate @ 10595]
Mark Doliner <mark@kingant.net>
parents: 9633
diff changeset
2165 gaim_signal_register(handle, "conversation-updated",
9909
ebca3bbc6719 [gaim-migrate @ 10801]
Luke Schierer <lschiere@pidgin.im>
parents: 9846
diff changeset
2166 gaim_marshal_VOID__POINTER_UINT, NULL, 2,
9734
676cf082d29c [gaim-migrate @ 10595]
Mark Doliner <mark@kingant.net>
parents: 9633
diff changeset
2167 gaim_value_new(GAIM_TYPE_SUBTYPE,
676cf082d29c [gaim-migrate @ 10595]
Mark Doliner <mark@kingant.net>
parents: 9633
diff changeset
2168 GAIM_SUBTYPE_CONVERSATION),
676cf082d29c [gaim-migrate @ 10595]
Mark Doliner <mark@kingant.net>
parents: 9633
diff changeset
2169 gaim_value_new(GAIM_TYPE_UINT));
676cf082d29c [gaim-migrate @ 10595]
Mark Doliner <mark@kingant.net>
parents: 9633
diff changeset
2170
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2171 gaim_signal_register(handle, "deleting-conversation",
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2172 gaim_marshal_VOID__POINTER, NULL, 1,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2173 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2174 GAIM_SUBTYPE_CONVERSATION));
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2175
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2176 gaim_signal_register(handle, "buddy-typing",
11793
dfdc286878f9 [gaim-migrate @ 14084]
Gary Kramlich <grim@reaperworld.com>
parents: 11706
diff changeset
2177 gaim_marshal_VOID__POINTER_POINTER, NULL, 2,
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2178 gaim_value_new(GAIM_TYPE_SUBTYPE,
11706
bcc49c25ef90 [gaim-migrate @ 13997]
Richard Laager <rlaager@wiktel.com>
parents: 11676
diff changeset
2179 GAIM_SUBTYPE_ACCOUNT),
bcc49c25ef90 [gaim-migrate @ 13997]
Richard Laager <rlaager@wiktel.com>
parents: 11676
diff changeset
2180 gaim_value_new(GAIM_TYPE_STRING));
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2181
6837
f098765ac919 [gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents: 6787
diff changeset
2182 gaim_signal_register(handle, "buddy-typing-stopped",
11793
dfdc286878f9 [gaim-migrate @ 14084]
Gary Kramlich <grim@reaperworld.com>
parents: 11706
diff changeset
2183 gaim_marshal_VOID__POINTER_POINTER, NULL, 2,
6837
f098765ac919 [gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents: 6787
diff changeset
2184 gaim_value_new(GAIM_TYPE_SUBTYPE,
11706
bcc49c25ef90 [gaim-migrate @ 13997]
Richard Laager <rlaager@wiktel.com>
parents: 11676
diff changeset
2185 GAIM_SUBTYPE_ACCOUNT),
bcc49c25ef90 [gaim-migrate @ 13997]
Richard Laager <rlaager@wiktel.com>
parents: 11676
diff changeset
2186 gaim_value_new(GAIM_TYPE_STRING));
6837
f098765ac919 [gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents: 6787
diff changeset
2187
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2188 gaim_signal_register(handle, "chat-buddy-joining",
9587
5e1c76f3d232 [gaim-migrate @ 10430]
Luke Schierer <lschiere@pidgin.im>
parents: 9554
diff changeset
2189 gaim_marshal_BOOLEAN__POINTER_POINTER_UINT,
5e1c76f3d232 [gaim-migrate @ 10430]
Luke Schierer <lschiere@pidgin.im>
parents: 9554
diff changeset
2190 gaim_value_new(GAIM_TYPE_BOOLEAN), 3,
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2191 gaim_value_new(GAIM_TYPE_SUBTYPE,
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2192 GAIM_SUBTYPE_CONVERSATION),
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2193 gaim_value_new(GAIM_TYPE_STRING),
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2194 gaim_value_new(GAIM_TYPE_UINT));
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2195
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2196 gaim_signal_register(handle, "chat-buddy-joined",
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2197 gaim_marshal_VOID__POINTER_POINTER_UINT, NULL, 3,
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2198 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2199 GAIM_SUBTYPE_CONVERSATION),
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2200 gaim_value_new(GAIM_TYPE_STRING),
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2201 gaim_value_new(GAIM_TYPE_UINT));
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2202
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2203 gaim_signal_register(handle, "chat-buddy-flags",
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2204 gaim_marshal_VOID__POINTER_POINTER_UINT_UINT, NULL, 4,
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2205 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2206 GAIM_SUBTYPE_CONVERSATION),
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2207 gaim_value_new(GAIM_TYPE_STRING),
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2208 gaim_value_new(GAIM_TYPE_UINT),
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2209 gaim_value_new(GAIM_TYPE_UINT));
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2210
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2211 gaim_signal_register(handle, "chat-buddy-leaving",
9587
5e1c76f3d232 [gaim-migrate @ 10430]
Luke Schierer <lschiere@pidgin.im>
parents: 9554
diff changeset
2212 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER,
5e1c76f3d232 [gaim-migrate @ 10430]
Luke Schierer <lschiere@pidgin.im>
parents: 9554
diff changeset
2213 gaim_value_new(GAIM_TYPE_BOOLEAN), 3,
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2214 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2215 GAIM_SUBTYPE_CONVERSATION),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2216 gaim_value_new(GAIM_TYPE_STRING),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2217 gaim_value_new(GAIM_TYPE_STRING));
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2218
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2219 gaim_signal_register(handle, "chat-buddy-left",
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2220 gaim_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2221 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2222 GAIM_SUBTYPE_CONVERSATION),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2223 gaim_value_new(GAIM_TYPE_STRING),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2224 gaim_value_new(GAIM_TYPE_STRING));
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2225
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2226 gaim_signal_register(handle, "chat-inviting-user",
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2227 gaim_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2228 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2229 GAIM_SUBTYPE_CONVERSATION),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2230 gaim_value_new(GAIM_TYPE_STRING),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2231 gaim_value_new_outgoing(GAIM_TYPE_STRING));
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2232
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2233 gaim_signal_register(handle, "chat-invited-user",
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2234 gaim_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2235 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2236 GAIM_SUBTYPE_CONVERSATION),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2237 gaim_value_new(GAIM_TYPE_STRING),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2238 gaim_value_new(GAIM_TYPE_STRING));
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2239
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2240 gaim_signal_register(handle, "chat-invited",
11064
e4459e8ccfb5 [gaim-migrate @ 13035]
Richard Laager <rlaager@wiktel.com>
parents: 11048
diff changeset
2241 gaim_marshal_INT__POINTER_POINTER_POINTER_POINTER_POINTER,
9514
1fac0336890c [gaim-migrate @ 10341]
Luke Schierer <lschiere@pidgin.im>
parents: 9375
diff changeset
2242 NULL, 5,
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2243 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2244 GAIM_SUBTYPE_ACCOUNT),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2245 gaim_value_new(GAIM_TYPE_STRING),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2246 gaim_value_new(GAIM_TYPE_STRING),
9514
1fac0336890c [gaim-migrate @ 10341]
Luke Schierer <lschiere@pidgin.im>
parents: 9375
diff changeset
2247 gaim_value_new(GAIM_TYPE_STRING),
1fac0336890c [gaim-migrate @ 10341]
Luke Schierer <lschiere@pidgin.im>
parents: 9375
diff changeset
2248 gaim_value_new(GAIM_TYPE_POINTER));
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2249
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2250 gaim_signal_register(handle, "chat-joined",
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2251 gaim_marshal_VOID__POINTER, NULL, 1,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2252 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2253 GAIM_SUBTYPE_CONVERSATION));
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2254
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2255 gaim_signal_register(handle, "chat-left",
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2256 gaim_marshal_VOID__POINTER, NULL, 1,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2257 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2258 GAIM_SUBTYPE_CONVERSATION));
9517
0524b36c701a [gaim-migrate @ 10344]
Luke Schierer <lschiere@pidgin.im>
parents: 9514
diff changeset
2259
0524b36c701a [gaim-migrate @ 10344]
Luke Schierer <lschiere@pidgin.im>
parents: 9514
diff changeset
2260 gaim_signal_register(handle, "chat-topic-changed",
9528
7ca073ddf9b0 [gaim-migrate @ 10355]
Luke Schierer <lschiere@pidgin.im>
parents: 9517
diff changeset
2261 gaim_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3,
9517
0524b36c701a [gaim-migrate @ 10344]
Luke Schierer <lschiere@pidgin.im>
parents: 9514
diff changeset
2262 gaim_value_new(GAIM_TYPE_SUBTYPE,
0524b36c701a [gaim-migrate @ 10344]
Luke Schierer <lschiere@pidgin.im>
parents: 9514
diff changeset
2263 GAIM_SUBTYPE_CONVERSATION),
0524b36c701a [gaim-migrate @ 10344]
Luke Schierer <lschiere@pidgin.im>
parents: 9514
diff changeset
2264 gaim_value_new(GAIM_TYPE_STRING),
0524b36c701a [gaim-migrate @ 10344]
Luke Schierer <lschiere@pidgin.im>
parents: 9514
diff changeset
2265 gaim_value_new(GAIM_TYPE_STRING));
5858
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2266 }
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2267
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2268 void
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2269 gaim_conversations_uninit(void)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2270 {
9909
ebca3bbc6719 [gaim-migrate @ 10801]
Luke Schierer <lschiere@pidgin.im>
parents: 9846
diff changeset
2271 while (conversations)
ebca3bbc6719 [gaim-migrate @ 10801]
Luke Schierer <lschiere@pidgin.im>
parents: 9846
diff changeset
2272 gaim_conversation_destroy((GaimConversation*)conversations->data);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2273 gaim_signals_unregister_by_instance(gaim_conversations_get_handle());
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2274 }