Mercurial > pidgin
annotate src/buddy_chat.c @ 448:737dc468d778
[gaim-migrate @ 458]
Pretty.
committer: Tailor Script <tailor@pidgin.im>
author | Rob Flynn <gaim@robflynn.com> |
---|---|
date | Fri, 30 Jun 2000 03:54:36 +0000 |
parents | a266fd221c3c |
children | 9be0b001645b |
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 "gaim.h" | |
32 #include "gtkhtml.h" | |
300
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
226
diff
changeset
|
33 #include <gdk/gdkkeysyms.h> |
1 | 34 |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
35 #include "pixmaps/underline.xpm" |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
36 #include "pixmaps/bold.xpm" |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
37 #include "pixmaps/italic.xpm" |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
38 #include "pixmaps/small.xpm" |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
39 #include "pixmaps/normal.xpm" |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
40 #include "pixmaps/big.xpm" |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
41 #include "pixmaps/fontface.xpm" |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
42 #include "pixmaps/palette.xpm" |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
43 #include "pixmaps/link.xpm" |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
44 #include "pixmaps/strike.xpm" |
371
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
45 #include "pixmaps/speaker.xpm" |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
46 #include "pixmaps/wood.xpm" |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
47 |
411
a330017b3aa4
[gaim-migrate @ 421]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
391
diff
changeset
|
48 /* |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
49 #include "pixmaps/smile_happy.xpm" |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
50 #include "pixmaps/smile_sad.xpm" |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
51 #include "pixmaps/smile_wink.xpm" |
411
a330017b3aa4
[gaim-migrate @ 421]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
391
diff
changeset
|
52 */ |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
53 |
1 | 54 static GtkWidget *joinchat; |
55 static GtkWidget *entry; | |
56 static GtkWidget *invite; | |
57 static GtkWidget *inviteentry; | |
58 static GtkWidget *invitemess; | |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
59 extern int state_lock; |
1 | 60 |
61 static void destroy_join_chat() | |
62 { | |
63 if (joinchat) | |
64 gtk_widget_destroy(joinchat); | |
65 joinchat=NULL; | |
66 } | |
67 | |
68 static void destroy_invite() | |
69 { | |
70 if (invite) | |
71 gtk_widget_destroy(invite); | |
72 invite=NULL; | |
73 } | |
74 | |
75 | |
76 | |
77 | |
78 static void do_join_chat() | |
79 { | |
80 char *group; | |
81 | |
82 group = gtk_entry_get_text(GTK_ENTRY(entry)); | |
83 | |
84 if (joinchat) { | |
85 serv_join_chat(4, group); | |
86 gtk_widget_destroy(joinchat); | |
87 } | |
88 joinchat=NULL; | |
89 } | |
90 | |
91 | |
92 | |
93 void join_chat() | |
94 { | |
95 GtkWidget *cancel; | |
96 GtkWidget *join; | |
97 GtkWidget *label; | |
98 GtkWidget *bbox; | |
99 GtkWidget *vbox; | |
100 GtkWidget *topbox; | |
101 if (!joinchat) { | |
102 joinchat = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
103 cancel = gtk_button_new_with_label(_("Cancel")); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
104 join = gtk_button_new_with_label(_("Join")); |
1 | 105 bbox = gtk_hbox_new(TRUE, 10); |
106 topbox = gtk_hbox_new(FALSE, 5); | |
107 vbox = gtk_vbox_new(FALSE, 5); | |
108 entry = gtk_entry_new(); | |
109 | |
110 /* Put the buttons in the box */ | |
111 gtk_box_pack_start(GTK_BOX(bbox), join, TRUE, TRUE, 10); | |
112 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 10); | |
113 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
114 label = gtk_label_new(_("Join what group:")); |
1 | 115 gtk_widget_show(label); |
116 gtk_box_pack_start(GTK_BOX(topbox), label, FALSE, FALSE, 5); | |
117 gtk_box_pack_start(GTK_BOX(topbox), entry, FALSE, FALSE, 5); | |
118 | |
119 /* And the boxes in the box */ | |
120 gtk_box_pack_start(GTK_BOX(vbox), topbox, TRUE, TRUE, 5); | |
121 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 5); | |
122 | |
123 /* Handle closes right */ | |
124 gtk_signal_connect(GTK_OBJECT(joinchat), "delete_event", | |
125 GTK_SIGNAL_FUNC(destroy_join_chat), joinchat); | |
126 | |
127 gtk_signal_connect(GTK_OBJECT(cancel), "clicked", | |
128 GTK_SIGNAL_FUNC(destroy_join_chat), joinchat); | |
129 gtk_signal_connect(GTK_OBJECT(join), "clicked", | |
130 GTK_SIGNAL_FUNC(do_join_chat), joinchat); | |
131 gtk_signal_connect(GTK_OBJECT(entry), "activate", | |
132 GTK_SIGNAL_FUNC(do_join_chat), joinchat); | |
133 /* Finish up */ | |
134 gtk_widget_show(join); | |
135 gtk_widget_show(cancel); | |
136 gtk_widget_show(entry); | |
137 gtk_widget_show(topbox); | |
138 gtk_widget_show(bbox); | |
139 gtk_widget_show(vbox); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
140 gtk_window_set_title(GTK_WINDOW(joinchat), _("Join Chat")); |
1 | 141 gtk_window_set_focus(GTK_WINDOW(joinchat), entry); |
142 gtk_container_add(GTK_CONTAINER(joinchat), vbox); | |
143 gtk_widget_realize(joinchat); | |
144 aol_icon(joinchat->window); | |
145 | |
146 } | |
147 gtk_widget_show(joinchat); | |
148 } | |
149 | |
150 | |
151 static void do_invite(GtkWidget *w, struct buddy_chat *b) | |
152 { | |
153 char *buddy; | |
154 char *mess; | |
155 | |
156 buddy = gtk_entry_get_text(GTK_ENTRY(inviteentry)); | |
157 mess = gtk_entry_get_text(GTK_ENTRY(invitemess)); | |
158 | |
159 if (invite) { | |
160 serv_chat_invite(b->id, mess, buddy); | |
161 gtk_widget_destroy(invite); | |
162 } | |
163 invite=NULL; | |
164 } | |
165 | |
166 | |
167 | |
168 static void invite_callback(GtkWidget *w, struct buddy_chat *b) | |
169 { | |
170 GtkWidget *cancel; | |
171 GtkWidget *invite_btn; | |
172 GtkWidget *label; | |
173 GtkWidget *bbox; | |
174 GtkWidget *vbox; | |
175 GtkWidget *topbox; | |
176 if (!invite) { | |
177 invite = gtk_window_new(GTK_WINDOW_DIALOG); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
178 cancel = gtk_button_new_with_label(_("Cancel")); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
179 invite_btn = gtk_button_new_with_label(_("Invite")); |
1 | 180 bbox = gtk_hbox_new(TRUE, 10); |
181 topbox = gtk_hbox_new(FALSE, 5); | |
182 vbox = gtk_vbox_new(FALSE, 5); | |
183 inviteentry = gtk_entry_new(); | |
184 invitemess = gtk_entry_new(); | |
185 | |
186 /* Put the buttons in the box */ | |
187 gtk_box_pack_start(GTK_BOX(bbox), invite_btn, TRUE, TRUE, 10); | |
188 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 10); | |
189 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
190 label = gtk_label_new(_("Invite who?")); |
1 | 191 gtk_widget_show(label); |
192 gtk_box_pack_start(GTK_BOX(topbox), label, FALSE, FALSE, 5); | |
193 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
|
194 label = gtk_label_new(_("With message:")); |
1 | 195 gtk_widget_show(label); |
196 gtk_box_pack_start(GTK_BOX(topbox), label, FALSE, FALSE, 5); | |
197 gtk_box_pack_start(GTK_BOX(topbox), invitemess, FALSE, FALSE, 5); | |
198 | |
199 /* And the boxes in the box */ | |
200 gtk_box_pack_start(GTK_BOX(vbox), topbox, TRUE, TRUE, 5); | |
201 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 5); | |
202 | |
203 /* Handle closes right */ | |
204 gtk_signal_connect(GTK_OBJECT(invite), "delete_event", | |
205 GTK_SIGNAL_FUNC(destroy_invite), invite); | |
206 | |
207 gtk_signal_connect(GTK_OBJECT(cancel), "clicked", | |
208 GTK_SIGNAL_FUNC(destroy_invite), b); | |
209 gtk_signal_connect(GTK_OBJECT(invite_btn), "clicked", | |
210 GTK_SIGNAL_FUNC(do_invite), b); | |
211 gtk_signal_connect(GTK_OBJECT(inviteentry), "activate", | |
212 GTK_SIGNAL_FUNC(do_invite), b); | |
213 /* Finish up */ | |
214 gtk_widget_show(invite_btn); | |
215 gtk_widget_show(cancel); | |
216 gtk_widget_show(inviteentry); | |
217 gtk_widget_show(invitemess); | |
218 gtk_widget_show(topbox); | |
219 gtk_widget_show(bbox); | |
220 gtk_widget_show(vbox); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
221 gtk_window_set_title(GTK_WINDOW(invite), _("Invite to Buddy Chat")); |
1 | 222 gtk_window_set_focus(GTK_WINDOW(invite), inviteentry); |
223 gtk_container_add(GTK_CONTAINER(invite), vbox); | |
224 gtk_widget_realize(invite); | |
225 aol_icon(invite->window); | |
226 | |
227 } | |
228 gtk_widget_show(invite); | |
229 } | |
230 | |
415
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
231 static gboolean meify(char *message) { |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
232 /* 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
|
233 * the "/me " part of it (including that space) and return TRUE */ |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
234 char *c = message; |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
235 int inside_HTML = 0; /* i really don't like descriptive names */ |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
236 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
|
237 while (*c) { |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
238 if (inside_HTML) { |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
239 if (*c == '>') inside_HTML = 0; |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
240 } else { |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
241 if (*c == '<') inside_HTML = 1; |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
242 else break; |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
243 } |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
244 c++; /* i really don't like c++ either */ |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
245 } |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
246 /* k, so now we've gotten past all the HTML crap. */ |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
247 if (!*c) return FALSE; |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
248 if (!strncmp(c, "/me ", 4)) { |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
249 sprintf(c, "%s", c+4); |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
250 return TRUE; |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
251 } else |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
252 return FALSE; |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
253 } |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
254 |
1 | 255 void chat_write(struct buddy_chat *b, char *who, int flag, char *message) |
256 { | |
257 char *buf; | |
258 GList *ignore = b->ignored; | |
259 char *str; | |
260 char colour[10]; | |
261 | |
262 | |
263 while(ignore) { | |
264 if (!strcasecmp(who, ignore->data)) | |
265 return; | |
266 ignore = ignore->next; | |
267 } | |
371
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
268 |
1 | 269 |
270 buf = g_malloc(BUF_LONG); | |
271 | |
272 if (flag & WFLAG_WHISPER) { | |
415
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
273 if (meify(message)) { |
371
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
274 str = g_malloc(64); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
275 g_snprintf(str, 62, "***%s", who); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
276 strcpy(colour, "#6C2585\0"); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
277 } else { |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
278 str = g_malloc(64); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
279 g_snprintf(str, 62, "*%s*:", who); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
280 strcpy(colour, "#00ff00\0"); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
281 } |
1 | 282 } else { |
415
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
283 if (meify(message)) { |
372
8c3b075d7aba
[gaim-migrate @ 382]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
371
diff
changeset
|
284 str = g_strdup(normalize(who)); |
8c3b075d7aba
[gaim-migrate @ 382]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
371
diff
changeset
|
285 if (!strcasecmp(str, normalize(current_user->username))) { |
8c3b075d7aba
[gaim-migrate @ 382]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
371
diff
changeset
|
286 if (b->makesound && (sound_options & OPT_SOUND_CHAT_SAY)) |
8c3b075d7aba
[gaim-migrate @ 382]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
371
diff
changeset
|
287 play_sound(SEND); |
8c3b075d7aba
[gaim-migrate @ 382]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
371
diff
changeset
|
288 } else { |
8c3b075d7aba
[gaim-migrate @ 382]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
371
diff
changeset
|
289 if (b->makesound && (sound_options & OPT_SOUND_CHAT_SAY)) |
8c3b075d7aba
[gaim-migrate @ 382]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
371
diff
changeset
|
290 play_sound(RECEIVE); |
8c3b075d7aba
[gaim-migrate @ 382]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
371
diff
changeset
|
291 } |
8c3b075d7aba
[gaim-migrate @ 382]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
371
diff
changeset
|
292 g_free(str); |
371
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
293 str = g_malloc(64); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
294 g_snprintf(str, 62, "***%s", who); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
295 strcpy(colour, "#6C2585\0"); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
296 } else { |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
297 str = g_strdup(normalize(who)); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
298 if (!strcasecmp(str, normalize(current_user->username))) { |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
299 if (b->makesound && (sound_options & OPT_SOUND_CHAT_SAY)) |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
300 play_sound(SEND); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
301 strcpy(colour, "#0000ff\0"); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
302 } else { |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
303 if (b->makesound && (sound_options & OPT_SOUND_CHAT_SAY)) |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
304 play_sound(RECEIVE); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
305 strcpy(colour, "#ff0000\0"); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
306 } |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
307 g_free(str); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
308 str = g_malloc(64); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
309 g_snprintf(str, 62, "%s:", who); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
310 } |
1 | 311 } |
312 | |
313 | |
314 | |
315 if (display_options & OPT_DISP_SHOW_TIME) | |
371
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
316 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"%s\"><B>%s %s </B></FONT>", colour, date(), str); |
1 | 317 else |
371
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
318 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"%s\"><B>%s </B></FONT>", colour, str); |
1 | 319 |
320 gtk_html_freeze(GTK_HTML(b->text)); | |
321 | |
322 gtk_html_append_text(GTK_HTML(b->text), buf, 0); | |
323 gtk_html_append_text(GTK_HTML(b->text), message, (display_options & OPT_DISP_IGNORE_COLOUR) ? HTML_OPTION_NO_COLOURS : 0); | |
324 gtk_html_append_text(GTK_HTML(b->text), "<BR>", 0); | |
325 | |
326 gtk_html_thaw(GTK_HTML(b->text)); | |
327 | |
373
1d29321843b0
[gaim-migrate @ 383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
372
diff
changeset
|
328 if (general_options & OPT_GEN_POPUP_CHAT) |
1d29321843b0
[gaim-migrate @ 383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
372
diff
changeset
|
329 gdk_window_show(b->window->window); |
1d29321843b0
[gaim-migrate @ 383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
372
diff
changeset
|
330 |
1d29321843b0
[gaim-migrate @ 383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
372
diff
changeset
|
331 if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(b->name)) { |
1d29321843b0
[gaim-migrate @ 383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
372
diff
changeset
|
332 char *t1; |
1d29321843b0
[gaim-migrate @ 383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
372
diff
changeset
|
333 FILE *fd; |
1d29321843b0
[gaim-migrate @ 383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
372
diff
changeset
|
334 |
1d29321843b0
[gaim-migrate @ 383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
372
diff
changeset
|
335 t1 = g_malloc(256); |
1d29321843b0
[gaim-migrate @ 383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
372
diff
changeset
|
336 snprintf(t1, 256, "%s.chat", b->name); |
1d29321843b0
[gaim-migrate @ 383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
372
diff
changeset
|
337 fd = open_log_file(t1); |
1d29321843b0
[gaim-migrate @ 383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
372
diff
changeset
|
338 g_free(t1); |
1d29321843b0
[gaim-migrate @ 383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
372
diff
changeset
|
339 if (general_options & OPT_GEN_STRIP_HTML) { |
1d29321843b0
[gaim-migrate @ 383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
372
diff
changeset
|
340 t1 = strip_html(message); |
1d29321843b0
[gaim-migrate @ 383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
372
diff
changeset
|
341 if (display_options & OPT_DISP_SHOW_TIME) |
1d29321843b0
[gaim-migrate @ 383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
372
diff
changeset
|
342 fprintf(fd, "%s %s %s\n", date(), str, t1); |
1d29321843b0
[gaim-migrate @ 383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
372
diff
changeset
|
343 else |
1d29321843b0
[gaim-migrate @ 383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
372
diff
changeset
|
344 fprintf(fd, "%s %s\n", str, t1); |
1d29321843b0
[gaim-migrate @ 383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
372
diff
changeset
|
345 g_free(t1); |
1d29321843b0
[gaim-migrate @ 383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
372
diff
changeset
|
346 } else { |
1d29321843b0
[gaim-migrate @ 383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
372
diff
changeset
|
347 if (display_options & OPT_DISP_SHOW_TIME) |
1d29321843b0
[gaim-migrate @ 383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
372
diff
changeset
|
348 fprintf(fd, "%s %s %s\n", date(), str, message); |
1d29321843b0
[gaim-migrate @ 383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
372
diff
changeset
|
349 else |
1d29321843b0
[gaim-migrate @ 383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
372
diff
changeset
|
350 fprintf(fd, "%s %s\n", str, message); |
1d29321843b0
[gaim-migrate @ 383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
372
diff
changeset
|
351 } |
1d29321843b0
[gaim-migrate @ 383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
372
diff
changeset
|
352 fclose(fd); |
1d29321843b0
[gaim-migrate @ 383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
372
diff
changeset
|
353 } |
1d29321843b0
[gaim-migrate @ 383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
372
diff
changeset
|
354 |
371
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
355 g_free(str); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
356 g_free(buf); |
1 | 357 } |
358 | |
359 static void close_callback(GtkWidget *widget, struct buddy_chat *b) | |
360 { | |
361 if (b->window) | |
362 gtk_widget_destroy(b->window); | |
363 b->window = NULL; | |
368
9bf1f77985d2
[gaim-migrate @ 378]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
363
diff
changeset
|
364 |
9bf1f77985d2
[gaim-migrate @ 378]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
363
diff
changeset
|
365 serv_chat_leave(b->id); |
1 | 366 } |
367 | |
368 | |
368
9bf1f77985d2
[gaim-migrate @ 378]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
363
diff
changeset
|
369 |
1 | 370 static void whisper_callback(GtkWidget *widget, struct buddy_chat *b) |
371 { | |
79 | 372 char buf[BUF_LEN*4]; |
1 | 373 char buf2[BUF_LONG]; |
374 GList *selected; | |
375 char *who; | |
376 | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
300
diff
changeset
|
377 strncpy(buf, gtk_editable_get_chars(GTK_EDITABLE(b->entry), 0, -1), sizeof(buf)/2); |
1 | 378 if (!strlen(buf)) |
379 return; | |
380 | |
381 selected = GTK_LIST(b->list)->selection; | |
382 | |
383 if (!selected) | |
384 return; | |
385 | |
386 | |
387 who = GTK_LABEL(gtk_container_children(GTK_CONTAINER(selected->data))->data)->label; | |
388 | |
389 if (!who) | |
390 return; | |
391 | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
300
diff
changeset
|
392 gtk_editable_delete_text(GTK_EDITABLE(b->entry), 0, -1); |
1 | 393 |
394 escape_text(buf); | |
395 serv_chat_whisper(b->id, who, buf); | |
396 | |
397 g_snprintf(buf2, sizeof(buf2), "%s->%s", current_user->username, who); | |
398 | |
399 chat_write(b, buf2, WFLAG_WHISPER, buf); | |
400 | |
401 gtk_widget_grab_focus(GTK_WIDGET(b->entry)); | |
402 | |
403 | |
404 } | |
405 | |
406 | |
407 static void send_callback(GtkWidget *widget, struct buddy_chat *b) | |
408 { | |
79 | 409 char buf[BUF_LEN*4]; |
1 | 410 |
223 | 411 strncpy(buf, gtk_editable_get_chars(GTK_EDITABLE(b->entry), 0, -1), sizeof(buf)/2); |
1 | 412 if (!strlen(buf)) |
413 return; | |
414 | |
223 | 415 gtk_editable_delete_text(GTK_EDITABLE(b->entry), 0, -1); |
1 | 416 |
417 if (general_options & OPT_GEN_SEND_LINKS) { | |
418 linkify_text(buf); | |
419 } | |
420 | |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
421 #ifdef GAIM_PLUGINS |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
422 { |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
423 GList *c = callbacks; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
424 struct gaim_callback *g; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
425 void (*function)(char *, char **, void *); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
426 char *buffy = g_strdup(buf); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
427 while (c) { |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
428 g = (struct gaim_callback *)c->data; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
429 if (g->event == event_chat_send && g->function != NULL) { |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
430 function = g->function; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
431 (*function)(b->name, &buffy, g->data); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
432 } |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
433 c = c->next; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
434 } |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
435 if (!buffy) |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
436 return; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
437 g_snprintf(buf, sizeof buf, "%s", buffy); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
438 g_free(buffy); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
439 } |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
440 #endif |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
441 |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
442 |
1 | 443 escape_text(buf); |
444 serv_chat_send(b->id, buf); | |
445 | |
446 gtk_widget_grab_focus(GTK_WIDGET(b->entry)); | |
447 | |
199
be5fbefdb195
[gaim-migrate @ 209]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
79
diff
changeset
|
448 serv_set_idle(0); |
375
1eae69f076d2
[gaim-migrate @ 385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
373
diff
changeset
|
449 |
1eae69f076d2
[gaim-migrate @ 385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
373
diff
changeset
|
450 if ((general_options & OPT_GEN_BACK_ON_IM) && awaymessage != NULL) { |
1eae69f076d2
[gaim-migrate @ 385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
373
diff
changeset
|
451 do_im_back(); |
1eae69f076d2
[gaim-migrate @ 385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
373
diff
changeset
|
452 } |
1 | 453 } |
454 | |
455 | |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
456 static gboolean chat_keypress_callback(GtkWidget *entry, GdkEventKey *event, struct buddy_chat *c) |
300
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
226
diff
changeset
|
457 { |
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
226
diff
changeset
|
458 int pos; |
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
226
diff
changeset
|
459 if (event->keyval == GDK_Return) { |
363
1c4ce1da3946
[gaim-migrate @ 373]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
460 if (!(event->state & GDK_SHIFT_MASK) |
1c4ce1da3946
[gaim-migrate @ 373]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
461 && (general_options & OPT_GEN_ENTER_SENDS)) { |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
462 gtk_signal_emit_by_name(GTK_OBJECT(entry), "activate", c); |
300
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
226
diff
changeset
|
463 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
226
diff
changeset
|
464 } else { |
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
226
diff
changeset
|
465 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "keypress_event"); |
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
226
diff
changeset
|
466 pos = gtk_editable_get_position(GTK_EDITABLE(entry)); |
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
226
diff
changeset
|
467 gtk_editable_insert_text(GTK_EDITABLE(entry), "\n", 1, &pos); |
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
226
diff
changeset
|
468 } |
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
226
diff
changeset
|
469 } |
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
226
diff
changeset
|
470 |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
471 /* now we see if we need to unset any buttons */ |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
472 |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
473 if (invert_tags(c->entry, "<B>", "</B>", 0)) |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
474 quiet_set(c->bold, TRUE); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
475 else if (count_tag(c->entry, "<B>", "</B>")) |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
476 quiet_set(c->bold, TRUE); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
477 else |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
478 quiet_set(c->bold,FALSE); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
479 |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
480 if (invert_tags(c->entry, "<I>", "</I>", 0)) |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
481 quiet_set(c->italic, TRUE); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
482 else if (count_tag(c->entry, "<I>", "</I>")) |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
483 quiet_set(c->italic, TRUE); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
484 else |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
485 quiet_set(c->italic, FALSE); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
486 |
371
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
487 if (invert_tags(entry, "<FONT COLOR", "</FONT>", 0)) |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
488 quiet_set(c->palette, TRUE); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
489 else if (count_tag(entry, "<FONT COLOR", "</FONT>")) |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
490 quiet_set(c->palette, TRUE); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
491 else |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
492 quiet_set(c->palette, FALSE); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
493 |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
494 if (invert_tags(entry, "<FONT FACE", "</FONT>", 0)) |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
495 quiet_set(c->font, TRUE); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
496 else if (count_tag(entry, "<FONT FACE", "</FONT>")) |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
497 quiet_set(c->font, TRUE); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
498 else |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
499 quiet_set(c->font, FALSE); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
500 |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
501 if (invert_tags(c->entry, "<A HREF", "</A>", 0)) |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
502 quiet_set(c->link, TRUE); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
503 else if (count_tag(c->entry, "<A HREF", "</A>")) |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
504 quiet_set(c->link, TRUE); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
505 else |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
506 quiet_set(c->link, FALSE); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
507 |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
508 if (invert_tags(entry, "<U>", "</U>", 0)) |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
509 quiet_set(c->underline, TRUE); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
510 else if (count_tag(entry, "<U>", "</U>")) |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
511 quiet_set(c->underline, TRUE); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
512 else |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
513 quiet_set(c->underline, FALSE); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
514 |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
515 if (invert_tags(entry, "<STRIKE>", "</STRIKE>", 0)) |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
516 quiet_set(c->strike, TRUE); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
517 else if (count_tag(entry, "<STRIKE>", "</STRIKE>")) |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
518 quiet_set(c->strike, TRUE); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
519 else |
371
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
520 quiet_set(c->strike, FALSE); |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
521 |
300
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
226
diff
changeset
|
522 return TRUE; |
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
226
diff
changeset
|
523 |
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
226
diff
changeset
|
524 } |
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
226
diff
changeset
|
525 |
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
226
diff
changeset
|
526 |
1 | 527 void update_chat_list(struct buddy_chat *b) |
528 { | |
529 GtkWidget *list_item; | |
530 char name[80]; | |
531 char *tmp; | |
532 GList *names = b->in_room; | |
533 | |
534 | |
535 gtk_list_clear_items(GTK_LIST(b->list), 0, -1); | |
536 | |
537 | |
538 while(names) { | |
539 tmp = (char *)names->data; | |
540 if (g_list_index(b->ignored, names->data) != -1) | |
541 g_snprintf(name, sizeof(name), "X %s", tmp); | |
542 else | |
543 g_snprintf(name, sizeof(name), "%s", tmp); | |
544 | |
545 list_item = gtk_list_item_new_with_label(name); | |
546 gtk_widget_show(list_item); | |
547 gtk_object_set_user_data(GTK_OBJECT(list_item), tmp); | |
548 | |
549 gtk_list_append_items(GTK_LIST(b->list), g_list_append(NULL, list_item)); | |
550 | |
551 names = names->next; | |
552 } | |
553 | |
554 } | |
555 | |
556 | |
557 | |
558 void add_chat_buddy(struct buddy_chat *b, char *buddy) | |
559 { | |
560 char *name = g_strdup(buddy); | |
561 | |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
562 #ifdef GAIM_PLUGINS |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
563 GList *c = callbacks; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
564 struct gaim_callback *g; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
565 void (*function)(char *, char *, void *); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
566 while (c) { |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
567 g = (struct gaim_callback *)c->data; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
568 if (g->event == event_chat_buddy_join && g->function != NULL) { |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
569 function = g->function; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
570 (*function)(b->name, name, g->data); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
571 } |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
572 c = c->next; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
573 } |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
574 #endif |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
575 |
1 | 576 b->in_room = g_list_append(b->in_room, name); |
577 | |
578 update_chat_list(b); | |
579 | |
371
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
580 if (b->makesound && (sound_options & OPT_SOUND_CHAT_JOIN)) |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
581 play_sound(BUDDY_ARRIVE); |
1 | 582 } |
583 | |
584 | |
585 | |
586 | |
587 void remove_chat_buddy(struct buddy_chat *b, char *buddy) | |
588 { | |
589 GList *names = b->in_room; | |
590 | |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
591 #ifdef GAIM_PLUGINS |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
592 GList *c = callbacks; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
593 struct gaim_callback *g; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
594 void (*function)(char *, char *, void *); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
595 while (c) { |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
596 g = (struct gaim_callback *)c->data; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
597 if (g->event == event_chat_buddy_leave && g->function != NULL) { |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
598 function = g->function; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
599 (*function)(b->name, buddy, g->data); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
600 } |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
601 c = c->next; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
602 } |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
603 #endif |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
604 |
1 | 605 while(names) { |
606 if (!strcasecmp((char *)names->data, buddy)) { | |
607 b->in_room = g_list_remove(b->in_room, names->data); | |
608 update_chat_list(b); | |
609 break; | |
610 } | |
611 names = names->next; | |
612 } | |
371
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
613 |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
614 if (b->makesound && (sound_options & OPT_SOUND_CHAT_JOIN)) |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
615 play_sound(BUDDY_LEAVE); |
1 | 616 } |
617 | |
618 | |
619 static void im_callback(GtkWidget *w, struct buddy_chat *b) | |
620 { | |
621 char *name; | |
622 GList *i; | |
623 struct conversation *c; | |
624 | |
625 i = GTK_LIST(b->list)->selection; | |
626 if (i) | |
627 name = (char *)gtk_object_get_user_data(GTK_OBJECT(i->data)); | |
628 else | |
629 return; | |
630 | |
631 c = find_conversation(name); | |
632 | |
633 if (c != NULL) { | |
634 gdk_window_raise(c->window->window); | |
635 } else { | |
636 c = new_conversation(name); | |
637 } | |
638 | |
639 | |
640 } | |
641 | |
642 static void ignore_callback(GtkWidget *w, struct buddy_chat *b) | |
643 { | |
644 char *name; | |
645 GList *i; | |
646 | |
647 i = GTK_LIST(b->list)->selection; | |
648 if (i) | |
649 name = (char *)gtk_object_get_user_data(GTK_OBJECT(i->data)); | |
650 else | |
651 return; | |
652 | |
653 if (g_list_index(b->ignored, (gpointer)name) == -1) | |
654 b->ignored = g_list_append(b->ignored, name); | |
655 else | |
656 b->ignored = g_list_remove(b->ignored, name); | |
657 | |
658 update_chat_list(b); | |
659 } | |
660 | |
661 static void info_callback(GtkWidget *w, struct buddy_chat *b) | |
662 { | |
663 char *name; | |
664 GList *i; | |
665 | |
666 i = GTK_LIST(b->list)->selection; | |
667 if (i) | |
668 name = (char *)gtk_object_get_user_data(GTK_OBJECT(i->data)); | |
669 else | |
670 return; | |
671 | |
672 serv_get_info(name); | |
673 } | |
674 | |
675 | |
676 | |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
677 |
1 | 678 void show_new_buddy_chat(struct buddy_chat *b) |
679 { | |
680 GtkWidget *win; | |
681 GtkWidget *text; | |
682 GtkWidget *send; | |
683 GtkWidget *list; | |
684 GtkWidget *invite_btn; | |
685 GtkWidget *whisper; | |
686 GtkWidget *close; | |
687 GtkWidget *chatentry; | |
688 GtkWidget *lbox; | |
689 GtkWidget *bbox; | |
690 GtkWidget *bbox2; | |
691 GtkWidget *im, *ignore, *info; | |
692 GtkWidget *sw; | |
693 GtkWidget *sw2; | |
694 GtkWidget *vbox; | |
223 | 695 GtkWidget *vpaned; |
696 GtkWidget *hpaned; | |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
697 GtkWidget *toolbar; |
371
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
698 GdkPixmap *strike_i, *small_i, *normal_i, *big_i, *bold_i, *italic_i, *underline_i, *speaker_i, *wood_i, *palette_i, *link_i, *font_i; |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
699 GtkWidget *strike_p, *small_p, *normal_p, *big_p, *bold_p, *italic_p, *underline_p, *speaker_p, *wood_p, *palette_p, *link_p, *font_p; |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
700 GtkWidget *strike, *small, *normal, *big, *bold, *italic, *underline, *speaker, *wood, *palette, *link, *font; |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
701 GdkBitmap *mask; |
1 | 702 |
703 win = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
704 b->window = win; | |
705 | |
223 | 706 vpaned = gtk_vpaned_new(); |
707 hpaned = gtk_hpaned_new(); | |
708 | |
26 | 709 gtk_window_set_policy(GTK_WINDOW(win), TRUE, TRUE, TRUE); |
710 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
711 close = gtk_button_new_with_label(_("Close")); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
712 invite_btn = gtk_button_new_with_label(_("Invite")); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
713 whisper = gtk_button_new_with_label(_("Whisper")); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
714 send = gtk_button_new_with_label(_("Send")); |
1 | 715 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
716 im = gtk_button_new_with_label(_("IM")); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
717 ignore = gtk_button_new_with_label(_("Ignore")); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
718 info = gtk_button_new_with_label(_("Info")); |
1 | 719 |
720 text = gtk_html_new(NULL, NULL); | |
721 | |
722 b->text = text; | |
723 | |
724 list = gtk_list_new(); | |
725 b->list = list; | |
726 | |
727 bbox = gtk_hbox_new(TRUE, 0); | |
728 bbox2 = gtk_hbox_new(TRUE, 0); | |
729 vbox = gtk_vbox_new(FALSE, 0); | |
730 lbox = gtk_vbox_new(FALSE, 4); | |
223 | 731 chatentry = gtk_text_new( NULL, NULL ); |
732 gtk_text_set_editable(GTK_TEXT(chatentry), TRUE); | |
733 | |
734 gtk_text_set_word_wrap(GTK_TEXT(chatentry), TRUE); | |
1 | 735 |
736 gtk_widget_realize(win); | |
737 | |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
738 toolbar = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_ICONS); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
739 |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
740 link_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
741 &win->style->white, link_xpm ); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
742 link_p = gtk_pixmap_new(link_i, mask); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
743 gtk_widget_show(link_p); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
744 |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
745 strike_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
746 &win->style->white, strike_xpm ); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
747 strike_p = gtk_pixmap_new(strike_i, mask); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
748 gtk_widget_show(strike_p); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
749 |
371
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
750 palette_i = gdk_pixmap_create_from_xpm_d (win->window, &mask, |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
751 &win->style->white, palette_xpm ); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
752 palette_p = gtk_pixmap_new(palette_i, mask); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
753 gtk_widget_show(palette_p); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
754 |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
755 bold_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
756 &win->style->white, bold_xpm ); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
757 bold_p = gtk_pixmap_new(bold_i, mask); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
758 gtk_widget_show(bold_p); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
759 |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
760 italic_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
761 &win->style->white, italic_xpm ); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
762 italic_p = gtk_pixmap_new(italic_i, mask); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
763 gtk_widget_show(italic_p); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
764 |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
765 underline_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
766 &win->style->white, underline_xpm ); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
767 underline_p = gtk_pixmap_new(underline_i, mask); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
768 gtk_widget_show(underline_p); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
769 |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
770 small_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
771 &win->style->white, small_xpm ); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
772 small_p = gtk_pixmap_new(small_i, mask); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
773 gtk_widget_show(small_p); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
774 |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
775 normal_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
776 &win->style->white, normal_xpm ); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
777 normal_p = gtk_pixmap_new(normal_i, mask); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
778 gtk_widget_show(normal_p); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
779 |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
780 big_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
781 &win->style->white, big_xpm ); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
782 big_p = gtk_pixmap_new(big_i, mask); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
783 gtk_widget_show(big_p); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
784 |
371
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
785 wood_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
786 &win->style->white, wood_xpm ); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
787 wood_p = gtk_pixmap_new(wood_i, mask); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
788 gtk_widget_show(wood_p); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
789 |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
790 font_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
791 &win->style->white, fontface_xpm ); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
792 font_p = gtk_pixmap_new(font_i, mask); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
793 gtk_widget_show(font_p); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
794 |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
795 speaker_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
796 &win->style->white, speaker_xpm ); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
797 speaker_p = gtk_pixmap_new(speaker_i, mask); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
798 gtk_widget_show(speaker_p); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
799 b->makesound=1; |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
800 |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
801 bold = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
802 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, NULL, |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
803 _("Bold"), _("Bold Text"), _("Bold"), bold_p, |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
804 GTK_SIGNAL_FUNC(do_bold), chatentry); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
805 italic = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
806 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
807 NULL, _("Italics"), _("Italics Text"), |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
808 _("Italics"), italic_p, GTK_SIGNAL_FUNC(do_italic), chatentry); |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
809 underline = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
810 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
811 NULL, _("Underline"), _("Underline Text"), |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
812 _("Underline"), underline_p, GTK_SIGNAL_FUNC(do_underline), chatentry); |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
813 strike = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
814 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
815 NULL, _("Strike"), _("Strike through Text"), |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
816 _("Strike"), strike_p, GTK_SIGNAL_FUNC(do_strike), chatentry); |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
817 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar)); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
818 small = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), _("Small"), _("Decrease font size"), _("Small"), small_p, GTK_SIGNAL_FUNC(do_small), chatentry); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
819 normal = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), _("Normal"), _("Normal font size"), _("Normal"), normal_p, GTK_SIGNAL_FUNC(do_normal), chatentry); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
820 big = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), _("Big"), _("Increase font size"), _("Big"), big_p, GTK_SIGNAL_FUNC(do_big), chatentry); |
371
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
821 font = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
822 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
823 NULL, _("Font"), _("Select Font"), |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
824 _("Font"), font_p, NULL, NULL); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
825 gtk_widget_set_sensitive(GTK_WIDGET(font), FALSE); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
826 |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
827 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar)); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
828 link = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
829 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, NULL, _("Link"), _("Insert Link"), |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
830 _("Link"), link_p, GTK_SIGNAL_FUNC(do_link), chatentry); |
371
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
831 palette = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
832 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
833 NULL, _("Color"), _("Text Color"), |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
834 _("Color"), palette_p, NULL, NULL); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
835 gtk_widget_set_sensitive(GTK_WIDGET(palette), FALSE); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
836 wood = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
837 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
838 NULL, _("Logging"), _("Enable logging"), |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
839 _("Logging"), wood_p, NULL, NULL); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
840 gtk_widget_set_sensitive(GTK_WIDGET(palette), FALSE); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
841 gtk_widget_set_sensitive(GTK_WIDGET(wood), FALSE); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
842 speaker = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
843 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
844 NULL, _("Sound"), _("Enable sounds"), |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
845 _("Sound"), speaker_p, GTK_SIGNAL_FUNC(set_option), &b->makesound); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
846 b->makesound = 0; |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
847 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(speaker), TRUE); |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
848 |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
849 gtk_widget_show(toolbar); |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
850 |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
851 b->bold = bold; |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
852 b->strike = strike; |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
853 b->italic = italic; |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
854 b->underline = underline; |
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
855 b->link = link; |
371
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
856 b->palette = palette; |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
857 b->font = font; |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
858 b->wood = wood; |
1 | 859 |
371
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
860 if (find_log_info(b->name)) |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
861 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(wood), TRUE); |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
862 else |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
863 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(wood), FALSE); |
1 | 864 |
865 gtk_object_set_user_data(GTK_OBJECT(chatentry), b); | |
866 b->entry = chatentry; | |
867 | |
868 /* Hack something so we know have an entry click event */ | |
869 | |
870 gtk_signal_connect(GTK_OBJECT(chatentry), "activate", GTK_SIGNAL_FUNC(send_callback),b); | |
300
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
226
diff
changeset
|
871 gtk_signal_connect(GTK_OBJECT(chatentry), "key_press_event", GTK_SIGNAL_FUNC(chat_keypress_callback), b); |
1 | 872 /* Text box */ |
873 | |
874 sw = gtk_scrolled_window_new (NULL, NULL); | |
875 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), | |
876 GTK_POLICY_NEVER, | |
877 GTK_POLICY_ALWAYS); | |
878 gtk_widget_show(sw); | |
879 gtk_container_add(GTK_CONTAINER(sw), text); | |
880 gtk_widget_show(text); | |
881 | |
882 | |
883 GTK_HTML (text)->hadj->step_increment = 10.0; | |
884 GTK_HTML (text)->vadj->step_increment = 10.0; | |
885 gtk_widget_set_usize(sw, 320, 150); | |
886 | |
223 | 887 gtk_paned_pack1(GTK_PANED(hpaned), sw, TRUE, TRUE); |
1 | 888 |
889 sw2 = gtk_scrolled_window_new(NULL, NULL); | |
890 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw2), | |
891 GTK_POLICY_NEVER, | |
892 GTK_POLICY_AUTOMATIC); | |
893 gtk_widget_show(sw2); | |
894 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw2), list); | |
895 | |
896 gtk_box_pack_start(GTK_BOX(lbox), sw2, TRUE, TRUE, 0); | |
226 | 897 gtk_box_pack_start(GTK_BOX(lbox), bbox2, FALSE, FALSE, 5); |
1 | 898 |
899 | |
223 | 900 gtk_paned_pack2(GTK_PANED(hpaned), lbox, TRUE, TRUE); |
1 | 901 gtk_widget_show(list); |
902 | |
903 | |
904 gtk_widget_set_usize(list, 150, 150); | |
905 | |
906 | |
907 /* Ready and pack buttons */ | |
908 gtk_object_set_user_data(GTK_OBJECT(win), b); | |
909 gtk_object_set_user_data(GTK_OBJECT(close), b); | |
910 gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(close_callback),b); | |
911 gtk_signal_connect(GTK_OBJECT(send), "clicked", GTK_SIGNAL_FUNC(send_callback),b); | |
912 gtk_signal_connect(GTK_OBJECT(invite_btn), "clicked", GTK_SIGNAL_FUNC(invite_callback), b); | |
913 gtk_signal_connect(GTK_OBJECT(whisper), "clicked", GTK_SIGNAL_FUNC(whisper_callback), b); | |
914 | |
915 gtk_signal_connect(GTK_OBJECT(im), "clicked", GTK_SIGNAL_FUNC(im_callback), b); | |
916 gtk_signal_connect(GTK_OBJECT(ignore), "clicked", GTK_SIGNAL_FUNC(ignore_callback), b); | |
917 gtk_signal_connect(GTK_OBJECT(info), "clicked", GTK_SIGNAL_FUNC(info_callback), b); | |
918 | |
919 gtk_box_pack_start(GTK_BOX(bbox), send, TRUE, TRUE, 5); | |
920 gtk_box_pack_start(GTK_BOX(bbox), whisper, TRUE, TRUE, 5); | |
921 gtk_box_pack_start(GTK_BOX(bbox), invite_btn, TRUE, TRUE, 5); | |
922 gtk_box_pack_start(GTK_BOX(bbox), close, TRUE, TRUE, 5); | |
923 | |
924 gtk_box_pack_start(GTK_BOX(bbox2), im, TRUE, TRUE, 5); | |
925 gtk_box_pack_start(GTK_BOX(bbox2), ignore, TRUE, TRUE, 5); | |
926 gtk_box_pack_start(GTK_BOX(bbox2), info, TRUE, TRUE, 5); | |
927 | |
928 /* pack and fill the rest */ | |
929 | |
930 | |
223 | 931 gtk_paned_pack1(GTK_PANED(vpaned), hpaned, TRUE, FALSE); |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
932 gtk_box_pack_start(GTK_BOX(vbox), toolbar, TRUE, TRUE, 5); |
223 | 933 gtk_box_pack_start(GTK_BOX(vbox), chatentry, TRUE, TRUE, 5); |
1 | 934 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 5); |
223 | 935 gtk_paned_pack2(GTK_PANED(vpaned), vbox, TRUE, FALSE); |
1 | 936 |
937 gtk_widget_show(send); | |
938 gtk_widget_show(invite_btn); | |
939 gtk_widget_show(whisper); | |
940 gtk_widget_show(close); | |
941 gtk_widget_show(im); | |
942 gtk_widget_show(ignore); | |
943 gtk_widget_show(info); | |
944 gtk_widget_show(bbox); | |
945 gtk_widget_show(lbox); | |
946 gtk_widget_show(bbox2); | |
947 gtk_widget_show(vbox); | |
223 | 948 gtk_widget_show( vpaned ); |
949 gtk_widget_show( hpaned ); | |
1 | 950 gtk_widget_show(chatentry); |
223 | 951 gtk_widget_set_usize(chatentry, 320, 25); |
1 | 952 |
223 | 953 gtk_container_add(GTK_CONTAINER(win),vpaned); |
1 | 954 gtk_container_border_width(GTK_CONTAINER(win), 10); |
955 | |
956 gtk_window_set_title(GTK_WINDOW(win), b->name); | |
957 gtk_window_set_focus(GTK_WINDOW(win), chatentry); | |
958 | |
959 gtk_signal_connect(GTK_OBJECT(win), "destroy", GTK_SIGNAL_FUNC(close_callback),b); | |
960 | |
961 | |
962 gtk_widget_realize(win); | |
963 aol_icon(win->window); | |
964 | |
965 gtk_widget_show(win); | |
966 | |
967 | |
968 } | |
969 | |
970 | |
971 | |
972 void handle_click_chat(GtkWidget *widget, GdkEventButton *event, struct chat_room *cr) | |
973 { | |
974 if (event->type == GDK_2BUTTON_PRESS && event->button == 1) { | |
975 serv_join_chat(cr->exchange, cr->name); | |
976 } | |
977 } | |
978 | |
979 | |
980 void setup_buddy_chats() | |
981 { | |
21 | 982 GList *list; |
1 | 983 struct chat_room *cr; |
984 GList *crs = chat_rooms; | |
985 GtkWidget *w; | |
986 GtkWidget *item; | |
987 GtkWidget *tree; | |
988 | |
21 | 989 if (buddies == NULL) |
990 return; | |
991 | |
992 list = GTK_TREE(buddies)->children; | |
993 | |
1 | 994 while(list) { |
995 w = (GtkWidget *)list->data; | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
996 if (!strcmp(GTK_LABEL(GTK_BIN(w)->child)->label, _("Buddy Chat"))) { |
1 | 997 gtk_tree_remove_items(GTK_TREE(buddies), list); |
998 list = GTK_TREE(buddies)->children; | |
999 if (!list) | |
1000 break; | |
1001 } | |
1002 list = list->next; | |
1003 } | |
1004 | |
1005 if (crs == NULL) | |
1006 return; | |
1007 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1008 item = gtk_tree_item_new_with_label(_("Buddy Chat")); |
1 | 1009 tree = gtk_tree_new(); |
1010 gtk_widget_show(item); | |
1011 gtk_widget_show(tree); | |
1012 gtk_tree_append(GTK_TREE(buddies), item); | |
1013 gtk_tree_item_set_subtree(GTK_TREE_ITEM(item), tree); | |
1014 gtk_tree_item_expand(GTK_TREE_ITEM(item)); | |
1015 | |
1016 while (crs) { | |
1017 cr = (struct chat_room *)crs->data; | |
1018 | |
1019 item = gtk_tree_item_new_with_label(cr->name); | |
1020 gtk_object_set_user_data(GTK_OBJECT(item), cr); | |
1021 gtk_tree_append(GTK_TREE(tree), item); | |
1022 gtk_widget_show(item); | |
1023 gtk_signal_connect(GTK_OBJECT(item), "button_press_event", | |
1024 GTK_SIGNAL_FUNC(handle_click_chat), | |
1025 cr); | |
1026 | |
1027 crs = crs->next; | |
1028 | |
1029 } | |
1030 | |
1031 } |