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