annotate src/buddy_chat.c @ 4181:4927676228f7

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