Mercurial > pidgin
annotate src/buddy_chat.c @ 974:a57fbdc1a758
[gaim-migrate @ 984]
bah
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Wed, 11 Oct 2000 03:06:50 +0000 |
parents | 2cd7b73e2c9a |
children | 91b7377e7b45 |
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 |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
161 hbox = gtk_hbox_new(TRUE, 10); |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
162 gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 5); |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
163 gtk_widget_show(hbox); |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
164 |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
165 label = gtk_label_new(_("Join Chat As:")); |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
166 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
167 gtk_widget_show(label); |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
168 |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
169 create_joinchat_menu(hbox); |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
170 |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
171 hbox = gtk_hbox_new(TRUE, 10); |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
172 gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 5); |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
173 gtk_widget_show(hbox); |
692
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
174 |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
175 opt = gtk_radio_button_new_with_label(NULL, |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
176 _("AIM Private Chats")); |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
177 gtk_box_pack_start(GTK_BOX(hbox), opt, FALSE, FALSE, 0); |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
178 community = 0; |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
179 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
180 gtk_signal_connect(GTK_OBJECT(opt), "clicked", set_option, &community); |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
181 gtk_widget_show(opt); |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
182 |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
183 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
|
184 _("AOL Community Chats")); |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
185 gtk_box_pack_start(GTK_BOX(hbox), opt, FALSE, FALSE, 0); |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
186 gtk_widget_show(opt); |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
666
diff
changeset
|
187 |
964
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
188 bbox = gtk_hbox_new(TRUE, 10); |
457 | 189 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
|
190 gtk_widget_show(bbox); |
1 | 191 |
964
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
192 join = picture_button(joinchat, _("Join"), join_xpm); |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
193 gtk_box_pack_start(GTK_BOX(bbox), join, FALSE, FALSE, 5); |
1 | 194 gtk_signal_connect(GTK_OBJECT(join), "clicked", |
195 GTK_SIGNAL_FUNC(do_join_chat), joinchat); | |
196 | |
964
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
197 cancel = picture_button(joinchat, _("Cancel"), cancel_xpm); |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
198 gtk_box_pack_end(GTK_BOX(bbox), cancel, FALSE, FALSE, 5); |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
199 gtk_signal_connect(GTK_OBJECT(cancel), "clicked", |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
200 GTK_SIGNAL_FUNC(destroy_join_chat), joinchat); |
1 | 201 } |
202 gtk_widget_show(joinchat); | |
203 } | |
204 | |
205 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
206 static void do_invite(GtkWidget *w, struct conversation *b) |
1 | 207 { |
208 char *buddy; | |
209 char *mess; | |
210 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
211 if (!b->is_chat) { |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
212 debug_print("do_invite: expecting chat, got IM\n"); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
213 return; |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
214 } |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
215 |
1 | 216 buddy = gtk_entry_get_text(GTK_ENTRY(inviteentry)); |
217 mess = gtk_entry_get_text(GTK_ENTRY(invitemess)); | |
218 | |
219 if (invite) { | |
964
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
220 serv_chat_invite(b->gc, b->id, mess, buddy); |
1 | 221 gtk_widget_destroy(invite); |
222 } | |
223 invite=NULL; | |
224 } | |
225 | |
226 | |
227 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
228 void invite_callback(GtkWidget *w, struct conversation *b) |
1 | 229 { |
230 GtkWidget *cancel; | |
231 GtkWidget *invite_btn; | |
232 GtkWidget *label; | |
233 GtkWidget *bbox; | |
234 GtkWidget *vbox; | |
235 GtkWidget *topbox; | |
236 if (!invite) { | |
237 invite = gtk_window_new(GTK_WINDOW_DIALOG); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
238 cancel = gtk_button_new_with_label(_("Cancel")); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
239 invite_btn = gtk_button_new_with_label(_("Invite")); |
1 | 240 bbox = gtk_hbox_new(TRUE, 10); |
241 topbox = gtk_hbox_new(FALSE, 5); | |
242 vbox = gtk_vbox_new(FALSE, 5); | |
243 inviteentry = gtk_entry_new(); | |
244 invitemess = gtk_entry_new(); | |
245 | |
535
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
246 if (display_options & OPT_DISP_COOL_LOOK) |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
247 { |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
248 gtk_button_set_relief(GTK_BUTTON(cancel), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
249 gtk_button_set_relief(GTK_BUTTON(invite_btn), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
250 } |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
251 |
1 | 252 /* Put the buttons in the box */ |
253 gtk_box_pack_start(GTK_BOX(bbox), invite_btn, TRUE, TRUE, 10); | |
254 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 10); | |
255 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
256 label = gtk_label_new(_("Invite who?")); |
1 | 257 gtk_widget_show(label); |
258 gtk_box_pack_start(GTK_BOX(topbox), label, FALSE, FALSE, 5); | |
259 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
|
260 label = gtk_label_new(_("With message:")); |
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), invitemess, FALSE, FALSE, 5); | |
264 | |
265 /* And the boxes in the box */ | |
266 gtk_box_pack_start(GTK_BOX(vbox), topbox, TRUE, TRUE, 5); | |
267 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 5); | |
268 | |
269 /* Handle closes right */ | |
270 gtk_signal_connect(GTK_OBJECT(invite), "delete_event", | |
271 GTK_SIGNAL_FUNC(destroy_invite), invite); | |
272 | |
273 gtk_signal_connect(GTK_OBJECT(cancel), "clicked", | |
274 GTK_SIGNAL_FUNC(destroy_invite), b); | |
275 gtk_signal_connect(GTK_OBJECT(invite_btn), "clicked", | |
276 GTK_SIGNAL_FUNC(do_invite), b); | |
277 gtk_signal_connect(GTK_OBJECT(inviteentry), "activate", | |
278 GTK_SIGNAL_FUNC(do_invite), b); | |
279 /* Finish up */ | |
280 gtk_widget_show(invite_btn); | |
281 gtk_widget_show(cancel); | |
282 gtk_widget_show(inviteentry); | |
283 gtk_widget_show(invitemess); | |
284 gtk_widget_show(topbox); | |
285 gtk_widget_show(bbox); | |
286 gtk_widget_show(vbox); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
287 gtk_window_set_title(GTK_WINDOW(invite), _("Invite to Buddy Chat")); |
1 | 288 gtk_window_set_focus(GTK_WINDOW(invite), inviteentry); |
289 gtk_container_add(GTK_CONTAINER(invite), vbox); | |
290 gtk_widget_realize(invite); | |
291 aol_icon(invite->window); | |
292 | |
293 } | |
294 gtk_widget_show(invite); | |
295 } | |
296 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
297 gboolean meify(char *message) { |
415
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
298 /* 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
|
299 * the "/me " part of it (including that space) and return TRUE */ |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
300 char *c = message; |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
301 int inside_HTML = 0; /* i really don't like descriptive names */ |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
302 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
|
303 while (*c) { |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
304 if (inside_HTML) { |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
305 if (*c == '>') inside_HTML = 0; |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
306 } else { |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
307 if (*c == '<') inside_HTML = 1; |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
308 else break; |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
309 } |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
310 c++; /* i really don't like c++ either */ |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
311 } |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
312 /* k, so now we've gotten past all the HTML crap. */ |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
313 if (!*c) return FALSE; |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
314 if (!strncmp(c, "/me ", 4)) { |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
315 sprintf(c, "%s", c+4); |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
316 return TRUE; |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
317 } else |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
318 return FALSE; |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
319 } |
a266fd221c3c
[gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
320 |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
321 void chat_write(struct conversation *b, char *who, int flag, char *message) |
1 | 322 { |
323 GList *ignore = b->ignored; | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
324 char *str; |
1 | 325 |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
326 if (!b->is_chat) { |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
327 debug_print("chat_write: expecting chat, got IM\n"); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
328 return; |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
329 } |
1 | 330 |
331 while(ignore) { | |
332 if (!strcasecmp(who, ignore->data)) | |
333 return; | |
334 ignore = ignore->next; | |
335 } | |
371
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
336 |
1 | 337 |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
338 if (!(flag & WFLAG_WHISPER)) { |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
339 str = g_strdup(normalize(who)); |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
915
diff
changeset
|
340 if (!strcasecmp(str, normalize(b->gc->username))) { |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
915
diff
changeset
|
341 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
|
342 debug_print(debug_buff); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
343 if (b->makesound && (sound_options & OPT_SOUND_CHAT_SAY)) |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
344 play_sound(SEND); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
345 flag |= WFLAG_SEND; |
371
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
346 } else { |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
347 if (b->makesound && (sound_options & OPT_SOUND_CHAT_SAY)) |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
348 play_sound(RECEIVE); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
349 flag |= WFLAG_RECV; |
371
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
350 } |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
351 g_free(str); |
1 | 352 } |
353 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
354 write_to_conv(b, message, flag, who); |
1 | 355 } |
356 | |
357 | |
368
9bf1f77985d2
[gaim-migrate @ 378]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
363
diff
changeset
|
358 |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
359 void whisper_callback(GtkWidget *widget, struct conversation *b) |
1 | 360 { |
79 | 361 char buf[BUF_LEN*4]; |
1 | 362 char buf2[BUF_LONG]; |
363 GList *selected; | |
364 char *who; | |
365 | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
300
diff
changeset
|
366 strncpy(buf, gtk_editable_get_chars(GTK_EDITABLE(b->entry), 0, -1), sizeof(buf)/2); |
1 | 367 if (!strlen(buf)) |
368 return; | |
369 | |
370 selected = GTK_LIST(b->list)->selection; | |
371 | |
372 if (!selected) | |
373 return; | |
374 | |
375 | |
376 who = GTK_LABEL(gtk_container_children(GTK_CONTAINER(selected->data))->data)->label; | |
377 | |
378 if (!who) | |
379 return; | |
380 | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
300
diff
changeset
|
381 gtk_editable_delete_text(GTK_EDITABLE(b->entry), 0, -1); |
1 | 382 |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
915
diff
changeset
|
383 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
|
384 serv_chat_whisper(b->gc, b->id, who, buf); |
1 | 385 |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
915
diff
changeset
|
386 g_snprintf(buf2, sizeof(buf2), "%s->%s", b->gc->username, who); |
1 | 387 |
388 chat_write(b, buf2, WFLAG_WHISPER, buf); | |
389 | |
390 gtk_widget_grab_focus(GTK_WIDGET(b->entry)); | |
391 | |
392 | |
393 } | |
394 | |
395 | |
396 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
397 void update_chat_list(struct conversation *b) |
1 | 398 { |
399 GtkWidget *list_item; | |
400 char name[80]; | |
401 char *tmp; | |
402 GList *names = b->in_room; | |
403 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
404 if (!b->is_chat) { |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
405 debug_print("update_chat_list: expecting chat, got IM\n"); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
406 return; |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
407 } |
1 | 408 |
409 gtk_list_clear_items(GTK_LIST(b->list), 0, -1); | |
410 | |
411 | |
412 while(names) { | |
413 tmp = (char *)names->data; | |
414 if (g_list_index(b->ignored, names->data) != -1) | |
415 g_snprintf(name, sizeof(name), "X %s", tmp); | |
416 else | |
417 g_snprintf(name, sizeof(name), "%s", tmp); | |
418 | |
419 list_item = gtk_list_item_new_with_label(name); | |
420 gtk_widget_show(list_item); | |
421 gtk_object_set_user_data(GTK_OBJECT(list_item), tmp); | |
422 | |
423 gtk_list_append_items(GTK_LIST(b->list), g_list_append(NULL, list_item)); | |
424 | |
425 names = names->next; | |
426 } | |
427 | |
428 } | |
429 | |
430 | |
431 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
432 void add_chat_buddy(struct conversation *b, char *buddy) |
1 | 433 { |
434 char *name = g_strdup(buddy); | |
612
12bb64b42ad1
[gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
604
diff
changeset
|
435 char tmp[BUF_LONG]; |
1 | 436 |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
716
diff
changeset
|
437 plugin_event(event_chat_buddy_join, b->name, name, 0); |
1 | 438 b->in_room = g_list_append(b->in_room, name); |
439 | |
440 update_chat_list(b); | |
441 | |
371
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
442 if (b->makesound && (sound_options & OPT_SOUND_CHAT_JOIN)) |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
443 play_sound(BUDDY_ARRIVE); |
612
12bb64b42ad1
[gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
604
diff
changeset
|
444 |
12bb64b42ad1
[gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
604
diff
changeset
|
445 if (display_options & OPT_DISP_CHAT_LOGON) { |
12bb64b42ad1
[gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
604
diff
changeset
|
446 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
|
447 write_to_conv(b, tmp, WFLAG_SYSTEM, NULL); |
12bb64b42ad1
[gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
604
diff
changeset
|
448 } |
1 | 449 } |
450 | |
451 | |
452 | |
453 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
454 void remove_chat_buddy(struct conversation *b, char *buddy) |
1 | 455 { |
456 GList *names = b->in_room; | |
612
12bb64b42ad1
[gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
604
diff
changeset
|
457 char tmp[BUF_LONG]; |
1 | 458 |
780
c714def9cebb
[gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
716
diff
changeset
|
459 plugin_event(event_chat_buddy_leave, b->name, buddy, 0); |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
375
diff
changeset
|
460 |
1 | 461 while(names) { |
462 if (!strcasecmp((char *)names->data, buddy)) { | |
463 b->in_room = g_list_remove(b->in_room, names->data); | |
464 update_chat_list(b); | |
465 break; | |
466 } | |
467 names = names->next; | |
468 } | |
371
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
469 |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
470 if (b->makesound && (sound_options & OPT_SOUND_CHAT_JOIN)) |
9d22acf6db73
[gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
471 play_sound(BUDDY_LEAVE); |
612
12bb64b42ad1
[gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
604
diff
changeset
|
472 |
12bb64b42ad1
[gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
604
diff
changeset
|
473 if (display_options & OPT_DISP_CHAT_LOGON) { |
12bb64b42ad1
[gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
604
diff
changeset
|
474 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
|
475 write_to_conv(b, tmp, WFLAG_SYSTEM, NULL); |
12bb64b42ad1
[gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
604
diff
changeset
|
476 } |
1 | 477 } |
478 | |
479 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
480 void im_callback(GtkWidget *w, struct conversation *b) |
1 | 481 { |
482 char *name; | |
483 GList *i; | |
484 struct conversation *c; | |
485 | |
486 i = GTK_LIST(b->list)->selection; | |
487 if (i) | |
488 name = (char *)gtk_object_get_user_data(GTK_OBJECT(i->data)); | |
489 else | |
490 return; | |
491 | |
492 c = find_conversation(name); | |
493 | |
494 if (c != NULL) { | |
495 gdk_window_raise(c->window->window); | |
496 } else { | |
497 c = new_conversation(name); | |
498 } | |
499 | |
500 | |
501 } | |
502 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
503 void ignore_callback(GtkWidget *w, struct conversation *b) |
1 | 504 { |
505 char *name; | |
506 GList *i; | |
507 | |
508 i = GTK_LIST(b->list)->selection; | |
509 if (i) | |
510 name = (char *)gtk_object_get_user_data(GTK_OBJECT(i->data)); | |
511 else | |
512 return; | |
513 | |
514 if (g_list_index(b->ignored, (gpointer)name) == -1) | |
515 b->ignored = g_list_append(b->ignored, name); | |
516 else | |
517 b->ignored = g_list_remove(b->ignored, name); | |
518 | |
519 update_chat_list(b); | |
520 } | |
521 | |
522 | |
523 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
524 void show_new_buddy_chat(struct conversation *b) |
1 | 525 { |
526 GtkWidget *win; | |
527 GtkWidget *text; | |
528 GtkWidget *send; | |
529 GtkWidget *list; | |
530 GtkWidget *invite_btn; | |
531 GtkWidget *whisper; | |
532 GtkWidget *close; | |
533 GtkWidget *chatentry; | |
534 GtkWidget *lbox; | |
535 GtkWidget *bbox; | |
536 GtkWidget *bbox2; | |
537 GtkWidget *im, *ignore, *info; | |
538 GtkWidget *sw; | |
539 GtkWidget *sw2; | |
540 GtkWidget *vbox; | |
223 | 541 GtkWidget *vpaned; |
542 GtkWidget *hpaned; | |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
543 GtkWidget *toolbar; |
844 | 544 |
915
378c862a2381
[gaim-migrate @ 925]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
909
diff
changeset
|
545 int dispstyle; |
1 | 546 |
547 win = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
548 b->window = win; | |
905 | 549 gtk_window_set_wmclass(GTK_WINDOW(win), "buddy_chat", "Gaim"); |
1 | 550 |
223 | 551 vpaned = gtk_vpaned_new(); |
552 hpaned = gtk_hpaned_new(); | |
553 | |
26 | 554 gtk_window_set_policy(GTK_WINDOW(win), TRUE, TRUE, TRUE); |
834
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
555 gtk_widget_realize(win); |
26 | 556 |
915
378c862a2381
[gaim-migrate @ 925]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
909
diff
changeset
|
557 dispstyle = set_dispstyle(1); |
1 | 558 |
834
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
559 close = picture_button2(win, _("Close"), cancel_xpm, dispstyle); |
844 | 560 |
834
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
561 invite_btn = picture_button2(win, _("Invite"), join_xpm, dispstyle); |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
562 whisper = picture_button2(win, _("Whisper"), tb_forward_xpm, dispstyle); |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
563 send = picture_button2(win, _("Send"), tmp_send_xpm, dispstyle); |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
564 |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
565 im = picture_button2(win, _("IM"), tmp_send_xpm, FALSE); |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
566 ignore = picture_button2(win, _("Ignore"), close_xpm, FALSE); |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
567 info = picture_button2(win, _("Info"), tb_search_xpm, FALSE); |
1 | 568 |
535
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
569 if (display_options & OPT_DISP_COOL_LOOK) |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
570 { |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
571 gtk_button_set_relief(GTK_BUTTON(close), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
572 gtk_button_set_relief(GTK_BUTTON(invite_btn), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
573 gtk_button_set_relief(GTK_BUTTON(whisper), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
574 gtk_button_set_relief(GTK_BUTTON(send), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
575 gtk_button_set_relief(GTK_BUTTON(im), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
576 gtk_button_set_relief(GTK_BUTTON(ignore), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
577 gtk_button_set_relief(GTK_BUTTON(info), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
578 } |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
485
diff
changeset
|
579 |
1 | 580 text = gtk_html_new(NULL, NULL); |
581 | |
582 b->text = text; | |
583 | |
584 list = gtk_list_new(); | |
585 b->list = list; | |
586 | |
844 | 587 bbox = gtk_hbox_new(FALSE, 5); |
1 | 588 bbox2 = gtk_hbox_new(TRUE, 0); |
589 vbox = gtk_vbox_new(FALSE, 0); | |
590 lbox = gtk_vbox_new(FALSE, 4); | |
646
83c773b5b6dc
[gaim-migrate @ 656]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
615
diff
changeset
|
591 |
223 | 592 chatentry = gtk_text_new( NULL, NULL ); |
593 gtk_text_set_editable(GTK_TEXT(chatentry), TRUE); | |
594 gtk_text_set_word_wrap(GTK_TEXT(chatentry), TRUE); | |
646
83c773b5b6dc
[gaim-migrate @ 656]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
615
diff
changeset
|
595 gtk_object_set_user_data(GTK_OBJECT(chatentry), b); |
83c773b5b6dc
[gaim-migrate @ 656]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
615
diff
changeset
|
596 b->entry = chatentry; |
1 | 597 |
598 gtk_widget_realize(win); | |
599 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
457
diff
changeset
|
600 toolbar = build_conv_toolbar(b); |
1 | 601 |
602 /* Hack something so we know have an entry click event */ | |
603 | |
604 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
|
605 gtk_signal_connect(GTK_OBJECT(chatentry), "key_press_event", GTK_SIGNAL_FUNC(keypress_callback), b); |
1 | 606 /* Text box */ |
607 | |
608 sw = gtk_scrolled_window_new (NULL, NULL); | |
609 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), | |
610 GTK_POLICY_NEVER, | |
611 GTK_POLICY_ALWAYS); | |
612 gtk_widget_show(sw); | |
613 gtk_container_add(GTK_CONTAINER(sw), text); | |
614 gtk_widget_show(text); | |
615 | |
616 | |
617 GTK_HTML (text)->hadj->step_increment = 10.0; | |
618 GTK_HTML (text)->vadj->step_increment = 10.0; | |
619 gtk_widget_set_usize(sw, 320, 150); | |
620 | |
223 | 621 gtk_paned_pack1(GTK_PANED(hpaned), sw, TRUE, TRUE); |
1 | 622 |
623 sw2 = gtk_scrolled_window_new(NULL, NULL); | |
624 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw2), | |
625 GTK_POLICY_NEVER, | |
626 GTK_POLICY_AUTOMATIC); | |
627 gtk_widget_show(sw2); | |
628 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw2), list); | |
629 | |
630 gtk_box_pack_start(GTK_BOX(lbox), sw2, TRUE, TRUE, 0); | |
226 | 631 gtk_box_pack_start(GTK_BOX(lbox), bbox2, FALSE, FALSE, 5); |
1 | 632 |
633 | |
223 | 634 gtk_paned_pack2(GTK_PANED(hpaned), lbox, TRUE, TRUE); |
1 | 635 gtk_widget_show(list); |
636 | |
637 | |
638 gtk_widget_set_usize(list, 150, 150); | |
639 | |
640 | |
641 /* Ready and pack buttons */ | |
642 gtk_object_set_user_data(GTK_OBJECT(win), b); | |
643 gtk_object_set_user_data(GTK_OBJECT(close), b); | |
644 gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(close_callback),b); | |
645 gtk_signal_connect(GTK_OBJECT(send), "clicked", GTK_SIGNAL_FUNC(send_callback),b); | |
646 gtk_signal_connect(GTK_OBJECT(invite_btn), "clicked", GTK_SIGNAL_FUNC(invite_callback), b); | |
647 gtk_signal_connect(GTK_OBJECT(whisper), "clicked", GTK_SIGNAL_FUNC(whisper_callback), b); | |
648 | |
649 gtk_signal_connect(GTK_OBJECT(im), "clicked", GTK_SIGNAL_FUNC(im_callback), b); | |
650 gtk_signal_connect(GTK_OBJECT(ignore), "clicked", GTK_SIGNAL_FUNC(ignore_callback), b); | |
651 gtk_signal_connect(GTK_OBJECT(info), "clicked", GTK_SIGNAL_FUNC(info_callback), b); | |
652 | |
653 | |
844 | 654 gtk_box_pack_end(GTK_BOX(bbox), close, dispstyle, dispstyle, 5); |
655 gtk_box_pack_end(GTK_BOX(bbox), invite_btn, dispstyle, dispstyle, 5); | |
656 gtk_box_pack_end(GTK_BOX(bbox), whisper, dispstyle, dispstyle, 5); | |
657 gtk_box_pack_end(GTK_BOX(bbox), send, dispstyle, dispstyle, 5); | |
658 | |
659 gtk_box_pack_start(GTK_BOX(bbox2), im, dispstyle, dispstyle, 5); | |
660 gtk_box_pack_start(GTK_BOX(bbox2), ignore, dispstyle, dispstyle, 5); | |
661 gtk_box_pack_start(GTK_BOX(bbox2), info, dispstyle, dispstyle, 5); | |
1 | 662 |
663 /* pack and fill the rest */ | |
664 | |
665 | |
223 | 666 gtk_paned_pack1(GTK_PANED(vpaned), hpaned, TRUE, FALSE); |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
667 gtk_box_pack_start(GTK_BOX(vbox), toolbar, TRUE, TRUE, 5); |
223 | 668 gtk_box_pack_start(GTK_BOX(vbox), chatentry, TRUE, TRUE, 5); |
1 | 669 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 5); |
223 | 670 gtk_paned_pack2(GTK_PANED(vpaned), vbox, TRUE, FALSE); |
1 | 671 |
672 gtk_widget_show(send); | |
673 gtk_widget_show(invite_btn); | |
674 gtk_widget_show(whisper); | |
675 gtk_widget_show(close); | |
676 gtk_widget_show(im); | |
677 gtk_widget_show(ignore); | |
678 gtk_widget_show(info); | |
679 gtk_widget_show(bbox); | |
680 gtk_widget_show(lbox); | |
681 gtk_widget_show(bbox2); | |
682 gtk_widget_show(vbox); | |
223 | 683 gtk_widget_show( vpaned ); |
684 gtk_widget_show( hpaned ); | |
1 | 685 gtk_widget_show(chatentry); |
864 | 686 |
687 if (display_options & OPT_DISP_CHAT_BIG_ENTRY) | |
688 gtk_widget_set_usize(chatentry, 320, 50); | |
689 else | |
690 gtk_widget_set_usize(chatentry, 320, 25); | |
1 | 691 |
223 | 692 gtk_container_add(GTK_CONTAINER(win),vpaned); |
1 | 693 gtk_container_border_width(GTK_CONTAINER(win), 10); |
694 | |
695 gtk_window_set_title(GTK_WINDOW(win), b->name); | |
696 gtk_window_set_focus(GTK_WINDOW(win), chatentry); | |
697 | |
698 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
|
699 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
|
700 gtk_signal_connect(GTK_OBJECT(chatentry), "key_press_event", GTK_SIGNAL_FUNC(entry_key_pressed), chatentry); |
1 | 701 |
716 | 702 b->font_dialog = NULL; |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
845
diff
changeset
|
703 b->fg_color_dialog = NULL; |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
845
diff
changeset
|
704 b->bg_color_dialog = NULL; |
716 | 705 b->smiley_dialog = NULL; |
706 b->link_dialog = NULL; | |
707 b->log_dialog = NULL; | |
834
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
708 b->send = send; |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
709 b->whisper = whisper; |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
710 b->invite = invite_btn; |
814
a636ac51d15b
[gaim-migrate @ 824]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
711 b->close = close; |
716 | 712 sprintf(b->fontface, "%s", fontface); |
713 b->hasfont = 0; | |
714 b->bgcol = bgcolor; | |
715 b->hasbg = 0; | |
716 b->fgcol = fgcolor; | |
717 b->hasfg = 0; | |
718 | |
615 | 719 gtk_widget_realize(win); |
1 | 720 aol_icon(win->window); |
721 | |
722 gtk_widget_show(win); | |
723 } | |
724 | |
725 | |
726 | |
727 void handle_click_chat(GtkWidget *widget, GdkEventButton *event, struct chat_room *cr) | |
728 { | |
729 if (event->type == GDK_2BUTTON_PRESS && event->button == 1) { | |
964
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
730 /* FIXME */ |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
731 serv_join_chat(connections->data, cr->exchange, cr->name); |
1 | 732 } |
733 } | |
734 | |
735 | |
736 void setup_buddy_chats() | |
737 { | |
21 | 738 GList *list; |
1 | 739 struct chat_room *cr; |
740 GList *crs = chat_rooms; | |
741 GtkWidget *w; | |
742 GtkWidget *item; | |
743 GtkWidget *tree; | |
744 | |
21 | 745 if (buddies == NULL) |
746 return; | |
747 | |
748 list = GTK_TREE(buddies)->children; | |
749 | |
1 | 750 while(list) { |
751 w = (GtkWidget *)list->data; | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
752 if (!strcmp(GTK_LABEL(GTK_BIN(w)->child)->label, _("Buddy Chat"))) { |
1 | 753 gtk_tree_remove_items(GTK_TREE(buddies), list); |
754 list = GTK_TREE(buddies)->children; | |
755 if (!list) | |
756 break; | |
757 } | |
758 list = list->next; | |
759 } | |
760 | |
761 if (crs == NULL) | |
762 return; | |
763 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
764 item = gtk_tree_item_new_with_label(_("Buddy Chat")); |
1 | 765 tree = gtk_tree_new(); |
766 gtk_widget_show(item); | |
767 gtk_widget_show(tree); | |
768 gtk_tree_append(GTK_TREE(buddies), item); | |
769 gtk_tree_item_set_subtree(GTK_TREE_ITEM(item), tree); | |
770 gtk_tree_item_expand(GTK_TREE_ITEM(item)); | |
771 | |
772 while (crs) { | |
773 cr = (struct chat_room *)crs->data; | |
774 | |
775 item = gtk_tree_item_new_with_label(cr->name); | |
776 gtk_object_set_user_data(GTK_OBJECT(item), cr); | |
777 gtk_tree_append(GTK_TREE(tree), item); | |
778 gtk_widget_show(item); | |
779 gtk_signal_connect(GTK_OBJECT(item), "button_press_event", | |
780 GTK_SIGNAL_FUNC(handle_click_chat), | |
781 cr); | |
782 | |
783 crs = crs->next; | |
784 | |
785 } | |
786 | |
787 } | |
834
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
788 |
915
378c862a2381
[gaim-migrate @ 925]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
909
diff
changeset
|
789 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
|
790 { |
915
378c862a2381
[gaim-migrate @ 925]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
909
diff
changeset
|
791 int dispstyle = set_dispstyle(chat); |
834
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
792 GtkWidget *parent = button->parent; |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
793 gtk_widget_destroy(button); |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
794 button = picture_button2(win, text, xpm, dispstyle); |
915
378c862a2381
[gaim-migrate @ 925]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
909
diff
changeset
|
795 if (chat == 1) |
909
9f2afe5faed5
[gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
907
diff
changeset
|
796 gtk_box_pack_start(GTK_BOX(parent), button, dispstyle, dispstyle, 5); |
9f2afe5faed5
[gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
907
diff
changeset
|
797 else |
9f2afe5faed5
[gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
907
diff
changeset
|
798 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
|
799 gtk_widget_show(button); |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
800 return button; |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
801 } |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
802 |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
803 void update_chat_button_pix() |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
804 { |
964
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
805 GSList *C = connections; |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
806 struct gaim_connection *g; |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
807 |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
808 while (C) { |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
809 GSList *bcs; |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
810 struct conversation *c; |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
811 int opt = 1; |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
812 g = (struct gaim_connection *)C->data; |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
813 bcs = g->buddy_chats; |
834
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
814 |
964
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
815 while (bcs) { |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
816 c = (struct conversation *)bcs->data; |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
817 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
|
818 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
|
819 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
|
820 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
|
821 gtk_object_set_user_data(GTK_OBJECT(c->close), c); |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
822 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
|
823 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
|
824 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
|
825 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
|
826 bcs = bcs->next; |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
827 } |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
828 C = C->next; |
834
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
829 } |
bac7089491c1
[gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
823
diff
changeset
|
830 } |
909
9f2afe5faed5
[gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
907
diff
changeset
|
831 |
9f2afe5faed5
[gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
907
diff
changeset
|
832 void update_im_button_pix() |
9f2afe5faed5
[gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
907
diff
changeset
|
833 { |
9f2afe5faed5
[gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
907
diff
changeset
|
834 GList *bcs = conversations; |
9f2afe5faed5
[gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
907
diff
changeset
|
835 struct conversation *c; |
9f2afe5faed5
[gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
907
diff
changeset
|
836 GtkWidget *parent; |
915
378c862a2381
[gaim-migrate @ 925]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
909
diff
changeset
|
837 int opt = 0; |
378c862a2381
[gaim-migrate @ 925]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
909
diff
changeset
|
838 int dispstyle = set_dispstyle(0); |
909
9f2afe5faed5
[gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
907
diff
changeset
|
839 |
9f2afe5faed5
[gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
907
diff
changeset
|
840 while (bcs) { |
9f2afe5faed5
[gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
907
diff
changeset
|
841 c = (struct conversation *)bcs->data; |
9f2afe5faed5
[gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
907
diff
changeset
|
842 parent = c->close->parent; |
9f2afe5faed5
[gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
907
diff
changeset
|
843 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
|
844 gtk_box_reorder_child(GTK_BOX(parent), c->close, 0); |
9f2afe5faed5
[gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
907
diff
changeset
|
845 gtk_box_set_child_packing(GTK_BOX(parent), c->sep1, dispstyle, dispstyle, 0, GTK_PACK_END); |
9f2afe5faed5
[gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
907
diff
changeset
|
846 if (find_buddy(c->name) == NULL) |
9f2afe5faed5
[gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
907
diff
changeset
|
847 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
|
848 else |
9f2afe5faed5
[gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
907
diff
changeset
|
849 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
|
850 gtk_box_reorder_child(GTK_BOX(parent), c->add, 2); |
9f2afe5faed5
[gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
907
diff
changeset
|
851 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
|
852 gtk_box_reorder_child(GTK_BOX(parent), c->block, 3); |
9f2afe5faed5
[gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
907
diff
changeset
|
853 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
|
854 gtk_box_reorder_child(GTK_BOX(parent), c->warn, 4); |
9f2afe5faed5
[gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
907
diff
changeset
|
855 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
|
856 gtk_box_reorder_child(GTK_BOX(parent), c->info, 5); |
9f2afe5faed5
[gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
907
diff
changeset
|
857 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
|
858 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
|
859 gtk_box_reorder_child(GTK_BOX(parent), c->send, 7); |
9f2afe5faed5
[gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
907
diff
changeset
|
860 gtk_object_set_user_data(GTK_OBJECT(c->close), c); |
9f2afe5faed5
[gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
907
diff
changeset
|
861 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
|
862 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
|
863 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
|
864 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
|
865 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
|
866 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
|
867 bcs = bcs->next; |
9f2afe5faed5
[gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
907
diff
changeset
|
868 } |
9f2afe5faed5
[gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
907
diff
changeset
|
869 } |