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