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