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