annotate src/buddy_chat.c @ 485:a15d87ea1d4c

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