annotate src/buddy_chat.c @ 1682:4328efeb531e

[gaim-migrate @ 1692] fix for links in messages, and also some chat updates (chat still does funny things but i think now at least you won't see 5 of the same person in the room) committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 04 Apr 2001 16:45:20 +0000
parents 171c64f70b66
children a312d64a995d
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>
1428
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1398
diff changeset
31 #include "gtkimhtml.h"
1117
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1109
diff changeset
32 #include "gtkspell.h"
300
b32c83750104 [gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 226
diff changeset
33 #include <gdk/gdkkeysyms.h>
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
34
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
35 #include "convo.h"
1235
a9cf2f61a7b1 [gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1228
diff changeset
36 #include "prpl.h"
344
2434adbb8703 [gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 338
diff changeset
37
834
bac7089491c1 [gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 823
diff changeset
38 #include "pixmaps/tb_forward.xpm"
604
0b1a132e0f75 [gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 535
diff changeset
39 #include "pixmaps/join.xpm"
909
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
40 #include "pixmaps/close.xpm"
604
0b1a132e0f75 [gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 535
diff changeset
41
1428
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1398
diff changeset
42 #include "pixmaps/luke03.xpm"
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1398
diff changeset
43 #include "pixmaps/oneeye.xpm"
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1398
diff changeset
44
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
45 static GtkWidget *joinchat;
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
46 static struct gaim_connection *joinchatgc;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
47 static GtkWidget *entry;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
48 static GtkWidget *invite;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
49 static GtkWidget *inviteentry;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
50 static GtkWidget *invitemess;
692
f4026275bc9f [gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 666
diff changeset
51 static int community;
344
2434adbb8703 [gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 338
diff changeset
52 extern int state_lock;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
53
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
54 static void destroy_join_chat()
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 if (joinchat)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
57 gtk_widget_destroy(joinchat);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
58 joinchat = NULL;
1
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
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
61 static void destroy_invite()
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
62 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
63 if (invite)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
64 gtk_widget_destroy(invite);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
65 invite = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
66 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
67
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
68
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
69 static void do_join_chat()
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
70 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
71 char *group;
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 group = gtk_entry_get_text(GTK_ENTRY(entry));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
74
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
75 if (joinchat) {
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
76 serv_join_chat(joinchatgc, community + 4, group);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
77 gtk_widget_destroy(joinchat);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
78 }
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
79 joinchat = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
80 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
81
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
82 static void joinchat_choose(GtkWidget *w, struct gaim_connection *g)
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
83 {
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
84 joinchatgc = g;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
85 }
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
86
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
87
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
88 static void create_joinchat_menu(GtkWidget *box)
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
89 {
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
90 GtkWidget *optmenu;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
91 GtkWidget *menu;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
92 GtkWidget *opt;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
93 GSList *c = connections;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
94 struct gaim_connection *g;
1235
a9cf2f61a7b1 [gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1228
diff changeset
95 char buf[2048];
964
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 optmenu = gtk_option_menu_new();
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
98 gtk_box_pack_start(GTK_BOX(box), optmenu, FALSE, FALSE, 0);
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
99
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
100 menu = gtk_menu_new();
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
101
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
102 while (c) {
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
103 g = (struct gaim_connection *)c->data;
1356
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
104 c = c->next;
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
105 if (!g->prpl->join_chat)
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
106 continue;
1235
a9cf2f61a7b1 [gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1228
diff changeset
107 g_snprintf(buf, sizeof buf, "%s (%s)", g->username, (*g->prpl->name)());
a9cf2f61a7b1 [gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1228
diff changeset
108 opt = gtk_menu_item_new_with_label(buf);
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
109 gtk_object_set_user_data(GTK_OBJECT(opt), g);
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
110 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
111 gtk_menu_append(GTK_MENU(menu), opt);
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
112 gtk_widget_show(opt);
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
113 }
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
114
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
115 gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu);
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
116 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), 0);
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
117
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
118 joinchatgc = connections->data;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
119 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
120
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
121
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
122 void join_chat()
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
123 {
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
124 GtkWidget *mainbox;
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
125 GtkWidget *frame;
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
126 GtkWidget *fbox;
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
127 GtkWidget *rowbox;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
128 GtkWidget *bbox;
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
129 GtkWidget *join;
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
130 GtkWidget *cancel;
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
131 GtkWidget *label;
692
f4026275bc9f [gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 666
diff changeset
132 GtkWidget *opt;
1356
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
133 GSList *c = connections;
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
134 struct gaim_connection *gc = NULL;
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
135
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
136 while (c) {
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
137 gc = c->data;
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
138 if (gc->prpl->join_chat)
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
139 break;
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
140 gc = NULL;
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
141 c = c->next;
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
142 }
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
143 if (gc == NULL) {
1358
3c87aa8efdc9 [gaim-migrate @ 1368]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1356
diff changeset
144 do_error_dialog("You are not currently signed on with any protocols that have "
1356
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
145 "the ability to chat.", "Unable to chat");
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
146 return;
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
147 }
456
725ffb93aedc [gaim-migrate @ 466]
Rob Flynn <gaim@robflynn.com>
parents: 449
diff changeset
148
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
149 if (!joinchat) {
457
5040146e18a8 [gaim-migrate @ 467]
Rob Flynn <gaim@robflynn.com>
parents: 456
diff changeset
150 joinchat = gtk_window_new(GTK_WINDOW_DIALOG);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
151 gtk_window_set_wmclass(GTK_WINDOW(joinchat), "joinchat", "Gaim");
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
152 gtk_window_set_policy(GTK_WINDOW(joinchat), FALSE, TRUE, TRUE);
834
bac7089491c1 [gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 823
diff changeset
153 gtk_widget_realize(joinchat);
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
154 gtk_signal_connect(GTK_OBJECT(joinchat), "delete_event",
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
155 GTK_SIGNAL_FUNC(destroy_join_chat), joinchat);
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
156 gtk_window_set_title(GTK_WINDOW(joinchat), _("Join Chat"));
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
157 aol_icon(joinchat->window);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
158
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
159 mainbox = gtk_vbox_new(FALSE, 5);
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
160 gtk_container_set_border_width(GTK_CONTAINER(mainbox), 5);
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
161 gtk_container_add(GTK_CONTAINER(joinchat), mainbox);
456
725ffb93aedc [gaim-migrate @ 466]
Rob Flynn <gaim@robflynn.com>
parents: 449
diff changeset
162
1211
892bb91e9a27 [gaim-migrate @ 1221]
Rob Flynn <gaim@robflynn.com>
parents: 1210
diff changeset
163 frame = gtk_frame_new(_("Buddy Chat"));
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
164 gtk_box_pack_start(GTK_BOX(mainbox), frame, TRUE, TRUE, 0);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
165
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
166 fbox = gtk_vbox_new(FALSE, 5);
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
167 gtk_container_set_border_width(GTK_CONTAINER(fbox), 5);
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
168 gtk_container_add(GTK_CONTAINER(frame), fbox);
456
725ffb93aedc [gaim-migrate @ 466]
Rob Flynn <gaim@robflynn.com>
parents: 449
diff changeset
169
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
170 rowbox = gtk_hbox_new(FALSE, 5);
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
171 gtk_box_pack_start(GTK_BOX(fbox), rowbox, TRUE, TRUE, 0);
456
725ffb93aedc [gaim-migrate @ 466]
Rob Flynn <gaim@robflynn.com>
parents: 449
diff changeset
172
350
fd3cc0a28d5d [gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
173 label = gtk_label_new(_("Join what group:"));
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
174 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
175
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
176 entry = gtk_entry_new();
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
177 gtk_box_pack_start(GTK_BOX(rowbox), entry, TRUE, TRUE, 0);
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
178 gtk_signal_connect(GTK_OBJECT(entry), "activate",
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
179 GTK_SIGNAL_FUNC(do_join_chat), joinchat);
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
180 gtk_window_set_focus(GTK_WINDOW(joinchat), entry);
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
181
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1018
diff changeset
182 #ifndef NO_MULTI
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
183 rowbox = gtk_hbox_new(FALSE, 5);
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
184 gtk_box_pack_start(GTK_BOX(fbox), rowbox, TRUE, TRUE, 0);
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
185
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
186 label = gtk_label_new(_("Join Chat As:"));
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
187 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
188
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
189 create_joinchat_menu(rowbox);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1018
diff changeset
190 #else
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1018
diff changeset
191 joinchatgc = connections->data;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1018
diff changeset
192 #endif
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
193
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
194 rowbox = gtk_hbox_new(FALSE, 5);
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
195 gtk_box_pack_start(GTK_BOX(fbox), rowbox, TRUE, TRUE, 0);
692
f4026275bc9f [gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 666
diff changeset
196
f4026275bc9f [gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 666
diff changeset
197 community = 0;
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
198 opt = gtk_radio_button_new_with_label(NULL, _("AIM Private Chats"));
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
199 gtk_box_pack_start(GTK_BOX(rowbox), opt, TRUE, TRUE, 0);
692
f4026275bc9f [gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 666
diff changeset
200 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE);
f4026275bc9f [gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 666
diff changeset
201 gtk_signal_connect(GTK_OBJECT(opt), "clicked", set_option, &community);
f4026275bc9f [gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 666
diff changeset
202 gtk_widget_show(opt);
f4026275bc9f [gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 666
diff changeset
203
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
204 opt = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(opt)),
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
205 _("AOL Community Chats"));
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
206 gtk_box_pack_start(GTK_BOX(rowbox), opt, TRUE, TRUE, 0);
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
207
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
208 /* buttons */
692
f4026275bc9f [gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 666
diff changeset
209
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
210 bbox = gtk_hbox_new(FALSE, 5);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
211 gtk_box_pack_start(GTK_BOX(mainbox), bbox, FALSE, FALSE, 0);
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
212
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
213 cancel = picture_button(joinchat, _("Cancel"), cancel_xpm);
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
214 gtk_box_pack_end(GTK_BOX(bbox), cancel, FALSE, FALSE, 0);
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
215 gtk_signal_connect(GTK_OBJECT(cancel), "clicked",
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
216 GTK_SIGNAL_FUNC(destroy_join_chat), joinchat);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
217
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
218 join = picture_button(joinchat, _("Join"), join_xpm);
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
219 gtk_box_pack_end(GTK_BOX(bbox), join, FALSE, FALSE, 0);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
220 gtk_signal_connect(GTK_OBJECT(join), "clicked", GTK_SIGNAL_FUNC(do_join_chat), joinchat);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
221 }
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
222 gtk_widget_show_all(joinchat);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
223 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
224
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
225
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
226 static void do_invite(GtkWidget *w, struct conversation *b)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
227 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
228 char *buddy;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
229 char *mess;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
230
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
231 if (!b->is_chat) {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
232 debug_printf("do_invite: expecting chat, got IM\n");
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
233 return;
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
234 }
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
235
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
236 buddy = gtk_entry_get_text(GTK_ENTRY(inviteentry));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
237 mess = gtk_entry_get_text(GTK_ENTRY(invitemess));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
238
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
239 if (invite) {
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
240 serv_chat_invite(b->gc, b->id, mess, buddy);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
241 gtk_widget_destroy(invite);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
242 }
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
243 invite = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
244 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
245
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
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
248 void invite_callback(GtkWidget *w, struct conversation *b)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
249 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
250 GtkWidget *cancel;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
251 GtkWidget *invite_btn;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
252 GtkWidget *label;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
253 GtkWidget *bbox;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
254 GtkWidget *vbox;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
255 GtkWidget *topbox;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
256 if (!invite) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
257 invite = gtk_window_new(GTK_WINDOW_DIALOG);
350
fd3cc0a28d5d [gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
258 cancel = gtk_button_new_with_label(_("Cancel"));
fd3cc0a28d5d [gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
259 invite_btn = gtk_button_new_with_label(_("Invite"));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
260 bbox = gtk_hbox_new(TRUE, 10);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
261 topbox = gtk_hbox_new(FALSE, 5);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
262 vbox = gtk_vbox_new(FALSE, 5);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
263 inviteentry = gtk_entry_new();
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
264 invitemess = gtk_entry_new();
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
265
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
266 if (display_options & OPT_DISP_COOL_LOOK) {
535
f03f041c1aa9 [gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 485
diff changeset
267 gtk_button_set_relief(GTK_BUTTON(cancel), GTK_RELIEF_NONE);
f03f041c1aa9 [gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 485
diff changeset
268 gtk_button_set_relief(GTK_BUTTON(invite_btn), GTK_RELIEF_NONE);
f03f041c1aa9 [gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 485
diff changeset
269 }
f03f041c1aa9 [gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 485
diff changeset
270
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
271 /* Put the buttons in the box */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
272 gtk_box_pack_start(GTK_BOX(bbox), invite_btn, TRUE, TRUE, 10);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
273 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 10);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
274
350
fd3cc0a28d5d [gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
275 label = gtk_label_new(_("Invite who?"));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
276 gtk_widget_show(label);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
277 gtk_box_pack_start(GTK_BOX(topbox), label, FALSE, FALSE, 5);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
278 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
279 label = gtk_label_new(_("With message:"));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
280 gtk_widget_show(label);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
281 gtk_box_pack_start(GTK_BOX(topbox), label, FALSE, FALSE, 5);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
282 gtk_box_pack_start(GTK_BOX(topbox), invitemess, FALSE, FALSE, 5);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
283
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
284 /* And the boxes in the box */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
285 gtk_box_pack_start(GTK_BOX(vbox), topbox, TRUE, TRUE, 5);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
286 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 5);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
287
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
288 /* Handle closes right */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
289 gtk_signal_connect(GTK_OBJECT(invite), "delete_event",
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
290 GTK_SIGNAL_FUNC(destroy_invite), invite);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
291
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
292 gtk_signal_connect(GTK_OBJECT(cancel), "clicked", GTK_SIGNAL_FUNC(destroy_invite), b);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
293 gtk_signal_connect(GTK_OBJECT(invite_btn), "clicked", GTK_SIGNAL_FUNC(do_invite), b);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
294 gtk_signal_connect(GTK_OBJECT(inviteentry), "activate", GTK_SIGNAL_FUNC(do_invite), b);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
295 /* Finish up */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
296 gtk_widget_show(invite_btn);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
297 gtk_widget_show(cancel);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
298 gtk_widget_show(inviteentry);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
299 gtk_widget_show(invitemess);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
300 gtk_widget_show(topbox);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
301 gtk_widget_show(bbox);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
302 gtk_widget_show(vbox);
350
fd3cc0a28d5d [gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
303 gtk_window_set_title(GTK_WINDOW(invite), _("Invite to Buddy Chat"));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
304 gtk_window_set_focus(GTK_WINDOW(invite), inviteentry);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
305 gtk_container_add(GTK_CONTAINER(invite), vbox);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
306 gtk_widget_realize(invite);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
307 aol_icon(invite->window);
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 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
310 gtk_widget_show(invite);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
311 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
312
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
313 gboolean meify(char *message)
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
314 {
415
a266fd221c3c [gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
315 /* 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
316 * the "/me " part of it (including that space) and return TRUE */
a266fd221c3c [gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
317 char *c = message;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
318 int inside_HTML = 0; /* i really don't like descriptive names */
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
319 if (!c)
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
320 return FALSE; /* um... this would be very bad if this happens */
415
a266fd221c3c [gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
321 while (*c) {
a266fd221c3c [gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
322 if (inside_HTML) {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
323 if (*c == '>')
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
324 inside_HTML = 0;
415
a266fd221c3c [gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
325 } else {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
326 if (*c == '<')
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
327 inside_HTML = 1;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
328 else
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
329 break;
415
a266fd221c3c [gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
330 }
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
331 c++; /* i really don't like c++ either */
415
a266fd221c3c [gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
332 }
a266fd221c3c [gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
333 /* k, so now we've gotten past all the HTML crap. */
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
334 if (!*c)
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
335 return FALSE;
415
a266fd221c3c [gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
336 if (!strncmp(c, "/me ", 4)) {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
337 sprintf(c, "%s", c + 4);
415
a266fd221c3c [gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
338 return TRUE;
a266fd221c3c [gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
339 } else
a266fd221c3c [gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
340 return FALSE;
a266fd221c3c [gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
341 }
a266fd221c3c [gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
342
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
343 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
344 {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
345 GList *ignore = b->ignored;
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
346 char *str;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
347
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
348 if (!b->is_chat) {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
349 debug_printf("chat_write: expecting chat, got IM\n");
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
350 return;
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
351 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
352
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
353 while (ignore) {
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
354 if (!strcasecmp(who, ignore->data))
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
355 return;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
356 ignore = ignore->next;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
357 }
371
9d22acf6db73 [gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
358
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
359
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
360 if (!(flag & WFLAG_WHISPER)) {
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
361 str = g_strdup(normalize(who));
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 915
diff changeset
362 if (!strcasecmp(str, normalize(b->gc->username))) {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
363 debug_printf("%s %s\n", normalize(who), normalize(b->gc->username));
1006
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1000
diff changeset
364 if (b->makesound && (sound_options & OPT_SOUND_CHAT_YOU_SAY))
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1000
diff changeset
365 play_sound(CHAT_YOU_SAY);
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
366 flag |= WFLAG_SEND;
371
9d22acf6db73 [gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
367 } else {
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
368 if (b->makesound && (sound_options & OPT_SOUND_CHAT_SAY))
1006
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1000
diff changeset
369 play_sound(CHAT_SAY);
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
370 flag |= WFLAG_RECV;
371
9d22acf6db73 [gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
371 }
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
372 g_free(str);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
373 }
1
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 write_to_conv(b, message, flag, who);
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
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
378
368
9bf1f77985d2 [gaim-migrate @ 378]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 363
diff changeset
379
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
380 void whisper_callback(GtkWidget *widget, struct conversation *b)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
381 {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
382 char buf[BUF_LEN * 4];
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
383 char buf2[BUF_LONG];
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
384 GList *selected;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
385 char *who;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
386
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
387 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
388 if (!strlen(buf))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
389 return;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
390
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
391 selected = GTK_LIST(b->list)->selection;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
392
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
393 if (!selected)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
394 return;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
395
1
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 who = GTK_LABEL(gtk_container_children(GTK_CONTAINER(selected->data))->data)->label;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
398
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
399 if (!who)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
400 return;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
401
338
9d258a0aa560 [gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 300
diff changeset
402 gtk_editable_delete_text(GTK_EDITABLE(b->entry), 0, -1);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
403
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
404 escape_text(buf); /* it's ok to leave this here because oscar can't whisper */
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
405 serv_chat_whisper(b->gc, b->id, who, buf);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
406
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 915
diff changeset
407 g_snprintf(buf2, sizeof(buf2), "%s->%s", b->gc->username, who);
1
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 chat_write(b, buf2, WFLAG_WHISPER, buf);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
410
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
411 gtk_widget_grab_focus(GTK_WIDGET(b->entry));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
412
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
413
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
414 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
415
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
416
1223
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
417 static gint insertname(gconstpointer one, gconstpointer two)
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
418 {
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
419 const char *a = (const char *)one;
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
420 const char *b = (const char *)two;
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
421
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
422 if (*a == '@') {
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
423 if (*b != '@')
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
424 return -1;
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
425 return (strcmp(a + 1, b + 1));
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
426 } else if (*a == '+') {
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
427 if (*b == '@')
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
428 return 1;
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
429 if (*b != '+')
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
430 return -1;
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
431 return (strcmp(a + 1, b + 1));
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
432 } else {
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
433 if (*b == '@' || *b == '+')
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
434 return 1;
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
435 return strcmp(a, b);
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
436 }
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
437 }
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
438
1398
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
439 static void chat_press_im(GtkObject *obj, struct conversation *b)
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
440 {
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
441 struct conversation *c;
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
442
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
443 c = find_conversation(gtk_object_get_user_data(obj));
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
444
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
445 if (c != NULL)
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
446 gdk_window_show(c->window->window);
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
447 else {
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
448 c = new_conversation(gtk_object_get_user_data(obj));
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
449 c->gc = b->gc;
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
450 gtk_option_menu_set_history(GTK_OPTION_MENU(c->menu), g_slist_index(connections, b->gc));
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
451 update_buttons_by_protocol(c);
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
452 }
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
453 }
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
454
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
455 static void chat_press_ign(GtkWidget *obj, struct conversation *b)
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
456 {
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
457 gtk_list_select_child(GTK_LIST(b->list), gtk_object_get_user_data(GTK_OBJECT(obj)));
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
458 ignore_callback(obj, b);
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
459 }
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
460
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
461 static void chat_press_info(GtkObject *obj, struct conversation *b)
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
462 {
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
463 (*b->gc->prpl->get_info)(b->gc, gtk_object_get_user_data(obj));
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
464 }
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
465
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
466 static gint right_click_chat(GtkObject *obj, GdkEventButton *event, struct conversation *b)
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
467 {
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
468 if (event->button == 3 && event->type == GDK_BUTTON_PRESS) {
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
469 GtkWidget *menu;
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
470 GtkWidget *button;
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
471
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
472 menu = gtk_menu_new();
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
473
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
474 button = gtk_menu_item_new_with_label(_("IM"));
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
475 gtk_signal_connect(GTK_OBJECT(button), "activate", GTK_SIGNAL_FUNC(chat_press_im), b);
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
476 gtk_object_set_user_data(GTK_OBJECT(button), gtk_object_get_user_data(obj));
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
477 gtk_menu_append(GTK_MENU(menu), button);
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
478 gtk_widget_show(button);
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
479
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
480 button = gtk_menu_item_new_with_label(_("Ignore"));
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
481 gtk_signal_connect(GTK_OBJECT(button), "activate", GTK_SIGNAL_FUNC(chat_press_ign), b);
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
482 gtk_object_set_user_data(GTK_OBJECT(button), obj);
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
483 gtk_menu_append(GTK_MENU(menu), button);
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
484 gtk_widget_show(button);
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
485
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
486 if (b->gc->prpl->get_info) {
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
487 button = gtk_menu_item_new_with_label(_("Info"));
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
488 gtk_signal_connect(GTK_OBJECT(button), "activate",
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
489 GTK_SIGNAL_FUNC(chat_press_info), b);
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
490 gtk_object_set_user_data(GTK_OBJECT(button), gtk_object_get_user_data(obj));
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
491 gtk_menu_append(GTK_MENU(menu), button);
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
492 gtk_widget_show(button);
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
493 }
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
494
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
495 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, event->button, event->time);
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
496 return TRUE;
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
497 }
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
498 return TRUE;
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
499 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
500
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
501 void add_chat_buddy(struct conversation *b, char *buddy)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
502 {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
503 char *name = g_strdup(buddy);
612
12bb64b42ad1 [gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 604
diff changeset
504 char tmp[BUF_LONG];
1053
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
505 GtkWidget *list_item;
1223
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
506 int pos;
1303
9c34f99af79e [gaim-migrate @ 1313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
507 GList *ignored;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
508
1000
91b7377e7b45 [gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 964
diff changeset
509 plugin_event(event_chat_buddy_join, b->gc, b->name, name, 0);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
510 b->in_room = g_list_insert_sorted(b->in_room, name, insertname);
1223
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
511 pos = g_list_index(b->in_room, name);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
512
1303
9c34f99af79e [gaim-migrate @ 1313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
513 ignored = b->ignored;
9c34f99af79e [gaim-migrate @ 1313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
514 while (ignored) {
9c34f99af79e [gaim-migrate @ 1313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
515 if (!strcasecmp(name, ignored->data))
9c34f99af79e [gaim-migrate @ 1313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
516 break;
9c34f99af79e [gaim-migrate @ 1313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
517 ignored = ignored->next;
9c34f99af79e [gaim-migrate @ 1313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
518 }
9c34f99af79e [gaim-migrate @ 1313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
519
9c34f99af79e [gaim-migrate @ 1313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
520 if (ignored) {
9c34f99af79e [gaim-migrate @ 1313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
521 g_snprintf(tmp, sizeof(tmp), "X %s", name);
9c34f99af79e [gaim-migrate @ 1313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
522 list_item = gtk_list_item_new_with_label(tmp);
9c34f99af79e [gaim-migrate @ 1313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
523 } else
9c34f99af79e [gaim-migrate @ 1313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
524 list_item = gtk_list_item_new_with_label(name);
9c34f99af79e [gaim-migrate @ 1313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
525
1053
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
526 gtk_object_set_user_data(GTK_OBJECT(list_item), name);
1398
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
527 gtk_signal_connect(GTK_OBJECT(list_item), "button_press_event",
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
528 GTK_SIGNAL_FUNC(right_click_chat), b);
1223
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
529 gtk_list_insert_items(GTK_LIST(b->list), g_list_append(NULL, list_item), pos);
1053
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
530 gtk_widget_show(list_item);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
531
1390
a437240b9771 [gaim-migrate @ 1400]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1389
diff changeset
532 g_snprintf(tmp, sizeof(tmp), _("%d %s in room"), g_list_length(b->in_room), g_list_length(b->in_room) == 1 ? "person" : "people");
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
533 gtk_label_set_text(GTK_LABEL(b->count), tmp);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
534
371
9d22acf6db73 [gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
535 if (b->makesound && (sound_options & OPT_SOUND_CHAT_JOIN))
1006
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1000
diff changeset
536 play_sound(CHAT_JOIN);
612
12bb64b42ad1 [gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 604
diff changeset
537
12bb64b42ad1 [gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 604
diff changeset
538 if (display_options & OPT_DISP_CHAT_LOGON) {
12bb64b42ad1 [gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 604
diff changeset
539 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
540 write_to_conv(b, tmp, WFLAG_SYSTEM, NULL);
12bb64b42ad1 [gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 604
diff changeset
541 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
542 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
543
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
544
1504
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
545 void rename_chat_buddy(struct conversation *b, char *old, char *new)
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
546 {
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
547 GList *names = b->in_room;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
548 GList *items = GTK_LIST(b->list)->children;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
549
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
550 char *name = g_strdup(new);
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
551 GtkWidget *list_item;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
552 int pos;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
553 GList *ignored = b->ignored;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
554
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
555 char tmp[BUF_LONG];
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
556
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
557 while (names) {
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
558 if (!strcasecmp((char *)names->data, old)) {
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
559 char *tmp2 = names->data;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
560 b->in_room = g_list_remove(b->in_room, names->data);
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
561 while (items) {
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
562 if (tmp2 == gtk_object_get_user_data(items->data)) {
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
563 gtk_list_remove_items(GTK_LIST(b->list),
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
564 g_list_append(NULL, items->data));
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
565 break;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
566 }
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
567 items = items->next;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
568 }
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
569 g_free(tmp2);
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
570 break;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
571 }
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
572 names = names->next;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
573 }
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
574
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
575 if (!names)
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
576 return;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
577
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
578 b->in_room = g_list_insert_sorted(b->in_room, name, insertname);
1505
171c64f70b66 [gaim-migrate @ 1515]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1504
diff changeset
579 pos = g_list_index(b->in_room, name);
1504
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
580
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
581 while (ignored) {
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
582 if (!strcasecmp(old, ignored->data))
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
583 break;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
584 ignored = ignored->next;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
585 }
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
586
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
587 if (ignored) {
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
588 b->ignored = g_list_remove(b->ignored, ignored->data);
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
589 b->ignored = g_list_append(b->ignored, name);
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
590 g_snprintf(tmp, sizeof(tmp), "X %s", name);
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
591 list_item = gtk_list_item_new_with_label(tmp);
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
592 } else
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
593 list_item = gtk_list_item_new_with_label(name);
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
594
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
595 gtk_object_set_user_data(GTK_OBJECT(list_item), name);
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
596 gtk_signal_connect(GTK_OBJECT(list_item), "button_press_event",
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
597 GTK_SIGNAL_FUNC(right_click_chat), b);
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
598 gtk_list_insert_items(GTK_LIST(b->list), g_list_append(NULL, list_item), pos);
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
599 gtk_widget_show(list_item);
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
600
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
601 if (display_options & OPT_DISP_CHAT_LOGON) {
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
602 g_snprintf(tmp, sizeof(tmp), _("<B>%s is now known as %s</B>"), old, new);
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
603 write_to_conv(b, tmp, WFLAG_SYSTEM, NULL);
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
604 }
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
605 }
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
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
608 void remove_chat_buddy(struct conversation *b, char *buddy)
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
609 {
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
610 GList *names = b->in_room;
1053
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
611 GList *items = GTK_LIST(b->list)->children;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
612
612
12bb64b42ad1 [gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 604
diff changeset
613 char tmp[BUF_LONG];
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
614
1000
91b7377e7b45 [gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 964
diff changeset
615 plugin_event(event_chat_buddy_leave, b->gc, b->name, buddy, 0);
391
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 375
diff changeset
616
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
617 while (names) {
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
618 if (!strcasecmp((char *)names->data, buddy)) {
1053
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
619 char *tmp = names->data;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
620 b->in_room = g_list_remove(b->in_room, names->data);
1053
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
621 while (items) {
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
622 if (tmp == gtk_object_get_user_data(items->data)) {
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
623 gtk_list_remove_items(GTK_LIST(b->list),
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
624 g_list_append(NULL, items->data));
1053
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
625 break;
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
626 }
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
627 items = items->next;
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
628 }
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
629 g_free(tmp);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
630 break;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
631 }
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
632 names = names->next;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
633 }
371
9d22acf6db73 [gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
634
1504
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
635 if (!names)
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
636 return;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
637
1390
a437240b9771 [gaim-migrate @ 1400]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1389
diff changeset
638 g_snprintf(tmp, sizeof(tmp), _("%d %s in room"), g_list_length(b->in_room), g_list_length(b->in_room) == 1 ? "person" : "people");
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
639 gtk_label_set_text(GTK_LABEL(b->count), tmp);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
640
1006
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1000
diff changeset
641 if (b->makesound && (sound_options & OPT_SOUND_CHAT_PART))
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1000
diff changeset
642 play_sound(CHAT_LEAVE);
612
12bb64b42ad1 [gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 604
diff changeset
643
12bb64b42ad1 [gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 604
diff changeset
644 if (display_options & OPT_DISP_CHAT_LOGON) {
12bb64b42ad1 [gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 604
diff changeset
645 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
646 write_to_conv(b, tmp, WFLAG_SYSTEM, NULL);
12bb64b42ad1 [gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 604
diff changeset
647 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
648 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
649
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
650
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
651 void im_callback(GtkWidget *w, struct conversation *b)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
652 {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
653 char *name;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
654 GList *i;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
655 struct conversation *c;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
656
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
657 i = GTK_LIST(b->list)->selection;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
658 if (i)
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
659 name = (char *)gtk_object_get_user_data(GTK_OBJECT(i->data));
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
660 else
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
661 return;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
662
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
663 c = find_conversation(name);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
664
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
665 if (c != NULL) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
666 gdk_window_raise(c->window->window);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
667 } else {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
668 c = new_conversation(name);
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
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
671
1
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
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
674 void ignore_callback(GtkWidget *w, struct conversation *b)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
675 {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
676 char *name;
1303
9c34f99af79e [gaim-migrate @ 1313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
677 GList *i, *ignored;
1053
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
678 int pos;
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
679 GtkWidget *list_item;
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
680 char tmp[80];
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
681
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
682 i = GTK_LIST(b->list)->selection;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
683 if (i)
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
684 name = (char *)gtk_object_get_user_data(GTK_OBJECT(i->data));
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
685 else
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
686 return;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
687
1053
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
688 pos = gtk_list_child_position(GTK_LIST(b->list), i->data);
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
689
1303
9c34f99af79e [gaim-migrate @ 1313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
690 ignored = b->ignored;
9c34f99af79e [gaim-migrate @ 1313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
691 while (ignored) {
9c34f99af79e [gaim-migrate @ 1313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
692 if (!strcasecmp(name, ignored->data))
9c34f99af79e [gaim-migrate @ 1313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
693 break;
9c34f99af79e [gaim-migrate @ 1313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
694 ignored = ignored->next;
9c34f99af79e [gaim-migrate @ 1313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
695 }
9c34f99af79e [gaim-migrate @ 1313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
696
9c34f99af79e [gaim-migrate @ 1313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
697 if (ignored) {
9c34f99af79e [gaim-migrate @ 1313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
698 b->ignored = g_list_remove(b->ignored, ignored->data);
9c34f99af79e [gaim-migrate @ 1313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
699 g_snprintf(tmp, sizeof tmp, "%s", name);
9c34f99af79e [gaim-migrate @ 1313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
700 } else {
9c34f99af79e [gaim-migrate @ 1313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
701 b->ignored = g_list_append(b->ignored, g_strdup(name));
1053
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
702 g_snprintf(tmp, sizeof tmp, "X %s", name);
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
703 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
704
1053
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
705 list_item = gtk_list_item_new_with_label(tmp);
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
706 gtk_object_set_user_data(GTK_OBJECT(list_item), name);
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
707 gtk_list_insert_items(GTK_LIST(b->list), g_list_append(NULL, list_item), pos);
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
708 gtk_widget_destroy(i->data);
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
709 gtk_widget_show(list_item);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
710 }
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
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
714 void show_new_buddy_chat(struct conversation *b)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
715 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
716 GtkWidget *win;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
717 GtkWidget *text;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
718 GtkWidget *send;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
719 GtkWidget *list;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
720 GtkWidget *invite_btn;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
721 GtkWidget *whisper;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
722 GtkWidget *close;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
723 GtkWidget *chatentry;
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
724 GtkWidget *lbox;
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
725 GtkWidget *bbox;
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
726 GtkWidget *bbox2;
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
727 GtkWidget *im, *ignore, *info;
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
728 GtkWidget *sw;
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
729 GtkWidget *sw2;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
730 GtkWidget *vbox;
223
ac05dfb9e762 [gaim-migrate @ 233]
Syd Logan <slogan>
parents: 199
diff changeset
731 GtkWidget *vpaned;
ac05dfb9e762 [gaim-migrate @ 233]
Syd Logan <slogan>
parents: 199
diff changeset
732 GtkWidget *hpaned;
344
2434adbb8703 [gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 338
diff changeset
733 GtkWidget *toolbar;
1380
638af9a58e39 [gaim-migrate @ 1390]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1358
diff changeset
734 char buf[BUF_LONG];
844
fae1d64b0278 [gaim-migrate @ 854]
Rob Flynn <gaim@robflynn.com>
parents: 834
diff changeset
735
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
736 int dispstyle = set_dispstyle(1);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
737
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
738 win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
739 b->window = win;
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
740 gtk_object_set_user_data(GTK_OBJECT(win), b);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
741 gtk_window_set_wmclass(GTK_WINDOW(win), "buddy_chat", "Gaim");
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
742 gtk_window_set_policy(GTK_WINDOW(win), TRUE, TRUE, TRUE);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
743 gtk_container_border_width(GTK_CONTAINER(win), 10);
1380
638af9a58e39 [gaim-migrate @ 1390]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1358
diff changeset
744 g_snprintf(buf, sizeof(buf), "Gaim - %s (chat)", b->name);
638af9a58e39 [gaim-migrate @ 1390]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1358
diff changeset
745 gtk_window_set_title(GTK_WINDOW(win), buf);
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
746 gtk_signal_connect(GTK_OBJECT(win), "destroy", GTK_SIGNAL_FUNC(close_callback), b);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
747 gtk_widget_realize(win);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
748 aol_icon(win->window);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
749
223
ac05dfb9e762 [gaim-migrate @ 233]
Syd Logan <slogan>
parents: 199
diff changeset
750 vpaned = gtk_vpaned_new();
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
751 gtk_paned_set_gutter_size(GTK_PANED(vpaned), 15);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
752 gtk_container_add(GTK_CONTAINER(win), vpaned);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
753 gtk_widget_show(vpaned);
223
ac05dfb9e762 [gaim-migrate @ 233]
Syd Logan <slogan>
parents: 199
diff changeset
754
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
755 hpaned = gtk_hpaned_new();
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
756 gtk_paned_set_gutter_size(GTK_PANED(hpaned), 15);
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
757 gtk_paned_pack1(GTK_PANED(vpaned), hpaned, TRUE, FALSE);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
758 gtk_widget_show(hpaned);
26
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 21
diff changeset
759
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
760 sw = gtk_scrolled_window_new(NULL, NULL);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
761 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
762 gtk_paned_pack1(GTK_PANED(hpaned), sw, TRUE, TRUE);
1228
6773043cf9f6 [gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1227
diff changeset
763 gtk_widget_set_usize(sw, 320, 160);
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
764 gtk_widget_show(sw);
834
bac7089491c1 [gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 823
diff changeset
765
1428
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1398
diff changeset
766 text = gtk_imhtml_new(NULL, NULL);
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
767 b->text = text;
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
768 gtk_container_add(GTK_CONTAINER(sw), text);
1428
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1398
diff changeset
769 GTK_LAYOUT(text)->hadjustment->step_increment = 10.0;
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1398
diff changeset
770 GTK_LAYOUT(text)->vadjustment->step_increment = 10.0;
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1398
diff changeset
771 if (!(display_options & OPT_DISP_SHOW_SMILEY))
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1398
diff changeset
772 gtk_imhtml_show_smileys(GTK_IMHTML(text), FALSE);
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1398
diff changeset
773 if (display_options & OPT_DISP_SHOW_TIME)
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1398
diff changeset
774 gtk_imhtml_show_comments(GTK_IMHTML(text), TRUE);
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1398
diff changeset
775 gtk_signal_connect(GTK_OBJECT(text), "url_clicked", GTK_SIGNAL_FUNC(open_url_nw), NULL);
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1398
diff changeset
776 gtk_imhtml_associate_smiley(GTK_IMHTML(text), "C:)", luke03_xpm);
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1398
diff changeset
777 gtk_imhtml_associate_smiley(GTK_IMHTML(text), "C:-)", luke03_xpm);
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1398
diff changeset
778 gtk_imhtml_associate_smiley(GTK_IMHTML(text), "O-)", oneeye_xpm);
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
779 gtk_widget_show(text);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
780
1228
6773043cf9f6 [gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1227
diff changeset
781 lbox = gtk_vbox_new(FALSE, 5);
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
782 gtk_paned_pack2(GTK_PANED(hpaned), lbox, TRUE, TRUE);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
783 gtk_widget_show(lbox);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
784
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
785 b->count = gtk_label_new(_("0 people in room"));
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
786 gtk_box_pack_start(GTK_BOX(lbox), b->count, FALSE, FALSE, 0);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
787 gtk_widget_show(b->count);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
788
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
789 sw2 = gtk_scrolled_window_new(NULL, NULL);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
790 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw2), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
791 gtk_box_pack_start(GTK_BOX(lbox), sw2, TRUE, TRUE, 0);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
792 gtk_widget_show(sw2);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
793
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
794 list = gtk_list_new();
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
795 b->list = list;
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
796 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw2), list);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
797 gtk_widget_set_usize(list, 150, -1);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
798 gtk_widget_show(list);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
799
1228
6773043cf9f6 [gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1227
diff changeset
800 bbox2 = gtk_hbox_new(TRUE, 5);
6773043cf9f6 [gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1227
diff changeset
801 gtk_box_pack_start(GTK_BOX(lbox), bbox2, FALSE, FALSE, 0);
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
802 gtk_widget_show(bbox2);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
803
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
804 im = picture_button2(win, _("IM"), tmp_send_xpm, FALSE);
1228
6773043cf9f6 [gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1227
diff changeset
805 gtk_box_pack_start(GTK_BOX(bbox2), im, dispstyle, dispstyle, 0);
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
806 gtk_signal_connect(GTK_OBJECT(im), "clicked", GTK_SIGNAL_FUNC(im_callback), b);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
807
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
808 ignore = picture_button2(win, _("Ignore"), close_xpm, FALSE);
1228
6773043cf9f6 [gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1227
diff changeset
809 gtk_box_pack_start(GTK_BOX(bbox2), ignore, dispstyle, dispstyle, 0);
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
810 gtk_signal_connect(GTK_OBJECT(ignore), "clicked", GTK_SIGNAL_FUNC(ignore_callback), b);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
811
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
812 info = picture_button2(win, _("Info"), tb_search_xpm, FALSE);
1228
6773043cf9f6 [gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1227
diff changeset
813 gtk_box_pack_start(GTK_BOX(bbox2), info, dispstyle, dispstyle, 0);
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
814 gtk_signal_connect(GTK_OBJECT(info), "clicked", GTK_SIGNAL_FUNC(info_callback), b);
1343
a0d89bdc733e [gaim-migrate @ 1353]
Rob Flynn <gaim@robflynn.com>
parents: 1303
diff changeset
815 b->info = info;
844
fae1d64b0278 [gaim-migrate @ 854]
Rob Flynn <gaim@robflynn.com>
parents: 834
diff changeset
816
1228
6773043cf9f6 [gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1227
diff changeset
817 vbox = gtk_vbox_new(FALSE, 5);
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
818 gtk_paned_pack2(GTK_PANED(vpaned), vbox, TRUE, FALSE);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
819 gtk_widget_show(vbox);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
820
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
821 chatentry = gtk_text_new(NULL, NULL);
1227
25611364a504 [gaim-migrate @ 1237]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1223
diff changeset
822 b->entry = chatentry;
25611364a504 [gaim-migrate @ 1237]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1223
diff changeset
823
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
824 toolbar = build_conv_toolbar(b);
1228
6773043cf9f6 [gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1227
diff changeset
825 gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
826
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
827 gtk_object_set_user_data(GTK_OBJECT(chatentry), b);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
828 gtk_text_set_editable(GTK_TEXT(chatentry), TRUE);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
829 gtk_text_set_word_wrap(GTK_TEXT(chatentry), TRUE);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
830 gtk_signal_connect(GTK_OBJECT(chatentry), "activate", GTK_SIGNAL_FUNC(send_callback), b);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
831 gtk_signal_connect(GTK_OBJECT(chatentry), "key_press_event", GTK_SIGNAL_FUNC(keypress_callback),
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
832 b);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
833 gtk_signal_connect(GTK_OBJECT(chatentry), "key_press_event", GTK_SIGNAL_FUNC(entry_key_pressed),
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
834 chatentry);
1117
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1109
diff changeset
835 if (general_options & OPT_GEN_CHECK_SPELLING)
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1109
diff changeset
836 gtkspell_attach(GTK_TEXT(chatentry));
1228
6773043cf9f6 [gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1227
diff changeset
837 gtk_box_pack_start(GTK_BOX(vbox), chatentry, TRUE, TRUE, 0);
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
838 if (display_options & OPT_DISP_CHAT_BIG_ENTRY)
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
839 gtk_widget_set_usize(chatentry, 320, 50);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
840 else
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
841 gtk_widget_set_usize(chatentry, 320, 25);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
842 gtk_window_set_focus(GTK_WINDOW(win), chatentry);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
843 gtk_widget_show(chatentry);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
844
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
845 bbox = gtk_hbox_new(FALSE, 5);
1228
6773043cf9f6 [gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1227
diff changeset
846 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
847 gtk_widget_show(bbox);
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
848
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
849 close = picture_button2(win, _("Close"), cancel_xpm, dispstyle);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
850 b->close = close;
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
851 gtk_object_set_user_data(GTK_OBJECT(close), b);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
852 gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(close_callback), b);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
853 gtk_box_pack_end(GTK_BOX(bbox), close, dispstyle, dispstyle, 0);
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
854
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
855 invite_btn = picture_button2(win, _("Invite"), join_xpm, dispstyle);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
856 b->invite = invite_btn;
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
857 gtk_signal_connect(GTK_OBJECT(invite_btn), "clicked", GTK_SIGNAL_FUNC(invite_callback), b);
1228
6773043cf9f6 [gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1227
diff changeset
858 gtk_box_pack_end(GTK_BOX(bbox), invite_btn, dispstyle, dispstyle, 0);
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
859
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
860 whisper = picture_button2(win, _("Whisper"), tb_forward_xpm, dispstyle);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
861 b->whisper = whisper;
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
862 gtk_signal_connect(GTK_OBJECT(whisper), "clicked", GTK_SIGNAL_FUNC(whisper_callback), b);
1228
6773043cf9f6 [gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1227
diff changeset
863 gtk_box_pack_end(GTK_BOX(bbox), whisper, dispstyle, dispstyle, 0);
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
864
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
865 send = picture_button2(win, _("Send"), tmp_send_xpm, dispstyle);
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
866 b->send = send;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
867 gtk_signal_connect(GTK_OBJECT(send), "clicked", GTK_SIGNAL_FUNC(send_callback), b);
1228
6773043cf9f6 [gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1227
diff changeset
868 gtk_box_pack_end(GTK_BOX(bbox), send, dispstyle, dispstyle, 0);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
869
716
0995382d0c46 [gaim-migrate @ 726]
Todd Kulesza <fflewddur>
parents: 694
diff changeset
870 b->font_dialog = NULL;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
871 b->fg_color_dialog = NULL;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
872 b->bg_color_dialog = NULL;
716
0995382d0c46 [gaim-migrate @ 726]
Todd Kulesza <fflewddur>
parents: 694
diff changeset
873 b->smiley_dialog = NULL;
0995382d0c46 [gaim-migrate @ 726]
Todd Kulesza <fflewddur>
parents: 694
diff changeset
874 b->link_dialog = NULL;
0995382d0c46 [gaim-migrate @ 726]
Todd Kulesza <fflewddur>
parents: 694
diff changeset
875 b->log_dialog = NULL;
0995382d0c46 [gaim-migrate @ 726]
Todd Kulesza <fflewddur>
parents: 694
diff changeset
876 sprintf(b->fontface, "%s", fontface);
0995382d0c46 [gaim-migrate @ 726]
Todd Kulesza <fflewddur>
parents: 694
diff changeset
877 b->hasfont = 0;
1441
5c67b8794991 [gaim-migrate @ 1451]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1428
diff changeset
878 b->fontsize = fontsize;
5c67b8794991 [gaim-migrate @ 1451]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1428
diff changeset
879 b->hassize = 0;
716
0995382d0c46 [gaim-migrate @ 726]
Todd Kulesza <fflewddur>
parents: 694
diff changeset
880 b->bgcol = bgcolor;
0995382d0c46 [gaim-migrate @ 726]
Todd Kulesza <fflewddur>
parents: 694
diff changeset
881 b->hasbg = 0;
0995382d0c46 [gaim-migrate @ 726]
Todd Kulesza <fflewddur>
parents: 694
diff changeset
882 b->fgcol = fgcolor;
0995382d0c46 [gaim-migrate @ 726]
Todd Kulesza <fflewddur>
parents: 694
diff changeset
883 b->hasfg = 0;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
884
1343
a0d89bdc733e [gaim-migrate @ 1353]
Rob Flynn <gaim@robflynn.com>
parents: 1303
diff changeset
885 update_buttons_by_protocol(b);
a0d89bdc733e [gaim-migrate @ 1353]
Rob Flynn <gaim@robflynn.com>
parents: 1303
diff changeset
886
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
887 gtk_widget_show(win);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
888 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
889
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
890
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
891
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
892 void handle_click_chat(GtkWidget *widget, GdkEventButton * event, struct chat_room *cr)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
893 {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
894 if (event->type == GDK_2BUTTON_PRESS && event->button == 1) {
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1053
diff changeset
895 /* FIXME : double click on chat in buddy list */
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
896 serv_join_chat(connections->data, cr->exchange, cr->name);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
897 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
898 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
899
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
900
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
901 void setup_buddy_chats()
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
902 {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
903 GList *list;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
904 struct chat_room *cr;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
905 GList *crs = chat_rooms;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
906 GtkWidget *w;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
907 GtkWidget *item;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
908 GtkWidget *tree;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
909
21
8ba601b1949a [gaim-migrate @ 30]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
910 if (buddies == NULL)
8ba601b1949a [gaim-migrate @ 30]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
911 return;
8ba601b1949a [gaim-migrate @ 30]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
912
8ba601b1949a [gaim-migrate @ 30]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
913 list = GTK_TREE(buddies)->children;
8ba601b1949a [gaim-migrate @ 30]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
914
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
915 while (list) {
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
916 w = (GtkWidget *)list->data;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
917 if (!strcmp(GTK_LABEL(GTK_BIN(w)->child)->label, _("Buddy Chat"))) {
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
918 gtk_tree_remove_items(GTK_TREE(buddies), list);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
919 list = GTK_TREE(buddies)->children;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
920 if (!list)
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
921 break;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
922 }
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
923 list = list->next;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
924 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
925
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
926 if (crs == NULL)
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
927 return;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
928
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
929 item = gtk_tree_item_new_with_label(_("Buddy Chat"));
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
930 tree = gtk_tree_new();
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
931 gtk_widget_show(item);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
932 gtk_widget_show(tree);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
933 gtk_tree_append(GTK_TREE(buddies), item);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
934 gtk_tree_item_set_subtree(GTK_TREE_ITEM(item), tree);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
935 gtk_tree_item_expand(GTK_TREE_ITEM(item));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
936
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
937 while (crs) {
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
938 cr = (struct chat_room *)crs->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
939
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
940 item = gtk_tree_item_new_with_label(cr->name);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
941 gtk_object_set_user_data(GTK_OBJECT(item), cr);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
942 gtk_tree_append(GTK_TREE(tree), item);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
943 gtk_widget_show(item);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
944 gtk_signal_connect(GTK_OBJECT(item), "button_press_event",
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
945 GTK_SIGNAL_FUNC(handle_click_chat), cr);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
946
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
947 crs = crs->next;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
948
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
949 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
950
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
951 }
834
bac7089491c1 [gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 823
diff changeset
952
915
378c862a2381 [gaim-migrate @ 925]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 909
diff changeset
953 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
954 {
915
378c862a2381 [gaim-migrate @ 925]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 909
diff changeset
955 int dispstyle = set_dispstyle(chat);
834
bac7089491c1 [gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 823
diff changeset
956 GtkWidget *parent = button->parent;
bac7089491c1 [gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 823
diff changeset
957 gtk_widget_destroy(button);
bac7089491c1 [gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 823
diff changeset
958 button = picture_button2(win, text, xpm, dispstyle);
915
378c862a2381 [gaim-migrate @ 925]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 909
diff changeset
959 if (chat == 1)
909
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
960 gtk_box_pack_start(GTK_BOX(parent), button, dispstyle, dispstyle, 5);
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
961 else
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
962 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
963 gtk_widget_show(button);
bac7089491c1 [gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 823
diff changeset
964 return button;
bac7089491c1 [gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 823
diff changeset
965 }
bac7089491c1 [gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 823
diff changeset
966
bac7089491c1 [gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 823
diff changeset
967 void update_chat_button_pix()
bac7089491c1 [gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 823
diff changeset
968 {
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
969 GSList *C = connections;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
970 struct gaim_connection *g;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
971
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
972 while (C) {
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
973 GSList *bcs;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
974 struct conversation *c;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
975 int opt = 1;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
976 g = (struct gaim_connection *)C->data;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
977 bcs = g->buddy_chats;
834
bac7089491c1 [gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 823
diff changeset
978
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
979 while (bcs) {
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
980 c = (struct conversation *)bcs->data;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
981 c->send = change_text(c->window, _("Send"), c->send, tmp_send_xpm, opt);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
982 c->whisper =
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
983 change_text(c->window, _("Whisper"), c->whisper, tb_forward_xpm, opt);
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
984 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
985 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
986 gtk_object_set_user_data(GTK_OBJECT(c->close), c);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
987 gtk_signal_connect(GTK_OBJECT(c->close), "clicked",
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
988 GTK_SIGNAL_FUNC(close_callback), c);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
989 gtk_signal_connect(GTK_OBJECT(c->send), "clicked",
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
990 GTK_SIGNAL_FUNC(send_callback), c);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
991 gtk_signal_connect(GTK_OBJECT(c->invite), "clicked",
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
992 GTK_SIGNAL_FUNC(invite_callback), c);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
993 gtk_signal_connect(GTK_OBJECT(c->whisper), "clicked",
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
994 GTK_SIGNAL_FUNC(whisper_callback), c);
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
995 bcs = bcs->next;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
996 }
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
997 C = C->next;
834
bac7089491c1 [gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 823
diff changeset
998 }
bac7089491c1 [gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 823
diff changeset
999 }
909
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1000
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1001 void update_im_button_pix()
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1002 {
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1003 GList *bcs = conversations;
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1004 struct conversation *c;
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1005 GtkWidget *parent;
915
378c862a2381 [gaim-migrate @ 925]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 909
diff changeset
1006 int opt = 0;
378c862a2381 [gaim-migrate @ 925]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 909
diff changeset
1007 int dispstyle = set_dispstyle(0);
909
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1008
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1009 while (bcs) {
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1010 c = (struct conversation *)bcs->data;
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1011 parent = c->close->parent;
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1012 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
1013 gtk_box_reorder_child(GTK_BOX(parent), c->close, 0);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1014 gtk_box_set_child_packing(GTK_BOX(parent), c->sep1, dispstyle, dispstyle, 0,
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1015 GTK_PACK_END);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1018
diff changeset
1016 if (find_buddy(c->gc, c->name) == NULL)
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1017 c->add = change_text(c->window, _("Add"), c->add, gnome_add_xpm, opt);
909
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1018 else
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1019 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
1020 gtk_box_reorder_child(GTK_BOX(parent), c->add, 2);
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1021 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
1022 gtk_box_reorder_child(GTK_BOX(parent), c->block, 3);
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1023 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
1024 gtk_box_reorder_child(GTK_BOX(parent), c->warn, 4);
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1025 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
1026 gtk_box_reorder_child(GTK_BOX(parent), c->info, 5);
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1027 c->send = change_text(c->window, _("Send"), c->send, tmp_send_xpm, opt);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1028 gtk_box_set_child_packing(GTK_BOX(parent), c->sep2, dispstyle, dispstyle, 0,
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1029 GTK_PACK_END);
909
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1030 gtk_box_reorder_child(GTK_BOX(parent), c->send, 7);
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1031 gtk_object_set_user_data(GTK_OBJECT(c->close), c);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1032 gtk_signal_connect(GTK_OBJECT(c->close), "clicked", GTK_SIGNAL_FUNC(close_callback), c);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1033 gtk_signal_connect(GTK_OBJECT(c->send), "clicked", GTK_SIGNAL_FUNC(send_callback), c);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1034 gtk_signal_connect(GTK_OBJECT(c->add), "clicked", GTK_SIGNAL_FUNC(add_callback), c);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1035 gtk_signal_connect(GTK_OBJECT(c->info), "clicked", GTK_SIGNAL_FUNC(info_callback), c);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1036 gtk_signal_connect(GTK_OBJECT(c->warn), "clicked", GTK_SIGNAL_FUNC(warn_callback), c);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1037 gtk_signal_connect(GTK_OBJECT(c->block), "clicked", GTK_SIGNAL_FUNC(block_callback), c);
909
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1038 bcs = bcs->next;
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1039 }
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1040 }