Mercurial > pidgin.yaz
annotate src/buddy_chat.c @ 887:c0ff16ef5e75
[gaim-migrate @ 897]
yay
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Tue, 12 Sep 2000 17:08:28 +0000 |
parents | 4a6ab6995439 |
children | 2876c40108cd |
rev | line source |
---|---|
1 | 1 /* |
2 * gaim | |
3 * | |
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 * | |
20 */ | |
21 | |
349
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
344
diff
changeset
|
22 #ifdef HAVE_CONFIG_H |
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
344
diff
changeset
|
23 #include "../config.h" |
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
344
diff
changeset
|
24 #endif |
1 | 25 #include <string.h> |
26 #include <sys/time.h> | |
27 #include <unistd.h> | |
28 #include <stdio.h> | |
29 #include <stdlib.h> | |
30 #include <gtk/gtk.h> | |
31 #include "gtkhtml.h" | |
300
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
226
diff
changeset
|
32 #include <gdk/gdkkeysyms.h> |
1 | 33 |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
34 #include "convo.h" |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
35 |
834
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
36 #include "pixmaps/tmp_send.xpm" |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
37 #include "pixmaps/close.xpm" |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
38 #include "pixmaps/tb_search.xpm" |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
39 |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
40 #include "pixmaps/tb_forward.xpm" |
604
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
41 #include "pixmaps/join.xpm" |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
42 #include "pixmaps/cancel.xpm" |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
43 |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
44 |
1 | 45 static GtkWidget *joinchat; |
46 static GtkWidget *entry; | |
47 static GtkWidget *invite; | |
48 static GtkWidget *inviteentry; | |
49 static GtkWidget *invitemess; | |
692
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
50 static int community; |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
51 extern int state_lock; |
1 | 52 |
53 static void destroy_join_chat() | |
54 { | |
55 if (joinchat) | |
56 gtk_widget_destroy(joinchat); | |
57 joinchat=NULL; | |
58 } | |
59 | |
60 static void destroy_invite() | |
61 { | |
62 if (invite) | |
63 gtk_widget_destroy(invite); | |
64 invite=NULL; | |
65 } | |
66 | |
67 | |
694
150214f1d48b
[gaim-migrate @ 704]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
692
diff
changeset
|
68 struct conversation *find_chat(char *name) |
150214f1d48b
[gaim-migrate @ 704]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
692
diff
changeset
|
69 { |
150214f1d48b
[gaim-migrate @ 704]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
692
diff
changeset
|
70 char cuser[64]; |
150214f1d48b
[gaim-migrate @ 704]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
692
diff
changeset
|
71 struct conversation *c = NULL; |
150214f1d48b
[gaim-migrate @ 704]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
692
diff
changeset
|
72 GList *cnv = buddy_chats; |
150214f1d48b
[gaim-migrate @ 704]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
692
diff
changeset
|
73 |
150214f1d48b
[gaim-migrate @ 704]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
692
diff
changeset
|
74 strcpy(cuser, normalize(name)); |
150214f1d48b
[gaim-migrate @ 704]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
692
diff
changeset
|
75 |
150214f1d48b
[gaim-migrate @ 704]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
692
diff
changeset
|
76 while (cnv) { |
150214f1d48b
[gaim-migrate @ 704]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
692
diff
changeset
|
77 c = (struct conversation *)cnv->data; |
150214f1d48b
[gaim-migrate @ 704]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
692
diff
changeset
|
78 if (!strcasecmp(cuser, normalize(c->name))) { |
150214f1d48b
[gaim-migrate @ 704]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
692
diff
changeset
|
79 return c; |
150214f1d48b
[gaim-migrate @ 704]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
692
diff
changeset
|
80 } |
150214f1d48b
[gaim-migrate @ 704]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
692
diff
changeset
|
81 cnv = cnv->next; |
150214f1d48b
[gaim-migrate @ 704]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
692
diff
changeset
|
82 } |
150214f1d48b
[gaim-migrate @ 704]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
692
diff
changeset
|
83 return NULL; |
150214f1d48b
[gaim-migrate @ 704]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
692
diff
changeset
|
84 } |
1 | 85 |
86 | |
87 static void do_join_chat() | |
88 { | |
89 char *group; | |
90 | |
91 group = gtk_entry_get_text(GTK_ENTRY(entry)); | |
92 | |
93 if (joinchat) { | |
692
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
94 serv_join_chat(community + 4, group); |
1 | 95 gtk_widget_destroy(joinchat); |
96 } | |
97 joinchat=NULL; | |
98 } | |
99 | |
100 | |
101 | |
102 void join_chat() | |
103 { | |
104 GtkWidget *cancel; | |
105 GtkWidget *join; | |
106 GtkWidget *label; | |
107 GtkWidget *bbox; | |
108 GtkWidget *vbox; | |
109 GtkWidget *topbox; | |
457 | 110 GtkWidget *frame; |
692
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
111 GtkWidget *opt; |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
112 GtkWidget *hbox; |
456 | 113 |
1 | 114 if (!joinchat) { |
457 | 115 joinchat = gtk_window_new(GTK_WINDOW_DIALOG); |
116 gtk_window_set_policy(GTK_WINDOW(joinchat), FALSE, FALSE, TRUE); | |
834
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
117 gtk_widget_realize(joinchat); |
1 | 118 bbox = gtk_hbox_new(TRUE, 10); |
119 topbox = gtk_hbox_new(FALSE, 5); | |
120 vbox = gtk_vbox_new(FALSE, 5); | |
121 entry = gtk_entry_new(); | |
692
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
122 hbox = gtk_hbox_new(TRUE, 10); |
1 | 123 |
457 | 124 frame = gtk_frame_new(_("Buddy Chat")); |
456 | 125 |
692
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
126 join = picture_button(joinchat, _("Join"), join_xpm); |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
127 cancel = picture_button(joinchat, _("Cancel"), cancel_xpm); |
456 | 128 |
692
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
129 gtk_box_pack_start(GTK_BOX(bbox), join, FALSE, FALSE, 5); |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
130 gtk_box_pack_end(GTK_BOX(bbox), cancel, FALSE, FALSE, 5); |
456 | 131 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
132 label = gtk_label_new(_("Join what group:")); |
1 | 133 gtk_widget_show(label); |
134 gtk_box_pack_start(GTK_BOX(topbox), label, FALSE, FALSE, 5); | |
135 gtk_box_pack_start(GTK_BOX(topbox), entry, FALSE, FALSE, 5); | |
692
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
136 |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
137 opt = gtk_radio_button_new_with_label(NULL, |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
138 _("AIM Private Chats")); |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
139 gtk_box_pack_start(GTK_BOX(hbox), opt, FALSE, FALSE, 0); |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
140 community = 0; |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
141 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
142 gtk_signal_connect(GTK_OBJECT(opt), "clicked", set_option, &community); |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
143 gtk_widget_show(opt); |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
144 |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
145 opt = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(opt)), |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
146 _("AOL Community Chats")); |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
147 gtk_box_pack_start(GTK_BOX(hbox), opt, FALSE, FALSE, 0); |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
148 gtk_widget_show(opt); |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
149 |
1 | 150 /* And the boxes in the box */ |
151 gtk_box_pack_start(GTK_BOX(vbox), topbox, TRUE, TRUE, 5); | |
692
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
152 gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 5); |
457 | 153 gtk_box_pack_start(GTK_BOX(vbox), bbox, TRUE, TRUE, 5); |
1 | 154 |
155 /* Handle closes right */ | |
156 gtk_signal_connect(GTK_OBJECT(joinchat), "delete_event", | |
157 GTK_SIGNAL_FUNC(destroy_join_chat), joinchat); | |
158 | |
159 gtk_signal_connect(GTK_OBJECT(cancel), "clicked", | |
160 GTK_SIGNAL_FUNC(destroy_join_chat), joinchat); | |
161 gtk_signal_connect(GTK_OBJECT(join), "clicked", | |
162 GTK_SIGNAL_FUNC(do_join_chat), joinchat); | |
163 gtk_signal_connect(GTK_OBJECT(entry), "activate", | |
164 GTK_SIGNAL_FUNC(do_join_chat), joinchat); | |
165 /* Finish up */ | |
166 gtk_widget_show(join); | |
167 gtk_widget_show(cancel); | |
168 gtk_widget_show(entry); | |
169 gtk_widget_show(topbox); | |
692
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
170 gtk_widget_show(hbox); |
1 | 171 gtk_widget_show(bbox); |
172 gtk_widget_show(vbox); | |
457 | 173 gtk_widget_show(frame); |
174 gtk_container_add(GTK_CONTAINER(frame), vbox); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
175 gtk_window_set_title(GTK_WINDOW(joinchat), _("Join Chat")); |
1 | 176 gtk_window_set_focus(GTK_WINDOW(joinchat), entry); |
457 | 177 gtk_container_add(GTK_CONTAINER(joinchat), frame); |
178 gtk_container_set_border_width(GTK_CONTAINER(joinchat), 5); | |
1 | 179 gtk_widget_realize(joinchat); |
180 aol_icon(joinchat->window); | |
181 | |
182 } | |
183 gtk_widget_show(joinchat); | |
184 } | |
185 | |
186 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
187 static void do_invite(GtkWidget *w, struct conversation *b) |
1 | 188 { |
189 char *buddy; | |
190 char *mess; | |
191 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
192 if (!b->is_chat) { |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
193 debug_print("do_invite: expecting chat, got IM\n"); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
194 return; |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
195 } |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
196 |
1 | 197 buddy = gtk_entry_get_text(GTK_ENTRY(inviteentry)); |
198 mess = gtk_entry_get_text(GTK_ENTRY(invitemess)); | |
199 | |
200 if (invite) { | |
201 serv_chat_invite(b->id, mess, buddy); | |
202 gtk_widget_destroy(invite); | |
203 } | |
204 invite=NULL; | |
205 } | |
206 | |
207 | |
208 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
209 void invite_callback(GtkWidget *w, struct conversation *b) |
1 | 210 { |
211 GtkWidget *cancel; | |
212 GtkWidget *invite_btn; | |
213 GtkWidget *label; | |
214 GtkWidget *bbox; | |
215 GtkWidget *vbox; | |
216 GtkWidget *topbox; | |
217 if (!invite) { | |
218 invite = gtk_window_new(GTK_WINDOW_DIALOG); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
219 cancel = gtk_button_new_with_label(_("Cancel")); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
220 invite_btn = gtk_button_new_with_label(_("Invite")); |
1 | 221 bbox = gtk_hbox_new(TRUE, 10); |
222 topbox = gtk_hbox_new(FALSE, 5); | |
223 vbox = gtk_vbox_new(FALSE, 5); | |
224 inviteentry = gtk_entry_new(); | |
225 invitemess = gtk_entry_new(); | |
226 | |
535
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
227 if (display_options & OPT_DISP_COOL_LOOK) |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
228 { |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
229 gtk_button_set_relief(GTK_BUTTON(cancel), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
230 gtk_button_set_relief(GTK_BUTTON(invite_btn), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
231 } |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
232 |
1 | 233 /* Put the buttons in the box */ |
234 gtk_box_pack_start(GTK_BOX(bbox), invite_btn, TRUE, TRUE, 10); | |
235 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 10); | |
236 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
237 label = gtk_label_new(_("Invite who?")); |
1 | 238 gtk_widget_show(label); |
239 gtk_box_pack_start(GTK_BOX(topbox), label, FALSE, FALSE, 5); | |
240 gtk_box_pack_start(GTK_BOX(topbox), inviteentry, FALSE, FALSE, 5); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
241 label = gtk_label_new(_("With message:")); |
1 | 242 gtk_widget_show(label); |
243 gtk_box_pack_start(GTK_BOX(topbox), label, FALSE, FALSE, 5); | |
244 gtk_box_pack_start(GTK_BOX(topbox), invitemess, FALSE, FALSE, 5); | |
245 | |
246 /* And the boxes in the box */ | |
247 gtk_box_pack_start(GTK_BOX(vbox), topbox, TRUE, TRUE, 5); | |
248 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 5); | |
249 | |
250 /* Handle closes right */ | |
251 gtk_signal_connect(GTK_OBJECT(invite), "delete_event", | |
252 GTK_SIGNAL_FUNC(destroy_invite), invite); | |
253 | |
254 gtk_signal_connect(GTK_OBJECT(cancel), "clicked", | |
255 GTK_SIGNAL_FUNC(destroy_invite), b); | |
256 gtk_signal_connect(GTK_OBJECT(invite_btn), "clicked", | |
257 GTK_SIGNAL_FUNC(do_invite), b); | |
258 gtk_signal_connect(GTK_OBJECT(inviteentry), "activate", | |
259 GTK_SIGNAL_FUNC(do_invite), b); | |
260 /* Finish up */ | |
261 gtk_widget_show(invite_btn); | |
262 gtk_widget_show(cancel); | |
263 gtk_widget_show(inviteentry); | |
264 gtk_widget_show(invitemess); | |
265 gtk_widget_show(topbox); | |
266 gtk_widget_show(bbox); | |
267 gtk_widget_show(vbox); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
268 gtk_window_set_title(GTK_WINDOW(invite), _("Invite to Buddy Chat")); |
1 | 269 gtk_window_set_focus(GTK_WINDOW(invite), inviteentry); |
270 gtk_container_add(GTK_CONTAINER(invite), vbox); | |
271 gtk_widget_realize(invite); | |
272 aol_icon(invite->window); | |
273 | |
274 } | |
275 gtk_widget_show(invite); | |
276 } | |
277 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
278 gboolean meify(char *message) { |
415
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
279 /* read /me-ify : if the message (post-HTML) starts with /me, remove |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
280 * the "/me " part of it (including that space) and return TRUE */ |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
281 char *c = message; |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
282 int inside_HTML = 0; /* i really don't like descriptive names */ |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
283 if (!c) return FALSE; /* um... this would be very bad if this happens */ |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
284 while (*c) { |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
285 if (inside_HTML) { |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
286 if (*c == '>') inside_HTML = 0; |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
287 } else { |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
288 if (*c == '<') inside_HTML = 1; |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
289 else break; |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
290 } |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
291 c++; /* i really don't like c++ either */ |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
292 } |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
293 /* k, so now we've gotten past all the HTML crap. */ |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
294 if (!*c) return FALSE; |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
295 if (!strncmp(c, "/me ", 4)) { |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
296 sprintf(c, "%s", c+4); |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
297 return TRUE; |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
298 } else |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
299 return FALSE; |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
300 } |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
301 |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
302 void chat_write(struct conversation *b, char *who, int flag, char *message) |
1 | 303 { |
304 GList *ignore = b->ignored; | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
305 char *str; |
1 | 306 |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
307 if (!b->is_chat) { |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
308 debug_print("chat_write: expecting chat, got IM\n"); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
309 return; |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
310 } |
1 | 311 |
312 while(ignore) { | |
313 if (!strcasecmp(who, ignore->data)) | |
314 return; | |
315 ignore = ignore->next; | |
316 } | |
371
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
317 |
1 | 318 |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
319 if (!(flag & WFLAG_WHISPER)) { |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
320 str = g_strdup(normalize(who)); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
321 if (!strcasecmp(str, normalize(current_user->username))) { |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
322 sprintf(debug_buff, "%s %s\n", normalize(who), normalize(current_user->username)); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
323 debug_print(debug_buff); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
324 if (b->makesound && (sound_options & OPT_SOUND_CHAT_SAY)) |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
325 play_sound(SEND); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
326 flag |= WFLAG_SEND; |
371
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
327 } else { |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
328 if (b->makesound && (sound_options & OPT_SOUND_CHAT_SAY)) |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
329 play_sound(RECEIVE); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
330 flag |= WFLAG_RECV; |
371
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
331 } |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
332 g_free(str); |
1 | 333 } |
334 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
335 write_to_conv(b, message, flag, who); |
1 | 336 } |
337 | |
338 | |
368
9bf1f77985d2
[gaim-migrate @ 378]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
363
diff
changeset
|
339 |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
340 void whisper_callback(GtkWidget *widget, struct conversation *b) |
1 | 341 { |
79 | 342 char buf[BUF_LEN*4]; |
1 | 343 char buf2[BUF_LONG]; |
344 GList *selected; | |
345 char *who; | |
346 | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
300
diff
changeset
|
347 strncpy(buf, gtk_editable_get_chars(GTK_EDITABLE(b->entry), 0, -1), sizeof(buf)/2); |
1 | 348 if (!strlen(buf)) |
349 return; | |
350 | |
351 selected = GTK_LIST(b->list)->selection; | |
352 | |
353 if (!selected) | |
354 return; | |
355 | |
356 | |
357 who = GTK_LABEL(gtk_container_children(GTK_CONTAINER(selected->data))->data)->label; | |
358 | |
359 if (!who) | |
360 return; | |
361 | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
300
diff
changeset
|
362 gtk_editable_delete_text(GTK_EDITABLE(b->entry), 0, -1); |
1 | 363 |
364 escape_text(buf); | |
365 serv_chat_whisper(b->id, who, buf); | |
366 | |
367 g_snprintf(buf2, sizeof(buf2), "%s->%s", current_user->username, who); | |
368 | |
369 chat_write(b, buf2, WFLAG_WHISPER, buf); | |
370 | |
371 gtk_widget_grab_focus(GTK_WIDGET(b->entry)); | |
372 | |
373 | |
374 } | |
375 | |
376 | |
377 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
378 void update_chat_list(struct conversation *b) |
1 | 379 { |
380 GtkWidget *list_item; | |
381 char name[80]; | |
382 char *tmp; | |
383 GList *names = b->in_room; | |
384 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
385 if (!b->is_chat) { |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
386 debug_print("update_chat_list: expecting chat, got IM\n"); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
387 return; |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
388 } |
1 | 389 |
390 gtk_list_clear_items(GTK_LIST(b->list), 0, -1); | |
391 | |
392 | |
393 while(names) { | |
394 tmp = (char *)names->data; | |
395 if (g_list_index(b->ignored, names->data) != -1) | |
396 g_snprintf(name, sizeof(name), "X %s", tmp); | |
397 else | |
398 g_snprintf(name, sizeof(name), "%s", tmp); | |
399 | |
400 list_item = gtk_list_item_new_with_label(name); | |
401 gtk_widget_show(list_item); | |
402 gtk_object_set_user_data(GTK_OBJECT(list_item), tmp); | |
403 | |
404 gtk_list_append_items(GTK_LIST(b->list), g_list_append(NULL, list_item)); | |
405 | |
406 names = names->next; | |
407 } | |
408 | |
409 } | |
410 | |
411 | |
412 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
413 void add_chat_buddy(struct conversation *b, char *buddy) |
1 | 414 { |
415 char *name = g_strdup(buddy); | |
612
12bb64b42ad1
[gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
604
diff
changeset
|
416 char tmp[BUF_LONG]; |
1 | 417 |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
716
diff
changeset
|
418 plugin_event(event_chat_buddy_join, b->name, name, 0); |
1 | 419 b->in_room = g_list_append(b->in_room, name); |
420 | |
421 update_chat_list(b); | |
422 | |
371
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
423 if (b->makesound && (sound_options & OPT_SOUND_CHAT_JOIN)) |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
424 play_sound(BUDDY_ARRIVE); |
612
12bb64b42ad1
[gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
604
diff
changeset
|
425 |
12bb64b42ad1
[gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
604
diff
changeset
|
426 if (display_options & OPT_DISP_CHAT_LOGON) { |
12bb64b42ad1
[gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
604
diff
changeset
|
427 g_snprintf(tmp, sizeof(tmp), _("<B>%s entered the room.</B>"), name); |
12bb64b42ad1
[gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
604
diff
changeset
|
428 write_to_conv(b, tmp, WFLAG_SYSTEM, NULL); |
12bb64b42ad1
[gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
604
diff
changeset
|
429 } |
1 | 430 } |
431 | |
432 | |
433 | |
434 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
435 void remove_chat_buddy(struct conversation *b, char *buddy) |
1 | 436 { |
437 GList *names = b->in_room; | |
612
12bb64b42ad1
[gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
604
diff
changeset
|
438 char tmp[BUF_LONG]; |
1 | 439 |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
716
diff
changeset
|
440 plugin_event(event_chat_buddy_leave, b->name, buddy, 0); |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
441 |
1 | 442 while(names) { |
443 if (!strcasecmp((char *)names->data, buddy)) { | |
444 b->in_room = g_list_remove(b->in_room, names->data); | |
445 update_chat_list(b); | |
446 break; | |
447 } | |
448 names = names->next; | |
449 } | |
371
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
450 |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
451 if (b->makesound && (sound_options & OPT_SOUND_CHAT_JOIN)) |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
452 play_sound(BUDDY_LEAVE); |
612
12bb64b42ad1
[gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
604
diff
changeset
|
453 |
12bb64b42ad1
[gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
604
diff
changeset
|
454 if (display_options & OPT_DISP_CHAT_LOGON) { |
12bb64b42ad1
[gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
604
diff
changeset
|
455 g_snprintf(tmp, sizeof(tmp), _("<B>%s left the room.</B>"), buddy); |
12bb64b42ad1
[gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
604
diff
changeset
|
456 write_to_conv(b, tmp, WFLAG_SYSTEM, NULL); |
12bb64b42ad1
[gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
604
diff
changeset
|
457 } |
1 | 458 } |
459 | |
460 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
461 void im_callback(GtkWidget *w, struct conversation *b) |
1 | 462 { |
463 char *name; | |
464 GList *i; | |
465 struct conversation *c; | |
466 | |
467 i = GTK_LIST(b->list)->selection; | |
468 if (i) | |
469 name = (char *)gtk_object_get_user_data(GTK_OBJECT(i->data)); | |
470 else | |
471 return; | |
472 | |
473 c = find_conversation(name); | |
474 | |
475 if (c != NULL) { | |
476 gdk_window_raise(c->window->window); | |
477 } else { | |
478 c = new_conversation(name); | |
479 } | |
480 | |
481 | |
482 } | |
483 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
484 void ignore_callback(GtkWidget *w, struct conversation *b) |
1 | 485 { |
486 char *name; | |
487 GList *i; | |
488 | |
489 i = GTK_LIST(b->list)->selection; | |
490 if (i) | |
491 name = (char *)gtk_object_get_user_data(GTK_OBJECT(i->data)); | |
492 else | |
493 return; | |
494 | |
495 if (g_list_index(b->ignored, (gpointer)name) == -1) | |
496 b->ignored = g_list_append(b->ignored, name); | |
497 else | |
498 b->ignored = g_list_remove(b->ignored, name); | |
499 | |
500 update_chat_list(b); | |
501 } | |
502 | |
503 | |
504 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
505 void show_new_buddy_chat(struct conversation *b) |
1 | 506 { |
507 GtkWidget *win; | |
508 GtkWidget *text; | |
509 GtkWidget *send; | |
510 GtkWidget *list; | |
511 GtkWidget *invite_btn; | |
512 GtkWidget *whisper; | |
513 GtkWidget *close; | |
514 GtkWidget *chatentry; | |
515 GtkWidget *lbox; | |
516 GtkWidget *bbox; | |
517 GtkWidget *bbox2; | |
518 GtkWidget *im, *ignore, *info; | |
519 GtkWidget *sw; | |
520 GtkWidget *sw2; | |
521 GtkWidget *vbox; | |
223 | 522 GtkWidget *vpaned; |
523 GtkWidget *hpaned; | |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
524 GtkWidget *toolbar; |
844 | 525 |
834
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
526 gboolean dispstyle; |
1 | 527 |
528 win = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
529 b->window = win; | |
530 | |
223 | 531 vpaned = gtk_vpaned_new(); |
532 hpaned = gtk_hpaned_new(); | |
533 | |
26 | 534 gtk_window_set_policy(GTK_WINDOW(win), TRUE, TRUE, TRUE); |
834
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
535 gtk_widget_realize(win); |
26 | 536 |
834
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
537 dispstyle = (display_options & OPT_DISP_CHAT_SHOW_TEXT) ? TRUE : FALSE; |
1 | 538 |
834
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
539 close = picture_button2(win, _("Close"), cancel_xpm, dispstyle); |
844 | 540 |
834
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
541 invite_btn = picture_button2(win, _("Invite"), join_xpm, dispstyle); |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
542 whisper = picture_button2(win, _("Whisper"), tb_forward_xpm, dispstyle); |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
543 send = picture_button2(win, _("Send"), tmp_send_xpm, dispstyle); |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
544 |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
545 im = picture_button2(win, _("IM"), tmp_send_xpm, FALSE); |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
546 ignore = picture_button2(win, _("Ignore"), close_xpm, FALSE); |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
547 info = picture_button2(win, _("Info"), tb_search_xpm, FALSE); |
1 | 548 |
535
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
549 if (display_options & OPT_DISP_COOL_LOOK) |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
550 { |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
551 gtk_button_set_relief(GTK_BUTTON(close), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
552 gtk_button_set_relief(GTK_BUTTON(invite_btn), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
553 gtk_button_set_relief(GTK_BUTTON(whisper), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
554 gtk_button_set_relief(GTK_BUTTON(send), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
555 gtk_button_set_relief(GTK_BUTTON(im), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
556 gtk_button_set_relief(GTK_BUTTON(ignore), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
557 gtk_button_set_relief(GTK_BUTTON(info), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
558 } |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
559 |
1 | 560 text = gtk_html_new(NULL, NULL); |
561 | |
562 b->text = text; | |
563 | |
564 list = gtk_list_new(); | |
565 b->list = list; | |
566 | |
844 | 567 bbox = gtk_hbox_new(FALSE, 5); |
1 | 568 bbox2 = gtk_hbox_new(TRUE, 0); |
569 vbox = gtk_vbox_new(FALSE, 0); | |
570 lbox = gtk_vbox_new(FALSE, 4); | |
646
83c773b5b6dc
[gaim-migrate @ 656]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
615
diff
changeset
|
571 |
223 | 572 chatentry = gtk_text_new( NULL, NULL ); |
573 gtk_text_set_editable(GTK_TEXT(chatentry), TRUE); | |
574 gtk_text_set_word_wrap(GTK_TEXT(chatentry), TRUE); | |
646
83c773b5b6dc
[gaim-migrate @ 656]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
615
diff
changeset
|
575 gtk_object_set_user_data(GTK_OBJECT(chatentry), b); |
83c773b5b6dc
[gaim-migrate @ 656]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
615
diff
changeset
|
576 b->entry = chatentry; |
1 | 577 |
578 gtk_widget_realize(win); | |
579 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
580 toolbar = build_conv_toolbar(b); |
1 | 581 |
582 /* Hack something so we know have an entry click event */ | |
583 | |
584 gtk_signal_connect(GTK_OBJECT(chatentry), "activate", GTK_SIGNAL_FUNC(send_callback),b); | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
585 gtk_signal_connect(GTK_OBJECT(chatentry), "key_press_event", GTK_SIGNAL_FUNC(keypress_callback), b); |
1 | 586 /* Text box */ |
587 | |
588 sw = gtk_scrolled_window_new (NULL, NULL); | |
589 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), | |
590 GTK_POLICY_NEVER, | |
591 GTK_POLICY_ALWAYS); | |
592 gtk_widget_show(sw); | |
593 gtk_container_add(GTK_CONTAINER(sw), text); | |
594 gtk_widget_show(text); | |
595 | |
596 | |
597 GTK_HTML (text)->hadj->step_increment = 10.0; | |
598 GTK_HTML (text)->vadj->step_increment = 10.0; | |
599 gtk_widget_set_usize(sw, 320, 150); | |
600 | |
223 | 601 gtk_paned_pack1(GTK_PANED(hpaned), sw, TRUE, TRUE); |
1 | 602 |
603 sw2 = gtk_scrolled_window_new(NULL, NULL); | |
604 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw2), | |
605 GTK_POLICY_NEVER, | |
606 GTK_POLICY_AUTOMATIC); | |
607 gtk_widget_show(sw2); | |
608 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw2), list); | |
609 | |
610 gtk_box_pack_start(GTK_BOX(lbox), sw2, TRUE, TRUE, 0); | |
226 | 611 gtk_box_pack_start(GTK_BOX(lbox), bbox2, FALSE, FALSE, 5); |
1 | 612 |
613 | |
223 | 614 gtk_paned_pack2(GTK_PANED(hpaned), lbox, TRUE, TRUE); |
1 | 615 gtk_widget_show(list); |
616 | |
617 | |
618 gtk_widget_set_usize(list, 150, 150); | |
619 | |
620 | |
621 /* Ready and pack buttons */ | |
622 gtk_object_set_user_data(GTK_OBJECT(win), b); | |
623 gtk_object_set_user_data(GTK_OBJECT(close), b); | |
624 gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(close_callback),b); | |
625 gtk_signal_connect(GTK_OBJECT(send), "clicked", GTK_SIGNAL_FUNC(send_callback),b); | |
626 gtk_signal_connect(GTK_OBJECT(invite_btn), "clicked", GTK_SIGNAL_FUNC(invite_callback), b); | |
627 gtk_signal_connect(GTK_OBJECT(whisper), "clicked", GTK_SIGNAL_FUNC(whisper_callback), b); | |
628 | |
629 gtk_signal_connect(GTK_OBJECT(im), "clicked", GTK_SIGNAL_FUNC(im_callback), b); | |
630 gtk_signal_connect(GTK_OBJECT(ignore), "clicked", GTK_SIGNAL_FUNC(ignore_callback), b); | |
631 gtk_signal_connect(GTK_OBJECT(info), "clicked", GTK_SIGNAL_FUNC(info_callback), b); | |
632 | |
633 | |
844 | 634 gtk_box_pack_end(GTK_BOX(bbox), close, dispstyle, dispstyle, 5); |
635 gtk_box_pack_end(GTK_BOX(bbox), invite_btn, dispstyle, dispstyle, 5); | |
636 gtk_box_pack_end(GTK_BOX(bbox), whisper, dispstyle, dispstyle, 5); | |
637 gtk_box_pack_end(GTK_BOX(bbox), send, dispstyle, dispstyle, 5); | |
638 | |
639 gtk_box_pack_start(GTK_BOX(bbox2), im, dispstyle, dispstyle, 5); | |
640 gtk_box_pack_start(GTK_BOX(bbox2), ignore, dispstyle, dispstyle, 5); | |
641 gtk_box_pack_start(GTK_BOX(bbox2), info, dispstyle, dispstyle, 5); | |
1 | 642 |
643 /* pack and fill the rest */ | |
644 | |
645 | |
223 | 646 gtk_paned_pack1(GTK_PANED(vpaned), hpaned, TRUE, FALSE); |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
647 gtk_box_pack_start(GTK_BOX(vbox), toolbar, TRUE, TRUE, 5); |
223 | 648 gtk_box_pack_start(GTK_BOX(vbox), chatentry, TRUE, TRUE, 5); |
1 | 649 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 5); |
223 | 650 gtk_paned_pack2(GTK_PANED(vpaned), vbox, TRUE, FALSE); |
1 | 651 |
652 gtk_widget_show(send); | |
653 gtk_widget_show(invite_btn); | |
654 gtk_widget_show(whisper); | |
655 gtk_widget_show(close); | |
656 gtk_widget_show(im); | |
657 gtk_widget_show(ignore); | |
658 gtk_widget_show(info); | |
659 gtk_widget_show(bbox); | |
660 gtk_widget_show(lbox); | |
661 gtk_widget_show(bbox2); | |
662 gtk_widget_show(vbox); | |
223 | 663 gtk_widget_show( vpaned ); |
664 gtk_widget_show( hpaned ); | |
1 | 665 gtk_widget_show(chatentry); |
864 | 666 |
667 if (display_options & OPT_DISP_CHAT_BIG_ENTRY) | |
668 gtk_widget_set_usize(chatentry, 320, 50); | |
669 else | |
670 gtk_widget_set_usize(chatentry, 320, 25); | |
1 | 671 |
223 | 672 gtk_container_add(GTK_CONTAINER(win),vpaned); |
1 | 673 gtk_container_border_width(GTK_CONTAINER(win), 10); |
674 | |
675 gtk_window_set_title(GTK_WINDOW(win), b->name); | |
676 gtk_window_set_focus(GTK_WINDOW(win), chatentry); | |
677 | |
678 gtk_signal_connect(GTK_OBJECT(win), "destroy", GTK_SIGNAL_FUNC(close_callback),b); | |
679 | |
716 | 680 b->font_dialog = NULL; |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
845
diff
changeset
|
681 b->fg_color_dialog = NULL; |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
845
diff
changeset
|
682 b->bg_color_dialog = NULL; |
716 | 683 b->smiley_dialog = NULL; |
684 b->link_dialog = NULL; | |
685 b->log_dialog = NULL; | |
834
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
686 b->send = send; |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
687 b->whisper = whisper; |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
688 b->invite = invite_btn; |
814
a636ac51d15b
[gaim-migrate @ 824]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
689 b->close = close; |
716 | 690 sprintf(b->fontface, "%s", fontface); |
691 b->hasfont = 0; | |
692 b->bgcol = bgcolor; | |
693 b->hasbg = 0; | |
694 b->fgcol = fgcolor; | |
695 b->hasfg = 0; | |
696 | |
615 | 697 gtk_widget_realize(win); |
1 | 698 aol_icon(win->window); |
699 | |
700 gtk_widget_show(win); | |
701 } | |
702 | |
703 | |
704 | |
705 void handle_click_chat(GtkWidget *widget, GdkEventButton *event, struct chat_room *cr) | |
706 { | |
707 if (event->type == GDK_2BUTTON_PRESS && event->button == 1) { | |
708 serv_join_chat(cr->exchange, cr->name); | |
709 } | |
710 } | |
711 | |
712 | |
713 void setup_buddy_chats() | |
714 { | |
21 | 715 GList *list; |
1 | 716 struct chat_room *cr; |
717 GList *crs = chat_rooms; | |
718 GtkWidget *w; | |
719 GtkWidget *item; | |
720 GtkWidget *tree; | |
721 | |
21 | 722 if (buddies == NULL) |
723 return; | |
724 | |
725 list = GTK_TREE(buddies)->children; | |
726 | |
1 | 727 while(list) { |
728 w = (GtkWidget *)list->data; | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
729 if (!strcmp(GTK_LABEL(GTK_BIN(w)->child)->label, _("Buddy Chat"))) { |
1 | 730 gtk_tree_remove_items(GTK_TREE(buddies), list); |
731 list = GTK_TREE(buddies)->children; | |
732 if (!list) | |
733 break; | |
734 } | |
735 list = list->next; | |
736 } | |
737 | |
738 if (crs == NULL) | |
739 return; | |
740 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
741 item = gtk_tree_item_new_with_label(_("Buddy Chat")); |
1 | 742 tree = gtk_tree_new(); |
743 gtk_widget_show(item); | |
744 gtk_widget_show(tree); | |
745 gtk_tree_append(GTK_TREE(buddies), item); | |
746 gtk_tree_item_set_subtree(GTK_TREE_ITEM(item), tree); | |
747 gtk_tree_item_expand(GTK_TREE_ITEM(item)); | |
748 | |
749 while (crs) { | |
750 cr = (struct chat_room *)crs->data; | |
751 | |
752 item = gtk_tree_item_new_with_label(cr->name); | |
753 gtk_object_set_user_data(GTK_OBJECT(item), cr); | |
754 gtk_tree_append(GTK_TREE(tree), item); | |
755 gtk_widget_show(item); | |
756 gtk_signal_connect(GTK_OBJECT(item), "button_press_event", | |
757 GTK_SIGNAL_FUNC(handle_click_chat), | |
758 cr); | |
759 | |
760 crs = crs->next; | |
761 | |
762 } | |
763 | |
764 } | |
834
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
765 |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
766 static GtkWidget *change_text(GtkWidget *win, char *text, GtkWidget *button, char **xpm) |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
767 { |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
768 gboolean dispstyle = (display_options & OPT_DISP_CHAT_SHOW_TEXT) ? TRUE : FALSE; |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
769 GtkWidget *parent = button->parent; |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
770 gtk_widget_destroy(button); |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
771 button = picture_button2(win, text, xpm, dispstyle); |
845
647b110f7a1a
[gaim-migrate @ 855]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
844
diff
changeset
|
772 gtk_box_pack_start(GTK_BOX(parent), button, dispstyle, dispstyle, 5); |
834
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
773 gtk_widget_show(button); |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
774 return button; |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
775 } |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
776 |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
777 void update_chat_button_pix() |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
778 { |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
779 GList *bcs = buddy_chats; |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
780 struct conversation *c; |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
781 |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
782 while (bcs) { |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
783 c = (struct conversation *)bcs->data; |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
784 c->send = change_text(c->window, _("Send"), c->send, tmp_send_xpm); |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
785 c->whisper = change_text(c->window, _("Whisper"), c->whisper, tb_forward_xpm); |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
786 c->invite = change_text(c->window, _("Invite"), c->invite, join_xpm); |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
787 c->close = change_text(c->window, _("Close"), c->close, cancel_xpm); |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
788 gtk_object_set_user_data(GTK_OBJECT(c->close), c); |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
789 gtk_signal_connect(GTK_OBJECT(c->close), "clicked", GTK_SIGNAL_FUNC(close_callback),c); |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
790 gtk_signal_connect(GTK_OBJECT(c->send), "clicked", GTK_SIGNAL_FUNC(send_callback),c); |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
791 gtk_signal_connect(GTK_OBJECT(c->invite), "clicked", GTK_SIGNAL_FUNC(invite_callback),c); |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
792 gtk_signal_connect(GTK_OBJECT(c->whisper), "clicked", GTK_SIGNAL_FUNC(whisper_callback),c); |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
793 bcs = bcs->next; |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
794 } |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
795 } |