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