annotate src/conversation.c @ 9580:b8d8571877df

[gaim-migrate @ 10423] "I have attached two i18n patches: i18n68.patch: - added src/protocols/yahoo/ycht.c to po/POTFILES.in i18n69.patch: - added POTFILES.in.noi18n to po/.cvsignore - a POTFILES.in.noi18n file will be placed in po/ if "update.pl -M" detects files in po/POTFILES.in which do not contain any i18n string" --Bjoern Voigt committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Fri, 23 Jul 2004 12:25:01 +0000
parents 8b2451878e26
children 5e1c76f3d232
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"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5860
diff changeset
25 #include "debug.h"
6982
083d1e4a9c78 [gaim-migrate @ 7538]
Mark Doliner <mark@kingant.net>
parents: 6846
diff changeset
26 #include "imgstore.h"
5436
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5350
diff changeset
27 #include "notify.h"
5539
de09863bd4b5 [gaim-migrate @ 5939]
Christian Hammond <chipx86@chipx86.com>
parents: 5436
diff changeset
28 #include "prefs.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5860
diff changeset
29 #include "prpl.h"
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
30 #include "signals.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5860
diff changeset
31 #include "util.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5860
diff changeset
32
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
33 typedef struct
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
34 {
5858
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
35 char *id;
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
36 char *name;
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
37 GaimConvPlacementFunc fnc;
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
38
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
39 } ConvPlacementData;
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
40
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
41 #define SEND_TYPED_TIMEOUT 5000
4241
cc14954cc399 [gaim-migrate @ 4491]
Luke Schierer <lschiere@pidgin.im>
parents: 4228
diff changeset
42
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
43 static GaimConvWindowUiOps *win_ui_ops = NULL;
4481
b30b0a02ada0 [gaim-migrate @ 4756]
Christian Hammond <chipx86@chipx86.com>
parents: 4478
diff changeset
44
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
45 static GList *conversations = NULL;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
46 static GList *ims = NULL;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
47 static GList *chats = NULL;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
48 static GList *windows = NULL;
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
49 static GList *conv_placement_fncs = NULL;
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
50 static GaimConvPlacementFunc place_conv = NULL;
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
51
7602
df5b0937ea47 [gaim-migrate @ 8225]
Christian Hammond <chipx86@chipx86.com>
parents: 7562
diff changeset
52 static void ensure_default_funcs(void);
df5b0937ea47 [gaim-migrate @ 8225]
Christian Hammond <chipx86@chipx86.com>
parents: 7562
diff changeset
53 static void conv_placement_last_created_win(GaimConversation *conv);
df5b0937ea47 [gaim-migrate @ 8225]
Christian Hammond <chipx86@chipx86.com>
parents: 7562
diff changeset
54
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
55 static gboolean
8158
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
56 find_nick(const char *nick, const char *message)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
57 {
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
58 char *msg, *who, *p;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
59 int n;
8158
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
60 gboolean ret = FALSE;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
61
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4687
diff changeset
62 msg = g_utf8_strdown(message, -1);
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4687
diff changeset
63
8158
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
64 who = g_utf8_strdown(nick, -1);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
65 n = strlen(who);
814
a636ac51d15b [gaim-migrate @ 824]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 808
diff changeset
66
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
67 if ((p = strstr(msg, who)) != NULL) {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
68 if ((p == msg || !isalnum(*(p - 1))) && !isalnum(*(p + n))) {
8158
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
69 ret = TRUE;
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1663
diff changeset
70 }
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
71 }
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
72
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
73 g_free(who);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
74 g_free(msg);
3612
abb114442532 [gaim-migrate @ 3726]
Sean Egan <seanegan@gmail.com>
parents: 3597
diff changeset
75
8158
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
76 return ret;
3596
bb966d68f9e3 [gaim-migrate @ 3698]
Mark Doliner <mark@kingant.net>
parents: 3572
diff changeset
77 }
bb966d68f9e3 [gaim-migrate @ 3698]
Mark Doliner <mark@kingant.net>
parents: 3572
diff changeset
78
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
79 static gboolean
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
80 reset_typing(gpointer data)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
81 {
6640
314111e7b601 [gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents: 6637
diff changeset
82 GaimConversation *c = (GaimConversation *)data;
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
83 GaimConvIm *im;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
84
6640
314111e7b601 [gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents: 6637
diff changeset
85 if (!g_list_find(conversations, c))
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
86 return FALSE;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
87
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
88 im = GAIM_CONV_IM(c);
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
89
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
90 gaim_conv_im_set_typing_state(im, GAIM_NOT_TYPING);
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
91 gaim_conv_im_update_typing(im);
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
92 gaim_conv_im_stop_typing_timeout(im);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
93
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
94 return FALSE;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
95 }
3159
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
96
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
97 static gboolean
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
98 send_typed(gpointer data)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
99 {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
100 GaimConversation *conv = (GaimConversation *)data;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
101 GaimConnection *gc;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
102 const char *name;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
103
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
104 gc = gaim_conversation_get_gc(conv);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
105 name = gaim_conversation_get_name(conv);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
106
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
107 if (conv != NULL && gc != NULL && name != NULL) {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
108 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
109
6402
cc35d07a0dcc [gaim-migrate @ 6907]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
110 serv_send_typing(gc, name, GAIM_TYPED);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
111
5213
1cf4eb75e3ee [gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
112 gaim_debug(GAIM_DEBUG_MISC, "conversation", "typed...\n");
573
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 570
diff changeset
113 }
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
114
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2722
diff changeset
115 return FALSE;
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
116 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
117
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
118 static void
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
119 common_send(GaimConversation *conv, const char *message)
3790
12b29552f1d7 [gaim-migrate @ 3930]
Rob Flynn <gaim@robflynn.com>
parents: 3789
diff changeset
120 {
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
121 GaimConversationType type;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
122 GaimConnection *gc;
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
123 GaimConversationUiOps *ops;
8076
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
124 char *displayed = NULL, *sent = NULL;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
125 int plugin_return;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
126 int err = 0;
3790
12b29552f1d7 [gaim-migrate @ 3930]
Rob Flynn <gaim@robflynn.com>
parents: 3789
diff changeset
127
7947
746404b12236 [gaim-migrate @ 8621]
Mark Doliner <mark@kingant.net>
parents: 7930
diff changeset
128 if (strlen(message) == 0)
746404b12236 [gaim-migrate @ 8621]
Mark Doliner <mark@kingant.net>
parents: 7930
diff changeset
129 return;
746404b12236 [gaim-migrate @ 8621]
Mark Doliner <mark@kingant.net>
parents: 7930
diff changeset
130
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
131 gc = gaim_conversation_get_gc(conv);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
132
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
133 g_return_if_fail(gc != NULL);
3731
d3592d407c9b [gaim-migrate @ 3869]
Sean Egan <seanegan@gmail.com>
parents: 3716
diff changeset
134
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
135 type = gaim_conversation_get_type(conv);
4465
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
136 ops = gaim_conversation_get_ui_ops(conv);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
137
8883
7e6ab16d3549 [gaim-migrate @ 9652]
Mark Doliner <mark@kingant.net>
parents: 8722
diff changeset
138 if (gc->flags & GAIM_CONNECTION_HTML)
8076
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
139 displayed = gaim_markup_linkify(message);
5136
381da05cb5ed [gaim-migrate @ 5500]
Nathan Walp <nwalp@pidgin.im>
parents: 5103
diff changeset
140 else
8076
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
141 displayed = g_strdup(message);
5136
381da05cb5ed [gaim-migrate @ 5500]
Nathan Walp <nwalp@pidgin.im>
parents: 5103
diff changeset
142
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
143 plugin_return =
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
144 GPOINTER_TO_INT(gaim_signal_emit_return_1(
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
145 gaim_conversations_get_handle(),
8076
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
146 (type == GAIM_CONV_IM ? "writing-im-msg" : "writing-chat-msg"),
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
147 gaim_conversation_get_account(conv), conv, &displayed));
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
148
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
149 if (displayed == NULL)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
150 return;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
151
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
152 if (plugin_return) {
8076
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
153 g_free(displayed);
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
154 return;
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
155 }
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
156
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
157 gaim_signal_emit(gaim_conversations_get_handle(),
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
158 (type == GAIM_CONV_IM ? "wrote-im-msg" : "wrote-chat-msg"),
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
159 gaim_conversation_get_account(conv), conv, displayed);
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
160
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
161 sent = g_strdup(displayed);
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
162
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
163 plugin_return =
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
164 GPOINTER_TO_INT(gaim_signal_emit_return_1(
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
165 gaim_conversations_get_handle(), (type == GAIM_CONV_IM ?
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
166 "displaying-im-msg" : "displaying-chat-msg"),
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
167 gaim_conversation_get_account(conv), conv, &displayed));
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
168
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
169 if (plugin_return) {
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
170 g_free(displayed);
8078
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
171 displayed = NULL;
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
172 } else {
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
173 gaim_signal_emit(gaim_conversations_get_handle(),
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
174 (type == GAIM_CONV_IM ? "displayed-im-msg" : "displayed-chat-msg"),
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
175 gaim_conversation_get_account(conv), conv, displayed);
796
4783a3b6859d [gaim-migrate @ 806]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 795
diff changeset
176 }
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
177
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
178 if (type == GAIM_CONV_IM) {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
179 GaimConvIm *im = GAIM_CONV_IM(conv);
2102
899c22dcee42 [gaim-migrate @ 2112]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2094
diff changeset
180
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
181 gaim_signal_emit(gaim_conversations_get_handle(), "sending-im-msg",
6509
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6496
diff changeset
182 gaim_conversation_get_account(conv),
8076
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
183 gaim_conversation_get_name(conv), &sent);
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
184
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
185 if (sent != NULL && sent[0] != '\0') {
6982
083d1e4a9c78 [gaim-migrate @ 7538]
Mark Doliner <mark@kingant.net>
parents: 6846
diff changeset
186 GaimMessageFlags msgflags = GAIM_MESSAGE_SEND;
083d1e4a9c78 [gaim-migrate @ 7538]
Mark Doliner <mark@kingant.net>
parents: 6846
diff changeset
187
8442
3d0178c4f390 [gaim-migrate @ 9172]
Luke Schierer <lschiere@pidgin.im>
parents: 8386
diff changeset
188 if (gc && gc->flags & GAIM_CONNECTION_HTML) {
3d0178c4f390 [gaim-migrate @ 9172]
Luke Schierer <lschiere@pidgin.im>
parents: 8386
diff changeset
189 err = serv_send_im(gc, gaim_conversation_get_name(conv),
9166
1e51236d825e [gaim-migrate @ 9951]
Tim Ringenbach <marv@pidgin.im>
parents: 9155
diff changeset
190 sent, 0);
8442
3d0178c4f390 [gaim-migrate @ 9172]
Luke Schierer <lschiere@pidgin.im>
parents: 8386
diff changeset
191 } else {
3d0178c4f390 [gaim-migrate @ 9172]
Luke Schierer <lschiere@pidgin.im>
parents: 8386
diff changeset
192 gchar *tmp = gaim_unescape_html(sent);
3d0178c4f390 [gaim-migrate @ 9172]
Luke Schierer <lschiere@pidgin.im>
parents: 8386
diff changeset
193 err = serv_send_im(gc, gaim_conversation_get_name(conv),
9166
1e51236d825e [gaim-migrate @ 9951]
Tim Ringenbach <marv@pidgin.im>
parents: 9155
diff changeset
194 tmp, 0);
8442
3d0178c4f390 [gaim-migrate @ 9172]
Luke Schierer <lschiere@pidgin.im>
parents: 8386
diff changeset
195 g_free(tmp);
3d0178c4f390 [gaim-migrate @ 9172]
Luke Schierer <lschiere@pidgin.im>
parents: 8386
diff changeset
196 }
6982
083d1e4a9c78 [gaim-migrate @ 7538]
Mark Doliner <mark@kingant.net>
parents: 6846
diff changeset
197
8078
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
198 if ((err > 0) && (displayed != NULL))
8076
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
199 gaim_conv_im_write(im, NULL, displayed, msgflags, time(NULL));
6982
083d1e4a9c78 [gaim-migrate @ 7538]
Mark Doliner <mark@kingant.net>
parents: 6846
diff changeset
200
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
201 gaim_signal_emit(gaim_conversations_get_handle(), "sent-im-msg",
6509
e74e378e86bf [gaim-migrate @ 7026]
Ethan Blanton <elb@pidgin.im>
parents: 6496
diff changeset
202 gaim_conversation_get_account(conv),
8076
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
203 gaim_conversation_get_name(conv), sent);
2102
899c22dcee42 [gaim-migrate @ 2112]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2094
diff changeset
204 }
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
205 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
206 else {
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
207 gaim_signal_emit(gaim_conversations_get_handle(), "sending-chat-msg",
8076
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
208 gaim_conversation_get_account(conv), &sent,
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
209 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)));
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
210
8076
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
211 if (sent != NULL && sent[0] != '\0') {
8442
3d0178c4f390 [gaim-migrate @ 9172]
Luke Schierer <lschiere@pidgin.im>
parents: 8386
diff changeset
212 if (gc && gc->flags & GAIM_CONNECTION_HTML) {
3d0178c4f390 [gaim-migrate @ 9172]
Luke Schierer <lschiere@pidgin.im>
parents: 8386
diff changeset
213 err = serv_chat_send(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), sent);
3d0178c4f390 [gaim-migrate @ 9172]
Luke Schierer <lschiere@pidgin.im>
parents: 8386
diff changeset
214 } else {
3d0178c4f390 [gaim-migrate @ 9172]
Luke Schierer <lschiere@pidgin.im>
parents: 8386
diff changeset
215 gchar *tmp = gaim_unescape_html(sent);
3d0178c4f390 [gaim-migrate @ 9172]
Luke Schierer <lschiere@pidgin.im>
parents: 8386
diff changeset
216 err = serv_chat_send(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), tmp);
3d0178c4f390 [gaim-migrate @ 9172]
Luke Schierer <lschiere@pidgin.im>
parents: 8386
diff changeset
217 g_free(tmp);
3d0178c4f390 [gaim-migrate @ 9172]
Luke Schierer <lschiere@pidgin.im>
parents: 8386
diff changeset
218 }
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
219
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
220 gaim_signal_emit(gaim_conversations_get_handle(), "sent-chat-msg",
8076
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
221 gaim_conversation_get_account(conv), sent,
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
222 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)));
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
223 }
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
224 }
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
225
2123
56c4382f2909 [gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2111
diff changeset
226 if (err < 0) {
5213
1cf4eb75e3ee [gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
227 if (err == -E2BIG) {
5436
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5350
diff changeset
228 gaim_notify_error(NULL, NULL,
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5350
diff changeset
229 _("Unable to send message. The message is "
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5350
diff changeset
230 "too large."), NULL);
5213
1cf4eb75e3ee [gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
231 }
1cf4eb75e3ee [gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
232 else if (err == -ENOTCONN) {
1cf4eb75e3ee [gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
233 gaim_debug(GAIM_DEBUG_ERROR, "conversation",
1cf4eb75e3ee [gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
234 "Not yet connected.\n");
1cf4eb75e3ee [gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
235 }
1cf4eb75e3ee [gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
236 else {
5436
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5350
diff changeset
237 gaim_notify_error(NULL, NULL, _("Unable to send message."), NULL);
5213
1cf4eb75e3ee [gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
238 }
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
239 }
8076
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
240
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
241 g_free(displayed);
504d98d14c25 [gaim-migrate @ 8775]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
242 g_free(sent);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
243 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
244
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
245 static void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
246 update_conv_indexes(GaimConvWindow *win)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
247 {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
248 GList *l;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
249 int i;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
250
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
251 for (l = gaim_conv_window_get_conversations(win), i = 0;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
252 l != NULL;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
253 l = l->next, i++) {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
254
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
255 GaimConversation *conv = (GaimConversation *)l->data;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
256
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
257 conv->conversation_pos = i;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
258 }
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
259 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
260
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
261 GaimConvWindow *
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
262 gaim_conv_window_new(void)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
263 {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
264 GaimConvWindow *win;
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
265
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
266 win = g_new0(GaimConvWindow, 1);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
267
5860
52d5fad43950 [gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents: 5858
diff changeset
268 windows = g_list_append(windows, win);
52d5fad43950 [gaim-migrate @ 6291]
Christian Hammond <chipx86@chipx86.com>
parents: 5858
diff changeset
269
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
270 win->ui_ops = gaim_conversations_get_win_ui_ops();
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
271
4465
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
272 if (win->ui_ops != NULL && win->ui_ops->new_window != NULL)
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
273 win->ui_ops->new_window(win);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
274
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
275 return win;
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
276 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
277
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
278 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
279 gaim_conv_window_destroy(GaimConvWindow *win)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
280 {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
281 GaimConvWindowUiOps *ops;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
282 GList *node;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
283
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
284 g_return_if_fail(win != NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
285
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
286 ops = gaim_conv_window_get_ui_ops(win);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
287
4638
b58c08b7cbe4 [gaim-migrate @ 4946]
Christian Hammond <chipx86@chipx86.com>
parents: 4622
diff changeset
288 /*
b58c08b7cbe4 [gaim-migrate @ 4946]
Christian Hammond <chipx86@chipx86.com>
parents: 4622
diff changeset
289 * If there are any conversations in this, destroy them all. The last
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
290 * conversation will call gaim_conv_window_destroy(), but this time, this
4638
b58c08b7cbe4 [gaim-migrate @ 4946]
Christian Hammond <chipx86@chipx86.com>
parents: 4622
diff changeset
291 * check will fail and the window will actually be destroyed.
b58c08b7cbe4 [gaim-migrate @ 4946]
Christian Hammond <chipx86@chipx86.com>
parents: 4622
diff changeset
292 *
b58c08b7cbe4 [gaim-migrate @ 4946]
Christian Hammond <chipx86@chipx86.com>
parents: 4622
diff changeset
293 * This is needed because chats may not close right away. They may
b58c08b7cbe4 [gaim-migrate @ 4946]
Christian Hammond <chipx86@chipx86.com>
parents: 4622
diff changeset
294 * wait for notification first. When they get that, the window is
b58c08b7cbe4 [gaim-migrate @ 4946]
Christian Hammond <chipx86@chipx86.com>
parents: 4622
diff changeset
295 * already destroyed, and gaim either crashes or spits out gtk warnings.
b58c08b7cbe4 [gaim-migrate @ 4946]
Christian Hammond <chipx86@chipx86.com>
parents: 4622
diff changeset
296 * The problem is fixed with this check.
b58c08b7cbe4 [gaim-migrate @ 4946]
Christian Hammond <chipx86@chipx86.com>
parents: 4622
diff changeset
297 */
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
298 if (gaim_conv_window_get_conversation_count(win) > 0) {
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
299
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
300 node = g_list_first(gaim_conv_window_get_conversations(win));
4647
ba87412b1a57 [gaim-migrate @ 4957]
Nathan Walp <nwalp@pidgin.im>
parents: 4638
diff changeset
301 while(node != NULL)
4638
b58c08b7cbe4 [gaim-migrate @ 4946]
Christian Hammond <chipx86@chipx86.com>
parents: 4622
diff changeset
302 {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
303 GaimConversation *conv = node->data;
4647
ba87412b1a57 [gaim-migrate @ 4957]
Nathan Walp <nwalp@pidgin.im>
parents: 4638
diff changeset
304
ba87412b1a57 [gaim-migrate @ 4957]
Nathan Walp <nwalp@pidgin.im>
parents: 4638
diff changeset
305 node = g_list_next(node);
4638
b58c08b7cbe4 [gaim-migrate @ 4946]
Christian Hammond <chipx86@chipx86.com>
parents: 4622
diff changeset
306
b58c08b7cbe4 [gaim-migrate @ 4946]
Christian Hammond <chipx86@chipx86.com>
parents: 4622
diff changeset
307 gaim_conversation_destroy(conv);
b58c08b7cbe4 [gaim-migrate @ 4946]
Christian Hammond <chipx86@chipx86.com>
parents: 4622
diff changeset
308 }
b58c08b7cbe4 [gaim-migrate @ 4946]
Christian Hammond <chipx86@chipx86.com>
parents: 4622
diff changeset
309 }
b58c08b7cbe4 [gaim-migrate @ 4946]
Christian Hammond <chipx86@chipx86.com>
parents: 4622
diff changeset
310 else
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
311 {
4638
b58c08b7cbe4 [gaim-migrate @ 4946]
Christian Hammond <chipx86@chipx86.com>
parents: 4622
diff changeset
312 if (ops != NULL && ops->destroy_window != NULL)
b58c08b7cbe4 [gaim-migrate @ 4946]
Christian Hammond <chipx86@chipx86.com>
parents: 4622
diff changeset
313 ops->destroy_window(win);
b58c08b7cbe4 [gaim-migrate @ 4946]
Christian Hammond <chipx86@chipx86.com>
parents: 4622
diff changeset
314
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
315 g_list_free(gaim_conv_window_get_conversations(win));
4638
b58c08b7cbe4 [gaim-migrate @ 4946]
Christian Hammond <chipx86@chipx86.com>
parents: 4622
diff changeset
316
b58c08b7cbe4 [gaim-migrate @ 4946]
Christian Hammond <chipx86@chipx86.com>
parents: 4622
diff changeset
317 windows = g_list_remove(windows, win);
b58c08b7cbe4 [gaim-migrate @ 4946]
Christian Hammond <chipx86@chipx86.com>
parents: 4622
diff changeset
318
b58c08b7cbe4 [gaim-migrate @ 4946]
Christian Hammond <chipx86@chipx86.com>
parents: 4622
diff changeset
319 g_free(win);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
320 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
321 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
322
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
323 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
324 gaim_conv_window_show(GaimConvWindow *win)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
325 {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
326 GaimConvWindowUiOps *ops;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
327
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
328 g_return_if_fail(win != NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
329
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
330 ops = gaim_conv_window_get_ui_ops(win);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
331
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
332 if (ops == NULL || ops->show == NULL)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
333 return;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
334
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
335 ops->show(win);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
336 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
337
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
338 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
339 gaim_conv_window_hide(GaimConvWindow *win)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
340 {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
341 GaimConvWindowUiOps *ops;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
342
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
343 g_return_if_fail(win != NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
344
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
345 ops = gaim_conv_window_get_ui_ops(win);
4359
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 if (ops == NULL || ops->hide == NULL)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
348 return;
3790
12b29552f1d7 [gaim-migrate @ 3930]
Rob Flynn <gaim@robflynn.com>
parents: 3789
diff changeset
349
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
350 ops->hide(win);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
351 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
352
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
353 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
354 gaim_conv_window_raise(GaimConvWindow *win)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
355 {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
356 GaimConvWindowUiOps *ops;
3790
12b29552f1d7 [gaim-migrate @ 3930]
Rob Flynn <gaim@robflynn.com>
parents: 3789
diff changeset
357
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
358 g_return_if_fail(win != NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
359
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
360 ops = gaim_conv_window_get_ui_ops(win);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
361
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
362 if (ops == NULL || ops->raise == NULL)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
363 return;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
364
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
365 ops->raise(win);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
366 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
367
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
368 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
369 gaim_conv_window_flash(GaimConvWindow *win)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
370 {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
371 GaimConvWindowUiOps *ops;
4359
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(win != NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
374
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
375 ops = gaim_conv_window_get_ui_ops(win);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
376
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
377 if (ops == NULL || ops->flash == NULL)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
378 return;
3790
12b29552f1d7 [gaim-migrate @ 3930]
Rob Flynn <gaim@robflynn.com>
parents: 3789
diff changeset
379
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
380 ops->flash(win);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
381 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
382
9260
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
383 gboolean
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
384 gaim_conv_window_has_focus(GaimConvWindow *win)
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
385 {
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
386 gboolean ret = FALSE;
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
387 GaimConvWindowUiOps *ops;
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
388
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
389 g_return_val_if_fail(win != NULL, FALSE);
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
390
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
391 ops = gaim_conv_window_get_ui_ops(win);
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
392
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
393 if (ops != NULL && ops->has_focus != NULL)
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
394 ret = ops->has_focus(win);
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
395
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
396 return ret;
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
397 }
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
398
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
399 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
400 gaim_conv_window_set_ui_ops(GaimConvWindow *win, GaimConvWindowUiOps *ops)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
401 {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
402 GaimConversationUiOps *conv_ops = NULL;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
403 GList *l;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
404
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
405 g_return_if_fail(win != NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
406
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
407 if (win->ui_ops == ops)
3790
12b29552f1d7 [gaim-migrate @ 3930]
Rob Flynn <gaim@robflynn.com>
parents: 3789
diff changeset
408 return;
12b29552f1d7 [gaim-migrate @ 3930]
Rob Flynn <gaim@robflynn.com>
parents: 3789
diff changeset
409
5139
d0182ae31ab8 [gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
410 if (ops != NULL && ops->get_conversation_ui_ops != NULL)
d0182ae31ab8 [gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
411 conv_ops = ops->get_conversation_ui_ops();
d0182ae31ab8 [gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
412
d0182ae31ab8 [gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
413 if (win->ui_ops != NULL && win->ui_ops->destroy_window != NULL)
d0182ae31ab8 [gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
414 win->ui_ops->destroy_window(win);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
415
4465
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
416 win->ui_ops = ops;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
417
5139
d0182ae31ab8 [gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
418 if (win->ui_ops != NULL && win->ui_ops->new_window != NULL)
d0182ae31ab8 [gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
419 win->ui_ops->new_window(win);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
420
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
421 for (l = gaim_conv_window_get_conversations(win);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
422 l != NULL;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
423 l = l->next) {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
424
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
425 GaimConversation *conv = (GaimConversation *)l;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
426
4465
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
427 gaim_conversation_set_ui_ops(conv, conv_ops);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
428
4465
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
429 if (win->ui_ops != NULL && win->ui_ops->add_conversation != NULL)
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
430 win->ui_ops->add_conversation(win, conv);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
431 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
432 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
433
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
434 GaimConvWindowUiOps *
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
435 gaim_conv_window_get_ui_ops(const GaimConvWindow *win)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
436 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
437 g_return_val_if_fail(win != NULL, NULL);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
438
4465
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
439 return win->ui_ops;
858
3de6e98e8898 [gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 856
diff changeset
440 }
3de6e98e8898 [gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 856
diff changeset
441
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
442 int
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
443 gaim_conv_window_add_conversation(GaimConvWindow *win, GaimConversation *conv)
858
3de6e98e8898 [gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 856
diff changeset
444 {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
445 GaimConvWindowUiOps *ops;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
446
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
447 g_return_val_if_fail(win != NULL, -1);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
448 g_return_val_if_fail(conv != NULL, -1);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
449
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
450 if (gaim_conversation_get_window(conv) != NULL) {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
451 gaim_conv_window_remove_conversation(
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
452 gaim_conversation_get_window(conv),
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
453 gaim_conversation_get_index(conv));
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
454 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
455
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
456 ops = gaim_conv_window_get_ui_ops(win);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
457
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
458 win->conversations = g_list_append(win->conversations, conv);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
459 win->conversation_count++;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
460
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
461 conv->conversation_pos = win->conversation_count - 1;
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 if (ops != NULL) {
4369
7e1fb422e5fd [gaim-migrate @ 4635]
Christian Hammond <chipx86@chipx86.com>
parents: 4363
diff changeset
464 conv->window = win;
7e1fb422e5fd [gaim-migrate @ 4635]
Christian Hammond <chipx86@chipx86.com>
parents: 4363
diff changeset
465
4465
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
466 if (ops->get_conversation_ui_ops != NULL)
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
467 gaim_conversation_set_ui_ops(conv, ops->get_conversation_ui_ops());
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
468
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
469 if (ops->add_conversation != NULL)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
470 ops->add_conversation(win, conv);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
471 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
472
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
473 return win->conversation_count - 1;
234
985635758c33 [gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 230
diff changeset
474 }
611
0f7e5ff95f71 [gaim-migrate @ 621]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 610
diff changeset
475
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
476 GaimConversation *
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
477 gaim_conv_window_remove_conversation(GaimConvWindow *win, unsigned int index)
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
478 {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
479 GaimConvWindowUiOps *ops;
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
480 GaimConversation *conv;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
481 GList *node;
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
482
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
483 g_return_val_if_fail(win != NULL, NULL);
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
484 g_return_val_if_fail(index < gaim_conv_window_get_conversation_count(win), NULL);
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
485
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
486 ops = gaim_conv_window_get_ui_ops(win);
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
487
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
488 node = g_list_nth(gaim_conv_window_get_conversations(win), index);
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
489 conv = (GaimConversation *)node->data;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
490
4360
c435a29370b8 [gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents: 4359
diff changeset
491 if (ops != NULL && ops->remove_conversation != NULL)
c435a29370b8 [gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents: 4359
diff changeset
492 ops->remove_conversation(win, conv);
c435a29370b8 [gaim-migrate @ 4626]
Christian Hammond <chipx86@chipx86.com>
parents: 4359
diff changeset
493
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
494 win->conversations = g_list_remove_link(win->conversations, node);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
495
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
496 g_list_free_1(node);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
497
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
498 win->conversation_count--;
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
499
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
500 conv->window = NULL;
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
501
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
502 if (gaim_conv_window_get_conversation_count(win) == 0)
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
503 gaim_conv_window_destroy(win);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
504 else {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
505 /* Change all the indexes. */
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
506 update_conv_indexes(win);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
507 }
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
508
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
509 return conv;
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
510 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
511
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
512 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
513 gaim_conv_window_move_conversation(GaimConvWindow *win, unsigned int index,
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
514 unsigned int new_index)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
515 {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
516 GaimConvWindowUiOps *ops;
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
517 GaimConversation *conv;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
518 GList *l;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
519
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
520 g_return_if_fail(win != NULL);
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
521 g_return_if_fail(index < gaim_conv_window_get_conversation_count(win));
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
522 g_return_if_fail(index != new_index);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
523
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
524 /* We can't move this past the last index. */
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
525 if (new_index > gaim_conv_window_get_conversation_count(win))
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
526 new_index = gaim_conv_window_get_conversation_count(win);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
527
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
528 /* Get the list item for this conversation at its current index. */
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
529 l = g_list_nth(gaim_conv_window_get_conversations(win), index);
3790
12b29552f1d7 [gaim-migrate @ 3930]
Rob Flynn <gaim@robflynn.com>
parents: 3789
diff changeset
530
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
531 if (l == NULL) {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
532 /* Should never happen. */
5213
1cf4eb75e3ee [gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
533 gaim_debug(GAIM_DEBUG_ERROR, "conversation",
1cf4eb75e3ee [gaim-migrate @ 5583]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
534 "Misordered conversations list in window %p\n", win);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
535
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
536 return;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
537 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
538
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
539 conv = (GaimConversation *)l->data;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
540
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
541 /* Update the UI part of this. */
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
542 ops = gaim_conv_window_get_ui_ops(win);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
543
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
544 if (ops != NULL && ops->move_conversation != NULL)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
545 ops->move_conversation(win, conv, new_index);
3790
12b29552f1d7 [gaim-migrate @ 3930]
Rob Flynn <gaim@robflynn.com>
parents: 3789
diff changeset
546
4415
c90039137172 [gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents: 4382
diff changeset
547 if (new_index > index)
c90039137172 [gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents: 4382
diff changeset
548 new_index--;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
549
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
550 /* Remove the old one. */
4415
c90039137172 [gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents: 4382
diff changeset
551 win->conversations = g_list_delete_link(win->conversations, l);
c90039137172 [gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents: 4382
diff changeset
552
c90039137172 [gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents: 4382
diff changeset
553 /* Insert it where it should go. */
c90039137172 [gaim-migrate @ 4688]
Christian Hammond <chipx86@chipx86.com>
parents: 4382
diff changeset
554 win->conversations = g_list_insert(win->conversations, conv, new_index);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
555
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
556 update_conv_indexes(win);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
557 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
558
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
559 GaimConversation *
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
560 gaim_conv_window_get_conversation_at(const GaimConvWindow *win, unsigned int index)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
561 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
562 g_return_val_if_fail(win != NULL, NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
563 g_return_val_if_fail(index >= 0 &&
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
564 index < gaim_conv_window_get_conversation_count(win),
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
565 NULL);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
566
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
567 return (GaimConversation *)g_list_nth_data(
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
568 gaim_conv_window_get_conversations(win), index);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
569 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
570
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
571 size_t
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
572 gaim_conv_window_get_conversation_count(const GaimConvWindow *win)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
573 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
574 g_return_val_if_fail(win != NULL, 0);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
575
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
576 return win->conversation_count;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
577 }
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 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
580 gaim_conv_window_switch_conversation(GaimConvWindow *win, unsigned int index)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
581 {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
582 GaimConvWindowUiOps *ops;
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
583 GaimConversation *old_conv, *conv;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
584
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
585 g_return_if_fail(win != NULL);
5680
71cc0d5376c2 [gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents: 5677
diff changeset
586 g_return_if_fail(index >= 0 &&
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
587 index < gaim_conv_window_get_conversation_count(win));
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
588
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
589 old_conv = gaim_conv_window_get_active_conversation(win);
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
590 conv = gaim_conv_window_get_conversation_at(win, index);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
591
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
592 gaim_signal_emit(gaim_conversations_get_handle(),
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
593 "conversation-switching", old_conv, conv);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
594
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
595 ops = gaim_conv_window_get_ui_ops(win);
3790
12b29552f1d7 [gaim-migrate @ 3930]
Rob Flynn <gaim@robflynn.com>
parents: 3789
diff changeset
596
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
597 if (ops != NULL && ops->switch_conversation != NULL)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
598 ops->switch_conversation(win, index);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
599
6417
9c65a439d327 [gaim-migrate @ 6924]
Christian Hammond <chipx86@chipx86.com>
parents: 6414
diff changeset
600 gaim_conversation_set_unseen(conv, GAIM_UNSEEN_NONE);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
601
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
602 gaim_signal_emit(gaim_conversations_get_handle(),
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
603 "conversation-switched", old_conv, conv);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
604 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
605
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
606 GaimConversation *
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
607 gaim_conv_window_get_active_conversation(const GaimConvWindow *win)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
608 {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
609 GaimConvWindowUiOps *ops;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
610
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
611 g_return_val_if_fail(win != NULL, NULL);
206
610b7ffc4821 [gaim-migrate @ 216]
Rob Flynn <gaim@robflynn.com>
parents: 189
diff changeset
612
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
613 if (gaim_conv_window_get_conversation_count(win) == 0)
5680
71cc0d5376c2 [gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents: 5677
diff changeset
614 return NULL;
71cc0d5376c2 [gaim-migrate @ 6098]
Christian Hammond <chipx86@chipx86.com>
parents: 5677
diff changeset
615
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
616 ops = gaim_conv_window_get_ui_ops(win);
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
617
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
618 if (ops != NULL && ops->get_active_index != NULL)
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
619 return gaim_conv_window_get_conversation_at(win, ops->get_active_index(win));
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
620
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
621 return NULL;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
622 }
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
623
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
624 GList *
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
625 gaim_conv_window_get_conversations(const GaimConvWindow *win)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
626 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
627 g_return_val_if_fail(win != NULL, NULL);
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
628
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
629 return win->conversations;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
630 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
631
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
632 GList *
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
633 gaim_get_windows(void)
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 windows;
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
636 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
637
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
638 GaimConvWindow *
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
639 gaim_get_first_window_with_type(GaimConversationType type)
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
640 {
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
641 GList *wins, *convs;
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
642 GaimConvWindow *win;
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
643 GaimConversation *conv;
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
644
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
645 if (type == GAIM_CONV_UNKNOWN)
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
646 return NULL;
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
647
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
648 for (wins = gaim_get_windows(); wins != NULL; wins = wins->next) {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
649 win = (GaimConvWindow *)wins->data;
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
650
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
651 for (convs = gaim_conv_window_get_conversations(win);
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
652 convs != NULL;
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
653 convs = convs->next) {
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
654
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
655 conv = (GaimConversation *)convs->data;
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
656
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
657 if (gaim_conversation_get_type(conv) == type)
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
658 return win;
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
659 }
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
660 }
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
661
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
662 return NULL;
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
663 }
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
664
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
665 GaimConvWindow *
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
666 gaim_get_last_window_with_type(GaimConversationType type)
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
667 {
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
668 GList *wins, *convs;
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
669 GaimConvWindow *win;
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
670 GaimConversation *conv;
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
671
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
672 if (type == GAIM_CONV_UNKNOWN)
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
673 return NULL;
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
674
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
675 for (wins = g_list_last(gaim_get_windows());
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
676 wins != NULL;
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
677 wins = wins->prev) {
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
678
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
679 win = (GaimConvWindow *)wins->data;
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
680
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
681 for (convs = gaim_conv_window_get_conversations(win);
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
682 convs != NULL;
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
683 convs = convs->next) {
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
684
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
685 conv = (GaimConversation *)convs->data;
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
686
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
687 if (gaim_conversation_get_type(conv) == type)
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
688 return win;
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
689 }
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
690 }
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
691
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
692 return NULL;
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
693 }
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
694
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
695 /**************************************************************************
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
696 * Conversation API
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
697 **************************************************************************/
8256
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
698 static void
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
699 gaim_conversation_chat_cleanup_for_rejoin(GaimConversation *conv)
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
700 {
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
701 const char *disp;
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
702 GaimAccount *account;
8373
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
703 GaimConnection *gc;
8256
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
704
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
705 account = gaim_conversation_get_account(conv);
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
706
8373
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
707 gaim_log_free(conv->log);
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
708 conv->log = gaim_log_new(GAIM_LOG_CHAT, gaim_conversation_get_name(conv),
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
709 account, time(NULL));
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
710
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
711 gc = gaim_account_get_connection(account);
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
712
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
713 if ((disp = gaim_connection_get_display_name(gc)) != NULL)
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
714 gaim_conv_chat_set_nick(GAIM_CONV_CHAT(conv), disp);
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
715 else
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
716 {
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
717 gaim_conv_chat_set_nick(GAIM_CONV_CHAT(conv),
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
718 gaim_account_get_username(account));
8256
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
719 }
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
720
8373
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
721 gaim_conv_chat_clear_users(GAIM_CONV_CHAT(conv));
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
722 gaim_conv_chat_set_topic(GAIM_CONV_CHAT(conv), NULL, NULL);
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
723 GAIM_CONV_CHAT(conv)->left = FALSE;
8256
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
724
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
725 gaim_conversation_update(conv, GAIM_CONV_UPDATE_CHATLEFT);
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
726 }
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
727
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
728 GaimConversation *
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
729 gaim_conversation_new(GaimConversationType type, GaimAccount *account,
4476
62c1e5e656d0 [gaim-migrate @ 4751]
Christian Hammond <chipx86@chipx86.com>
parents: 4471
diff changeset
730 const char *name)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
731 {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
732 GaimConversation *conv;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
733
7088
7fd2fd7c6980 [gaim-migrate @ 7653]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
734 g_return_val_if_fail(type != GAIM_CONV_UNKNOWN, NULL);
7fd2fd7c6980 [gaim-migrate @ 7653]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
735 g_return_val_if_fail(account != NULL, NULL);
7fd2fd7c6980 [gaim-migrate @ 7653]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
736 g_return_val_if_fail(name != NULL, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
737
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
738 /* Check if this conversation already exists. */
8256
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
739 if (((conv = gaim_find_conversation_with_account(name, account)) != NULL) &&
8271
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
740 (gaim_conversation_get_type(conv) == type))
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
741 {
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
742 if (gaim_conversation_get_type(conv) != GAIM_CONV_CHAT ||
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
743 gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv)))
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
744 {
8256
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
745 if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT)
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
746 gaim_conversation_chat_cleanup_for_rejoin(conv);
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
747
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
748 return conv;
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
749 }
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
750 }
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
751
6402
cc35d07a0dcc [gaim-migrate @ 6907]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
752 conv = g_new0(GaimConversation, 1);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
753
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
754 conv->type = type;
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4481
diff changeset
755 conv->account = account;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
756 conv->name = g_strdup(name);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
757 conv->title = g_strdup(name);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
758 conv->send_history = g_list_append(NULL, NULL);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
759 conv->history = g_string_new("");
5139
d0182ae31ab8 [gaim-migrate @ 5503]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
760 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
761 g_free, NULL);
8635
4aee5a47937d [gaim-migrate @ 9387]
Nathan Walp <nwalp@pidgin.im>
parents: 8442
diff changeset
762 conv->log = gaim_log_new(type == GAIM_CONV_CHAT ? GAIM_LOG_CHAT :
4aee5a47937d [gaim-migrate @ 9387]
Nathan Walp <nwalp@pidgin.im>
parents: 8442
diff changeset
763 GAIM_LOG_IM, conv->name, account,
4aee5a47937d [gaim-migrate @ 9387]
Nathan Walp <nwalp@pidgin.im>
parents: 8442
diff changeset
764 time(NULL));
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7261
diff changeset
765
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
766
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
767 if (type == GAIM_CONV_IM)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
768 {
9324
af707cc1e229 [gaim-migrate @ 10132]
Tim Ringenbach <marv@pidgin.im>
parents: 9261
diff changeset
769 GaimBuddyIcon *icon;
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
770 conv->u.im = g_new0(GaimConvIm, 1);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
771 conv->u.im->conv = conv;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
772
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
773 ims = g_list_append(ims, conv);
9324
af707cc1e229 [gaim-migrate @ 10132]
Tim Ringenbach <marv@pidgin.im>
parents: 9261
diff changeset
774 if ((icon = gaim_buddy_icons_find(account, name)))
af707cc1e229 [gaim-migrate @ 10132]
Tim Ringenbach <marv@pidgin.im>
parents: 9261
diff changeset
775 gaim_conv_im_set_icon(conv->u.im, icon);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
776
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
777 gaim_conversation_set_logging(conv,
7562
b859cfb5f31a [gaim-migrate @ 8176]
Christian Hammond <chipx86@chipx86.com>
parents: 7561
diff changeset
778 gaim_prefs_get_bool("/core/logging/log_ims"));
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
779 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
780 else if (type == GAIM_CONV_CHAT)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
781 {
8158
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
782 const char *disp;
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
783
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
784 conv->u.chat = g_new0(GaimConvChat, 1);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
785 conv->u.chat->conv = conv;
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 chats = g_list_append(chats, conv);
8271
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
788
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
789 if ((disp = gaim_connection_get_display_name(account->gc)))
8158
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
790 gaim_conv_chat_set_nick(conv->u.chat, disp);
8271
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
791 else
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
792 gaim_conv_chat_set_nick(conv->u.chat,
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
793 gaim_account_get_username(account));
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
794
5545
7a64114641c3 [gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents: 5539
diff changeset
795 gaim_conversation_set_logging(conv,
7562
b859cfb5f31a [gaim-migrate @ 8176]
Christian Hammond <chipx86@chipx86.com>
parents: 7561
diff changeset
796 gaim_prefs_get_bool("/core/logging/log_chats"));
4359
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
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
799 conversations = g_list_append(conversations, conv);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
800
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
801 /* Auto-set the title. */
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
802 gaim_conversation_autoset_title(conv);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
803
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
804 /*
9155
e0c50af60837 [gaim-migrate @ 9939]
Mark Doliner <mark@kingant.net>
parents: 9150
diff changeset
805 * Place the conversation somewhere. If there are no conversation
e0c50af60837 [gaim-migrate @ 9939]
Mark Doliner <mark@kingant.net>
parents: 9150
diff changeset
806 * windows open, or if tabbed conversations are not enabled, then
e0c50af60837 [gaim-migrate @ 9939]
Mark Doliner <mark@kingant.net>
parents: 9150
diff changeset
807 * place the conversation in a new window by itself. Otherwise use
e0c50af60837 [gaim-migrate @ 9939]
Mark Doliner <mark@kingant.net>
parents: 9150
diff changeset
808 * the chosen conversation placement function.
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
809 */
9155
e0c50af60837 [gaim-migrate @ 9939]
Mark Doliner <mark@kingant.net>
parents: 9150
diff changeset
810 if ((windows == NULL) || (!gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")))
8373
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
811 {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
812 GaimConvWindow *win;
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
813
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
814 win = gaim_conv_window_new();
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
815 gaim_conv_window_add_conversation(win, conv);
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
816
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
817 /* Ensure the window is visible. */
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
818 gaim_conv_window_show(win);
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
819 }
8373
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
820 else
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
821 {
7602
df5b0937ea47 [gaim-migrate @ 8225]
Christian Hammond <chipx86@chipx86.com>
parents: 7562
diff changeset
822 if (place_conv == NULL)
df5b0937ea47 [gaim-migrate @ 8225]
Christian Hammond <chipx86@chipx86.com>
parents: 7562
diff changeset
823 {
df5b0937ea47 [gaim-migrate @ 8225]
Christian Hammond <chipx86@chipx86.com>
parents: 7562
diff changeset
824 ensure_default_funcs();
df5b0937ea47 [gaim-migrate @ 8225]
Christian Hammond <chipx86@chipx86.com>
parents: 7562
diff changeset
825
df5b0937ea47 [gaim-migrate @ 8225]
Christian Hammond <chipx86@chipx86.com>
parents: 7562
diff changeset
826 place_conv = conv_placement_last_created_win;
df5b0937ea47 [gaim-migrate @ 8225]
Christian Hammond <chipx86@chipx86.com>
parents: 7562
diff changeset
827 }
df5b0937ea47 [gaim-migrate @ 8225]
Christian Hammond <chipx86@chipx86.com>
parents: 7562
diff changeset
828
df5b0937ea47 [gaim-migrate @ 8225]
Christian Hammond <chipx86@chipx86.com>
parents: 7562
diff changeset
829 if (place_conv == NULL)
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
830 gaim_debug(GAIM_DEBUG_ERROR, "conversation",
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
831 "This is about to suck.\n");
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
832
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
833 place_conv(conv);
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
834 }
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
835
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
836 gaim_signal_emit(gaim_conversations_get_handle(),
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
837 "conversation-created", conv);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
838
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
839 return conv;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
840 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
841
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
842 void
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
843 gaim_conversation_destroy(GaimConversation *conv)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
844 {
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5139
diff changeset
845 GaimPluginProtocolInfo *prpl_info = NULL;
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
846 GaimConvWindow *win;
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
847 GaimConversationUiOps *ops;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
848 GaimConnection *gc;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
849 const char *name;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
850 GList *node;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
851
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
852 g_return_if_fail(conv != NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
853
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
854 win = gaim_conversation_get_window(conv);
4465
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
855 ops = gaim_conversation_get_ui_ops(conv);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
856 gc = gaim_conversation_get_gc(conv);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
857 name = gaim_conversation_get_name(conv);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
858
8373
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
859 if (gc != NULL)
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
860 {
5262
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
861 /* Still connected */
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
862 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
863
8373
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
864 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM)
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
865 {
5545
7a64114641c3 [gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents: 5539
diff changeset
866 if (gaim_prefs_get_bool("/core/conversations/im/send_typing"))
6403
01963a303f43 [gaim-migrate @ 6908]
Christian Hammond <chipx86@chipx86.com>
parents: 6402
diff changeset
867 serv_send_typing(gc, name, GAIM_NOT_TYPING);
5262
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
868
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
869 if (gc && prpl_info->convo_closed != NULL)
6403
01963a303f43 [gaim-migrate @ 6908]
Christian Hammond <chipx86@chipx86.com>
parents: 6402
diff changeset
870 prpl_info->convo_closed(gc, name);
5262
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
871 }
8373
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
872 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT)
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
873 {
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
874 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
875 #if 0
5262
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
876 /*
6030
54c37db13279 [gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents: 6020
diff changeset
877 * This is unfortunately necessary, because calling
54c37db13279 [gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents: 6020
diff changeset
878 * serv_chat_leave() calls this gaim_conversation_destroy(),
54c37db13279 [gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents: 6020
diff changeset
879 * 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
880 * 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
881 * serv_got_chat_left(), which is eventually called from the
54c37db13279 [gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents: 6020
diff changeset
882 * prpl that serv_chat_leave() calls, removes this conversation
54c37db13279 [gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents: 6020
diff changeset
883 * 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
884 * 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
885 * calling this, because it'll be called again. If not, fall
54c37db13279 [gaim-migrate @ 6480]
Christian Hammond <chipx86@chipx86.com>
parents: 6020
diff changeset
886 * 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
887 * be on the 2nd pass.
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
888 *
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
889 * Long paragraph. <-- Short sentence.
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
890 *
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
891 * -- ChipX86
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
892 */
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
893
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
894 if (gc && g_slist_find(gc->buddy_chats, conv) != NULL) {
8373
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
895 serv_chat_leave(gc, chat_id);
5262
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
896
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
897 return;
799f9585988a [gaim-migrate @ 5634]
Luke Schierer <lschiere@pidgin.im>
parents: 5213
diff changeset
898 }
8271
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
899 #endif
8373
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
900 /*
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
901 * Instead of all of that, lets just close the window when
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
902 * 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
903 * 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
904 * knows it left the chat.
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
905 */
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
906 if (!gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv)))
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
907 serv_chat_leave(gc, chat_id);
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
908
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
909 /*
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
910 * 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
911 * 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
912 */
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
913 if (!gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv)))
7a58f6f9fc3e [gaim-migrate @ 9100]
Christian Hammond <chipx86@chipx86.com>
parents: 8348
diff changeset
914 serv_got_chat_left(gc, chat_id);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
915 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
916 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
917
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
918 gaim_signal_emit(gaim_conversations_get_handle(),
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
919 "deleting-conversation", conv);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
920
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
921 if (conv->name != NULL) g_free(conv->name);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
922 if (conv->title != NULL) g_free(conv->title);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
923
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
924 for (node = g_list_first(conv->send_history);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
925 node != NULL;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
926 node = g_list_next(node)) {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
927
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
928 if (node->data != NULL)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
929 g_free(node->data);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
930 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
931
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
932 g_list_free(g_list_first(conv->send_history));
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
933
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
934 if (conv->history != NULL)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
935 g_string_free(conv->history, TRUE);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
936
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
937 conversations = g_list_remove(conversations, conv);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
938
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
939 if (conv->type == GAIM_CONV_IM) {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
940 gaim_conv_im_stop_typing_timeout(conv->u.im);
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
941 gaim_conv_im_stop_type_again_timeout(conv->u.im);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
942
6846
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
943 if (conv->u.im->icon != NULL)
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
944 gaim_buddy_icon_unref(conv->u.im->icon);
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
945
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
946 g_free(conv->u.im);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
947
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
948 ims = g_list_remove(ims, conv);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
949 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
950 else if (conv->type == GAIM_CONV_CHAT) {
4572
06084165a966 [gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents: 4522
diff changeset
951
06084165a966 [gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents: 4522
diff changeset
952 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
953 if (node->data != NULL)
06084165a966 [gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents: 4522
diff changeset
954 g_free(node->data);
06084165a966 [gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents: 4522
diff changeset
955 }
06084165a966 [gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents: 4522
diff changeset
956
06084165a966 [gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents: 4522
diff changeset
957 for (node = conv->u.chat->ignored; node != NULL; node = node->next) {
06084165a966 [gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents: 4522
diff changeset
958 if (node->data != NULL)
06084165a966 [gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents: 4522
diff changeset
959 g_free(node->data);
06084165a966 [gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents: 4522
diff changeset
960 }
06084165a966 [gaim-migrate @ 4853]
Christian Hammond <chipx86@chipx86.com>
parents: 4522
diff changeset
961
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
962 g_list_free(conv->u.chat->in_room);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
963 g_list_free(conv->u.chat->ignored);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
964
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
965 if (conv->u.chat->who != NULL)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
966 g_free(conv->u.chat->who);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
967
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
968 if (conv->u.chat->topic != NULL)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
969 g_free(conv->u.chat->topic);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
970
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
971 g_free(conv->u.chat);
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 chats = g_list_remove(chats, conv);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
974 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
975
4877
249382064693 [gaim-migrate @ 5207]
Christian Hammond <chipx86@chipx86.com>
parents: 4876
diff changeset
976 g_hash_table_destroy(conv->data);
4876
9567b13d0e98 [gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents: 4818
diff changeset
977
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
978 if (win != NULL) {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
979 gaim_conv_window_remove_conversation(win,
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
980 gaim_conversation_get_index(conv));
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
981 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
982
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
983 if (ops != NULL && ops->destroy_conversation != NULL)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
984 ops->destroy_conversation(conv);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
985
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7261
diff changeset
986 gaim_log_free(conv->log);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
987 g_free(conv);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
988 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
989
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
990 GaimConversationType
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
991 gaim_conversation_get_type(const GaimConversation *conv)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
992 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
993 g_return_val_if_fail(conv != NULL, GAIM_CONV_UNKNOWN);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
994
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
995 return conv->type;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
996 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
997
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
998 void
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
999 gaim_conversation_set_ui_ops(GaimConversation *conv,
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1000 GaimConversationUiOps *ops)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1001 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1002 g_return_if_fail(conv != NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1003
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1004 if (conv->ui_ops == ops)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1005 return;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1006
4465
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
1007 if (conv->ui_ops != NULL && conv->ui_ops->destroy_conversation != NULL)
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
1008 conv->ui_ops->destroy_conversation(conv);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1009
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1010 conv->ui_data = NULL;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1011
4465
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
1012 conv->ui_ops = ops;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1013 }
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1014
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1015 GaimConversationUiOps *
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1016 gaim_conversation_get_ui_ops(const GaimConversation *conv)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1017 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1018 g_return_val_if_fail(conv != NULL, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1019
4465
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
1020 return conv->ui_ops;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1021 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1022
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1023 void
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1024 gaim_conversation_set_account(GaimConversation *conv, GaimAccount *account)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1025 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1026 g_return_if_fail(conv != NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1027
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1028 if (account == gaim_conversation_get_account(conv))
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1029 return;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1030
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4481
diff changeset
1031 conv->account = account;
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4481
diff changeset
1032
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4481
diff changeset
1033 gaim_conversation_update(conv, GAIM_CONV_UPDATE_ACCOUNT);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1034 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1035
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
1036 GaimAccount *
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1037 gaim_conversation_get_account(const GaimConversation *conv)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1038 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1039 g_return_val_if_fail(conv != NULL, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1040
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4481
diff changeset
1041 return conv->account;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1042 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1043
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
1044 GaimConnection *
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1045 gaim_conversation_get_gc(const GaimConversation *conv)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1046 {
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
1047 GaimAccount *account;
4425
be8f9ca74ddf [gaim-migrate @ 4700]
Christian Hammond <chipx86@chipx86.com>
parents: 4415
diff changeset
1048
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1049 g_return_val_if_fail(conv != NULL, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1050
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4481
diff changeset
1051 account = gaim_conversation_get_account(conv);
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4481
diff changeset
1052
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4481
diff changeset
1053 if (account == NULL)
4425
be8f9ca74ddf [gaim-migrate @ 4700]
Christian Hammond <chipx86@chipx86.com>
parents: 4415
diff changeset
1054 return NULL;
be8f9ca74ddf [gaim-migrate @ 4700]
Christian Hammond <chipx86@chipx86.com>
parents: 4415
diff changeset
1055
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4481
diff changeset
1056 return account->gc;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1057 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1058
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1059 void
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1060 gaim_conversation_set_title(GaimConversation *conv, const char *title)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1061 {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1062 GaimConversationUiOps *ops;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1063
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1064 g_return_if_fail(conv != NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1065 g_return_if_fail(title != NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1066
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1067 if (conv->title != NULL)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1068 g_free(conv->title);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1069
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1070 conv->title = g_strdup(title);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1071
4465
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
1072 ops = gaim_conversation_get_ui_ops(conv);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1073
8155
77d1252b3803 [gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents: 8078
diff changeset
1074 if (ops != NULL && ops->updated != NULL)
77d1252b3803 [gaim-migrate @ 8867]
Christian Hammond <chipx86@chipx86.com>
parents: 8078
diff changeset
1075 ops->updated(conv, GAIM_CONV_UPDATE_TITLE);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1076 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1077
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1078 const char *
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1079 gaim_conversation_get_title(const GaimConversation *conv)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1080 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1081 g_return_val_if_fail(conv != NULL, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1082
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1083 return conv->title;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1084 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1085
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1086 void
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1087 gaim_conversation_autoset_title(GaimConversation *conv)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1088 {
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
1089 GaimAccount *account;
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6640
diff changeset
1090 GaimBuddy *b;
8015
5f86d21b6232 [gaim-migrate @ 8695]
Nathan Walp <nwalp@pidgin.im>
parents: 7947
diff changeset
1091 GaimChat *chat;
5f86d21b6232 [gaim-migrate @ 8695]
Nathan Walp <nwalp@pidgin.im>
parents: 7947
diff changeset
1092 const char *text = NULL, *name;
3799
3163a8825063 [gaim-migrate @ 3941]
Luke Schierer <lschiere@pidgin.im>
parents: 3790
diff changeset
1093
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1094 g_return_if_fail(conv != NULL);
2267
837aa71710c5 [gaim-migrate @ 2277]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2264
diff changeset
1095
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4481
diff changeset
1096 account = gaim_conversation_get_account(conv);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1097 name = gaim_conversation_get_name(conv);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1098
8015
5f86d21b6232 [gaim-migrate @ 8695]
Nathan Walp <nwalp@pidgin.im>
parents: 7947
diff changeset
1099 if (gaim_prefs_get_bool("/core/conversations/use_alias_for_title")) {
5f86d21b6232 [gaim-migrate @ 8695]
Nathan Walp <nwalp@pidgin.im>
parents: 7947
diff changeset
1100 if(gaim_conversation_get_type(conv) == GAIM_CONV_IM) {
5f86d21b6232 [gaim-migrate @ 8695]
Nathan Walp <nwalp@pidgin.im>
parents: 7947
diff changeset
1101 if(account && ((b = gaim_find_buddy(account, name)) != NULL))
5f86d21b6232 [gaim-migrate @ 8695]
Nathan Walp <nwalp@pidgin.im>
parents: 7947
diff changeset
1102 text = gaim_get_buddy_alias(b);
5f86d21b6232 [gaim-migrate @ 8695]
Nathan Walp <nwalp@pidgin.im>
parents: 7947
diff changeset
1103 } else if(gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) {
5f86d21b6232 [gaim-migrate @ 8695]
Nathan Walp <nwalp@pidgin.im>
parents: 7947
diff changeset
1104 if(account && ((chat = gaim_blist_find_chat(account, name)) != NULL))
5f86d21b6232 [gaim-migrate @ 8695]
Nathan Walp <nwalp@pidgin.im>
parents: 7947
diff changeset
1105 text = chat->alias;
5f86d21b6232 [gaim-migrate @ 8695]
Nathan Walp <nwalp@pidgin.im>
parents: 7947
diff changeset
1106 }
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1107 }
8015
5f86d21b6232 [gaim-migrate @ 8695]
Nathan Walp <nwalp@pidgin.im>
parents: 7947
diff changeset
1108
5f86d21b6232 [gaim-migrate @ 8695]
Nathan Walp <nwalp@pidgin.im>
parents: 7947
diff changeset
1109 if(!text)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1110 text = name;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1111
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1112 gaim_conversation_set_title(conv, text);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1113 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1114
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1115 int
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1116 gaim_conversation_get_index(const GaimConversation *conv)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1117 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1118 g_return_val_if_fail(conv != NULL, 0);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1119
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1120 return conv->conversation_pos;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1121 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1122
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1123 void
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1124 gaim_conversation_set_unseen(GaimConversation *conv, GaimUnseenState state)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1125 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1126 g_return_if_fail(conv != NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1127
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1128 conv->unseen = state;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1129
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1130 gaim_conversation_update(conv, GAIM_CONV_UPDATE_UNSEEN);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1131 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1132
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1133 void
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1134 gaim_conversation_foreach(void (*func)(GaimConversation *conv))
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1135 {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1136 GaimConversation *conv;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1137 GList *l;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1138
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1139 g_return_if_fail(func != NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1140
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1141 for (l = gaim_get_conversations(); l != NULL; l = l->next) {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1142 conv = (GaimConversation *)l->data;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1143
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1144 func(conv);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1145 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1146 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1147
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1148 GaimUnseenState
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1149 gaim_conversation_get_unseen(const GaimConversation *conv)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1150 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1151 g_return_val_if_fail(conv != NULL, 0);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1152
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1153 return conv->unseen;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1154 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1155
7256
c93493c59ac3 [gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents: 7125
diff changeset
1156 void
c93493c59ac3 [gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents: 7125
diff changeset
1157 gaim_conversation_set_name(GaimConversation *conv, const char *name)
c93493c59ac3 [gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents: 7125
diff changeset
1158 {
c93493c59ac3 [gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents: 7125
diff changeset
1159 g_return_if_fail(conv != NULL);
c93493c59ac3 [gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents: 7125
diff changeset
1160
c93493c59ac3 [gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents: 7125
diff changeset
1161 if (conv->name != NULL)
c93493c59ac3 [gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents: 7125
diff changeset
1162 g_free(conv->name);
c93493c59ac3 [gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents: 7125
diff changeset
1163
c93493c59ac3 [gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents: 7125
diff changeset
1164 conv->name = (name == NULL ? NULL : g_strdup(name));
7257
31abca48a631 [gaim-migrate @ 7834]
Christian Hammond <chipx86@chipx86.com>
parents: 7256
diff changeset
1165
31abca48a631 [gaim-migrate @ 7834]
Christian Hammond <chipx86@chipx86.com>
parents: 7256
diff changeset
1166 gaim_conversation_autoset_title(conv);
7256
c93493c59ac3 [gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents: 7125
diff changeset
1167 }
c93493c59ac3 [gaim-migrate @ 7833]
Christian Hammond <chipx86@chipx86.com>
parents: 7125
diff changeset
1168
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1169 const char *
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1170 gaim_conversation_get_name(const GaimConversation *conv)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1171 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1172 g_return_val_if_fail(conv != NULL, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1173
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1174 return conv->name;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1175 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1176
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1177 void
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1178 gaim_conversation_set_logging(GaimConversation *conv, gboolean log)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1179 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1180 g_return_if_fail(conv != NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1181
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1182 conv->logging = log;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1183
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1184 gaim_conversation_update(conv, GAIM_CONV_UPDATE_LOGGING);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1185 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1186
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1187 gboolean
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1188 gaim_conversation_is_logging(const GaimConversation *conv)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1189 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1190 g_return_val_if_fail(conv != NULL, FALSE);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1191
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1192 return conv->logging;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1193 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1194
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1195 GList *
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1196 gaim_conversation_get_send_history(const GaimConversation *conv)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1197 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1198 g_return_val_if_fail(conv != NULL, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1199
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1200 return conv->send_history;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1201 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1202
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1203 void
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1204 gaim_conversation_set_history(GaimConversation *conv, GString *history)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1205 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1206 g_return_if_fail(conv != NULL);
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
1207
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1208 conv->history = history;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1209 }
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 GString *
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1212 gaim_conversation_get_history(const GaimConversation *conv)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1213 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1214 g_return_val_if_fail(conv != NULL, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1215
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1216 return conv->history;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1217 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1218
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1219 GaimConvWindow *
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1220 gaim_conversation_get_window(const GaimConversation *conv)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1221 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1222 g_return_val_if_fail(conv != NULL, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1223
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1224 return conv->window;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1225 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1226
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1227 GaimConvIm *
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1228 gaim_conversation_get_im_data(const GaimConversation *conv)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1229 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1230 g_return_val_if_fail(conv != NULL, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1231
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1232 if (gaim_conversation_get_type(conv) != GAIM_CONV_IM)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1233 return NULL;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1234
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1235 return conv->u.im;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1236 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1237
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1238 GaimConvChat *
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1239 gaim_conversation_get_chat_data(const GaimConversation *conv)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1240 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1241 g_return_val_if_fail(conv != NULL, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1242
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1243 if (gaim_conversation_get_type(conv) != GAIM_CONV_CHAT)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1244 return NULL;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1245
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1246 return conv->u.chat;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1247 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1248
4876
9567b13d0e98 [gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents: 4818
diff changeset
1249 void
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1250 gaim_conversation_set_data(GaimConversation *conv, const char *key,
4877
249382064693 [gaim-migrate @ 5207]
Christian Hammond <chipx86@chipx86.com>
parents: 4876
diff changeset
1251 gpointer data)
4876
9567b13d0e98 [gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents: 4818
diff changeset
1252 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1253 g_return_if_fail(conv != NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1254 g_return_if_fail(key != NULL);
4876
9567b13d0e98 [gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents: 4818
diff changeset
1255
4877
249382064693 [gaim-migrate @ 5207]
Christian Hammond <chipx86@chipx86.com>
parents: 4876
diff changeset
1256 g_hash_table_replace(conv->data, g_strdup(key), data);
4876
9567b13d0e98 [gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents: 4818
diff changeset
1257 }
9567b13d0e98 [gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents: 4818
diff changeset
1258
9567b13d0e98 [gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents: 4818
diff changeset
1259 gpointer
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1260 gaim_conversation_get_data(GaimConversation *conv, const char *key)
4876
9567b13d0e98 [gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents: 4818
diff changeset
1261 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1262 g_return_val_if_fail(conv != NULL, NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1263 g_return_val_if_fail(key != NULL, NULL);
4876
9567b13d0e98 [gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents: 4818
diff changeset
1264
4877
249382064693 [gaim-migrate @ 5207]
Christian Hammond <chipx86@chipx86.com>
parents: 4876
diff changeset
1265 return g_hash_table_lookup(conv->data, key);
4876
9567b13d0e98 [gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents: 4818
diff changeset
1266 }
9567b13d0e98 [gaim-migrate @ 5206]
Christian Hammond <chipx86@chipx86.com>
parents: 4818
diff changeset
1267
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1268 GList *
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1269 gaim_get_conversations(void)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1270 {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1271 return conversations;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1272 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1273
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1274 GList *
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1275 gaim_get_ims(void)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1276 {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1277 return ims;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1278 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1279
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1280 GList *
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1281 gaim_get_chats(void)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1282 {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1283 return chats;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1284 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1285
7261
1930e3d00ecd [gaim-migrate @ 7838]
Nathan Walp <nwalp@pidgin.im>
parents: 7257
diff changeset
1286
1930e3d00ecd [gaim-migrate @ 7838]
Nathan Walp <nwalp@pidgin.im>
parents: 7257
diff changeset
1287 /* This is deprecated, right? */
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1288 GaimConversation *
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1289 gaim_find_conversation(const char *name)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1290 {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1291 GaimConversation *c = NULL;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1292 char *cuser;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1293 GList *cnv;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1294
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1295 g_return_val_if_fail(name != NULL, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1296
7261
1930e3d00ecd [gaim-migrate @ 7838]
Nathan Walp <nwalp@pidgin.im>
parents: 7257
diff changeset
1297 cuser = g_strdup(gaim_normalize(NULL, name));
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1298
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1299 for (cnv = gaim_get_conversations(); cnv != NULL; cnv = cnv->next) {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1300 c = (GaimConversation *)cnv->data;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1301
7261
1930e3d00ecd [gaim-migrate @ 7838]
Nathan Walp <nwalp@pidgin.im>
parents: 7257
diff changeset
1302 if (!gaim_utf8_strcasecmp(cuser, gaim_normalize(NULL, gaim_conversation_get_name(c))))
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1303 break;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1304
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1305 c = NULL;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1306 }
2794
2d3f47783a22 [gaim-migrate @ 2807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2788
diff changeset
1307
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1308 g_free(cuser);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1309
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1310 return c;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1311 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1312
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1313 GaimConversation *
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1314 gaim_find_conversation_with_account(const char *name,
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1315 const GaimAccount *account)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1316 {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1317 GaimConversation *c = NULL;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1318 char *cuser;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1319 GList *cnv;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1320
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1321 g_return_val_if_fail(name != NULL, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1322
7261
1930e3d00ecd [gaim-migrate @ 7838]
Nathan Walp <nwalp@pidgin.im>
parents: 7257
diff changeset
1323 cuser = g_strdup(gaim_normalize(account, name));
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1324
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1325 for (cnv = gaim_get_conversations(); cnv != NULL; cnv = cnv->next) {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1326 c = (GaimConversation *)cnv->data;
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1327
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1328 if (!gaim_utf8_strcasecmp(cuser,
7261
1930e3d00ecd [gaim-migrate @ 7838]
Nathan Walp <nwalp@pidgin.im>
parents: 7257
diff changeset
1329 gaim_normalize(account, gaim_conversation_get_name(c))) &&
4491
3196d9044a45 [gaim-migrate @ 4766]
Nathan Walp <nwalp@pidgin.im>
parents: 4481
diff changeset
1330 account == gaim_conversation_get_account(c)) {
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1331
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1332 break;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1333 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1334
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1335 c = NULL;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1336 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1337
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1338 g_free(cuser);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1339
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1340 return c;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1341 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1342
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1343 void
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1344 gaim_conversation_write(GaimConversation *conv, const char *who,
6982
083d1e4a9c78 [gaim-migrate @ 7538]
Mark Doliner <mark@kingant.net>
parents: 6846
diff changeset
1345 const char *message, GaimMessageFlags flags,
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1346 time_t mtime)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1347 {
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5139
diff changeset
1348 GaimPluginProtocolInfo *prpl_info = NULL;
6496
e0c80bec996a [gaim-migrate @ 7011]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
1349 GaimConnection *gc = NULL;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
1350 GaimAccount *account;
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1351 GaimConversationUiOps *ops;
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1352 GaimConvWindow *win;
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6640
diff changeset
1353 GaimBuddy *b;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1354 GaimUnseenState unseen;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1355 /* int logging_font_options = 0; */
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1356
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1357 g_return_if_fail(conv != NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1358 g_return_if_fail(message != NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1359
4465
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
1360 ops = gaim_conversation_get_ui_ops(conv);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1361
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1362 if (ops == NULL || ops->write_conv == NULL)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1363 return;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1364
4608
5fcb44d771d2 [gaim-migrate @ 4896]
Nathan Walp <nwalp@pidgin.im>
parents: 4574
diff changeset
1365 account = gaim_conversation_get_account(conv);
6496
e0c80bec996a [gaim-migrate @ 7011]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
1366
e0c80bec996a [gaim-migrate @ 7011]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
1367 if (account != NULL)
e0c80bec996a [gaim-migrate @ 7011]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
1368 gc = gaim_account_get_connection(account);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1369
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1370 if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT &&
6496
e0c80bec996a [gaim-migrate @ 7011]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
1371 (gc == NULL || !g_slist_find(gc->buddy_chats, conv)))
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1372 return;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1373
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1374 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM &&
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1375 !g_list_find(gaim_get_conversations(), conv))
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1376 return;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1377
6496
e0c80bec996a [gaim-migrate @ 7011]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
1378 if (gc != NULL) {
e0c80bec996a [gaim-migrate @ 7011]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
1379 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
5350
a6146cbae03b [gaim-migrate @ 5726]
Christian Hammond <chipx86@chipx86.com>
parents: 5262
diff changeset
1380
a6146cbae03b [gaim-migrate @ 5726]
Christian Hammond <chipx86@chipx86.com>
parents: 5262
diff changeset
1381 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM ||
a6146cbae03b [gaim-migrate @ 5726]
Christian Hammond <chipx86@chipx86.com>
parents: 5262
diff changeset
1382 !(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) {
a6146cbae03b [gaim-migrate @ 5726]
Christian Hammond <chipx86@chipx86.com>
parents: 5262
diff changeset
1383
a6146cbae03b [gaim-migrate @ 5726]
Christian Hammond <chipx86@chipx86.com>
parents: 5262
diff changeset
1384 if (who == NULL) {
6621
42fdf16f1dad [gaim-migrate @ 7145]
Mark Doliner <mark@kingant.net>
parents: 6607
diff changeset
1385 if (flags & GAIM_MESSAGE_SEND) {
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
1386 b = gaim_find_buddy(account,
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7261
diff changeset
1387 gaim_account_get_username(account));
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
1388
8348
9f11f793c19e [gaim-migrate @ 9072]
Nathan Walp <nwalp@pidgin.im>
parents: 8288
diff changeset
1389 if (gaim_account_get_alias(account) != NULL)
9f11f793c19e [gaim-migrate @ 9072]
Nathan Walp <nwalp@pidgin.im>
parents: 8288
diff changeset
1390 who = account->alias;
9f11f793c19e [gaim-migrate @ 9072]
Nathan Walp <nwalp@pidgin.im>
parents: 8288
diff changeset
1391 else if (b != NULL && strcmp(b->name, gaim_get_buddy_alias(b)))
5350
a6146cbae03b [gaim-migrate @ 5726]
Christian Hammond <chipx86@chipx86.com>
parents: 5262
diff changeset
1392 who = gaim_get_buddy_alias(b);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
1393 else if (gaim_connection_get_display_name(gc) != NULL)
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
1394 who = gaim_connection_get_display_name(gc);
5350
a6146cbae03b [gaim-migrate @ 5726]
Christian Hammond <chipx86@chipx86.com>
parents: 5262
diff changeset
1395 else
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
1396 who = gaim_account_get_username(account);
5350
a6146cbae03b [gaim-migrate @ 5726]
Christian Hammond <chipx86@chipx86.com>
parents: 5262
diff changeset
1397 }
a6146cbae03b [gaim-migrate @ 5726]
Christian Hammond <chipx86@chipx86.com>
parents: 5262
diff changeset
1398 else {
a6146cbae03b [gaim-migrate @ 5726]
Christian Hammond <chipx86@chipx86.com>
parents: 5262
diff changeset
1399 b = gaim_find_buddy(account,
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7261
diff changeset
1400 gaim_conversation_get_name(conv));
5350
a6146cbae03b [gaim-migrate @ 5726]
Christian Hammond <chipx86@chipx86.com>
parents: 5262
diff changeset
1401
a6146cbae03b [gaim-migrate @ 5726]
Christian Hammond <chipx86@chipx86.com>
parents: 5262
diff changeset
1402 if (b != NULL)
a6146cbae03b [gaim-migrate @ 5726]
Christian Hammond <chipx86@chipx86.com>
parents: 5262
diff changeset
1403 who = gaim_get_buddy_alias(b);
a6146cbae03b [gaim-migrate @ 5726]
Christian Hammond <chipx86@chipx86.com>
parents: 5262
diff changeset
1404 else
a6146cbae03b [gaim-migrate @ 5726]
Christian Hammond <chipx86@chipx86.com>
parents: 5262
diff changeset
1405 who = gaim_conversation_get_name(conv);
a6146cbae03b [gaim-migrate @ 5726]
Christian Hammond <chipx86@chipx86.com>
parents: 5262
diff changeset
1406 }
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1407 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1408 else {
5350
a6146cbae03b [gaim-migrate @ 5726]
Christian Hammond <chipx86@chipx86.com>
parents: 5262
diff changeset
1409 b = gaim_find_buddy(account, who);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1410
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1411 if (b != NULL)
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4647
diff changeset
1412 who = gaim_get_buddy_alias(b);
1772
896432d66303 [gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1764
diff changeset
1413 }
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1414 }
474
7720d0f9da8e [gaim-migrate @ 484]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 473
diff changeset
1415 }
8256
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
1416
7780
7ab3d01d2c50 [gaim-migrate @ 8425]
Sean Egan <seanegan@gmail.com>
parents: 7624
diff changeset
1417 if (gaim_conversation_is_logging(conv))
7ab3d01d2c50 [gaim-migrate @ 8425]
Sean Egan <seanegan@gmail.com>
parents: 7624
diff changeset
1418 gaim_log_write(conv->log, flags, who, mtime, message);
6982
083d1e4a9c78 [gaim-migrate @ 7538]
Mark Doliner <mark@kingant.net>
parents: 6846
diff changeset
1419 ops->write_conv(conv, who, message, flags, mtime);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
1420
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1421 win = gaim_conversation_get_window(conv);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1422
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1423 /* Tab highlighting */
8722
230fee6f1e3e [gaim-migrate @ 9477]
Sean Egan <seanegan@gmail.com>
parents: 8635
diff changeset
1424 if (!(flags & GAIM_MESSAGE_RECV) && !(flags & GAIM_MESSAGE_SYSTEM) && !(flags & GAIM_MESSAGE_ERROR))
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1425 return;
1479
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
1426
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1427 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) {
6621
42fdf16f1dad [gaim-migrate @ 7145]
Mark Doliner <mark@kingant.net>
parents: 6607
diff changeset
1428 if ((flags & GAIM_MESSAGE_RECV) == GAIM_MESSAGE_RECV)
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1429 gaim_conv_im_set_typing_state(GAIM_CONV_IM(conv), GAIM_NOT_TYPING);
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1430 }
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1431
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1432 if (gaim_conv_window_get_active_conversation(win) != conv) {
6621
42fdf16f1dad [gaim-migrate @ 7145]
Mark Doliner <mark@kingant.net>
parents: 6607
diff changeset
1433 if ((flags & GAIM_MESSAGE_NICK) == GAIM_MESSAGE_NICK ||
4616
767093a2ddaf [gaim-migrate @ 4907]
Nathan Walp <nwalp@pidgin.im>
parents: 4608
diff changeset
1434 gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_NICK)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1435 unseen = GAIM_UNSEEN_NICK;
8722
230fee6f1e3e [gaim-migrate @ 9477]
Sean Egan <seanegan@gmail.com>
parents: 8635
diff changeset
1436 else if ((((flags & GAIM_MESSAGE_SYSTEM) == GAIM_MESSAGE_SYSTEM) ||
230fee6f1e3e [gaim-migrate @ 9477]
Sean Egan <seanegan@gmail.com>
parents: 8635
diff changeset
1437 ((flags & GAIM_MESSAGE_ERROR) == GAIM_MESSAGE_ERROR)) &&
6405
96de6d9eb422 [gaim-migrate @ 6910]
Christian Hammond <chipx86@chipx86.com>
parents: 6403
diff changeset
1438 gaim_conversation_get_unseen(conv) != GAIM_UNSEEN_TEXT)
96de6d9eb422 [gaim-migrate @ 6910]
Christian Hammond <chipx86@chipx86.com>
parents: 6403
diff changeset
1439 unseen = GAIM_UNSEEN_EVENT;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1440 else
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1441 unseen = GAIM_UNSEEN_TEXT;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1442 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1443 else
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1444 unseen = GAIM_UNSEEN_NONE;
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1445
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1446 gaim_conversation_set_unseen(conv, unseen);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1447 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1448
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1449 void
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1450 gaim_conversation_update_progress(GaimConversation *conv, float percent)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1451 {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1452 GaimConversationUiOps *ops;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1453
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1454 g_return_if_fail(conv != NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1455 g_return_if_fail(percent >= 0 && percent <= 1);
3768
f53370197bb9 [gaim-migrate @ 3907]
Sean Egan <seanegan@gmail.com>
parents: 3763
diff changeset
1456
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1457 /*
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1458 * NOTE: A percent == 1 indicates that the progress bar should be
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1459 * closed.
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1460 */
4465
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
1461 ops = gaim_conversation_get_ui_ops(conv);
3768
f53370197bb9 [gaim-migrate @ 3907]
Sean Egan <seanegan@gmail.com>
parents: 3763
diff changeset
1462
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1463 if (ops != NULL && ops->update_progress != NULL)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1464 ops->update_progress(conv, percent);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1465 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1466
9260
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
1467 gboolean
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
1468 gaim_conversation_has_focus(GaimConversation *conv)
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
1469 {
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
1470 gboolean ret = FALSE;
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
1471 GaimConvWindow *win;
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
1472 GaimConversationUiOps *ops;
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
1473
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
1474 g_return_val_if_fail(conv != NULL, FALSE);
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
1475
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
1476 win = gaim_conversation_get_window(conv);
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
1477 if (gaim_conv_window_get_active_conversation(win) != conv)
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
1478 return FALSE;
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
1479
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
1480 ops = gaim_conversation_get_ui_ops(conv);
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
1481
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
1482 if (ops != NULL && ops->has_focus != NULL)
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
1483 ret = ops->has_focus(conv);
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
1484
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
1485 return ret;
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
1486 }
947876140943 [gaim-migrate @ 10059]
Christian Hammond <chipx86@chipx86.com>
parents: 9251
diff changeset
1487
7930
68f70cf074d0 [gaim-migrate @ 8601]
Mark Doliner <mark@kingant.net>
parents: 7879
diff changeset
1488 /*
8256
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
1489 * 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
1490 * 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
1491 * 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
1492 * when chats are added/removed from the blist.
68f70cf074d0 [gaim-migrate @ 8601]
Mark Doliner <mark@kingant.net>
parents: 7879
diff changeset
1493 */
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1494 void
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1495 gaim_conversation_update(GaimConversation *conv, GaimConvUpdateType type)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1496 {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1497 GaimConversationUiOps *ops;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1498
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1499 g_return_if_fail(conv != NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1500
4465
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
1501 ops = gaim_conversation_get_ui_ops(conv);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1502
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1503 if (ops != NULL && ops->updated != NULL)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1504 ops->updated(conv, type);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1505 }
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
1506
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1507 /**************************************************************************
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1508 * IM Conversation API
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1509 **************************************************************************/
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1510 GaimConversation *
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1511 gaim_conv_im_get_conversation(const GaimConvIm *im)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1512 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1513 g_return_val_if_fail(im != NULL, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1514
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1515 return im->conv;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1516 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1517
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1518 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1519 gaim_conv_im_set_icon(GaimConvIm *im, GaimBuddyIcon *icon)
6846
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
1520 {
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
1521 g_return_if_fail(im != NULL);
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
1522
9261
77fdeb4c459f [gaim-migrate @ 10060]
Christian Hammond <chipx86@chipx86.com>
parents: 9260
diff changeset
1523 if (im->icon != icon)
77fdeb4c459f [gaim-migrate @ 10060]
Christian Hammond <chipx86@chipx86.com>
parents: 9260
diff changeset
1524 {
77fdeb4c459f [gaim-migrate @ 10060]
Christian Hammond <chipx86@chipx86.com>
parents: 9260
diff changeset
1525 if (im->icon != NULL)
77fdeb4c459f [gaim-migrate @ 10060]
Christian Hammond <chipx86@chipx86.com>
parents: 9260
diff changeset
1526 gaim_buddy_icon_unref(im->icon);
77fdeb4c459f [gaim-migrate @ 10060]
Christian Hammond <chipx86@chipx86.com>
parents: 9260
diff changeset
1527
77fdeb4c459f [gaim-migrate @ 10060]
Christian Hammond <chipx86@chipx86.com>
parents: 9260
diff changeset
1528 im->icon = (icon == NULL ? NULL : gaim_buddy_icon_ref(icon));
77fdeb4c459f [gaim-migrate @ 10060]
Christian Hammond <chipx86@chipx86.com>
parents: 9260
diff changeset
1529 }
6846
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
1530
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1531 gaim_conversation_update(gaim_conv_im_get_conversation(im),
6846
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
1532 GAIM_CONV_UPDATE_ICON);
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
1533 }
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
1534
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
1535 GaimBuddyIcon *
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1536 gaim_conv_im_get_icon(const GaimConvIm *im)
6846
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
1537 {
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
1538 g_return_val_if_fail(im != NULL, NULL);
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
1539
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
1540 return im->icon;
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
1541 }
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
1542
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
1543 void
8288
dde73afb3283 [gaim-migrate @ 9012]
Christian Hammond <chipx86@chipx86.com>
parents: 8287
diff changeset
1544 gaim_conv_im_set_typing_state(GaimConvIm *im, GaimTypingState state)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1545 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1546 g_return_if_fail(im != NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1547
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1548 im->typing_state = state;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
1549 }
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1550
8288
dde73afb3283 [gaim-migrate @ 9012]
Christian Hammond <chipx86@chipx86.com>
parents: 8287
diff changeset
1551 GaimTypingState
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1552 gaim_conv_im_get_typing_state(const GaimConvIm *im)
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1553 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1554 g_return_val_if_fail(im != NULL, 0);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1555
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1556 return im->typing_state;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1557 }
3704
04a911e7dfc9 [gaim-migrate @ 3835]
Rob Flynn <gaim@robflynn.com>
parents: 3699
diff changeset
1558
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1559 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1560 gaim_conv_im_start_typing_timeout(GaimConvIm *im, int timeout)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1561 {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1562 GaimConversation *conv;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1563 const char *name;
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1564
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1565 g_return_if_fail(im != NULL);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1566
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1567 if (im->typing_timeout > 0)
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1568 gaim_conv_im_stop_typing_timeout(im);
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1569
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1570 conv = gaim_conv_im_get_conversation(im);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1571 name = gaim_conversation_get_name(conv);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1572
8273
f24172f53650 [gaim-migrate @ 8997]
Christian Hammond <chipx86@chipx86.com>
parents: 8271
diff changeset
1573 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
1574 }
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1575
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1576 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1577 gaim_conv_im_stop_typing_timeout(GaimConvIm *im)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1578 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1579 g_return_if_fail(im != NULL);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1580
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1581 if (im->typing_timeout == 0)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1582 return;
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1583
8287
ef881489396e [gaim-migrate @ 9011]
Christian Hammond <chipx86@chipx86.com>
parents: 8273
diff changeset
1584 gaim_timeout_remove(im->typing_timeout);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1585 im->typing_timeout = 0;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1586 }
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1587
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1588 guint
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1589 gaim_conv_im_get_typing_timeout(const GaimConvIm *im)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1590 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1591 g_return_val_if_fail(im != NULL, 0);
3699
b401bd1701b4 [gaim-migrate @ 3830]
Rob Flynn <gaim@robflynn.com>
parents: 3696
diff changeset
1592
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1593 return im->typing_timeout;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1594 }
3699
b401bd1701b4 [gaim-migrate @ 3830]
Rob Flynn <gaim@robflynn.com>
parents: 3696
diff changeset
1595
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1596 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1597 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
1598 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1599 g_return_if_fail(im != NULL);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1600
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1601 im->type_again = val;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1602 }
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1603
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1604 time_t
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1605 gaim_conv_im_get_type_again(const GaimConvIm *im)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1606 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1607 g_return_val_if_fail(im != NULL, 0);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1608
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1609 return im->type_again;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1610 }
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1611
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1612 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1613 gaim_conv_im_start_type_again_timeout(GaimConvIm *im)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1614 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1615 g_return_if_fail(im != NULL);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1616
8273
f24172f53650 [gaim-migrate @ 8997]
Christian Hammond <chipx86@chipx86.com>
parents: 8271
diff changeset
1617 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
1618 gaim_conv_im_get_conversation(im));
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1619 }
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1620
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1621 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1622 gaim_conv_im_stop_type_again_timeout(GaimConvIm *im)
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1623 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1624 g_return_if_fail(im != NULL);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1625
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1626 if (im->type_again_timeout == 0)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1627 return;
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1628
8287
ef881489396e [gaim-migrate @ 9011]
Christian Hammond <chipx86@chipx86.com>
parents: 8273
diff changeset
1629 gaim_timeout_remove(im->type_again_timeout);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1630 im->type_again_timeout = 0;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1631 }
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1632
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1633 guint
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1634 gaim_conv_im_get_type_again_timeout(const GaimConvIm *im)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1635 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1636 g_return_val_if_fail(im != NULL, 0);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1637
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1638 return im->type_again_timeout;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1639 }
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1640
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1641 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1642 gaim_conv_im_update_typing(GaimConvIm *im)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1643 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1644 g_return_if_fail(im != NULL);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1645
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1646 gaim_conversation_update(gaim_conv_im_get_conversation(im),
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1647 GAIM_CONV_UPDATE_TYPING);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1648 }
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1649
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1650 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1651 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
1652 GaimMessageFlags flags, time_t mtime)
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
1653 {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1654 GaimConversation *c;
1898
73d73939f698 [gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1889
diff changeset
1655
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1656 g_return_if_fail(im != NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1657 g_return_if_fail(message != NULL);
1898
73d73939f698 [gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1889
diff changeset
1658
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1659 c = gaim_conv_im_get_conversation(im);
2787
feea7103a235 [gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2773
diff changeset
1660
4382
76223649765b [gaim-migrate @ 4648]
Christian Hammond <chipx86@chipx86.com>
parents: 4378
diff changeset
1661 /* Raise the window, if specified in prefs. */
4465
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
1662 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
1663 c->ui_ops->write_im(c, who, message, flags, mtime);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1664 else
6982
083d1e4a9c78 [gaim-migrate @ 7538]
Mark Doliner <mark@kingant.net>
parents: 6846
diff changeset
1665 gaim_conversation_write(c, who, message, flags, mtime);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
1666 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
1667
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1668 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1669 gaim_conv_im_send(GaimConvIm *im, const char *message)
2379
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
1670 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1671 g_return_if_fail(im != NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1672 g_return_if_fail(message != NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1673
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1674 common_send(gaim_conv_im_get_conversation(im), message);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1675 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1676
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1677 /**************************************************************************
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1678 * Chat Conversation API
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1679 **************************************************************************/
2379
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
1680
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1681 GaimConversation *
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1682 gaim_conv_chat_get_conversation(const GaimConvChat *chat)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1683 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1684 g_return_val_if_fail(chat != NULL, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1685
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1686 return chat->conv;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1687 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1688
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1689 GList *
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1690 gaim_conv_chat_set_users(GaimConvChat *chat, GList *users)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1691 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1692 g_return_val_if_fail(chat != NULL, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1693
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1694 chat->in_room = users;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1695
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1696 return users;
2379
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
1697 }
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
1698
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1699 GList *
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1700 gaim_conv_chat_get_users(const GaimConvChat *chat)
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1701 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1702 g_return_val_if_fail(chat != NULL, NULL);
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1703
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1704 return chat->in_room;
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1705 }
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
1706
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1707 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1708 gaim_conv_chat_ignore(GaimConvChat *chat, const char *name)
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
1709 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1710 g_return_if_fail(chat != NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1711 g_return_if_fail(name != NULL);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
1712
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1713 /* Make sure the user isn't already ignored. */
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1714 if (gaim_conv_chat_is_user_ignored(chat, name))
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1715 return;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1716
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1717 gaim_conv_chat_set_ignored(chat,
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1718 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
1719 }
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
1720
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1721 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1722 gaim_conv_chat_unignore(GaimConvChat *chat, const char *name)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1723 {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1724 GList *item;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1725
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1726 g_return_if_fail(chat != NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1727 g_return_if_fail(name != NULL);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
1728
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1729 /* Make sure the user is actually ignored. */
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1730 if (!gaim_conv_chat_is_user_ignored(chat, name))
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1731 return;
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
1732
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1733 item = g_list_find(gaim_conv_chat_get_ignored(chat),
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1734 gaim_conv_chat_get_ignored_user(chat, name));
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1735
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1736 gaim_conv_chat_set_ignored(chat,
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1737 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
1738
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1739 g_free(item->data);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1740 g_list_free_1(item);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
1741 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
1742
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1743 GList *
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1744 gaim_conv_chat_set_ignored(GaimConvChat *chat, GList *ignored)
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
1745 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1746 g_return_val_if_fail(chat != NULL, NULL);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
1747
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1748 chat->ignored = ignored;
993
eacd93d0089a [gaim-migrate @ 1003]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1749
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1750 return ignored;
2111
109669b3887e [gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2109
diff changeset
1751 }
109669b3887e [gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2109
diff changeset
1752
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1753 GList *
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1754 gaim_conv_chat_get_ignored(const GaimConvChat *chat)
2111
109669b3887e [gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2109
diff changeset
1755 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1756 g_return_val_if_fail(chat != NULL, NULL);
1898
73d73939f698 [gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1889
diff changeset
1757
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1758 return chat->ignored;
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
1759 }
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
1760
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1761 const char *
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1762 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
1763 {
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1764 GList *ignored;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1765
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1766 g_return_val_if_fail(chat != NULL, NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1767 g_return_val_if_fail(user != NULL, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1768
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1769 for (ignored = gaim_conv_chat_get_ignored(chat);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1770 ignored != NULL;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1771 ignored = ignored->next) {
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
1772
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1773 const char *ign = (const char *)ignored->data;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1774
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4687
diff changeset
1775 if (!gaim_utf8_strcasecmp(user, ign) ||
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4687
diff changeset
1776 ((*ign == '+' || *ign == '%') && !gaim_utf8_strcasecmp(user, ign + 1)))
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1777 return ign;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1778
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1779 if (*ign == '@') {
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1780 ign++;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1781
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4687
diff changeset
1782 if ((*ign == '+' && !gaim_utf8_strcasecmp(user, ign + 1)) ||
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4687
diff changeset
1783 (*ign != '+' && !gaim_utf8_strcasecmp(user, ign)))
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1784 return ign;
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1785 }
2094
be10a1243ed7 [gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2090
diff changeset
1786 }
1341
6ec45c45157c [gaim-migrate @ 1351]
Rob Flynn <gaim@robflynn.com>
parents: 1340
diff changeset
1787
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1788 return NULL;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1789 }
1341
6ec45c45157c [gaim-migrate @ 1351]
Rob Flynn <gaim@robflynn.com>
parents: 1340
diff changeset
1790
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1791 gboolean
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1792 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
1793 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1794 g_return_val_if_fail(chat != NULL, FALSE);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1795 g_return_val_if_fail(user != NULL, FALSE);
1341
6ec45c45157c [gaim-migrate @ 1351]
Rob Flynn <gaim@robflynn.com>
parents: 1340
diff changeset
1796
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1797 return (gaim_conv_chat_get_ignored_user(chat, user) != NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1798 }
1343
a0d89bdc733e [gaim-migrate @ 1353]
Rob Flynn <gaim@robflynn.com>
parents: 1342
diff changeset
1799
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1800 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1801 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
1802 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1803 g_return_if_fail(chat != NULL);
1343
a0d89bdc733e [gaim-migrate @ 1353]
Rob Flynn <gaim@robflynn.com>
parents: 1342
diff changeset
1804
7606
08c9d0dcf906 [gaim-migrate @ 8229]
Luke Schierer <lschiere@pidgin.im>
parents: 7602
diff changeset
1805 if (chat->who != NULL) g_free(chat->who);
08c9d0dcf906 [gaim-migrate @ 8229]
Luke Schierer <lschiere@pidgin.im>
parents: 7602
diff changeset
1806 if (chat->topic != NULL) g_free(chat->topic);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1807
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1808 chat->who = (who == NULL ? NULL : g_strdup(who));
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1809 chat->topic = (topic == NULL ? NULL : g_strdup(topic));
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1810
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1811 gaim_conversation_update(gaim_conv_chat_get_conversation(chat),
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1812 GAIM_CONV_UPDATE_TOPIC);
9517
0524b36c701a [gaim-migrate @ 10344]
Luke Schierer <lschiere@pidgin.im>
parents: 9514
diff changeset
1813
0524b36c701a [gaim-migrate @ 10344]
Luke Schierer <lschiere@pidgin.im>
parents: 9514
diff changeset
1814 gaim_signal_emit(gaim_conversations_get_handle(), "chat-topic-changed",
0524b36c701a [gaim-migrate @ 10344]
Luke Schierer <lschiere@pidgin.im>
parents: 9514
diff changeset
1815 chat->conv, chat->who, chat->topic);
1340
1526caa87138 [gaim-migrate @ 1350]
Rob Flynn <gaim@robflynn.com>
parents: 1253
diff changeset
1816 }
1526caa87138 [gaim-migrate @ 1350]
Rob Flynn <gaim@robflynn.com>
parents: 1253
diff changeset
1817
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1818 const char *
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1819 gaim_conv_chat_get_topic(const GaimConvChat *chat)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1820 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1821 g_return_val_if_fail(chat != NULL, NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1822
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1823 return chat->topic;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1824 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1825
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1826 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1827 gaim_conv_chat_set_id(GaimConvChat *chat, int id)
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
1828 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1829 g_return_if_fail(chat != NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1830
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1831 chat->id = id;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1832 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1833
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1834 int
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1835 gaim_conv_chat_get_id(const GaimConvChat *chat)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1836 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1837 g_return_val_if_fail(chat != NULL, -1);
3951
32942c49dced [gaim-migrate @ 4132]
Luke Schierer <lschiere@pidgin.im>
parents: 3925
diff changeset
1838
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1839 return chat->id;
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1840 }
3951
32942c49dced [gaim-migrate @ 4132]
Luke Schierer <lschiere@pidgin.im>
parents: 3925
diff changeset
1841
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1842 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1843 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
1844 GaimMessageFlags flags, time_t mtime)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1845 {
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
1846 GaimAccount *account;
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1847 GaimConversation *conv;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
1848 GaimConnection *gc;
3866
994b5c4d15dd [gaim-migrate @ 4018]
Rob Flynn <gaim@robflynn.com>
parents: 3846
diff changeset
1849
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1850 g_return_if_fail(chat != NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1851 g_return_if_fail(who != NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1852 g_return_if_fail(message != NULL);
3866
994b5c4d15dd [gaim-migrate @ 4018]
Rob Flynn <gaim@robflynn.com>
parents: 3846
diff changeset
1853
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1854 conv = gaim_conv_chat_get_conversation(chat);
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
1855 gc = gaim_conversation_get_gc(conv);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
1856 account = gaim_connection_get_account(gc);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1857
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1858 /* 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
1859 if (gaim_conv_chat_is_user_ignored(chat, who))
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
1860 return;
3677
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
1861
6621
42fdf16f1dad [gaim-migrate @ 7145]
Mark Doliner <mark@kingant.net>
parents: 6607
diff changeset
1862 if (!(flags & GAIM_MESSAGE_WHISPER)) {
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1863 char *str;
8158
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
1864 const char *nick;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1865
7261
1930e3d00ecd [gaim-migrate @ 7838]
Nathan Walp <nwalp@pidgin.im>
parents: 7257
diff changeset
1866 str = g_strdup(gaim_normalize(account, who));
8158
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
1867 nick = gaim_conv_chat_get_nick(chat);
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
1868
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
1869 if (!g_utf8_collate(str, gaim_normalize(account, nick))) {
6621
42fdf16f1dad [gaim-migrate @ 7145]
Mark Doliner <mark@kingant.net>
parents: 6607
diff changeset
1870 flags |= GAIM_MESSAGE_SEND;
8158
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
1871 } else {
6621
42fdf16f1dad [gaim-migrate @ 7145]
Mark Doliner <mark@kingant.net>
parents: 6607
diff changeset
1872 flags |= GAIM_MESSAGE_RECV;
3677
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
1873
8158
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
1874 if (find_nick(chat->nick, message))
6621
42fdf16f1dad [gaim-migrate @ 7145]
Mark Doliner <mark@kingant.net>
parents: 6607
diff changeset
1875 flags |= GAIM_MESSAGE_NICK;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1876 }
6060
6b4a12cd4caf [gaim-migrate @ 6510]
Nathan Walp <nwalp@pidgin.im>
parents: 6054
diff changeset
1877
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1878 g_free(str);
3677
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
1879 }
3705
91498932cea7 [gaim-migrate @ 3838]
Luke Schierer <lschiere@pidgin.im>
parents: 3704
diff changeset
1880
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1881 /* 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
1882 if (conv->ui_ops != NULL && conv->ui_ops->write_chat != NULL)
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
1883 conv->ui_ops->write_chat(conv, who, message, flags, mtime);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1884 else
6982
083d1e4a9c78 [gaim-migrate @ 7538]
Mark Doliner <mark@kingant.net>
parents: 6846
diff changeset
1885 gaim_conversation_write(conv, who, message, flags, mtime);
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
1886 }
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
1887
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1888 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1889 gaim_conv_chat_send(GaimConvChat *chat, const char *message)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1890 {
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1891 g_return_if_fail(chat != NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1892 g_return_if_fail(message != NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1893
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1894 common_send(gaim_conv_chat_get_conversation(chat), message);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1895 }
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1896
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1897 void
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1898 gaim_conv_chat_add_user(GaimConvChat *chat, const char *user, const char *extra_msg,
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1899 GaimConvChatBuddyFlags flags)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1900 {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1901 GaimConversation *conv;
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1902 GaimConversationUiOps *ops;
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1903 GaimConvChatBuddy *cb;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1904 char tmp[BUF_LONG];
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1905
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1906 g_return_if_fail(chat != NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1907 g_return_if_fail(user != NULL);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1908
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1909 conv = gaim_conv_chat_get_conversation(chat);
4465
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
1910 ops = gaim_conversation_get_ui_ops(conv);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1911
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1912 gaim_signal_emit(gaim_conversations_get_handle(),
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1913 "chat-buddy-joining", conv, user);
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1914
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1915 cb = gaim_conv_chat_cb_new(user, flags);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1916
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1917 gaim_conv_chat_set_users(chat,
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1918 g_list_append(gaim_conv_chat_get_users(chat), cb));
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1919
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1920 if (ops != NULL && ops->chat_add_user != NULL)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1921 ops->chat_add_user(conv, user);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1922
8998
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
1923 if (extra_msg == NULL)
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
1924 g_snprintf(tmp, sizeof(tmp), _("%s entered the room."), user);
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
1925 else
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
1926 g_snprintf(tmp, sizeof(tmp),
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
1927 _("%s [<I>%s</I>] entered the room."),
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
1928 user, extra_msg);
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
1929
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
1930 gaim_conversation_write(conv, NULL, tmp, GAIM_MESSAGE_SYSTEM, time(NULL));
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1931
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1932 gaim_signal_emit(gaim_conversations_get_handle(),
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1933 "chat-buddy-joined", conv, user);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
1934 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
1935
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1936 void
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1937 gaim_conv_chat_add_users(GaimConvChat *chat, GList *users, GList *flags)
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1938 {
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1939 GaimConversation *conv;
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1940 GaimConversationUiOps *ops;
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1941 GaimConvChatBuddy *cb;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1942 GList *ul, *fl;
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1943
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1944 g_return_if_fail(chat != NULL);
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1945 g_return_if_fail(users != NULL);
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1946
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1947 conv = gaim_conv_chat_get_conversation(chat);
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1948 ops = gaim_conversation_get_ui_ops(conv);
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1949
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1950 ul = users;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1951 fl = flags;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1952 while ((ul != NULL) && (fl != NULL)) {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1953 const char *user = (const char *)ul->data;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1954 GaimConvChatBuddyFlags f = GPOINTER_TO_INT(fl->data);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1955
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1956 gaim_signal_emit(gaim_conversations_get_handle(),
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1957 "chat-buddy-joining", conv, user, f);
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 cb = gaim_conv_chat_cb_new(user, f);
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1960 gaim_conv_chat_set_users(chat,
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1961 g_list_append(gaim_conv_chat_get_users(chat), cb));
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1962
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
1963 gaim_signal_emit(gaim_conversations_get_handle(),
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1964 "chat-buddy-joined", conv, user, f);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1965 ul = ul->next;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1966 fl = fl->next;
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1967 }
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1968
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1969 if (ops != NULL && ops->chat_add_users != NULL)
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1970 ops->chat_add_users(conv, users);
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1971 }
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1972
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
1973 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1974 gaim_conv_chat_rename_user(GaimConvChat *chat, const char *old_user,
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1975 const char *new_user)
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
1976 {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1977 GaimConversation *conv;
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
1978 GaimConversationUiOps *ops;
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1979 GaimConvChatBuddy *cb;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1980 GaimConvChatBuddyFlags flags;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1981 char tmp[BUF_LONG];
8158
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
1982 gboolean its_me = FALSE;
3866
994b5c4d15dd [gaim-migrate @ 4018]
Rob Flynn <gaim@robflynn.com>
parents: 3846
diff changeset
1983
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1984 g_return_if_fail(chat != NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1985 g_return_if_fail(old_user != NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
1986 g_return_if_fail(new_user != NULL);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
1987
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1988 conv = gaim_conv_chat_get_conversation(chat);
4465
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
1989 ops = gaim_conversation_get_ui_ops(conv);
3304
7c5325f460de [gaim-migrate @ 3322]
Sean Egan <seanegan@gmail.com>
parents: 3300
diff changeset
1990
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1991 flags = gaim_conv_chat_user_get_flags(chat, old_user);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1992 cb = gaim_conv_chat_cb_new(new_user, flags);
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1993 gaim_conv_chat_set_users(chat,
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1994 g_list_append(gaim_conv_chat_get_users(chat), cb));
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1995
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1996 if (ops != NULL && ops->chat_rename_user != NULL)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
1997 ops->chat_rename_user(conv, old_user, new_user);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1998
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
1999 cb = gaim_conv_chat_cb_find(chat, old_user);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2000
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2001 if (cb) {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2002 gaim_conv_chat_set_users(chat,
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2003 g_list_remove(gaim_conv_chat_get_users(chat), cb));
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2004 gaim_conv_chat_cb_destroy(cb);
4506
f3afcc4dd133 [gaim-migrate @ 4781]
Christian Hammond <chipx86@chipx86.com>
parents: 4491
diff changeset
2005 }
1428
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
2006
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2007 if (gaim_conv_chat_is_user_ignored(chat, old_user)) {
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2008 gaim_conv_chat_unignore(chat, old_user);
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2009 gaim_conv_chat_ignore(chat, new_user);
1428
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
2010 }
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2011 else if (gaim_conv_chat_is_user_ignored(chat, new_user))
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2012 gaim_conv_chat_unignore(chat, new_user);
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2013
8158
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
2014 if(!g_utf8_collate(old_user, chat->nick)) {
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
2015 gaim_conv_chat_set_nick(chat, new_user);
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
2016 its_me = TRUE;
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
2017 }
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
2018
5545
7a64114641c3 [gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents: 5539
diff changeset
2019 if (gaim_prefs_get_bool("/core/conversations/chat/show_nick_change")) {
8158
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
2020 if(its_me) {
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
2021 g_snprintf(tmp, sizeof(tmp),
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
2022 _("You are now known as %s"), new_user);
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
2023 } else {
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
2024 g_snprintf(tmp, sizeof(tmp),
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
2025 _("%s is now known as %s"), old_user, new_user);
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
2026 }
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2027
6982
083d1e4a9c78 [gaim-migrate @ 7538]
Mark Doliner <mark@kingant.net>
parents: 6846
diff changeset
2028 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
2029 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2030 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2031
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
2032 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2033 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
2034 {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
2035 GaimConversation *conv;
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
2036 GaimConversationUiOps *ops;
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2037 GaimConvChatBuddy *cb;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
2038 char tmp[BUF_LONG];
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2039
5677
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
2040 g_return_if_fail(chat != NULL);
0adfd56b46b5 [gaim-migrate @ 6095]
Christian Hammond <chipx86@chipx86.com>
parents: 5676
diff changeset
2041 g_return_if_fail(user != NULL);
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2042
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2043 conv = gaim_conv_chat_get_conversation(chat);
4465
6e37eb000b7a [gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents: 4425
diff changeset
2044 ops = gaim_conversation_get_ui_ops(conv);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
2045
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2046 gaim_signal_emit(gaim_conversations_get_handle(), "chat-buddy-leaving",
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2047 conv, user, reason);
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
2048
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
2049 if (ops != NULL && ops->chat_remove_user != NULL)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
2050 ops->chat_remove_user(conv, user);
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
2051
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2052 cb = gaim_conv_chat_cb_find(chat, user);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2053
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2054 if (cb) {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2055 gaim_conv_chat_set_users(chat,
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2056 g_list_remove(gaim_conv_chat_get_users(chat), cb));
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2057 gaim_conv_chat_cb_destroy(cb);
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2058 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2059
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
2060 /* 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
2061
8998
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
2062 if (reason != NULL && *reason != '\0')
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
2063 g_snprintf(tmp, sizeof(tmp),
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
2064 _("%s left the room (%s)."), user, reason);
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
2065 else
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
2066 g_snprintf(tmp, sizeof(tmp), _("%s left the room."), user);
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
2067
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
2068 gaim_conversation_write(conv, NULL, tmp, GAIM_MESSAGE_SYSTEM, time(NULL));
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2069
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2070 gaim_signal_emit(gaim_conversations_get_handle(), "chat-buddy-left",
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2071 conv, user, reason);
1759
e0f936b4c91a [gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1757
diff changeset
2072 }
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
2073
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
2074 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2075 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
2076 {
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
2077 GaimConversation *conv;
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
2078 GaimConversationUiOps *ops;
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2079 GaimConvChatBuddy *cb;
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
2080 char tmp[BUF_LONG];
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2081 GList *l;
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
2082
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
2083 g_return_if_fail(chat != NULL);
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
2084 g_return_if_fail(users != NULL);
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
2085
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2086 conv = gaim_conv_chat_get_conversation(chat);
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
2087 ops = gaim_conversation_get_ui_ops(conv);
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
2088
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
2089 for (l = users; l != NULL; l = l->next) {
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2090 const char *user = (const char *)l->data;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2091
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2092 gaim_signal_emit(gaim_conversations_get_handle(), "chat-buddy-leaving",
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2093 conv, user, reason);
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
2094 }
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
2095
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
2096 if (ops != NULL && ops->chat_remove_users != NULL)
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
2097 ops->chat_remove_users(conv, users);
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
2098
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
2099 for (l = users; l != NULL; l = l->next) {
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2100 const char *user = (const char *)l->data;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2101
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2102 cb = gaim_conv_chat_cb_find(chat, user);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2103
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2104 if (cb) {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2105 gaim_conv_chat_set_users(chat,
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2106 g_list_remove(gaim_conv_chat_get_users(chat), cb));
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2107 gaim_conv_chat_cb_destroy(cb);
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
2108 }
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2109
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2110 gaim_signal_emit(gaim_conversations_get_handle(), "chat-buddy-left",
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2111 conv, user, reason);
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
2112 }
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
2113
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
2114 /* 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
2115
8998
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
2116 if (reason != NULL && *reason != '\0') {
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
2117 int i;
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
2118 int size = g_list_length(users);
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
2119 int max = MIN(10, size);
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
2120 GList *l;
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
2121
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
2122 *tmp = '\0';
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
2123
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
2124 for (l = users, i = 0; i < max; i++, l = l->next) {
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
2125 g_strlcat(tmp, (char *)l->data, sizeof(tmp));
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
2126
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
2127 if (i < max - 1)
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
2128 g_strlcat(tmp, ", ", sizeof(tmp));
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
2129 }
8998
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
2130
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
2131 if (size > 10)
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
2132 g_snprintf(tmp, sizeof(tmp),
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
2133 _("(+%d more)"), size - 10);
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
2134
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
2135 g_snprintf(tmp, sizeof(tmp), _(" left the room (%s)."), reason);
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
2136
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
2137 gaim_conversation_write(conv, NULL, tmp,
3738d1eac0ad [gaim-migrate @ 9773]
Luke Schierer <lschiere@pidgin.im>
parents: 8979
diff changeset
2138 GAIM_MESSAGE_SYSTEM, time(NULL));
6407
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
2139 }
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
2140 }
ba0b99a72be2 [gaim-migrate @ 6913]
Christian Hammond <chipx86@chipx86.com>
parents: 6405
diff changeset
2141
6414
874a5c9f4eb8 [gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents: 6407
diff changeset
2142 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2143 gaim_conv_chat_clear_users(GaimConvChat *chat)
6414
874a5c9f4eb8 [gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents: 6407
diff changeset
2144 {
874a5c9f4eb8 [gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents: 6407
diff changeset
2145 GaimConversation *conv;
874a5c9f4eb8 [gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents: 6407
diff changeset
2146 GaimConversationUiOps *ops;
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2147 GList *users, *names = NULL;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2148 GList *l;
6414
874a5c9f4eb8 [gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents: 6407
diff changeset
2149
874a5c9f4eb8 [gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents: 6407
diff changeset
2150 g_return_if_fail(chat != NULL);
874a5c9f4eb8 [gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents: 6407
diff changeset
2151
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2152 conv = gaim_conv_chat_get_conversation(chat);
6414
874a5c9f4eb8 [gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents: 6407
diff changeset
2153 ops = gaim_conversation_get_ui_ops(conv);
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2154 users = gaim_conv_chat_get_users(chat);
6414
874a5c9f4eb8 [gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents: 6407
diff changeset
2155
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2156 if (ops != NULL && ops->chat_remove_users != NULL) {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2157 for (l = users; l; l = l->next) {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2158 GaimConvChatBuddy *cb = l->data;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2159 names = g_list_append(names, cb->name);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2160 }
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2161 ops->chat_remove_users(conv, names);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2162 g_list_free(names);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2163 }
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2164
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2165 for (l = users; l; l = l->next)
6414
874a5c9f4eb8 [gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents: 6407
diff changeset
2166 {
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2167 GaimConvChatBuddy *cb = l->data;
6414
874a5c9f4eb8 [gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents: 6407
diff changeset
2168
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2169 gaim_signal_emit(gaim_conversations_get_handle(),
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2170 "chat-buddy-leaving", conv, cb->name, NULL);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2171 gaim_signal_emit(gaim_conversations_get_handle(),
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2172 "chat-buddy-left", conv, cb->name, NULL);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2173
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2174 gaim_conv_chat_cb_destroy(cb);
6414
874a5c9f4eb8 [gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents: 6407
diff changeset
2175 }
874a5c9f4eb8 [gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents: 6407
diff changeset
2176
874a5c9f4eb8 [gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents: 6407
diff changeset
2177 g_list_free(users);
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2178 gaim_conv_chat_set_users(chat, NULL);
6414
874a5c9f4eb8 [gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents: 6407
diff changeset
2179 }
874a5c9f4eb8 [gaim-migrate @ 6921]
Christian Hammond <chipx86@chipx86.com>
parents: 6407
diff changeset
2180
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2181
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2182 gboolean
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2183 gaim_conv_chat_find_user(GaimConvChat *chat, const char *user)
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2184 {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2185 g_return_val_if_fail(chat != NULL, FALSE);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2186 g_return_val_if_fail(user != NULL, FALSE);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2187
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2188 return (gaim_conv_chat_cb_find(chat, user) != NULL);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2189 }
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2190
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2191 void
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2192 gaim_conv_chat_user_set_flags(GaimConvChat *chat, const char *user,
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2193 GaimConvChatBuddyFlags flags)
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2194 {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2195 GaimConversation *conv;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2196 GaimConversationUiOps *ops;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2197 GaimConvChatBuddy *cb;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2198 GaimConvChatBuddyFlags oldflags;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2199
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2200 g_return_if_fail(chat != NULL);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2201 g_return_if_fail(user != NULL);
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 cb = gaim_conv_chat_cb_find(chat, user);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2204
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2205 if (!cb)
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2206 return;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2207
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2208 if (flags == cb->flags)
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2209 return;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2210
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2211 oldflags = cb->flags;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2212 cb->flags = flags;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2213
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2214 conv = gaim_conv_chat_get_conversation(chat);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2215 ops = gaim_conversation_get_ui_ops(conv);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2216
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2217 if (ops != NULL && ops->chat_update_user != NULL)
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2218 ops->chat_update_user(conv, user);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2219
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2220 gaim_signal_emit(gaim_conversations_get_handle(),
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2221 "chat-buddy-flags", conv, user, oldflags, flags);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2222 }
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2223
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2224 GaimConvChatBuddyFlags
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2225 gaim_conv_chat_user_get_flags(GaimConvChat *chat, const char *user)
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2226 {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2227 GaimConvChatBuddy *cb;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2228
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2229 g_return_val_if_fail(chat != NULL, 0);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2230 g_return_val_if_fail(user != NULL, 0);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2231
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2232 cb = gaim_conv_chat_cb_find(chat, user);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2233
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2234 if (!cb)
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2235 return GAIM_CBFLAGS_NONE;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2236
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2237 return cb->flags;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2238 }
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2239
8158
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
2240 void gaim_conv_chat_set_nick(GaimConvChat *chat, const char *nick) {
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
2241 g_return_if_fail(chat != NULL);
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
2242
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
2243 if(chat->nick)
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
2244 g_free(chat->nick);
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
2245 chat->nick = g_strdup(nick);
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
2246 }
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
2247
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
2248 const char *gaim_conv_chat_get_nick(GaimConvChat *chat) {
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
2249 g_return_val_if_fail(chat != NULL, NULL);
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
2250
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
2251 return chat->nick;
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
2252 }
e283be34aadf [gaim-migrate @ 8870]
Nathan Walp <nwalp@pidgin.im>
parents: 8155
diff changeset
2253
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
2254 GaimConversation *
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
2255 gaim_find_chat(const GaimConnection *gc, int id)
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
2256 {
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
2257 GList *l;
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
2258 GaimConversation *conv;
2499
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
2259
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
2260 for (l = gaim_get_chats(); l != NULL; l = l->next) {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
2261 conv = (GaimConversation *)l->data;
2499
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
2262
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2263 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
2264 gaim_conversation_get_gc(conv) == gc)
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
2265 return conv;
2499
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
2266 }
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
2267
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
2268 return NULL;
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
2269 }
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2270
8256
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
2271 void
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
2272 gaim_conv_chat_left(GaimConvChat *chat)
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
2273 {
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
2274 g_return_if_fail(chat != NULL);
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
2275
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
2276 chat->left = TRUE;
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
2277 gaim_conversation_update(chat->conv, GAIM_CONV_UPDATE_CHATLEFT);
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
2278 }
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
2279
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
2280 gboolean
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
2281 gaim_conv_chat_has_left(GaimConvChat *chat)
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
2282 {
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
2283 g_return_val_if_fail(chat != NULL, TRUE);
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
2284
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
2285 return chat->left;
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
2286 }
1d86096ae0f4 [gaim-migrate @ 8979]
Christian Hammond <chipx86@chipx86.com>
parents: 8158
diff changeset
2287
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2288 GaimConvChatBuddy *
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2289 gaim_conv_chat_cb_new(const char *name, GaimConvChatBuddyFlags flags)
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2290 {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2291 GaimConvChatBuddy *cb;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2292
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2293 g_return_val_if_fail(name != NULL, NULL);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2294
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2295 cb = g_new0(GaimConvChatBuddy, 1);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2296 cb->name = g_strdup(name);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2297 cb->flags = flags;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2298
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2299 return cb;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2300 }
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2301
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2302 GaimConvChatBuddy *
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2303 gaim_conv_chat_cb_find(GaimConvChat *chat, const char *name)
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2304 {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2305 GList *l;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2306 GaimConvChatBuddy *cb = NULL;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2307
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2308 g_return_val_if_fail(chat != NULL, NULL);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2309 g_return_val_if_fail(name != NULL, NULL);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2310
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2311 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
2312 cb = l->data;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2313 if (!gaim_utf8_strcasecmp(cb->name, name))
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2314 return cb;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2315 }
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2316
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2317 return NULL;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2318 }
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2319
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2320 void
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2321 gaim_conv_chat_cb_destroy(GaimConvChatBuddy *cb)
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2322 {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2323 g_return_if_fail(cb != NULL);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2324
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2325 if (cb->name)
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2326 g_free(cb->name);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2327 cb->name = NULL;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2328 cb->flags = 0;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2329 g_free(cb);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2330 }
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2331
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2332 const char *
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2333 gaim_conv_chat_cb_get_name(GaimConvChatBuddy *cb)
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2334 {
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2335 g_return_val_if_fail(cb != NULL, NULL);
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2336
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2337 return cb->name;
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2338 }
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2339
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2340 /**************************************************************************
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2341 * Conversation placement functions
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2342 **************************************************************************/
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2343 /* This one places conversations in the last made window. */
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2344 static void
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
2345 conv_placement_last_created_win(GaimConversation *conv)
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2346 {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2347 GaimConvWindow *win;
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2348
9251
45d2ad4ac1c1 [gaim-migrate @ 10050]
Ethan Blanton <elb@pidgin.im>
parents: 9166
diff changeset
2349 win = g_list_last(gaim_get_windows())->data;
45d2ad4ac1c1 [gaim-migrate @ 10050]
Ethan Blanton <elb@pidgin.im>
parents: 9166
diff changeset
2350
45d2ad4ac1c1 [gaim-migrate @ 10050]
Ethan Blanton <elb@pidgin.im>
parents: 9166
diff changeset
2351 if (win == NULL) {
45d2ad4ac1c1 [gaim-migrate @ 10050]
Ethan Blanton <elb@pidgin.im>
parents: 9166
diff changeset
2352 win = gaim_conv_window_new();
45d2ad4ac1c1 [gaim-migrate @ 10050]
Ethan Blanton <elb@pidgin.im>
parents: 9166
diff changeset
2353
45d2ad4ac1c1 [gaim-migrate @ 10050]
Ethan Blanton <elb@pidgin.im>
parents: 9166
diff changeset
2354 gaim_conv_window_add_conversation(win, conv);
45d2ad4ac1c1 [gaim-migrate @ 10050]
Ethan Blanton <elb@pidgin.im>
parents: 9166
diff changeset
2355 gaim_conv_window_show(win);
45d2ad4ac1c1 [gaim-migrate @ 10050]
Ethan Blanton <elb@pidgin.im>
parents: 9166
diff changeset
2356 }
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2357 else
9251
45d2ad4ac1c1 [gaim-migrate @ 10050]
Ethan Blanton <elb@pidgin.im>
parents: 9166
diff changeset
2358 gaim_conv_window_add_conversation(win, conv);
45d2ad4ac1c1 [gaim-migrate @ 10050]
Ethan Blanton <elb@pidgin.im>
parents: 9166
diff changeset
2359 }
45d2ad4ac1c1 [gaim-migrate @ 10050]
Ethan Blanton <elb@pidgin.im>
parents: 9166
diff changeset
2360
45d2ad4ac1c1 [gaim-migrate @ 10050]
Ethan Blanton <elb@pidgin.im>
parents: 9166
diff changeset
2361 /* This one places conversations in the last made window of the same type. */
45d2ad4ac1c1 [gaim-migrate @ 10050]
Ethan Blanton <elb@pidgin.im>
parents: 9166
diff changeset
2362 static void
45d2ad4ac1c1 [gaim-migrate @ 10050]
Ethan Blanton <elb@pidgin.im>
parents: 9166
diff changeset
2363 conv_placement_last_created_win_type(GaimConversation *conv)
45d2ad4ac1c1 [gaim-migrate @ 10050]
Ethan Blanton <elb@pidgin.im>
parents: 9166
diff changeset
2364 {
45d2ad4ac1c1 [gaim-migrate @ 10050]
Ethan Blanton <elb@pidgin.im>
parents: 9166
diff changeset
2365 GaimConvWindow *win;
45d2ad4ac1c1 [gaim-migrate @ 10050]
Ethan Blanton <elb@pidgin.im>
parents: 9166
diff changeset
2366
45d2ad4ac1c1 [gaim-migrate @ 10050]
Ethan Blanton <elb@pidgin.im>
parents: 9166
diff changeset
2367 win = gaim_get_last_window_with_type(gaim_conversation_get_type(conv));
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2368
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2369 if (win == NULL) {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2370 win = gaim_conv_window_new();
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2371
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2372 gaim_conv_window_add_conversation(win, conv);
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2373 gaim_conv_window_show(win);
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2374 }
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2375 else
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2376 gaim_conv_window_add_conversation(win, conv);
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2377 }
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2378
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2379 /* This one places each conversation in its own window. */
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2380 static void
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
2381 conv_placement_new_window(GaimConversation *conv)
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2382 {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2383 GaimConvWindow *win;
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2384
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2385 win = gaim_conv_window_new();
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2386
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2387 gaim_conv_window_add_conversation(win, conv);
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2388
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2389 gaim_conv_window_show(win);
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2390 }
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2391
8271
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2392 static GaimGroup *
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2393 conv_get_group(GaimConversation *conv)
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2394 {
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2395 GaimGroup *group = NULL;
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2396
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2397 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM)
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2398 {
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2399 GaimBuddy *buddy;
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2400
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2401 buddy = gaim_find_buddy(gaim_conversation_get_account(conv),
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2402 gaim_conversation_get_name(conv));
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2403
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2404 if (buddy != NULL)
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2405 group = gaim_find_buddys_group(buddy);
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2406
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2407 }
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2408 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT)
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2409 {
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2410 GaimChat *chat;
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2411
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2412 chat = gaim_blist_find_chat(gaim_conversation_get_account(conv),
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2413 gaim_conversation_get_name(conv));
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2414
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2415 if (chat != NULL)
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2416 group = gaim_chat_get_group(chat);
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2417 }
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2418
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2419 return group;
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2420 }
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2421
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2422 /*
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2423 * This groups things by, well, group. Buddies from groups will always be
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2424 * grouped together, and a buddy from a group not belonging to any currently
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2425 * open windows will get a new window.
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2426 */
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2427 static void
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
2428 conv_placement_by_group(GaimConversation *conv)
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2429 {
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2430 GaimConversationType type;
8271
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2431 GaimGroup *group = NULL;
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2432 GList *wl, *cl;
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2433
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2434 type = gaim_conversation_get_type(conv);
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2435
8271
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2436 group = conv_get_group(conv);
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2437
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2438 /* Go through the list of IMs and find one with this group. */
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2439 for (wl = gaim_get_windows(); wl != NULL; wl = wl->next)
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2440 {
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2441 GaimConvWindow *win2;
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2442 GaimConversation *conv2;
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2443 GaimGroup *group2 = NULL;
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2444
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2445 win2 = (GaimConvWindow *)wl->data;
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2446
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2447 for (cl = gaim_conv_window_get_conversations(win2);
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2448 cl != NULL;
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2449 cl = cl->next)
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2450 {
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2451 conv2 = (GaimConversation *)cl->data;
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2452
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2453 group2 = conv_get_group(conv2);
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2454
9150
05532ad61ed5 [gaim-migrate @ 9934]
Luke Schierer <lschiere@pidgin.im>
parents: 9123
diff changeset
2455 if (group == group2)
8271
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2456 {
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2457 gaim_conv_window_add_conversation(win2, conv);
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2458
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2459 return;
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2460 }
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2461 }
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2462 }
8271
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2463
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2464 /* Make a new window. */
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2465 conv_placement_new_window(conv);
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2466 }
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2467
4522
0738264a52ad [gaim-migrate @ 4800]
Nathan Walp <nwalp@pidgin.im>
parents: 4506
diff changeset
2468 /* This groups things by account. Otherwise, the same semantics as above */
0738264a52ad [gaim-migrate @ 4800]
Nathan Walp <nwalp@pidgin.im>
parents: 4506
diff changeset
2469 static void
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
2470 conv_placement_by_account(GaimConversation *conv)
4522
0738264a52ad [gaim-migrate @ 4800]
Nathan Walp <nwalp@pidgin.im>
parents: 4506
diff changeset
2471 {
0738264a52ad [gaim-migrate @ 4800]
Nathan Walp <nwalp@pidgin.im>
parents: 4506
diff changeset
2472 GaimConversationType type;
0738264a52ad [gaim-migrate @ 4800]
Nathan Walp <nwalp@pidgin.im>
parents: 4506
diff changeset
2473 GList *wins, *convs;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5545
diff changeset
2474 GaimAccount *account;
4522
0738264a52ad [gaim-migrate @ 4800]
Nathan Walp <nwalp@pidgin.im>
parents: 4506
diff changeset
2475
0738264a52ad [gaim-migrate @ 4800]
Nathan Walp <nwalp@pidgin.im>
parents: 4506
diff changeset
2476 account = gaim_conversation_get_account(conv);
0738264a52ad [gaim-migrate @ 4800]
Nathan Walp <nwalp@pidgin.im>
parents: 4506
diff changeset
2477 type = gaim_conversation_get_type(conv);
0738264a52ad [gaim-migrate @ 4800]
Nathan Walp <nwalp@pidgin.im>
parents: 4506
diff changeset
2478
0738264a52ad [gaim-migrate @ 4800]
Nathan Walp <nwalp@pidgin.im>
parents: 4506
diff changeset
2479 /* Go through the list of IMs and find one with this group. */
8271
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2480 for (wins = gaim_get_windows(); wins != NULL; wins = wins->next)
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2481 {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2482 GaimConvWindow *win2;
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
2483 GaimConversation *conv2;
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
2484
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2485 win2 = (GaimConvWindow *)wins->data;
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2486
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2487 for (convs = gaim_conv_window_get_conversations(win2);
8271
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2488 convs != NULL;
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2489 convs = convs->next)
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2490 {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
2491 conv2 = (GaimConversation *)convs->data;
4522
0738264a52ad [gaim-migrate @ 4800]
Nathan Walp <nwalp@pidgin.im>
parents: 4506
diff changeset
2492
9150
05532ad61ed5 [gaim-migrate @ 9934]
Luke Schierer <lschiere@pidgin.im>
parents: 9123
diff changeset
2493 if (account == gaim_conversation_get_account(conv2))
8271
5c9cd9c97727 [gaim-migrate @ 8995]
Christian Hammond <chipx86@chipx86.com>
parents: 8256
diff changeset
2494 {
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2495 gaim_conv_window_add_conversation(win2, conv);
4522
0738264a52ad [gaim-migrate @ 4800]
Nathan Walp <nwalp@pidgin.im>
parents: 4506
diff changeset
2496 return;
0738264a52ad [gaim-migrate @ 4800]
Nathan Walp <nwalp@pidgin.im>
parents: 4506
diff changeset
2497 }
0738264a52ad [gaim-migrate @ 4800]
Nathan Walp <nwalp@pidgin.im>
parents: 4506
diff changeset
2498 }
0738264a52ad [gaim-migrate @ 4800]
Nathan Walp <nwalp@pidgin.im>
parents: 4506
diff changeset
2499 }
5545
7a64114641c3 [gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents: 5539
diff changeset
2500
4522
0738264a52ad [gaim-migrate @ 4800]
Nathan Walp <nwalp@pidgin.im>
parents: 4506
diff changeset
2501 /* Make a new window. */
0738264a52ad [gaim-migrate @ 4800]
Nathan Walp <nwalp@pidgin.im>
parents: 4506
diff changeset
2502 conv_placement_new_window(conv);
0738264a52ad [gaim-migrate @ 4800]
Nathan Walp <nwalp@pidgin.im>
parents: 4506
diff changeset
2503 }
0738264a52ad [gaim-migrate @ 4800]
Nathan Walp <nwalp@pidgin.im>
parents: 4506
diff changeset
2504
7602
df5b0937ea47 [gaim-migrate @ 8225]
Christian Hammond <chipx86@chipx86.com>
parents: 7562
diff changeset
2505 static ConvPlacementData *
df5b0937ea47 [gaim-migrate @ 8225]
Christian Hammond <chipx86@chipx86.com>
parents: 7562
diff changeset
2506 get_conv_placement_data(const char *id)
5858
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2507 {
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2508 ConvPlacementData *data = NULL;
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2509 GList *n;
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2510
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2511 for(n = conv_placement_fncs; n; n = n->next) {
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2512 data = n->data;
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2513 if(!strcmp(data->id, id))
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2514 return data;
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2515 }
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2516
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2517 return NULL;
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2518 }
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2519
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2520 static void
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2521 add_conv_placement_fnc(const char *id, const char *name,
7602
df5b0937ea47 [gaim-migrate @ 8225]
Christian Hammond <chipx86@chipx86.com>
parents: 7562
diff changeset
2522 GaimConvPlacementFunc fnc)
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2523 {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
2524 ConvPlacementData *data;
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
2525
5858
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2526 data = g_new(ConvPlacementData, 1);
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2527
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2528 data->id = g_strdup(id);
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2529 data->name = g_strdup(name);
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2530 data->fnc = fnc;
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2531
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2532 conv_placement_fncs = g_list_append(conv_placement_fncs, data);
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2533 }
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2534
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2535 static void
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2536 ensure_default_funcs(void)
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2537 {
7602
df5b0937ea47 [gaim-migrate @ 8225]
Christian Hammond <chipx86@chipx86.com>
parents: 7562
diff changeset
2538 if (conv_placement_fncs == NULL)
df5b0937ea47 [gaim-migrate @ 8225]
Christian Hammond <chipx86@chipx86.com>
parents: 7562
diff changeset
2539 {
5858
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2540 add_conv_placement_fnc("last", _("Last created window"),
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2541 conv_placement_last_created_win);
9251
45d2ad4ac1c1 [gaim-migrate @ 10050]
Ethan Blanton <elb@pidgin.im>
parents: 9166
diff changeset
2542 add_conv_placement_fnc("im_chat", _("Separate IM and Chat windows"),
45d2ad4ac1c1 [gaim-migrate @ 10050]
Ethan Blanton <elb@pidgin.im>
parents: 9166
diff changeset
2543 conv_placement_last_created_win_type);
5858
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2544 add_conv_placement_fnc("new", _("New window"),
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2545 conv_placement_new_window);
5858
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2546 add_conv_placement_fnc("group", _("By group"),
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2547 conv_placement_by_group);
5858
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2548 add_conv_placement_fnc("account", _("By account"),
4522
0738264a52ad [gaim-migrate @ 4800]
Nathan Walp <nwalp@pidgin.im>
parents: 4506
diff changeset
2549 conv_placement_by_account);
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2550 }
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2551 }
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2552
6312
5e5959d7a85e [gaim-migrate @ 6811]
Christian Hammond <chipx86@chipx86.com>
parents: 6060
diff changeset
2553 GList *
5e5959d7a85e [gaim-migrate @ 6811]
Christian Hammond <chipx86@chipx86.com>
parents: 6060
diff changeset
2554 gaim_conv_placement_get_options(void)
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2555 {
5858
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2556 GList *n, *list = NULL;
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2557 ConvPlacementData *data;
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2558
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2559 ensure_default_funcs();
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2560
6312
5e5959d7a85e [gaim-migrate @ 6811]
Christian Hammond <chipx86@chipx86.com>
parents: 6060
diff changeset
2561 for (n = conv_placement_fncs; n; n = n->next) {
5858
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2562 data = n->data;
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2563 list = g_list_append(list, data->name);
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2564 list = g_list_append(list, data->id);
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2565 }
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2566
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2567 return list;
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2568 }
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2569
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2570
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2571 void
6312
5e5959d7a85e [gaim-migrate @ 6811]
Christian Hammond <chipx86@chipx86.com>
parents: 6060
diff changeset
2572 gaim_conv_placement_add_fnc(const char *id, const char *name,
5e5959d7a85e [gaim-migrate @ 6811]
Christian Hammond <chipx86@chipx86.com>
parents: 6060
diff changeset
2573 GaimConvPlacementFunc fnc)
5858
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2574 {
6312
5e5959d7a85e [gaim-migrate @ 6811]
Christian Hammond <chipx86@chipx86.com>
parents: 6060
diff changeset
2575 g_return_if_fail(id != NULL);
5858
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2576 g_return_if_fail(name != NULL);
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2577 g_return_if_fail(fnc != NULL);
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2578
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2579 ensure_default_funcs();
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2580
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2581 add_conv_placement_fnc(id, name, fnc);
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2582 }
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2583
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2584 void
5858
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2585 gaim_conv_placement_remove_fnc(const char *id)
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2586 {
5858
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2587 ConvPlacementData *data = get_conv_placement_data(id);
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2588
6312
5e5959d7a85e [gaim-migrate @ 6811]
Christian Hammond <chipx86@chipx86.com>
parents: 6060
diff changeset
2589 if (data == NULL)
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2590 return;
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2591
5858
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2592 conv_placement_fncs = g_list_remove(conv_placement_fncs, data);
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2593
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2594 g_free(data->id);
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2595 g_free(data->name);
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2596 g_free(data);
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2597 }
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2598
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2599 const char *
5858
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2600 gaim_conv_placement_get_name(const char *id)
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2601 {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
2602 ConvPlacementData *data;
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2603
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2604 ensure_default_funcs();
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2605
5858
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2606 data = get_conv_placement_data(id);
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2607
6312
5e5959d7a85e [gaim-migrate @ 6811]
Christian Hammond <chipx86@chipx86.com>
parents: 6060
diff changeset
2608 if (data == NULL)
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2609 return NULL;
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2610
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2611 return data->name;
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2612 }
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2613
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
2614 GaimConvPlacementFunc
5858
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2615 gaim_conv_placement_get_fnc(const char *id)
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2616 {
5676
dae79aefac8d [gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents: 5621
diff changeset
2617 ConvPlacementData *data;
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2618
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2619 ensure_default_funcs();
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2620
5858
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2621 data = get_conv_placement_data(id);
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2622
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2623 if (data == NULL)
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2624 return NULL;
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2625
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2626 return data->fnc;
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2627 }
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2628
7561
cdfdbabd3266 [gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents: 7553
diff changeset
2629 void
cdfdbabd3266 [gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents: 7553
diff changeset
2630 gaim_conv_placement_set_current_func(GaimConvPlacementFunc func)
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2631 {
7561
cdfdbabd3266 [gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents: 7553
diff changeset
2632 g_return_if_fail(func != NULL);
cdfdbabd3266 [gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents: 7553
diff changeset
2633
cdfdbabd3266 [gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents: 7553
diff changeset
2634 place_conv = func;
cdfdbabd3266 [gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents: 7553
diff changeset
2635 }
cdfdbabd3266 [gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents: 7553
diff changeset
2636
cdfdbabd3266 [gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents: 7553
diff changeset
2637 GaimConvPlacementFunc
cdfdbabd3266 [gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents: 7553
diff changeset
2638 gaim_conv_placement_get_current_func(void)
cdfdbabd3266 [gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents: 7553
diff changeset
2639 {
cdfdbabd3266 [gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents: 7553
diff changeset
2640 return place_conv;
4469
d76095396a0e [gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents: 4467
diff changeset
2641 }
4481
b30b0a02ada0 [gaim-migrate @ 4756]
Christian Hammond <chipx86@chipx86.com>
parents: 4478
diff changeset
2642
6016
1e4a574bb46d [gaim-migrate @ 6466]
Mark Doliner <mark@kingant.net>
parents: 5872
diff changeset
2643 static void
6312
5e5959d7a85e [gaim-migrate @ 6811]
Christian Hammond <chipx86@chipx86.com>
parents: 6060
diff changeset
2644 update_titles_pref_cb(const char *name, GaimPrefType type,
5e5959d7a85e [gaim-migrate @ 6811]
Christian Hammond <chipx86@chipx86.com>
parents: 6060
diff changeset
2645 gpointer value, gpointer data)
6016
1e4a574bb46d [gaim-migrate @ 6466]
Mark Doliner <mark@kingant.net>
parents: 5872
diff changeset
2646 {
1e4a574bb46d [gaim-migrate @ 6466]
Mark Doliner <mark@kingant.net>
parents: 5872
diff changeset
2647 /*
7561
cdfdbabd3266 [gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents: 7553
diff changeset
2648 * If the use_server_alias option was changed, and use_alias_for_title
6016
1e4a574bb46d [gaim-migrate @ 6466]
Mark Doliner <mark@kingant.net>
parents: 5872
diff changeset
2649 * is false, then we don't have to do anything here.
1e4a574bb46d [gaim-migrate @ 6466]
Mark Doliner <mark@kingant.net>
parents: 5872
diff changeset
2650 */
7561
cdfdbabd3266 [gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents: 7553
diff changeset
2651 if (!strcmp(name, "/core/buddies/use_server_alias") &&
6016
1e4a574bb46d [gaim-migrate @ 6466]
Mark Doliner <mark@kingant.net>
parents: 5872
diff changeset
2652 !gaim_prefs_get_bool("/core/conversations/use_alias_for_title"))
1e4a574bb46d [gaim-migrate @ 6466]
Mark Doliner <mark@kingant.net>
parents: 5872
diff changeset
2653 return;
1e4a574bb46d [gaim-migrate @ 6466]
Mark Doliner <mark@kingant.net>
parents: 5872
diff changeset
2654
1e4a574bb46d [gaim-migrate @ 6466]
Mark Doliner <mark@kingant.net>
parents: 5872
diff changeset
2655 gaim_conversation_foreach(gaim_conversation_autoset_title);
1e4a574bb46d [gaim-migrate @ 6466]
Mark Doliner <mark@kingant.net>
parents: 5872
diff changeset
2656 }
1e4a574bb46d [gaim-migrate @ 6466]
Mark Doliner <mark@kingant.net>
parents: 5872
diff changeset
2657
4481
b30b0a02ada0 [gaim-migrate @ 4756]
Christian Hammond <chipx86@chipx86.com>
parents: 4478
diff changeset
2658 void
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2659 gaim_conversations_set_win_ui_ops(GaimConvWindowUiOps *ops)
4481
b30b0a02ada0 [gaim-migrate @ 4756]
Christian Hammond <chipx86@chipx86.com>
parents: 4478
diff changeset
2660 {
b30b0a02ada0 [gaim-migrate @ 4756]
Christian Hammond <chipx86@chipx86.com>
parents: 4478
diff changeset
2661 win_ui_ops = ops;
b30b0a02ada0 [gaim-migrate @ 4756]
Christian Hammond <chipx86@chipx86.com>
parents: 4478
diff changeset
2662 }
b30b0a02ada0 [gaim-migrate @ 4756]
Christian Hammond <chipx86@chipx86.com>
parents: 4478
diff changeset
2663
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
2664 GaimConvWindowUiOps *
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6982
diff changeset
2665 gaim_conversations_get_win_ui_ops(void)
4481
b30b0a02ada0 [gaim-migrate @ 4756]
Christian Hammond <chipx86@chipx86.com>
parents: 4478
diff changeset
2666 {
b30b0a02ada0 [gaim-migrate @ 4756]
Christian Hammond <chipx86@chipx86.com>
parents: 4478
diff changeset
2667 return win_ui_ops;
b30b0a02ada0 [gaim-migrate @ 4756]
Christian Hammond <chipx86@chipx86.com>
parents: 4478
diff changeset
2668 }
5858
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2669
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2670 void *
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2671 gaim_conversations_get_handle(void)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2672 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2673 static int handle;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2674
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2675 return &handle;
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2676 }
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2677
5858
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2678 void
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2679 gaim_conversations_init(void)
5858
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2680 {
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2681 void *handle = gaim_conversations_get_handle();
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2682
6846
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
2683 /**********************************************************************
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
2684 * Register preferences
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
2685 **********************************************************************/
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2686
5858
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2687 /* Conversations */
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2688 gaim_prefs_add_none("/core/conversations");
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2689 gaim_prefs_add_bool("/core/conversations/use_alias_for_title", TRUE);
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2690
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2691 /* Conversations -> Chat */
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2692 gaim_prefs_add_none("/core/conversations/chat");
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2693 gaim_prefs_add_bool("/core/conversations/chat/show_nick_change", TRUE);
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2694
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2695 /* Conversations -> IM */
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2696 gaim_prefs_add_none("/core/conversations/im");
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2697 gaim_prefs_add_bool("/core/conversations/im/send_typing", TRUE);
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2698
8900
7a67c459ab8f [gaim-migrate @ 9669]
Mark Doliner <mark@kingant.net>
parents: 8884
diff changeset
2699 /* Connect callbacks for changed preferences */
6016
1e4a574bb46d [gaim-migrate @ 6466]
Mark Doliner <mark@kingant.net>
parents: 5872
diff changeset
2700 gaim_prefs_connect_callback("/core/conversations/use_alias_for_title",
1e4a574bb46d [gaim-migrate @ 6466]
Mark Doliner <mark@kingant.net>
parents: 5872
diff changeset
2701 update_titles_pref_cb, NULL);
1e4a574bb46d [gaim-migrate @ 6466]
Mark Doliner <mark@kingant.net>
parents: 5872
diff changeset
2702 gaim_prefs_connect_callback("/core/buddies/use_server_alias",
1e4a574bb46d [gaim-migrate @ 6466]
Mark Doliner <mark@kingant.net>
parents: 5872
diff changeset
2703 update_titles_pref_cb, NULL);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2704
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2705
6846
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
2706 /**********************************************************************
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
2707 * Register signals
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
2708 **********************************************************************/
8078
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2709 gaim_signal_register(handle, "writing-im-msg",
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2710 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER,
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2711 gaim_value_new(GAIM_TYPE_BOOLEAN), 3,
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2712 gaim_value_new(GAIM_TYPE_SUBTYPE,
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2713 GAIM_SUBTYPE_ACCOUNT),
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2714 gaim_value_new(GAIM_TYPE_SUBTYPE,
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2715 GAIM_SUBTYPE_CONVERSATION),
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2716 gaim_value_new_outgoing(GAIM_TYPE_STRING));
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2717
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2718 gaim_signal_register(handle, "wrote-im-msg",
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2719 gaim_marshal_VOID__POINTER_POINTER_POINTER,
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2720 NULL, 3,
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2721 gaim_value_new(GAIM_TYPE_SUBTYPE,
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2722 GAIM_SUBTYPE_ACCOUNT),
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2723 gaim_value_new(GAIM_TYPE_SUBTYPE,
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2724 GAIM_SUBTYPE_CONVERSATION),
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2725 gaim_value_new(GAIM_TYPE_STRING));
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2726
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2727 gaim_signal_register(handle, "displaying-im-msg",
6780
e9a730ad5a3c [gaim-migrate @ 7319]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2728 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER,
e9a730ad5a3c [gaim-migrate @ 7319]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2729 gaim_value_new(GAIM_TYPE_BOOLEAN), 3,
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2730 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2731 GAIM_SUBTYPE_ACCOUNT),
6780
e9a730ad5a3c [gaim-migrate @ 7319]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2732 gaim_value_new(GAIM_TYPE_SUBTYPE,
e9a730ad5a3c [gaim-migrate @ 7319]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2733 GAIM_SUBTYPE_CONVERSATION),
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2734 gaim_value_new_outgoing(GAIM_TYPE_STRING));
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2735
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2736 gaim_signal_register(handle, "displayed-im-msg",
6780
e9a730ad5a3c [gaim-migrate @ 7319]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2737 gaim_marshal_VOID__POINTER_POINTER_POINTER,
e9a730ad5a3c [gaim-migrate @ 7319]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2738 NULL, 3,
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2739 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2740 GAIM_SUBTYPE_ACCOUNT),
6780
e9a730ad5a3c [gaim-migrate @ 7319]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2741 gaim_value_new(GAIM_TYPE_SUBTYPE,
e9a730ad5a3c [gaim-migrate @ 7319]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2742 GAIM_SUBTYPE_CONVERSATION),
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2743 gaim_value_new(GAIM_TYPE_STRING));
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2744
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2745 gaim_signal_register(handle, "sending-im-msg",
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2746 gaim_marshal_VOID__POINTER_POINTER_POINTER,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2747 NULL, 3,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2748 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2749 GAIM_SUBTYPE_ACCOUNT),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2750 gaim_value_new(GAIM_TYPE_STRING),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2751 gaim_value_new_outgoing(GAIM_TYPE_STRING));
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2752
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2753 gaim_signal_register(handle, "sent-im-msg",
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2754 gaim_marshal_VOID__POINTER_POINTER_POINTER,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2755 NULL, 3,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2756 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2757 GAIM_SUBTYPE_ACCOUNT),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2758 gaim_value_new(GAIM_TYPE_STRING),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2759 gaim_value_new(GAIM_TYPE_STRING));
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2760
8999
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2761 gaim_signal_register(handle, "receiving-im-msg",
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2762 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2763 gaim_value_new(GAIM_TYPE_BOOLEAN), 4,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2764 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2765 GAIM_SUBTYPE_ACCOUNT),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2766 gaim_value_new_outgoing(GAIM_TYPE_STRING),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2767 gaim_value_new_outgoing(GAIM_TYPE_STRING),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2768 gaim_value_new_outgoing(GAIM_TYPE_UINT));
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2769
8999
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2770 gaim_signal_register(handle, "received-im-msg",
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2771 gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT,
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2772 NULL, 4,
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2773 gaim_value_new(GAIM_TYPE_SUBTYPE,
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2774 GAIM_SUBTYPE_ACCOUNT),
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2775 gaim_value_new(GAIM_TYPE_STRING),
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2776 gaim_value_new(GAIM_TYPE_STRING),
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2777 gaim_value_new(GAIM_TYPE_UINT));
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2778
8078
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2779 gaim_signal_register(handle, "writing-chat-msg",
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2780 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER,
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2781 gaim_value_new(GAIM_TYPE_BOOLEAN), 3,
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2782 gaim_value_new(GAIM_TYPE_SUBTYPE,
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2783 GAIM_SUBTYPE_ACCOUNT),
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2784 gaim_value_new(GAIM_TYPE_SUBTYPE,
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2785 GAIM_SUBTYPE_CONVERSATION),
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2786 gaim_value_new_outgoing(GAIM_TYPE_STRING));
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2787
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2788 gaim_signal_register(handle, "wrote-chat-msg",
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2789 gaim_marshal_VOID__POINTER_POINTER_POINTER,
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2790 NULL, 3,
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2791 gaim_value_new(GAIM_TYPE_SUBTYPE,
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2792 GAIM_SUBTYPE_ACCOUNT),
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2793 gaim_value_new(GAIM_TYPE_SUBTYPE,
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2794 GAIM_SUBTYPE_CONVERSATION),
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2795 gaim_value_new(GAIM_TYPE_STRING));
ab0750ac5154 [gaim-migrate @ 8777]
Mark Doliner <mark@kingant.net>
parents: 8076
diff changeset
2796
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2797 gaim_signal_register(handle, "displaying-chat-msg",
6780
e9a730ad5a3c [gaim-migrate @ 7319]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2798 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER,
e9a730ad5a3c [gaim-migrate @ 7319]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2799 gaim_value_new(GAIM_TYPE_BOOLEAN), 3,
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2800 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2801 GAIM_SUBTYPE_ACCOUNT),
6780
e9a730ad5a3c [gaim-migrate @ 7319]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2802 gaim_value_new(GAIM_TYPE_SUBTYPE,
e9a730ad5a3c [gaim-migrate @ 7319]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2803 GAIM_SUBTYPE_CONVERSATION),
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2804 gaim_value_new_outgoing(GAIM_TYPE_STRING));
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2805
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2806 gaim_signal_register(handle, "displayed-chat-msg",
6780
e9a730ad5a3c [gaim-migrate @ 7319]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2807 gaim_marshal_VOID__POINTER_POINTER_POINTER,
e9a730ad5a3c [gaim-migrate @ 7319]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2808 NULL, 3,
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2809 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2810 GAIM_SUBTYPE_ACCOUNT),
6780
e9a730ad5a3c [gaim-migrate @ 7319]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2811 gaim_value_new(GAIM_TYPE_SUBTYPE,
e9a730ad5a3c [gaim-migrate @ 7319]
Christian Hammond <chipx86@chipx86.com>
parents: 6695
diff changeset
2812 GAIM_SUBTYPE_CONVERSATION),
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2813 gaim_value_new(GAIM_TYPE_STRING));
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2814
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2815 gaim_signal_register(handle, "sending-chat-msg",
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2816 gaim_marshal_VOID__POINTER_POINTER_UINT, NULL, 3,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2817 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2818 GAIM_SUBTYPE_ACCOUNT),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2819 gaim_value_new_outgoing(GAIM_TYPE_STRING),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2820 gaim_value_new(GAIM_TYPE_UINT));
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2821
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2822 gaim_signal_register(handle, "sent-chat-msg",
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2823 gaim_marshal_VOID__POINTER_POINTER_UINT, NULL, 3,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2824 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2825 GAIM_SUBTYPE_ACCOUNT),
6607
d8fd7c29eaf0 [gaim-migrate @ 7131]
Christian Hammond <chipx86@chipx86.com>
parents: 6605
diff changeset
2826 gaim_value_new(GAIM_TYPE_STRING),
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2827 gaim_value_new(GAIM_TYPE_UINT));
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2828
8999
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2829 gaim_signal_register(handle, "receiving-chat-msg",
7511
a899742289c2 [gaim-migrate @ 8124]
Christian Hammond <chipx86@chipx86.com>
parents: 7431
diff changeset
2830 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER,
6634
dd0d238edf21 [gaim-migrate @ 7158]
Christian Hammond <chipx86@chipx86.com>
parents: 6622
diff changeset
2831 gaim_value_new(GAIM_TYPE_BOOLEAN), 4,
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2832 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2833 GAIM_SUBTYPE_ACCOUNT),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2834 gaim_value_new_outgoing(GAIM_TYPE_STRING),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2835 gaim_value_new_outgoing(GAIM_TYPE_STRING),
7511
a899742289c2 [gaim-migrate @ 8124]
Christian Hammond <chipx86@chipx86.com>
parents: 7431
diff changeset
2836 gaim_value_new(GAIM_TYPE_SUBTYPE,
a899742289c2 [gaim-migrate @ 8124]
Christian Hammond <chipx86@chipx86.com>
parents: 7431
diff changeset
2837 GAIM_SUBTYPE_CONVERSATION));
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2838
8999
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2839 gaim_signal_register(handle, "received-chat-msg",
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2840 gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER,
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2841 NULL, 4,
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2842 gaim_value_new(GAIM_TYPE_SUBTYPE,
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2843 GAIM_SUBTYPE_ACCOUNT),
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2844 gaim_value_new(GAIM_TYPE_STRING),
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2845 gaim_value_new(GAIM_TYPE_STRING),
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2846 gaim_value_new(GAIM_TYPE_SUBTYPE,
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2847 GAIM_SUBTYPE_CONVERSATION));
8f838ae3e710 [gaim-migrate @ 9774]
Luke Schierer <lschiere@pidgin.im>
parents: 8998
diff changeset
2848
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2849 gaim_signal_register(handle, "conversation-switching",
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2850 gaim_marshal_VOID__POINTER_POINTER, NULL, 2,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2851 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2852 GAIM_SUBTYPE_CONVERSATION),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2853 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2854 GAIM_SUBTYPE_CONVERSATION));
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2855
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2856 gaim_signal_register(handle, "conversation-switched",
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2857 gaim_marshal_VOID__POINTER_POINTER, NULL, 2,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2858 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2859 GAIM_SUBTYPE_CONVERSATION),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2860 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2861 GAIM_SUBTYPE_CONVERSATION));
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2862
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2863 gaim_signal_register(handle, "conversation-created",
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2864 gaim_marshal_VOID__POINTER, NULL, 1,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2865 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2866 GAIM_SUBTYPE_CONVERSATION));
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2867
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2868 gaim_signal_register(handle, "deleting-conversation",
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2869 gaim_marshal_VOID__POINTER, NULL, 1,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2870 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2871 GAIM_SUBTYPE_CONVERSATION));
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2872
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2873 gaim_signal_register(handle, "buddy-typing",
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2874 gaim_marshal_VOID__POINTER, NULL, 1,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2875 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2876 GAIM_SUBTYPE_CONVERSATION));
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2877
6837
f098765ac919 [gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents: 6787
diff changeset
2878 gaim_signal_register(handle, "buddy-typing-stopped",
f098765ac919 [gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents: 6787
diff changeset
2879 gaim_marshal_VOID__POINTER, NULL, 1,
f098765ac919 [gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents: 6787
diff changeset
2880 gaim_value_new(GAIM_TYPE_SUBTYPE,
f098765ac919 [gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents: 6787
diff changeset
2881 GAIM_SUBTYPE_CONVERSATION));
f098765ac919 [gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents: 6787
diff changeset
2882
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2883 gaim_signal_register(handle, "chat-buddy-joining",
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2884 gaim_marshal_VOID__POINTER_POINTER_UINT, NULL, 3,
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2885 gaim_value_new(GAIM_TYPE_SUBTYPE,
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2886 GAIM_SUBTYPE_CONVERSATION),
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2887 gaim_value_new(GAIM_TYPE_STRING),
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2888 gaim_value_new(GAIM_TYPE_UINT));
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2889
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2890 gaim_signal_register(handle, "chat-buddy-joined",
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2891 gaim_marshal_VOID__POINTER_POINTER_UINT, NULL, 3,
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2892 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2893 GAIM_SUBTYPE_CONVERSATION),
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2894 gaim_value_new(GAIM_TYPE_STRING),
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2895 gaim_value_new(GAIM_TYPE_UINT));
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2896
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2897 gaim_signal_register(handle, "chat-buddy-flags",
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2898 gaim_marshal_VOID__POINTER_POINTER_UINT_UINT, NULL, 4,
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2899 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2900 GAIM_SUBTYPE_CONVERSATION),
9554
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2901 gaim_value_new(GAIM_TYPE_STRING),
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2902 gaim_value_new(GAIM_TYPE_UINT),
8b2451878e26 [gaim-migrate @ 10387]
Luke Schierer <lschiere@pidgin.im>
parents: 9528
diff changeset
2903 gaim_value_new(GAIM_TYPE_UINT));
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2904
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2905 gaim_signal_register(handle, "chat-buddy-leaving",
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2906 gaim_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2907 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2908 GAIM_SUBTYPE_CONVERSATION),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2909 gaim_value_new(GAIM_TYPE_STRING),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2910 gaim_value_new(GAIM_TYPE_STRING));
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2911
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2912 gaim_signal_register(handle, "chat-buddy-left",
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2913 gaim_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2914 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2915 GAIM_SUBTYPE_CONVERSATION),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2916 gaim_value_new(GAIM_TYPE_STRING),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2917 gaim_value_new(GAIM_TYPE_STRING));
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2918
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2919 gaim_signal_register(handle, "chat-inviting-user",
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2920 gaim_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2921 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2922 GAIM_SUBTYPE_CONVERSATION),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2923 gaim_value_new(GAIM_TYPE_STRING),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2924 gaim_value_new_outgoing(GAIM_TYPE_STRING));
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2925
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2926 gaim_signal_register(handle, "chat-invited-user",
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2927 gaim_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2928 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2929 GAIM_SUBTYPE_CONVERSATION),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2930 gaim_value_new(GAIM_TYPE_STRING),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2931 gaim_value_new(GAIM_TYPE_STRING));
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2932
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2933 gaim_signal_register(handle, "chat-invited",
9514
1fac0336890c [gaim-migrate @ 10341]
Luke Schierer <lschiere@pidgin.im>
parents: 9375
diff changeset
2934 gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER_POINTER,
1fac0336890c [gaim-migrate @ 10341]
Luke Schierer <lschiere@pidgin.im>
parents: 9375
diff changeset
2935 NULL, 5,
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2936 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2937 GAIM_SUBTYPE_ACCOUNT),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2938 gaim_value_new(GAIM_TYPE_STRING),
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2939 gaim_value_new(GAIM_TYPE_STRING),
9514
1fac0336890c [gaim-migrate @ 10341]
Luke Schierer <lschiere@pidgin.im>
parents: 9375
diff changeset
2940 gaim_value_new(GAIM_TYPE_STRING),
1fac0336890c [gaim-migrate @ 10341]
Luke Schierer <lschiere@pidgin.im>
parents: 9375
diff changeset
2941 gaim_value_new(GAIM_TYPE_POINTER));
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2942
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2943 gaim_signal_register(handle, "chat-joined",
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2944 gaim_marshal_VOID__POINTER, NULL, 1,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2945 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2946 GAIM_SUBTYPE_CONVERSATION));
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2947
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2948 gaim_signal_register(handle, "chat-left",
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2949 gaim_marshal_VOID__POINTER, NULL, 1,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2950 gaim_value_new(GAIM_TYPE_SUBTYPE,
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6509
diff changeset
2951 GAIM_SUBTYPE_CONVERSATION));
9517
0524b36c701a [gaim-migrate @ 10344]
Luke Schierer <lschiere@pidgin.im>
parents: 9514
diff changeset
2952
0524b36c701a [gaim-migrate @ 10344]
Luke Schierer <lschiere@pidgin.im>
parents: 9514
diff changeset
2953 gaim_signal_register(handle, "chat-topic-changed",
9528
7ca073ddf9b0 [gaim-migrate @ 10355]
Luke Schierer <lschiere@pidgin.im>
parents: 9517
diff changeset
2954 gaim_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3,
9517
0524b36c701a [gaim-migrate @ 10344]
Luke Schierer <lschiere@pidgin.im>
parents: 9514
diff changeset
2955 gaim_value_new(GAIM_TYPE_SUBTYPE,
0524b36c701a [gaim-migrate @ 10344]
Luke Schierer <lschiere@pidgin.im>
parents: 9514
diff changeset
2956 GAIM_SUBTYPE_CONVERSATION),
0524b36c701a [gaim-migrate @ 10344]
Luke Schierer <lschiere@pidgin.im>
parents: 9514
diff changeset
2957 gaim_value_new(GAIM_TYPE_STRING),
0524b36c701a [gaim-migrate @ 10344]
Luke Schierer <lschiere@pidgin.im>
parents: 9514
diff changeset
2958 gaim_value_new(GAIM_TYPE_STRING));
5858
96e5b32e75ad [gaim-migrate @ 6289]
Nathan Walp <nwalp@pidgin.im>
parents: 5776
diff changeset
2959 }
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2960
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2961 void
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2962 gaim_conversations_uninit(void)
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2963 {
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2964 gaim_signals_unregister_by_instance(gaim_conversations_get_handle());
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6478
diff changeset
2965 }