annotate src/buddy_chat.c @ 4259:a533999c8a6c

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