annotate src/conversation.c @ 3690:f210c035c8ae

[gaim-migrate @ 3820] didnt mean to kill this committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Mon, 14 Oct 2002 06:21:47 +0000
parents c78e0c031514
children b56d6de58f48
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1 /*
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2 * gaim
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3 *
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
5 *
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
9 * (at your option) any later version.
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
10 *
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
14 * GNU General Public License for more details.
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
15 *
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
19 *
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
20 */
eb2151d7e88a [gaim-migrate @ 76]
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
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
25 #include <string.h>
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3629
diff changeset
26 #ifndef _WIN32
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
27 #include <sys/time.h>
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3629
diff changeset
28 #include <unistd.h>
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3629
diff changeset
29 #include <gdk/gdkx.h>
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3629
diff changeset
30 #include <X11/Xlib.h>
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3629
diff changeset
31 #else
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3629
diff changeset
32 #ifdef small
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3629
diff changeset
33 #undef small
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3629
diff changeset
34 #endif
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3629
diff changeset
35 #endif /*_WIN32*/
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
36 #include <sys/types.h>
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
37 #include <sys/stat.h>
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
38 #include <stdio.h>
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
39 #include <stdlib.h>
2123
56c4382f2909 [gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2111
diff changeset
40 #include <errno.h>
210
ec0686b3b03f [gaim-migrate @ 220]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 209
diff changeset
41 #include <ctype.h>
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
42 #include <gtk/gtk.h>
1428
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
43 #include "gtkimhtml.h"
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
44 #include <gdk/gdkkeysyms.h>
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
45 #include "convo.h"
1117
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
46 #include "gtkspell.h"
1235
a9cf2f61a7b1 [gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1228
diff changeset
47 #include "prpl.h"
337
f5b199e20d12 [gaim-migrate @ 347]
Rob Flynn <gaim@robflynn.com>
parents: 315
diff changeset
48
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3629
diff changeset
49 #ifdef _WIN32
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3629
diff changeset
50 #include "win32dep.h"
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3629
diff changeset
51 #endif
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3629
diff changeset
52
604
0b1a132e0f75 [gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 602
diff changeset
53 #include "pixmaps/fontface.xpm"
790
9d5e7e987103 [gaim-migrate @ 800]
Rob Flynn <gaim@robflynn.com>
parents: 780
diff changeset
54 #include "pixmaps/smile_icon.xpm"
3484
5d1dff030d8b [gaim-migrate @ 3538]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
55 #include "pixmaps/search_small.xpm"
1479
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
56 #include "pixmaps/save_small.xpm"
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
57 #include "pixmaps/speaker.xpm"
3300
c5b4e55024e3 [gaim-migrate @ 3318]
Sean Egan <seanegan@gmail.com>
parents: 3280
diff changeset
58 #include "pixmaps/speaker_mute.xpm"
3044
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
59 #include "pixmaps/image_icon.xpm"
604
0b1a132e0f75 [gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 602
diff changeset
60
0b1a132e0f75 [gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 602
diff changeset
61 #include "pixmaps/luke03.xpm"
610
cadb51c068cb [gaim-migrate @ 620]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 608
diff changeset
62 #include "pixmaps/oneeye.xpm"
1732
e5ba877f51f2 [gaim-migrate @ 1742]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1709
diff changeset
63 #include "pixmaps/crazy4.xpm"
1965
cfdb6a9d3af8 [gaim-migrate @ 1975]
Rob Flynn <gaim@robflynn.com>
parents: 1918
diff changeset
64 #include "pixmaps/mrt.xpm"
2426
9e6c9461df3d [gaim-migrate @ 2439]
Rob Flynn <gaim@robflynn.com>
parents: 2421
diff changeset
65 #include "pixmaps/download.xpm"
2874
48123cba5a87 [gaim-migrate @ 2887]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2857
diff changeset
66 #include "pixmaps/farted.xpm"
604
0b1a132e0f75 [gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 602
diff changeset
67
2460
049822b93239 [gaim-migrate @ 2473]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2449
diff changeset
68 static gchar *ispell_cmd[] = { "ispell", "-a", NULL };
3209
265a3c9d0557 [gaim-migrate @ 3226]
Sean Egan <seanegan@gmail.com>
parents: 3205
diff changeset
69 static gchar *aspell_cmd[] = { "aspell", "--sug-mode=fast","-a", NULL };
2460
049822b93239 [gaim-migrate @ 2473]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2449
diff changeset
70
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
71 int state_lock = 0;
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
72
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
73 GdkPixmap *dark_icon_pm = NULL;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
74 GdkBitmap *dark_icon_bm = NULL;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
75
1608
e19a2cb4190c [gaim-migrate @ 1618]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1597
diff changeset
76 GtkWidget *all_convos = NULL;
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
77 GtkWidget *convo_notebook = NULL;
3677
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
78 GtkWidget *convo_menubar = NULL;
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
79
2763
477a035d81e5 [gaim-migrate @ 2776]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2761
diff changeset
80 char fontface[128] = { 0 };
3473
0073a014e55b [gaim-migrate @ 3524]
Sean Egan <seanegan@gmail.com>
parents: 3472
diff changeset
81
1441
5c67b8794991 [gaim-migrate @ 1451]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1440
diff changeset
82 int fontsize = 3;
885
db5f5c33e83f [gaim-migrate @ 895]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 876
diff changeset
83 extern GdkColor bgcolor;
db5f5c33e83f [gaim-migrate @ 895]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 876
diff changeset
84 extern GdkColor fgcolor;
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
85
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
86 void check_everything(GtkWidget *entry);
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
87 gboolean keypress_callback(GtkWidget *entry, GdkEventKey * event, struct conversation *c);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
88
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
89 static void update_icon(struct conversation *);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
90 static void remove_icon(struct conversation *);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
91
2231
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
92 static void update_checkbox(struct conversation *);
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
93 static void remove_checkbox(struct conversation *);
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
94
3035
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 3033
diff changeset
95 static void update_smilies(struct conversation *c);
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 3033
diff changeset
96
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 3033
diff changeset
97
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
98 /*------------------------------------------------------------------------*/
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
99 /* Helpers */
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
100 /*------------------------------------------------------------------------*/
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
101
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
102
3081
eb364675bbe4 [gaim-migrate @ 3095]
Rob Flynn <gaim@robflynn.com>
parents: 3060
diff changeset
103 void gaim_setup_imhtml_smileys(GtkWidget *imhtml)
1780
d7cbedd1d651 [gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1772
diff changeset
104 {
d7cbedd1d651 [gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1772
diff changeset
105 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "C:)", luke03_xpm);
d7cbedd1d651 [gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1772
diff changeset
106 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "C:-)", luke03_xpm);
d7cbedd1d651 [gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1772
diff changeset
107 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "O-)", oneeye_xpm);
d7cbedd1d651 [gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1772
diff changeset
108 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ">:)", crazy4_xpm);
d7cbedd1d651 [gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1772
diff changeset
109 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ">:-)", crazy4_xpm);
1965
cfdb6a9d3af8 [gaim-migrate @ 1975]
Rob Flynn <gaim@robflynn.com>
parents: 1918
diff changeset
110 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-o)))", mrt_xpm);
cfdb6a9d3af8 [gaim-migrate @ 1975]
Rob Flynn <gaim@robflynn.com>
parents: 1918
diff changeset
111 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-O)))", mrt_xpm);
2426
9e6c9461df3d [gaim-migrate @ 2439]
Rob Flynn <gaim@robflynn.com>
parents: 2421
diff changeset
112 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "8-|)", download_xpm);
2877
403dd881dcc4 [gaim-migrate @ 2890]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2874
diff changeset
113 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-]", farted_xpm);
1780
d7cbedd1d651 [gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1772
diff changeset
114 }
d7cbedd1d651 [gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1772
diff changeset
115
3081
eb364675bbe4 [gaim-migrate @ 3095]
Rob Flynn <gaim@robflynn.com>
parents: 3060
diff changeset
116 void gaim_setup_imhtml(GtkWidget *imhtml)
eb364675bbe4 [gaim-migrate @ 3095]
Rob Flynn <gaim@robflynn.com>
parents: 3060
diff changeset
117 {
eb364675bbe4 [gaim-migrate @ 3095]
Rob Flynn <gaim@robflynn.com>
parents: 3060
diff changeset
118 g_return_if_fail(imhtml != NULL);
eb364675bbe4 [gaim-migrate @ 3095]
Rob Flynn <gaim@robflynn.com>
parents: 3060
diff changeset
119 g_return_if_fail(GTK_IS_IMHTML(imhtml));
eb364675bbe4 [gaim-migrate @ 3095]
Rob Flynn <gaim@robflynn.com>
parents: 3060
diff changeset
120 if (!(convo_options & OPT_CONVO_SHOW_SMILEY))
eb364675bbe4 [gaim-migrate @ 3095]
Rob Flynn <gaim@robflynn.com>
parents: 3060
diff changeset
121 gtk_imhtml_show_smileys(GTK_IMHTML(imhtml), FALSE);
eb364675bbe4 [gaim-migrate @ 3095]
Rob Flynn <gaim@robflynn.com>
parents: 3060
diff changeset
122
eb364675bbe4 [gaim-migrate @ 3095]
Rob Flynn <gaim@robflynn.com>
parents: 3060
diff changeset
123 gtk_signal_connect(GTK_OBJECT(imhtml), "url_clicked", GTK_SIGNAL_FUNC(open_url), NULL);
eb364675bbe4 [gaim-migrate @ 3095]
Rob Flynn <gaim@robflynn.com>
parents: 3060
diff changeset
124 gaim_setup_imhtml_smileys(imhtml);
eb364675bbe4 [gaim-migrate @ 3095]
Rob Flynn <gaim@robflynn.com>
parents: 3060
diff changeset
125 }
eb364675bbe4 [gaim-migrate @ 3095]
Rob Flynn <gaim@robflynn.com>
parents: 3060
diff changeset
126
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
127 void quiet_set(GtkWidget *tb, int state)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
128 {
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
129 state_lock = 1;
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
130 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(tb), state);
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
131 state_lock = 0;
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
132 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
133
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
134
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
135 void set_state_lock(int i)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
136 {
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
137 state_lock = i;
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
138 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
139
234
985635758c33 [gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 230
diff changeset
140 void toggle_sensitive(GtkWidget *widget, GtkWidget *to_toggle)
985635758c33 [gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 230
diff changeset
141 {
985635758c33 [gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 230
diff changeset
142 gboolean sensitivity = GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(to_toggle));
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
143
234
985635758c33 [gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 230
diff changeset
144 if (sensitivity == TRUE)
985635758c33 [gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 230
diff changeset
145 gtk_widget_set_sensitive(GTK_WIDGET(to_toggle), FALSE);
985635758c33 [gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 230
diff changeset
146 else
985635758c33 [gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 230
diff changeset
147 gtk_widget_set_sensitive(GTK_WIDGET(to_toggle), TRUE);
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
148
234
985635758c33 [gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 230
diff changeset
149 return;
985635758c33 [gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 230
diff changeset
150 }
985635758c33 [gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 230
diff changeset
151
2937
261895f72f8a [gaim-migrate @ 2950]
Adam Fritzler <mid@auk.cx>
parents: 2936
diff changeset
152 void set_convo_name(struct conversation *c, const char *nname)
261895f72f8a [gaim-migrate @ 2950]
Adam Fritzler <mid@auk.cx>
parents: 2936
diff changeset
153 {
261895f72f8a [gaim-migrate @ 2950]
Adam Fritzler <mid@auk.cx>
parents: 2936
diff changeset
154
261895f72f8a [gaim-migrate @ 2950]
Adam Fritzler <mid@auk.cx>
parents: 2936
diff changeset
155 g_snprintf(c->name, sizeof(c->name), "%s", nname);
261895f72f8a [gaim-migrate @ 2950]
Adam Fritzler <mid@auk.cx>
parents: 2936
diff changeset
156
261895f72f8a [gaim-migrate @ 2950]
Adam Fritzler <mid@auk.cx>
parents: 2936
diff changeset
157 return;
261895f72f8a [gaim-migrate @ 2950]
Adam Fritzler <mid@auk.cx>
parents: 2936
diff changeset
158 }
261895f72f8a [gaim-migrate @ 2950]
Adam Fritzler <mid@auk.cx>
parents: 2936
diff changeset
159
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
160 struct conversation *new_conversation(char *name)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
161 {
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
162 struct conversation *c;
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
163
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
164 c = find_conversation(name);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
165
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
166 if (c != NULL)
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
167 return c;
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
168
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
169 c = (struct conversation *)g_new0(struct conversation, 1);
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
170 g_snprintf(c->name, sizeof(c->name), "%s", name);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
171
3457
222e23f91092 [gaim-migrate @ 3505]
Sean Egan <seanegan@gmail.com>
parents: 3451
diff changeset
172 if ((logging_options & OPT_LOG_CONVOS) || find_log_info(c->name)) {
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
173 FILE *fd;
70
dead1eb6d654 [gaim-migrate @ 80]
Rob Flynn <gaim@robflynn.com>
parents: 68
diff changeset
174
3457
222e23f91092 [gaim-migrate @ 3505]
Sean Egan <seanegan@gmail.com>
parents: 3451
diff changeset
175 fd = open_log_file(c->name, c->is_chat);
2004
699ddd727a49 [gaim-migrate @ 2014]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1970
diff changeset
176 if (fd) {
1525
ba8e6e211af5 [gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1486
diff changeset
177 if (!(logging_options & OPT_LOG_STRIP_HTML))
1437
1f0660a2c893 [gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1434
diff changeset
178 fprintf(fd,
1f0660a2c893 [gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1434
diff changeset
179 "<HR><BR><H3 Align=Center> ---- New Conversation @ %s ----</H3><BR>\n",
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
180 full_date());
1437
1f0660a2c893 [gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1434
diff changeset
181 else
1f0660a2c893 [gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1434
diff changeset
182 fprintf(fd, " ---- New Conversation @ %s ----\n", full_date());
1034
1d43fda97960 [gaim-migrate @ 1044]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1032
diff changeset
183 fclose(fd);
1d43fda97960 [gaim-migrate @ 1044]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1032
diff changeset
184 } else
1d43fda97960 [gaim-migrate @ 1044]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1032
diff changeset
185 /* do we want to do something here? */ ;
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
186 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
187
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
188 if (connections)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
189 c->gc = (struct gaim_connection *)connections->data;
1479
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
190 c->history = g_string_new("");
3122
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
191 c->send_history = g_list_append(NULL, NULL);
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
192 conversations = g_list_append(conversations, c);
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
193 show_conv(c);
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
194 update_icon(c);
3051
7cd6eadd575f [gaim-migrate @ 3064]
Rob Flynn <gaim@robflynn.com>
parents: 3050
diff changeset
195 update_checkbox(c);
3035
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 3033
diff changeset
196 update_smilies(c);
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3506
diff changeset
197 plugin_event(event_new_conversation, name);
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
198 return c;
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
199 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
200
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
201
3466
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3461
diff changeset
202 struct conversation *find_conversation(const char *name)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
203 {
2138
cfa83a1b3d49 [gaim-migrate @ 2148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2124
diff changeset
204 char *cuser = g_malloc(1024);
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
205 struct conversation *c;
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
206 GList *cnv = conversations;
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
207
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
208 strcpy(cuser, normalize(name));
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
209
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
210 while (cnv) {
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
211 c = (struct conversation *)cnv->data;
2048
3366311426df [gaim-migrate @ 2058]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2017
diff changeset
212 if (!g_strcasecmp(cuser, normalize(c->name))) {
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
213 g_free(cuser);
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
214 return c;
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
215 }
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
216 cnv = cnv->next;
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
217 }
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
218 g_free(cuser);
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
219 return NULL;
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
220 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
221
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
222 /* ---------------------------------------------------
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
223 * Function to remove a log file entry
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
224 * ---------------------------------------------------
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
225 */
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
226
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
227 void rm_log(struct log_conversation *a)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
228 {
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
229 struct conversation *cnv = find_conversation(a->name);
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
230
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
231 log_conversations = g_list_remove(log_conversations, a);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
232
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
233 save_prefs();
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
234
2787
feea7103a235 [gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2773
diff changeset
235 if (cnv && !(im_options & OPT_IM_ONE_WINDOW))
feea7103a235 [gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2773
diff changeset
236 set_convo_title(cnv);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
237 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
238
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
239 struct log_conversation *find_log_info(char *name)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
240 {
2138
cfa83a1b3d49 [gaim-migrate @ 2148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2124
diff changeset
241 char *pname = g_malloc(1024);
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
242 GList *lc = log_conversations;
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
243 struct log_conversation *l;
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
244
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
245
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
246 strcpy(pname, normalize(name));
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
247
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
248 while (lc) {
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
249 l = (struct log_conversation *)lc->data;
2048
3366311426df [gaim-migrate @ 2058]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2017
diff changeset
250 if (!g_strcasecmp(pname, normalize(l->name))) {
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
251 g_free(pname);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
252 return l;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
253 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
254 lc = lc->next;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
255 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
256 g_free(pname);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
257 return NULL;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
258 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
259
625
ea41ca1658b5 [gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 624
diff changeset
260 void delete_conversation(struct conversation *c)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
261 {
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3506
diff changeset
262 plugin_event(event_del_conversation, c);
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
263 conversations = g_list_remove(conversations, c);
858
3de6e98e8898 [gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 856
diff changeset
264 if (c->fg_color_dialog)
3de6e98e8898 [gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 856
diff changeset
265 gtk_widget_destroy(c->fg_color_dialog);
3de6e98e8898 [gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 856
diff changeset
266 if (c->bg_color_dialog)
3de6e98e8898 [gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 856
diff changeset
267 gtk_widget_destroy(c->bg_color_dialog);
625
ea41ca1658b5 [gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 624
diff changeset
268 if (c->font_dialog)
ea41ca1658b5 [gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 624
diff changeset
269 gtk_widget_destroy(c->font_dialog);
ea41ca1658b5 [gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 624
diff changeset
270 if (c->smiley_dialog)
ea41ca1658b5 [gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 624
diff changeset
271 gtk_widget_destroy(c->smiley_dialog);
ea41ca1658b5 [gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 624
diff changeset
272 if (c->link_dialog)
ea41ca1658b5 [gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 624
diff changeset
273 gtk_widget_destroy(c->link_dialog);
ea41ca1658b5 [gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 624
diff changeset
274 if (c->log_dialog)
ea41ca1658b5 [gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 624
diff changeset
275 gtk_widget_destroy(c->log_dialog);
2499
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
276 if (c->save_icon)
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
277 gtk_widget_destroy(c->save_icon);
3122
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
278 c->send_history = g_list_first(c->send_history);
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
279 while (c->send_history) {
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
280 if (c->send_history->data)
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
281 g_free(c->send_history->data);
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
282 c->send_history = c->send_history->next;
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
283 }
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
284 g_list_free(c->send_history);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
285 if (c->typing_timeout)
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
286 gtk_timeout_remove(c->typing_timeout);
3596
bb966d68f9e3 [gaim-migrate @ 3698]
Mark Doliner <mark@kingant.net>
parents: 3572
diff changeset
287 if (c->type_again_timeout)
bb966d68f9e3 [gaim-migrate @ 3698]
Mark Doliner <mark@kingant.net>
parents: 3572
diff changeset
288 gtk_timeout_remove(c->type_again_timeout);
1479
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
289 g_string_free(c->history, TRUE);
625
ea41ca1658b5 [gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 624
diff changeset
290 g_free(c);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
291 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
292
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
293 void update_log_convs()
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
294 {
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
295 GSList *C = connections;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
296 struct gaim_connection *g;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
297 GSList *bcs;
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
298 GList *cnv = conversations;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
299 struct conversation *c;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
300
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
301 while (cnv) {
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
302 c = (struct conversation *)cnv->data;
3457
222e23f91092 [gaim-migrate @ 3505]
Sean Egan <seanegan@gmail.com>
parents: 3451
diff changeset
303 if (c->log_button) {
222e23f91092 [gaim-migrate @ 3505]
Sean Egan <seanegan@gmail.com>
parents: 3451
diff changeset
304 if (c->is_chat)
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
305 gtk_widget_set_sensitive(GTK_WIDGET(c->log_button),
3457
222e23f91092 [gaim-migrate @ 3505]
Sean Egan <seanegan@gmail.com>
parents: 3451
diff changeset
306 ((logging_options & OPT_LOG_CHATS)) ? FALSE : TRUE);
222e23f91092 [gaim-migrate @ 3505]
Sean Egan <seanegan@gmail.com>
parents: 3451
diff changeset
307 else
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
308 gtk_widget_set_sensitive(GTK_WIDGET(c->log_button),
3457
222e23f91092 [gaim-migrate @ 3505]
Sean Egan <seanegan@gmail.com>
parents: 3451
diff changeset
309 ((logging_options & OPT_LOG_CONVOS)) ? FALSE : TRUE);
222e23f91092 [gaim-migrate @ 3505]
Sean Egan <seanegan@gmail.com>
parents: 3451
diff changeset
310 }
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
311
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
312 cnv = cnv->next;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
313 }
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
314
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
315 while (C) {
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
316 g = (struct gaim_connection *)C->data;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
317 bcs = g->buddy_chats;
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
318 while (bcs) {
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
319 c = (struct conversation *)bcs->data;
3457
222e23f91092 [gaim-migrate @ 3505]
Sean Egan <seanegan@gmail.com>
parents: 3451
diff changeset
320 if (c->log_button) {
222e23f91092 [gaim-migrate @ 3505]
Sean Egan <seanegan@gmail.com>
parents: 3451
diff changeset
321 if (c->is_chat)
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
322 gtk_widget_set_sensitive(GTK_WIDGET(c->log_button),
3457
222e23f91092 [gaim-migrate @ 3505]
Sean Egan <seanegan@gmail.com>
parents: 3451
diff changeset
323 ((logging_options & OPT_LOG_CHATS)) ? FALSE :
222e23f91092 [gaim-migrate @ 3505]
Sean Egan <seanegan@gmail.com>
parents: 3451
diff changeset
324 TRUE);
222e23f91092 [gaim-migrate @ 3505]
Sean Egan <seanegan@gmail.com>
parents: 3451
diff changeset
325 else
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
326 gtk_widget_set_sensitive(GTK_WIDGET(c->log_button),
3457
222e23f91092 [gaim-migrate @ 3505]
Sean Egan <seanegan@gmail.com>
parents: 3451
diff changeset
327 ((logging_options & OPT_LOG_CONVOS)) ? FALSE :
222e23f91092 [gaim-migrate @ 3505]
Sean Egan <seanegan@gmail.com>
parents: 3451
diff changeset
328 TRUE);
222e23f91092 [gaim-migrate @ 3505]
Sean Egan <seanegan@gmail.com>
parents: 3451
diff changeset
329 }
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
330
964
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
331 bcs = bcs->next;
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
332 }
2cd7b73e2c9a [gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 960
diff changeset
333 C = C->next;
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
334 }
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
335 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
336
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
337 void update_font_buttons()
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
338 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
339 GList *cnv = conversations;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
340 struct conversation *c;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
341
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
342 while (cnv) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
343 c = (struct conversation *)cnv->data;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
344
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
345 if (c->bold)
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
346 gtk_widget_set_sensitive(c->bold,
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
347 ((font_options & OPT_FONT_BOLD)) ? FALSE : TRUE);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
348
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
349 if (c->italic)
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
350 gtk_widget_set_sensitive(c->italic,
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
351 ((font_options & OPT_FONT_ITALIC)) ? FALSE : TRUE);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
352
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
353 if (c->underline)
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
354 gtk_widget_set_sensitive(c->underline,
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
355 ((font_options & OPT_FONT_UNDERLINE)) ? FALSE : TRUE);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
356
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
357 cnv = cnv->next;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
358 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
359 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
360
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
361 /*
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
362 void update_transparency()
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
363 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
364 GList *cnv = conversations;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
365 struct conversation *c;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
366
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
367 This func should be uncalled!
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
368
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
369 while(cnv) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
370 c = (struct conversation *)cnv->data;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
371
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
372 if (c->text)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
373 gtk_html_set_transparent(GTK_HTML(c->text),
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
374 (transparent) ? TRUE : FALSE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
375
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
376 cnv = cnv->next;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
377 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
378 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
379 */
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
380
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
381
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
382 /*------------------------------------------------------------------------*/
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
383 /* Callbacks */
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
384 /*------------------------------------------------------------------------*/
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
385
608
e33dfed611c9 [gaim-migrate @ 618]
Todd Kulesza <fflewddur>
parents: 604
diff changeset
386 void toggle_loggle(GtkWidget *loggle, struct conversation *c)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
387 {
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
388 if (state_lock)
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
389 return;
3484
5d1dff030d8b [gaim-migrate @ 3538]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
390
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
391 if (find_log_info(c->name))
3484
5d1dff030d8b [gaim-migrate @ 3538]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
392 rm_log(find_log_info(c->name));
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
393 else if (GTK_CHECK_MENU_ITEM(c->log_button)->active)
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
394 show_log_dialog(c);
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
395 else
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
396 cancel_log(NULL, c);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
397 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
398
3300
c5b4e55024e3 [gaim-migrate @ 3318]
Sean Egan <seanegan@gmail.com>
parents: 3280
diff changeset
399 void toggle_sound(GtkWidget *widget, struct conversation *c)
c5b4e55024e3 [gaim-migrate @ 3318]
Sean Egan <seanegan@gmail.com>
parents: 3280
diff changeset
400 {
3681
8599c86b9f46 [gaim-migrate @ 3811]
Rob Flynn <gaim@robflynn.com>
parents: 3679
diff changeset
401 if (state_lock)
3682
73c2b924703e [gaim-migrate @ 3812]
Rob Flynn <gaim@robflynn.com>
parents: 3681
diff changeset
402 return;
3681
8599c86b9f46 [gaim-migrate @ 3811]
Rob Flynn <gaim@robflynn.com>
parents: 3679
diff changeset
403
3300
c5b4e55024e3 [gaim-migrate @ 3318]
Sean Egan <seanegan@gmail.com>
parents: 3280
diff changeset
404 c->makesound = !c->makesound;
c5b4e55024e3 [gaim-migrate @ 3318]
Sean Egan <seanegan@gmail.com>
parents: 3280
diff changeset
405 }
c5b4e55024e3 [gaim-migrate @ 3318]
Sean Egan <seanegan@gmail.com>
parents: 3280
diff changeset
406
1479
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
407 static void do_save_convo(GtkObject *obj, GtkWidget *wid)
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
408 {
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
409 struct conversation *c = gtk_object_get_user_data(obj);
3466
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3461
diff changeset
410 const char *filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(wid));
1479
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
411 FILE *f;
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
412 if (file_is_dir(filename, wid))
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
413 return;
3466
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3461
diff changeset
414 if (!((!c->is_chat && g_list_find(conversations, c)) ||
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3461
diff changeset
415 (c->is_chat && g_slist_find(connections, c->gc) && g_slist_find(c->gc->buddy_chats, c))))
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3461
diff changeset
416 filename = NULL;
1479
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
417 gtk_widget_destroy(wid);
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
418 if (!filename)
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
419 return;
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
420 f = fopen(filename, "w+");
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
421 if (!f)
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
422 return;
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
423 fprintf(f, "%s", c->history->str);
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
424 fclose(f);
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
425 }
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
426
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
427 void save_convo(GtkWidget *save, struct conversation *c)
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
428 {
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
429 char buf[BUF_LONG];
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
430 GtkWidget *window = gtk_file_selection_new(_("Gaim - Save Conversation"));
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3629
diff changeset
431 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S "%s.log", gaim_home_dir(), normalize(c->name));
1479
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
432 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf);
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
433 gtk_object_set_user_data(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), c);
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
434 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button),
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
435 "clicked", GTK_SIGNAL_FUNC(do_save_convo), window);
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
436 gtk_signal_connect_object(GTK_OBJECT(GTK_FILE_SELECTION(window)->cancel_button),
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
437 "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), (gpointer)window);
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
438 gtk_widget_show(window);
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
439 }
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
440
3044
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
441 static void do_insert_image(GtkObject *obj, GtkWidget *wid)
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
442 {
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
443 struct conversation *c = gtk_object_get_user_data(obj);
3466
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3461
diff changeset
444 const char *name = gtk_file_selection_get_filename(GTK_FILE_SELECTION(wid));
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3461
diff changeset
445 const char *filename;
3044
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
446 int pos;
3466
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3461
diff changeset
447 char *buf;
3044
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
448 struct stat st;
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
449 int id = g_slist_length(c->images) + 1;
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
450
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
451 if (file_is_dir(name, wid))
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
452 return;
3466
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3461
diff changeset
453 if (!(!c->is_chat && g_list_find(conversations, c)))
3044
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
454 name = NULL;
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
455 gtk_widget_destroy(wid);
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
456 if (!name)
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
457 return;
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
458
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
459 if (stat(name, &st) != 0) {
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
460 debug_printf("Could not stat %s\n", name);
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
461 return;
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
462 }
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
463
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
464 filename = name;
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
465 while (strchr(filename, '/'))
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
466 filename = strchr(filename, '/') + 1;
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
467
3466
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3461
diff changeset
468 buf = g_strdup_printf ("<IMG SRC=\"file://%s\" ID=\"%d\" DATASIZE=\"%d\">",
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3461
diff changeset
469 filename, id, (int)st.st_size);
3044
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
470 c->images = g_slist_append(c->images, g_strdup(name));
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
471
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
472 if (GTK_OLD_EDITABLE(c->entry)->has_selection) {
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
473 int finish = GTK_OLD_EDITABLE(c->entry)->selection_end_pos;
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
474 gtk_editable_insert_text(GTK_EDITABLE(c->entry),
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
475 buf, strlen(buf), &finish);
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
476 } else {
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
477 pos = GTK_OLD_EDITABLE(c->entry)->current_pos;
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
478 gtk_editable_insert_text(GTK_EDITABLE(c->entry),
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
479 buf, strlen(buf), &pos);
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
480 }
3466
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3461
diff changeset
481 g_free(buf);
3044
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
482 }
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
483
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
484 void insert_image(GtkWidget *save, struct conversation *c)
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
485 {
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
486 char buf[BUF_LONG];
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
487 GtkWidget *window = gtk_file_selection_new(_("Gaim - Insert Image"));
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3629
diff changeset
488 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S, gaim_home_dir());
3044
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
489 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf);
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
490 gtk_object_set_user_data(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), c);
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
491 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button),
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
492 "clicked", GTK_SIGNAL_FUNC(do_insert_image), window);
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
493 gtk_signal_connect_object(GTK_OBJECT(GTK_FILE_SELECTION(window)->cancel_button),
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
494 "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), (gpointer)window);
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
495 gtk_widget_show(window);
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
496 }
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
497
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
498
570
93c65fbaa622 [gaim-migrate @ 580]
Todd Kulesza <fflewddur>
parents: 563
diff changeset
499 void insert_smiley(GtkWidget *smiley, struct conversation *c)
555
66fe9f2c26ad [gaim-migrate @ 565]
Todd Kulesza <fflewddur>
parents: 551
diff changeset
500 {
66fe9f2c26ad [gaim-migrate @ 565]
Todd Kulesza <fflewddur>
parents: 551
diff changeset
501 if (state_lock)
66fe9f2c26ad [gaim-migrate @ 565]
Todd Kulesza <fflewddur>
parents: 551
diff changeset
502 return;
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
503
570
93c65fbaa622 [gaim-migrate @ 580]
Todd Kulesza <fflewddur>
parents: 563
diff changeset
504 if (GTK_TOGGLE_BUTTON(smiley)->active)
93c65fbaa622 [gaim-migrate @ 580]
Todd Kulesza <fflewddur>
parents: 563
diff changeset
505 show_smiley_dialog(c, smiley);
93c65fbaa622 [gaim-migrate @ 580]
Todd Kulesza <fflewddur>
parents: 563
diff changeset
506 else if (c->smiley_dialog)
93c65fbaa622 [gaim-migrate @ 580]
Todd Kulesza <fflewddur>
parents: 563
diff changeset
507 close_smiley_dialog(smiley, c);
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
508
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
509 gtk_widget_grab_focus(c->entry);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
510
555
66fe9f2c26ad [gaim-migrate @ 565]
Todd Kulesza <fflewddur>
parents: 551
diff changeset
511 return;
66fe9f2c26ad [gaim-migrate @ 565]
Todd Kulesza <fflewddur>
parents: 551
diff changeset
512 }
66fe9f2c26ad [gaim-migrate @ 565]
Todd Kulesza <fflewddur>
parents: 551
diff changeset
513
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
514 int close_callback(GtkWidget *widget, struct conversation *c)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
515 {
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
516 if (c->is_chat && (widget == c->close) && !(chat_options & OPT_CHAT_ONE_WINDOW)) {
814
a636ac51d15b [gaim-migrate @ 824]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 808
diff changeset
517 GtkWidget *tmp = c->window;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1244
diff changeset
518 debug_printf("chat clicked close button\n");
814
a636ac51d15b [gaim-migrate @ 824]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 808
diff changeset
519 c->window = NULL;
a636ac51d15b [gaim-migrate @ 824]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 808
diff changeset
520 gtk_widget_destroy(tmp);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
521 return FALSE;
814
a636ac51d15b [gaim-migrate @ 824]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 808
diff changeset
522 }
a636ac51d15b [gaim-migrate @ 824]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 808
diff changeset
523
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1244
diff changeset
524 debug_printf("conversation close callback\n");
814
a636ac51d15b [gaim-migrate @ 824]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 808
diff changeset
525
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
526 if (convo_options & OPT_CONVO_CHECK_SPELLING)
1117
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
527 gtkspell_detach(GTK_TEXT(c->entry));
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
528
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1663
diff changeset
529 if (!c->is_chat) {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2245
diff changeset
530 GSList *cn = connections;
3596
bb966d68f9e3 [gaim-migrate @ 3698]
Mark Doliner <mark@kingant.net>
parents: 3572
diff changeset
531 if (!(misc_options & OPT_MISC_STEALTH_TYPING))
bb966d68f9e3 [gaim-migrate @ 3698]
Mark Doliner <mark@kingant.net>
parents: 3572
diff changeset
532 serv_send_typing(c->gc, c->name, NOT_TYPING);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2245
diff changeset
533 while (cn) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2245
diff changeset
534 struct gaim_connection *gc = cn->data;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2245
diff changeset
535 cn = cn->next;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2245
diff changeset
536 if (gc->prpl->convo_closed)
2662
b0c5770156e1 [gaim-migrate @ 2675]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2631
diff changeset
537 gc->prpl->convo_closed(gc, c->name);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2245
diff changeset
538 }
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
539 remove_icon(c);
2231
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
540 remove_checkbox(c);
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
541 if (im_options & OPT_IM_ONE_WINDOW) {
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
542 if ((g_list_length(conversations) > 1) ||
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
543 ((convo_options & OPT_CONVO_COMBINE) &&
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
544 (chat_options & OPT_CHAT_ONE_WINDOW) && chats)) {
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1663
diff changeset
545 gtk_notebook_remove_page(GTK_NOTEBOOK(convo_notebook),
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
546 g_list_index(conversations, c));
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1663
diff changeset
547 } else {
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1663
diff changeset
548 if (c->window)
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1663
diff changeset
549 gtk_widget_destroy(c->window);
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1663
diff changeset
550 c->window = NULL;
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1663
diff changeset
551 all_convos = NULL;
1757
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
552 convo_notebook = NULL;
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
553 if (convo_options & OPT_CONVO_COMBINE) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
554 all_chats = NULL;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
555 chat_notebook = NULL;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
556 }
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1663
diff changeset
557 }
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
558 } else {
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
559 if (c->window)
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
560 gtk_widget_destroy(c->window);
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
561 c->window = NULL;
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
562 }
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
563 } else {
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
564 if (chat_options & OPT_CHAT_ONE_WINDOW) {
2891
58baac124b0d [gaim-migrate @ 2904]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2877
diff changeset
565 if ((convo_options & OPT_CONVO_COMBINE) && (im_options & OPT_IM_ONE_WINDOW)
58baac124b0d [gaim-migrate @ 2904]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2877
diff changeset
566 && (conversations || chats->next)) {
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1663
diff changeset
567 gtk_notebook_remove_page(GTK_NOTEBOOK(chat_notebook),
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
568 g_list_index(chats, c) +
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
569 g_list_length(conversations));
2891
58baac124b0d [gaim-migrate @ 2904]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2877
diff changeset
570 } else if (g_list_length(chats) > 1) {
58baac124b0d [gaim-migrate @ 2904]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2877
diff changeset
571 gtk_notebook_remove_page(GTK_NOTEBOOK(chat_notebook),
58baac124b0d [gaim-migrate @ 2904]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2877
diff changeset
572 g_list_index(chats, c));
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1663
diff changeset
573 } else {
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1663
diff changeset
574 if (c->window)
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1663
diff changeset
575 gtk_widget_destroy(c->window);
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1663
diff changeset
576 c->window = NULL;
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1663
diff changeset
577 all_chats = NULL;
1757
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
578 chat_notebook = NULL;
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
579 if (convo_options & OPT_CONVO_COMBINE) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
580 all_convos = NULL;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
581 convo_notebook = NULL;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
582 }
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1663
diff changeset
583 }
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1663
diff changeset
584 } else {
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1663
diff changeset
585 if (c->window)
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1663
diff changeset
586 gtk_widget_destroy(c->window);
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1663
diff changeset
587 c->window = NULL;
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1663
diff changeset
588 }
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
589 }
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
590
858
3de6e98e8898 [gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 856
diff changeset
591 if (c->fg_color_dialog)
3de6e98e8898 [gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 856
diff changeset
592 gtk_widget_destroy(c->fg_color_dialog);
3de6e98e8898 [gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 856
diff changeset
593 c->fg_color_dialog = NULL;
3de6e98e8898 [gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 856
diff changeset
594 if (c->bg_color_dialog)
3de6e98e8898 [gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 856
diff changeset
595 gtk_widget_destroy(c->bg_color_dialog);
3de6e98e8898 [gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 856
diff changeset
596 c->bg_color_dialog = NULL;
625
ea41ca1658b5 [gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 624
diff changeset
597 if (c->font_dialog)
ea41ca1658b5 [gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 624
diff changeset
598 gtk_widget_destroy(c->font_dialog);
ea41ca1658b5 [gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 624
diff changeset
599 c->font_dialog = NULL;
ea41ca1658b5 [gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 624
diff changeset
600 if (c->smiley_dialog)
ea41ca1658b5 [gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 624
diff changeset
601 gtk_widget_destroy(c->smiley_dialog);
ea41ca1658b5 [gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 624
diff changeset
602 c->smiley_dialog = NULL;
ea41ca1658b5 [gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 624
diff changeset
603 if (c->link_dialog)
ea41ca1658b5 [gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 624
diff changeset
604 gtk_widget_destroy(c->link_dialog);
ea41ca1658b5 [gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 624
diff changeset
605 c->link_dialog = NULL;
ea41ca1658b5 [gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 624
diff changeset
606 if (c->log_dialog)
ea41ca1658b5 [gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 624
diff changeset
607 gtk_widget_destroy(c->log_dialog);
ea41ca1658b5 [gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 624
diff changeset
608 c->log_dialog = NULL;
ea41ca1658b5 [gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 624
diff changeset
609
511
3133ab511d92 [gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 502
diff changeset
610 if (c->is_chat) {
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1663
diff changeset
611 chats = g_list_remove(chats, c);
1063
e1408fb04c36 [gaim-migrate @ 1073]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1034
diff changeset
612 if (c->gc)
e1408fb04c36 [gaim-migrate @ 1073]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1034
diff changeset
613 serv_chat_leave(c->gc, c->id);
2017
eee309c0de93 [gaim-migrate @ 2027]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2004
diff changeset
614 else
eee309c0de93 [gaim-migrate @ 2027]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2004
diff changeset
615 delete_chat(c);
511
3133ab511d92 [gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 502
diff changeset
616 } else {
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
617 delete_conversation(c);
511
3133ab511d92 [gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 502
diff changeset
618 }
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
619
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
620 return TRUE;
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
621 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
622
666
71ea550c22ac [gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 661
diff changeset
623 void set_font_face(char *newfont, struct conversation *c)
230
83dd297aa363 [gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 210
diff changeset
624 {
666
71ea550c22ac [gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 661
diff changeset
625 char *pre_fontface;
3473
0073a014e55b [gaim-migrate @ 3524]
Sean Egan <seanegan@gmail.com>
parents: 3472
diff changeset
626
0073a014e55b [gaim-migrate @ 3524]
Sean Egan <seanegan@gmail.com>
parents: 3472
diff changeset
627 sprintf(c->fontface, "%s", newfont && *newfont ? newfont : DEFAULT_FONT_FACE);
688
6b1345121dd3 [gaim-migrate @ 698]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 687
diff changeset
628 c->hasfont = 1;
2763
477a035d81e5 [gaim-migrate @ 2776]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2761
diff changeset
629
477a035d81e5 [gaim-migrate @ 2776]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2761
diff changeset
630 pre_fontface = g_strconcat("<FONT FACE=\"", c->fontface, "\">", NULL);
230
83dd297aa363 [gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 210
diff changeset
631 surround(c->entry, pre_fontface, "</FONT>");
83dd297aa363 [gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 210
diff changeset
632 gtk_widget_grab_focus(c->entry);
2763
477a035d81e5 [gaim-migrate @ 2776]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2761
diff changeset
633 g_free(pre_fontface);
230
83dd297aa363 [gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 210
diff changeset
634 }
83dd297aa363 [gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 210
diff changeset
635
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
636 gint delete_all_convo(GtkWidget *w, GdkEventAny *e, gpointer d)
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
637 {
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
638 if (w == all_convos) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
639 while (conversations) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
640 struct conversation *c = conversations->data;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
641 close_callback(c->close, c);
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
642 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
643 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
644 if (w == all_chats) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
645 while (chats) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
646 struct conversation *c = chats->data;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
647 close_callback(c->close, c);
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
648 }
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
649 }
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
650 return FALSE;
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
651 }
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
652
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
653 static gint delete_event_convo(GtkWidget *w, GdkEventAny *e, struct conversation *c)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
654 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
655 delete_conversation(c);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
656 return FALSE;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
657 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
658
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
659 void add_callback(GtkWidget *widget, struct conversation *c)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
660 {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2662
diff changeset
661 struct buddy *b = find_buddy(c->gc, c->name);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2662
diff changeset
662 if (b) {
2745
0c8de85fee62 [gaim-migrate @ 2758]
Rob Flynn <gaim@robflynn.com>
parents: 2743
diff changeset
663 show_confirm_del(c->gc, c->name);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2662
diff changeset
664 } else if (c->gc)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2662
diff changeset
665 show_add_buddy(c->gc, c->name, NULL, NULL);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
666
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
667 gtk_widget_grab_focus(c->entry);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
668 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
669
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
670
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
671 void block_callback(GtkWidget *widget, struct conversation *c)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
672 {
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
673 if (c->gc)
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
674 show_add_perm(c->gc, c->name, FALSE);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
675 gtk_widget_grab_focus(c->entry);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
676 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
677
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
678 void warn_callback(GtkWidget *widget, struct conversation *c)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
679 {
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
680 show_warn_dialog(c->gc, c->name);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
681 gtk_widget_grab_focus(c->entry);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
682 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
683
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
684 void info_callback(GtkWidget *w, struct conversation *c)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
685 {
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
686 if (c->is_chat) {
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
687 char *name;
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
688 GList *i;
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
689
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
690 i = GTK_LIST(c->list)->selection;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
691 if (i) {
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
692 name = (char *)gtk_object_get_user_data(GTK_OBJECT(i->data));
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
693 } else {
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
694 return;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
695 }
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
696
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
697 serv_get_info(c->gc, name);
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
698 } else {
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
699 serv_get_info(c->gc, c->name);
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
700 gtk_widget_grab_focus(c->entry);
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
701 }
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
702 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
703
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
704 static void move_next_tab(GtkNotebook *notebook, gboolean chat)
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
705 {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
706 int currpage = gtk_notebook_get_current_page(notebook);
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
707 int convlen;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
708 GList *cnv;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
709 struct conversation *d = NULL;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
710
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
711 if ((convo_options & OPT_CONVO_COMBINE) &&
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
712 (im_options & OPT_IM_ONE_WINDOW) &&
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
713 (chat_options & OPT_CHAT_ONE_WINDOW))
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
714 convlen = g_list_length(conversations);
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
715 else
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
716 convlen = 0;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
717
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
718 if (chat) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
719 /* if chat, find next unread chat */
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
720 cnv = g_list_nth(chats, currpage - convlen);
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
721 while (cnv) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
722 d = cnv->data;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
723 if (d->unseen > 0)
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
724 break;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
725 cnv = cnv->next;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
726 d = NULL;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
727 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
728 if (d) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
729 gtk_notebook_set_page(notebook, convlen + g_list_index(chats, d));
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
730 return;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
731 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
732 } else {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
733 /* else find next unread convo */
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
734 cnv = g_list_nth(conversations, currpage);
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
735 while (cnv) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
736 d = cnv->data;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
737 if (d->unseen > 0)
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
738 break;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
739 cnv = cnv->next;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
740 d = NULL;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
741 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
742 if (d) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
743 gtk_notebook_set_page(notebook, g_list_index(conversations, d));
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
744 return;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
745 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
746 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
747
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
748 if (convo_options & OPT_CONVO_COMBINE) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
749 if (chat && (im_options & OPT_IM_ONE_WINDOW)) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
750 /* if chat find next unread convo */
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
751 cnv = conversations;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
752 while (cnv) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
753 d = cnv->data;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
754 if (d->unseen > 0)
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
755 break;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
756 cnv = cnv->next;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
757 d = NULL;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
758 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
759 if (d) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
760 gtk_notebook_set_page(notebook, g_list_index(conversations, d));
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
761 return;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
762 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
763 } else if (!chat && (chat_options & OPT_CHAT_ONE_WINDOW)) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
764 /* else find next unread chat */
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
765 cnv = chats;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
766 while (cnv) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
767 d = cnv->data;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
768 if (d->unseen > 0)
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
769 break;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
770 cnv = cnv->next;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
771 d = NULL;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
772 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
773 if (d) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
774 gtk_notebook_set_page(notebook, convlen + g_list_index(chats, d));
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
775 return;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
776 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
777 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
778 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
779
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
780 if (chat) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
781 /* if chat find first unread chat */
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
782 cnv = chats;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
783 while (cnv) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
784 d = cnv->data;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
785 if (d->unseen > 0)
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
786 break;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
787 cnv = cnv->next;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
788 d = NULL;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
789 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
790 if (d) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
791 gtk_notebook_set_page(notebook, convlen + g_list_index(chats, d));
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
792 return;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
793 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
794 } else {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
795 /* else find first unread convo */
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
796 cnv = conversations;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
797 while (cnv) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
798 d = cnv->data;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
799 if (d->unseen > 0)
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
800 break;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
801 cnv = cnv->next;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
802 d = NULL;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
803 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
804 if (d) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
805 gtk_notebook_set_page(notebook, g_list_index(conversations, d));
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
806 return;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
807 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
808 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
809
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
810 /* go to next page */
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
811 if (currpage + 1 == g_list_length(notebook->children))
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
812 gtk_notebook_set_page(notebook, 0);
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
813 else
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
814 gtk_notebook_next_page(notebook);
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
815 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
816
3612
abb114442532 [gaim-migrate @ 3726]
Sean Egan <seanegan@gmail.com>
parents: 3597
diff changeset
817 #define SEND_TYPED_TIMEOUT 5000
abb114442532 [gaim-migrate @ 3726]
Sean Egan <seanegan@gmail.com>
parents: 3597
diff changeset
818
3596
bb966d68f9e3 [gaim-migrate @ 3698]
Mark Doliner <mark@kingant.net>
parents: 3572
diff changeset
819 gboolean send_typed(gpointer data)
bb966d68f9e3 [gaim-migrate @ 3698]
Mark Doliner <mark@kingant.net>
parents: 3572
diff changeset
820 {
bb966d68f9e3 [gaim-migrate @ 3698]
Mark Doliner <mark@kingant.net>
parents: 3572
diff changeset
821 struct conversation *c = (struct conversation*)data;
bb966d68f9e3 [gaim-migrate @ 3698]
Mark Doliner <mark@kingant.net>
parents: 3572
diff changeset
822 if (c && c->gc && c->name) {
bb966d68f9e3 [gaim-migrate @ 3698]
Mark Doliner <mark@kingant.net>
parents: 3572
diff changeset
823 c->type_again = 1;
bb966d68f9e3 [gaim-migrate @ 3698]
Mark Doliner <mark@kingant.net>
parents: 3572
diff changeset
824 serv_send_typing(c->gc, c->name, TYPED);
bb966d68f9e3 [gaim-migrate @ 3698]
Mark Doliner <mark@kingant.net>
parents: 3572
diff changeset
825 }
bb966d68f9e3 [gaim-migrate @ 3698]
Mark Doliner <mark@kingant.net>
parents: 3572
diff changeset
826 return FALSE;
bb966d68f9e3 [gaim-migrate @ 3698]
Mark Doliner <mark@kingant.net>
parents: 3572
diff changeset
827 }
bb966d68f9e3 [gaim-migrate @ 3698]
Mark Doliner <mark@kingant.net>
parents: 3572
diff changeset
828
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
829 gboolean keypress_callback(GtkWidget *entry, GdkEventKey * event, struct conversation *c)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
830 {
573
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 570
diff changeset
831 int pos;
3627
639411e6a4cd [gaim-migrate @ 3750]
Luke Schierer <lschiere@pidgin.im>
parents: 3626
diff changeset
832 gboolean key_is_typing = TRUE;
639411e6a4cd [gaim-migrate @ 3750]
Luke Schierer <lschiere@pidgin.im>
parents: 3626
diff changeset
833
1411
a3e472534370 [gaim-migrate @ 1421]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1403
diff changeset
834 if (event->keyval == GDK_Escape) {
3627
639411e6a4cd [gaim-migrate @ 3750]
Luke Schierer <lschiere@pidgin.im>
parents: 3626
diff changeset
835 key_is_typing = FALSE;
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
836 if (convo_options & OPT_CONVO_ESC_CAN_CLOSE) {
1411
a3e472534370 [gaim-migrate @ 1421]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1403
diff changeset
837 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
1464
ae075ecc7c34 [gaim-migrate @ 1474]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1456
diff changeset
838 close_callback(c->close, c);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
839 c = NULL;
1411
a3e472534370 [gaim-migrate @ 1421]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1403
diff changeset
840 }
2363
08c66712364c [gaim-migrate @ 2376]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2345
diff changeset
841 } else if (event->keyval == GDK_Page_Up) {
3627
639411e6a4cd [gaim-migrate @ 3750]
Luke Schierer <lschiere@pidgin.im>
parents: 3626
diff changeset
842 key_is_typing = FALSE;
2749
8ff0bd0f7347 [gaim-migrate @ 2762]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2748
diff changeset
843 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
3626
468dc12b5ee8 [gaim-migrate @ 3749]
Luke Schierer <lschiere@pidgin.im>
parents: 3612
diff changeset
844 if(!(event->state & GDK_CONTROL_MASK))
468dc12b5ee8 [gaim-migrate @ 3749]
Luke Schierer <lschiere@pidgin.im>
parents: 3612
diff changeset
845 gtk_imhtml_page_up(GTK_IMHTML(c->text));
2363
08c66712364c [gaim-migrate @ 2376]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2345
diff changeset
846 } else if (event->keyval == GDK_Page_Down) {
3627
639411e6a4cd [gaim-migrate @ 3750]
Luke Schierer <lschiere@pidgin.im>
parents: 3626
diff changeset
847 key_is_typing = FALSE;
2749
8ff0bd0f7347 [gaim-migrate @ 2762]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2748
diff changeset
848 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
3626
468dc12b5ee8 [gaim-migrate @ 3749]
Luke Schierer <lschiere@pidgin.im>
parents: 3612
diff changeset
849 if(!(event->state & GDK_CONTROL_MASK))
468dc12b5ee8 [gaim-migrate @ 3749]
Luke Schierer <lschiere@pidgin.im>
parents: 3612
diff changeset
850 gtk_imhtml_page_down(GTK_IMHTML(c->text));
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
851 } else if ((event->keyval == GDK_F2) && (convo_options & OPT_CONVO_F2_TOGGLES)) {
3627
639411e6a4cd [gaim-migrate @ 3750]
Luke Schierer <lschiere@pidgin.im>
parents: 3626
diff changeset
852 key_is_typing = FALSE;
1455
d113c7e2c5f1 [gaim-migrate @ 1465]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1453
diff changeset
853 gtk_imhtml_show_comments(GTK_IMHTML(c->text), !GTK_IMHTML(c->text)->comments);
1872
efc899af4912 [gaim-migrate @ 1882]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1867
diff changeset
854 } else if ((event->keyval == GDK_Return) || (event->keyval == GDK_KP_Enter)) {
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
855 if ((event->state & GDK_CONTROL_MASK) && (convo_options & OPT_CONVO_CTL_ENTER)) {
573
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 570
diff changeset
856 gtk_signal_emit_by_name(GTK_OBJECT(entry), "activate", c);
1442
2f4e6269b001 [gaim-migrate @ 1452]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
857 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
2748
497868102c90 [gaim-migrate @ 2761]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2745
diff changeset
858 return TRUE;
2773
a0fd8f91e294 [gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2767
diff changeset
859 } else if (!(event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) && (convo_options & OPT_CONVO_ENTER_SENDS)) {
1442
2f4e6269b001 [gaim-migrate @ 1452]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
860 gtk_signal_emit_by_name(GTK_OBJECT(entry), "activate", c);
573
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 570
diff changeset
861 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
2748
497868102c90 [gaim-migrate @ 2761]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2745
diff changeset
862 return TRUE;
573
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 570
diff changeset
863 } else {
2483
e73ca8d8d358 [gaim-migrate @ 2496]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
864 int oldpos;
573
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 570
diff changeset
865 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
2483
e73ca8d8d358 [gaim-migrate @ 2496]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
866 oldpos = pos = gtk_editable_get_position(GTK_EDITABLE(entry));
573
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 570
diff changeset
867 gtk_editable_insert_text(GTK_EDITABLE(entry), "\n", 1, &pos);
2483
e73ca8d8d358 [gaim-migrate @ 2496]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
868 if (oldpos == pos)
e73ca8d8d358 [gaim-migrate @ 2496]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
869 gtk_editable_set_position(GTK_EDITABLE(entry), pos + 1);
2748
497868102c90 [gaim-migrate @ 2761]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2745
diff changeset
870 return TRUE;
573
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 570
diff changeset
871 }
2483
e73ca8d8d358 [gaim-migrate @ 2496]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
872 } else if ((event->state & GDK_CONTROL_MASK) && (event->keyval == 'm')) {
e73ca8d8d358 [gaim-migrate @ 2496]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
873 int oldpos;
e73ca8d8d358 [gaim-migrate @ 2496]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
874 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
e73ca8d8d358 [gaim-migrate @ 2496]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
875 oldpos = pos = gtk_editable_get_position(GTK_EDITABLE(entry));
e73ca8d8d358 [gaim-migrate @ 2496]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
876 gtk_editable_insert_text(GTK_EDITABLE(entry), "\n", 1, &pos);
e73ca8d8d358 [gaim-migrate @ 2496]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
877 if (oldpos == pos)
e73ca8d8d358 [gaim-migrate @ 2496]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
878 gtk_editable_set_position(GTK_EDITABLE(entry), pos + 1);
830
60284aef22f0 [gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
879 } else if (event->state & GDK_CONTROL_MASK) {
3122
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
880 int pos = 0;
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
881 switch (event->keyval) {
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
882 case GDK_Up:
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
883 if (!c->send_history)
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
884 break;
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
885 if (!c->send_history->prev) {
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
886 if (c->send_history->data)
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
887 g_free(c->send_history->data);
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
888 c->send_history->data = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1);
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
889 }
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
890 if (c->send_history->next && c->send_history->next->data) {
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
891 c->send_history = c->send_history->next;
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
892 gtk_editable_delete_text (GTK_EDITABLE(entry),0,-1);
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
893 gtk_editable_insert_text(GTK_EDITABLE(entry),
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
894 c->send_history->data,
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
895 strlen(c->send_history->data),
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
896 &pos);
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
897 }
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
898
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
899 break;
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
900 case GDK_Down:
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
901 if (!c->send_history)
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
902 break;
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
903 if (c->send_history->prev) {
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
904 c->send_history = c->send_history->prev;
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
905 if (c->send_history->data) {
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
906 gtk_editable_delete_text (GTK_EDITABLE(entry),0,-1);
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
907 gtk_editable_insert_text (GTK_EDITABLE(entry), c->send_history->data,
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
908 strlen(c->send_history->data), &pos);
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
909
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
910 }
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
911 }
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
912 break;
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
913 }
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
914 if (convo_options & OPT_CONVO_CTL_CHARS) {
830
60284aef22f0 [gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
915 switch (event->keyval) {
60284aef22f0 [gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
916 case 'i':
1621
cf2071b095ca [gaim-migrate @ 1631]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1617
diff changeset
917 case 'I':
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
918 quiet_set(c->italic,
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
919 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(c->italic)));
830
60284aef22f0 [gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
920 do_italic(c->italic, c->entry);
60284aef22f0 [gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
921 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
60284aef22f0 [gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
922 break;
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
923 case 'u': /* ctl-u is GDK_Clear, which clears the line */
1621
cf2071b095ca [gaim-migrate @ 1631]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1617
diff changeset
924 case 'U':
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
925 quiet_set(c->underline,
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
926 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
927 (c->underline)));
830
60284aef22f0 [gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
928 do_underline(c->underline, c->entry);
60284aef22f0 [gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
929 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
60284aef22f0 [gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
930 break;
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
931 case 'b': /* ctl-b is GDK_Left, which moves backwards */
1621
cf2071b095ca [gaim-migrate @ 1631]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1617
diff changeset
932 case 'B':
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
933 quiet_set(c->bold,
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
934 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(c->bold)));
830
60284aef22f0 [gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
935 do_bold(c->bold, c->entry);
60284aef22f0 [gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
936 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
60284aef22f0 [gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
937 break;
3159
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
938 case '-':
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
939 do_small(NULL, c->entry);
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
940 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
941 break;
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
942 case '=':
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
943 case '+':
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
944 do_big(NULL, c->entry);
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
945 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
946 break;
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
947 case '0':
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
948 do_normal(NULL, c->entry);
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
949 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
950 break;
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
951 case 'f':
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
952 case 'F':
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
953 quiet_set(c->font,
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
954 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(c->font)));
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
955 toggle_font(c->font, c);
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
956 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
957 break;
830
60284aef22f0 [gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
958 }
60284aef22f0 [gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
959 }
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
960 if (convo_options & OPT_CONVO_CTL_SMILEYS) {
830
60284aef22f0 [gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
961 char buf[7];
60284aef22f0 [gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
962 buf[0] = '\0';
60284aef22f0 [gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
963 switch (event->keyval) {
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
964 case '1':
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
965 sprintf(buf, ":-)");
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
966 break;
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
967 case '2':
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
968 sprintf(buf, ":-(");
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
969 break;
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
970 case '3':
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
971 sprintf(buf, ";-)");
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
972 break;
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
973 case '4':
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
974 sprintf(buf, ":-P");
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
975 break;
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
976 case '5':
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
977 sprintf(buf, "=-O");
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
978 break;
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
979 case '6':
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
980 sprintf(buf, ":-*");
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
981 break;
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
982 case '7':
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
983 sprintf(buf, ">:o");
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
984 break;
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
985 case '8':
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
986 sprintf(buf, "8-)");
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
987 break;
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
988 case '!':
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
989 sprintf(buf, ":-$");
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
990 break;
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
991 case '@':
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
992 sprintf(buf, ":-!");
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
993 break;
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
994 case '#':
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
995 sprintf(buf, ":-[");
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
996 break;
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
997 case '$':
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
998 sprintf(buf, "O:-)");
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
999 break;
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1000 case '%':
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1001 sprintf(buf, ":-/");
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1002 break;
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1003 case '^':
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1004 sprintf(buf, ":'(");
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1005 break;
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1006 case '&':
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1007 sprintf(buf, ":-X");
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1008 break;
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1009 case '*':
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1010 sprintf(buf, ":-D");
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1011 break;
830
60284aef22f0 [gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
1012 }
60284aef22f0 [gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
1013 if (buf[0]) {
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2722
diff changeset
1014 if (GTK_OLD_EDITABLE(c->entry)->has_selection) {
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2722
diff changeset
1015 int finish = GTK_OLD_EDITABLE(c->entry)->selection_end_pos;
830
60284aef22f0 [gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
1016 gtk_editable_insert_text(GTK_EDITABLE(c->entry),
60284aef22f0 [gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
1017 buf, strlen(buf), &finish);
60284aef22f0 [gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
1018 } else {
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2722
diff changeset
1019 pos = GTK_OLD_EDITABLE(c->entry)->current_pos;
830
60284aef22f0 [gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
1020 gtk_editable_insert_text(GTK_EDITABLE(c->entry),
60284aef22f0 [gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
1021 buf, strlen(buf), &pos);
60284aef22f0 [gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
1022 }
60284aef22f0 [gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
1023 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
60284aef22f0 [gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
1024 }
573
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 570
diff changeset
1025 }
2631
a2cf3cac7e66 [gaim-migrate @ 2644]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2625
diff changeset
1026 if (event->keyval == 'l') {
3627
639411e6a4cd [gaim-migrate @ 3750]
Luke Schierer <lschiere@pidgin.im>
parents: 3626
diff changeset
1027 key_is_typing = FALSE;
2340
b16642ac87b2 [gaim-migrate @ 2353]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2335
diff changeset
1028 gtk_imhtml_clear(GTK_IMHTML(c->text));
2631
a2cf3cac7e66 [gaim-migrate @ 2644]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2625
diff changeset
1029 g_string_free(c->history, TRUE);
a2cf3cac7e66 [gaim-migrate @ 2644]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2625
diff changeset
1030 c->history = g_string_new("");
3168
255155a1b190 [gaim-migrate @ 3184]
Sean Egan <seanegan@gmail.com>
parents: 3159
diff changeset
1031 } else if ((event->keyval == 'w') && (convo_options & OPT_CONVO_CTL_W_CLOSES)) {
3627
639411e6a4cd [gaim-migrate @ 3750]
Luke Schierer <lschiere@pidgin.im>
parents: 3626
diff changeset
1032 key_is_typing = FALSE;
3159
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
1033 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
1034 close_callback(c->close, c);
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
1035 c = NULL;
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
1036 return TRUE;
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
1037 } else if (event->keyval == 'n') {
3627
639411e6a4cd [gaim-migrate @ 3750]
Luke Schierer <lschiere@pidgin.im>
parents: 3626
diff changeset
1038 key_is_typing = FALSE;
3159
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
1039 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
1040 show_im_dialog();
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
1041 } else if (event->keyval == 'z') {
3627
639411e6a4cd [gaim-migrate @ 3750]
Luke Schierer <lschiere@pidgin.im>
parents: 3626
diff changeset
1042 key_is_typing = FALSE;
3159
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
1043 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3629
diff changeset
1044 #ifndef _WIN32
3159
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
1045 XIconifyWindow(GDK_DISPLAY(),
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
1046 GDK_WINDOW_XWINDOW(c->window->window),
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
1047 ((_XPrivDisplay)GDK_DISPLAY())->default_screen);
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3629
diff changeset
1048 #endif
2631
a2cf3cac7e66 [gaim-migrate @ 2644]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2625
diff changeset
1049 }
3159
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
1050
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
1051
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
1052 if ((!c->is_chat && (im_options & OPT_IM_ONE_WINDOW)) ||
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
1053 (c->is_chat && (chat_options & OPT_CHAT_ONE_WINDOW))) {
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1663
diff changeset
1054 GtkWidget *notebook = (c->is_chat ? chat_notebook : convo_notebook);
1595
f281f4d94973 [gaim-migrate @ 1605]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1594
diff changeset
1055 if (event->keyval == '[') {
3627
639411e6a4cd [gaim-migrate @ 3750]
Luke Schierer <lschiere@pidgin.im>
parents: 3626
diff changeset
1056 key_is_typing = FALSE;
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1663
diff changeset
1057 gtk_notebook_prev_page(GTK_NOTEBOOK(notebook));
1587
69a004b5820a [gaim-migrate @ 1597]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1583
diff changeset
1058 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
1595
f281f4d94973 [gaim-migrate @ 1605]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1594
diff changeset
1059 } else if (event->keyval == ']') {
3627
639411e6a4cd [gaim-migrate @ 3750]
Luke Schierer <lschiere@pidgin.im>
parents: 3626
diff changeset
1060 key_is_typing = FALSE;
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1663
diff changeset
1061 gtk_notebook_next_page(GTK_NOTEBOOK(notebook));
1587
69a004b5820a [gaim-migrate @ 1597]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1583
diff changeset
1062 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
1595
f281f4d94973 [gaim-migrate @ 1605]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1594
diff changeset
1063 } else if (event->keyval == GDK_Tab) {
3627
639411e6a4cd [gaim-migrate @ 3750]
Luke Schierer <lschiere@pidgin.im>
parents: 3626
diff changeset
1064 key_is_typing = FALSE;
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
1065 move_next_tab(GTK_NOTEBOOK(notebook), c->is_chat);
1587
69a004b5820a [gaim-migrate @ 1597]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1583
diff changeset
1066 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
2735
aeae739353d0 [gaim-migrate @ 2748]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2725
diff changeset
1067 return TRUE;
1587
69a004b5820a [gaim-migrate @ 1597]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1583
diff changeset
1068 }
69a004b5820a [gaim-migrate @ 1597]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1583
diff changeset
1069 }
2385
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2379
diff changeset
1070 } else if ((event->keyval == GDK_Tab) && c->is_chat && (chat_options & OPT_CHAT_TAB_COMPLETE)) {
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2379
diff changeset
1071 tab_complete(c);
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2379
diff changeset
1072 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2722
diff changeset
1073 return TRUE;
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
1074 } else if (((!c->is_chat && (im_options & OPT_IM_ONE_WINDOW)) ||
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
1075 (c->is_chat && (chat_options & OPT_CHAT_ONE_WINDOW))) &&
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2386
diff changeset
1076 (event->state & GDK_MOD1_MASK) && (event->keyval > '0') && (event->keyval <= '9')) {
3629
afc5bb164c5a [gaim-migrate @ 3752]
Luke Schierer <lschiere@pidgin.im>
parents: 3628
diff changeset
1077 GtkWidget *notebook = NULL;
3627
639411e6a4cd [gaim-migrate @ 3750]
Luke Schierer <lschiere@pidgin.im>
parents: 3626
diff changeset
1078 key_is_typing = FALSE;
3628
74ed52a818a1 [gaim-migrate @ 3751]
Luke Schierer <lschiere@pidgin.im>
parents: 3627
diff changeset
1079 notebook = (c->is_chat ? chat_notebook : convo_notebook);
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1663
diff changeset
1080 gtk_notebook_set_page(GTK_NOTEBOOK(notebook), event->keyval - '1');
1621
cf2071b095ca [gaim-migrate @ 1631]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1617
diff changeset
1081 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event");
573
9566a53cde23 [gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 570
diff changeset
1082 }
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1083
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
1084 if (c && (!(misc_options & OPT_MISC_STEALTH_TYPING)) && !c->is_chat) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
1085 char *txt = gtk_editable_get_chars(GTK_EDITABLE(c->entry), 0, -1);
3612
abb114442532 [gaim-migrate @ 3726]
Sean Egan <seanegan@gmail.com>
parents: 3597
diff changeset
1086 if (strlen(txt) == 1 && ((GTK_OLD_EDITABLE(c->entry)->current_pos == 1 && event->keyval == GDK_BackSpace) ||
abb114442532 [gaim-migrate @ 3726]
Sean Egan <seanegan@gmail.com>
parents: 3597
diff changeset
1087 (GTK_OLD_EDITABLE(c->entry)->current_pos == 0 && event->keyval == GDK_Delete))) {
abb114442532 [gaim-migrate @ 3726]
Sean Egan <seanegan@gmail.com>
parents: 3597
diff changeset
1088 if (c && c->type_again_timeout)
abb114442532 [gaim-migrate @ 3726]
Sean Egan <seanegan@gmail.com>
parents: 3597
diff changeset
1089 gtk_timeout_remove(c->type_again_timeout);
abb114442532 [gaim-migrate @ 3726]
Sean Egan <seanegan@gmail.com>
parents: 3597
diff changeset
1090 serv_send_typing(c->gc, c->name, NOT_TYPING);
abb114442532 [gaim-migrate @ 3726]
Sean Egan <seanegan@gmail.com>
parents: 3597
diff changeset
1091 } else if (GTK_OLD_EDITABLE(c->entry)->selection_start_pos == 0 && (GTK_OLD_EDITABLE(c->entry)->selection_end_pos == strlen(txt) &&
abb114442532 [gaim-migrate @ 3726]
Sean Egan <seanegan@gmail.com>
parents: 3597
diff changeset
1092 strlen(txt) > 0 && (event->keyval == GDK_BackSpace || event->keyval == GDK_Delete))) {
3596
bb966d68f9e3 [gaim-migrate @ 3698]
Mark Doliner <mark@kingant.net>
parents: 3572
diff changeset
1093 if (c && c->type_again_timeout)
bb966d68f9e3 [gaim-migrate @ 3698]
Mark Doliner <mark@kingant.net>
parents: 3572
diff changeset
1094 gtk_timeout_remove(c->type_again_timeout);
3612
abb114442532 [gaim-migrate @ 3726]
Sean Egan <seanegan@gmail.com>
parents: 3597
diff changeset
1095 serv_send_typing(c->gc, c->name, NOT_TYPING);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
1096 }
3612
abb114442532 [gaim-migrate @ 3726]
Sean Egan <seanegan@gmail.com>
parents: 3597
diff changeset
1097 else if (gdk_keyval_to_unicode(event->keyval) || event->keyval == GDK_BackSpace || event->keyval == GDK_Delete) {
3627
639411e6a4cd [gaim-migrate @ 3750]
Luke Schierer <lschiere@pidgin.im>
parents: 3626
diff changeset
1098 if (key_is_typing && (strlen(txt) == 0 || (c->type_again != 0 && time(NULL) > c->type_again))) {
3612
abb114442532 [gaim-migrate @ 3726]
Sean Egan <seanegan@gmail.com>
parents: 3597
diff changeset
1099 int timeout = serv_send_typing(c->gc, c->name, TYPING);
abb114442532 [gaim-migrate @ 3726]
Sean Egan <seanegan@gmail.com>
parents: 3597
diff changeset
1100 if (timeout)
abb114442532 [gaim-migrate @ 3726]
Sean Egan <seanegan@gmail.com>
parents: 3597
diff changeset
1101 c->type_again = time(NULL) + timeout;
abb114442532 [gaim-migrate @ 3726]
Sean Egan <seanegan@gmail.com>
parents: 3597
diff changeset
1102 else
abb114442532 [gaim-migrate @ 3726]
Sean Egan <seanegan@gmail.com>
parents: 3597
diff changeset
1103 c->type_again = 0;
3596
bb966d68f9e3 [gaim-migrate @ 3698]
Mark Doliner <mark@kingant.net>
parents: 3572
diff changeset
1104 }
3612
abb114442532 [gaim-migrate @ 3726]
Sean Egan <seanegan@gmail.com>
parents: 3597
diff changeset
1105 if (c->type_again_timeout)
abb114442532 [gaim-migrate @ 3726]
Sean Egan <seanegan@gmail.com>
parents: 3597
diff changeset
1106 gtk_timeout_remove(c->type_again_timeout);
abb114442532 [gaim-migrate @ 3726]
Sean Egan <seanegan@gmail.com>
parents: 3597
diff changeset
1107 c->type_again_timeout = gtk_timeout_add(SEND_TYPED_TIMEOUT, send_typed, (gpointer)c);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
1108 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
1109 g_free(txt);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
1110 }
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2722
diff changeset
1111 return FALSE;
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1112 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1113
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1114
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
1115 void send_callback(GtkWidget *widget, struct conversation *c)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1116 {
2102
899c22dcee42 [gaim-migrate @ 2112]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2094
diff changeset
1117 char *buf, *buf2;
3044
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1118 int limit;
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1119 gulong length=0;
2123
56c4382f2909 [gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2111
diff changeset
1120 int err = 0;
3122
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
1121 GList *first;
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1122
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1123 if (!c->gc)
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1124 return;
1100
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1078
diff changeset
1125
3035
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 3033
diff changeset
1126
1100
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1078
diff changeset
1127 buf2 = gtk_editable_get_chars(GTK_EDITABLE(c->entry), 0, -1);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
1128 limit = 32 * 1024; /* you shouldn't be sending more than 32k in your messages. that's a book. */
738
97c7b2f61cb5 [gaim-migrate @ 748]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 700
diff changeset
1129 buf = g_malloc(limit);
97c7b2f61cb5 [gaim-migrate @ 748]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 700
diff changeset
1130 g_snprintf(buf, limit, "%s", buf2);
753
cd62f69d187e [gaim-migrate @ 763]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 745
diff changeset
1131 g_free(buf2);
796
4783a3b6859d [gaim-migrate @ 806]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 795
diff changeset
1132 if (!strlen(buf)) {
4783a3b6859d [gaim-migrate @ 806]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 795
diff changeset
1133 g_free(buf);
4783a3b6859d [gaim-migrate @ 806]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 795
diff changeset
1134 return;
4783a3b6859d [gaim-migrate @ 806]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 795
diff changeset
1135 }
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
1136
3122
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
1137 first = g_list_first(c->send_history);
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
1138 if (first->data)
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
1139 g_free(first->data);
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
1140 first->data = g_strdup(buf);
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
1141 c->send_history = g_list_prepend(first, NULL);
4d967ccd797b [gaim-migrate @ 3137]
Sean Egan <seanegan@gmail.com>
parents: 3097
diff changeset
1142
738
97c7b2f61cb5 [gaim-migrate @ 748]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 700
diff changeset
1143 buf2 = g_malloc(limit);
97c7b2f61cb5 [gaim-migrate @ 748]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 700
diff changeset
1144
2706
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2699
diff changeset
1145 if (c->gc->flags & OPT_CONN_HTML) {
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
1146 if (convo_options & OPT_CONVO_SEND_LINKS)
1889
c81f3dd0e58e [gaim-migrate @ 1899]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1881
diff changeset
1147 linkify_text(buf);
c81f3dd0e58e [gaim-migrate @ 1899]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1881
diff changeset
1148
1370
776bb4c6c0b8 [gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1352
diff changeset
1149 if (font_options & OPT_FONT_BOLD) {
776bb4c6c0b8 [gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1352
diff changeset
1150 g_snprintf(buf2, limit, "<B>%s</B>", buf);
776bb4c6c0b8 [gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1352
diff changeset
1151 strcpy(buf, buf2);
776bb4c6c0b8 [gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1352
diff changeset
1152 }
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1153
1370
776bb4c6c0b8 [gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1352
diff changeset
1154 if (font_options & OPT_FONT_ITALIC) {
776bb4c6c0b8 [gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1352
diff changeset
1155 g_snprintf(buf2, limit, "<I>%s</I>", buf);
776bb4c6c0b8 [gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1352
diff changeset
1156 strcpy(buf, buf2);
776bb4c6c0b8 [gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1352
diff changeset
1157 }
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1158
1370
776bb4c6c0b8 [gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1352
diff changeset
1159 if (font_options & OPT_FONT_UNDERLINE) {
776bb4c6c0b8 [gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1352
diff changeset
1160 g_snprintf(buf2, limit, "<U>%s</U>", buf);
776bb4c6c0b8 [gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1352
diff changeset
1161 strcpy(buf, buf2);
776bb4c6c0b8 [gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1352
diff changeset
1162 }
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1163
1370
776bb4c6c0b8 [gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1352
diff changeset
1164 if (font_options & OPT_FONT_STRIKE) {
776bb4c6c0b8 [gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1352
diff changeset
1165 g_snprintf(buf2, limit, "<STRIKE>%s</STRIKE>", buf);
776bb4c6c0b8 [gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1352
diff changeset
1166 strcpy(buf, buf2);
776bb4c6c0b8 [gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1352
diff changeset
1167 }
101
a9aa982272f9 [gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 88
diff changeset
1168
1370
776bb4c6c0b8 [gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1352
diff changeset
1169 if ((font_options & OPT_FONT_FACE) || c->hasfont) {
776bb4c6c0b8 [gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1352
diff changeset
1170 g_snprintf(buf2, limit, "<FONT FACE=\"%s\">%s</FONT>", c->fontface, buf);
776bb4c6c0b8 [gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1352
diff changeset
1171 strcpy(buf, buf2);
776bb4c6c0b8 [gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1352
diff changeset
1172 }
488
0fcb7e7a263c [gaim-migrate @ 498]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 474
diff changeset
1173
2699
092c5a1ddf72 [gaim-migrate @ 2712]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2681
diff changeset
1174 if (font_options & OPT_FONT_SIZE) {
092c5a1ddf72 [gaim-migrate @ 2712]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2681
diff changeset
1175 g_snprintf(buf2, limit, "<FONT SIZE=\"%d\">%s</FONT>", fontsize, buf);
1441
5c67b8794991 [gaim-migrate @ 1451]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1440
diff changeset
1176 strcpy(buf, buf2);
5c67b8794991 [gaim-migrate @ 1451]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1440
diff changeset
1177 }
5c67b8794991 [gaim-migrate @ 1451]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1440
diff changeset
1178
1370
776bb4c6c0b8 [gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1352
diff changeset
1179 if ((font_options & OPT_FONT_FGCOL) || c->hasfg) {
776bb4c6c0b8 [gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1352
diff changeset
1180 g_snprintf(buf2, limit, "<FONT COLOR=\"#%02X%02X%02X\">%s</FONT>", c->fgcol.red,
776bb4c6c0b8 [gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1352
diff changeset
1181 c->fgcol.green, c->fgcol.blue, buf);
776bb4c6c0b8 [gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1352
diff changeset
1182 strcpy(buf, buf2);
776bb4c6c0b8 [gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1352
diff changeset
1183 }
666
71ea550c22ac [gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 661
diff changeset
1184
1370
776bb4c6c0b8 [gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1352
diff changeset
1185 if ((font_options & OPT_FONT_BGCOL) || c->hasbg) {
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
1186 g_snprintf(buf2, limit, "<BODY BGCOLOR=\"#%02X%02X%02X\">%s</BODY>",
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
1187 c->bgcol.red, c->bgcol.green, c->bgcol.blue, buf);
1370
776bb4c6c0b8 [gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1352
diff changeset
1188 strcpy(buf, buf2);
776bb4c6c0b8 [gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1352
diff changeset
1189 }
666
71ea550c22ac [gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 661
diff changeset
1190 }
71ea550c22ac [gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 661
diff changeset
1191
1881
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1872
diff changeset
1192 quiet_set(c->bold, FALSE);
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1872
diff changeset
1193 quiet_set(c->italic, FALSE);
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1872
diff changeset
1194 quiet_set(c->underline, FALSE);
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1872
diff changeset
1195 quiet_set(c->font, FALSE);
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1872
diff changeset
1196 quiet_set(c->fgcolorbtn, FALSE);
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1872
diff changeset
1197 quiet_set(c->bgcolorbtn, FALSE);
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1872
diff changeset
1198 quiet_set(c->link, FALSE);
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1872
diff changeset
1199 gtk_widget_grab_focus(c->entry);
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1872
diff changeset
1200
101
a9aa982272f9 [gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 88
diff changeset
1201 {
391
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 389
diff changeset
1202 char *buffy = g_strdup(buf);
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
1203 enum gaim_event evnt = c->is_chat ? event_chat_send : event_im_send;
2345
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2340
diff changeset
1204 int plugin_return = plugin_event(evnt, c->gc,
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
1205 c->is_chat ? (void *)c->id : c->name,
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3506
diff changeset
1206 &buffy);
391
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 389
diff changeset
1207 if (!buffy) {
102
8c301530b2a3 [gaim-migrate @ 112]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
1208 g_free(buf2);
796
4783a3b6859d [gaim-migrate @ 806]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 795
diff changeset
1209 g_free(buf);
102
8c301530b2a3 [gaim-migrate @ 112]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
1210 return;
8c301530b2a3 [gaim-migrate @ 112]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
1211 }
1100
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1078
diff changeset
1212 if (plugin_return) {
2139
a14e8459c233 [gaim-migrate @ 2149]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2138
diff changeset
1213 gtk_editable_delete_text(GTK_EDITABLE(c->entry), 0, -1);
1100
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1078
diff changeset
1214 g_free(buffy);
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1078
diff changeset
1215 g_free(buf2);
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1078
diff changeset
1216 g_free(buf);
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1078
diff changeset
1217 return;
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1078
diff changeset
1218 }
738
97c7b2f61cb5 [gaim-migrate @ 748]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 700
diff changeset
1219 g_snprintf(buf, limit, "%s", buffy);
391
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 389
diff changeset
1220 g_free(buffy);
101
a9aa982272f9 [gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 88
diff changeset
1221 }
3048
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
1222
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
1223 if (!c->is_chat) {
2102
899c22dcee42 [gaim-migrate @ 2112]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2094
diff changeset
1224 char *buffy;
3048
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
1225 gboolean binary = FALSE;
2102
899c22dcee42 [gaim-migrate @ 2112]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2094
diff changeset
1226
899c22dcee42 [gaim-migrate @ 2112]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2094
diff changeset
1227 buffy = g_strdup(buf);
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3506
diff changeset
1228 plugin_event(event_im_displayed_sent, c->gc, c->name, &buffy);
2102
899c22dcee42 [gaim-migrate @ 2112]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2094
diff changeset
1229 if (buffy) {
2231
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
1230 int imflags = 0;
2239
b7ff2ca1d653 [gaim-migrate @ 2249]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2231
diff changeset
1231 if (c->check && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(c->check)))
2231
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
1232 imflags = IM_FLAG_CHECKBOX;
3048
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
1233
3033
1143524a2eaf [gaim-migrate @ 3046]
Sean Egan <seanegan@gmail.com>
parents: 3022
diff changeset
1234 if (c->images) {
3159
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
1235 int id = 0, offset = 0;
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3129
diff changeset
1236 char *bigbuf = NULL;
3033
1143524a2eaf [gaim-migrate @ 3046]
Sean Egan <seanegan@gmail.com>
parents: 3022
diff changeset
1237 GSList *tmplist = c->images;
1143524a2eaf [gaim-migrate @ 3046]
Sean Egan <seanegan@gmail.com>
parents: 3022
diff changeset
1238 id = 1;
3048
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
1239
3033
1143524a2eaf [gaim-migrate @ 3046]
Sean Egan <seanegan@gmail.com>
parents: 3022
diff changeset
1240 while (tmplist) {
3044
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1241 FILE *imgfile;
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1242 char *filename;
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1243 struct stat st;
3033
1143524a2eaf [gaim-migrate @ 3046]
Sean Egan <seanegan@gmail.com>
parents: 3022
diff changeset
1244 char imgtag[1024];
3048
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
1245
3033
1143524a2eaf [gaim-migrate @ 3046]
Sean Egan <seanegan@gmail.com>
parents: 3022
diff changeset
1246 if (stat(tmplist->data, &st) != 0) {
1143524a2eaf [gaim-migrate @ 3046]
Sean Egan <seanegan@gmail.com>
parents: 3022
diff changeset
1247 debug_printf("Could not stat %s\n", tmplist->data);
3048
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
1248 tmplist = tmplist->next;
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
1249 continue;
3033
1143524a2eaf [gaim-migrate @ 3046]
Sean Egan <seanegan@gmail.com>
parents: 3022
diff changeset
1250 }
3044
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1251
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1252 /* Here we check to make sure the user still wants to send the
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1253 * image. He may have deleted the <img> tag in which case we
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1254 * don't want to send the binary data. */
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1255 filename = tmplist->data;
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1256 while (strchr(filename, '/'))
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1257 filename = strchr(filename, '/') + 1;
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1258 g_snprintf(imgtag, sizeof(imgtag),
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1259 "<IMG SRC=\"file://%s\" ID=\"%d\" DATASIZE=\"%d\">",
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1260 filename, id, (int)st.st_size);
3048
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
1261
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
1262 if (strstr(buffy, imgtag) == 0) {
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
1263 debug_printf("Not sending image: %s\n", tmplist->data);
3044
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1264 tmplist = tmplist->next;
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1265 continue;
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1266 }
3048
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
1267 if (!binary) {
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
1268 length = strlen(buffy) + strlen("<BINARY></BINARY>");
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
1269 bigbuf = g_malloc(length + 1);
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
1270 g_snprintf(bigbuf, strlen(buffy) + strlen("<BINARY> ") + 1,
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
1271 "%s<BINARY>", buffy);
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
1272 offset = strlen(buffy) + strlen("<BINARY>");
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
1273 binary = TRUE;
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
1274 }
3033
1143524a2eaf [gaim-migrate @ 3046]
Sean Egan <seanegan@gmail.com>
parents: 3022
diff changeset
1275 g_snprintf(imgtag, sizeof(imgtag),
1143524a2eaf [gaim-migrate @ 3046]
Sean Egan <seanegan@gmail.com>
parents: 3022
diff changeset
1276 "<DATA ID=\"%d\" SIZE=\"%d\">",
3044
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1277 id, (int)st.st_size);
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1278
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1279 length = length + strlen(imgtag) + st.st_size + strlen("</DATA>");;
3048
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
1280 bigbuf = g_realloc(bigbuf, length + 1);
3044
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1281 if (!(imgfile = fopen(tmplist->data, "r"))) {
3033
1143524a2eaf [gaim-migrate @ 3046]
Sean Egan <seanegan@gmail.com>
parents: 3022
diff changeset
1282 debug_printf("Could not open %s\n", tmplist->data);
3048
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
1283 tmplist = tmplist->next;
3044
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1284 continue;
3033
1143524a2eaf [gaim-migrate @ 3046]
Sean Egan <seanegan@gmail.com>
parents: 3022
diff changeset
1285 }
1143524a2eaf [gaim-migrate @ 3046]
Sean Egan <seanegan@gmail.com>
parents: 3022
diff changeset
1286 g_snprintf(bigbuf + offset, strlen(imgtag) + 1, "%s", imgtag);
1143524a2eaf [gaim-migrate @ 3046]
Sean Egan <seanegan@gmail.com>
parents: 3022
diff changeset
1287 offset = offset + strlen(imgtag);
3044
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1288 offset = offset + fread(bigbuf + offset, 1, st.st_size, imgfile);
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1289 fclose(imgfile);
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1290 g_snprintf(bigbuf + offset, strlen("</DATA>") + 1, "</DATA>");
3033
1143524a2eaf [gaim-migrate @ 3046]
Sean Egan <seanegan@gmail.com>
parents: 3022
diff changeset
1291 offset= offset + strlen("</DATA>");
1143524a2eaf [gaim-migrate @ 3046]
Sean Egan <seanegan@gmail.com>
parents: 3022
diff changeset
1292 id++;
1143524a2eaf [gaim-migrate @ 3046]
Sean Egan <seanegan@gmail.com>
parents: 3022
diff changeset
1293 tmplist = tmplist->next;
1143524a2eaf [gaim-migrate @ 3046]
Sean Egan <seanegan@gmail.com>
parents: 3022
diff changeset
1294 }
3048
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
1295 if (binary) {
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
1296 g_snprintf(bigbuf + offset, strlen("</BINARY>") + 1, "</BINARY>");
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
1297 err =serv_send_im(c->gc, c->name, bigbuf, length, imflags);
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
1298 } else {
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
1299 err = serv_send_im(c->gc, c->name, buffy, -1, imflags);
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
1300 }
3044
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1301 if (err > 0) {
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1302 GSList *tempy = c->images;
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1303 while (tempy) {
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1304 g_free(tempy->data);
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1305 tempy = tempy->next;
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1306 }
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1307 g_slist_free(tempy);
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1308 c->images = NULL;
3048
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
1309 if (binary)
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
1310 write_to_conv(c, bigbuf, WFLAG_SEND, NULL, time(NULL), length);
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
1311 else
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
1312 write_to_conv(c, buffy, WFLAG_SEND, NULL, time(NULL), -1);
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 3056
diff changeset
1313 if (c->makesound)
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 3056
diff changeset
1314 play_sound(SND_SEND);
3033
1143524a2eaf [gaim-migrate @ 3046]
Sean Egan <seanegan@gmail.com>
parents: 3022
diff changeset
1315 if (im_options & OPT_IM_POPDOWN)
1143524a2eaf [gaim-migrate @ 3046]
Sean Egan <seanegan@gmail.com>
parents: 3022
diff changeset
1316 gtk_widget_hide(c->window);
1143524a2eaf [gaim-migrate @ 3046]
Sean Egan <seanegan@gmail.com>
parents: 3022
diff changeset
1317
3044
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1318
3033
1143524a2eaf [gaim-migrate @ 3046]
Sean Egan <seanegan@gmail.com>
parents: 3022
diff changeset
1319 }
3048
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
1320 if (binary)
e729c064bc1b [gaim-migrate @ 3061]
Sean Egan <seanegan@gmail.com>
parents: 3044
diff changeset
1321 g_free(bigbuf);
3033
1143524a2eaf [gaim-migrate @ 3046]
Sean Egan <seanegan@gmail.com>
parents: 3022
diff changeset
1322 } else {
3044
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1323 err =serv_send_im(c->gc, c->name, buffy, -1, imflags);
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1324 if (err > 0) {
3033
1143524a2eaf [gaim-migrate @ 3046]
Sean Egan <seanegan@gmail.com>
parents: 3022
diff changeset
1325 write_to_conv(c, buf, WFLAG_SEND, NULL, time(NULL), -1);
3060
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 3056
diff changeset
1326 if (c->makesound)
4f2f12bf4408 [gaim-migrate @ 3074]
Sean Egan <seanegan@gmail.com>
parents: 3056
diff changeset
1327 play_sound(SND_SEND);
3044
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1328 if (im_options & OPT_IM_POPDOWN)
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1329 gtk_widget_hide(c->window);
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1330 }
3033
1143524a2eaf [gaim-migrate @ 3046]
Sean Egan <seanegan@gmail.com>
parents: 3022
diff changeset
1331 }
2102
899c22dcee42 [gaim-migrate @ 2112]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2094
diff changeset
1332 g_free(buffy);
899c22dcee42 [gaim-migrate @ 2112]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2094
diff changeset
1333 }
3033
1143524a2eaf [gaim-migrate @ 3046]
Sean Egan <seanegan@gmail.com>
parents: 3022
diff changeset
1334
502
4d1e39112cbd [gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 494
diff changeset
1335 } else {
2167
edf8c5a70e5b [gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2160
diff changeset
1336 err = serv_chat_send(c->gc, c->id, buf);
502
4d1e39112cbd [gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 494
diff changeset
1337
4d1e39112cbd [gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 494
diff changeset
1338 /* no sound because we do that when we receive our message */
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
1339 }
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1340
2123
56c4382f2909 [gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2111
diff changeset
1341 g_free(buf2);
56c4382f2909 [gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2111
diff changeset
1342 g_free(buf);
56c4382f2909 [gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2111
diff changeset
1343
56c4382f2909 [gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2111
diff changeset
1344 if (err < 0) {
56c4382f2909 [gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2111
diff changeset
1345 if (err == -E2BIG)
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3384
diff changeset
1346 do_error_dialog(_("Unable to send message. The message is too large"), NULL, GAIM_ERROR);
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3629
diff changeset
1347 #ifndef _WIN32
3044
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1348 else if (err == -ENOTCONN)
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
1349 debug_printf("Not yet connected\n");
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3629
diff changeset
1350 #else
3641
e2391338c394 [gaim-migrate @ 3765]
Luke Schierer <lschiere@pidgin.im>
parents: 3630
diff changeset
1351 else if (err == SOCKET_ERROR) {
e2391338c394 [gaim-migrate @ 3765]
Luke Schierer <lschiere@pidgin.im>
parents: 3630
diff changeset
1352 if (WSAENOTCONN == WSAGetLastError())
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3629
diff changeset
1353 debug_printf("Not yet connected\n");
3641
e2391338c394 [gaim-migrate @ 3765]
Luke Schierer <lschiere@pidgin.im>
parents: 3630
diff changeset
1354 }
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3629
diff changeset
1355 #endif
2123
56c4382f2909 [gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2111
diff changeset
1356 else
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3384
diff changeset
1357 do_error_dialog(_("Unable to send message"), NULL, GAIM_ERROR);
2832
e0eeda0a9ab9 [gaim-migrate @ 2845]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2831
diff changeset
1358 } else {
2123
56c4382f2909 [gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2111
diff changeset
1359 gtk_editable_delete_text(GTK_EDITABLE(c->entry), 0, -1);
56c4382f2909 [gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2111
diff changeset
1360
2832
e0eeda0a9ab9 [gaim-migrate @ 2845]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2831
diff changeset
1361 if ((err > 0) && (away_options & OPT_AWAY_BACK_ON_IM)) {
2123
56c4382f2909 [gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2111
diff changeset
1362 if (awaymessage != NULL) {
56c4382f2909 [gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2111
diff changeset
1363 do_im_back();
56c4382f2909 [gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2111
diff changeset
1364 } else if (c->gc->away) {
56c4382f2909 [gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2111
diff changeset
1365 serv_set_away(c->gc, GAIM_AWAY_CUSTOM, NULL);
56c4382f2909 [gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2111
diff changeset
1366 }
1403
c0aa7fdc0a93 [gaim-migrate @ 1413]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1401
diff changeset
1367 }
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1368 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1369 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1370
907
08d5037c9296 [gaim-migrate @ 917]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 905
diff changeset
1371 int entry_key_pressed(GtkWidget *w, GtkWidget *entry)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1372 {
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1373 check_everything(w);
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2722
diff changeset
1374 return FALSE;
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1375 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1376
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1377 /*------------------------------------------------------------------------*/
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1378 /* HTML-type stuff */
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1379 /*------------------------------------------------------------------------*/
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1380
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1381 int count_tag(GtkWidget *entry, char *s1, char *s2)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1382 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1383 char *p1, *p2;
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1384 int res = 0;
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1385 char *tmp, *tmpo, h;
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1386 tmpo = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1);
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2722
diff changeset
1387 h = tmpo[GTK_OLD_EDITABLE(entry)->current_pos];
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2722
diff changeset
1388 tmpo[GTK_OLD_EDITABLE(entry)->current_pos] = '\0';
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1389 tmp = tmpo;
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1390 do {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1391 p1 = strstr(tmp, s1);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1392 p2 = strstr(tmp, s2);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1393 if (p1 && p2) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1394 if (p1 < p2) {
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1395 res = 1;
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1396 tmp = p1 + strlen(s1);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1397 } else if (p2 < p1) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1398 res = 0;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1399 tmp = p2 + strlen(s2);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1400 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1401 } else {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1402 if (p1) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1403 res = 1;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1404 tmp = p1 + strlen(s1);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1405 } else if (p2) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1406 res = 0;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1407 tmp = p2 + strlen(s2);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1408 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1409 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1410 } while (p1 || p2);
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2722
diff changeset
1411 tmpo[GTK_OLD_EDITABLE(entry)->current_pos] = h;
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1412 g_free(tmpo);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1413 return res;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1414 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1415
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1416
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1417 int invert_tags(GtkWidget *entry, char *s1, char *s2, int really)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1418 {
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2722
diff changeset
1419 int start = GTK_OLD_EDITABLE(entry)->selection_start_pos;
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2722
diff changeset
1420 int finish = GTK_OLD_EDITABLE(entry)->selection_end_pos;
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1421 char *s;
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1422
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1423 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1);
2048
3366311426df [gaim-migrate @ 2058]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2017
diff changeset
1424 if (!g_strncasecmp(&s[start], s1, strlen(s1)) &&
3366311426df [gaim-migrate @ 2058]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2017
diff changeset
1425 !g_strncasecmp(&s[finish - strlen(s2)], s2, strlen(s2))) {
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1426 if (really) {
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1427 gtk_editable_delete_text(GTK_EDITABLE(entry), start, start + strlen(s1));
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1428 gtk_editable_delete_text(GTK_EDITABLE(entry), finish - strlen(s2) - strlen(s1),
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1429 finish - strlen(s1));
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1430 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1431 g_free(s);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1432 return 1;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1433 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1434 g_free(s);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1435 return 0;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1436 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1437
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1438
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1439 void remove_tags(GtkWidget *entry, char *tag)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1440 {
275
f9eb3eb9ffde [gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 234
diff changeset
1441 char *s, *t;
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2722
diff changeset
1442 int start = GTK_OLD_EDITABLE(entry)->selection_start_pos;
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2722
diff changeset
1443 int finish = GTK_OLD_EDITABLE(entry)->selection_end_pos;
275
f9eb3eb9ffde [gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 234
diff changeset
1444 int temp;
f9eb3eb9ffde [gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 234
diff changeset
1445 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1446 t = s;
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1447
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1448 if (start > finish) {
275
f9eb3eb9ffde [gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 234
diff changeset
1449 temp = start;
f9eb3eb9ffde [gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 234
diff changeset
1450 start = finish;
f9eb3eb9ffde [gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 234
diff changeset
1451 finish = temp;
f9eb3eb9ffde [gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 234
diff changeset
1452 }
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1453
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1454 if (strstr(tag, "<FONT SIZE=")) {
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1455 while ((t = strstr(t, "<FONT SIZE="))) {
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1456 if (((t - s) < finish) && ((t - s) >= start)) {
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1457 gtk_editable_delete_text(GTK_EDITABLE(entry), (t - s),
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1458 (t - s) + strlen(tag));
846
4b05985bae5e [gaim-migrate @ 856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 843
diff changeset
1459 g_free(s);
230
83dd297aa363 [gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 210
diff changeset
1460 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1);
83dd297aa363 [gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 210
diff changeset
1461 t = s;
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1462 } else
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1463 t++;
68
03ec647d24e9 [gaim-migrate @ 78]
Rob Flynn <gaim@robflynn.com>
parents: 67
diff changeset
1464 }
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1465 } else {
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1466 while ((t = strstr(t, tag))) {
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1467 if (((t - s) < finish) && ((t - s) >= start)) {
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1468 gtk_editable_delete_text(GTK_EDITABLE(entry), (t - s),
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1469 (t - s) + strlen(tag));
846
4b05985bae5e [gaim-migrate @ 856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 843
diff changeset
1470 g_free(s);
230
83dd297aa363 [gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 210
diff changeset
1471 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1);
83dd297aa363 [gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 210
diff changeset
1472 t = s;
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1473 } else
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1474 t++;
230
83dd297aa363 [gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 210
diff changeset
1475 }
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1476 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1477 g_free(s);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1478 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1479
1440
6330d0bb309f [gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1439
diff changeset
1480 static char *html_logize(char *p)
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1481 {
1103
7aabbbaae829 [gaim-migrate @ 1113]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
1482
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1483 char *temp_p = p;
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1484 char *buffer_p;
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1485 char *buffer_start;
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1486 int num_cr = 0;
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1487 int char_len = 0;
1103
7aabbbaae829 [gaim-migrate @ 1113]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
1488
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1489 while (*temp_p != '\0') {
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1490 char_len++;
1440
6330d0bb309f [gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1439
diff changeset
1491 if ((*temp_p == '\n') || ((*temp_p == '<') && (*(temp_p + 1) == '!')))
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1492 num_cr++;
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1493 ++temp_p;
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1494 }
1103
7aabbbaae829 [gaim-migrate @ 1113]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
1495
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1496 temp_p = p;
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1497 buffer_p = g_malloc(char_len + (4 * num_cr) + 1);
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1498 buffer_start = buffer_p;
1103
7aabbbaae829 [gaim-migrate @ 1113]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
1499
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1500 while (*temp_p != '\0') {
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1501 if (*temp_p == '\n') {
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1502 *buffer_p++ = '<';
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1503 *buffer_p++ = 'B';
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1504 *buffer_p++ = 'R';
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1505 *buffer_p++ = '>';
1440
6330d0bb309f [gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1439
diff changeset
1506 *buffer_p++ = '\n';
6330d0bb309f [gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1439
diff changeset
1507 } else if ((*temp_p == '<') && (*(temp_p + 1) == '!')) {
6330d0bb309f [gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1439
diff changeset
1508 *buffer_p++ = '&';
2994
60018f862a51 [gaim-migrate @ 3007]
Sean Egan <seanegan@gmail.com>
parents: 2993
diff changeset
1509 *buffer_p++ = 'l';
1440
6330d0bb309f [gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1439
diff changeset
1510 *buffer_p++ = 't';
6330d0bb309f [gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1439
diff changeset
1511 *buffer_p++ = ';';
6330d0bb309f [gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1439
diff changeset
1512 } else
6330d0bb309f [gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1439
diff changeset
1513 *buffer_p++ = *temp_p;
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1514 ++temp_p;
1103
7aabbbaae829 [gaim-migrate @ 1113]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
1515 }
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1516 *buffer_p = '\0';
1103
7aabbbaae829 [gaim-migrate @ 1113]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
1517
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1518 return buffer_start;
1103
7aabbbaae829 [gaim-migrate @ 1113]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
1519 }
7aabbbaae829 [gaim-migrate @ 1113]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
1520
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1521 void surround(GtkWidget *entry, char *pre, char *post)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1522 {
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2722
diff changeset
1523 int temp, pos = GTK_OLD_EDITABLE(entry)->current_pos;
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1524 int dummy;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1525 int start, finish;
1133
0dc7c7b4f8ca [gaim-migrate @ 1143]
Rob Flynn <gaim@robflynn.com>
parents: 1117
diff changeset
1526
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
1527 if (convo_options & OPT_CONVO_CHECK_SPELLING) {
1133
0dc7c7b4f8ca [gaim-migrate @ 1143]
Rob Flynn <gaim@robflynn.com>
parents: 1117
diff changeset
1528 gtkspell_detach(GTK_TEXT(entry));
0dc7c7b4f8ca [gaim-migrate @ 1143]
Rob Flynn <gaim@robflynn.com>
parents: 1117
diff changeset
1529 }
0dc7c7b4f8ca [gaim-migrate @ 1143]
Rob Flynn <gaim@robflynn.com>
parents: 1117
diff changeset
1530
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2722
diff changeset
1531 if (GTK_OLD_EDITABLE(entry)->has_selection) {
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1532 remove_tags(entry, pre);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1533 remove_tags(entry, post);
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2722
diff changeset
1534 start = GTK_OLD_EDITABLE(entry)->selection_start_pos;
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2722
diff changeset
1535 finish = GTK_OLD_EDITABLE(entry)->selection_end_pos;
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1536 if (start > finish) {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1537 dummy = finish;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1538 finish = start;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1539 start = dummy;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1540 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1541 dummy = start;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1542 gtk_editable_insert_text(GTK_EDITABLE(entry), pre, strlen(pre), &dummy);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1543 dummy = finish + strlen(pre);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1544 gtk_editable_insert_text(GTK_EDITABLE(entry), post, strlen(post), &dummy);
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1545 gtk_editable_select_region(GTK_EDITABLE(entry), start,
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1546 finish + strlen(pre) + strlen(post));
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1547 } else {
649
779c04b844f4 [gaim-migrate @ 659]
Todd Kulesza <fflewddur>
parents: 648
diff changeset
1548 temp = pos;
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1549 gtk_editable_insert_text(GTK_EDITABLE(entry), pre, strlen(pre), &pos);
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1550 if (temp == pos) {
649
779c04b844f4 [gaim-migrate @ 659]
Todd Kulesza <fflewddur>
parents: 648
diff changeset
1551 dummy = pos + strlen(pre);
779c04b844f4 [gaim-migrate @ 659]
Todd Kulesza <fflewddur>
parents: 648
diff changeset
1552 gtk_editable_insert_text(GTK_EDITABLE(entry), post, strlen(post), &dummy);
779c04b844f4 [gaim-migrate @ 659]
Todd Kulesza <fflewddur>
parents: 648
diff changeset
1553 gtk_editable_set_position(GTK_EDITABLE(entry), dummy);
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1554 } else {
649
779c04b844f4 [gaim-migrate @ 659]
Todd Kulesza <fflewddur>
parents: 648
diff changeset
1555 dummy = pos;
779c04b844f4 [gaim-migrate @ 659]
Todd Kulesza <fflewddur>
parents: 648
diff changeset
1556 gtk_editable_insert_text(GTK_EDITABLE(entry), post, strlen(post), &dummy);
779c04b844f4 [gaim-migrate @ 659]
Todd Kulesza <fflewddur>
parents: 648
diff changeset
1557 gtk_editable_set_position(GTK_EDITABLE(entry), pos);
779c04b844f4 [gaim-migrate @ 659]
Todd Kulesza <fflewddur>
parents: 648
diff changeset
1558 }
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1559 }
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1560
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
1561 if (convo_options & OPT_CONVO_CHECK_SPELLING) {
1133
0dc7c7b4f8ca [gaim-migrate @ 1143]
Rob Flynn <gaim@robflynn.com>
parents: 1117
diff changeset
1562 gtkspell_attach(GTK_TEXT(entry));
0dc7c7b4f8ca [gaim-migrate @ 1143]
Rob Flynn <gaim@robflynn.com>
parents: 1117
diff changeset
1563 }
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1564
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1565 gtk_widget_grab_focus(entry);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1566 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1567
344
2434adbb8703 [gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 337
diff changeset
1568 void advance_past(GtkWidget *entry, char *pre, char *post)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1569 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1570 char *s, *s2;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1571 int pos;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1572 if (invert_tags(entry, pre, post, 1))
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1573 return;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1574 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1);
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2722
diff changeset
1575 pos = GTK_OLD_EDITABLE(entry)->current_pos;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1244
diff changeset
1576 debug_printf(_("Currently at %d, "), pos);
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1577 s2 = strstr(&s[pos], post);
523
023c3851db0a [gaim-migrate @ 533]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 520
diff changeset
1578 if (s2) {
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1579 pos = s2 - s + strlen(post);
523
023c3851db0a [gaim-migrate @ 533]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 520
diff changeset
1580 } else {
023c3851db0a [gaim-migrate @ 533]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 520
diff changeset
1581 gtk_editable_insert_text(GTK_EDITABLE(entry), post, strlen(post), &pos);
023c3851db0a [gaim-migrate @ 533]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 520
diff changeset
1582 }
846
4b05985bae5e [gaim-migrate @ 856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 843
diff changeset
1583 g_free(s);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1244
diff changeset
1584 debug_printf(_("Setting position to %d\n"), pos);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1585 gtk_editable_set_position(GTK_EDITABLE(entry), pos);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1586 gtk_widget_grab_focus(entry);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1587 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1588
858
3de6e98e8898 [gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 856
diff changeset
1589 void toggle_fg_color(GtkWidget *color, struct conversation *c)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1590 {
311
0a8b4edc4732 [gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 309
diff changeset
1591 if (state_lock)
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1592 return;
311
0a8b4edc4732 [gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 309
diff changeset
1593 if (GTK_TOGGLE_BUTTON(color)->active)
858
3de6e98e8898 [gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 856
diff changeset
1594 show_fgcolor_dialog(c, color);
3de6e98e8898 [gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 856
diff changeset
1595 else if (c->fg_color_dialog)
3de6e98e8898 [gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 856
diff changeset
1596 cancel_fgcolor(color, c);
3de6e98e8898 [gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 856
diff changeset
1597 else
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1598 advance_past(c->entry, "<FONT COLOR>", "</FONT>");
858
3de6e98e8898 [gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 856
diff changeset
1599 }
3de6e98e8898 [gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 856
diff changeset
1600
3de6e98e8898 [gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 856
diff changeset
1601 void toggle_bg_color(GtkWidget *color, struct conversation *c)
3de6e98e8898 [gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 856
diff changeset
1602 {
3de6e98e8898 [gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 856
diff changeset
1603 if (state_lock)
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1604 return;
858
3de6e98e8898 [gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 856
diff changeset
1605 if (GTK_TOGGLE_BUTTON(color)->active)
3de6e98e8898 [gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 856
diff changeset
1606 show_bgcolor_dialog(c, color);
3de6e98e8898 [gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 856
diff changeset
1607 else if (c->bg_color_dialog)
3de6e98e8898 [gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 856
diff changeset
1608 cancel_bgcolor(color, c);
189
50dc3db25513 [gaim-migrate @ 199]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 187
diff changeset
1609 else
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1610 advance_past(c->entry, "<BODY BGCOLOR>", "</BODY>");
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1611 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1612
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
1613 void toggle_font(GtkWidget *font, struct conversation *c)
234
985635758c33 [gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 230
diff changeset
1614 {
311
0a8b4edc4732 [gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 309
diff changeset
1615 if (state_lock)
0a8b4edc4732 [gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 309
diff changeset
1616 return;
0a8b4edc4732 [gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 309
diff changeset
1617 if (GTK_TOGGLE_BUTTON(font)->active)
0a8b4edc4732 [gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 309
diff changeset
1618 show_font_dialog(c, font);
563
8d6e2de1fb64 [gaim-migrate @ 573]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 557
diff changeset
1619 else if (c->font_dialog)
8d6e2de1fb64 [gaim-migrate @ 573]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 557
diff changeset
1620 cancel_font(font, c);
311
0a8b4edc4732 [gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 309
diff changeset
1621 else
0a8b4edc4732 [gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 309
diff changeset
1622 advance_past(c->entry, "<FONT FACE>", "</FONT>");
234
985635758c33 [gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 230
diff changeset
1623 }
611
0f7e5ff95f71 [gaim-migrate @ 621]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 610
diff changeset
1624
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1625 void insert_link_cb(GtkWidget *w, struct conversation *c)
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1626 {
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1627 show_add_link(c->link, c);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1628 }
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1629
608
e33dfed611c9 [gaim-migrate @ 618]
Todd Kulesza <fflewddur>
parents: 604
diff changeset
1630 void toggle_link(GtkWidget *linky, struct conversation *c)
e33dfed611c9 [gaim-migrate @ 618]
Todd Kulesza <fflewddur>
parents: 604
diff changeset
1631 {
e33dfed611c9 [gaim-migrate @ 618]
Todd Kulesza <fflewddur>
parents: 604
diff changeset
1632 if (state_lock)
e33dfed611c9 [gaim-migrate @ 618]
Todd Kulesza <fflewddur>
parents: 604
diff changeset
1633 return;
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1634
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1635 if (GTK_TOGGLE_BUTTON(c->link)->active)
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1636 show_add_link(c->link, c);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1637
608
e33dfed611c9 [gaim-migrate @ 618]
Todd Kulesza <fflewddur>
parents: 604
diff changeset
1638 else if (c->link_dialog)
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1639 cancel_link(c->link, c);
608
e33dfed611c9 [gaim-migrate @ 618]
Todd Kulesza <fflewddur>
parents: 604
diff changeset
1640 else
e33dfed611c9 [gaim-migrate @ 618]
Todd Kulesza <fflewddur>
parents: 604
diff changeset
1641 advance_past(c->entry, "<A HREF>", "</A>");
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1642
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1643 gtk_widget_grab_focus(c->entry);
608
e33dfed611c9 [gaim-migrate @ 618]
Todd Kulesza <fflewddur>
parents: 604
diff changeset
1644 }
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1645
344
2434adbb8703 [gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 337
diff changeset
1646 void do_strike(GtkWidget *strike, GtkWidget *entry)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1647 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1648 if (state_lock)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1649 return;
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1650
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1651 if (GTK_TOGGLE_BUTTON(strike)->active)
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1652 surround(entry, "<STRIKE>", "</STRIKE>");
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1653 else
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1654 advance_past(entry, "<STRIKE>", "</STRIKE>");
1133
0dc7c7b4f8ca [gaim-migrate @ 1143]
Rob Flynn <gaim@robflynn.com>
parents: 1117
diff changeset
1655
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1656 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1657
344
2434adbb8703 [gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 337
diff changeset
1658 void do_bold(GtkWidget *bold, GtkWidget *entry)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1659 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1660 if (state_lock)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1661 return;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1662 if (GTK_TOGGLE_BUTTON(bold)->active)
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1663 surround(entry, "<B>", "</B>");
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1664 else
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1665 advance_past(entry, "<B>", "</B>");
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1666
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1667 gtk_widget_grab_focus(entry);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1668 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1669
344
2434adbb8703 [gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 337
diff changeset
1670 void do_underline(GtkWidget *underline, GtkWidget *entry)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1671 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1672 if (state_lock)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1673 return;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1674 if (GTK_TOGGLE_BUTTON(underline)->active)
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1675 surround(entry, "<U>", "</U>");
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1676 else
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1677 advance_past(entry, "<U>", "</U>");
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1678
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1679 gtk_widget_grab_focus(entry);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1680 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1681
344
2434adbb8703 [gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 337
diff changeset
1682 void do_italic(GtkWidget *italic, GtkWidget *entry)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1683 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1684 if (state_lock)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1685 return;
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1686 if (GTK_TOGGLE_BUTTON(italic)->active)
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1687 surround(entry, "<I>", "</I>");
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1688 else
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1689 advance_past(entry, "<I>", "</I>");
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1690
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1691 gtk_widget_grab_focus(entry);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1692 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1693
230
83dd297aa363 [gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 210
diff changeset
1694 /* html code to modify font sizes must all be the same length, */
83dd297aa363 [gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 210
diff changeset
1695 /* currently set to 15 chars */
83dd297aa363 [gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 210
diff changeset
1696
344
2434adbb8703 [gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 337
diff changeset
1697 void do_small(GtkWidget *small, GtkWidget *entry)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1698 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1699 if (state_lock)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1700 return;
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1701
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1702 surround(entry, "<FONT SIZE=\"1\">", "</FONT>");
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1703
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1704 gtk_widget_grab_focus(entry);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1705 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1706
344
2434adbb8703 [gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 337
diff changeset
1707 void do_normal(GtkWidget *normal, GtkWidget *entry)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1708 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1709 if (state_lock)
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1710 return;
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1711
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1712 surround(entry, "<FONT SIZE=\"3\">", "</FONT>");
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1713
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1714 gtk_widget_grab_focus(entry);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1715 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1716
344
2434adbb8703 [gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 337
diff changeset
1717 void do_big(GtkWidget *big, GtkWidget *entry)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1718 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1719 if (state_lock)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1720 return;
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1721
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1722 surround(entry, "<FONT SIZE=\"5\">", "</FONT>");
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1723
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
1724 gtk_widget_grab_focus(entry);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1725 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1726
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1727 void check_everything(GtkWidget *entry)
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1728 {
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1729 struct conversation *c;
206
610b7ffc4821 [gaim-migrate @ 216]
Rob Flynn <gaim@robflynn.com>
parents: 189
diff changeset
1730
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1731 c = (struct conversation *)gtk_object_get_user_data(GTK_OBJECT(entry));
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1732 if (!c)
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1733 return;
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1734 if (invert_tags(entry, "<B>", "</B>", 0))
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1735 quiet_set(c->bold, TRUE);
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1736 else if (count_tag(entry, "<B>", "</B>"))
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1737 quiet_set(c->bold, TRUE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1738 else
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1739 quiet_set(c->bold, FALSE);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1740 if (invert_tags(entry, "<I>", "</I>", 0))
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1741 quiet_set(c->italic, TRUE);
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1742 else if (count_tag(entry, "<I>", "</I>"))
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1743 quiet_set(c->italic, TRUE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1744 else
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1745 quiet_set(c->italic, FALSE);
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1746
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1747 if (invert_tags(entry, "<FONT COLOR", "</FONT>", 0))
854
9e2dcad06d3c [gaim-migrate @ 864]
Rob Flynn <gaim@robflynn.com>
parents: 849
diff changeset
1748 quiet_set(c->fgcolorbtn, TRUE);
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1749 else if (count_tag(entry, "<FONT COLOR", "</FONT>"))
854
9e2dcad06d3c [gaim-migrate @ 864]
Rob Flynn <gaim@robflynn.com>
parents: 849
diff changeset
1750 quiet_set(c->fgcolorbtn, TRUE);
311
0a8b4edc4732 [gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 309
diff changeset
1751 else
854
9e2dcad06d3c [gaim-migrate @ 864]
Rob Flynn <gaim@robflynn.com>
parents: 849
diff changeset
1752 quiet_set(c->fgcolorbtn, FALSE);
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1753
861
00fb90babcb2 [gaim-migrate @ 871]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 860
diff changeset
1754 if (invert_tags(entry, "<BODY BGCOLOR", "</BODY>", 0))
00fb90babcb2 [gaim-migrate @ 871]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 860
diff changeset
1755 quiet_set(c->bgcolorbtn, TRUE);
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1756 else if (count_tag(entry, "<BODY BGCOLOR", "</BODY>"))
861
00fb90babcb2 [gaim-migrate @ 871]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 860
diff changeset
1757 quiet_set(c->bgcolorbtn, TRUE);
00fb90babcb2 [gaim-migrate @ 871]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 860
diff changeset
1758 else
00fb90babcb2 [gaim-migrate @ 871]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 860
diff changeset
1759 quiet_set(c->bgcolorbtn, FALSE);
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1760
311
0a8b4edc4732 [gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 309
diff changeset
1761 if (invert_tags(entry, "<FONT FACE", "</FONT>", 0))
0a8b4edc4732 [gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 309
diff changeset
1762 quiet_set(c->font, TRUE);
0a8b4edc4732 [gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 309
diff changeset
1763 else if (count_tag(entry, "<FONT FACE", "</FONT>"))
0a8b4edc4732 [gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 309
diff changeset
1764 quiet_set(c->font, TRUE);
0a8b4edc4732 [gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 309
diff changeset
1765 else
0a8b4edc4732 [gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 309
diff changeset
1766 quiet_set(c->font, FALSE);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1767
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1768 if (invert_tags(entry, "<A HREF", "</A>", 0))
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1769 quiet_set(c->link, TRUE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1770 else if (count_tag(entry, "<A HREF", "</A>"))
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1771 quiet_set(c->link, TRUE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1772 else
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1773 quiet_set(c->link, FALSE);
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1774
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1775 if (invert_tags(entry, "<U>", "</U>", 0))
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1776 quiet_set(c->underline, TRUE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1777 else if (count_tag(entry, "<U>", "</U>"))
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1778 quiet_set(c->underline, TRUE);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1779 else
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1780 quiet_set(c->underline, FALSE);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1781 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1782
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1783
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1784 /*------------------------------------------------------------------------*/
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1785 /* Takin care of the window.. */
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1786 /*------------------------------------------------------------------------*/
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1787
3431
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1788 static char* nick_colors[] = {
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1789 "#ba55d3", /* Medium Orchid */
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1790 "#ee82ee", /* Violet */
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1791 "#c715b4", /* Medium Violet Red */
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1792 "#ff69b4", /* Hot Pink */
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1793 "#ff6347", /* Tomato */
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1794 "#fa8c00", /* Dark Orange */
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1795 "#fa8072" /* Salmon */
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1796 "#b22222", /* Fire Brick */
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1797 "#f4a460", /* Sandy Brown */
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1798 "#cd5c5c", /* Indian Red */
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1799 "#bc8f8f", /* Rosy Brown */
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1800 "#f0e68c", /* Khaki */
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1801 "#bdb76b", /* Dark Khaki */
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1802 "#228b22", /* Forest Green */
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1803 "#9acd32", /* Yellow Green */
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1804 "#32cd32", /* Lime Green */
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1805 "#3cb371", /* Medium Sea Green */
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1806 "#2e8b57", /* Sea Green */
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1807 "#8fbc8f", /* Dark Sea Green */
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1808 "#66cdaa", /* Medium Aquamarine */
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1809 "#5f9ea0", /* Cadet Blue */
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1810 "#48d1cc", /* Medium Turquoise */
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1811 "#00ced1", /* Dark Turquoise */
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1812 "#4682b4", /* Stell Blue */
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1813 "#00bfff", /* Deep Sky Blue */
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1814 "#1690ff", /* Dodger Blue */
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1815 "#4169ff", /* Royal Blue */
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1816 "#6a5acd", /* Slate Blue */
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1817 "#6495ed", /* Cornflower Blue */
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1818 "#708090", /* Slate gray */
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1819 "#ffdead", /* Navajo White */
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1820 };
bc9c71d74842 [gaim-migrate @ 3457]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
1821 #define NUM_NICK_COLORS (sizeof(nick_colors) / sizeof(char *))
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1822
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
1823 /* this is going to be interesting since the conversation could either be a
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
1824 * normal IM conversation or a chat window. but hopefully it won't matter */
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2855
diff changeset
1825 void write_to_conv(struct conversation *c, char *what, int flags, char *who, time_t mtime, gint length)
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1826 {
1735
00f74db70f2d [gaim-migrate @ 1745]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1732
diff changeset
1827 char buf[BUF_LONG];
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
1828 char *str;
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1829 FILE *fd;
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1830 char colour[10];
741
58a6e6e26695 [gaim-migrate @ 751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 738
diff changeset
1831 struct buddy *b;
1244
eaa0e2f5ace4 [gaim-migrate @ 1254]
Rob Flynn <gaim@robflynn.com>
parents: 1235
diff changeset
1832 int gtk_font_options = 0;
1440
6330d0bb309f [gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1439
diff changeset
1833 GString *logstr;
1735
00f74db70f2d [gaim-migrate @ 1745]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1732
diff changeset
1834 char buf2[BUF_LONG];
1764
1e0613d9526b [gaim-migrate @ 1774]
Rob Flynn <gaim@robflynn.com>
parents: 1759
diff changeset
1835 char mdate[64];
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
1836 int unhighlight = 0;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
1837
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2855
diff changeset
1838 if (c->is_chat && (!c->gc || !g_slist_find(c->gc->buddy_chats, c)))
2267
837aa71710c5 [gaim-migrate @ 2277]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2264
diff changeset
1839 return;
837aa71710c5 [gaim-migrate @ 2277]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2264
diff changeset
1840
2447
6bdeb91abe4e [gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2426
diff changeset
1841 if (!c->is_chat && !g_list_find(conversations, c))
6bdeb91abe4e [gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2426
diff changeset
1842 return;
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
1843
2794
2d3f47783a22 [gaim-migrate @ 2807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2788
diff changeset
1844 gtk_widget_show(c->window);
2d3f47783a22 [gaim-migrate @ 2807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2788
diff changeset
1845
1772
896432d66303 [gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1764
diff changeset
1846 if (!c->is_chat || !(c->gc->prpl->options & OPT_PROTO_UNIQUE_CHATNAME)) {
896432d66303 [gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1764
diff changeset
1847 if (!who) {
896432d66303 [gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1764
diff changeset
1848 if (flags & WFLAG_SEND) {
896432d66303 [gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1764
diff changeset
1849 b = find_buddy(c->gc, c->gc->username);
2213
a226ebf4be47 [gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2210
diff changeset
1850 if (b && strcmp(b->name, b->show))
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
1851 who = b->show;
3205
332df87cf3d6 [gaim-migrate @ 3222]
Sean Egan <seanegan@gmail.com>
parents: 3168
diff changeset
1852 else if (c->gc->user->alias[0])
332df87cf3d6 [gaim-migrate @ 3222]
Sean Egan <seanegan@gmail.com>
parents: 3168
diff changeset
1853 who = c->gc->user->alias;
2210
3a6fd1e8f00a [gaim-migrate @ 2220]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2202
diff changeset
1854 else if (c->gc->displayname[0])
3a6fd1e8f00a [gaim-migrate @ 2220]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2202
diff changeset
1855 who = c->gc->displayname;
1772
896432d66303 [gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1764
diff changeset
1856 else
896432d66303 [gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1764
diff changeset
1857 who = c->gc->username;
896432d66303 [gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1764
diff changeset
1858 } else {
896432d66303 [gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1764
diff changeset
1859 b = find_buddy(c->gc, c->name);
896432d66303 [gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1764
diff changeset
1860 if (b)
896432d66303 [gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1764
diff changeset
1861 who = b->show;
896432d66303 [gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1764
diff changeset
1862 else
896432d66303 [gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1764
diff changeset
1863 who = c->name;
896432d66303 [gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1764
diff changeset
1864 }
896432d66303 [gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1764
diff changeset
1865 } else {
896432d66303 [gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1764
diff changeset
1866 b = find_buddy(c->gc, who);
745
d693b83e4933 [gaim-migrate @ 755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 741
diff changeset
1867 if (b)
d693b83e4933 [gaim-migrate @ 755]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 741
diff changeset
1868 who = b->show;
741
58a6e6e26695 [gaim-migrate @ 751]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 738
diff changeset
1869 }
474
7720d0f9da8e [gaim-migrate @ 484]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 473
diff changeset
1870 }
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1871
2447
6bdeb91abe4e [gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2426
diff changeset
1872 strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime));
6bdeb91abe4e [gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2426
diff changeset
1873
6bdeb91abe4e [gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2426
diff changeset
1874 gtk_font_options = gtk_font_options ^ GTK_IMHTML_NO_COMMENTS;
6bdeb91abe4e [gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2426
diff changeset
1875
6bdeb91abe4e [gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2426
diff changeset
1876 if (convo_options & OPT_CONVO_IGNORE_COLOUR)
6bdeb91abe4e [gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2426
diff changeset
1877 gtk_font_options = gtk_font_options ^ GTK_IMHTML_NO_COLOURS;
6bdeb91abe4e [gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2426
diff changeset
1878
6bdeb91abe4e [gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2426
diff changeset
1879 if (convo_options & OPT_CONVO_IGNORE_FONTS)
6bdeb91abe4e [gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2426
diff changeset
1880 gtk_font_options = gtk_font_options ^ GTK_IMHTML_NO_FONTS;
6bdeb91abe4e [gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2426
diff changeset
1881
6bdeb91abe4e [gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2426
diff changeset
1882 if (convo_options & OPT_CONVO_IGNORE_SIZES)
6bdeb91abe4e [gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2426
diff changeset
1883 gtk_font_options = gtk_font_options ^ GTK_IMHTML_NO_SIZES;
6bdeb91abe4e [gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2426
diff changeset
1884
6bdeb91abe4e [gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2426
diff changeset
1885 if (!(logging_options & OPT_LOG_STRIP_HTML))
6bdeb91abe4e [gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2426
diff changeset
1886 gtk_font_options = gtk_font_options ^ GTK_IMHTML_RETURN_LOG;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
1887
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1888 if (flags & WFLAG_SYSTEM) {
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
1889 if (convo_options & OPT_CONVO_SHOW_TIME)
1764
1e0613d9526b [gaim-migrate @ 1774]
Rob Flynn <gaim@robflynn.com>
parents: 1759
diff changeset
1890 g_snprintf(buf, BUF_LONG, "<FONT SIZE=\"2\">(%s) </FONT><B>%s</B>", mdate, what);
1735
00f74db70f2d [gaim-migrate @ 1745]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1732
diff changeset
1891 else
1815
f15d449b3167 [gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1813
diff changeset
1892 g_snprintf(buf, BUF_LONG, "<B>%s</B>", what);
1735
00f74db70f2d [gaim-migrate @ 1745]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1732
diff changeset
1893 g_snprintf(buf2, sizeof(buf2), "<FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B><BR>",
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
1894 mdate, what);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1895
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2855
diff changeset
1896 gtk_imhtml_append_text(GTK_IMHTML(c->text), buf2, -1, 0);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1897
1525
ba8e6e211af5 [gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1486
diff changeset
1898 if (logging_options & OPT_LOG_STRIP_HTML) {
1735
00f74db70f2d [gaim-migrate @ 1745]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1732
diff changeset
1899 char *t1 = strip_html(buf);
1479
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
1900 c->history = g_string_append(c->history, t1);
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
1901 c->history = g_string_append(c->history, "\n");
1486
b72a33d07ce8 [gaim-migrate @ 1496]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1479
diff changeset
1902 g_free(t1);
1479
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
1903 } else {
1735
00f74db70f2d [gaim-migrate @ 1745]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1732
diff changeset
1904 c->history = g_string_append(c->history, buf);
1479
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
1905 c->history = g_string_append(c->history, "<BR>\n");
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
1906 }
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
1907
3457
222e23f91092 [gaim-migrate @ 3505]
Sean Egan <seanegan@gmail.com>
parents: 3451
diff changeset
1908 if (!(flags & WFLAG_NOLOG) && ((c->is_chat && (logging_options & OPT_LOG_CHATS))
222e23f91092 [gaim-migrate @ 3505]
Sean Egan <seanegan@gmail.com>
parents: 3451
diff changeset
1909 || (!c->is_chat && (logging_options & OPT_LOG_CONVOS))
222e23f91092 [gaim-migrate @ 3505]
Sean Egan <seanegan@gmail.com>
parents: 3451
diff changeset
1910 || find_log_info(c->name))) {
1437
1f0660a2c893 [gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1434
diff changeset
1911 char *t1;
699
f8acdd22065a [gaim-migrate @ 709]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 698
diff changeset
1912 char nm[256];
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1913
1525
ba8e6e211af5 [gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1486
diff changeset
1914 if (logging_options & OPT_LOG_STRIP_HTML) {
1735
00f74db70f2d [gaim-migrate @ 1745]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1732
diff changeset
1915 t1 = strip_html(buf);
1437
1f0660a2c893 [gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1434
diff changeset
1916 } else {
1735
00f74db70f2d [gaim-migrate @ 1745]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1732
diff changeset
1917 t1 = buf;
1437
1f0660a2c893 [gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1434
diff changeset
1918 }
699
f8acdd22065a [gaim-migrate @ 709]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 698
diff changeset
1919 if (c->is_chat)
f8acdd22065a [gaim-migrate @ 709]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 698
diff changeset
1920 g_snprintf(nm, 256, "%s.chat", c->name);
f8acdd22065a [gaim-migrate @ 709]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 698
diff changeset
1921 else
f8acdd22065a [gaim-migrate @ 709]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 698
diff changeset
1922 g_snprintf(nm, 256, "%s", c->name);
3457
222e23f91092 [gaim-migrate @ 3505]
Sean Egan <seanegan@gmail.com>
parents: 3451
diff changeset
1923 fd = open_log_file(nm, c->is_chat);
2004
699ddd727a49 [gaim-migrate @ 2014]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1970
diff changeset
1924 if (fd) {
1525
ba8e6e211af5 [gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1486
diff changeset
1925 if (logging_options & OPT_LOG_STRIP_HTML) {
1437
1f0660a2c893 [gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1434
diff changeset
1926 fprintf(fd, "%s\n", t1);
1f0660a2c893 [gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1434
diff changeset
1927 } else {
1f0660a2c893 [gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1434
diff changeset
1928 fprintf(fd, "%s<BR>\n", t1);
1f0660a2c893 [gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1434
diff changeset
1929 }
1067
649199f4730e [gaim-migrate @ 1077]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1063
diff changeset
1930 fclose(fd);
936
311b3f72e7b9 [gaim-migrate @ 946]
Rob Flynn <gaim@robflynn.com>
parents: 915
diff changeset
1931 }
1525
ba8e6e211af5 [gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1486
diff changeset
1932 if (logging_options & OPT_LOG_STRIP_HTML) {
1437
1f0660a2c893 [gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1434
diff changeset
1933 g_free(t1);
1f0660a2c893 [gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1434
diff changeset
1934 }
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1935 }
2385
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2379
diff changeset
1936 } else if (flags & WFLAG_NOLOG) {
bdc74764245c [gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2379
diff changeset
1937 g_snprintf(buf, BUF_LONG, "<B><FONT COLOR=\"#777777\">%s</FONT></B><BR>", what);
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2855
diff changeset
1938 gtk_imhtml_append_text(GTK_IMHTML(c->text), buf, -1, 0);
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1939 } else {
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
1940 if (flags & WFLAG_WHISPER) {
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
1941 /* if we're whispering, it's not an autoresponse */
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2855
diff changeset
1942 if (meify(what, length)) {
2138
cfa83a1b3d49 [gaim-migrate @ 2148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2124
diff changeset
1943 str = g_malloc(1024);
cfa83a1b3d49 [gaim-migrate @ 2148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2124
diff changeset
1944 g_snprintf(str, 1024, "***%s", who);
2374
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
1945 strcpy(colour, "#6C2585");
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
1946 } else {
2138
cfa83a1b3d49 [gaim-migrate @ 2148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2124
diff changeset
1947 str = g_malloc(1024);
cfa83a1b3d49 [gaim-migrate @ 2148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2124
diff changeset
1948 g_snprintf(str, 1024, "*%s*:", who);
2374
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
1949 strcpy(colour, "#00ff00");
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
1950 }
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
1951 } else {
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2855
diff changeset
1952 if (meify(what, length)) {
2138
cfa83a1b3d49 [gaim-migrate @ 2148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2124
diff changeset
1953 str = g_malloc(1024);
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
1954 if (flags & WFLAG_AUTO)
2138
cfa83a1b3d49 [gaim-migrate @ 2148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2124
diff changeset
1955 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, who);
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
1956 else
2138
cfa83a1b3d49 [gaim-migrate @ 2148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2124
diff changeset
1957 g_snprintf(str, 1024, "***%s", who);
2374
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
1958 if (flags & WFLAG_NICK)
2375
09fe1b00d31f [gaim-migrate @ 2388]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2374
diff changeset
1959 strcpy(colour, "#af7f00");
2374
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
1960 else
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
1961 strcpy(colour, "#062585");
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
1962 } else {
2138
cfa83a1b3d49 [gaim-migrate @ 2148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2124
diff changeset
1963 str = g_malloc(1024);
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
1964 if (flags & WFLAG_AUTO)
2138
cfa83a1b3d49 [gaim-migrate @ 2148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2124
diff changeset
1965 g_snprintf(str, 1024, "%s %s", who, AUTO_RESPONSE);
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
1966 else
2138
cfa83a1b3d49 [gaim-migrate @ 2148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2124
diff changeset
1967 g_snprintf(str, 1024, "%s:", who);
2374
9e9385cddcc6 [gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
1968 if (flags & WFLAG_NICK)
2375
09fe1b00d31f [gaim-migrate @ 2388]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2374
diff changeset
1969 strcpy(colour, "#af7f00");
3367
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
1970 else if (flags & WFLAG_RECV) {
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
1971 if (flags & WFLAG_COLORIZE) {
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
1972 char *u = who;
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
1973 int m = 0;
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
1974 while (*u) {
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
1975 m = m + *u;
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
1976 u++;
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
1977 }
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
1978 m = m % NUM_NICK_COLORS;
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
1979 strcpy(colour, nick_colors[m]);
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
1980 } else {
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
1981 strcpy(colour, "#ff0000");
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
1982 }
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
1983 } else if (flags & WFLAG_RECV)
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1984 strcpy(colour, "#ff0000");
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
1985 else if (flags & WFLAG_SEND)
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
1986 strcpy(colour, "#0000ff");
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
1987 }
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
1988 }
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1989
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
1990 if (convo_options & OPT_CONVO_SHOW_TIME)
1437
1f0660a2c893 [gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1434
diff changeset
1991 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"%s\"><FONT SIZE=\"2\">(%s) </FONT>"
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
1992 "<B>%s</B></FONT> ", colour, mdate, str);
1437
1f0660a2c893 [gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1434
diff changeset
1993 else
1f0660a2c893 [gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1434
diff changeset
1994 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"%s\"><B>%s</B></FONT> ", colour, str);
1439
06a21ec0e269 [gaim-migrate @ 1449]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1438
diff changeset
1995 g_snprintf(buf2, BUF_LONG, "<FONT COLOR=\"%s\"><FONT SIZE=\"2\"><!--(%s) --></FONT>"
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
1996 "<B>%s</B></FONT> ", colour, mdate, str);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1997
473
f9bb7761c52b [gaim-migrate @ 483]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 472
diff changeset
1998 g_free(str);
f9bb7761c52b [gaim-migrate @ 483]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 472
diff changeset
1999
2856
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2855
diff changeset
2000 gtk_imhtml_append_text(GTK_IMHTML(c->text), buf2, -1, 0);
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2855
diff changeset
2001
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2855
diff changeset
2002 logstr = gtk_imhtml_append_text(GTK_IMHTML(c->text), what, length, gtk_font_options);
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2855
diff changeset
2003
b1e300a85678 [gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2855
diff changeset
2004 gtk_imhtml_append_text(GTK_IMHTML(c->text), "<BR>", -1, 0);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2005
2857
7a6f33cd6721 [gaim-migrate @ 2870]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2856
diff changeset
2006 /* XXX this needs to be updated for the new length argument */
1525
ba8e6e211af5 [gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1486
diff changeset
2007 if (logging_options & OPT_LOG_STRIP_HTML) {
1479
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
2008 char *t1, *t2;
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
2009 t1 = strip_html(buf);
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
2010 t2 = strip_html(what);
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
2011 c->history = g_string_append(c->history, t1);
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
2012 c->history = g_string_append(c->history, t2);
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
2013 c->history = g_string_append(c->history, "\n");
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
2014 g_free(t1);
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
2015 g_free(t2);
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
2016 } else {
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
2017 char *t1, *t2;
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
2018 t1 = html_logize(buf);
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
2019 t2 = html_logize(what);
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
2020 c->history = g_string_append(c->history, t1);
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
2021 c->history = g_string_append(c->history, t2);
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
2022 c->history = g_string_append(c->history, "\n");
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
2023 c->history = g_string_append(c->history, logstr->str);
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
2024 c->history = g_string_append(c->history, "<BR>\n");
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
2025 g_free(t1);
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
2026 g_free(t2);
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
2027 }
4c62ead808a2 [gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1464
diff changeset
2028
2857
7a6f33cd6721 [gaim-migrate @ 2870]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2856
diff changeset
2029 /* XXX this needs to be updated for the new length argument */
3457
222e23f91092 [gaim-migrate @ 3505]
Sean Egan <seanegan@gmail.com>
parents: 3451
diff changeset
2030 if ((c->is_chat && (logging_options & OPT_LOG_CHATS))
222e23f91092 [gaim-migrate @ 3505]
Sean Egan <seanegan@gmail.com>
parents: 3451
diff changeset
2031 || (!c->is_chat && (logging_options & OPT_LOG_CONVOS)) || find_log_info(c->name)) {
1437
1f0660a2c893 [gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1434
diff changeset
2032 char *t1, *t2;
1f0660a2c893 [gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1434
diff changeset
2033 char *nm = g_malloc(256);
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
2034 if (c->is_chat)
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
2035 g_snprintf(nm, 256, "%s.chat", c->name);
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
2036 else
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
2037 g_snprintf(nm, 256, "%s", c->name);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2038
1525
ba8e6e211af5 [gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1486
diff changeset
2039 if (logging_options & OPT_LOG_STRIP_HTML) {
1437
1f0660a2c893 [gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1434
diff changeset
2040 t1 = strip_html(buf);
1f0660a2c893 [gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1434
diff changeset
2041 t2 = strip_html(what);
1f0660a2c893 [gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1434
diff changeset
2042 } else {
1440
6330d0bb309f [gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1439
diff changeset
2043 t1 = html_logize(buf);
6330d0bb309f [gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1439
diff changeset
2044 t2 = html_logize(what);
1437
1f0660a2c893 [gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1434
diff changeset
2045 }
3457
222e23f91092 [gaim-migrate @ 3505]
Sean Egan <seanegan@gmail.com>
parents: 3451
diff changeset
2046 fd = open_log_file(nm, c->is_chat);
2004
699ddd727a49 [gaim-migrate @ 2014]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1970
diff changeset
2047 if (fd) {
1525
ba8e6e211af5 [gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1486
diff changeset
2048 if (logging_options & OPT_LOG_STRIP_HTML) {
1437
1f0660a2c893 [gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1434
diff changeset
2049 fprintf(fd, "%s%s\n", t1, t2);
1f0660a2c893 [gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1434
diff changeset
2050 } else {
1440
6330d0bb309f [gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1439
diff changeset
2051 fprintf(fd, "%s%s%s<BR>\n", t1, t2, logstr->str);
6330d0bb309f [gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1439
diff changeset
2052 g_string_free(logstr, TRUE);
1437
1f0660a2c893 [gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1434
diff changeset
2053 }
1067
649199f4730e [gaim-migrate @ 1077]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1063
diff changeset
2054 fclose(fd);
936
311b3f72e7b9 [gaim-migrate @ 946]
Rob Flynn <gaim@robflynn.com>
parents: 915
diff changeset
2055 }
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
2056 g_free(t1);
1437
1f0660a2c893 [gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1434
diff changeset
2057 g_free(t2);
1f0660a2c893 [gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1434
diff changeset
2058 g_free(nm);
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
2059 }
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
2060 }
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2061
3597
bc87186a7478 [gaim-migrate @ 3699]
Sean Egan <seanegan@gmail.com>
parents: 3596
diff changeset
2062 if (!flags & WFLAG_NOLOG && ((c->is_chat && (chat_options & OPT_CHAT_POPUP)) ||
bc87186a7478 [gaim-migrate @ 3699]
Sean Egan <seanegan@gmail.com>
parents: 3596
diff changeset
2063 (!c->is_chat && (im_options & OPT_IM_POPUP))))
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
2064 gdk_window_show(c->window->window);
3022
5f6ddad12b1d [gaim-migrate @ 3035]
Sean Egan <seanegan@gmail.com>
parents: 3014
diff changeset
2065 if (flags & WFLAG_RECV)
5f6ddad12b1d [gaim-migrate @ 3035]
Sean Egan <seanegan@gmail.com>
parents: 3014
diff changeset
2066 reset_typing(g_strdup(c->name));
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2067
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2068 /* tab highlighting */
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2069 if (c->is_chat && !(chat_options & OPT_CHAT_ONE_WINDOW)) /* if chat but not tabbed chat */
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2070 return;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2071 if (!c->is_chat && !(im_options & OPT_IM_ONE_WINDOW)) /* if convo but not tabbed convo */
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2072 return;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2073 if (!(flags & WFLAG_RECV) && !(flags & WFLAG_SYSTEM))
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2074 return;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2075 if ((c->unseen == 2) || ((c->unseen == 1) && !(flags & WFLAG_NICK)))
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2076 return;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2077
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2078 if (c->is_chat) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2079 int offs;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2080 if ((convo_options & OPT_CONVO_COMBINE) && (im_options & OPT_IM_ONE_WINDOW))
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2081 offs = g_list_length(conversations);
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2082 else
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2083 offs = 0;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2084 if (gtk_notebook_get_current_page(GTK_NOTEBOOK(chat_notebook)) ==
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2085 g_list_index(chats, c) + offs)
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2086 unhighlight = 1;
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2087 } else {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2088 if (gtk_notebook_get_current_page(GTK_NOTEBOOK(convo_notebook)) ==
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2089 g_list_index(conversations, c))
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2090 unhighlight = 1;
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2091 }
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2092 if ((c->unseen != -1) && unhighlight) /* If there's no typing message
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2093 and we're on the same tab, don't bother
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2094 changing the color. */
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2095 return;
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2096
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2097 {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2098 GtkNotebook *notebook = GTK_NOTEBOOK(c->is_chat ? chat_notebook : convo_notebook);
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2099 int offs = ((convo_options & OPT_CONVO_COMBINE) &&
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2100 (im_options & OPT_IM_ONE_WINDOW) && c->is_chat) ?
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2101 g_list_length(conversations) : 0;
1692
a312d64a995d [gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1663
diff changeset
2102 GList *ws = (c->is_chat ? chats : conversations);
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2103 GtkWidget *label = gtk_notebook_get_tab_label(notebook,
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2104 gtk_notebook_get_nth_page(notebook,
3022
5f6ddad12b1d [gaim-migrate @ 3035]
Sean Egan <seanegan@gmail.com>
parents: 3014
diff changeset
2105 offs + g_list_index(ws, c)));
2625
d8d2df2bdf01 [gaim-migrate @ 2638]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2619
diff changeset
2106 GtkStyle *style;
d8d2df2bdf01 [gaim-migrate @ 2638]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2619
diff changeset
2107 style = gtk_style_new();
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2108 if (!GTK_WIDGET_REALIZED(label))
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2109 gtk_widget_realize(label);
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2722
diff changeset
2110 gdk_font_unref(gtk_style_get_font(style));
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2722
diff changeset
2111 gtk_style_set_font(style, gdk_font_ref(gtk_style_get_font(label->style)));
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2112 if (!unhighlight && flags & WFLAG_NICK) {
2625
d8d2df2bdf01 [gaim-migrate @ 2638]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2619
diff changeset
2113 style->fg[0].red = 0x0000;
d8d2df2bdf01 [gaim-migrate @ 2638]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2619
diff changeset
2114 style->fg[0].green = 0x0000;
d8d2df2bdf01 [gaim-migrate @ 2638]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2619
diff changeset
2115 style->fg[0].blue = 0xcccc;
d8d2df2bdf01 [gaim-migrate @ 2638]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2619
diff changeset
2116 c->unseen = 2;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2117 } else if (!unhighlight) {
2625
d8d2df2bdf01 [gaim-migrate @ 2638]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2619
diff changeset
2118 style->fg[0].red = 0xcccc;
d8d2df2bdf01 [gaim-migrate @ 2638]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2619
diff changeset
2119 style->fg[0].green = 0x0000;
d8d2df2bdf01 [gaim-migrate @ 2638]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2619
diff changeset
2120 style->fg[0].blue = 0x0000;
d8d2df2bdf01 [gaim-migrate @ 2638]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2619
diff changeset
2121 c->unseen = 1;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2122 } else {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2123 c->unseen = 0;
2625
d8d2df2bdf01 [gaim-migrate @ 2638]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2619
diff changeset
2124 }
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2125 gtk_widget_set_style(label, style);
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2126 gtk_style_unref(style);
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2127 }
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2128 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2129
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2130 void update_progress(struct conversation *c, float percent) {
3044
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
2131
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2132 if (percent >= 1 && !(c->progress))
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2133 return;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2134
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2135 if (percent >= 1) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2136 gtk_widget_destroy(c->progress);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2137 c->progress = NULL;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2138 return;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2139 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2140
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2141 if (!c->progress) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2142 GtkBox *box = GTK_BOX(c->text->parent->parent);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2143 c->progress = gtk_progress_bar_new();
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2144 gtk_box_pack_end(box, c->progress, FALSE, FALSE, 0);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2145 gtk_widget_set_usize (c->progress, 1, 8);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2146 gtk_widget_show (c->progress);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2147 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2148
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2149 if (percent < 1)
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2150 gtk_progress_set_percentage(GTK_PROGRESS(c->progress), percent);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2151 }
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2152
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2153 GtkWidget *build_conv_menubar(struct conversation *c)
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2154 {
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2155 GtkWidget *menubar;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2156 GtkWidget *menu;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2157 GtkWidget *menuitem;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2158
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2159 menubar = gtk_menu_bar_new();
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2160
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2161 menu = gtk_menu_new();
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2162
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2163 /* The file menu */
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2164 menuitem = gaim_new_item(NULL, _("File"));
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2165 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2166 gtk_menu_bar_append(GTK_MENU_BAR(menubar), menuitem);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2167
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2168 gaim_new_item_from_stock(menu, _("_Save Conversation"), "gtk-save-as", GTK_SIGNAL_FUNC(save_convo), c, 0, 0, NULL);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2169
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2170 gaim_new_item_from_stock(menu, _("View _History"), NULL, GTK_SIGNAL_FUNC(conv_show_log), GINT_TO_POINTER(c->name), 0, 0, NULL);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2171
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2172 menuitem = gtk_menu_item_new();
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2173 gtk_menu_append(GTK_MENU(menu), menuitem);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2174 /*
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2175 c->sendfile_btn = gaim_new_item_from_pixbuf(menu, _("Send File"), "send-file-small.png", NULL, NULL, 0, 0, NULL); */
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2176
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2177 gaim_new_item_from_pixbuf(menu, _("Insert URL"), NULL, GTK_SIGNAL_FUNC(insert_link_cb), c, 0, 0, NULL);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2178 c->image_menubtn = gaim_new_item_from_pixbuf(menu, _("Insert Image"), "insert-image-small.png", GTK_SIGNAL_FUNC(insert_image), c, 0, 0, NULL);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2179
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2180 menuitem = gtk_menu_item_new();
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2181 gtk_menu_append(GTK_MENU(menu), menuitem);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2182
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2183 gaim_new_item_from_stock(menu, _("_Close"), "gtk-close", GTK_SIGNAL_FUNC(close_callback), c, 0, 0, NULL);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2184
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2185 /* The Options menu */
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2186 menu = gtk_menu_new();
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2187
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2188 menuitem = gaim_new_item(NULL, _("Options"));
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2189 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2190 gtk_menu_bar_append(GTK_MENU_BAR(menubar), menuitem);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2191
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2192 /* Logging */
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2193 menuitem = gtk_check_menu_item_new_with_mnemonic(_("Enable _Logging"));
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2194 c->log_button = menuitem; /* We should save this */
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2195
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2196 state_lock = 1;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2197 if (find_log_info(c->name))
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2198 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(menuitem), TRUE);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2199 else
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2200 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(menuitem), FALSE);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2201 state_lock = 0;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2202
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2203 gtk_signal_connect(GTK_OBJECT(menuitem), "toggled", GTK_SIGNAL_FUNC(toggle_loggle), c);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2204
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2205 /* Sounds */
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2206
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2207 gtk_menu_append(GTK_MENU(menu), menuitem);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2208
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2209 menuitem = gtk_check_menu_item_new_with_mnemonic(_("Enable _Sounds"));
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2210 c->makesound = 1;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2211 gtk_signal_connect(GTK_OBJECT(menuitem), "toggled", GTK_SIGNAL_FUNC(toggle_sound), c);
3679
6addfadafda1 [gaim-migrate @ 3809]
Rob Flynn <gaim@robflynn.com>
parents: 3678
diff changeset
2212 state_lock = 1;
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2213 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE);
3679
6addfadafda1 [gaim-migrate @ 3809]
Rob Flynn <gaim@robflynn.com>
parents: 3678
diff changeset
2214 state_lock = 0;
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2215 gtk_menu_append(GTK_MENU(menu), menuitem);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2216
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2217
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2218
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2219 /* Now set the current values or something */
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2220 gtk_widget_set_sensitive(GTK_WIDGET(c->log_button), (logging_options & OPT_LOG_CONVOS) ? FALSE : TRUE);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2221
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2222 gtk_widget_show_all(menubar);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2223
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2224 return menubar;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2225
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2226 }
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2227
3689
c78e0c031514 [gaim-migrate @ 3819]
Rob Flynn <gaim@robflynn.com>
parents: 3684
diff changeset
2228 GtkWidget *build_conv_toolbar(struct conversation *c)
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2229 {
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2230 GtkWidget *vbox;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2231 GtkWidget *hbox;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2232 GtkWidget *button;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2233 GtkWidget *sep;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2234 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2235 /*
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2236 c->toolbar = toolbar;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2237 c->bold = bold;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2238 c->strike = strike;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2239 c->italic = italic;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2240 c->underline = underline;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2241 c->log_button = wood;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2242 c->viewer_button = viewer;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2243 c->fgcolorbtn = fgcolorbtn;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2244 c->bgcolorbtn = bgcolorbtn;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2245 c->link = link;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2246 c->wood = wood;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2247 c->font = font;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2248 c->smiley = smiley;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2249 c->imagebtn = image;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2250 c->speaker = speaker;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2251 c->speaker_p = speaker_p;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2252 */
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2253
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2254 vbox = gtk_vbox_new(FALSE, 0);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2255 sep = gtk_hseparator_new();
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2256 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2257
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2258 hbox = gtk_hbox_new(FALSE, 5);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2259 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2260
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2261 /* Bold */
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2262 button = gaim_pixbuf_toolbar_button_from_stock("gtk-bold");
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2263 gtk_size_group_add_widget(sg, button);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2264 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2265 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(do_bold), c->entry);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2266 c->bold = button; /* We should remember this */
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2267
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2268 /* Italic */
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2269 button = gaim_pixbuf_toolbar_button_from_stock("gtk-italic");
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2270 gtk_size_group_add_widget(sg, button);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2271 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2272 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(do_italic), c->entry);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2273 c->italic = button; /* We should remember this */
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2274
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2275 /* Underline */
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2276 button = gaim_pixbuf_toolbar_button_from_stock("gtk-underline");
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2277 gtk_size_group_add_widget(sg, button);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2278 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2279 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(do_underline), c->entry);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2280 c->underline = button; /* We should remember this */
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2281
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2282 /* Sep */
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2283 sep = gtk_vseparator_new();
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2284 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2285
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2286 /* Increase font size */
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2287 button = gaim_pixbuf_toolbar_button_from_file("text_bigger.png");
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2288 gtk_size_group_add_widget(sg, button);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2289 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2290 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(do_big), c->entry);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2291
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2292 /* Normal Font Size */
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2293 button = gaim_pixbuf_toolbar_button_from_file("text_normal.png");
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2294 gtk_size_group_add_widget(sg, button);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2295 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2296 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(do_normal), c->entry);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2297 c->font = button; /* We should remember this */
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2298
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2299 /* Decrease font size */
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2300 button = gaim_pixbuf_toolbar_button_from_file("text_smaller.png");
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2301 gtk_size_group_add_widget(sg, button);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2302 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2303 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(do_small), c->entry);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2304
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2305 /* Sep */
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2306 sep = gtk_vseparator_new();
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2307 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2308
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2309 /* Font Color */
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2310 button = gaim_pixbuf_toolbar_button_from_stock("gtk-select-color");
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2311 gtk_size_group_add_widget(sg, button);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2312 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2313 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_fg_color), c);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2314 c->fgcolorbtn = button; /* We should remember this */
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2315
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2316 /* Font Color */
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2317 button = gaim_pixbuf_toolbar_button_from_stock("gtk-select-color");
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2318 gtk_size_group_add_widget(sg, button);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2319 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2320 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_bg_color), c);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2321 c->bgcolorbtn = button; /* We should remember this */
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2322
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2323
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2324 /* Sep */
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2325 sep = gtk_vseparator_new();
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2326 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2327
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2328 /* Insert IM Image */
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2329 button = gaim_pixbuf_toolbar_button_from_file("insert-image-small.png");
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2330 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(insert_image), c);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2331 gtk_size_group_add_widget(sg, button);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2332 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2333 c->imagebtn = button;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2334
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2335 /* Insert Link */
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2336 button = gaim_pixbuf_toolbar_button_from_file("insert-link-small.png");
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2337 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_link), c);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2338 gtk_size_group_add_widget(sg, button);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2339 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2340 c->link = button;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2341
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2342 /* Insert Smiley */
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2343 button = gaim_pixbuf_toolbar_button_from_file("insert-smiley-small.png");
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2344 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(insert_smiley), c);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2345 gtk_size_group_add_widget(sg, button);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2346 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2347 c->smiley = button;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2348
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2349 sep = gtk_hseparator_new();
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2350 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2351
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2352 gtk_widget_show_all(vbox);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2353
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2354 return vbox;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2355 }
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2356
1898
73d73939f698 [gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1889
diff changeset
2357 static void convo_sel_send(GtkObject *m, struct gaim_connection *c)
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2358 {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2359 struct conversation *cnv = gtk_object_get_user_data(m);
1898
73d73939f698 [gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1889
diff changeset
2360
73d73939f698 [gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1889
diff changeset
2361 if (cnv->gc == c)
73d73939f698 [gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1889
diff changeset
2362 return;
73d73939f698 [gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1889
diff changeset
2363
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2364 cnv->gc = c;
1340
1526caa87138 [gaim-migrate @ 1350]
Rob Flynn <gaim@robflynn.com>
parents: 1253
diff changeset
2365
2787
feea7103a235 [gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2773
diff changeset
2366 set_convo_title(cnv);
feea7103a235 [gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2773
diff changeset
2367
1342
84aef77f0add [gaim-migrate @ 1352]
Rob Flynn <gaim@robflynn.com>
parents: 1341
diff changeset
2368 update_buttons_by_protocol(cnv);
1898
73d73939f698 [gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1889
diff changeset
2369
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
2370 update_icon(cnv);
2231
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
2371 update_checkbox(cnv);
3050
200b8133616a [gaim-migrate @ 3063]
Rob Flynn <gaim@robflynn.com>
parents: 3048
diff changeset
2372 update_smilies(cnv);
3081
eb364675bbe4 [gaim-migrate @ 3095]
Rob Flynn <gaim@robflynn.com>
parents: 3060
diff changeset
2373 gaim_setup_imhtml_smileys(cnv->text);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2374 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2375
2379
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
2376 int set_dispstyle(int chat)
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
2377 {
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
2378 int dispstyle;
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
2379
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
2380 if (chat) {
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
2381 switch (chat_options & (OPT_CHAT_BUTTON_TEXT | OPT_CHAT_BUTTON_XPM)) {
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
2382 case OPT_CHAT_BUTTON_TEXT:
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
2383 dispstyle = 1;
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
2384 break;
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
2385 case OPT_CHAT_BUTTON_XPM:
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
2386 dispstyle = 0;
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
2387 break;
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
2388 default: /* both or neither */
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
2389 dispstyle = 2;
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
2390 break;
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
2391 }
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
2392 } else {
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
2393 switch (im_options & (OPT_IM_BUTTON_TEXT | OPT_IM_BUTTON_XPM)) {
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
2394 case OPT_IM_BUTTON_TEXT:
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
2395 dispstyle = 1;
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
2396 break;
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
2397 case OPT_IM_BUTTON_XPM:
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
2398 dispstyle = 0;
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
2399 break;
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
2400 default: /* both or neither */
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
2401 dispstyle = 2;
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
2402 break;
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
2403 }
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
2404 }
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
2405 return dispstyle;
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
2406 }
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2375
diff changeset
2407
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2408 void update_convo_add_button(struct conversation *c)
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2409 {
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2410 int dispstyle = set_dispstyle(0);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2411 GtkWidget *parent = c->add->parent;
1663
0f7d2284296f [gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1647
diff changeset
2412 gboolean rebuild = FALSE;
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
2413
1352
2e8213567278 [gaim-migrate @ 1362]
Rob Flynn <gaim@robflynn.com>
parents: 1343
diff changeset
2414 if (find_buddy(c->gc, c->name)) {
1663
0f7d2284296f [gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1647
diff changeset
2415 if (!gtk_object_get_user_data(GTK_OBJECT(c->add))) {
0f7d2284296f [gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1647
diff changeset
2416 gtk_widget_destroy(c->add);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2417 c->add = gaim_pixbuf_button_from_stock(_("Remove"), "gtk-remove", GAIM_BUTTON_VERTICAL);
1663
0f7d2284296f [gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1647
diff changeset
2418 rebuild = TRUE;
0f7d2284296f [gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1647
diff changeset
2419 }
0f7d2284296f [gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1647
diff changeset
2420 if (c->gc) {
1352
2e8213567278 [gaim-migrate @ 1362]
Rob Flynn <gaim@robflynn.com>
parents: 1343
diff changeset
2421 if (c->gc->prpl->remove_buddy == NULL)
2e8213567278 [gaim-migrate @ 1362]
Rob Flynn <gaim@robflynn.com>
parents: 1343
diff changeset
2422 gtk_widget_set_sensitive(c->add, FALSE);
2e8213567278 [gaim-migrate @ 1362]
Rob Flynn <gaim@robflynn.com>
parents: 1343
diff changeset
2423 else
2e8213567278 [gaim-migrate @ 1362]
Rob Flynn <gaim@robflynn.com>
parents: 1343
diff changeset
2424 gtk_widget_set_sensitive(c->add, TRUE);
1663
0f7d2284296f [gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1647
diff changeset
2425 } else
0f7d2284296f [gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1647
diff changeset
2426 gtk_widget_set_sensitive(c->add, FALSE);
0f7d2284296f [gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1647
diff changeset
2427 gtk_object_set_user_data(GTK_OBJECT(c->add), c);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2428 } else {
1663
0f7d2284296f [gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1647
diff changeset
2429 if (gtk_object_get_user_data(GTK_OBJECT(c->add))) {
0f7d2284296f [gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1647
diff changeset
2430 gtk_widget_destroy(c->add);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2431 c->add = gaim_pixbuf_button_from_stock(_("Add"), "gtk-add", GAIM_BUTTON_VERTICAL);
1663
0f7d2284296f [gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1647
diff changeset
2432 rebuild = TRUE;
0f7d2284296f [gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1647
diff changeset
2433 }
0f7d2284296f [gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1647
diff changeset
2434 if (c->gc) {
1352
2e8213567278 [gaim-migrate @ 1362]
Rob Flynn <gaim@robflynn.com>
parents: 1343
diff changeset
2435 if (c->gc->prpl->add_buddy == NULL)
2e8213567278 [gaim-migrate @ 1362]
Rob Flynn <gaim@robflynn.com>
parents: 1343
diff changeset
2436 gtk_widget_set_sensitive(c->add, FALSE);
2e8213567278 [gaim-migrate @ 1362]
Rob Flynn <gaim@robflynn.com>
parents: 1343
diff changeset
2437 else
2e8213567278 [gaim-migrate @ 1362]
Rob Flynn <gaim@robflynn.com>
parents: 1343
diff changeset
2438 gtk_widget_set_sensitive(c->add, TRUE);
1663
0f7d2284296f [gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1647
diff changeset
2439 } else
0f7d2284296f [gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1647
diff changeset
2440 gtk_widget_set_sensitive(c->add, FALSE);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2441 }
1352
2e8213567278 [gaim-migrate @ 1362]
Rob Flynn <gaim@robflynn.com>
parents: 1343
diff changeset
2442
1663
0f7d2284296f [gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1647
diff changeset
2443 if (rebuild) {
0f7d2284296f [gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1647
diff changeset
2444 gtk_signal_connect(GTK_OBJECT(c->add), "clicked", GTK_SIGNAL_FUNC(add_callback), c);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2445 gtk_box_pack_start(GTK_BOX(parent), c->add, FALSE, FALSE, 0);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2446 gtk_box_reorder_child(GTK_BOX(parent), c->add, 3);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2447 gtk_button_set_relief(GTK_BUTTON(c->add), GTK_RELIEF_NONE);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2448 gtk_size_group_add_widget(c->sg, c->add);
1663
0f7d2284296f [gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1647
diff changeset
2449 gtk_widget_show(c->add);
0f7d2284296f [gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1647
diff changeset
2450 }
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2451 }
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2452
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2453 static void create_convo_menu(struct conversation *cnv)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2454 {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2455 GtkWidget *menu, *opt;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2456 GSList *g = connections;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2457 struct gaim_connection *c;
1235
a9cf2f61a7b1 [gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1228
diff changeset
2458 char buf[2048];
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2459
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2460 if (g_slist_length(g) < 2)
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2461 gtk_widget_hide(cnv->menu->parent);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2462 else {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2463 menu = gtk_menu_new();
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2464
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2465 while (g) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2466 c = (struct gaim_connection *)g->data;
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3554
diff changeset
2467 g_snprintf(buf, sizeof buf, "%s (%s)", c->username, c->prpl->name);
1235
a9cf2f61a7b1 [gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1228
diff changeset
2468 opt = gtk_menu_item_new_with_label(buf);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2469 gtk_object_set_user_data(GTK_OBJECT(opt), cnv);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2470 gtk_signal_connect(GTK_OBJECT(opt), "activate",
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2471 GTK_SIGNAL_FUNC(convo_sel_send), c);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2472 gtk_widget_show(opt);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2473 gtk_menu_append(GTK_MENU(menu), opt);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2474 g = g->next;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2475 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2476
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2477 gtk_option_menu_remove_menu(GTK_OPTION_MENU(cnv->menu));
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2478 gtk_option_menu_set_menu(GTK_OPTION_MENU(cnv->menu), menu);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2479 gtk_option_menu_set_history(GTK_OPTION_MENU(cnv->menu), 0);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2480
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2481 gtk_widget_show(cnv->menu);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2482 gtk_widget_show(cnv->menu->parent);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2483 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2484 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2485
2111
109669b3887e [gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2109
diff changeset
2486 void redo_convo_menus()
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2487 {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2488 GList *c = conversations;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2489 struct conversation *C;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2490
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2491 while (c) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2492 C = (struct conversation *)c->data;
1898
73d73939f698 [gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1889
diff changeset
2493 c = c->next;
73d73939f698 [gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1889
diff changeset
2494
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2495 create_convo_menu(C);
993
eacd93d0089a [gaim-migrate @ 1003]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2496
2111
109669b3887e [gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2109
diff changeset
2497 if (g_slist_find(connections, C->gc))
2487
43a75ca5b909 [gaim-migrate @ 2500]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2483
diff changeset
2498 set_convo_gc(C, C->gc);
43a75ca5b909 [gaim-migrate @ 2500]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2483
diff changeset
2499 else
43a75ca5b909 [gaim-migrate @ 2500]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2483
diff changeset
2500 set_convo_gc(C, connections ? connections->data : NULL);
2111
109669b3887e [gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2109
diff changeset
2501 }
109669b3887e [gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2109
diff changeset
2502 }
109669b3887e [gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2109
diff changeset
2503
109669b3887e [gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2109
diff changeset
2504 void convo_menu_remove(struct gaim_connection *gc)
109669b3887e [gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2109
diff changeset
2505 {
109669b3887e [gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2109
diff changeset
2506 GList *c = conversations;
109669b3887e [gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2109
diff changeset
2507 struct conversation *C;
109669b3887e [gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2109
diff changeset
2508
109669b3887e [gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2109
diff changeset
2509 while (c) {
109669b3887e [gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2109
diff changeset
2510 C = (struct conversation *)c->data;
109669b3887e [gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2109
diff changeset
2511 c = c->next;
2109
3110ea142888 [gaim-migrate @ 2119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2104
diff changeset
2512
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
2513 remove_icon(C);
2231
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
2514 remove_checkbox(C);
1898
73d73939f698 [gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1889
diff changeset
2515 }
73d73939f698 [gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1889
diff changeset
2516 }
73d73939f698 [gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1889
diff changeset
2517
73d73939f698 [gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1889
diff changeset
2518 void set_convo_gc(struct conversation *c, struct gaim_connection *gc)
73d73939f698 [gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1889
diff changeset
2519 {
2722
abecab600451 [gaim-migrate @ 2735]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2706
diff changeset
2520 if (gc)
abecab600451 [gaim-migrate @ 2735]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2706
diff changeset
2521 gtk_option_menu_set_history(GTK_OPTION_MENU(c->menu), g_slist_index(connections, gc));
abecab600451 [gaim-migrate @ 2735]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2706
diff changeset
2522
1898
73d73939f698 [gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1889
diff changeset
2523 if (c->gc == gc)
73d73939f698 [gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1889
diff changeset
2524 return;
993
eacd93d0089a [gaim-migrate @ 1003]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
2525
1898
73d73939f698 [gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1889
diff changeset
2526 c->gc = gc;
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
2527
2787
feea7103a235 [gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2773
diff changeset
2528 set_convo_title(c);
1898
73d73939f698 [gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1889
diff changeset
2529 update_buttons_by_protocol(c);
73d73939f698 [gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1889
diff changeset
2530
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
2531 update_icon(c);
2231
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
2532 update_checkbox(c);
3051
7cd6eadd575f [gaim-migrate @ 3064]
Rob Flynn <gaim@robflynn.com>
parents: 3050
diff changeset
2533 update_smilies(c);
3081
eb364675bbe4 [gaim-migrate @ 3095]
Rob Flynn <gaim@robflynn.com>
parents: 3060
diff changeset
2534 gaim_setup_imhtml_smileys(c->text);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2535 }
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
2536
1340
1526caa87138 [gaim-migrate @ 1350]
Rob Flynn <gaim@robflynn.com>
parents: 1253
diff changeset
2537 void update_buttons_by_protocol(struct conversation *c)
1526caa87138 [gaim-migrate @ 1350]
Rob Flynn <gaim@robflynn.com>
parents: 1253
diff changeset
2538 {
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
2539 if (!c->gc) {
2619
536198196dc6 [gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2582
diff changeset
2540 if (c->info)
536198196dc6 [gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2582
diff changeset
2541 gtk_widget_set_sensitive(c->info, FALSE);
536198196dc6 [gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2582
diff changeset
2542 if (c->send)
536198196dc6 [gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2582
diff changeset
2543 gtk_widget_set_sensitive(c->send, FALSE);
536198196dc6 [gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2582
diff changeset
2544 if (c->warn)
536198196dc6 [gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2582
diff changeset
2545 gtk_widget_set_sensitive(c->warn, FALSE);
536198196dc6 [gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2582
diff changeset
2546 if (c->block)
536198196dc6 [gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2582
diff changeset
2547 gtk_widget_set_sensitive(c->block, FALSE);
536198196dc6 [gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2582
diff changeset
2548 if (c->add)
536198196dc6 [gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2582
diff changeset
2549 gtk_widget_set_sensitive(c->add, FALSE);
2546
d392e9b867e9 [gaim-migrate @ 2559]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2541
diff changeset
2550 if (c->whisper)
d392e9b867e9 [gaim-migrate @ 2559]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2541
diff changeset
2551 gtk_widget_set_sensitive(c->whisper, FALSE);
d392e9b867e9 [gaim-migrate @ 2559]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2541
diff changeset
2552 if (c->invite)
d392e9b867e9 [gaim-migrate @ 2559]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2541
diff changeset
2553 gtk_widget_set_sensitive(c->invite, FALSE);
1352
2e8213567278 [gaim-migrate @ 1362]
Rob Flynn <gaim@robflynn.com>
parents: 1343
diff changeset
2554 return;
2e8213567278 [gaim-migrate @ 1362]
Rob Flynn <gaim@robflynn.com>
parents: 1343
diff changeset
2555 }
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
2556
1532
249a770bebd7 [gaim-migrate @ 1542]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
2557 if (c->gc->prpl->get_info == NULL && c->info)
1340
1526caa87138 [gaim-migrate @ 1350]
Rob Flynn <gaim@robflynn.com>
parents: 1253
diff changeset
2558 gtk_widget_set_sensitive(c->info, FALSE);
1398
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1370
diff changeset
2559 else if (c->info)
1340
1526caa87138 [gaim-migrate @ 1350]
Rob Flynn <gaim@robflynn.com>
parents: 1253
diff changeset
2560 gtk_widget_set_sensitive(c->info, TRUE);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2561 /*
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2562 if (!c->is_chat && c->gc->prpl->file_transfer_out)
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2563 gtk_widget_set_sensitive(c->sendfile_btn, TRUE);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2564 else
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2565 gtk_widget_set_sensitive(c->sendfile_btn, FALSE);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2566 */
2094
be10a1243ed7 [gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2090
diff changeset
2567 if (c->is_chat) {
be10a1243ed7 [gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2090
diff changeset
2568 if (c->gc->prpl->chat_send == NULL && c->send)
be10a1243ed7 [gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2090
diff changeset
2569 gtk_widget_set_sensitive(c->send, FALSE);
be10a1243ed7 [gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2090
diff changeset
2570 else
be10a1243ed7 [gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2090
diff changeset
2571 gtk_widget_set_sensitive(c->send, TRUE);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2572
3044
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
2573 gtk_widget_set_sensitive(c->imagebtn, FALSE);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2574 gtk_widget_set_sensitive(c->image_menubtn, FALSE);
2094
be10a1243ed7 [gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2090
diff changeset
2575 } else {
be10a1243ed7 [gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2090
diff changeset
2576 if (c->gc->prpl->send_im == NULL && c->send)
be10a1243ed7 [gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2090
diff changeset
2577 gtk_widget_set_sensitive(c->send, FALSE);
be10a1243ed7 [gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2090
diff changeset
2578 else
be10a1243ed7 [gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2090
diff changeset
2579 gtk_widget_set_sensitive(c->send, TRUE);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2580 if (c->gc->prpl->options & OPT_PROTO_IM_IMAGE) {
3044
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
2581 gtk_widget_set_sensitive(c->imagebtn, TRUE);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2582 gtk_widget_set_sensitive(c->image_menubtn, TRUE);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2583 }
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2584 else {
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2585 gtk_widget_set_sensitive(c->image_menubtn, FALSE);
3044
e68e2ba82310 [gaim-migrate @ 3057]
Sean Egan <seanegan@gmail.com>
parents: 3035
diff changeset
2586 gtk_widget_set_sensitive(c->imagebtn, FALSE);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2587 }
2094
be10a1243ed7 [gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2090
diff changeset
2588 }
1341
6ec45c45157c [gaim-migrate @ 1351]
Rob Flynn <gaim@robflynn.com>
parents: 1340
diff changeset
2589
1343
a0d89bdc733e [gaim-migrate @ 1353]
Rob Flynn <gaim@robflynn.com>
parents: 1342
diff changeset
2590 if (c->gc->prpl->warn == NULL && c->warn)
1341
6ec45c45157c [gaim-migrate @ 1351]
Rob Flynn <gaim@robflynn.com>
parents: 1340
diff changeset
2591 gtk_widget_set_sensitive(c->warn, FALSE);
1398
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1370
diff changeset
2592 else if (c->warn)
1341
6ec45c45157c [gaim-migrate @ 1351]
Rob Flynn <gaim@robflynn.com>
parents: 1340
diff changeset
2593 gtk_widget_set_sensitive(c->warn, TRUE);
6ec45c45157c [gaim-migrate @ 1351]
Rob Flynn <gaim@robflynn.com>
parents: 1340
diff changeset
2594
1343
a0d89bdc733e [gaim-migrate @ 1353]
Rob Flynn <gaim@robflynn.com>
parents: 1342
diff changeset
2595 if (c->gc->prpl->add_permit == NULL && c->block)
1341
6ec45c45157c [gaim-migrate @ 1351]
Rob Flynn <gaim@robflynn.com>
parents: 1340
diff changeset
2596 gtk_widget_set_sensitive(c->block, FALSE);
1398
f6b0cf1f4c3b [gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1370
diff changeset
2597 else if (c->block)
1341
6ec45c45157c [gaim-migrate @ 1351]
Rob Flynn <gaim@robflynn.com>
parents: 1340
diff changeset
2598 gtk_widget_set_sensitive(c->block, TRUE);
6ec45c45157c [gaim-migrate @ 1351]
Rob Flynn <gaim@robflynn.com>
parents: 1340
diff changeset
2599
1343
a0d89bdc733e [gaim-migrate @ 1353]
Rob Flynn <gaim@robflynn.com>
parents: 1342
diff changeset
2600 if (c->add)
a0d89bdc733e [gaim-migrate @ 1353]
Rob Flynn <gaim@robflynn.com>
parents: 1342
diff changeset
2601 update_convo_add_button(c);
a0d89bdc733e [gaim-migrate @ 1353]
Rob Flynn <gaim@robflynn.com>
parents: 1342
diff changeset
2602
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
2603 if (c->whisper) {
1343
a0d89bdc733e [gaim-migrate @ 1353]
Rob Flynn <gaim@robflynn.com>
parents: 1342
diff changeset
2604 if (c->gc->prpl->chat_whisper == NULL)
a0d89bdc733e [gaim-migrate @ 1353]
Rob Flynn <gaim@robflynn.com>
parents: 1342
diff changeset
2605 gtk_widget_set_sensitive(c->whisper, FALSE);
a0d89bdc733e [gaim-migrate @ 1353]
Rob Flynn <gaim@robflynn.com>
parents: 1342
diff changeset
2606 else
a0d89bdc733e [gaim-migrate @ 1353]
Rob Flynn <gaim@robflynn.com>
parents: 1342
diff changeset
2607 gtk_widget_set_sensitive(c->whisper, TRUE);
a0d89bdc733e [gaim-migrate @ 1353]
Rob Flynn <gaim@robflynn.com>
parents: 1342
diff changeset
2608 }
a0d89bdc733e [gaim-migrate @ 1353]
Rob Flynn <gaim@robflynn.com>
parents: 1342
diff changeset
2609
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
2610 if (c->invite) {
1343
a0d89bdc733e [gaim-migrate @ 1353]
Rob Flynn <gaim@robflynn.com>
parents: 1342
diff changeset
2611 if (c->gc->prpl->chat_invite == NULL)
a0d89bdc733e [gaim-migrate @ 1353]
Rob Flynn <gaim@robflynn.com>
parents: 1342
diff changeset
2612 gtk_widget_set_sensitive(c->invite, FALSE);
a0d89bdc733e [gaim-migrate @ 1353]
Rob Flynn <gaim@robflynn.com>
parents: 1342
diff changeset
2613 else
a0d89bdc733e [gaim-migrate @ 1353]
Rob Flynn <gaim@robflynn.com>
parents: 1342
diff changeset
2614 gtk_widget_set_sensitive(c->invite, TRUE);
a0d89bdc733e [gaim-migrate @ 1353]
Rob Flynn <gaim@robflynn.com>
parents: 1342
diff changeset
2615 }
1340
1526caa87138 [gaim-migrate @ 1350]
Rob Flynn <gaim@robflynn.com>
parents: 1253
diff changeset
2616 }
1526caa87138 [gaim-migrate @ 1350]
Rob Flynn <gaim@robflynn.com>
parents: 1253
diff changeset
2617
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2618 void convo_switch(GtkNotebook *notebook, GtkWidget *page, gint page_num, gpointer data)
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2619 {
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2620 GtkWidget *label = gtk_notebook_get_tab_label(notebook,
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2621 gtk_notebook_get_nth_page(notebook, page_num));
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2622 GtkStyle *style;
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2623 struct conversation *c;
3677
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
2624
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2625 if ((convo_options & OPT_CONVO_COMBINE) &&
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2626 (im_options & OPT_IM_ONE_WINDOW) &&
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2627 (chat_options & OPT_CHAT_ONE_WINDOW)) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2628 int len = g_list_length(conversations);
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2629 if (page_num < len)
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2630 c = g_list_nth_data(conversations, page_num);
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2631 else
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2632 c = g_list_nth_data(chats, page_num - len);
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2633 } else if (GTK_WIDGET(notebook) == convo_notebook)
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2634 c = g_list_nth_data(conversations, page_num);
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2635 else
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2636 c = g_list_nth_data(chats, page_num);
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2637 if (c && c->window && c->entry)
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2638 gtk_window_set_focus(GTK_WINDOW(c->window), c->entry);
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2639 if (!GTK_WIDGET_REALIZED(label))
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2640 return;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2641 if (c->unseen == -1) return;
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2642 style = gtk_style_new();
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2722
diff changeset
2643 gtk_style_set_font(style, gdk_font_ref(gtk_style_get_font(label->style)));
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2644 gtk_widget_set_style(label, style);
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2645 gtk_style_unref(style);
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2646 if (c)
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2647 c->unseen = 0;
3677
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
2648
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
2649 if (!c->is_chat) {
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
2650 GtkWidget *menubar;
3683
e3583f15dfe0 [gaim-migrate @ 3813]
Rob Flynn <gaim@robflynn.com>
parents: 3682
diff changeset
2651 GtkWidget *parent = convo_notebook->parent;
3677
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
2652
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
2653 gtk_widget_freeze_child_notify(GTK_WIDGET(c->window));
3683
e3583f15dfe0 [gaim-migrate @ 3813]
Rob Flynn <gaim@robflynn.com>
parents: 3682
diff changeset
2654
e3583f15dfe0 [gaim-migrate @ 3813]
Rob Flynn <gaim@robflynn.com>
parents: 3682
diff changeset
2655 if (convo_menubar != NULL)
e3583f15dfe0 [gaim-migrate @ 3813]
Rob Flynn <gaim@robflynn.com>
parents: 3682
diff changeset
2656 gtk_widget_destroy(convo_menubar);
e3583f15dfe0 [gaim-migrate @ 3813]
Rob Flynn <gaim@robflynn.com>
parents: 3682
diff changeset
2657
3677
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
2658 menubar = build_conv_menubar(c);
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
2659 gtk_box_pack_start(GTK_BOX(parent), menubar, FALSE, TRUE, 0);
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
2660 gtk_box_reorder_child(GTK_BOX(parent), menubar, 0);
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
2661 convo_menubar = menubar;
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
2662
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
2663 gtk_widget_thaw_child_notify(GTK_WIDGET(c->window));
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
2664 } else {
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
2665 gtk_widget_destroy(convo_menubar);
3683
e3583f15dfe0 [gaim-migrate @ 3813]
Rob Flynn <gaim@robflynn.com>
parents: 3682
diff changeset
2666 convo_menubar = NULL;
3677
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
2667 }
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2668 }
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2669
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2670 void show_typing(struct conversation *c) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2671
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2672 if (c->is_chat) /* We shouldn't be getting typing notifications from chats. */
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2673 return;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2674 if (im_options & OPT_IM_ONE_WINDOW) { /* We'll make the tab green */
3003
2a1bae4efb92 [gaim-migrate @ 3016]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2675 GtkStyle *style;
2a1bae4efb92 [gaim-migrate @ 3016]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2676 GtkNotebook *notebook = GTK_NOTEBOOK(c->is_chat ? chat_notebook : convo_notebook);
2a1bae4efb92 [gaim-migrate @ 3016]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2677 int offs = ((convo_options & OPT_CONVO_COMBINE) &&
2a1bae4efb92 [gaim-migrate @ 3016]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2678 (im_options & OPT_IM_ONE_WINDOW) && c->is_chat) ?
2a1bae4efb92 [gaim-migrate @ 3016]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2679 g_list_length(conversations) : 0;
2a1bae4efb92 [gaim-migrate @ 3016]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2680 GList *ws = (c->is_chat ? chats : conversations);
2a1bae4efb92 [gaim-migrate @ 3016]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2681 GtkWidget *label = gtk_notebook_get_tab_label(notebook,
2a1bae4efb92 [gaim-migrate @ 3016]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2682 gtk_notebook_get_nth_page(notebook,
2a1bae4efb92 [gaim-migrate @ 3016]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2683 offs + g_list_index(ws, c)));
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2684 style = gtk_style_new();
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2685 if (!GTK_WIDGET_REALIZED(label))
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2686 gtk_widget_realize(label);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2687 gtk_style_set_font(style, gdk_font_ref(gtk_style_get_font(label->style)));
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2688 style->fg[0].red = 0x0000;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2689 style->fg[0].green = 0x9999;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2690 style->fg[0].blue = 0x0000;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2691 gtk_widget_set_style(label, style);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2692 debug_printf("setting style\n");
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2693 gtk_style_unref(style);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2694 c->unseen = -1;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2695 } else {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2696 GtkWindow *win = (GtkWindow *)c->window;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2697 char *buf;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2698 if (strstr(win->title, " [TYPING]"))
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2699 return;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2700 buf = g_malloc(strlen(win->title) + strlen(" [TYPING]") + 1);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2701 g_snprintf(buf,
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2702 strlen(win->title) + strlen(" [TYPING]") + 1, "%s [TYPING]",
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2703 win->title);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2704 gtk_window_set_title(win, buf);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2705 g_free(buf);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2706 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2707
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2708 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2709
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2710 /* This returns a boolean, so that it can timeout */
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2711 gboolean reset_typing(char *name) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2712 struct conversation *c = find_conversation(name);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2713 if (!c) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2714 g_free(name);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2715 return FALSE;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2716 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2717 /* Reset the title (if necessary) */
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2718 if (c->is_chat) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2719 g_free(name);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2720 c->typing_timeout = 0;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2721 return FALSE;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2722 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2723 if (!(im_options & OPT_IM_ONE_WINDOW)) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2724 GtkWindow *win = (GtkWindow*)c->window;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2725 char *new_title;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2726 if (strstr(win->title, " [TYPING]")) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2727 new_title = g_malloc(strlen(win->title) - strlen("[TYPING]"));
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2728 g_snprintf(new_title, strlen(win->title) - strlen("[TYPING]"), win->title);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2729 gtk_window_set_title(win, new_title);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2730 g_free(new_title);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2731
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2732 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2733 } else if (c->unseen == -1) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2734 GtkNotebook *notebook = GTK_NOTEBOOK(convo_notebook);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2735 int offs = ((convo_options & OPT_CONVO_COMBINE) &&
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2736 (im_options & OPT_IM_ONE_WINDOW) && c->is_chat) ?
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2737 g_list_length(conversations) : 0;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2738 GList *ws = (conversations);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2739 GtkWidget *label = gtk_notebook_get_tab_label(notebook,
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2740 gtk_notebook_get_nth_page(notebook,
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2741 offs + g_list_index(ws, c)));
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2742 GtkStyle *style;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2743 style = gtk_style_new();
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2744 if (!GTK_WIDGET_REALIZED(label))
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2745 gtk_widget_realize(label);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2746 gtk_style_set_font(style, gdk_font_ref(gtk_style_get_font(label->style)));
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2747 c->unseen = 0;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2748 gtk_widget_set_style(label, style);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2749 gtk_style_unref(style);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2750 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2751 g_free(name);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2752 c->typing_timeout = 0;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2753 return FALSE;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2754 }
1340
1526caa87138 [gaim-migrate @ 1350]
Rob Flynn <gaim@robflynn.com>
parents: 1253
diff changeset
2755
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
2756 void show_conv(struct conversation *c)
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
2757 {
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
2758 GtkWidget *win;
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2759 GtkWidget *cont;
615
9f168ba28ac2 [gaim-migrate @ 625]
Todd Kulesza <fflewddur>
parents: 611
diff changeset
2760 GtkWidget *text;
9f168ba28ac2 [gaim-migrate @ 625]
Todd Kulesza <fflewddur>
parents: 611
diff changeset
2761 GtkWidget *sw;
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
2762 GtkWidget *send;
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
2763 GtkWidget *info;
615
9f168ba28ac2 [gaim-migrate @ 625]
Todd Kulesza <fflewddur>
parents: 611
diff changeset
2764 GtkWidget *warn;
9f168ba28ac2 [gaim-migrate @ 625]
Todd Kulesza <fflewddur>
parents: 611
diff changeset
2765 GtkWidget *block;
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
2766 GtkWidget *close;
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
2767 GtkWidget *entry;
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
2768 GtkWidget *bbox;
615
9f168ba28ac2 [gaim-migrate @ 625]
Todd Kulesza <fflewddur>
parents: 611
diff changeset
2769 GtkWidget *vbox;
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
2770 GtkWidget *vbox2;
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
2771 GtkWidget *paned;
615
9f168ba28ac2 [gaim-migrate @ 625]
Todd Kulesza <fflewddur>
parents: 611
diff changeset
2772 GtkWidget *add;
623
83b0caceea9a [gaim-migrate @ 633]
Rob Flynn <gaim@robflynn.com>
parents: 615
diff changeset
2773 GtkWidget *toolbar;
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2774 GtkWidget *hbox;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2775 GtkWidget *label;
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2776 GtkWidget *menubar;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2777
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2778 c->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
2779
1219
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2780 c->font_dialog = NULL;
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
2781 c->fg_color_dialog = NULL;
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
2782 c->bg_color_dialog = NULL;
1219
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2783 c->smiley_dialog = NULL;
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2784 c->link_dialog = NULL;
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2785 c->log_dialog = NULL;
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2786 sprintf(c->fontface, "%s", fontface);
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2787 c->hasfont = 0;
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2788 c->bgcol = bgcolor;
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2789 c->hasbg = 0;
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2790 c->fgcol = fgcolor;
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2791 c->hasfg = 0;
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2792
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
2793 if (im_options & OPT_IM_ONE_WINDOW) {
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2794 if (!all_convos) {
3677
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
2795 GtkWidget *testidea;
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2796 win = all_convos = c->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2797 if ((convo_options & OPT_CONVO_COMBINE) && (chat_options & OPT_CHAT_ONE_WINDOW))
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2798 all_chats = all_convos;
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2799 gtk_window_set_wmclass(GTK_WINDOW(win), "conversation", "Gaim");
2335
2c595fc5f1f8 [gaim-migrate @ 2348]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
2800 gtk_window_set_policy(GTK_WINDOW(win), TRUE, TRUE, FALSE);
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2801 gtk_container_border_width(GTK_CONTAINER(win), 0);
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2802 gtk_widget_realize(win);
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2803 gtk_window_set_title(GTK_WINDOW(win), _("Gaim - Conversations"));
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2804 gtk_signal_connect(GTK_OBJECT(win), "delete_event",
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2805 GTK_SIGNAL_FUNC(delete_all_convo), NULL);
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2806
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2807 convo_notebook = gtk_notebook_new();
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2808 if ((convo_options & OPT_CONVO_COMBINE) && (chat_options & OPT_CHAT_ONE_WINDOW))
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2809 chat_notebook = convo_notebook;
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
2810 if (im_options & OPT_IM_SIDE_TAB) {
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
2811 if (im_options & OPT_IM_BR_TAB) {
1757
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
2812 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(convo_notebook),
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
2813 GTK_POS_RIGHT);
1757
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
2814 } else {
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
2815 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(convo_notebook),
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
2816 GTK_POS_LEFT);
1757
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
2817 }
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
2818 } else {
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
2819 if (im_options & OPT_IM_BR_TAB) {
1757
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
2820 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(convo_notebook),
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
2821 GTK_POS_BOTTOM);
1757
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
2822 } else {
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
2823 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(convo_notebook),
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
2824 GTK_POS_TOP);
1757
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
2825 }
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
2826 }
1596
f5845007e3bc [gaim-migrate @ 1606]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1595
diff changeset
2827 gtk_notebook_set_scrollable(GTK_NOTEBOOK(convo_notebook), TRUE);
1597
c1a8a7c40424 [gaim-migrate @ 1607]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1596
diff changeset
2828 gtk_notebook_popup_enable(GTK_NOTEBOOK(convo_notebook));
3677
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
2829
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
2830 testidea = gtk_vbox_new(FALSE, 0);
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
2831
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
2832 menubar = build_conv_menubar(c);
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
2833 gtk_box_pack_start(GTK_BOX(testidea), menubar, FALSE, TRUE, 0);
3683
e3583f15dfe0 [gaim-migrate @ 3813]
Rob Flynn <gaim@robflynn.com>
parents: 3682
diff changeset
2834 gtk_box_pack_start(GTK_BOX(testidea), convo_notebook, TRUE, TRUE, 0);
e3583f15dfe0 [gaim-migrate @ 3813]
Rob Flynn <gaim@robflynn.com>
parents: 3682
diff changeset
2835 gtk_widget_show(testidea);
e3583f15dfe0 [gaim-migrate @ 3813]
Rob Flynn <gaim@robflynn.com>
parents: 3682
diff changeset
2836 gtk_widget_show(convo_notebook);
3677
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
2837 convo_menubar = menubar;
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
2838
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
2839 gtk_container_add(GTK_CONTAINER(win), testidea);
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2840 gtk_signal_connect(GTK_OBJECT(convo_notebook), "switch-page",
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2841 GTK_SIGNAL_FUNC(convo_switch), NULL);
3683
e3583f15dfe0 [gaim-migrate @ 3813]
Rob Flynn <gaim@robflynn.com>
parents: 3682
diff changeset
2842
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2843 } else
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2844 win = c->window = all_convos;
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2845
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2846 cont = gtk_vbox_new(FALSE, 5);
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2847 gtk_container_set_border_width(GTK_CONTAINER(cont), 5);
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2848 /* this doesn't matter since we're resetting the name once we're out of the if */
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2849 gtk_notebook_insert_page(GTK_NOTEBOOK(convo_notebook), cont, gtk_label_new(c->name),
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
2850 g_list_index(conversations, c));
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2851 gtk_widget_show(cont);
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2852 } else {
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2853 cont = win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2854 c->window = win;
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2855 gtk_object_set_user_data(GTK_OBJECT(win), c);
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2856 gtk_window_set_wmclass(GTK_WINDOW(win), "conversation", "Gaim");
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2857 gtk_window_set_policy(GTK_WINDOW(win), TRUE, TRUE, TRUE);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2858 gtk_container_border_width(GTK_CONTAINER(win), 0);
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2859 gtk_widget_realize(win);
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2860 gtk_signal_connect(GTK_OBJECT(win), "delete_event",
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2861 GTK_SIGNAL_FUNC(delete_event_convo), c);
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2862 }
2787
feea7103a235 [gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2773
diff changeset
2863 set_convo_title(c);
623
83b0caceea9a [gaim-migrate @ 633]
Rob Flynn <gaim@robflynn.com>
parents: 615
diff changeset
2864
1219
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2865 paned = gtk_vpaned_new();
1228
6773043cf9f6 [gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1227
diff changeset
2866 gtk_paned_set_gutter_size(GTK_PANED(paned), 15);
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2867 gtk_container_add(GTK_CONTAINER(cont), paned);
1219
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2868 gtk_widget_show(paned);
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2869
1228
6773043cf9f6 [gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1227
diff changeset
2870 vbox = gtk_vbox_new(FALSE, 5);
1219
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2871 gtk_paned_pack1(GTK_PANED(paned), vbox, FALSE, TRUE);
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2872 gtk_widget_show(vbox);
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
2873
3677
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
2874 if (!(im_options & OPT_IM_ONE_WINDOW)) {
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
2875 menubar = build_conv_menubar(c);
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
2876 gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0);
7571943d6851 [gaim-migrate @ 3807]
Rob Flynn <gaim@robflynn.com>
parents: 3671
diff changeset
2877 }
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2878
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
2879 sw = gtk_scrolled_window_new(NULL, NULL);
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
2880 c->sw = sw;
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
2881 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
1228
6773043cf9f6 [gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1227
diff changeset
2882 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0);
1813
998a6a032874 [gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1780
diff changeset
2883 gtk_widget_set_usize(sw, conv_size.width, conv_size.height);
1219
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2884 gtk_widget_show(sw);
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2885
1428
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
2886 text = gtk_imhtml_new(NULL, NULL);
1219
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2887 c->text = text;
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2888 gtk_container_add(GTK_CONTAINER(sw), text);
1428
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
2889 GTK_LAYOUT(text)->hadjustment->step_increment = 10.0;
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
2890 GTK_LAYOUT(text)->vadjustment->step_increment = 10.0;
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
2891 if (convo_options & OPT_CONVO_SHOW_TIME)
1428
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
2892 gtk_imhtml_show_comments(GTK_IMHTML(text), TRUE);
1815
f15d449b3167 [gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1813
diff changeset
2893 gaim_setup_imhtml(text);
1219
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2894 gtk_widget_show(text);
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2895
1228
6773043cf9f6 [gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1227
diff changeset
2896 vbox2 = gtk_vbox_new(FALSE, 5);
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
2897 gtk_paned_pack2(GTK_PANED(paned), vbox2, FALSE, FALSE);
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
2898 gtk_widget_show(vbox2);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2899
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2900 hbox = gtk_hbox_new(FALSE, 0);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2901 gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2902 gtk_widget_show(hbox);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2903
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2904 label = gtk_label_new(_("Send message as: "));
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2905 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2906 gtk_widget_show(label);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2907
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2908 c->menu = gtk_option_menu_new();
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2909 gtk_box_pack_start(GTK_BOX(hbox), c->menu, FALSE, FALSE, 5);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2910 gtk_widget_show(c->menu);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2911
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 936
diff changeset
2912 create_convo_menu(c);
1219
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2913
1898
73d73939f698 [gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1889
diff changeset
2914 c->lbox = gtk_hbox_new(FALSE, 0);
73d73939f698 [gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1889
diff changeset
2915 gtk_box_pack_start(GTK_BOX(vbox2), c->lbox, FALSE, FALSE, 0);
73d73939f698 [gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1889
diff changeset
2916 gtk_widget_show(c->lbox);
73d73939f698 [gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1889
diff changeset
2917
1227
25611364a504 [gaim-migrate @ 1237]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1219
diff changeset
2918 entry = gtk_text_new(NULL, NULL);
25611364a504 [gaim-migrate @ 1237]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1219
diff changeset
2919 c->entry = entry;
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
2920 if (!(im_options & OPT_IM_ONE_WINDOW))
1594
ac8eddd16e89 [gaim-migrate @ 1604]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1592
diff changeset
2921 gtk_window_set_focus(GTK_WINDOW(c->window), c->entry);
1227
25611364a504 [gaim-migrate @ 1237]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1219
diff changeset
2922
3689
c78e0c031514 [gaim-migrate @ 3819]
Rob Flynn <gaim@robflynn.com>
parents: 3684
diff changeset
2923 toolbar = build_conv_toolbar(c);
1228
6773043cf9f6 [gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1227
diff changeset
2924 gtk_box_pack_start(GTK_BOX(vbox2), toolbar, FALSE, FALSE, 0);
1219
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2925
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2926 gtk_object_set_user_data(GTK_OBJECT(entry), c);
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
2927 gtk_text_set_editable(GTK_TEXT(entry), TRUE);
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
2928 gtk_text_set_word_wrap(GTK_TEXT(entry), TRUE);
3304
7c5325f460de [gaim-migrate @ 3322]
Sean Egan <seanegan@gmail.com>
parents: 3300
diff changeset
2929
3338
bf8d5c825297 [gaim-migrate @ 3357]
Jim Seymour <jseymour>
parents: 3311
diff changeset
2930 gtk_widget_set_usize(entry, conv_size.width - 20, MAX(conv_size.entry_height, 25));
1813
998a6a032874 [gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1780
diff changeset
2931
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
2932 gtk_signal_connect(GTK_OBJECT(entry), "activate", GTK_SIGNAL_FUNC(send_callback), c);
1219
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2933 gtk_signal_connect(GTK_OBJECT(entry), "key_press_event", GTK_SIGNAL_FUNC(keypress_callback), c);
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
2934 gtk_signal_connect(GTK_OBJECT(entry), "key_press_event", GTK_SIGNAL_FUNC(entry_key_pressed),
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
2935 entry);
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
2936 if (convo_options & OPT_CONVO_CHECK_SPELLING)
1117
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
2937 gtkspell_attach(GTK_TEXT(c->entry));
1228
6773043cf9f6 [gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1227
diff changeset
2938 gtk_box_pack_start(GTK_BOX(vbox2), entry, TRUE, TRUE, 0);
1219
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2939 gtk_widget_show(entry);
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2940
1898
73d73939f698 [gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1889
diff changeset
2941 c->bbox = bbox = gtk_hbox_new(FALSE, 5);
1228
6773043cf9f6 [gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1227
diff changeset
2942 gtk_box_pack_start(GTK_BOX(vbox2), bbox, FALSE, FALSE, 0);
1219
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2943 gtk_widget_show(bbox);
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2944
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2945 /* I'm leaving this here just incase we want to bring this back. I'd rather not have the close
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2946 * button any more. If we do, though, it needs to be on the left side. I might bring it back and put
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2947 * it on that side. */
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2948
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2949 /*
1219
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2950 close = picture_button2(win, _("Close"), cancel_xpm, dispstyle);
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2951 c->close = close;
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2952 gtk_object_set_user_data(GTK_OBJECT(close), c);
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2953 gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(close_callback), c);
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2954 gtk_box_pack_end(GTK_BOX(bbox), close, dispstyle, dispstyle, 0);
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
2955 gtk_widget_show(close);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2956
1219
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2957 c->sep1 = gtk_vseparator_new();
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2958 gtk_box_pack_end(GTK_BOX(bbox), c->sep1, dispstyle, dispstyle, 0);
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2959 gtk_widget_show(c->sep1);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2960 */
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2961
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2962 /* Put the send button on the right */
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2963 send = gaim_pixbuf_button_from_stock(_("Send"), "gtk-convert", GAIM_BUTTON_VERTICAL);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2964 c->send = send;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2965 gtk_signal_connect(GTK_OBJECT(send), "clicked", GTK_SIGNAL_FUNC(send_callback), c);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2966 gtk_box_pack_end(GTK_BOX(bbox), send, FALSE, FALSE, 0);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2967 gtk_widget_show(send);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2968
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2969 c->sep2 = gtk_vseparator_new();
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2970 gtk_box_pack_end(GTK_BOX(bbox), c->sep2, FALSE, TRUE, 0);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2971 gtk_widget_show(c->sep2);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2972
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2973 /* And put the other buttons on the left */
1219
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2974
1663
0f7d2284296f [gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1647
diff changeset
2975 if (c->gc && find_buddy(c->gc, c->name) != NULL) {
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2976 add = gaim_pixbuf_button_from_stock(_("Remove"), "gtk-remove", GAIM_BUTTON_VERTICAL);
1663
0f7d2284296f [gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1647
diff changeset
2977 gtk_object_set_user_data(GTK_OBJECT(add), c);
0f7d2284296f [gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1647
diff changeset
2978 } else
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2979 add = gaim_pixbuf_button_from_stock(_("Add"), "gtk-add", GAIM_BUTTON_VERTICAL);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2980
1219
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2981 c->add = add;
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2982 gtk_signal_connect(GTK_OBJECT(add), "clicked", GTK_SIGNAL_FUNC(add_callback), c);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2983 gtk_box_pack_start(GTK_BOX(bbox), add, FALSE, FALSE, 0);
1219
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2984 gtk_widget_show(add);
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2985
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2986 warn = gaim_pixbuf_button_from_stock(_("Warn"), "gtk-dialog-warning", GAIM_BUTTON_VERTICAL);
1219
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2987 c->warn = warn;
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2988 gtk_signal_connect(GTK_OBJECT(warn), "clicked", GTK_SIGNAL_FUNC(warn_callback), c);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2989 gtk_box_pack_start(GTK_BOX(bbox), warn, FALSE, FALSE, 0);
1219
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2990 gtk_widget_show(warn);
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2991
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2992 info = gaim_pixbuf_button_from_stock(_("Info"), "gtk-find", GAIM_BUTTON_VERTICAL);
1219
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2993 c->info = info;
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2994 gtk_signal_connect(GTK_OBJECT(info), "clicked", GTK_SIGNAL_FUNC(info_callback), c);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2995 gtk_box_pack_start(GTK_BOX(bbox), info, FALSE, FALSE, 0);
1219
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2996 gtk_widget_show(info);
2528fc35aa32 [gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1215
diff changeset
2997
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2998
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
2999 block = gaim_pixbuf_button_from_stock(_("Block"), "gtk-stop", GAIM_BUTTON_VERTICAL);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
3000 c->block = block;
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
3001 gtk_signal_connect(GTK_OBJECT(block), "clicked", GTK_SIGNAL_FUNC(block_callback), c);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
3002 gtk_box_pack_start(GTK_BOX(bbox), block, FALSE, FALSE, 0);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
3003 gtk_widget_show(block);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
3004
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
3005 /* I don't know if these should have borders. They look kind of dumb
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
3006 * with borders. */
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
3007 gtk_button_set_relief(GTK_BUTTON(info), GTK_RELIEF_NONE);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
3008 gtk_button_set_relief(GTK_BUTTON(add), GTK_RELIEF_NONE);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
3009 gtk_button_set_relief(GTK_BUTTON(warn), GTK_RELIEF_NONE);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
3010 gtk_button_set_relief(GTK_BUTTON(send), GTK_RELIEF_NONE);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
3011 gtk_button_set_relief(GTK_BUTTON(block), GTK_RELIEF_NONE);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
3012
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
3013 gtk_size_group_add_widget(c->sg, info);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
3014 gtk_size_group_add_widget(c->sg, add);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
3015 gtk_size_group_add_widget(c->sg, warn);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
3016 gtk_size_group_add_widget(c->sg, send);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
3017 gtk_size_group_add_widget(c->sg, block);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
3018
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
3019 gtk_box_reorder_child(GTK_BOX(bbox), c->warn, 1);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
3020 gtk_box_reorder_child(GTK_BOX(bbox), c->block, 2);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
3021 gtk_box_reorder_child(GTK_BOX(bbox), c->add, 3);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
3022 gtk_box_reorder_child(GTK_BOX(bbox), c->info, 4);
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
3023
666
71ea550c22ac [gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 661
diff changeset
3024
1340
1526caa87138 [gaim-migrate @ 1350]
Rob Flynn <gaim@robflynn.com>
parents: 1253
diff changeset
3025 update_buttons_by_protocol(c);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
3026
3470
2f8f4f1dac98 [gaim-migrate @ 3521]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
3027 if (!(im_options & OPT_IM_ONE_WINDOW))
2f8f4f1dac98 [gaim-migrate @ 3521]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
3028 gtk_widget_grab_focus(c->entry);
66
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3029 gtk_widget_show(win);
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3030 }
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3031
eb2151d7e88a [gaim-migrate @ 76]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3032
1253
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
3033 void toggle_spellchk()
8342d3aab1f1 [gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
3034 {
1117
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
3035 GList *cnv = conversations;
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
3036 GSList *cht;
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
3037 struct conversation *c;
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
3038 GSList *con = connections;
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
3039 struct gaim_connection *gc;
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
3040
3209
265a3c9d0557 [gaim-migrate @ 3226]
Sean Egan <seanegan@gmail.com>
parents: 3205
diff changeset
3041 if (convo_options & OPT_CONVO_CHECK_SPELLING){
265a3c9d0557 [gaim-migrate @ 3226]
Sean Egan <seanegan@gmail.com>
parents: 3205
diff changeset
3042 /*If ispell fails to start, start aspell. This is the way that
265a3c9d0557 [gaim-migrate @ 3226]
Sean Egan <seanegan@gmail.com>
parents: 3205
diff changeset
3043 Gabber does it. -- lorien420@myrealbox.com */
265a3c9d0557 [gaim-migrate @ 3226]
Sean Egan <seanegan@gmail.com>
parents: 3205
diff changeset
3044 if (gtkspell_start(NULL, ispell_cmd)<0){
265a3c9d0557 [gaim-migrate @ 3226]
Sean Egan <seanegan@gmail.com>
parents: 3205
diff changeset
3045 debug_printf("gtkspell failed to start when using ispell\n");
265a3c9d0557 [gaim-migrate @ 3226]
Sean Egan <seanegan@gmail.com>
parents: 3205
diff changeset
3046 if (gtkspell_start(NULL, aspell_cmd)<0){
265a3c9d0557 [gaim-migrate @ 3226]
Sean Egan <seanegan@gmail.com>
parents: 3205
diff changeset
3047 debug_printf("gtkspell failed to start when using aspell\n");
265a3c9d0557 [gaim-migrate @ 3226]
Sean Egan <seanegan@gmail.com>
parents: 3205
diff changeset
3048 } else
265a3c9d0557 [gaim-migrate @ 3226]
Sean Egan <seanegan@gmail.com>
parents: 3205
diff changeset
3049 debug_printf("gtkspell started with aspell\n");
265a3c9d0557 [gaim-migrate @ 3226]
Sean Egan <seanegan@gmail.com>
parents: 3205
diff changeset
3050 } else {
265a3c9d0557 [gaim-migrate @ 3226]
Sean Egan <seanegan@gmail.com>
parents: 3205
diff changeset
3051 debug_printf("gtkspell started with ispell\n");
265a3c9d0557 [gaim-migrate @ 3226]
Sean Egan <seanegan@gmail.com>
parents: 3205
diff changeset
3052 }
265a3c9d0557 [gaim-migrate @ 3226]
Sean Egan <seanegan@gmail.com>
parents: 3205
diff changeset
3053 }
2460
049822b93239 [gaim-migrate @ 2473]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2449
diff changeset
3054
1117
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
3055 while (cnv) {
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
3056 c = (struct conversation *)cnv->data;
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
3057 if (convo_options & OPT_CONVO_CHECK_SPELLING)
1117
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
3058 gtkspell_attach(GTK_TEXT(c->entry));
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
3059 else
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
3060 gtkspell_detach(GTK_TEXT(c->entry));
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
3061 cnv = cnv->next;
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
3062 }
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
3063
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
3064 while (con) {
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
3065 gc = (struct gaim_connection *)con->data;
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
3066 cht = gc->buddy_chats;
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
3067 while (cht) {
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
3068 c = (struct conversation *)cht->data;
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
3069 if (convo_options & OPT_CONVO_CHECK_SPELLING)
1117
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
3070 gtkspell_attach(GTK_TEXT(c->entry));
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
3071 else
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
3072 gtkspell_detach(GTK_TEXT(c->entry));
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
3073 cht = cht->next;
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
3074 }
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
3075 con = con->next;
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
3076 }
2460
049822b93239 [gaim-migrate @ 2473]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2449
diff changeset
3077
049822b93239 [gaim-migrate @ 2473]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2449
diff changeset
3078 if (!(convo_options & OPT_CONVO_CHECK_SPELLING))
049822b93239 [gaim-migrate @ 2473]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2449
diff changeset
3079 gtkspell_stop();
1117
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1103
diff changeset
3080 }
1428
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3081
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3082 void toggle_timestamps()
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3083 {
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3084 GList *cnv = conversations;
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3085 GSList *cht;
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3086 struct conversation *c;
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3087 GSList *con = connections;
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3088 struct gaim_connection *gc;
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3089
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3090 while (cnv) {
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3091 c = (struct conversation *)cnv->data;
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
3092 if (convo_options & OPT_CONVO_SHOW_TIME)
1428
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3093 gtk_imhtml_show_comments(GTK_IMHTML(c->text), TRUE);
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3094 else
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3095 gtk_imhtml_show_comments(GTK_IMHTML(c->text), FALSE);
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3096 cnv = cnv->next;
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3097 }
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3098
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3099 while (con) {
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3100 gc = (struct gaim_connection *)con->data;
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3101 cht = gc->buddy_chats;
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3102 while (cht) {
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3103 c = (struct conversation *)cht->data;
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
3104 if (convo_options & OPT_CONVO_SHOW_TIME)
1428
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3105 gtk_imhtml_show_comments(GTK_IMHTML(c->text), TRUE);
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3106 else
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3107 gtk_imhtml_show_comments(GTK_IMHTML(c->text), FALSE);
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3108 cht = cht->next;
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3109 }
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3110 con = con->next;
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3111 }
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3112 }
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3113
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3114 void toggle_smileys()
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3115 {
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3116 GList *cnv = conversations;
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3117 GSList *cht;
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3118 struct conversation *c;
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3119 GSList *con = connections;
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3120 struct gaim_connection *gc;
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3121
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3122 while (cnv) {
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3123 c = (struct conversation *)cnv->data;
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
3124 if (convo_options & OPT_CONVO_SHOW_SMILEY)
1428
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3125 gtk_imhtml_show_smileys(GTK_IMHTML(c->text), TRUE);
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3126 else
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3127 gtk_imhtml_show_smileys(GTK_IMHTML(c->text), FALSE);
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3128 cnv = cnv->next;
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3129 }
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3130
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3131 while (con) {
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3132 gc = (struct gaim_connection *)con->data;
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3133 cht = gc->buddy_chats;
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3134 while (cht) {
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3135 c = (struct conversation *)cht->data;
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
3136 if (convo_options & OPT_CONVO_SHOW_SMILEY)
1428
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3137 gtk_imhtml_show_smileys(GTK_IMHTML(c->text), TRUE);
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3138 else
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3139 gtk_imhtml_show_smileys(GTK_IMHTML(c->text), FALSE);
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3140 cht = cht->next;
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3141 }
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3142 con = con->next;
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3143 }
00b3d02a2168 [gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1414
diff changeset
3144 }
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3145
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3146 void im_tabize()
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3147 {
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3148 /* evil, evil i tell you! evil! */
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
3149 if (im_options & OPT_IM_ONE_WINDOW) {
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3150 GList *x = conversations;
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3151 if ((convo_options & OPT_CONVO_COMBINE) && (chat_options & OPT_CHAT_ONE_WINDOW)) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3152 all_convos = all_chats;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3153 convo_notebook = chat_notebook;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3154 }
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3155 while (x) {
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3156 struct conversation *c = x->data;
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3157 GtkWidget *imhtml, *win;
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3158
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3159 imhtml = c->text;
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3160 win = c->window;
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3161 remove_icon(c);
2231
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
3162 remove_checkbox(c);
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3163 show_conv(c);
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3164 gtk_widget_destroy(c->text);
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3165 gtk_widget_reparent(imhtml, c->sw);
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3166 c->text = imhtml;
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3167 gtk_widget_destroy(win);
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3168 update_icon(c);
2231
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
3169 update_checkbox(c);
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3170 set_convo_title(c);
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3171
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3172 x = x->next;
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3173 }
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3174 } else {
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3175 GList *x, *m;
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3176 x = m = conversations;
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3177 conversations = NULL;
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3178 while (x) {
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3179 struct conversation *c = x->data;
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3180 GtkWidget *imhtml;
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3181
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3182 imhtml = c->text;
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3183 remove_icon(c);
2231
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
3184 remove_checkbox(c);
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3185 show_conv(c);
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3186 gtk_container_remove(GTK_CONTAINER(c->sw), c->text);
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3187 gtk_widget_reparent(imhtml, c->sw);
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3188 c->text = imhtml;
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3189 update_icon(c);
2231
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
3190 update_checkbox(c);
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3191 set_convo_title(c);
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3192
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3193 x = x->next;
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3194 }
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3195 conversations = m;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3196 if ((convo_options & OPT_CONVO_COMBINE) && (chat_options & OPT_CHAT_ONE_WINDOW)) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3197 if (chats) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3198 struct conversation *c;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3199 while (m) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3200 gtk_notebook_remove_page(GTK_NOTEBOOK(chat_notebook), 0);
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3201 m = m->next;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3202 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3203 c = chats->data;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3204 gtk_window_set_focus(GTK_WINDOW(c->window), c->entry);
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3205 } else {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3206 if (all_convos)
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3207 gtk_widget_destroy(all_convos);
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3208 all_chats = NULL;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3209 chat_notebook = NULL;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3210 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3211 } else if (all_convos)
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3212 gtk_widget_destroy(all_convos);
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3213 all_convos = NULL;
1757
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
3214 convo_notebook = NULL;
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3215 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3216 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3217
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3218 void convo_tabize()
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3219 {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3220 GList *x, *m;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3221 GtkWidget *tmp;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3222
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3223 if (!chats && !conversations)
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3224 return;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3225
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3226 if (convo_options & OPT_CONVO_COMBINE) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3227 if (!chats) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3228 all_chats = all_convos;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3229 chat_notebook = convo_notebook;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3230 return;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3231 } else if (!conversations) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3232 all_convos = all_chats;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3233 convo_notebook = chat_notebook;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3234 return;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3235 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3236 } else {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3237 if (!chats) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3238 all_chats = NULL;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3239 chat_notebook = NULL;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3240 return;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3241 } else if (!conversations) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3242 all_convos = NULL;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3243 convo_notebook = NULL;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3244 return;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3245 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3246 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3247
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3248 tmp = all_convos;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3249 if (convo_options & OPT_CONVO_COMBINE) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3250 all_convos = all_chats;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3251 convo_notebook = chat_notebook;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3252 } else {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3253 all_convos = NULL;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3254 convo_notebook = NULL;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3255 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3256 x = m = conversations;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3257 while (x) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3258 struct conversation *c = x->data;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3259 GtkWidget *imhtml;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3260
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3261 imhtml = c->text;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3262 remove_icon(c);
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3263 remove_checkbox(c);
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3264 show_conv(c);
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3265 gtk_container_remove(GTK_CONTAINER(c->sw), c->text);
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3266 gtk_widget_reparent(imhtml, c->sw);
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3267 c->text = imhtml;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3268 update_icon(c);
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3269 update_checkbox(c);
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3270
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3271 x = x->next;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3272 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3273
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3274 conversations = m;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3275 if (convo_options & OPT_CONVO_COMBINE) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3276 if (tmp)
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3277 gtk_widget_destroy(tmp);
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3278 } else {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3279 while (m) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3280 gtk_notebook_remove_page(GTK_NOTEBOOK(chat_notebook), 0);
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3281 m = m->next;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3282 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3283 }
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3284 m = conversations;
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3285 while (m) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3286 set_convo_title(m->data);
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3287 m = m->next;
1573
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3288 }
3a8bd72f431f [gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1532
diff changeset
3289 }
1587
69a004b5820a [gaim-migrate @ 1597]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1583
diff changeset
3290
2787
feea7103a235 [gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2773
diff changeset
3291 void set_convo_title(struct conversation *c)
1587
69a004b5820a [gaim-migrate @ 1597]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1583
diff changeset
3292 {
2787
feea7103a235 [gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2773
diff changeset
3293 struct buddy *b;
feea7103a235 [gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2773
diff changeset
3294 char *text;
feea7103a235 [gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2773
diff changeset
3295 int index;
feea7103a235 [gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2773
diff changeset
3296 GtkNotebook *nb;
feea7103a235 [gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2773
diff changeset
3297
feea7103a235 [gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2773
diff changeset
3298 if ((im_options & OPT_IM_ALIAS_TAB) && c->gc && ((b = find_buddy(c->gc, c->name)) != NULL))
feea7103a235 [gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2773
diff changeset
3299 text = b->show;
feea7103a235 [gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2773
diff changeset
3300 else
feea7103a235 [gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2773
diff changeset
3301 text = c->name;
feea7103a235 [gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2773
diff changeset
3302
2843
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3303 if (im_options & OPT_IM_ONE_WINDOW) {
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3304 nb = GTK_NOTEBOOK(convo_notebook);
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3305 index = g_list_index(conversations, c);
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3306 gtk_notebook_set_tab_label_text(nb, gtk_notebook_get_nth_page(nb, index), text);
87d11d2a7d59 [gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2834
diff changeset
3307 } else {
2834
66b1112d948f [gaim-migrate @ 2847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2832
diff changeset
3308 char buf[256];
3457
222e23f91092 [gaim-migrate @ 3505]
Sean Egan <seanegan@gmail.com>
parents: 3451
diff changeset
3309 if ((find_log_info(c->name)) || (c->is_chat && (logging_options & OPT_LOG_CHATS))
222e23f91092 [gaim-migrate @ 3505]
Sean Egan <seanegan@gmail.com>
parents: 3451
diff changeset
3310 || (!c->is_chat && (logging_options & OPT_LOG_CONVOS)))
2834
66b1112d948f [gaim-migrate @ 2847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2832
diff changeset
3311 g_snprintf(buf, sizeof(buf), LOG_CONVERSATION_TITLE, text);
66b1112d948f [gaim-migrate @ 2847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2832
diff changeset
3312 else
66b1112d948f [gaim-migrate @ 2847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2832
diff changeset
3313 g_snprintf(buf, sizeof(buf), CONVERSATION_TITLE, text);
66b1112d948f [gaim-migrate @ 2847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2832
diff changeset
3314 gtk_window_set_title(GTK_WINDOW(c->window), buf);
66b1112d948f [gaim-migrate @ 2847]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2832
diff changeset
3315 }
2787
feea7103a235 [gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2773
diff changeset
3316 }
feea7103a235 [gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2773
diff changeset
3317
feea7103a235 [gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2773
diff changeset
3318 void set_convo_titles()
feea7103a235 [gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2773
diff changeset
3319 {
feea7103a235 [gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2773
diff changeset
3320 GList *c = conversations;
feea7103a235 [gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2773
diff changeset
3321 while (c) {
feea7103a235 [gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2773
diff changeset
3322 set_convo_title(c->data);
feea7103a235 [gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2773
diff changeset
3323 c = c->next;
feea7103a235 [gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2773
diff changeset
3324 }
1587
69a004b5820a [gaim-migrate @ 1597]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1583
diff changeset
3325 }
1590
b4e54a752676 [gaim-migrate @ 1600]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1587
diff changeset
3326
b4e54a752676 [gaim-migrate @ 1600]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1587
diff changeset
3327 void raise_convo_tab(struct conversation *c)
b4e54a752676 [gaim-migrate @ 1600]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1587
diff changeset
3328 {
b4e54a752676 [gaim-migrate @ 1600]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1587
diff changeset
3329 gtk_notebook_set_page(GTK_NOTEBOOK(convo_notebook), g_list_index(conversations, c));
1617
f30f719e5933 [gaim-migrate @ 1627]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1608
diff changeset
3330 gdk_window_show(c->window->window);
1590
b4e54a752676 [gaim-migrate @ 1600]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1587
diff changeset
3331 }
1757
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
3332
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
3333 void update_im_tabs()
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
3334 {
1757
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
3335 if (!convo_notebook || !all_convos)
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
3336 return;
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
3337 if (im_options & OPT_IM_SIDE_TAB) {
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
3338 if (im_options & OPT_IM_BR_TAB) {
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
3339 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(convo_notebook), GTK_POS_RIGHT);
1757
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
3340 } else {
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
3341 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(convo_notebook), GTK_POS_LEFT);
1757
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
3342 }
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
3343 } else {
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
3344 if (im_options & OPT_IM_BR_TAB) {
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
3345 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(convo_notebook), GTK_POS_BOTTOM);
1757
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
3346 } else {
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
3347 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(convo_notebook), GTK_POS_TOP);
1757
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
3348 }
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
3349 }
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
3350 }
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
3351
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
3352 void update_chat_tabs()
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
3353 {
1757
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
3354 if (!chat_notebook || !all_chats)
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
3355 return;
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
3356 if (chat_options & OPT_CHAT_SIDE_TAB) {
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
3357 if (chat_options & OPT_CHAT_BR_TAB) {
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
3358 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(chat_notebook), GTK_POS_RIGHT);
1757
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
3359 } else {
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
3360 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(chat_notebook), GTK_POS_LEFT);
1757
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
3361 }
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
3362 } else {
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2303
diff changeset
3363 if (chat_options & OPT_CHAT_BR_TAB) {
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
3364 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(chat_notebook), GTK_POS_BOTTOM);
1757
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
3365 } else {
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
3366 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(chat_notebook), GTK_POS_TOP);
1757
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
3367 }
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
3368 }
3dfe4aefd366 [gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1735
diff changeset
3369 }
1759
e0f936b4c91a [gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1757
diff changeset
3370
e0f936b4c91a [gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1757
diff changeset
3371 void update_convo_color(gboolean fg)
e0f936b4c91a [gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1757
diff changeset
3372 {
e0f936b4c91a [gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1757
diff changeset
3373 GList *c = conversations;
e0f936b4c91a [gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1757
diff changeset
3374 struct conversation *b;
e0f936b4c91a [gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1757
diff changeset
3375
e0f936b4c91a [gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1757
diff changeset
3376 while (c) {
e0f936b4c91a [gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1757
diff changeset
3377 b = c->data;
e0f936b4c91a [gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1757
diff changeset
3378 c = c->next;
e0f936b4c91a [gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1757
diff changeset
3379 if (fg) {
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
3380 if (b->hasfg)
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
3381 continue;
1759
e0f936b4c91a [gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1757
diff changeset
3382 b->fgcol = fgcolor;
e0f936b4c91a [gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1757
diff changeset
3383 } else {
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
3384 if (b->hasbg)
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
3385 continue;
1759
e0f936b4c91a [gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1757
diff changeset
3386 b->bgcol = bgcolor;
e0f936b4c91a [gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1757
diff changeset
3387 }
e0f936b4c91a [gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1757
diff changeset
3388 }
e0f936b4c91a [gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1757
diff changeset
3389 }
e0f936b4c91a [gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1757
diff changeset
3390
e0f936b4c91a [gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1757
diff changeset
3391 void update_convo_font()
e0f936b4c91a [gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1757
diff changeset
3392 {
e0f936b4c91a [gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1757
diff changeset
3393 GList *c = conversations;
e0f936b4c91a [gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1757
diff changeset
3394 struct conversation *b;
e0f936b4c91a [gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1757
diff changeset
3395
e0f936b4c91a [gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1757
diff changeset
3396 while (c) {
e0f936b4c91a [gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1757
diff changeset
3397 b = c->data;
e0f936b4c91a [gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1757
diff changeset
3398 c = c->next;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
3399 if (b->hasfont)
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2363
diff changeset
3400 continue;
1759
e0f936b4c91a [gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1757
diff changeset
3401 sprintf(b->fontface, "%s", fontface);
e0f936b4c91a [gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1757
diff changeset
3402 }
e0f936b4c91a [gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1757
diff changeset
3403 }
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3404
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3405 #include <gdk-pixbuf/gdk-pixbuf.h>
2227
a93a6fe22330 [gaim-migrate @ 2237]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2213
diff changeset
3406
a93a6fe22330 [gaim-migrate @ 2237]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2213
diff changeset
3407 #define SCALE(x) ((gdk_pixbuf_animation_get_width(x) <= 48 && gdk_pixbuf_animation_get_height(x) <= 48) \
a93a6fe22330 [gaim-migrate @ 2237]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2213
diff changeset
3408 ? 48 : 50)
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3409
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3410 static gboolean redraw_icon(gpointer data)
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3411 {
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3412 struct conversation *c = data;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3413
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3414 GdkPixbuf *buf;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3415 GdkPixbuf *scale;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3416 GdkPixmap *pm;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3417 GdkBitmap *bm;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3418 gint delay;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3419
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3420 if (!g_list_find(conversations, c)) {
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3421 debug_printf("I think this is a bug.\n");
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3422 return FALSE;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3423 }
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3424
3367
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
3425 gdk_pixbuf_animation_iter_advance(c->iter, NULL);
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
3426 buf = gdk_pixbuf_animation_iter_get_pixbuf(c->iter);
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
3427 scale = gdk_pixbuf_scale_simple(buf,
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
3428 MAX(gdk_pixbuf_get_width(buf) * SCALE(c->anim) /
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
3429 gdk_pixbuf_animation_get_width(c->anim), 1),
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
3430 MAX(gdk_pixbuf_get_height(buf) * SCALE(c->anim) /
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
3431 gdk_pixbuf_animation_get_height(c->anim), 1),
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
3432 GDK_INTERP_NEAREST);
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
3433 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100);
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
3434 gdk_pixbuf_unref(scale);
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
3435 gtk_pixmap_set(GTK_PIXMAP(c->icon), pm, bm);
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
3436 gdk_pixmap_unref(pm);
3380
d59394b4c5a6 [gaim-migrate @ 3399]
Sean Egan <seanegan@gmail.com>
parents: 3374
diff changeset
3437 gtk_widget_queue_draw(c->icon);
3367
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
3438 if (bm)
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
3439 gdk_bitmap_unref(bm);
3380
d59394b4c5a6 [gaim-migrate @ 3399]
Sean Egan <seanegan@gmail.com>
parents: 3374
diff changeset
3440 delay = gdk_pixbuf_animation_iter_get_delay_time(c->iter) / 10;
3367
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
3441
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3442 c->icon_timer = gtk_timeout_add(delay * 10, redraw_icon, c);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3443 return FALSE;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3444 }
2499
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3445
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3446 static void stop_anim(GtkObject *obj, struct conversation *c)
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3447 {
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3448 if (c->icon_timer)
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3449 gtk_timeout_remove(c->icon_timer);
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3450 c->icon_timer = 0;
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3451 }
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3452
2513
6e52448f352a [gaim-migrate @ 2526]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2502
diff changeset
3453 static void start_anim(GtkObject *obj, struct conversation *c)
6e52448f352a [gaim-migrate @ 2526]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2502
diff changeset
3454 {
6e52448f352a [gaim-migrate @ 2526]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2502
diff changeset
3455 int delay;
3380
d59394b4c5a6 [gaim-migrate @ 3399]
Sean Egan <seanegan@gmail.com>
parents: 3374
diff changeset
3456 delay = gdk_pixbuf_animation_iter_get_delay_time(c->iter) / 10;
3097
58588d33a3ca [gaim-migrate @ 3111]
Sean Egan <seanegan@gmail.com>
parents: 3081
diff changeset
3457 if (c->anim)
58588d33a3ca [gaim-migrate @ 3111]
Sean Egan <seanegan@gmail.com>
parents: 3081
diff changeset
3458 c->icon_timer = gtk_timeout_add(delay * 10, redraw_icon, c);
2513
6e52448f352a [gaim-migrate @ 2526]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2502
diff changeset
3459 }
6e52448f352a [gaim-migrate @ 2526]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2502
diff changeset
3460
2499
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3461 static int des_save_icon(GtkObject *obj, GdkEvent *e, struct conversation *c)
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3462 {
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3463 gtk_widget_destroy(c->save_icon);
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3464 c->save_icon = NULL;
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3465 return TRUE;
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3466 }
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3467
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3468 static void do_save_icon(GtkObject *obj, struct conversation *c)
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3469 {
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3470 FILE *file;
3466
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3461
diff changeset
3471 const char *f = gtk_file_selection_get_filename(GTK_FILE_SELECTION(c->save_icon));
2499
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3472 if (file_is_dir(f, c->save_icon))
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3473 return;
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3474
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3475 file = fopen(f, "w");
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3476 if (file) {
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3477 int len;
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3478 void *data = get_icon_data(c->gc, normalize(c->name), &len);
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3479 if (data)
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3480 fwrite(data, 1, len, file);
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3481 fclose(file);
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3482 } else {
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3384
diff changeset
3483 do_error_dialog("Can't save icon file to disk", strerror(errno), GAIM_ERROR);
2499
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3484 }
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3485
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3486 gtk_widget_destroy(c->save_icon);
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3487 c->save_icon = NULL;
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3488 }
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3489
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3490 static void cancel_save_icon(GtkObject *obj, struct conversation *c)
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3491 {
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3492 gtk_widget_destroy(c->save_icon);
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3493 c->save_icon = NULL;
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3494 }
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3495
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3496 static void save_icon(GtkObject *obj, struct conversation *c)
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3497 {
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3498 char buf[BUF_LEN];
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3499
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3500 if (c->save_icon) {
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3501 gdk_window_raise(c->save_icon->window);
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3502 return;
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3503 }
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3504
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3505 c->save_icon = gtk_file_selection_new(_("Gaim - Save Icon"));
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3506 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(c->save_icon));
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3629
diff changeset
3507 g_snprintf(buf, BUF_LEN - 1, "%s" G_DIR_SEPARATOR_S "%s.icon", gaim_home_dir(), c->name);
2499
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3508 gtk_file_selection_set_filename(GTK_FILE_SELECTION(c->save_icon), buf);
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3509 gtk_signal_connect(GTK_OBJECT(c->save_icon), "delete_event",
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3510 GTK_SIGNAL_FUNC(des_save_icon), c);
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3511 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(c->save_icon)->ok_button), "clicked",
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3512 GTK_SIGNAL_FUNC(do_save_icon), c);
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3513 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(c->save_icon)->cancel_button), "clicked",
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3514 GTK_SIGNAL_FUNC(cancel_save_icon), c);
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3515
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3516 gtk_widget_show(c->save_icon);
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3517 }
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3518
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3519 static gboolean icon_menu(GtkObject *obj, GdkEventButton *e, struct conversation *c)
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3520 {
3250
0970eabdd8df [gaim-migrate @ 3268]
Jim Seymour <jseymour>
parents: 3209
diff changeset
3521 static GtkWidget *menu = NULL;
2499
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3522 GtkWidget *button;
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3523
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3524 if (e->button != 3)
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3525 return FALSE;
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3526 if (e->type != GDK_BUTTON_PRESS)
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3527 return FALSE;
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3528
3250
0970eabdd8df [gaim-migrate @ 3268]
Jim Seymour <jseymour>
parents: 3209
diff changeset
3529 /*
0970eabdd8df [gaim-migrate @ 3268]
Jim Seymour <jseymour>
parents: 3209
diff changeset
3530 * If a menu already exists, destroy it before creating a new one,
0970eabdd8df [gaim-migrate @ 3268]
Jim Seymour <jseymour>
parents: 3209
diff changeset
3531 * thus freeing-up the memory it occupied.
0970eabdd8df [gaim-migrate @ 3268]
Jim Seymour <jseymour>
parents: 3209
diff changeset
3532 */
0970eabdd8df [gaim-migrate @ 3268]
Jim Seymour <jseymour>
parents: 3209
diff changeset
3533 if(menu)
0970eabdd8df [gaim-migrate @ 3268]
Jim Seymour <jseymour>
parents: 3209
diff changeset
3534 gtk_widget_destroy(menu);
0970eabdd8df [gaim-migrate @ 3268]
Jim Seymour <jseymour>
parents: 3209
diff changeset
3535
2499
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3536 menu = gtk_menu_new();
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3537
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3538 if (c->icon_timer) {
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3539 button = gtk_menu_item_new_with_label(_("Disable Animation"));
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3540 gtk_signal_connect(GTK_OBJECT(button), "activate", GTK_SIGNAL_FUNC(stop_anim), c);
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3541 gtk_menu_append(GTK_MENU(menu), button);
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3542 gtk_widget_show(button);
3367
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
3543 }
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
3544 else if (c->anim && !(gdk_pixbuf_animation_is_static_image(c->anim)))
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
3545 {
2513
6e52448f352a [gaim-migrate @ 2526]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2502
diff changeset
3546 button = gtk_menu_item_new_with_label(_("Enable Animation"));
6e52448f352a [gaim-migrate @ 2526]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2502
diff changeset
3547 gtk_signal_connect(GTK_OBJECT(button), "activate", GTK_SIGNAL_FUNC(start_anim), c);
6e52448f352a [gaim-migrate @ 2526]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2502
diff changeset
3548 gtk_menu_append(GTK_MENU(menu), button);
6e52448f352a [gaim-migrate @ 2526]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2502
diff changeset
3549 gtk_widget_show(button);
2499
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3550 }
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3551
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3552 button = gtk_menu_item_new_with_label(_("Hide Icon"));
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3553 gtk_signal_connect_object(GTK_OBJECT(button), "activate",
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3554 GTK_SIGNAL_FUNC(remove_icon), (void *)c);
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3555 gtk_menu_append(GTK_MENU(menu), button);
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3556 gtk_widget_show(button);
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3557
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3558 button = gtk_menu_item_new_with_label(_("Save Icon As..."));
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3559 gtk_signal_connect(GTK_OBJECT(button), "activate", GTK_SIGNAL_FUNC(save_icon), c);
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3560 gtk_menu_append(GTK_MENU(menu), button);
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3561 gtk_widget_show(button);
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3562
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3563 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, e->button, e->time);
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3564
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3565 return TRUE;
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3566 }
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3567
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3568 void remove_icon(struct conversation *c)
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3569 {
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3570 if (c->icon)
2895
63cdece2348d [gaim-migrate @ 2908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2891
diff changeset
3571 gtk_container_remove(GTK_CONTAINER(c->bbox), c->icon->parent->parent);
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3572 c->icon = NULL;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3573 if (c->anim)
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3574 gdk_pixbuf_animation_unref(c->anim);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3575 c->anim = NULL;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3576 if (c->icon_timer)
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3577 gtk_timeout_remove(c->icon_timer);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3578 c->icon_timer = 0;
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3367
diff changeset
3579 if(c->iter)
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3367
diff changeset
3580 g_object_unref(c->iter);
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3581 }
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3582
3035
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 3033
diff changeset
3583 void update_smilies(struct conversation *c)
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 3033
diff changeset
3584 {
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 3033
diff changeset
3585 GSList *smilies;
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 3033
diff changeset
3586
3056
2379e9bb2fea [gaim-migrate @ 3069]
Rob Flynn <gaim@robflynn.com>
parents: 3051
diff changeset
3587 if (!c)
2379e9bb2fea [gaim-migrate @ 3069]
Rob Flynn <gaim@robflynn.com>
parents: 3051
diff changeset
3588 return;
2379e9bb2fea [gaim-migrate @ 3069]
Rob Flynn <gaim@robflynn.com>
parents: 3051
diff changeset
3589
2379e9bb2fea [gaim-migrate @ 3069]
Rob Flynn <gaim@robflynn.com>
parents: 3051
diff changeset
3590 if (!c->gc)
2379e9bb2fea [gaim-migrate @ 3069]
Rob Flynn <gaim@robflynn.com>
parents: 3051
diff changeset
3591 return;
2379e9bb2fea [gaim-migrate @ 3069]
Rob Flynn <gaim@robflynn.com>
parents: 3051
diff changeset
3592
3035
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 3033
diff changeset
3593 if (c->gc->prpl->smiley_list) {
3050
200b8133616a [gaim-migrate @ 3063]
Rob Flynn <gaim@robflynn.com>
parents: 3048
diff changeset
3594 gtk_imhtml_remove_smileys(GTK_IMHTML(c->text));
3035
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 3033
diff changeset
3595 smilies = c->gc->prpl->smiley_list();
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 3033
diff changeset
3596
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 3033
diff changeset
3597 while (smilies) {
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 3033
diff changeset
3598 struct _prpl_smiley *smile =
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 3033
diff changeset
3599 (struct _prpl_smiley *)smilies->data;
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 3033
diff changeset
3600
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 3033
diff changeset
3601 gtk_imhtml_associate_smiley(GTK_IMHTML(c->text), smile->key, smile->xpm);
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 3033
diff changeset
3602 smilies = g_slist_next(smilies);
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 3033
diff changeset
3603 }
3050
200b8133616a [gaim-migrate @ 3063]
Rob Flynn <gaim@robflynn.com>
parents: 3048
diff changeset
3604 } else {
200b8133616a [gaim-migrate @ 3063]
Rob Flynn <gaim@robflynn.com>
parents: 3048
diff changeset
3605 gtk_imhtml_reset_smileys(GTK_IMHTML(c->text));
3035
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 3033
diff changeset
3606 }
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 3033
diff changeset
3607 }
0f1766887ddd [gaim-migrate @ 3048]
Rob Flynn <gaim@robflynn.com>
parents: 3033
diff changeset
3608
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3609 void update_icon(struct conversation *c)
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3610 {
2521
f42fceb6a9ea [gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2513
diff changeset
3611 char filename[256];
f42fceb6a9ea [gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2513
diff changeset
3612 FILE *file;
3380
d59394b4c5a6 [gaim-migrate @ 3399]
Sean Egan <seanegan@gmail.com>
parents: 3374
diff changeset
3613 GError *err = NULL;
3466
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3461
diff changeset
3614
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3615 void *data;
3367
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
3616 int len, delay;
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3617
2521
f42fceb6a9ea [gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2513
diff changeset
3618 GdkPixbuf *buf;
f42fceb6a9ea [gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2513
diff changeset
3619
2499
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3620 GtkWidget *event;
2895
63cdece2348d [gaim-migrate @ 2908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2891
diff changeset
3621 GtkWidget *frame;
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3622 GdkPixbuf *scale;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3623 GdkPixmap *pm;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3624 GdkBitmap *bm;
2264
2993b6091a53 [gaim-migrate @ 2274]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
3625 int sf = 0;
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3626
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3627 if (!c)
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3628 return;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3629
2231
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
3630 remove_icon(c);
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
3631
2323
bde2481bb4db [gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
3632 if (im_options & OPT_IM_HIDE_ICONS)
bde2481bb4db [gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
3633 return;
bde2481bb4db [gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
3634
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3635 if (!c->gc)
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3636 return;
2195
d615f7e2d8c4 [gaim-migrate @ 2205]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2191
diff changeset
3637
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3638 data = get_icon_data(c->gc, normalize(c->name), &len);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3639 if (!data)
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3640 return;
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3641
2521
f42fceb6a9ea [gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2513
diff changeset
3642 /* this is such an evil hack, i don't know why i'm even considering it.
f42fceb6a9ea [gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2513
diff changeset
3643 * we'll do it differently when gdk-pixbuf-loader isn't leaky anymore. */
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3629
diff changeset
3644 g_snprintf(filename, sizeof(filename), "%s" G_DIR_SEPARATOR_S "gaimicon-%s.%d", g_get_tmp_dir(), c->name, getpid());
2521
f42fceb6a9ea [gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2513
diff changeset
3645 file = fopen(filename, "w");
f42fceb6a9ea [gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2513
diff changeset
3646 if (!file)
f42fceb6a9ea [gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2513
diff changeset
3647 return;
f42fceb6a9ea [gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2513
diff changeset
3648 fwrite(data, 1, len, file);
f42fceb6a9ea [gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2513
diff changeset
3649 fclose(file);
f42fceb6a9ea [gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2513
diff changeset
3650
3367
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
3651 c->anim = gdk_pixbuf_animation_new_from_file(filename, &err);
3380
d59394b4c5a6 [gaim-migrate @ 3399]
Sean Egan <seanegan@gmail.com>
parents: 3374
diff changeset
3652 if (err) {
d59394b4c5a6 [gaim-migrate @ 3399]
Sean Egan <seanegan@gmail.com>
parents: 3374
diff changeset
3653 debug_printf("Buddy icon error: %s\n", err->message);
d59394b4c5a6 [gaim-migrate @ 3399]
Sean Egan <seanegan@gmail.com>
parents: 3374
diff changeset
3654 g_error_free(err);
d59394b4c5a6 [gaim-migrate @ 3399]
Sean Egan <seanegan@gmail.com>
parents: 3374
diff changeset
3655 }
2521
f42fceb6a9ea [gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2513
diff changeset
3656 /* make sure we remove the file as soon as possible */
f42fceb6a9ea [gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2513
diff changeset
3657 unlink(filename);
f42fceb6a9ea [gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2513
diff changeset
3658
f42fceb6a9ea [gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2513
diff changeset
3659 if (!c->anim)
f42fceb6a9ea [gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2513
diff changeset
3660 return;
f42fceb6a9ea [gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2513
diff changeset
3661
3380
d59394b4c5a6 [gaim-migrate @ 3399]
Sean Egan <seanegan@gmail.com>
parents: 3374
diff changeset
3662 if (gdk_pixbuf_animation_is_static_image(c->anim)) {
d59394b4c5a6 [gaim-migrate @ 3399]
Sean Egan <seanegan@gmail.com>
parents: 3374
diff changeset
3663 c->iter = NULL;
d59394b4c5a6 [gaim-migrate @ 3399]
Sean Egan <seanegan@gmail.com>
parents: 3374
diff changeset
3664 delay = 0;
d59394b4c5a6 [gaim-migrate @ 3399]
Sean Egan <seanegan@gmail.com>
parents: 3374
diff changeset
3665 buf = gdk_pixbuf_animation_get_static_image(c->anim);
d59394b4c5a6 [gaim-migrate @ 3399]
Sean Egan <seanegan@gmail.com>
parents: 3374
diff changeset
3666 } else {
3367
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
3667 c->iter = gdk_pixbuf_animation_get_iter(c->anim, NULL);
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
3668 buf = gdk_pixbuf_animation_iter_get_pixbuf(c->iter);
3380
d59394b4c5a6 [gaim-migrate @ 3399]
Sean Egan <seanegan@gmail.com>
parents: 3374
diff changeset
3669 delay = gdk_pixbuf_animation_iter_get_delay_time(c->iter);
d59394b4c5a6 [gaim-migrate @ 3399]
Sean Egan <seanegan@gmail.com>
parents: 3374
diff changeset
3670 delay = delay / 10;
d59394b4c5a6 [gaim-migrate @ 3399]
Sean Egan <seanegan@gmail.com>
parents: 3374
diff changeset
3671 }
d59394b4c5a6 [gaim-migrate @ 3399]
Sean Egan <seanegan@gmail.com>
parents: 3374
diff changeset
3672 sf = SCALE(c->anim);
3367
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
3673 scale = gdk_pixbuf_scale_simple(buf,
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
3674 MAX(gdk_pixbuf_get_width(buf) * sf /
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
3675 gdk_pixbuf_animation_get_width(c->anim), 1),
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
3676 MAX(gdk_pixbuf_get_height(buf) * sf /
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
3677 gdk_pixbuf_animation_get_height(c->anim), 1),
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
3678 GDK_INTERP_NEAREST);
3380
d59394b4c5a6 [gaim-migrate @ 3399]
Sean Egan <seanegan@gmail.com>
parents: 3374
diff changeset
3679
d59394b4c5a6 [gaim-migrate @ 3399]
Sean Egan <seanegan@gmail.com>
parents: 3374
diff changeset
3680 if (delay)
d59394b4c5a6 [gaim-migrate @ 3399]
Sean Egan <seanegan@gmail.com>
parents: 3374
diff changeset
3681 c->icon_timer = gtk_timeout_add(delay * 10, redraw_icon, c);
3367
3b00d97d59aa [gaim-migrate @ 3386]
Sean Egan <seanegan@gmail.com>
parents: 3338
diff changeset
3682
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3683
2936
dd71bb88bc58 [gaim-migrate @ 2949]
Rob Flynn <gaim@robflynn.com>
parents: 2918
diff changeset
3684 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100);
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3685 gdk_pixbuf_unref(scale);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3686
2895
63cdece2348d [gaim-migrate @ 2908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2891
diff changeset
3687 frame = gtk_frame_new(NULL);
2936
dd71bb88bc58 [gaim-migrate @ 2949]
Rob Flynn <gaim@robflynn.com>
parents: 2918
diff changeset
3688 gtk_frame_set_shadow_type(GTK_FRAME(frame), bm ? GTK_SHADOW_NONE : GTK_SHADOW_IN);
2895
63cdece2348d [gaim-migrate @ 2908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2891
diff changeset
3689 gtk_box_pack_start(GTK_BOX(c->bbox), frame, FALSE, FALSE, 5);
3671
0f468c22c702 [gaim-migrate @ 3801]
Rob Flynn <gaim@robflynn.com>
parents: 3641
diff changeset
3690 gtk_box_reorder_child(GTK_BOX(c->bbox), frame, 0);
2895
63cdece2348d [gaim-migrate @ 2908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2891
diff changeset
3691 gtk_widget_show(frame);
63cdece2348d [gaim-migrate @ 2908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2891
diff changeset
3692
2499
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3693 event = gtk_event_box_new();
2895
63cdece2348d [gaim-migrate @ 2908]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2891
diff changeset
3694 gtk_container_add(GTK_CONTAINER(frame), event);
2499
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3695 gtk_signal_connect(GTK_OBJECT(event), "button-press-event", GTK_SIGNAL_FUNC(icon_menu), c);
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3696 gtk_widget_show(event);
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3697
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3698 c->icon = gtk_pixmap_new(pm, bm);
2264
2993b6091a53 [gaim-migrate @ 2274]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
3699 gtk_widget_set_usize(c->icon, sf, sf);
2499
933e139fd0d3 [gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2487
diff changeset
3700 gtk_container_add(GTK_CONTAINER(event), c->icon);
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3701 gtk_widget_show(c->icon);
3012
08327a2f25aa [gaim-migrate @ 3025]
Sean Egan <seanegan@gmail.com>
parents: 3003
diff changeset
3702 if(im_options & OPT_IM_NO_ANIMATION)
3013
47d0f8979fb1 [gaim-migrate @ 3026]
Sean Egan <seanegan@gmail.com>
parents: 3012
diff changeset
3703 stop_anim(NULL, c);
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3704 gdk_pixmap_unref(pm);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3705 if (bm)
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3706 gdk_bitmap_unref(bm);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3707 }
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3708
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3709 void got_new_icon(struct gaim_connection *gc, char *who)
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3710 {
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3711 struct conversation *c = find_conversation(who);
2245
31157c54fe6e [gaim-migrate @ 2255]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2239
diff changeset
3712 if (c && (c->gc == gc))
2191
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3713 update_icon(c);
657dbe515608 [gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2167
diff changeset
3714 }
2231
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
3715
2323
bde2481bb4db [gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
3716 void set_hide_icons()
bde2481bb4db [gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
3717 {
bde2481bb4db [gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
3718 GList *c = conversations;
bde2481bb4db [gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
3719 while (c) {
bde2481bb4db [gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
3720 update_icon(c->data);
bde2481bb4db [gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
3721 c = c->next;
bde2481bb4db [gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
3722 }
bde2481bb4db [gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
3723 }
bde2481bb4db [gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2313
diff changeset
3724
3013
47d0f8979fb1 [gaim-migrate @ 3026]
Sean Egan <seanegan@gmail.com>
parents: 3012
diff changeset
3725 void set_anim()
47d0f8979fb1 [gaim-migrate @ 3026]
Sean Egan <seanegan@gmail.com>
parents: 3012
diff changeset
3726 {
47d0f8979fb1 [gaim-migrate @ 3026]
Sean Egan <seanegan@gmail.com>
parents: 3012
diff changeset
3727 GList *c = conversations;
3097
58588d33a3ca [gaim-migrate @ 3111]
Sean Egan <seanegan@gmail.com>
parents: 3081
diff changeset
3728 if (im_options & OPT_IM_HIDE_ICONS)
58588d33a3ca [gaim-migrate @ 3111]
Sean Egan <seanegan@gmail.com>
parents: 3081
diff changeset
3729 return;
3013
47d0f8979fb1 [gaim-migrate @ 3026]
Sean Egan <seanegan@gmail.com>
parents: 3012
diff changeset
3730 while (c) {
47d0f8979fb1 [gaim-migrate @ 3026]
Sean Egan <seanegan@gmail.com>
parents: 3012
diff changeset
3731 if(im_options & OPT_IM_NO_ANIMATION)
47d0f8979fb1 [gaim-migrate @ 3026]
Sean Egan <seanegan@gmail.com>
parents: 3012
diff changeset
3732 stop_anim(NULL, c->data);
47d0f8979fb1 [gaim-migrate @ 3026]
Sean Egan <seanegan@gmail.com>
parents: 3012
diff changeset
3733 else
47d0f8979fb1 [gaim-migrate @ 3026]
Sean Egan <seanegan@gmail.com>
parents: 3012
diff changeset
3734 start_anim(NULL, c->data);
47d0f8979fb1 [gaim-migrate @ 3026]
Sean Egan <seanegan@gmail.com>
parents: 3012
diff changeset
3735 c = c->next;
47d0f8979fb1 [gaim-migrate @ 3026]
Sean Egan <seanegan@gmail.com>
parents: 3012
diff changeset
3736 }
47d0f8979fb1 [gaim-migrate @ 3026]
Sean Egan <seanegan@gmail.com>
parents: 3012
diff changeset
3737 }
47d0f8979fb1 [gaim-migrate @ 3026]
Sean Egan <seanegan@gmail.com>
parents: 3012
diff changeset
3738
2231
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
3739 static void remove_checkbox(struct conversation *c)
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
3740 {
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
3741 if (c->check)
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
3742 gtk_container_remove(GTK_CONTAINER(c->lbox), c->check);
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
3743 c->check = NULL;
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
3744 }
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
3745
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
3746 static void update_checkbox(struct conversation *c)
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
3747 {
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
3748 if (!c)
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
3749 return;
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
3750
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
3751 remove_checkbox(c);
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
3752
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
3753 if (!c->gc)
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
3754 return;
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
3755
2706
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2699
diff changeset
3756 if (!c->gc->checkbox)
2231
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
3757 return;
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
3758
2706
e841b14b5b89 [gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2699
diff changeset
3759 c->check = gtk_check_button_new_with_label(c->gc->checkbox);
2231
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
3760 gtk_box_pack_start(GTK_BOX(c->lbox), c->check, FALSE, FALSE, 5);
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
3761 gtk_widget_show(c->check);
8c4ff1a368bd [gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2227
diff changeset
3762 }