annotate src/buddy_chat.c @ 3629:afc5bb164c5a

[gaim-migrate @ 3752] the proper fix to the parse error the last commit resolved. committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Fri, 11 Oct 2002 02:10:08 +0000
parents bdd0bebd2d04
children e3583f15dfe0
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
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2048
diff changeset
23 #include <config.h>
349
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>
2374
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
28 #include <ctype.h>
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
29 #include <stdio.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
30 #include <stdlib.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
31 #include <gtk/gtk.h>
1428
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1398
diff changeset
32 #include "gtkimhtml.h"
1117
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1109
diff changeset
33 #include "gtkspell.h"
300
b32c83750104 [gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 226
diff changeset
34 #include <gdk/gdkkeysyms.h>
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
35
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
36 #include "convo.h"
1235
a9cf2f61a7b1 [gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1228
diff changeset
37 #include "prpl.h"
344
2434adbb8703 [gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 338
diff changeset
38
834
bac7089491c1 [gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 823
diff changeset
39 #include "pixmaps/tb_forward.xpm"
604
0b1a132e0f75 [gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 535
diff changeset
40 #include "pixmaps/join.xpm"
909
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
41 #include "pixmaps/close.xpm"
604
0b1a132e0f75 [gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 535
diff changeset
42
1819
47e064712091 [gaim-migrate @ 1829]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
43 GtkWidget *joinchat;
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
44 static struct gaim_connection *joinchatgc;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
45 static GtkWidget *invite;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
46 static GtkWidget *inviteentry;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
47 static GtkWidget *invitemess;
1807
ba8f463744c0 [gaim-migrate @ 1817]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1806
diff changeset
48 static GtkWidget *jc_vbox = NULL;
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
49 static GList *chatentries = NULL;
344
2434adbb8703 [gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 338
diff changeset
50 extern int state_lock;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
51
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
52 GList *chats = NULL;
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
53 GtkWidget *all_chats = NULL;
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
54 GtkWidget *chat_notebook = NULL;
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
55
2632
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
56 static char *ignored(struct conversation *b, char *who)
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
57 {
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
58 GList *ignore = b->ignored;
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
59 while (ignore) {
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
60 char *ign = ignore->data;
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
61 if (!g_strcasecmp(who, ign))
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
62 return ign;
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
63 if (*ign == '+' && !g_strcasecmp(who, ign + 1))
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
64 return ign;
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
65 if (*ign == '@') {
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
66 ign++;
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
67 if (*ign == '+' && !g_strcasecmp(who, ign + 1))
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
68 return ign;
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
69 if (*ign != '+' && !g_strcasecmp(who, ign))
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
70 return ign;
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
71 }
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
72 ignore = ignore->next;
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
73 }
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
74 return NULL;
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
75 }
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
76
1806
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
77
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
78 static void destroy_join_chat()
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
79 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
80 if (joinchat)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
81 gtk_widget_destroy(joinchat);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
82 joinchat = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
83 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
84
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
85 static void destroy_invite()
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
86 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
87 if (invite)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
88 gtk_widget_destroy(invite);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
89 invite = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
90 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
91
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
92
1819
47e064712091 [gaim-migrate @ 1829]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
93 void do_join_chat()
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
94 {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
95 if (joinchat) {
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
96 GList *data = NULL;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
97 GList *tmp = chatentries;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
98 int *ival;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
99 char *sval;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
100 while (tmp) {
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
101 if (gtk_object_get_user_data(tmp->data)) {
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
102 ival = g_new0(int, 1);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
103 *ival = gtk_spin_button_get_value_as_int(tmp->data);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
104 data = g_list_append(data, ival);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
105 } else {
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
106 sval = g_strdup(gtk_entry_get_text(tmp->data));
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
107 data = g_list_append(data, sval);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
108 }
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
109 tmp = tmp->next;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
110 }
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
111 serv_join_chat(joinchatgc, data);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
112
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
113 tmp = data;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
114 while (tmp) {
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
115 g_free(tmp->data);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
116 tmp = tmp->next;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
117 }
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
118 g_list_free(data);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
119
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
120 gtk_widget_destroy(joinchat);
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
121 if (chatentries)
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
122 g_list_free(chatentries);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
123 chatentries = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
124 }
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
125 joinchat = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
126 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
127
1806
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
128 static void rebuild_jc()
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
129 {
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
130 GList *list, *tmp;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
131 struct proto_chat_entry *pce;
2289
38e156136896 [gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2268
diff changeset
132 gboolean focus = TRUE;
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
133
1806
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
134 if (!joinchatgc)
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
135 return;
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
136
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
137 while (GTK_BOX(jc_vbox)->children)
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
138 gtk_container_remove(GTK_CONTAINER(jc_vbox),
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
139 ((GtkBoxChild *)GTK_BOX(jc_vbox)->children->data)->widget);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
140 if (chatentries)
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
141 g_list_free(chatentries);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
142 chatentries = NULL;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
143
2662
b0c5770156e1 [gaim-migrate @ 2675]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2634
diff changeset
144 tmp = list = joinchatgc->prpl->chat_info(joinchatgc);
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
145 while (list) {
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
146 GtkWidget *label;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
147 GtkWidget *rowbox;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
148 pce = list->data;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
149
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
150 rowbox = gtk_hbox_new(FALSE, 5);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
151 gtk_box_pack_start(GTK_BOX(jc_vbox), rowbox, TRUE, TRUE, 0);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
152 gtk_widget_show(rowbox);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
153
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
154 label = gtk_label_new(pce->label);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
155 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
156 gtk_widget_show(label);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
157
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
158 if (pce->is_int) {
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
159 GtkObject *adjust;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
160 GtkWidget *spin;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
161 adjust = gtk_adjustment_new(pce->min, pce->min, pce->max, 1, 10, 10);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
162 spin = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
163 gtk_object_set_user_data(GTK_OBJECT(spin), (void *)1);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
164 chatentries = g_list_append(chatentries, spin);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
165 gtk_widget_set_usize(spin, 50, -1);
2346
b1c1e3401e10 [gaim-migrate @ 2359]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2345
diff changeset
166 gtk_box_pack_end(GTK_BOX(rowbox), spin, FALSE, FALSE, 0);
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
167 gtk_widget_show(spin);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
168 } else {
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
169 GtkWidget *entry;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
170 entry = gtk_entry_new();
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
171 chatentries = g_list_append(chatentries, entry);
2346
b1c1e3401e10 [gaim-migrate @ 2359]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2345
diff changeset
172 gtk_box_pack_end(GTK_BOX(rowbox), entry, FALSE, FALSE, 0);
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
173 if (pce->def)
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
174 gtk_entry_set_text(GTK_ENTRY(entry), pce->def);
2289
38e156136896 [gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2268
diff changeset
175 if (focus) {
38e156136896 [gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2268
diff changeset
176 gtk_widget_grab_focus(entry);
38e156136896 [gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2268
diff changeset
177 focus = FALSE;
38e156136896 [gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2268
diff changeset
178 }
2205
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
179 gtk_signal_connect(GTK_OBJECT(entry), "activate",
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
180 GTK_SIGNAL_FUNC(do_join_chat), NULL);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
181 gtk_widget_show(entry);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
182 }
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
183
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
184 g_free(pce);
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
185 list = list->next;
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
186 }
cff4fbe01c7b [gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2199
diff changeset
187 g_list_free(tmp);
1806
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
188 }
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
189
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
190 static void joinchat_choose(GtkWidget *w, struct gaim_connection *g)
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
191 {
1806
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
192 if (joinchatgc == g)
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
193 return;
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
194 joinchatgc = g;
1806
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
195 rebuild_jc();
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
196 }
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
197
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
198 static void create_joinchat_menu(GtkWidget *box)
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
199 {
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
200 GtkWidget *optmenu;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
201 GtkWidget *menu;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
202 GtkWidget *opt;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
203 GSList *c = connections;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
204 struct gaim_connection *g;
1235
a9cf2f61a7b1 [gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1228
diff changeset
205 char buf[2048];
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
206
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
207 optmenu = gtk_option_menu_new();
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
208 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
209
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
210 menu = gtk_menu_new();
1793
00c753b86710 [gaim-migrate @ 1803]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1780
diff changeset
211 joinchatgc = NULL;
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
212
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
213 while (c) {
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
214 g = (struct gaim_connection *)c->data;
1356
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
215 c = c->next;
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
216 if (!g->prpl->join_chat)
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
217 continue;
1793
00c753b86710 [gaim-migrate @ 1803]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1780
diff changeset
218 if (!joinchatgc)
00c753b86710 [gaim-migrate @ 1803]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1780
diff changeset
219 joinchatgc = g;
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3517
diff changeset
220 g_snprintf(buf, sizeof buf, "%s (%s)", g->username, g->prpl->name);
1235
a9cf2f61a7b1 [gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1228
diff changeset
221 opt = gtk_menu_item_new_with_label(buf);
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
222 gtk_object_set_user_data(GTK_OBJECT(opt), g);
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
223 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
224 gtk_menu_append(GTK_MENU(menu), opt);
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
225 gtk_widget_show(opt);
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
226 }
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
227
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
228 gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu);
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
229 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), 0);
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
230 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
231
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
232 void join_chat()
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
233 {
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
234 GtkWidget *mainbox;
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
235 GtkWidget *frame;
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
236 GtkWidget *fbox;
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
237 GtkWidget *rowbox;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
238 GtkWidget *bbox;
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
239 GtkWidget *join;
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
240 GtkWidget *cancel;
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
241 GtkWidget *label;
1356
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
242 GSList *c = connections;
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
243 struct gaim_connection *gc = NULL;
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
244
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
245 while (c) {
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
246 gc = c->data;
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
247 if (gc->prpl->join_chat)
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
248 break;
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
249 gc = NULL;
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
250 c = c->next;
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
251 }
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
252 if (gc == NULL) {
1358
3c87aa8efdc9 [gaim-migrate @ 1368]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1356
diff changeset
253 do_error_dialog("You are not currently signed on with any protocols that have "
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3367
diff changeset
254 "the ability to chat.", NULL, GAIM_ERROR);
1356
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
255 return;
c22d04db51be [gaim-migrate @ 1366]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1343
diff changeset
256 }
456
725ffb93aedc [gaim-migrate @ 466]
Rob Flynn <gaim@robflynn.com>
parents: 449
diff changeset
257
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
258 if (!joinchat) {
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2699
diff changeset
259 GAIM_DIALOG(joinchat);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
260 gtk_window_set_wmclass(GTK_WINDOW(joinchat), "joinchat", "Gaim");
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
261 gtk_window_set_policy(GTK_WINDOW(joinchat), FALSE, TRUE, TRUE);
834
bac7089491c1 [gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 823
diff changeset
262 gtk_widget_realize(joinchat);
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
263 gtk_signal_connect(GTK_OBJECT(joinchat), "delete_event",
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
264 GTK_SIGNAL_FUNC(destroy_join_chat), joinchat);
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
265 gtk_window_set_title(GTK_WINDOW(joinchat), _("Join Chat"));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
266
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
267 mainbox = gtk_vbox_new(FALSE, 5);
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
268 gtk_container_set_border_width(GTK_CONTAINER(mainbox), 5);
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
269 gtk_container_add(GTK_CONTAINER(joinchat), mainbox);
456
725ffb93aedc [gaim-migrate @ 466]
Rob Flynn <gaim@robflynn.com>
parents: 449
diff changeset
270
1211
892bb91e9a27 [gaim-migrate @ 1221]
Rob Flynn <gaim@robflynn.com>
parents: 1210
diff changeset
271 frame = gtk_frame_new(_("Buddy Chat"));
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
272 gtk_box_pack_start(GTK_BOX(mainbox), frame, TRUE, TRUE, 0);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
273
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
274 fbox = gtk_vbox_new(FALSE, 5);
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
275 gtk_container_set_border_width(GTK_CONTAINER(fbox), 5);
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
276 gtk_container_add(GTK_CONTAINER(frame), fbox);
456
725ffb93aedc [gaim-migrate @ 466]
Rob Flynn <gaim@robflynn.com>
parents: 449
diff changeset
277
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1018
diff changeset
278 #ifndef NO_MULTI
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
279 rowbox = gtk_hbox_new(FALSE, 5);
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
280 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
281
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
282 label = gtk_label_new(_("Join Chat As:"));
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
283 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
284
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
285 create_joinchat_menu(rowbox);
1806
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
286
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
287 {
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
288 GtkWidget *tmp = fbox;
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
289 fbox = gtk_vbox_new(FALSE, 5);
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
290 gtk_container_add(GTK_CONTAINER(tmp), fbox);
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
291 gtk_container_set_border_width(GTK_CONTAINER(fbox), 0);
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
292 jc_vbox = fbox;
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
293 }
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1018
diff changeset
294 #else
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1018
diff changeset
295 joinchatgc = connections->data;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1018
diff changeset
296 #endif
1806
c649b63382b7 [gaim-migrate @ 1816]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1793
diff changeset
297 rebuild_jc();
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
298 /* buttons */
692
f4026275bc9f [gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 666
diff changeset
299
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
300 bbox = gtk_hbox_new(FALSE, 5);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
301 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
302
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
303 cancel = picture_button(joinchat, _("Cancel"), cancel_xpm);
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
304 gtk_box_pack_end(GTK_BOX(bbox), cancel, FALSE, FALSE, 0);
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
305 gtk_signal_connect(GTK_OBJECT(cancel), "clicked",
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
306 GTK_SIGNAL_FUNC(destroy_join_chat), joinchat);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
307
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
308 join = picture_button(joinchat, _("Join"), join_xpm);
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
309 gtk_box_pack_end(GTK_BOX(bbox), join, FALSE, FALSE, 0);
1819
47e064712091 [gaim-migrate @ 1829]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
310 gtk_signal_connect(GTK_OBJECT(join), "clicked", GTK_SIGNAL_FUNC(do_join_chat), NULL);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
311 }
1210
265abea9db72 [gaim-migrate @ 1220]
Rob Flynn <gaim@robflynn.com>
parents: 1201
diff changeset
312 gtk_widget_show_all(joinchat);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
313 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
314
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
315
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
316 static void do_invite(GtkWidget *w, struct conversation *b)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
317 {
3466
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
318 const char *buddy;
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3453
diff changeset
319 const char *mess;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
320
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
321 if (!b->is_chat) {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
322 debug_printf("do_invite: expecting chat, got IM\n");
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
323 return;
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
324 }
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
325
2252
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
326 buddy = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(inviteentry)->entry));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
327 mess = gtk_entry_get_text(GTK_ENTRY(invitemess));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
328
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
329 if (invite) {
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
330 serv_chat_invite(b->gc, b->id, mess, buddy);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
331 gtk_widget_destroy(invite);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
332 }
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
333 invite = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
334 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
335
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
336
2252
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
337 GList *generate_invite_user_names(struct gaim_connection *gc)
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
338 {
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
339 GSList *grp;
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
340 GSList *bl;
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
341 struct group *g;
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
342 struct buddy *buddy;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
343
2257
eae25a0309c1 [gaim-migrate @ 2267]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2256
diff changeset
344 static GList *tmp = NULL;
eae25a0309c1 [gaim-migrate @ 2267]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2256
diff changeset
345
eae25a0309c1 [gaim-migrate @ 2267]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2256
diff changeset
346 if (tmp)
eae25a0309c1 [gaim-migrate @ 2267]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2256
diff changeset
347 g_list_free(tmp);
2268
a9787aad60f3 [gaim-migrate @ 2278]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2257
diff changeset
348 tmp = NULL;
2252
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
349
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
350 tmp = g_list_append(tmp, "");
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
351
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
352 if (gc) {
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
353 grp = gc->groups;
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
354
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
355 while (grp) {
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
356 g = (struct group *)grp->data;
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
357
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
358 bl = g->members;
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
359
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
360 while (bl) {
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
361 buddy = (struct buddy *)bl->data;
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
362
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
363 if (buddy->present)
2257
eae25a0309c1 [gaim-migrate @ 2267]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2256
diff changeset
364 tmp = g_list_append(tmp, buddy->name);
2252
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
365
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
366 bl = g_slist_next(bl);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
367 }
2252
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
368
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
369 grp = g_slist_next(grp);
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
370 }
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
371 }
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
372
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
373 return tmp;
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
374
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
375 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
376
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
377 void invite_callback(GtkWidget *w, struct conversation *b)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
378 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
379 GtkWidget *cancel;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
380 GtkWidget *invite_btn;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
381 GtkWidget *label;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
382 GtkWidget *bbox;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
383 GtkWidget *vbox;
2252
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
384 GtkWidget *table;
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
385 GtkWidget *frame;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
386
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
387 if (!invite) {
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2699
diff changeset
388 GAIM_DIALOG(invite);
2252
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
389 gtk_widget_realize(invite);
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
390
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
391 cancel = picture_button(invite, _("Cancel"), cancel_xpm);
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
392 invite_btn = picture_button(invite, _("Invite"), join_xpm);
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
393 inviteentry = gtk_combo_new();
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
394 invitemess = gtk_entry_new();
2252
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
395 frame = gtk_frame_new(_("Invite"));
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
396 table = gtk_table_new(2, 2, FALSE);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
397
2252
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
398 gtk_table_set_row_spacings(GTK_TABLE(table), 5);
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
399 gtk_table_set_col_spacings(GTK_TABLE(table), 5);
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
400 gtk_container_set_border_width(GTK_CONTAINER(table), 5);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
401
2252
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
402 gtk_container_set_border_width(GTK_CONTAINER(frame), 5);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
403
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
404 /* Now we should fill out all of the names */
2252
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
405 gtk_combo_set_popdown_strings(GTK_COMBO(inviteentry), generate_invite_user_names(b->gc));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
406
2252
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
407 vbox = gtk_vbox_new(FALSE, 0);
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
408 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
409 gtk_container_add(GTK_CONTAINER(frame), table);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
410
2252
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
411 label = gtk_label_new(_("Buddy"));
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
412 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
413 gtk_widget_show(label);
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
414 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0);
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
415
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
416 label = gtk_label_new(_("Message"));
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
417 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
418 gtk_widget_show(label);
2252
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
419 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0);
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
420
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
421 /* Now the right side of the table */
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
422 gtk_table_attach(GTK_TABLE(table), inviteentry, 1, 2, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0,
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
423 0);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
424 gtk_table_attach(GTK_TABLE(table), invitemess, 1, 2, 1, 2, GTK_FILL | GTK_EXPAND, 0, 0,
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
425 0);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
426
2252
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
427 /* And now for the button box */
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
428 bbox = gtk_hbox_new(FALSE, 10);
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
429 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
430
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
431 gtk_box_pack_end(GTK_BOX(bbox), cancel, FALSE, FALSE, 0);
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
432 gtk_box_pack_end(GTK_BOX(bbox), invite_btn, FALSE, FALSE, 0);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
433
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
434 /* Handle closes right */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
435 gtk_signal_connect(GTK_OBJECT(invite), "delete_event",
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
436 GTK_SIGNAL_FUNC(destroy_invite), invite);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
437
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
438 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
439 gtk_signal_connect(GTK_OBJECT(invite_btn), "clicked", GTK_SIGNAL_FUNC(do_invite), b);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
440 gtk_signal_connect(GTK_OBJECT(GTK_ENTRY(GTK_COMBO(inviteentry)->entry)), "activate",
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
441 GTK_SIGNAL_FUNC(do_invite), b);
2252
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
442
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
443 /* Finish up */
2252
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
444 gtk_widget_set_usize(GTK_WIDGET(invite), 550, 115);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
445 gtk_widget_show(invite_btn);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
446 gtk_widget_show(cancel);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
447 gtk_widget_show(inviteentry);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
448 gtk_widget_show(invitemess);
2252
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
449 gtk_widget_show(vbox);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
450 gtk_widget_show(bbox);
2252
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
451 gtk_widget_show(table);
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
452 gtk_widget_show(frame);
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
453 gtk_window_set_title(GTK_WINDOW(invite), _("Gaim - Invite Buddy Into Chat Room"));
2253
eb4401ac17ed [gaim-migrate @ 2263]
Rob Flynn <gaim@robflynn.com>
parents: 2252
diff changeset
454 gtk_window_set_focus(GTK_WINDOW(invite), GTK_WIDGET(GTK_COMBO(inviteentry)->entry));
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
455 gtk_container_add(GTK_CONTAINER(invite), vbox);
2252
912a25df97f3 [gaim-migrate @ 2262]
Rob Flynn <gaim@robflynn.com>
parents: 2208
diff changeset
456
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
457
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
458 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
459 gtk_widget_show(invite);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
460 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
461
2385
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
462 void tab_complete(struct conversation *c)
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
463 {
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2699
diff changeset
464 int pos = GTK_OLD_EDITABLE(c->entry)->current_pos;
2385
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
465 int start = pos;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
466 int most_matched = -1;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
467 char *entered, *partial = NULL;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
468 char *text;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
469 GList *matches = NULL;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
470 GList *nicks = c->in_room;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
471
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
472 /* if there's nothing there just return */
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
473 if (!start)
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
474 return;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
475
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
476 text = gtk_editable_get_chars(GTK_EDITABLE(c->entry), 0, pos);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
477
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
478 /* if we're at the end of ": " we need to move back 2 spaces */
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
479 if (start >= 2 && text[start - 1] == ' ' && text[start - 2] == ':')
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
480 start -= 2;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
481
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
482 /* find the start of the word that we're tabbing */
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
483 while (start > 0 && text[start - 1] != ' ')
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
484 start--;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
485
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
486 entered = text + start;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
487 if (chat_options & OPT_CHAT_OLD_STYLE_TAB) {
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
488 if (strlen(entered) >= 2 && !strncmp(": ", entered + strlen(entered) - 2, 2))
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
489 entered[strlen(entered) - 2] = 0;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
490 }
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
491
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
492 if (!strlen(entered)) {
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
493 g_free(text);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
494 return;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
495 }
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
496
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
497 debug_printf("checking tab-completion for %s\n", entered);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
498
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
499 while (nicks) {
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
500 char *nick = nicks->data;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
501 /* this checks to see if the current nick could be a completion */
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
502 if (g_strncasecmp(nick, entered, strlen(entered))) {
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
503 if (nick[0] != '+' && nick[0] != '@') {
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
504 nicks = nicks->next;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
505 continue;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
506 }
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
507 if (g_strncasecmp(nick + 1, entered, strlen(entered))) {
2386
437ae28a1172 [gaim-migrate @ 2399]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2385
diff changeset
508 if (nick[0] != '@' || nick[1] != '+') {
2385
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
509 nicks = nicks->next;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
510 continue;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
511 }
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
512 if (g_strncasecmp(nick + 2, entered, strlen(entered))) {
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
513 nicks = nicks->next;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
514 continue;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
515 }
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
516 else
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
517 nick += 2;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
518 } else
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
519 nick++;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
520 }
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
521 /* if we're here, it's a possible completion */
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
522 debug_printf("possible completion: %s\n", nick);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
523
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
524 /* if we're doing old-style, just fill in the completion */
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
525 if (chat_options & OPT_CHAT_OLD_STYLE_TAB) {
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
526 gtk_editable_delete_text(GTK_EDITABLE(c->entry), start, pos);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
527 if (strlen(nick) == strlen(entered)) {
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
528 nicks = nicks->next ? nicks->next : c->in_room;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
529 nick = nicks->data;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
530 if (*nick == '@')
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
531 nick++;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
532 if (*nick == '+')
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
533 nick++;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
534 }
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
535
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
536 if (start == 0) {
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
537 char *tmp = g_strdup_printf("%s: ", nick);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
538 int t = start;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
539 gtk_editable_insert_text(GTK_EDITABLE(c->entry), tmp, strlen(tmp), &start);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
540 if (t == start) {
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
541 t = start + strlen(tmp);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
542 gtk_editable_set_position(GTK_EDITABLE(c->entry), t);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
543 }
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
544 g_free(tmp);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
545 } else {
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
546 int t = start;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
547 gtk_editable_insert_text(GTK_EDITABLE(c->entry), nick, strlen(nick), &start);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
548 if (t == start) {
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
549 t = start + strlen(nick);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
550 gtk_editable_set_position(GTK_EDITABLE(c->entry), t);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
551 }
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
552 }
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
553 g_free(text);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
554 return;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
555 }
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
556
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
557 /* we're only here if we're doing new style */
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
558 if (most_matched == -1) {
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
559 /* this will only get called once, since from now on most_matched is >= 0 */
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
560 most_matched = strlen(nick);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
561 partial = g_strdup(nick);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
562 } else if (most_matched) {
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
563 while (g_strncasecmp(nick, partial, most_matched))
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
564 most_matched--;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
565 partial[most_matched] = 0;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
566 }
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
567 matches = g_list_append(matches, nick);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
568
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
569 nicks = nicks->next;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
570 }
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
571 /* we're only here if we're doing new style */
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
572
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
573 /* if there weren't any matches, return */
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
574 if (!matches) {
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
575 /* if matches isn't set partials won't be either */
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
576 g_free(text);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
577 return;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
578 }
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
579
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
580 gtk_editable_delete_text(GTK_EDITABLE(c->entry), start, pos);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
581 if (!matches->next) {
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
582 /* there was only one match. fill it in. */
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
583 if (start == 0) {
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
584 char *tmp = g_strdup_printf("%s: ", (char *)matches->data);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
585 int t = start;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
586 gtk_editable_insert_text(GTK_EDITABLE(c->entry), tmp, strlen(tmp), &start);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
587 if (t == start) {
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
588 t = start + strlen(tmp);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
589 gtk_editable_set_position(GTK_EDITABLE(c->entry), t);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
590 }
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
591 g_free(tmp);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
592 } else {
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
593 gtk_editable_insert_text(GTK_EDITABLE(c->entry), matches->data, strlen(matches->data), &start);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
594 }
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
595 matches = g_list_remove(matches, matches->data);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
596 } else {
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
597 /* there were lots of matches, fill in as much as possible and display all of them */
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
598 char *addthis = g_malloc0(1);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
599 int t = start;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
600 while (matches) {
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
601 char *tmp = addthis;
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
602 addthis = g_strconcat(tmp, matches->data, " ", NULL);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
603 g_free(tmp);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
604 matches = g_list_remove(matches, matches->data);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
605 }
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2854
diff changeset
606 write_to_conv(c, addthis, WFLAG_NOLOG, NULL, time(NULL), -1);
2385
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
607 gtk_editable_insert_text(GTK_EDITABLE(c->entry), partial, strlen(partial), &start);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
608 if (t == start) {
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
609 t = start + strlen(partial);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
610 gtk_editable_set_position(GTK_EDITABLE(c->entry), t);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
611 }
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
612 g_free(addthis);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
613 }
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
614
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
615 g_free(text);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
616 g_free(partial);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
617 }
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2384
diff changeset
618
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2854
diff changeset
619 gboolean meify(char *message, int len)
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
620 {
415
a266fd221c3c [gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
621 /* 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
622 * the "/me " part of it (including that space) and return TRUE */
a266fd221c3c [gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
623 char *c = message;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
624 int inside_HTML = 0; /* i really don't like descriptive names */
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
625 if (!c)
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
626 return FALSE; /* um... this would be very bad if this happens */
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2854
diff changeset
627 if (len == -1)
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2854
diff changeset
628 len = strlen(message);
415
a266fd221c3c [gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
629 while (*c) {
a266fd221c3c [gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
630 if (inside_HTML) {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
631 if (*c == '>')
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
632 inside_HTML = 0;
415
a266fd221c3c [gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
633 } else {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
634 if (*c == '<')
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
635 inside_HTML = 1;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
636 else
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
637 break;
415
a266fd221c3c [gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
638 }
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
639 c++; /* i really don't like c++ either */
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2854
diff changeset
640 len--;
415
a266fd221c3c [gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
641 }
a266fd221c3c [gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
642 /* 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
643 if (!*c)
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
644 return FALSE;
2048
3366311426df [gaim-migrate @ 2058]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2017
diff changeset
645 if (!g_strncasecmp(c, "/me ", 4)) {
2860
d842df0f5fe1 [gaim-migrate @ 2873]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2856
diff changeset
646 memmove(c, c + 4, len - 3);
415
a266fd221c3c [gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
647 return TRUE;
a266fd221c3c [gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
648 } else
a266fd221c3c [gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
649 return FALSE;
a266fd221c3c [gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
650 }
a266fd221c3c [gaim-migrate @ 425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
651
2374
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
652 static gboolean find_nick(struct gaim_connection *gc, char *message)
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
653 {
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
654 char *msg = g_strdup(message), *who, *p;
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
655 int n;
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
656 g_strdown(msg);
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
657
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
658 who = g_strdup(gc->username);
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
659 n = strlen(who);
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
660 g_strdown(who);
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
661
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
662 if ((p = strstr(msg, who)) != NULL) {
2384
05034cd0402b [gaim-migrate @ 2397]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2374
diff changeset
663 if (((p == msg) || !isalnum(*(p - 1))) && !isalnum(*(p + n))) {
2374
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
664 g_free(who);
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
665 g_free(msg);
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
666 return TRUE;
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
667 }
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
668 }
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
669 g_free(who);
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
670
2390
bb088ec77c9b [gaim-migrate @ 2403]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2386
diff changeset
671 if (!g_strcasecmp(gc->username, gc->displayname)) {
2374
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
672 g_free(msg);
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
673 return FALSE;
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
674 }
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
675
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
676 who = g_strdup(gc->displayname);
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
677 n = strlen(who);
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
678 g_strdown(who);
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
679
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
680 if ((p = strstr(msg, who)) != NULL) {
2384
05034cd0402b [gaim-migrate @ 2397]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2374
diff changeset
681 if (((p == msg) || !isalnum(*(p - 1))) && !isalnum(*(p + n))) {
2374
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
682 g_free(who);
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
683 g_free(msg);
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
684 return TRUE;
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
685 }
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
686 }
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
687 g_free(who);
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
688 g_free(msg);
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
689 return FALSE;
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
690 }
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
691
1764
1e0613d9526b [gaim-migrate @ 1774]
Rob Flynn <gaim@robflynn.com>
parents: 1757
diff changeset
692 void chat_write(struct conversation *b, char *who, int flag, char *message, time_t mtime)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
693 {
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
694 char *str;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
695
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
696 if (!b->is_chat) {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
697 debug_printf("chat_write: expecting chat, got IM\n");
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
698 return;
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
699 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
700
2632
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
701 if (ignored(b, who))
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
702 return;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
703
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
704 if (!(flag & WFLAG_WHISPER)) {
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
705 str = g_strdup(normalize (who));
2374
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
706 if (!g_strcasecmp(str, normalize(b->gc->username))) {
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2956
diff changeset
707 if (b->makesound)
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2956
diff changeset
708 play_sound(SND_CHAT_YOU_SAY);
2289
38e156136896 [gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2268
diff changeset
709 flag |= WFLAG_SEND;
2374
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
710 } else if (!g_strcasecmp(str, normalize(b->gc->displayname))) {
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2956
diff changeset
711 if (b->makesound)
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2956
diff changeset
712 play_sound(SND_CHAT_YOU_SAY);
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
713 flag |= WFLAG_SEND;
371
9d22acf6db73 [gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
714 } else {
3224
b4c9646792f0 [gaim-migrate @ 3241]
Sean Egan <seanegan@gmail.com>
parents: 3223
diff changeset
715 flag |= WFLAG_RECV;
3228
5da7dae50d87 [gaim-migrate @ 3245]
Sean Egan <seanegan@gmail.com>
parents: 3227
diff changeset
716 if (find_nick(b->gc, message))
3226
aba6ee7f8aba [gaim-migrate @ 3243]
Sean Egan <seanegan@gmail.com>
parents: 3225
diff changeset
717 flag |= WFLAG_NICK;
371
9d22acf6db73 [gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
718 }
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
719 g_free(str);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
720 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
721
3226
aba6ee7f8aba [gaim-migrate @ 3243]
Sean Egan <seanegan@gmail.com>
parents: 3225
diff changeset
722 if (flag & WFLAG_RECV && b->makesound) {
3227
671667425d27 [gaim-migrate @ 3244]
Sean Egan <seanegan@gmail.com>
parents: 3226
diff changeset
723 if (flag & WFLAG_NICK && (sound_options & OPT_SOUND_CHAT_NICK)) {
3219
639960efc6ff [gaim-migrate @ 3236]
Sean Egan <seanegan@gmail.com>
parents: 3217
diff changeset
724 play_sound(SND_CHAT_NICK);
3226
aba6ee7f8aba [gaim-migrate @ 3243]
Sean Egan <seanegan@gmail.com>
parents: 3225
diff changeset
725 } else {
3224
b4c9646792f0 [gaim-migrate @ 3241]
Sean Egan <seanegan@gmail.com>
parents: 3223
diff changeset
726 play_sound(SND_CHAT_SAY);
3226
aba6ee7f8aba [gaim-migrate @ 3243]
Sean Egan <seanegan@gmail.com>
parents: 3225
diff changeset
727 }
3217
80d20a257a36 [gaim-migrate @ 3234]
Sean Egan <seanegan@gmail.com>
parents: 3216
diff changeset
728 }
3367
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3312
diff changeset
729
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3312
diff changeset
730 if (chat_options & OPT_CHAT_COLORIZE)
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3312
diff changeset
731 flag |= WFLAG_COLORIZE;
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3312
diff changeset
732 write_to_conv(b, message, flag, who, mtime, -1);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
733 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
734
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
735
368
9bf1f77985d2 [gaim-migrate @ 378]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 363
diff changeset
736
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
737 void whisper_callback(GtkWidget *widget, struct conversation *b)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
738 {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
739 char buf[BUF_LEN * 4];
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
740 char buf2[BUF_LONG];
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
741 GList *selected;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
742 char *who;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
743
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
744 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
745 if (!strlen(buf))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
746 return;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
747
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
748 selected = GTK_LIST(b->list)->selection;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
749
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
750 if (!selected)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
751 return;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
752
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
753
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
754 who = GTK_LABEL(gtk_container_children(GTK_CONTAINER(selected->data))->data)->label;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
755
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
756 if (!who)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
757 return;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
758
338
9d258a0aa560 [gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 300
diff changeset
759 gtk_editable_delete_text(GTK_EDITABLE(b->entry), 0, -1);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
760
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
761 serv_chat_whisper(b->gc, b->id, who, buf);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
762
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 915
diff changeset
763 g_snprintf(buf2, sizeof(buf2), "%s->%s", b->gc->username, who);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
764
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
765 chat_write(b, buf2, WFLAG_WHISPER, buf, time(NULL));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
766
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
767 gtk_widget_grab_focus(GTK_WIDGET(b->entry));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
768
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
769
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
770 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
771
1223
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
772 static gint insertname(gconstpointer one, gconstpointer two)
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
773 {
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
774 const char *a = (const char *)one;
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
775 const char *b = (const char *)two;
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
776
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
777 if (*a == '@') {
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
778 if (*b != '@')
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
779 return -1;
3312
0c7bd995eb03 [gaim-migrate @ 3330]
Jim Seymour <jseymour>
parents: 3250
diff changeset
780 return (strcasecmp(a + 1, b + 1));
1223
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
781 } else if (*a == '+') {
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
782 if (*b == '@')
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
783 return 1;
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
784 if (*b != '+')
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
785 return -1;
3312
0c7bd995eb03 [gaim-migrate @ 3330]
Jim Seymour <jseymour>
parents: 3250
diff changeset
786 return (strcasecmp(a + 1, b + 1));
1223
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
787 } else {
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
788 if (*b == '@' || *b == '+')
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
789 return 1;
3312
0c7bd995eb03 [gaim-migrate @ 3330]
Jim Seymour <jseymour>
parents: 3250
diff changeset
790 return strcasecmp(a, b);
1223
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
791 }
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
792 }
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
793
1398
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
794 static void chat_press_im(GtkObject *obj, struct conversation *b)
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
795 {
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
796 struct conversation *c;
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
797
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
798 c = find_conversation(gtk_object_get_user_data(obj));
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
799
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
800 if (c != NULL)
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
801 gdk_window_show(c->window->window);
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
802 else {
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
803 c = new_conversation(gtk_object_get_user_data(obj));
1898
73d73939f698 [gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1860
diff changeset
804 set_convo_gc(c, b->gc);
1398
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
805 }
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
806 }
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
807
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
808 static void chat_press_ign(GtkWidget *obj, struct conversation *b)
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
809 {
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
810 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
811 ignore_callback(obj, b);
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
812 }
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
813
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
814 static void chat_press_info(GtkObject *obj, struct conversation *b)
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
815 {
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
816 if (b->gc) {
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
817 /*
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
818 * If there are special needs for getting info on users in
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
819 * buddy chat "rooms"...
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
820 */
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
821 if(b->gc->prpl->get_cb_info != NULL) {
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
822 b->gc->prpl->get_cb_info(b->gc, b->id, gtk_object_get_user_data(obj));
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
823 } else {
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
824 b->gc->prpl->get_info(b->gc, gtk_object_get_user_data(obj));
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
825 }
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
826 }
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
827 }
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
828
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
829
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
830 static void chat_press_away(GtkObject *obj, struct conversation *b)
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
831 {
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
832 if (b->gc) {
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
833 /*
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
834 * May want to expand this to work similarly to chat_press_info?
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
835 */
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
836 if(b->gc->prpl->get_cb_away != NULL) {
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
837 b->gc->prpl->get_cb_away(b->gc, b->id, gtk_object_get_user_data(obj));
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
838 }
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
839 }
1398
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
840 }
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
841
3453
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
842 /* Added by Jonas <jonas@birme.se> */
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
843 static void chat_press_add(GtkObject *obj, struct conversation *c)
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
844 {
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
845 char *name = gtk_object_get_user_data(obj);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
846 struct buddy *b = find_buddy(c->gc, name);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
847
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
848 if (b) {
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
849 show_confirm_del(c->gc, name);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
850 } else if (c->gc)
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
851 show_add_buddy(c->gc, name, NULL, NULL);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
852
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
853 gtk_widget_grab_focus(c->entry);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
854 }
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
855 /* End Jonas */
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
856
1398
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
857 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
858 {
2845
0c10058610a0 [gaim-migrate @ 2858]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2843
diff changeset
859 if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) {
2854
86e74a0c2f6e [gaim-migrate @ 2867]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2845
diff changeset
860 struct conversation *c;
86e74a0c2f6e [gaim-migrate @ 2867]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2845
diff changeset
861 if ((c = find_conversation(gtk_object_get_user_data(obj))) == NULL)
86e74a0c2f6e [gaim-migrate @ 2867]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2845
diff changeset
862 c = new_conversation(gtk_object_get_user_data(obj));
86e74a0c2f6e [gaim-migrate @ 2867]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2845
diff changeset
863 set_convo_gc(c, b->gc);
2845
0c10058610a0 [gaim-migrate @ 2858]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2843
diff changeset
864 } else if (event->button == 3 && event->type == GDK_BUTTON_PRESS) {
3250
0970eabdd8df [gaim-migrate @ 3268]
Jim Seymour <jseymour>
parents: 3228
diff changeset
865 static GtkWidget *menu = NULL;
1398
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
866 GtkWidget *button;
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
867
3250
0970eabdd8df [gaim-migrate @ 3268]
Jim Seymour <jseymour>
parents: 3228
diff changeset
868 /*
0970eabdd8df [gaim-migrate @ 3268]
Jim Seymour <jseymour>
parents: 3228
diff changeset
869 * If a menu already exists, destroy it before creating a new one,
0970eabdd8df [gaim-migrate @ 3268]
Jim Seymour <jseymour>
parents: 3228
diff changeset
870 * thus freeing-up the memory it occupied.
0970eabdd8df [gaim-migrate @ 3268]
Jim Seymour <jseymour>
parents: 3228
diff changeset
871 */
0970eabdd8df [gaim-migrate @ 3268]
Jim Seymour <jseymour>
parents: 3228
diff changeset
872 if(menu)
0970eabdd8df [gaim-migrate @ 3268]
Jim Seymour <jseymour>
parents: 3228
diff changeset
873 gtk_widget_destroy(menu);
0970eabdd8df [gaim-migrate @ 3268]
Jim Seymour <jseymour>
parents: 3228
diff changeset
874
1398
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
875 menu = gtk_menu_new();
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
876
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
877 button = gtk_menu_item_new_with_label(_("IM"));
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
878 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
879 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
880 gtk_menu_append(GTK_MENU(menu), button);
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
881 gtk_widget_show(button);
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
882
2632
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
883 if (ignored(b, gtk_object_get_user_data(obj)))
2350
0264a8a27e69 [gaim-migrate @ 2363]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2346
diff changeset
884 button = gtk_menu_item_new_with_label(_("Un-Ignore"));
0264a8a27e69 [gaim-migrate @ 2363]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2346
diff changeset
885 else
0264a8a27e69 [gaim-migrate @ 2363]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2346
diff changeset
886 button = gtk_menu_item_new_with_label(_("Ignore"));
1398
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
887 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
888 gtk_object_set_user_data(GTK_OBJECT(button), obj);
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
889 gtk_menu_append(GTK_MENU(menu), button);
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
890 gtk_widget_show(button);
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
891
2208
9b3262a2f7c4 [gaim-migrate @ 2218]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2205
diff changeset
892 if (b->gc && b->gc->prpl->get_info) {
1398
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
893 button = gtk_menu_item_new_with_label(_("Info"));
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
894 gtk_signal_connect(GTK_OBJECT(button), "activate",
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
895 GTK_SIGNAL_FUNC(chat_press_info), b);
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
896 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
897 gtk_menu_append(GTK_MENU(menu), button);
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
898 gtk_widget_show(button);
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
899 }
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
900
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
901 if (b->gc && b->gc->prpl->get_cb_away) {
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
902 button = gtk_menu_item_new_with_label(_("Get Away Msg"));
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
903 gtk_signal_connect(GTK_OBJECT(button), "activate",
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
904 GTK_SIGNAL_FUNC(chat_press_away), b);
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
905 gtk_object_set_user_data(GTK_OBJECT(button), gtk_object_get_user_data(obj));
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
906 gtk_menu_append(GTK_MENU(menu), button);
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
907 gtk_widget_show(button);
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
908 }
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
909
3453
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
910 /* Added by Jonas <jonas@birme.se> */
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
911 if (b->gc) {
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
912 if (find_buddy(b->gc, gtk_object_get_user_data(obj)))
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
913 button = gtk_menu_item_new_with_label(_("Remove"));
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
914 else
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
915 button = gtk_menu_item_new_with_label(_("Add"));
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
916 gtk_signal_connect(GTK_OBJECT(button), "activate",
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
917 GTK_SIGNAL_FUNC(chat_press_add), b);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
918 gtk_object_set_user_data(GTK_OBJECT(button),
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
919 gtk_object_get_user_data(obj));
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
920 gtk_menu_append(GTK_MENU(menu), button);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
921 gtk_widget_show(button);
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
922 }
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
923 /* End Jonas */
736951485ac6 [gaim-migrate @ 3498]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
924
1398
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
925 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
926 return TRUE;
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
927 }
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
928 return TRUE;
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1390
diff changeset
929 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
930
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
931 /*
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
932 * Common code for adding a chat buddy to the list
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
933 */
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
934 static void add_chat_buddy_common(struct conversation *b, char *name, int pos)
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
935 {
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
936 char tmp[BUF_LONG];
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
937 GtkWidget *list_item;
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
938
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
939 if (ignored(b, name)) {
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
940 g_snprintf(tmp, sizeof(tmp), "X %s", name);
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
941 list_item = gtk_list_item_new_with_label(tmp);
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
942 } else
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
943 list_item = gtk_list_item_new_with_label(name);
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
944
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
945 gtk_object_set_user_data(GTK_OBJECT(list_item), name);
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
946 gtk_signal_connect(GTK_OBJECT(list_item), "button_press_event",
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
947 GTK_SIGNAL_FUNC(right_click_chat), b);
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
948 gtk_list_insert_items(GTK_LIST(b->list), g_list_append(NULL, list_item), pos);
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
949 gtk_widget_show(list_item);
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
950 }
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
951
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
952 void add_chat_buddy(struct conversation *b, char *buddy)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
953 {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
954 char *name = g_strdup(buddy);
612
12bb64b42ad1 [gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 604
diff changeset
955 char tmp[BUF_LONG];
1223
96ab3e7b7035 [gaim-migrate @ 1233]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1211
diff changeset
956 int pos;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
957
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
958 plugin_event(event_chat_buddy_join, b->gc, b->id, name);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
959 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
960 pos = g_list_index(b->in_room, name);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
961
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
962 add_chat_buddy_common(b, name, pos);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
963
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
964 g_snprintf(tmp, sizeof(tmp), _("%d %s in room"), g_list_length(b->in_room),
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
965 g_list_length(b->in_room) == 1 ? "person" : "people");
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
966 gtk_label_set_text(GTK_LABEL(b->count), tmp);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
967
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2956
diff changeset
968 if (b->makesound)
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2956
diff changeset
969 play_sound(SND_CHAT_JOIN);
612
12bb64b42ad1 [gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 604
diff changeset
970
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2289
diff changeset
971 if (chat_options & OPT_CHAT_LOGON) {
1735
00f74db70f2d [gaim-migrate @ 1745]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1732
diff changeset
972 g_snprintf(tmp, sizeof(tmp), _("%s entered the room."), name);
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2854
diff changeset
973 write_to_conv(b, tmp, WFLAG_SYSTEM, NULL, time(NULL), -1);
612
12bb64b42ad1 [gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 604
diff changeset
974 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
975 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
976
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
977
1504
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
978 void rename_chat_buddy(struct conversation *b, char *old, char *new)
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
979 {
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
980 GList *names = b->in_room;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
981 GList *items = GTK_LIST(b->list)->children;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
982
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
983 char *name = g_strdup(new);
2632
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
984 char *ign;
1504
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
985 int pos;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
986
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
987 char tmp[BUF_LONG];
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
988
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
989 while (names) {
2048
3366311426df [gaim-migrate @ 2058]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2017
diff changeset
990 if (!g_strcasecmp((char *)names->data, old)) {
1504
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
991 char *tmp2 = names->data;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
992 b->in_room = g_list_remove(b->in_room, names->data);
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
993 while (items) {
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
994 if (tmp2 == gtk_object_get_user_data(items->data)) {
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
995 gtk_list_remove_items(GTK_LIST(b->list),
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
996 g_list_append(NULL, items->data));
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
997 break;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
998 }
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
999 items = items->next;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
1000 }
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
1001 g_free(tmp2);
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
1002 break;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
1003 }
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
1004 names = names->next;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
1005 }
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
1006
2630
5004f7eb3d4d [gaim-migrate @ 2643]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2625
diff changeset
1007 if (!names) {
5004f7eb3d4d [gaim-migrate @ 2643]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2625
diff changeset
1008 g_free(name);
1504
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
1009 return;
2630
5004f7eb3d4d [gaim-migrate @ 2643]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2625
diff changeset
1010 }
1504
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
1011
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
1012 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
1013 pos = g_list_index(b->in_room, name);
1504
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
1014
2632
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
1015 ign = ignored(b, old);
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
1016
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
1017 if (ign) {
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
1018 g_free(ign);
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
1019 b->ignored = g_list_remove(b->ignored, ign);
2631
a2cf3cac7e66 [gaim-migrate @ 2644]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2630
diff changeset
1020
2632
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
1021 /* we haven't added them yet. if we find them, don't add them again */
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
1022 if (!ignored(b, new))
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
1023 b->ignored = g_list_append(b->ignored, g_strdup(name));
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
1024
2634
7a3f7aebd4e5 [gaim-migrate @ 2647]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2632
diff changeset
1025 } else {
7a3f7aebd4e5 [gaim-migrate @ 2647]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2632
diff changeset
1026 if ((ign = ignored(b, new)) != NULL) {
7a3f7aebd4e5 [gaim-migrate @ 2647]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2632
diff changeset
1027 /* if they weren't ignored and change to someone who is ignored,
7a3f7aebd4e5 [gaim-migrate @ 2647]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2632
diff changeset
1028 * assume it's someone else. that may seem a little backwards but
7a3f7aebd4e5 [gaim-migrate @ 2647]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2632
diff changeset
1029 * it's better when it *is* actually someone else. Sorry Sean. */
7a3f7aebd4e5 [gaim-migrate @ 2647]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2632
diff changeset
1030 g_free(ign);
7a3f7aebd4e5 [gaim-migrate @ 2647]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2632
diff changeset
1031 b->ignored = g_list_remove(b->ignored, ign);
7a3f7aebd4e5 [gaim-migrate @ 2647]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2632
diff changeset
1032 }
7a3f7aebd4e5 [gaim-migrate @ 2647]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2632
diff changeset
1033 }
1504
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
1034
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
1035 add_chat_buddy_common(b, name, pos);
1504
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
1036
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2289
diff changeset
1037 if (chat_options & OPT_CHAT_LOGON) {
1735
00f74db70f2d [gaim-migrate @ 1745]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1732
diff changeset
1038 g_snprintf(tmp, sizeof(tmp), _("%s is now known as %s"), old, new);
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2854
diff changeset
1039 write_to_conv(b, tmp, WFLAG_SYSTEM, NULL, time(NULL), -1);
1504
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
1040 }
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
1041 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1042
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1043
2820
b917845dad3c [gaim-migrate @ 2833]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
1044 void remove_chat_buddy(struct conversation *b, char *buddy, char *reason)
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1045 {
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1046 GList *names = b->in_room;
1053
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
1047 GList *items = GTK_LIST(b->list)->children;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1048
612
12bb64b42ad1 [gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 604
diff changeset
1049 char tmp[BUF_LONG];
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1050
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1051 plugin_event(event_chat_buddy_leave, b->gc, b->id, buddy);
391
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 375
diff changeset
1052
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1053 while (names) {
2048
3366311426df [gaim-migrate @ 2058]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2017
diff changeset
1054 if (!g_strcasecmp((char *)names->data, buddy)) {
1053
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
1055 char *tmp = names->data;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1056 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
1057 while (items) {
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
1058 if (tmp == gtk_object_get_user_data(items->data)) {
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
1059 gtk_list_remove_items(GTK_LIST(b->list),
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1060 g_list_append(NULL, items->data));
1053
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
1061 break;
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
1062 }
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
1063 items = items->next;
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
1064 }
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
1065 g_free(tmp);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1066 break;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1067 }
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1068 names = names->next;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1069 }
371
9d22acf6db73 [gaim-migrate @ 381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
1070
1504
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
1071 if (!names)
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
1072 return;
cac3efeb4d9c [gaim-migrate @ 1514]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
1073
2631
a2cf3cac7e66 [gaim-migrate @ 2644]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2630
diff changeset
1074 /* don't remove them from ignored in case they re-enter */
a2cf3cac7e66 [gaim-migrate @ 2644]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2630
diff changeset
1075
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
1076 g_snprintf(tmp, sizeof(tmp), _("%d %s in room"), g_list_length(b->in_room),
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
1077 g_list_length(b->in_room) == 1 ? "person" : "people");
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1078 gtk_label_set_text(GTK_LABEL(b->count), tmp);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1079
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2956
diff changeset
1080 if (b->makesound)
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 2956
diff changeset
1081 play_sound(SND_CHAT_LEAVE);
612
12bb64b42ad1 [gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 604
diff changeset
1082
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2289
diff changeset
1083 if (chat_options & OPT_CHAT_LOGON) {
2820
b917845dad3c [gaim-migrate @ 2833]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
1084 if (reason && *reason)
b917845dad3c [gaim-migrate @ 2833]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
1085 g_snprintf(tmp, sizeof(tmp), _("%s left the room (%s)."), buddy, reason);
b917845dad3c [gaim-migrate @ 2833]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
1086 else
b917845dad3c [gaim-migrate @ 2833]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
1087 g_snprintf(tmp, sizeof(tmp), _("%s left the room."), buddy);
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2854
diff changeset
1088 write_to_conv(b, tmp, WFLAG_SYSTEM, NULL, time(NULL), -1);
612
12bb64b42ad1 [gaim-migrate @ 622]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 604
diff changeset
1089 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1090 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1091
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1092
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
1093 void im_callback(GtkWidget *w, struct conversation *b)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1094 {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1095 char *name;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1096 GList *i;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1097 struct conversation *c;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1098
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1099 i = GTK_LIST(b->list)->selection;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
1100 if (i) {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1101 name = (char *)gtk_object_get_user_data(GTK_OBJECT(i->data));
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
1102 } else {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1103 return;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
1104 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1105
2663
0e6d113bb8cd [gaim-migrate @ 2676]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2662
diff changeset
1106 if (*name == '@')
0e6d113bb8cd [gaim-migrate @ 2676]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2662
diff changeset
1107 name++;
0e6d113bb8cd [gaim-migrate @ 2676]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2662
diff changeset
1108 if (*name == '+')
0e6d113bb8cd [gaim-migrate @ 2676]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2662
diff changeset
1109 name++;
0e6d113bb8cd [gaim-migrate @ 2676]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2662
diff changeset
1110
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1111 c = find_conversation(name);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1112
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1113 if (c != NULL) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1114 gdk_window_raise(c->window->window);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1115 } else {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1116 c = new_conversation(name);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1117 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1118
2391
abebece90bd7 [gaim-migrate @ 2404]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2390
diff changeset
1119 set_convo_gc(c, b->gc);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1120 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1121
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
1122 void ignore_callback(GtkWidget *w, struct conversation *b)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1123 {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1124 char *name;
2632
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
1125 GList *i;
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
1126 char *ign;
1053
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
1127 int pos;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1128
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1129 i = GTK_LIST(b->list)->selection;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
1130 if (i) {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1131 name = (char *)gtk_object_get_user_data(GTK_OBJECT(i->data));
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
1132 } else {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1133 return;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
1134 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1135
1053
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
1136 pos = gtk_list_child_position(GTK_LIST(b->list), i->data);
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
1137
2632
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
1138 ign = ignored(b, name);
1303
9c34f99af79e [gaim-migrate @ 1313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1139
2632
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
1140 if (ign) {
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
1141 g_free(ign);
11badfae115c [gaim-migrate @ 2645]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
1142 b->ignored = g_list_remove(b->ignored, ign);
1303
9c34f99af79e [gaim-migrate @ 1313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1143 } else {
9c34f99af79e [gaim-migrate @ 1313]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1144 b->ignored = g_list_append(b->ignored, g_strdup(name));
1053
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
1145 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1146
1053
864f4aae0b60 [gaim-migrate @ 1063]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
1147 gtk_widget_destroy(i->data);
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
1148 add_chat_buddy_common(b, name, pos);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1149 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1150
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 457
diff changeset
1151 void show_new_buddy_chat(struct conversation *b)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1152 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1153 GtkWidget *win;
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1154 GtkWidget *cont;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1155 GtkWidget *text;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1156 GtkWidget *send;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1157 GtkWidget *list;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1158 GtkWidget *invite_btn;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1159 GtkWidget *whisper;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1160 GtkWidget *close;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1161 GtkWidget *chatentry;
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1162 GtkWidget *lbox;
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1163 GtkWidget *bbox;
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1164 GtkWidget *bbox2;
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1165 GtkWidget *im, *ignore, *info;
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1166 GtkWidget *sw;
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1167 GtkWidget *sw2;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1168 GtkWidget *vbox;
223
ac05dfb9e762 [gaim-migrate @ 233]
Syd Logan <slogan>
parents: 199
diff changeset
1169 GtkWidget *vpaned;
ac05dfb9e762 [gaim-migrate @ 233]
Syd Logan <slogan>
parents: 199
diff changeset
1170 GtkWidget *hpaned;
344
2434adbb8703 [gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 338
diff changeset
1171 GtkWidget *toolbar;
1380
638af9a58e39 [gaim-migrate @ 1390]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1358
diff changeset
1172 char buf[BUF_LONG];
844
fae1d64b0278 [gaim-migrate @ 854]
Rob Flynn <gaim@robflynn.com>
parents: 834
diff changeset
1173
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1174 int dispstyle = set_dispstyle(1);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1175
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2289
diff changeset
1176 if (chat_options & OPT_CHAT_ONE_WINDOW) {
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1177 if (!all_chats) {
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1178 win = all_chats = b->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1179 if ((convo_options & OPT_CONVO_COMBINE) && (im_options & OPT_IM_ONE_WINDOW))
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1180 all_convos = all_chats;
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1181 gtk_window_set_wmclass(GTK_WINDOW(win), "buddy_chat", "Gaim");
2880
7dd0838f602e [gaim-migrate @ 2893]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2860
diff changeset
1182 gtk_window_set_policy(GTK_WINDOW(win), TRUE, TRUE, FALSE);
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1183 gtk_container_border_width(GTK_CONTAINER(win), 0);
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1184 gtk_widget_realize(win);
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1185 gtk_window_set_title(GTK_WINDOW(win), _("Gaim - Group Chats"));
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1186 gtk_signal_connect(GTK_OBJECT(win), "delete_event",
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1187 GTK_SIGNAL_FUNC(delete_all_convo), NULL);
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1188
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1189 chat_notebook = gtk_notebook_new();
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1190 if ((convo_options & OPT_CONVO_COMBINE) && (im_options & OPT_IM_ONE_WINDOW))
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1191 convo_notebook = chat_notebook;
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2289
diff changeset
1192 if (chat_options & OPT_CHAT_SIDE_TAB) {
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2289
diff changeset
1193 if (chat_options & OPT_CHAT_BR_TAB) {
1757
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
1194 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(chat_notebook),
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
1195 GTK_POS_RIGHT);
1757
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
1196 } else {
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
1197 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(chat_notebook),
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
1198 GTK_POS_LEFT);
1757
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
1199 }
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
1200 } else {
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2289
diff changeset
1201 if (chat_options & OPT_CHAT_BR_TAB) {
1757
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
1202 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(chat_notebook),
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
1203 GTK_POS_BOTTOM);
1757
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
1204 } else {
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
1205 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(chat_notebook),
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
1206 GTK_POS_TOP);
1757
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
1207 }
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
1208 }
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1209 gtk_notebook_set_scrollable(GTK_NOTEBOOK(chat_notebook), TRUE);
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1210 gtk_notebook_popup_enable(GTK_NOTEBOOK(chat_notebook));
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1211 gtk_container_add(GTK_CONTAINER(win), chat_notebook);
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1212 gtk_signal_connect(GTK_OBJECT(chat_notebook), "switch-page",
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1213 GTK_SIGNAL_FUNC(convo_switch), NULL);
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1214 gtk_widget_show(chat_notebook);
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1215 } else
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1216 win = b->window = all_chats;
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1217
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1218 cont = gtk_vbox_new(FALSE, 5);
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1219 gtk_container_set_border_width(GTK_CONTAINER(cont), 5);
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1220 gtk_notebook_append_page(GTK_NOTEBOOK(chat_notebook), cont, gtk_label_new(b->name));
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1221 gtk_widget_show(cont);
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1222 } else {
1920
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1898
diff changeset
1223 win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1224 b->window = win;
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1225 gtk_object_set_user_data(GTK_OBJECT(win), b);
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1226 gtk_window_set_wmclass(GTK_WINDOW(win), "buddy_chat", "Gaim");
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1227 gtk_window_set_policy(GTK_WINDOW(win), TRUE, TRUE, TRUE);
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1228 gtk_container_border_width(GTK_CONTAINER(win), 10);
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1229 gtk_widget_realize(win);
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1230 g_snprintf(buf, sizeof(buf), "Gaim - %s (chat)", b->name);
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1231 gtk_window_set_title(GTK_WINDOW(win), buf);
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1232 gtk_signal_connect(GTK_OBJECT(win), "destroy", GTK_SIGNAL_FUNC(close_callback), b);
1920
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1898
diff changeset
1233
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
1234 cont = gtk_vbox_new(FALSE, 5);
1920
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1898
diff changeset
1235 gtk_container_add(GTK_CONTAINER(win), cont);
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1898
diff changeset
1236 gtk_widget_show(cont);
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1898
diff changeset
1237 }
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1898
diff changeset
1238
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1898
diff changeset
1239 if (b->gc->prpl->options & OPT_PROTO_CHAT_TOPIC) {
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1898
diff changeset
1240 GtkWidget *hbox;
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1898
diff changeset
1241 GtkWidget *label;
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1898
diff changeset
1242
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1898
diff changeset
1243 hbox = gtk_hbox_new(FALSE, 0);
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1898
diff changeset
1244 gtk_box_pack_start(GTK_BOX(cont), hbox, FALSE, FALSE, 5);
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1898
diff changeset
1245 gtk_widget_show(hbox);
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1898
diff changeset
1246
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1898
diff changeset
1247 label = gtk_label_new(_("Topic:"));
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1898
diff changeset
1248 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1898
diff changeset
1249 gtk_widget_show(label);
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1898
diff changeset
1250
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1898
diff changeset
1251 b->topic_text = gtk_entry_new();
2289
38e156136896 [gaim-migrate @ 2299]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2268
diff changeset
1252 gtk_entry_set_editable(GTK_ENTRY(b->topic_text), FALSE);
1920
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1898
diff changeset
1253 gtk_box_pack_start(GTK_BOX(hbox), b->topic_text, TRUE, TRUE, 5);
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1898
diff changeset
1254 gtk_widget_show(b->topic_text);
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1255 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1256
223
ac05dfb9e762 [gaim-migrate @ 233]
Syd Logan <slogan>
parents: 199
diff changeset
1257 vpaned = gtk_vpaned_new();
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1258 gtk_paned_set_gutter_size(GTK_PANED(vpaned), 15);
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1259 gtk_container_add(GTK_CONTAINER(cont), vpaned);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1260 gtk_widget_show(vpaned);
223
ac05dfb9e762 [gaim-migrate @ 233]
Syd Logan <slogan>
parents: 199
diff changeset
1261
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1262 hpaned = gtk_hpaned_new();
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1263 gtk_paned_set_gutter_size(GTK_PANED(hpaned), 15);
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1264 gtk_paned_pack1(GTK_PANED(vpaned), hpaned, TRUE, FALSE);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1265 gtk_widget_show(hpaned);
26
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 21
diff changeset
1266
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1267 sw = gtk_scrolled_window_new(NULL, NULL);
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1268 b->sw = sw;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1269 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
1270 gtk_paned_pack1(GTK_PANED(hpaned), sw, TRUE, TRUE);
1813
998a6a032874 [gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1807
diff changeset
1271 gtk_widget_set_usize(sw, buddy_chat_size.width, buddy_chat_size.height);
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1272 gtk_widget_show(sw);
834
bac7089491c1 [gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 823
diff changeset
1273
1428
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1398
diff changeset
1274 text = gtk_imhtml_new(NULL, NULL);
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1275 b->text = text;
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1276 gtk_container_add(GTK_CONTAINER(sw), text);
1428
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1398
diff changeset
1277 GTK_LAYOUT(text)->hadjustment->step_increment = 10.0;
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1398
diff changeset
1278 GTK_LAYOUT(text)->vadjustment->step_increment = 10.0;
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2289
diff changeset
1279 if (convo_options & OPT_CONVO_SHOW_TIME)
1428
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1398
diff changeset
1280 gtk_imhtml_show_comments(GTK_IMHTML(text), TRUE);
1815
f15d449b3167 [gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1813
diff changeset
1281 gaim_setup_imhtml(text);
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1282 gtk_widget_show(text);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1283
1228
6773043cf9f6 [gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1227
diff changeset
1284 lbox = gtk_vbox_new(FALSE, 5);
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1285 gtk_paned_pack2(GTK_PANED(hpaned), lbox, TRUE, TRUE);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1286 gtk_widget_show(lbox);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1287
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1288 b->count = gtk_label_new(_("0 people in room"));
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1289 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
1290 gtk_widget_show(b->count);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1291
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1292 sw2 = gtk_scrolled_window_new(NULL, NULL);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1293 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
1294 gtk_box_pack_start(GTK_BOX(lbox), sw2, TRUE, TRUE, 0);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1295 gtk_widget_show(sw2);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1296
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1297 list = gtk_list_new();
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1298 b->list = list;
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1299 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw2), list);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1300 gtk_widget_set_usize(list, 150, -1);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1301 gtk_widget_show(list);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1302
1228
6773043cf9f6 [gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1227
diff changeset
1303 bbox2 = gtk_hbox_new(TRUE, 5);
6773043cf9f6 [gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1227
diff changeset
1304 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
1305 gtk_widget_show(bbox2);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1306
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1307 im = picture_button2(win, _("IM"), tmp_send_xpm, FALSE);
1228
6773043cf9f6 [gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1227
diff changeset
1308 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
1309 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
1310
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1311 ignore = picture_button2(win, _("Ignore"), close_xpm, FALSE);
1228
6773043cf9f6 [gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1227
diff changeset
1312 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
1313 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
1314
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1315 info = picture_button2(win, _("Info"), tb_search_xpm, FALSE);
1228
6773043cf9f6 [gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1227
diff changeset
1316 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
1317 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
1318 b->info = info;
844
fae1d64b0278 [gaim-migrate @ 854]
Rob Flynn <gaim@robflynn.com>
parents: 834
diff changeset
1319
1228
6773043cf9f6 [gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1227
diff changeset
1320 vbox = gtk_vbox_new(FALSE, 5);
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1321 gtk_paned_pack2(GTK_PANED(vpaned), vbox, TRUE, FALSE);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1322 gtk_widget_show(vbox);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1323
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1324 chatentry = gtk_text_new(NULL, NULL);
1227
25611364a504 [gaim-migrate @ 1237]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1223
diff changeset
1325 b->entry = chatentry;
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2289
diff changeset
1326 if (!(chat_options & OPT_CHAT_ONE_WINDOW))
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1327 gtk_window_set_focus(GTK_WINDOW(b->window), b->entry);
1227
25611364a504 [gaim-migrate @ 1237]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1223
diff changeset
1328
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1329 toolbar = build_conv_toolbar(b);
1228
6773043cf9f6 [gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1227
diff changeset
1330 gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1331
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1332 gtk_object_set_user_data(GTK_OBJECT(chatentry), b);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1333 gtk_text_set_editable(GTK_TEXT(chatentry), TRUE);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1334 gtk_text_set_word_wrap(GTK_TEXT(chatentry), TRUE);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1335 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
1336 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
1337 b);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1338 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
1339 chatentry);
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2289
diff changeset
1340 if (convo_options & OPT_CONVO_CHECK_SPELLING)
1117
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1109
diff changeset
1341 gtkspell_attach(GTK_TEXT(chatentry));
1228
6773043cf9f6 [gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1227
diff changeset
1342 gtk_box_pack_start(GTK_BOX(vbox), chatentry, TRUE, TRUE, 0);
2899
019d7462337b [gaim-migrate @ 2912]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2880
diff changeset
1343 gtk_widget_set_usize(chatentry, buddy_chat_size.width, MAX(buddy_chat_size.entry_height, 25));
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1344 gtk_window_set_focus(GTK_WINDOW(win), chatentry);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1345 gtk_widget_show(chatentry);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1346
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1347 bbox = gtk_hbox_new(FALSE, 5);
1228
6773043cf9f6 [gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1227
diff changeset
1348 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
1349 gtk_widget_show(bbox);
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1350
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1351 close = picture_button2(win, _("Close"), cancel_xpm, dispstyle);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1352 b->close = close;
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1353 gtk_object_set_user_data(GTK_OBJECT(close), b);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1354 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
1355 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
1356
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1357 invite_btn = picture_button2(win, _("Invite"), join_xpm, dispstyle);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1358 b->invite = invite_btn;
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1359 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
1360 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
1361
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1362 whisper = picture_button2(win, _("Whisper"), tb_forward_xpm, dispstyle);
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1363 b->whisper = whisper;
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1364 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
1365 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
1366
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1367 send = picture_button2(win, _("Send"), tmp_send_xpm, dispstyle);
1201
90bb83cafb9e [gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1117
diff changeset
1368 b->send = send;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1369 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
1370 gtk_box_pack_end(GTK_BOX(bbox), send, dispstyle, dispstyle, 0);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1371
716
0995382d0c46 [gaim-migrate @ 726]
Todd Kulesza <fflewddur>
parents: 694
diff changeset
1372 b->font_dialog = NULL;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1373 b->fg_color_dialog = NULL;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1374 b->bg_color_dialog = NULL;
716
0995382d0c46 [gaim-migrate @ 726]
Todd Kulesza <fflewddur>
parents: 694
diff changeset
1375 b->smiley_dialog = NULL;
0995382d0c46 [gaim-migrate @ 726]
Todd Kulesza <fflewddur>
parents: 694
diff changeset
1376 b->link_dialog = NULL;
0995382d0c46 [gaim-migrate @ 726]
Todd Kulesza <fflewddur>
parents: 694
diff changeset
1377 b->log_dialog = NULL;
0995382d0c46 [gaim-migrate @ 726]
Todd Kulesza <fflewddur>
parents: 694
diff changeset
1378 sprintf(b->fontface, "%s", fontface);
0995382d0c46 [gaim-migrate @ 726]
Todd Kulesza <fflewddur>
parents: 694
diff changeset
1379 b->hasfont = 0;
0995382d0c46 [gaim-migrate @ 726]
Todd Kulesza <fflewddur>
parents: 694
diff changeset
1380 b->bgcol = bgcolor;
0995382d0c46 [gaim-migrate @ 726]
Todd Kulesza <fflewddur>
parents: 694
diff changeset
1381 b->hasbg = 0;
0995382d0c46 [gaim-migrate @ 726]
Todd Kulesza <fflewddur>
parents: 694
diff changeset
1382 b->fgcol = fgcolor;
0995382d0c46 [gaim-migrate @ 726]
Todd Kulesza <fflewddur>
parents: 694
diff changeset
1383 b->hasfg = 0;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1384
1343
a0d89bdc733e [gaim-migrate @ 1353]
Rob Flynn <gaim@robflynn.com>
parents: 1303
diff changeset
1385 update_buttons_by_protocol(b);
a0d89bdc733e [gaim-migrate @ 1353]
Rob Flynn <gaim@robflynn.com>
parents: 1303
diff changeset
1386
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1387 gtk_widget_show(win);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1388 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1389
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
1390 void chat_set_topic(struct conversation *b, char *who, char *topic)
2017
eee309c0de93 [gaim-migrate @ 2027]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1924
diff changeset
1391 {
1920
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1898
diff changeset
1392 gtk_entry_set_text(GTK_ENTRY(b->topic_text), topic);
2368
84823e04dcf7 [gaim-migrate @ 2381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2350
diff changeset
1393 if (b->topic)
84823e04dcf7 [gaim-migrate @ 2381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2350
diff changeset
1394 g_free(b->topic);
84823e04dcf7 [gaim-migrate @ 2381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2350
diff changeset
1395 b->topic = g_strdup(topic);
1920
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1898
diff changeset
1396 }
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1898
diff changeset
1397
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1398
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1399
2017
eee309c0de93 [gaim-migrate @ 2027]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1924
diff changeset
1400 void delete_chat(struct conversation *b)
eee309c0de93 [gaim-migrate @ 2027]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1924
diff changeset
1401 {
eee309c0de93 [gaim-migrate @ 2027]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1924
diff changeset
1402 while (b->in_room) {
eee309c0de93 [gaim-migrate @ 2027]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1924
diff changeset
1403 g_free(b->in_room->data);
eee309c0de93 [gaim-migrate @ 2027]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1924
diff changeset
1404 b->in_room = g_list_remove(b->in_room, b->in_room->data);
eee309c0de93 [gaim-migrate @ 2027]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1924
diff changeset
1405 }
eee309c0de93 [gaim-migrate @ 2027]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1924
diff changeset
1406 while (b->ignored) {
eee309c0de93 [gaim-migrate @ 2027]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1924
diff changeset
1407 g_free(b->ignored->data);
eee309c0de93 [gaim-migrate @ 2027]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1924
diff changeset
1408 b->ignored = g_list_remove(b->ignored, b->ignored->data);
eee309c0de93 [gaim-migrate @ 2027]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1924
diff changeset
1409 }
eee309c0de93 [gaim-migrate @ 2027]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1924
diff changeset
1410 g_string_free(b->history, TRUE);
2368
84823e04dcf7 [gaim-migrate @ 2381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2350
diff changeset
1411 if (b->topic)
84823e04dcf7 [gaim-migrate @ 2381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2350
diff changeset
1412 g_free(b->topic);
2017
eee309c0de93 [gaim-migrate @ 2027]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1924
diff changeset
1413 g_free(b);
eee309c0de93 [gaim-migrate @ 2027]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1924
diff changeset
1414 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1415
915
378c862a2381 [gaim-migrate @ 925]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 909
diff changeset
1416 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
1417 {
915
378c862a2381 [gaim-migrate @ 925]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 909
diff changeset
1418 int dispstyle = set_dispstyle(chat);
834
bac7089491c1 [gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 823
diff changeset
1419 GtkWidget *parent = button->parent;
bac7089491c1 [gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 823
diff changeset
1420 gtk_widget_destroy(button);
bac7089491c1 [gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 823
diff changeset
1421 button = picture_button2(win, text, xpm, dispstyle);
915
378c862a2381 [gaim-migrate @ 925]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 909
diff changeset
1422 if (chat == 1)
909
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1423 gtk_box_pack_start(GTK_BOX(parent), button, dispstyle, dispstyle, 5);
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1424 else
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1425 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
1426 gtk_widget_show(button);
bac7089491c1 [gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 823
diff changeset
1427 return button;
bac7089491c1 [gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 823
diff changeset
1428 }
bac7089491c1 [gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 823
diff changeset
1429
bac7089491c1 [gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 823
diff changeset
1430 void update_chat_button_pix()
bac7089491c1 [gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 823
diff changeset
1431 {
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
1432 GSList *C = connections;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
1433 struct gaim_connection *g;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
1434
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
1435 while (C) {
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
1436 GSList *bcs;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
1437 struct conversation *c;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
1438 int opt = 1;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
1439 g = (struct gaim_connection *)C->data;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
1440 bcs = g->buddy_chats;
834
bac7089491c1 [gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 823
diff changeset
1441
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
1442 while (bcs) {
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
1443 c = (struct conversation *)bcs->data;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
1444 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
1445 c->whisper =
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1446 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
1447 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
1448 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
1449 gtk_object_set_user_data(GTK_OBJECT(c->close), c);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1450 gtk_signal_connect(GTK_OBJECT(c->close), "clicked",
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1451 GTK_SIGNAL_FUNC(close_callback), c);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1452 gtk_signal_connect(GTK_OBJECT(c->send), "clicked",
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1453 GTK_SIGNAL_FUNC(send_callback), c);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1454 gtk_signal_connect(GTK_OBJECT(c->invite), "clicked",
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1455 GTK_SIGNAL_FUNC(invite_callback), c);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1456 gtk_signal_connect(GTK_OBJECT(c->whisper), "clicked",
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1457 GTK_SIGNAL_FUNC(whisper_callback), c);
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2391
diff changeset
1458
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2391
diff changeset
1459 update_buttons_by_protocol(c);
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2391
diff changeset
1460
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
1461 bcs = bcs->next;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
1462 }
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
1463 C = C->next;
834
bac7089491c1 [gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 823
diff changeset
1464 }
bac7089491c1 [gaim-migrate @ 844]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 823
diff changeset
1465 }
909
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1466
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1467 void update_im_button_pix()
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1468 {
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1469 GList *bcs = conversations;
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1470 struct conversation *c;
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1471 GtkWidget *parent;
915
378c862a2381 [gaim-migrate @ 925]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 909
diff changeset
1472 int opt = 0;
378c862a2381 [gaim-migrate @ 925]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 909
diff changeset
1473 int dispstyle = set_dispstyle(0);
909
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1474
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1475 while (bcs) {
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1476 c = (struct conversation *)bcs->data;
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1477 parent = c->close->parent;
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1478 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
1479 gtk_box_reorder_child(GTK_BOX(parent), c->close, 0);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1480 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
1481 GTK_PACK_END);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1018
diff changeset
1482 if (find_buddy(c->gc, c->name) == NULL)
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1483 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
1484 else
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1485 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
1486 gtk_box_reorder_child(GTK_BOX(parent), c->add, 2);
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1487 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
1488 gtk_box_reorder_child(GTK_BOX(parent), c->block, 3);
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1489 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
1490 gtk_box_reorder_child(GTK_BOX(parent), c->warn, 4);
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1491 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
1492 gtk_box_reorder_child(GTK_BOX(parent), c->info, 5);
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1493 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
1494 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
1495 GTK_PACK_END);
909
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1496 gtk_box_reorder_child(GTK_BOX(parent), c->send, 7);
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1497 gtk_object_set_user_data(GTK_OBJECT(c->close), c);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
1498 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
1499 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
1500 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
1501 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
1502 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
1503 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
1504 bcs = bcs->next;
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1505 }
9f2afe5faed5 [gaim-migrate @ 919]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 907
diff changeset
1506 }
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1507
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1508 void chat_tabize()
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1509 {
2368
84823e04dcf7 [gaim-migrate @ 2381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2350
diff changeset
1510 int pos = 0;
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1511 char tmp[BUF_LONG];
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1512 /* evil, evil i tell you! evil! */
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2289
diff changeset
1513 if (chat_options & OPT_CHAT_ONE_WINDOW) {
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1514 GList *x = chats;
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1515 if ((convo_options & OPT_CONVO_COMBINE) && (im_options & OPT_IM_ONE_WINDOW)) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1516 all_chats = all_convos;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1517 chat_notebook = convo_notebook;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1518 }
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1519 while (x) {
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1520 struct conversation *c = x->data;
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1521 GtkWidget *imhtml, *win;
2368
84823e04dcf7 [gaim-migrate @ 2381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2350
diff changeset
1522 GList *r = c->in_room;
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1523
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1524 imhtml = c->text;
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1525 win = c->window;
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1526 show_new_buddy_chat(c);
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1527 gtk_widget_destroy(c->text);
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1528 gtk_widget_reparent(imhtml, c->sw);
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1529 c->text = imhtml;
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1530 gtk_signal_disconnect_by_func(GTK_OBJECT(win),
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
1531 GTK_SIGNAL_FUNC(close_callback), c);
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1532 gtk_widget_destroy(win);
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1533
2368
84823e04dcf7 [gaim-migrate @ 2381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2350
diff changeset
1534 if (c->topic)
84823e04dcf7 [gaim-migrate @ 2381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2350
diff changeset
1535 gtk_entry_set_text(GTK_ENTRY(c->topic_text), c->topic);
84823e04dcf7 [gaim-migrate @ 2381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2350
diff changeset
1536
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1537 g_snprintf(tmp, sizeof(tmp), _("%d %s in room"), g_list_length(c->in_room),
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1538 g_list_length(c->in_room) == 1 ? "person" : "people");
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1539 gtk_label_set_text(GTK_LABEL(c->count), tmp);
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1540
2368
84823e04dcf7 [gaim-migrate @ 2381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2350
diff changeset
1541 while (r) {
84823e04dcf7 [gaim-migrate @ 2381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2350
diff changeset
1542 char *name = r->data;
84823e04dcf7 [gaim-migrate @ 2381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2350
diff changeset
1543
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
1544 add_chat_buddy_common(c, name, pos);
2368
84823e04dcf7 [gaim-migrate @ 2381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2350
diff changeset
1545
84823e04dcf7 [gaim-migrate @ 2381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2350
diff changeset
1546 r = r->next;
84823e04dcf7 [gaim-migrate @ 2381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2350
diff changeset
1547 pos++;
84823e04dcf7 [gaim-migrate @ 2381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2350
diff changeset
1548 }
84823e04dcf7 [gaim-migrate @ 2381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2350
diff changeset
1549
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1550 x = x->next;
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1551 }
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1552 } else {
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1553 GList *x, *m;
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1554 x = m = chats;
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1555 chats = NULL;
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1556 while (x) {
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1557 struct conversation *c = x->data;
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1558 GtkWidget *imhtml;
2368
84823e04dcf7 [gaim-migrate @ 2381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2350
diff changeset
1559 GList *r = c->in_room;
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1560
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1561 imhtml = c->text;
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1562 show_new_buddy_chat(c);
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1563 gtk_widget_destroy(c->text);
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1564 gtk_widget_reparent(imhtml, c->sw);
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1565 c->text = imhtml;
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1566
2368
84823e04dcf7 [gaim-migrate @ 2381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2350
diff changeset
1567 if (c->topic)
84823e04dcf7 [gaim-migrate @ 2381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2350
diff changeset
1568 gtk_entry_set_text(GTK_ENTRY(c->topic_text), c->topic);
84823e04dcf7 [gaim-migrate @ 2381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2350
diff changeset
1569
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1570 g_snprintf(tmp, sizeof(tmp), _("%d %s in room"), g_list_length(c->in_room),
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1571 g_list_length(c->in_room) == 1 ? "person" : "people");
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1572 gtk_label_set_text(GTK_LABEL(c->count), tmp);
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1573
2368
84823e04dcf7 [gaim-migrate @ 2381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2350
diff changeset
1574 while (r) {
84823e04dcf7 [gaim-migrate @ 2381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2350
diff changeset
1575 char *name = r->data;
84823e04dcf7 [gaim-migrate @ 2381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2350
diff changeset
1576
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2899
diff changeset
1577 add_chat_buddy_common(c, name, pos);
2368
84823e04dcf7 [gaim-migrate @ 2381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2350
diff changeset
1578
84823e04dcf7 [gaim-migrate @ 2381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2350
diff changeset
1579 r = r->next;
84823e04dcf7 [gaim-migrate @ 2381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2350
diff changeset
1580 pos++;
84823e04dcf7 [gaim-migrate @ 2381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2350
diff changeset
1581 }
84823e04dcf7 [gaim-migrate @ 2381]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2350
diff changeset
1582
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1583 x = x->next;
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1584 }
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1585 chats = m;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1586 if ((convo_options & OPT_CONVO_COMBINE) &&
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1587 (im_options & OPT_IM_ONE_WINDOW) && conversations) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1588 while (m) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1589 gtk_notebook_remove_page(GTK_NOTEBOOK(chat_notebook),
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1590 g_list_length(conversations));
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1591 m = m->next;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1592 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2820
diff changeset
1593 } else if (all_chats)
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1594 gtk_widget_destroy(all_chats);
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1595 all_chats = NULL;
1757
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
1596 chat_notebook = NULL;
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1597 }
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1505
diff changeset
1598 }