Mercurial > pidgin.yaz
annotate src/conversation.c @ 3756:08742bf8a7be
[gaim-migrate @ 3895]
This should work a bit better now. Changing protocols doesn't mess things
up in the account settings dialogs.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Sat, 19 Oct 2002 23:29:24 +0000 |
parents | ddc4bfd2c825 |
children | ac18a395eced |
rev | line source |
---|---|
66 | 1 /* |
2 * gaim | |
3 * | |
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 * | |
20 */ | |
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 | 25 #include <string.h> |
3630 | 26 #ifndef _WIN32 |
66 | 27 #include <sys/time.h> |
3630 | 28 #include <unistd.h> |
29 #include <gdk/gdkx.h> | |
30 #include <X11/Xlib.h> | |
31 #else | |
32 #ifdef small | |
33 #undef small | |
34 #endif | |
35 #endif /*_WIN32*/ | |
66 | 36 #include <sys/types.h> |
37 #include <sys/stat.h> | |
38 #include <stdio.h> | |
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 | 42 #include <gtk/gtk.h> |
1428
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
43 #include "gtkimhtml.h" |
66 | 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 | 48 |
3630 | 49 #ifdef _WIN32 |
3716
d7e83b4db191
[gaim-migrate @ 3849]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3705
diff
changeset
|
50 #include <process.h> /* fog getpid() */ |
d7e83b4db191
[gaim-migrate @ 3849]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3705
diff
changeset
|
51 #include <io.h> |
3630 | 52 #include "win32dep.h" |
53 #endif | |
54 | |
3716
d7e83b4db191
[gaim-migrate @ 3849]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3705
diff
changeset
|
55 /*#include "pixmaps/save_small.xpm"*/ |
604
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
56 |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
57 #include "pixmaps/luke03.xpm" |
610
cadb51c068cb
[gaim-migrate @ 620]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
58 #include "pixmaps/oneeye.xpm" |
1732
e5ba877f51f2
[gaim-migrate @ 1742]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1709
diff
changeset
|
59 #include "pixmaps/crazy4.xpm" |
1965 | 60 #include "pixmaps/mrt.xpm" |
2426 | 61 #include "pixmaps/download.xpm" |
2874
48123cba5a87
[gaim-migrate @ 2887]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2857
diff
changeset
|
62 #include "pixmaps/farted.xpm" |
604
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
63 |
2460
049822b93239
[gaim-migrate @ 2473]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2449
diff
changeset
|
64 static gchar *ispell_cmd[] = { "ispell", "-a", NULL }; |
3209 | 65 static gchar *aspell_cmd[] = { "aspell", "--sug-mode=fast","-a", NULL }; |
2460
049822b93239
[gaim-migrate @ 2473]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2449
diff
changeset
|
66 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
67 int state_lock = 0; |
66 | 68 |
69 GdkPixmap *dark_icon_pm = NULL; | |
70 GdkBitmap *dark_icon_bm = NULL; | |
71 | |
1608
e19a2cb4190c
[gaim-migrate @ 1618]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1597
diff
changeset
|
72 GtkWidget *all_convos = NULL; |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
73 GtkWidget *convo_notebook = NULL; |
3677 | 74 GtkWidget *convo_menubar = NULL; |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
75 |
2763
477a035d81e5
[gaim-migrate @ 2776]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2761
diff
changeset
|
76 char fontface[128] = { 0 }; |
3473 | 77 |
1441
5c67b8794991
[gaim-migrate @ 1451]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1440
diff
changeset
|
78 int fontsize = 3; |
885
db5f5c33e83f
[gaim-migrate @ 895]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
876
diff
changeset
|
79 extern GdkColor bgcolor; |
db5f5c33e83f
[gaim-migrate @ 895]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
876
diff
changeset
|
80 extern GdkColor fgcolor; |
66 | 81 |
82 void check_everything(GtkWidget *entry); | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
83 gboolean keypress_callback(GtkWidget *entry, GdkEventKey * event, struct conversation *c); |
66 | 84 |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
85 static void update_icon(struct conversation *); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
86 static void remove_icon(struct conversation *); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
87 |
2231
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
88 static void update_checkbox(struct conversation *); |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
89 static void remove_checkbox(struct conversation *); |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
90 |
3035 | 91 static void update_smilies(struct conversation *c); |
92 | |
93 | |
66 | 94 /*------------------------------------------------------------------------*/ |
95 /* Helpers */ | |
96 /*------------------------------------------------------------------------*/ | |
97 | |
98 | |
3081 | 99 void gaim_setup_imhtml_smileys(GtkWidget *imhtml) |
1780
d7cbedd1d651
[gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1772
diff
changeset
|
100 { |
d7cbedd1d651
[gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1772
diff
changeset
|
101 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "C:)", luke03_xpm); |
d7cbedd1d651
[gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1772
diff
changeset
|
102 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "C:-)", luke03_xpm); |
d7cbedd1d651
[gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1772
diff
changeset
|
103 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "O-)", oneeye_xpm); |
d7cbedd1d651
[gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1772
diff
changeset
|
104 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ">:)", crazy4_xpm); |
d7cbedd1d651
[gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1772
diff
changeset
|
105 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ">:-)", crazy4_xpm); |
1965 | 106 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-o)))", mrt_xpm); |
107 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-O)))", mrt_xpm); | |
2426 | 108 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "8-|)", download_xpm); |
2877
403dd881dcc4
[gaim-migrate @ 2890]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2874
diff
changeset
|
109 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-]", farted_xpm); |
1780
d7cbedd1d651
[gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1772
diff
changeset
|
110 } |
d7cbedd1d651
[gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1772
diff
changeset
|
111 |
3081 | 112 void gaim_setup_imhtml(GtkWidget *imhtml) |
113 { | |
114 g_return_if_fail(imhtml != NULL); | |
115 g_return_if_fail(GTK_IS_IMHTML(imhtml)); | |
116 if (!(convo_options & OPT_CONVO_SHOW_SMILEY)) | |
117 gtk_imhtml_show_smileys(GTK_IMHTML(imhtml), FALSE); | |
118 | |
119 gtk_signal_connect(GTK_OBJECT(imhtml), "url_clicked", GTK_SIGNAL_FUNC(open_url), NULL); | |
120 gaim_setup_imhtml_smileys(imhtml); | |
121 } | |
122 | |
66 | 123 void quiet_set(GtkWidget *tb, int state) |
124 { | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
125 state_lock = 1; |
66 | 126 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(tb), state); |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
127 state_lock = 0; |
66 | 128 } |
129 | |
130 | |
131 void set_state_lock(int i) | |
132 { | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
133 state_lock = i; |
66 | 134 } |
135 | |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
136 void toggle_sensitive(GtkWidget *widget, GtkWidget *to_toggle) |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
137 { |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
138 gboolean sensitivity = GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(to_toggle)); |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
139 |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
140 if (sensitivity == TRUE) |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
141 gtk_widget_set_sensitive(GTK_WIDGET(to_toggle), FALSE); |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
142 else |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
143 gtk_widget_set_sensitive(GTK_WIDGET(to_toggle), TRUE); |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
144 |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
145 return; |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
146 } |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
147 |
2937 | 148 void set_convo_name(struct conversation *c, const char *nname) |
149 { | |
150 | |
151 g_snprintf(c->name, sizeof(c->name), "%s", nname); | |
152 | |
153 return; | |
154 } | |
155 | |
66 | 156 struct conversation *new_conversation(char *name) |
157 { | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
158 struct conversation *c; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
159 |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
160 c = find_conversation(name); |
66 | 161 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
162 if (c != NULL) |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
163 return c; |
66 | 164 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
165 c = (struct conversation *)g_new0(struct conversation, 1); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
166 g_snprintf(c->name, sizeof(c->name), "%s", name); |
66 | 167 |
3457 | 168 if ((logging_options & OPT_LOG_CONVOS) || find_log_info(c->name)) { |
66 | 169 FILE *fd; |
70 | 170 |
3457 | 171 fd = open_log_file(c->name, c->is_chat); |
2004
699ddd727a49
[gaim-migrate @ 2014]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1970
diff
changeset
|
172 if (fd) { |
1525
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1486
diff
changeset
|
173 if (!(logging_options & OPT_LOG_STRIP_HTML)) |
1437
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
174 fprintf(fd, |
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
175 "<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
|
176 full_date()); |
1437
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
177 else |
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
178 fprintf(fd, " ---- New Conversation @ %s ----\n", full_date()); |
1034
1d43fda97960
[gaim-migrate @ 1044]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1032
diff
changeset
|
179 fclose(fd); |
1d43fda97960
[gaim-migrate @ 1044]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1032
diff
changeset
|
180 } else |
1d43fda97960
[gaim-migrate @ 1044]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1032
diff
changeset
|
181 /* do we want to do something here? */ ; |
66 | 182 } |
183 | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
184 if (connections) |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
185 c->gc = (struct gaim_connection *)connections->data; |
1479
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
186 c->history = g_string_new(""); |
3122 | 187 c->send_history = g_list_append(NULL, NULL); |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
188 conversations = g_list_append(conversations, c); |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
189 show_conv(c); |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
190 update_icon(c); |
3051 | 191 update_checkbox(c); |
3035 | 192 update_smilies(c); |
3517 | 193 plugin_event(event_new_conversation, name); |
3705 | 194 gtk_imhtml_to_bottom(c->text); |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
195 return c; |
66 | 196 } |
197 | |
198 | |
3466 | 199 struct conversation *find_conversation(const char *name) |
66 | 200 { |
2138
cfa83a1b3d49
[gaim-migrate @ 2148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2124
diff
changeset
|
201 char *cuser = g_malloc(1024); |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
202 struct conversation *c; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
203 GList *cnv = conversations; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
204 |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
205 strcpy(cuser, normalize(name)); |
66 | 206 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
207 while (cnv) { |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
208 c = (struct conversation *)cnv->data; |
2048
3366311426df
[gaim-migrate @ 2058]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2017
diff
changeset
|
209 if (!g_strcasecmp(cuser, normalize(c->name))) { |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
210 g_free(cuser); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
211 return c; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
212 } |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
213 cnv = cnv->next; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
214 } |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
215 g_free(cuser); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
216 return NULL; |
66 | 217 } |
218 | |
219 /* --------------------------------------------------- | |
220 * Function to remove a log file entry | |
221 * --------------------------------------------------- | |
222 */ | |
223 | |
224 void rm_log(struct log_conversation *a) | |
225 { | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
226 struct conversation *cnv = find_conversation(a->name); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
227 |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
228 log_conversations = g_list_remove(log_conversations, a); |
66 | 229 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
230 save_prefs(); |
66 | 231 |
2787
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
232 if (cnv && !(im_options & OPT_IM_ONE_WINDOW)) |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
233 set_convo_title(cnv); |
66 | 234 } |
235 | |
236 struct log_conversation *find_log_info(char *name) | |
237 { | |
2138
cfa83a1b3d49
[gaim-migrate @ 2148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2124
diff
changeset
|
238 char *pname = g_malloc(1024); |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
239 GList *lc = log_conversations; |
66 | 240 struct log_conversation *l; |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
241 |
66 | 242 |
243 strcpy(pname, normalize(name)); | |
244 | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
245 while (lc) { |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
246 l = (struct log_conversation *)lc->data; |
2048
3366311426df
[gaim-migrate @ 2058]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2017
diff
changeset
|
247 if (!g_strcasecmp(pname, normalize(l->name))) { |
66 | 248 g_free(pname); |
249 return l; | |
250 } | |
251 lc = lc->next; | |
252 } | |
253 g_free(pname); | |
254 return NULL; | |
255 } | |
256 | |
625
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
257 void delete_conversation(struct conversation *c) |
66 | 258 { |
3517 | 259 plugin_event(event_del_conversation, c); |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
260 conversations = g_list_remove(conversations, c); |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
261 if (c->fg_color_dialog) |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
262 gtk_widget_destroy(c->fg_color_dialog); |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
263 if (c->bg_color_dialog) |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
264 gtk_widget_destroy(c->bg_color_dialog); |
625
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
265 if (c->font_dialog) |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
266 gtk_widget_destroy(c->font_dialog); |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
267 if (c->smiley_dialog) |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
268 gtk_widget_destroy(c->smiley_dialog); |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
269 if (c->link_dialog) |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
270 gtk_widget_destroy(c->link_dialog); |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
271 if (c->log_dialog) |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
272 gtk_widget_destroy(c->log_dialog); |
2499
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
273 if (c->save_icon) |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
274 gtk_widget_destroy(c->save_icon); |
3122 | 275 c->send_history = g_list_first(c->send_history); |
276 while (c->send_history) { | |
277 if (c->send_history->data) | |
278 g_free(c->send_history->data); | |
279 c->send_history = c->send_history->next; | |
280 } | |
281 g_list_free(c->send_history); | |
2993 | 282 if (c->typing_timeout) |
283 gtk_timeout_remove(c->typing_timeout); | |
3596 | 284 if (c->type_again_timeout) |
285 gtk_timeout_remove(c->type_again_timeout); | |
1479
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
286 g_string_free(c->history, TRUE); |
625
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
287 g_free(c); |
66 | 288 } |
289 | |
290 void update_log_convs() | |
291 { | |
964
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
292 GSList *C = connections; |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
293 struct gaim_connection *g; |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
294 GSList *bcs; |
66 | 295 GList *cnv = conversations; |
296 struct conversation *c; | |
297 | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
298 while (cnv) { |
66 | 299 c = (struct conversation *)cnv->data; |
3457 | 300 if (c->log_button) { |
301 if (c->is_chat) | |
3671 | 302 gtk_widget_set_sensitive(GTK_WIDGET(c->log_button), |
3457 | 303 ((logging_options & OPT_LOG_CHATS)) ? FALSE : TRUE); |
304 else | |
3671 | 305 gtk_widget_set_sensitive(GTK_WIDGET(c->log_button), |
3457 | 306 ((logging_options & OPT_LOG_CONVOS)) ? FALSE : TRUE); |
307 } | |
66 | 308 |
309 cnv = cnv->next; | |
310 } | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
311 |
964
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
312 while (C) { |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
313 g = (struct gaim_connection *)C->data; |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
314 bcs = g->buddy_chats; |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
315 while (bcs) { |
964
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
316 c = (struct conversation *)bcs->data; |
3457 | 317 if (c->log_button) { |
318 if (c->is_chat) | |
3671 | 319 gtk_widget_set_sensitive(GTK_WIDGET(c->log_button), |
3457 | 320 ((logging_options & OPT_LOG_CHATS)) ? FALSE : |
321 TRUE); | |
322 else | |
3671 | 323 gtk_widget_set_sensitive(GTK_WIDGET(c->log_button), |
3457 | 324 ((logging_options & OPT_LOG_CONVOS)) ? FALSE : |
325 TRUE); | |
326 } | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
327 |
964
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
328 bcs = bcs->next; |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
329 } |
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
330 C = C->next; |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
331 } |
66 | 332 } |
333 | |
334 void update_font_buttons() | |
335 { | |
336 GList *cnv = conversations; | |
337 struct conversation *c; | |
338 | |
339 while (cnv) { | |
340 c = (struct conversation *)cnv->data; | |
341 | |
342 if (c->bold) | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
343 gtk_widget_set_sensitive(c->bold, |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
344 ((font_options & OPT_FONT_BOLD)) ? FALSE : TRUE); |
66 | 345 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
346 if (c->italic) |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
347 gtk_widget_set_sensitive(c->italic, |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
348 ((font_options & OPT_FONT_ITALIC)) ? FALSE : TRUE); |
66 | 349 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
350 if (c->underline) |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
351 gtk_widget_set_sensitive(c->underline, |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
352 ((font_options & OPT_FONT_UNDERLINE)) ? FALSE : TRUE); |
66 | 353 |
354 cnv = cnv->next; | |
355 } | |
356 } | |
357 | |
358 /* | |
359 void update_transparency() | |
360 { | |
361 GList *cnv = conversations; | |
362 struct conversation *c; | |
363 | |
364 This func should be uncalled! | |
365 | |
366 while(cnv) { | |
367 c = (struct conversation *)cnv->data; | |
368 | |
369 if (c->text) | |
370 gtk_html_set_transparent(GTK_HTML(c->text), | |
371 (transparent) ? TRUE : FALSE); | |
372 | |
373 cnv = cnv->next; | |
374 } | |
375 } | |
376 */ | |
377 | |
378 | |
379 /*------------------------------------------------------------------------*/ | |
380 /* Callbacks */ | |
381 /*------------------------------------------------------------------------*/ | |
382 | |
608 | 383 void toggle_loggle(GtkWidget *loggle, struct conversation *c) |
66 | 384 { |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
385 if (state_lock) |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
386 return; |
3484 | 387 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
388 if (find_log_info(c->name)) |
3484 | 389 rm_log(find_log_info(c->name)); |
3671 | 390 else if (GTK_CHECK_MENU_ITEM(c->log_button)->active) |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
391 show_log_dialog(c); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
392 else |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
393 cancel_log(NULL, c); |
66 | 394 } |
395 | |
3300 | 396 void toggle_sound(GtkWidget *widget, struct conversation *c) |
397 { | |
3681 | 398 if (state_lock) |
3682 | 399 return; |
3681 | 400 |
3300 | 401 c->makesound = !c->makesound; |
402 } | |
403 | |
1479
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
404 static void do_save_convo(GtkObject *obj, GtkWidget *wid) |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
405 { |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
406 struct conversation *c = gtk_object_get_user_data(obj); |
3466 | 407 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
|
408 FILE *f; |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
409 if (file_is_dir(filename, wid)) |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
410 return; |
3466 | 411 if (!((!c->is_chat && g_list_find(conversations, c)) || |
412 (c->is_chat && g_slist_find(connections, c->gc) && g_slist_find(c->gc->buddy_chats, c)))) | |
413 filename = NULL; | |
1479
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
414 gtk_widget_destroy(wid); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
415 if (!filename) |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
416 return; |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
417 f = fopen(filename, "w+"); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
418 if (!f) |
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 fprintf(f, "%s", c->history->str); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
421 fclose(f); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
422 } |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
423 |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
424 void save_convo(GtkWidget *save, struct conversation *c) |
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 char buf[BUF_LONG]; |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
427 GtkWidget *window = gtk_file_selection_new(_("Gaim - Save Conversation")); |
3630 | 428 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
|
429 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
430 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
|
431 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
432 "clicked", GTK_SIGNAL_FUNC(do_save_convo), window); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
433 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
|
434 "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), (gpointer)window); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
435 gtk_widget_show(window); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
436 } |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
437 |
3044 | 438 static void do_insert_image(GtkObject *obj, GtkWidget *wid) |
439 { | |
440 struct conversation *c = gtk_object_get_user_data(obj); | |
3466 | 441 const char *name = gtk_file_selection_get_filename(GTK_FILE_SELECTION(wid)); |
442 const char *filename; | |
3044 | 443 int pos; |
3466 | 444 char *buf; |
3044 | 445 struct stat st; |
446 int id = g_slist_length(c->images) + 1; | |
447 | |
448 if (file_is_dir(name, wid)) | |
449 return; | |
3466 | 450 if (!(!c->is_chat && g_list_find(conversations, c))) |
3044 | 451 name = NULL; |
452 gtk_widget_destroy(wid); | |
453 if (!name) | |
454 return; | |
455 | |
456 if (stat(name, &st) != 0) { | |
457 debug_printf("Could not stat %s\n", name); | |
458 return; | |
459 } | |
460 | |
461 filename = name; | |
462 while (strchr(filename, '/')) | |
463 filename = strchr(filename, '/') + 1; | |
464 | |
3466 | 465 buf = g_strdup_printf ("<IMG SRC=\"file://%s\" ID=\"%d\" DATASIZE=\"%d\">", |
466 filename, id, (int)st.st_size); | |
3044 | 467 c->images = g_slist_append(c->images, g_strdup(name)); |
468 | |
469 if (GTK_OLD_EDITABLE(c->entry)->has_selection) { | |
470 int finish = GTK_OLD_EDITABLE(c->entry)->selection_end_pos; | |
471 gtk_editable_insert_text(GTK_EDITABLE(c->entry), | |
472 buf, strlen(buf), &finish); | |
473 } else { | |
474 pos = GTK_OLD_EDITABLE(c->entry)->current_pos; | |
475 gtk_editable_insert_text(GTK_EDITABLE(c->entry), | |
476 buf, strlen(buf), &pos); | |
477 } | |
3466 | 478 g_free(buf); |
3044 | 479 } |
480 | |
481 void insert_image(GtkWidget *save, struct conversation *c) | |
482 { | |
483 char buf[BUF_LONG]; | |
484 GtkWidget *window = gtk_file_selection_new(_("Gaim - Insert Image")); | |
3630 | 485 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S, gaim_home_dir()); |
3044 | 486 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); |
487 gtk_object_set_user_data(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), c); | |
488 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), | |
489 "clicked", GTK_SIGNAL_FUNC(do_insert_image), window); | |
490 gtk_signal_connect_object(GTK_OBJECT(GTK_FILE_SELECTION(window)->cancel_button), | |
491 "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), (gpointer)window); | |
492 gtk_widget_show(window); | |
493 } | |
494 | |
495 | |
570 | 496 void insert_smiley(GtkWidget *smiley, struct conversation *c) |
555 | 497 { |
498 if (state_lock) | |
499 return; | |
3671 | 500 |
570 | 501 if (GTK_TOGGLE_BUTTON(smiley)->active) |
502 show_smiley_dialog(c, smiley); | |
503 else if (c->smiley_dialog) | |
504 close_smiley_dialog(smiley, c); | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
505 |
3671 | 506 gtk_widget_grab_focus(c->entry); |
507 | |
555 | 508 return; |
509 } | |
510 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
511 int close_callback(GtkWidget *widget, struct conversation *c) |
66 | 512 { |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
513 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
|
514 GtkWidget *tmp = c->window; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1244
diff
changeset
|
515 debug_printf("chat clicked close button\n"); |
814
a636ac51d15b
[gaim-migrate @ 824]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
808
diff
changeset
|
516 c->window = NULL; |
a636ac51d15b
[gaim-migrate @ 824]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
808
diff
changeset
|
517 gtk_widget_destroy(tmp); |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
518 return FALSE; |
814
a636ac51d15b
[gaim-migrate @ 824]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
808
diff
changeset
|
519 } |
a636ac51d15b
[gaim-migrate @ 824]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
808
diff
changeset
|
520 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1244
diff
changeset
|
521 debug_printf("conversation close callback\n"); |
814
a636ac51d15b
[gaim-migrate @ 824]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
808
diff
changeset
|
522 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
523 if (convo_options & OPT_CONVO_CHECK_SPELLING) |
1117
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
524 gtkspell_detach(GTK_TEXT(c->entry)); |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
525 |
1692
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
526 if (!c->is_chat) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2245
diff
changeset
|
527 GSList *cn = connections; |
3596 | 528 if (!(misc_options & OPT_MISC_STEALTH_TYPING)) |
529 serv_send_typing(c->gc, c->name, NOT_TYPING); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2245
diff
changeset
|
530 while (cn) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2245
diff
changeset
|
531 struct gaim_connection *gc = cn->data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2245
diff
changeset
|
532 cn = cn->next; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2245
diff
changeset
|
533 if (gc->prpl->convo_closed) |
2662
b0c5770156e1
[gaim-migrate @ 2675]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2631
diff
changeset
|
534 gc->prpl->convo_closed(gc, c->name); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2245
diff
changeset
|
535 } |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
536 remove_icon(c); |
2231
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
537 remove_checkbox(c); |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
538 if (im_options & OPT_IM_ONE_WINDOW) { |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
539 if ((g_list_length(conversations) > 1) || |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
540 ((convo_options & OPT_CONVO_COMBINE) && |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
541 (chat_options & OPT_CHAT_ONE_WINDOW) && chats)) { |
1692
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
542 gtk_notebook_remove_page(GTK_NOTEBOOK(convo_notebook), |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
543 g_list_index(conversations, c)); |
1692
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
544 } else { |
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
545 if (c->window) |
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
546 gtk_widget_destroy(c->window); |
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
547 c->window = NULL; |
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
548 all_convos = NULL; |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
549 convo_notebook = NULL; |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
550 if (convo_options & OPT_CONVO_COMBINE) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
551 all_chats = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
552 chat_notebook = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
553 } |
1692
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
554 } |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
555 } else { |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
556 if (c->window) |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
557 gtk_widget_destroy(c->window); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
558 c->window = NULL; |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
559 } |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
560 } else { |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
561 if (chat_options & OPT_CHAT_ONE_WINDOW) { |
2891
58baac124b0d
[gaim-migrate @ 2904]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2877
diff
changeset
|
562 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
|
563 && (conversations || chats->next)) { |
1692
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
564 gtk_notebook_remove_page(GTK_NOTEBOOK(chat_notebook), |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
565 g_list_index(chats, c) + |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
566 g_list_length(conversations)); |
2891
58baac124b0d
[gaim-migrate @ 2904]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2877
diff
changeset
|
567 } else if (g_list_length(chats) > 1) { |
58baac124b0d
[gaim-migrate @ 2904]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2877
diff
changeset
|
568 gtk_notebook_remove_page(GTK_NOTEBOOK(chat_notebook), |
58baac124b0d
[gaim-migrate @ 2904]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2877
diff
changeset
|
569 g_list_index(chats, c)); |
1692
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
570 } else { |
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
571 if (c->window) |
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
572 gtk_widget_destroy(c->window); |
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
573 c->window = NULL; |
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
574 all_chats = NULL; |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
575 chat_notebook = NULL; |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
576 if (convo_options & OPT_CONVO_COMBINE) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
577 all_convos = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
578 convo_notebook = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
579 } |
1692
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
580 } |
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
581 } else { |
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
582 if (c->window) |
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
583 gtk_widget_destroy(c->window); |
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
584 c->window = NULL; |
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
585 } |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
586 } |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
587 |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
588 if (c->fg_color_dialog) |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
589 gtk_widget_destroy(c->fg_color_dialog); |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
590 c->fg_color_dialog = NULL; |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
591 if (c->bg_color_dialog) |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
592 gtk_widget_destroy(c->bg_color_dialog); |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
593 c->bg_color_dialog = NULL; |
625
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
594 if (c->font_dialog) |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
595 gtk_widget_destroy(c->font_dialog); |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
596 c->font_dialog = NULL; |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
597 if (c->smiley_dialog) |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
598 gtk_widget_destroy(c->smiley_dialog); |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
599 c->smiley_dialog = NULL; |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
600 if (c->link_dialog) |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
601 gtk_widget_destroy(c->link_dialog); |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
602 c->link_dialog = NULL; |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
603 if (c->log_dialog) |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
604 gtk_widget_destroy(c->log_dialog); |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
605 c->log_dialog = NULL; |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
606 |
511
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
502
diff
changeset
|
607 if (c->is_chat) { |
1692
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
608 chats = g_list_remove(chats, c); |
1063
e1408fb04c36
[gaim-migrate @ 1073]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1034
diff
changeset
|
609 if (c->gc) |
e1408fb04c36
[gaim-migrate @ 1073]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1034
diff
changeset
|
610 serv_chat_leave(c->gc, c->id); |
2017
eee309c0de93
[gaim-migrate @ 2027]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2004
diff
changeset
|
611 else |
eee309c0de93
[gaim-migrate @ 2027]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2004
diff
changeset
|
612 delete_chat(c); |
511
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
502
diff
changeset
|
613 } else { |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
614 delete_conversation(c); |
511
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
502
diff
changeset
|
615 } |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
616 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
617 return TRUE; |
66 | 618 } |
619 | |
666
71ea550c22ac
[gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
661
diff
changeset
|
620 void set_font_face(char *newfont, struct conversation *c) |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
621 { |
666
71ea550c22ac
[gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
661
diff
changeset
|
622 char *pre_fontface; |
3473 | 623 |
624 sprintf(c->fontface, "%s", newfont && *newfont ? newfont : DEFAULT_FONT_FACE); | |
688
6b1345121dd3
[gaim-migrate @ 698]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
687
diff
changeset
|
625 c->hasfont = 1; |
2763
477a035d81e5
[gaim-migrate @ 2776]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2761
diff
changeset
|
626 |
477a035d81e5
[gaim-migrate @ 2776]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2761
diff
changeset
|
627 pre_fontface = g_strconcat("<FONT FACE=\"", c->fontface, "\">", NULL); |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
628 surround(c->entry, pre_fontface, "</FONT>"); |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
629 gtk_widget_grab_focus(c->entry); |
2763
477a035d81e5
[gaim-migrate @ 2776]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2761
diff
changeset
|
630 g_free(pre_fontface); |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
631 } |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
632 |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
633 gint delete_all_convo(GtkWidget *w, GdkEventAny *e, gpointer d) |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
634 { |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
635 if (w == all_convos) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
636 while (conversations) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
637 struct conversation *c = conversations->data; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
638 close_callback(c->close, c); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
639 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
640 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
641 if (w == all_chats) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
642 while (chats) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
643 struct conversation *c = chats->data; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
644 close_callback(c->close, c); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
645 } |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
646 } |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
647 return FALSE; |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
648 } |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
649 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
650 static gint delete_event_convo(GtkWidget *w, GdkEventAny *e, struct conversation *c) |
66 | 651 { |
652 delete_conversation(c); | |
653 return FALSE; | |
654 } | |
655 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
656 void add_callback(GtkWidget *widget, struct conversation *c) |
66 | 657 { |
2681
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2662
diff
changeset
|
658 struct buddy *b = find_buddy(c->gc, c->name); |
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2662
diff
changeset
|
659 if (b) { |
2745 | 660 show_confirm_del(c->gc, c->name); |
2681
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2662
diff
changeset
|
661 } else if (c->gc) |
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2662
diff
changeset
|
662 show_add_buddy(c->gc, c->name, NULL, NULL); |
66 | 663 |
664 gtk_widget_grab_focus(c->entry); | |
665 } | |
666 | |
667 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
668 void block_callback(GtkWidget *widget, struct conversation *c) |
66 | 669 { |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
670 if (c->gc) |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
671 show_add_perm(c->gc, c->name, FALSE); |
66 | 672 gtk_widget_grab_focus(c->entry); |
673 } | |
674 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
675 void warn_callback(GtkWidget *widget, struct conversation *c) |
66 | 676 { |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
677 show_warn_dialog(c->gc, c->name); |
66 | 678 gtk_widget_grab_focus(c->entry); |
679 } | |
680 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
681 void info_callback(GtkWidget *w, struct conversation *c) |
66 | 682 { |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
683 if (c->is_chat) { |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
684 char *name; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
685 GList *i; |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
686 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
687 i = GTK_LIST(c->list)->selection; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
688 if (i) { |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
689 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
|
690 } else { |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
691 return; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
692 } |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
693 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
694 serv_get_info(c->gc, name); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
695 } else { |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
696 serv_get_info(c->gc, c->name); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
697 gtk_widget_grab_focus(c->entry); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
698 } |
66 | 699 } |
700 | |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
701 static void move_next_tab(GtkNotebook *notebook, gboolean chat) |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
702 { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
703 int currpage = gtk_notebook_get_current_page(notebook); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
704 int convlen; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
705 GList *cnv; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
706 struct conversation *d = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
707 |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
708 if ((convo_options & OPT_CONVO_COMBINE) && |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
709 (im_options & OPT_IM_ONE_WINDOW) && |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
710 (chat_options & OPT_CHAT_ONE_WINDOW)) |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
711 convlen = g_list_length(conversations); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
712 else |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
713 convlen = 0; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
714 |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
715 if (chat) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
716 /* if chat, find next unread chat */ |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
717 cnv = g_list_nth(chats, currpage - convlen); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
718 while (cnv) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
719 d = cnv->data; |
2993 | 720 if (d->unseen > 0) |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
721 break; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
722 cnv = cnv->next; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
723 d = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
724 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
725 if (d) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
726 gtk_notebook_set_page(notebook, convlen + g_list_index(chats, d)); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
727 return; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
728 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
729 } else { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
730 /* else find next unread convo */ |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
731 cnv = g_list_nth(conversations, currpage); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
732 while (cnv) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
733 d = cnv->data; |
2993 | 734 if (d->unseen > 0) |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
735 break; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
736 cnv = cnv->next; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
737 d = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
738 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
739 if (d) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
740 gtk_notebook_set_page(notebook, g_list_index(conversations, d)); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
741 return; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
742 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
743 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
744 |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
745 if (convo_options & OPT_CONVO_COMBINE) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
746 if (chat && (im_options & OPT_IM_ONE_WINDOW)) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
747 /* if chat find next unread convo */ |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
748 cnv = conversations; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
749 while (cnv) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
750 d = cnv->data; |
2993 | 751 if (d->unseen > 0) |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
752 break; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
753 cnv = cnv->next; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
754 d = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
755 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
756 if (d) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
757 gtk_notebook_set_page(notebook, g_list_index(conversations, d)); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
758 return; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
759 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
760 } else if (!chat && (chat_options & OPT_CHAT_ONE_WINDOW)) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
761 /* else find next unread chat */ |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
762 cnv = chats; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
763 while (cnv) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
764 d = cnv->data; |
2993 | 765 if (d->unseen > 0) |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
766 break; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
767 cnv = cnv->next; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
768 d = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
769 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
770 if (d) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
771 gtk_notebook_set_page(notebook, convlen + g_list_index(chats, d)); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
772 return; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
773 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
774 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
775 } |
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 if (chat) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
778 /* if chat find first unread chat */ |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
779 cnv = chats; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
780 while (cnv) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
781 d = cnv->data; |
2993 | 782 if (d->unseen > 0) |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
783 break; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
784 cnv = cnv->next; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
785 d = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
786 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
787 if (d) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
788 gtk_notebook_set_page(notebook, convlen + g_list_index(chats, d)); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
789 return; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
790 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
791 } else { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
792 /* else find first unread convo */ |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
793 cnv = conversations; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
794 while (cnv) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
795 d = cnv->data; |
2993 | 796 if (d->unseen > 0) |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
797 break; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
798 cnv = cnv->next; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
799 d = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
800 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
801 if (d) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
802 gtk_notebook_set_page(notebook, g_list_index(conversations, d)); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
803 return; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
804 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
805 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
806 |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
807 /* go to next page */ |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
808 if (currpage + 1 == g_list_length(notebook->children)) |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
809 gtk_notebook_set_page(notebook, 0); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
810 else |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
811 gtk_notebook_next_page(notebook); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
812 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
813 |
3612 | 814 #define SEND_TYPED_TIMEOUT 5000 |
815 | |
3596 | 816 gboolean send_typed(gpointer data) |
817 { | |
818 struct conversation *c = (struct conversation*)data; | |
819 if (c && c->gc && c->name) { | |
820 c->type_again = 1; | |
821 serv_send_typing(c->gc, c->name, TYPED); | |
822 } | |
823 return FALSE; | |
824 } | |
825 | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
826 gboolean keypress_callback(GtkWidget *entry, GdkEventKey * event, struct conversation *c) |
66 | 827 { |
573
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
828 int pos; |
3627 | 829 |
1411
a3e472534370
[gaim-migrate @ 1421]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1403
diff
changeset
|
830 if (event->keyval == GDK_Escape) { |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
831 if (convo_options & OPT_CONVO_ESC_CAN_CLOSE) { |
1411
a3e472534370
[gaim-migrate @ 1421]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1403
diff
changeset
|
832 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
|
833 close_callback(c->close, c); |
2993 | 834 c = NULL; |
1411
a3e472534370
[gaim-migrate @ 1421]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1403
diff
changeset
|
835 } |
2363
08c66712364c
[gaim-migrate @ 2376]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2345
diff
changeset
|
836 } else if (event->keyval == GDK_Page_Up) { |
2749
8ff0bd0f7347
[gaim-migrate @ 2762]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2748
diff
changeset
|
837 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
3626 | 838 if(!(event->state & GDK_CONTROL_MASK)) |
839 gtk_imhtml_page_up(GTK_IMHTML(c->text)); | |
2363
08c66712364c
[gaim-migrate @ 2376]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2345
diff
changeset
|
840 } else if (event->keyval == GDK_Page_Down) { |
2749
8ff0bd0f7347
[gaim-migrate @ 2762]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2748
diff
changeset
|
841 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
3626 | 842 if(!(event->state & GDK_CONTROL_MASK)) |
843 gtk_imhtml_page_down(GTK_IMHTML(c->text)); | |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
844 } else if ((event->keyval == GDK_F2) && (convo_options & OPT_CONVO_F2_TOGGLES)) { |
1455
d113c7e2c5f1
[gaim-migrate @ 1465]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1453
diff
changeset
|
845 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
|
846 } 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
|
847 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
|
848 gtk_signal_emit_by_name(GTK_OBJECT(entry), "activate", c); |
1442
2f4e6269b001
[gaim-migrate @ 1452]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1441
diff
changeset
|
849 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
|
850 return TRUE; |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2767
diff
changeset
|
851 } 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
|
852 gtk_signal_emit_by_name(GTK_OBJECT(entry), "activate", c); |
573
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
853 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
|
854 return TRUE; |
573
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
855 } else { |
2483
e73ca8d8d358
[gaim-migrate @ 2496]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
856 int oldpos; |
573
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
857 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
|
858 oldpos = pos = gtk_editable_get_position(GTK_EDITABLE(entry)); |
573
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
859 gtk_editable_insert_text(GTK_EDITABLE(entry), "\n", 1, &pos); |
2483
e73ca8d8d358
[gaim-migrate @ 2496]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
860 if (oldpos == pos) |
e73ca8d8d358
[gaim-migrate @ 2496]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
861 gtk_editable_set_position(GTK_EDITABLE(entry), pos + 1); |
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 } |
2483
e73ca8d8d358
[gaim-migrate @ 2496]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
864 } else if ((event->state & GDK_CONTROL_MASK) && (event->keyval == 'm')) { |
e73ca8d8d358
[gaim-migrate @ 2496]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
865 int oldpos; |
e73ca8d8d358
[gaim-migrate @ 2496]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
866 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
|
867 oldpos = pos = gtk_editable_get_position(GTK_EDITABLE(entry)); |
e73ca8d8d358
[gaim-migrate @ 2496]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
868 gtk_editable_insert_text(GTK_EDITABLE(entry), "\n", 1, &pos); |
e73ca8d8d358
[gaim-migrate @ 2496]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
869 if (oldpos == pos) |
e73ca8d8d358
[gaim-migrate @ 2496]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
870 gtk_editable_set_position(GTK_EDITABLE(entry), pos + 1); |
830
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
871 } else if (event->state & GDK_CONTROL_MASK) { |
3122 | 872 int pos = 0; |
873 switch (event->keyval) { | |
874 case GDK_Up: | |
875 if (!c->send_history) | |
876 break; | |
877 if (!c->send_history->prev) { | |
878 if (c->send_history->data) | |
879 g_free(c->send_history->data); | |
880 c->send_history->data = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); | |
881 } | |
882 if (c->send_history->next && c->send_history->next->data) { | |
883 c->send_history = c->send_history->next; | |
884 gtk_editable_delete_text (GTK_EDITABLE(entry),0,-1); | |
885 gtk_editable_insert_text(GTK_EDITABLE(entry), | |
886 c->send_history->data, | |
887 strlen(c->send_history->data), | |
888 &pos); | |
889 } | |
890 | |
891 break; | |
892 case GDK_Down: | |
893 if (!c->send_history) | |
894 break; | |
895 if (c->send_history->prev) { | |
896 c->send_history = c->send_history->prev; | |
897 if (c->send_history->data) { | |
898 gtk_editable_delete_text (GTK_EDITABLE(entry),0,-1); | |
899 gtk_editable_insert_text (GTK_EDITABLE(entry), c->send_history->data, | |
900 strlen(c->send_history->data), &pos); | |
901 | |
902 } | |
903 } | |
904 break; | |
905 } | |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
906 if (convo_options & OPT_CONVO_CTL_CHARS) { |
830
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
907 switch (event->keyval) { |
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
908 case 'i': |
1621
cf2071b095ca
[gaim-migrate @ 1631]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1617
diff
changeset
|
909 case 'I': |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
910 quiet_set(c->italic, |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
911 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(c->italic))); |
830
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
912 do_italic(c->italic, c->entry); |
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
913 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
|
914 break; |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
915 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
|
916 case 'U': |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
917 quiet_set(c->underline, |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
918 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
919 (c->underline))); |
830
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
920 do_underline(c->underline, 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 'b': /* ctl-b is GDK_Left, which moves backwards */ |
1621
cf2071b095ca
[gaim-migrate @ 1631]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1617
diff
changeset
|
924 case 'B': |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
925 quiet_set(c->bold, |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
926 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(c->bold))); |
830
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
927 do_bold(c->bold, c->entry); |
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
928 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
|
929 break; |
3159 | 930 case '-': |
931 do_small(NULL, c->entry); | |
932 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); | |
933 break; | |
934 case '=': | |
935 case '+': | |
936 do_big(NULL, c->entry); | |
937 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); | |
938 break; | |
939 case '0': | |
940 do_normal(NULL, c->entry); | |
941 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); | |
942 break; | |
943 case 'f': | |
944 case 'F': | |
945 quiet_set(c->font, | |
946 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(c->font))); | |
947 toggle_font(c->font, c); | |
948 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); | |
949 break; | |
830
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
950 } |
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
951 } |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
952 if (convo_options & OPT_CONVO_CTL_SMILEYS) { |
830
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
953 char buf[7]; |
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
954 buf[0] = '\0'; |
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
955 switch (event->keyval) { |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
956 case '1': |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
957 sprintf(buf, ":-)"); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
958 break; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
959 case '2': |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
960 sprintf(buf, ":-("); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
961 break; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
962 case '3': |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
963 sprintf(buf, ";-)"); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
964 break; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
965 case '4': |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
966 sprintf(buf, ":-P"); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
967 break; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
968 case '5': |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
969 sprintf(buf, "=-O"); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
970 break; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
971 case '6': |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
972 sprintf(buf, ":-*"); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
973 break; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
974 case '7': |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
975 sprintf(buf, ">:o"); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
976 break; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
977 case '8': |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
978 sprintf(buf, "8-)"); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
979 break; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
980 case '!': |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
981 sprintf(buf, ":-$"); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
982 break; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
983 case '@': |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
984 sprintf(buf, ":-!"); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
985 break; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
986 case '#': |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
987 sprintf(buf, ":-["); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
988 break; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
989 case '$': |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
990 sprintf(buf, "O:-)"); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
991 break; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
992 case '%': |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
993 sprintf(buf, ":-/"); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
994 break; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
995 case '^': |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
996 sprintf(buf, ":'("); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
997 break; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
998 case '&': |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
999 sprintf(buf, ":-X"); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1000 break; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1001 case '*': |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1002 sprintf(buf, ":-D"); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1003 break; |
830
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
1004 } |
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
1005 if (buf[0]) { |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2722
diff
changeset
|
1006 if (GTK_OLD_EDITABLE(c->entry)->has_selection) { |
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2722
diff
changeset
|
1007 int finish = GTK_OLD_EDITABLE(c->entry)->selection_end_pos; |
830
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
1008 gtk_editable_insert_text(GTK_EDITABLE(c->entry), |
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
1009 buf, strlen(buf), &finish); |
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
1010 } else { |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2722
diff
changeset
|
1011 pos = GTK_OLD_EDITABLE(c->entry)->current_pos; |
830
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
1012 gtk_editable_insert_text(GTK_EDITABLE(c->entry), |
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
1013 buf, strlen(buf), &pos); |
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
1014 } |
60284aef22f0
[gaim-migrate @ 840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
829
diff
changeset
|
1015 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
|
1016 } |
573
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
1017 } |
2631
a2cf3cac7e66
[gaim-migrate @ 2644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2625
diff
changeset
|
1018 if (event->keyval == 'l') { |
2340
b16642ac87b2
[gaim-migrate @ 2353]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2335
diff
changeset
|
1019 gtk_imhtml_clear(GTK_IMHTML(c->text)); |
2631
a2cf3cac7e66
[gaim-migrate @ 2644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2625
diff
changeset
|
1020 g_string_free(c->history, TRUE); |
a2cf3cac7e66
[gaim-migrate @ 2644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2625
diff
changeset
|
1021 c->history = g_string_new(""); |
3168 | 1022 } else if ((event->keyval == 'w') && (convo_options & OPT_CONVO_CTL_W_CLOSES)) { |
3159 | 1023 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
1024 close_callback(c->close, c); | |
1025 c = NULL; | |
1026 return TRUE; | |
1027 } else if (event->keyval == 'n') { | |
1028 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); | |
1029 show_im_dialog(); | |
1030 } else if (event->keyval == 'z') { | |
1031 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); | |
3630 | 1032 #ifndef _WIN32 |
3159 | 1033 XIconifyWindow(GDK_DISPLAY(), |
1034 GDK_WINDOW_XWINDOW(c->window->window), | |
1035 ((_XPrivDisplay)GDK_DISPLAY())->default_screen); | |
3630 | 1036 #endif |
2631
a2cf3cac7e66
[gaim-migrate @ 2644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2625
diff
changeset
|
1037 } |
3159 | 1038 |
1039 | |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1040 if ((!c->is_chat && (im_options & OPT_IM_ONE_WINDOW)) || |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
1041 (c->is_chat && (chat_options & OPT_CHAT_ONE_WINDOW))) { |
1692
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
1042 GtkWidget *notebook = (c->is_chat ? chat_notebook : convo_notebook); |
1595
f281f4d94973
[gaim-migrate @ 1605]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1594
diff
changeset
|
1043 if (event->keyval == '[') { |
1692
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
1044 gtk_notebook_prev_page(GTK_NOTEBOOK(notebook)); |
1587
69a004b5820a
[gaim-migrate @ 1597]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1583
diff
changeset
|
1045 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
|
1046 } else if (event->keyval == ']') { |
1692
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
1047 gtk_notebook_next_page(GTK_NOTEBOOK(notebook)); |
1587
69a004b5820a
[gaim-migrate @ 1597]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1583
diff
changeset
|
1048 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
|
1049 } else if (event->keyval == GDK_Tab) { |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
1050 move_next_tab(GTK_NOTEBOOK(notebook), c->is_chat); |
1587
69a004b5820a
[gaim-migrate @ 1597]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1583
diff
changeset
|
1051 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
|
1052 return TRUE; |
1587
69a004b5820a
[gaim-migrate @ 1597]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1583
diff
changeset
|
1053 } |
69a004b5820a
[gaim-migrate @ 1597]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1583
diff
changeset
|
1054 } |
2385
bdc74764245c
[gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
1055 } 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
|
1056 tab_complete(c); |
bdc74764245c
[gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
1057 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
|
1058 return TRUE; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1059 } 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
|
1060 (c->is_chat && (chat_options & OPT_CHAT_ONE_WINDOW))) && |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2386
diff
changeset
|
1061 (event->state & GDK_MOD1_MASK) && (event->keyval > '0') && (event->keyval <= '9')) { |
3629 | 1062 GtkWidget *notebook = NULL; |
3628 | 1063 notebook = (c->is_chat ? chat_notebook : convo_notebook); |
1692
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
1064 gtk_notebook_set_page(GTK_NOTEBOOK(notebook), event->keyval - '1'); |
1621
cf2071b095ca
[gaim-migrate @ 1631]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1617
diff
changeset
|
1065 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
|
1066 } |
66 | 1067 |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2722
diff
changeset
|
1068 return FALSE; |
66 | 1069 } |
1070 | |
3731 | 1071 static void got_typing_keypress(struct conversation *c, gboolean first) { |
1072 /* we know we got something, so we at least have to make sure we don't send | |
1073 * TYPED any time soon */ | |
1074 if(c->type_again_timeout) | |
1075 gtk_timeout_remove(c->type_again_timeout); | |
1076 c->type_again_timeout = gtk_timeout_add(SEND_TYPED_TIMEOUT, send_typed, c); | |
1077 | |
1078 /* we send typed if this is the first character typed, or if we're due | |
1079 * to send another one */ | |
1080 if(first || (c->type_again != 0 && time(NULL) > c->type_again)) { | |
1081 int timeout = serv_send_typing(c->gc, c->name, TYPING); | |
1082 if(timeout) | |
1083 c->type_again = time(NULL) + timeout; | |
1084 else | |
1085 c->type_again = 0; | |
1086 } | |
1087 } | |
1088 | |
1089 void delete_text_callback(GtkEditable *editable, gint start_pos, gint end_pos, gpointer user_data) { | |
1090 struct conversation *c = user_data; | |
1091 gchar *contents; | |
1092 | |
1093 if(!c) | |
1094 return; | |
1095 | |
1096 if (misc_options & OPT_MISC_STEALTH_TYPING) | |
1097 return; | |
1098 | |
1099 contents = gtk_editable_get_chars(editable, 0, -1); | |
3749 | 1100 if(start_pos == 0 && (end_pos == strlen(contents) || end_pos == -1)) { |
3731 | 1101 if(c->type_again_timeout) |
1102 gtk_timeout_remove(c->type_again_timeout); | |
1103 serv_send_typing(c->gc, c->name, NOT_TYPING); | |
1104 } else { | |
1105 /* we're deleting, but not all of it, so it counts as typing */ | |
1106 got_typing_keypress(c, FALSE); | |
1107 } | |
1108 g_free(contents); | |
1109 } | |
1110 | |
1111 void insert_text_callback(GtkEditable *editable, gchar *new_text, gint new_text_length, gint *position, gpointer user_data) { | |
1112 struct conversation *c = user_data; | |
1113 gchar *contents; | |
1114 | |
1115 if(!c) | |
1116 return; | |
1117 | |
1118 if (misc_options & OPT_MISC_STEALTH_TYPING) | |
1119 return; | |
1120 | |
1121 contents = gtk_editable_get_chars(editable, 0, -1); | |
1122 got_typing_keypress(c, (*position == 0 && strlen(contents) == 0)); | |
1123 g_free(contents); | |
1124 } | |
66 | 1125 |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1126 void send_callback(GtkWidget *widget, struct conversation *c) |
66 | 1127 { |
2102
899c22dcee42
[gaim-migrate @ 2112]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2094
diff
changeset
|
1128 char *buf, *buf2; |
3044 | 1129 int limit; |
1130 gulong length=0; | |
2123
56c4382f2909
[gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2111
diff
changeset
|
1131 int err = 0; |
3122 | 1132 GList *first; |
66 | 1133 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1134 if (!c->gc) |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1135 return; |
1100
f168625b63fe
[gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1078
diff
changeset
|
1136 |
3035 | 1137 |
1100
f168625b63fe
[gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1078
diff
changeset
|
1138 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
|
1139 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
|
1140 buf = g_malloc(limit); |
97c7b2f61cb5
[gaim-migrate @ 748]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
700
diff
changeset
|
1141 g_snprintf(buf, limit, "%s", buf2); |
753
cd62f69d187e
[gaim-migrate @ 763]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
745
diff
changeset
|
1142 g_free(buf2); |
796
4783a3b6859d
[gaim-migrate @ 806]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
795
diff
changeset
|
1143 if (!strlen(buf)) { |
4783a3b6859d
[gaim-migrate @ 806]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
795
diff
changeset
|
1144 g_free(buf); |
4783a3b6859d
[gaim-migrate @ 806]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
795
diff
changeset
|
1145 return; |
4783a3b6859d
[gaim-migrate @ 806]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
795
diff
changeset
|
1146 } |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1147 |
3122 | 1148 first = g_list_first(c->send_history); |
1149 if (first->data) | |
1150 g_free(first->data); | |
1151 first->data = g_strdup(buf); | |
1152 c->send_history = g_list_prepend(first, NULL); | |
1153 | |
738
97c7b2f61cb5
[gaim-migrate @ 748]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
700
diff
changeset
|
1154 buf2 = g_malloc(limit); |
97c7b2f61cb5
[gaim-migrate @ 748]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
700
diff
changeset
|
1155 |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2699
diff
changeset
|
1156 if (c->gc->flags & OPT_CONN_HTML) { |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1157 if (convo_options & OPT_CONVO_SEND_LINKS) |
1889
c81f3dd0e58e
[gaim-migrate @ 1899]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
1158 linkify_text(buf); |
c81f3dd0e58e
[gaim-migrate @ 1899]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
1159 |
1370
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1160 if (font_options & OPT_FONT_BOLD) { |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1161 g_snprintf(buf2, limit, "<B>%s</B>", buf); |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1162 strcpy(buf, buf2); |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1163 } |
66 | 1164 |
1370
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1165 if (font_options & OPT_FONT_ITALIC) { |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1166 g_snprintf(buf2, limit, "<I>%s</I>", buf); |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1167 strcpy(buf, buf2); |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1168 } |
66 | 1169 |
1370
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1170 if (font_options & OPT_FONT_UNDERLINE) { |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1171 g_snprintf(buf2, limit, "<U>%s</U>", buf); |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1172 strcpy(buf, buf2); |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1173 } |
66 | 1174 |
1370
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1175 if (font_options & OPT_FONT_STRIKE) { |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1176 g_snprintf(buf2, limit, "<STRIKE>%s</STRIKE>", buf); |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1177 strcpy(buf, buf2); |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1178 } |
101
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
1179 |
1370
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1180 if ((font_options & OPT_FONT_FACE) || c->hasfont) { |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1181 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
|
1182 strcpy(buf, buf2); |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1183 } |
488
0fcb7e7a263c
[gaim-migrate @ 498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
474
diff
changeset
|
1184 |
2699
092c5a1ddf72
[gaim-migrate @ 2712]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
1185 if (font_options & OPT_FONT_SIZE) { |
092c5a1ddf72
[gaim-migrate @ 2712]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
1186 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
|
1187 strcpy(buf, buf2); |
5c67b8794991
[gaim-migrate @ 1451]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1440
diff
changeset
|
1188 } |
5c67b8794991
[gaim-migrate @ 1451]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1440
diff
changeset
|
1189 |
1370
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1190 if ((font_options & OPT_FONT_FGCOL) || c->hasfg) { |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1191 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
|
1192 c->fgcol.green, c->fgcol.blue, buf); |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1193 strcpy(buf, buf2); |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1194 } |
666
71ea550c22ac
[gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
661
diff
changeset
|
1195 |
1370
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1196 if ((font_options & OPT_FONT_BGCOL) || c->hasbg) { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
1197 g_snprintf(buf2, limit, "<BODY BGCOLOR=\"#%02X%02X%02X\">%s</BODY>", |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
1198 c->bgcol.red, c->bgcol.green, c->bgcol.blue, buf); |
1370
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1199 strcpy(buf, buf2); |
776bb4c6c0b8
[gaim-migrate @ 1380]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
1200 } |
666
71ea550c22ac
[gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
661
diff
changeset
|
1201 } |
71ea550c22ac
[gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
661
diff
changeset
|
1202 |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1872
diff
changeset
|
1203 quiet_set(c->bold, FALSE); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1872
diff
changeset
|
1204 quiet_set(c->italic, FALSE); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1872
diff
changeset
|
1205 quiet_set(c->underline, FALSE); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1872
diff
changeset
|
1206 quiet_set(c->font, FALSE); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1872
diff
changeset
|
1207 quiet_set(c->fgcolorbtn, FALSE); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1872
diff
changeset
|
1208 quiet_set(c->bgcolorbtn, FALSE); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1872
diff
changeset
|
1209 quiet_set(c->link, FALSE); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1872
diff
changeset
|
1210 gtk_widget_grab_focus(c->entry); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1872
diff
changeset
|
1211 |
101
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
1212 { |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
389
diff
changeset
|
1213 char *buffy = g_strdup(buf); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1214 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
|
1215 int plugin_return = plugin_event(evnt, c->gc, |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
1216 c->is_chat ? (void *)c->id : c->name, |
3517 | 1217 &buffy); |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
389
diff
changeset
|
1218 if (!buffy) { |
102
8c301530b2a3
[gaim-migrate @ 112]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
101
diff
changeset
|
1219 g_free(buf2); |
796
4783a3b6859d
[gaim-migrate @ 806]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
795
diff
changeset
|
1220 g_free(buf); |
102
8c301530b2a3
[gaim-migrate @ 112]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
101
diff
changeset
|
1221 return; |
8c301530b2a3
[gaim-migrate @ 112]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
101
diff
changeset
|
1222 } |
1100
f168625b63fe
[gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1078
diff
changeset
|
1223 if (plugin_return) { |
2139
a14e8459c233
[gaim-migrate @ 2149]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2138
diff
changeset
|
1224 gtk_editable_delete_text(GTK_EDITABLE(c->entry), 0, -1); |
1100
f168625b63fe
[gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1078
diff
changeset
|
1225 g_free(buffy); |
f168625b63fe
[gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1078
diff
changeset
|
1226 g_free(buf2); |
f168625b63fe
[gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1078
diff
changeset
|
1227 g_free(buf); |
f168625b63fe
[gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1078
diff
changeset
|
1228 return; |
f168625b63fe
[gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1078
diff
changeset
|
1229 } |
738
97c7b2f61cb5
[gaim-migrate @ 748]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
700
diff
changeset
|
1230 g_snprintf(buf, limit, "%s", buffy); |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
389
diff
changeset
|
1231 g_free(buffy); |
101
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
1232 } |
3048 | 1233 |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1234 if (!c->is_chat) { |
2102
899c22dcee42
[gaim-migrate @ 2112]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2094
diff
changeset
|
1235 char *buffy; |
3048 | 1236 gboolean binary = FALSE; |
2102
899c22dcee42
[gaim-migrate @ 2112]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2094
diff
changeset
|
1237 |
899c22dcee42
[gaim-migrate @ 2112]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2094
diff
changeset
|
1238 buffy = g_strdup(buf); |
3517 | 1239 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
|
1240 if (buffy) { |
2231
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
1241 int imflags = 0; |
2239
b7ff2ca1d653
[gaim-migrate @ 2249]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2231
diff
changeset
|
1242 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
|
1243 imflags = IM_FLAG_CHECKBOX; |
3048 | 1244 |
3033 | 1245 if (c->images) { |
3159 | 1246 int id = 0, offset = 0; |
1247 char *bigbuf = NULL; | |
3033 | 1248 GSList *tmplist = c->images; |
1249 id = 1; | |
3048 | 1250 |
3033 | 1251 while (tmplist) { |
3044 | 1252 FILE *imgfile; |
1253 char *filename; | |
1254 struct stat st; | |
3033 | 1255 char imgtag[1024]; |
3048 | 1256 |
3033 | 1257 if (stat(tmplist->data, &st) != 0) { |
1258 debug_printf("Could not stat %s\n", tmplist->data); | |
3048 | 1259 tmplist = tmplist->next; |
1260 continue; | |
3033 | 1261 } |
3044 | 1262 |
1263 /* Here we check to make sure the user still wants to send the | |
1264 * image. He may have deleted the <img> tag in which case we | |
1265 * don't want to send the binary data. */ | |
1266 filename = tmplist->data; | |
1267 while (strchr(filename, '/')) | |
1268 filename = strchr(filename, '/') + 1; | |
1269 g_snprintf(imgtag, sizeof(imgtag), | |
1270 "<IMG SRC=\"file://%s\" ID=\"%d\" DATASIZE=\"%d\">", | |
1271 filename, id, (int)st.st_size); | |
3048 | 1272 |
1273 if (strstr(buffy, imgtag) == 0) { | |
1274 debug_printf("Not sending image: %s\n", tmplist->data); | |
3044 | 1275 tmplist = tmplist->next; |
1276 continue; | |
1277 } | |
3048 | 1278 if (!binary) { |
1279 length = strlen(buffy) + strlen("<BINARY></BINARY>"); | |
1280 bigbuf = g_malloc(length + 1); | |
1281 g_snprintf(bigbuf, strlen(buffy) + strlen("<BINARY> ") + 1, | |
1282 "%s<BINARY>", buffy); | |
1283 offset = strlen(buffy) + strlen("<BINARY>"); | |
1284 binary = TRUE; | |
1285 } | |
3033 | 1286 g_snprintf(imgtag, sizeof(imgtag), |
1287 "<DATA ID=\"%d\" SIZE=\"%d\">", | |
3044 | 1288 id, (int)st.st_size); |
1289 | |
1290 length = length + strlen(imgtag) + st.st_size + strlen("</DATA>");; | |
3048 | 1291 bigbuf = g_realloc(bigbuf, length + 1); |
3044 | 1292 if (!(imgfile = fopen(tmplist->data, "r"))) { |
3033 | 1293 debug_printf("Could not open %s\n", tmplist->data); |
3048 | 1294 tmplist = tmplist->next; |
3044 | 1295 continue; |
3033 | 1296 } |
1297 g_snprintf(bigbuf + offset, strlen(imgtag) + 1, "%s", imgtag); | |
1298 offset = offset + strlen(imgtag); | |
3044 | 1299 offset = offset + fread(bigbuf + offset, 1, st.st_size, imgfile); |
1300 fclose(imgfile); | |
1301 g_snprintf(bigbuf + offset, strlen("</DATA>") + 1, "</DATA>"); | |
3033 | 1302 offset= offset + strlen("</DATA>"); |
1303 id++; | |
1304 tmplist = tmplist->next; | |
1305 } | |
3048 | 1306 if (binary) { |
1307 g_snprintf(bigbuf + offset, strlen("</BINARY>") + 1, "</BINARY>"); | |
1308 err =serv_send_im(c->gc, c->name, bigbuf, length, imflags); | |
1309 } else { | |
1310 err = serv_send_im(c->gc, c->name, buffy, -1, imflags); | |
1311 } | |
3044 | 1312 if (err > 0) { |
1313 GSList *tempy = c->images; | |
1314 while (tempy) { | |
1315 g_free(tempy->data); | |
1316 tempy = tempy->next; | |
1317 } | |
1318 g_slist_free(tempy); | |
1319 c->images = NULL; | |
3048 | 1320 if (binary) |
1321 write_to_conv(c, bigbuf, WFLAG_SEND, NULL, time(NULL), length); | |
1322 else | |
1323 write_to_conv(c, buffy, WFLAG_SEND, NULL, time(NULL), -1); | |
3060 | 1324 if (c->makesound) |
1325 play_sound(SND_SEND); | |
3033 | 1326 if (im_options & OPT_IM_POPDOWN) |
1327 gtk_widget_hide(c->window); | |
1328 | |
3044 | 1329 |
3033 | 1330 } |
3048 | 1331 if (binary) |
1332 g_free(bigbuf); | |
3033 | 1333 } else { |
3044 | 1334 err =serv_send_im(c->gc, c->name, buffy, -1, imflags); |
1335 if (err > 0) { | |
3033 | 1336 write_to_conv(c, buf, WFLAG_SEND, NULL, time(NULL), -1); |
3060 | 1337 if (c->makesound) |
1338 play_sound(SND_SEND); | |
3044 | 1339 if (im_options & OPT_IM_POPDOWN) |
1340 gtk_widget_hide(c->window); | |
1341 } | |
3033 | 1342 } |
2102
899c22dcee42
[gaim-migrate @ 2112]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2094
diff
changeset
|
1343 g_free(buffy); |
899c22dcee42
[gaim-migrate @ 2112]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2094
diff
changeset
|
1344 } |
3033 | 1345 |
502
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1346 } else { |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2160
diff
changeset
|
1347 err = serv_chat_send(c->gc, c->id, buf); |
502
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1348 |
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1349 /* 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
|
1350 } |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1351 |
2123
56c4382f2909
[gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2111
diff
changeset
|
1352 g_free(buf2); |
56c4382f2909
[gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2111
diff
changeset
|
1353 g_free(buf); |
56c4382f2909
[gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2111
diff
changeset
|
1354 |
56c4382f2909
[gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2111
diff
changeset
|
1355 if (err < 0) { |
56c4382f2909
[gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2111
diff
changeset
|
1356 if (err == -E2BIG) |
3427 | 1357 do_error_dialog(_("Unable to send message. The message is too large"), NULL, GAIM_ERROR); |
3044 | 1358 else if (err == -ENOTCONN) |
1359 debug_printf("Not yet connected\n"); | |
2123
56c4382f2909
[gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2111
diff
changeset
|
1360 else |
3427 | 1361 do_error_dialog(_("Unable to send message"), NULL, GAIM_ERROR); |
2832
e0eeda0a9ab9
[gaim-migrate @ 2845]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2831
diff
changeset
|
1362 } else { |
2123
56c4382f2909
[gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2111
diff
changeset
|
1363 gtk_editable_delete_text(GTK_EDITABLE(c->entry), 0, -1); |
56c4382f2909
[gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2111
diff
changeset
|
1364 |
2832
e0eeda0a9ab9
[gaim-migrate @ 2845]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2831
diff
changeset
|
1365 if ((err > 0) && (away_options & OPT_AWAY_BACK_ON_IM)) { |
2123
56c4382f2909
[gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2111
diff
changeset
|
1366 if (awaymessage != NULL) { |
56c4382f2909
[gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2111
diff
changeset
|
1367 do_im_back(); |
56c4382f2909
[gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2111
diff
changeset
|
1368 } else if (c->gc->away) { |
56c4382f2909
[gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2111
diff
changeset
|
1369 serv_set_away(c->gc, GAIM_AWAY_CUSTOM, NULL); |
56c4382f2909
[gaim-migrate @ 2133]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2111
diff
changeset
|
1370 } |
1403
c0aa7fdc0a93
[gaim-migrate @ 1413]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1401
diff
changeset
|
1371 } |
66 | 1372 } |
1373 } | |
1374 | |
907
08d5037c9296
[gaim-migrate @ 917]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
1375 int entry_key_pressed(GtkWidget *w, GtkWidget *entry) |
66 | 1376 { |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1377 check_everything(w); |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2722
diff
changeset
|
1378 return FALSE; |
66 | 1379 } |
1380 | |
1381 /*------------------------------------------------------------------------*/ | |
1382 /* HTML-type stuff */ | |
1383 /*------------------------------------------------------------------------*/ | |
1384 | |
1385 int count_tag(GtkWidget *entry, char *s1, char *s2) | |
1386 { | |
1387 char *p1, *p2; | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1388 int res = 0; |
66 | 1389 char *tmp, *tmpo, h; |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1390 tmpo = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2722
diff
changeset
|
1391 h = tmpo[GTK_OLD_EDITABLE(entry)->current_pos]; |
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2722
diff
changeset
|
1392 tmpo[GTK_OLD_EDITABLE(entry)->current_pos] = '\0'; |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1393 tmp = tmpo; |
66 | 1394 do { |
1395 p1 = strstr(tmp, s1); | |
1396 p2 = strstr(tmp, s2); | |
1397 if (p1 && p2) { | |
1398 if (p1 < p2) { | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1399 res = 1; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1400 tmp = p1 + strlen(s1); |
66 | 1401 } else if (p2 < p1) { |
1402 res = 0; | |
1403 tmp = p2 + strlen(s2); | |
1404 } | |
1405 } else { | |
1406 if (p1) { | |
1407 res = 1; | |
1408 tmp = p1 + strlen(s1); | |
1409 } else if (p2) { | |
1410 res = 0; | |
1411 tmp = p2 + strlen(s2); | |
1412 } | |
1413 } | |
1414 } while (p1 || p2); | |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2722
diff
changeset
|
1415 tmpo[GTK_OLD_EDITABLE(entry)->current_pos] = h; |
66 | 1416 g_free(tmpo); |
1417 return res; | |
1418 } | |
1419 | |
1420 | |
1421 int invert_tags(GtkWidget *entry, char *s1, char *s2, int really) | |
1422 { | |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2722
diff
changeset
|
1423 int start = GTK_OLD_EDITABLE(entry)->selection_start_pos; |
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2722
diff
changeset
|
1424 int finish = GTK_OLD_EDITABLE(entry)->selection_end_pos; |
66 | 1425 char *s; |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1426 |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1427 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); |
2048
3366311426df
[gaim-migrate @ 2058]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2017
diff
changeset
|
1428 if (!g_strncasecmp(&s[start], s1, strlen(s1)) && |
3366311426df
[gaim-migrate @ 2058]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2017
diff
changeset
|
1429 !g_strncasecmp(&s[finish - strlen(s2)], s2, strlen(s2))) { |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1430 if (really) { |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1431 gtk_editable_delete_text(GTK_EDITABLE(entry), start, start + strlen(s1)); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1432 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
|
1433 finish - strlen(s1)); |
66 | 1434 } |
1435 g_free(s); | |
1436 return 1; | |
1437 } | |
1438 g_free(s); | |
1439 return 0; | |
1440 } | |
1441 | |
1442 | |
1443 void remove_tags(GtkWidget *entry, char *tag) | |
1444 { | |
275
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
1445 char *s, *t; |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2722
diff
changeset
|
1446 int start = GTK_OLD_EDITABLE(entry)->selection_start_pos; |
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2722
diff
changeset
|
1447 int finish = GTK_OLD_EDITABLE(entry)->selection_end_pos; |
275
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
1448 int temp; |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
1449 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); |
66 | 1450 t = s; |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1451 |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1452 if (start > finish) { |
275
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
1453 temp = start; |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
1454 start = finish; |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
1455 finish = temp; |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
1456 } |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1457 |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1458 if (strstr(tag, "<FONT SIZE=")) { |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1459 while ((t = strstr(t, "<FONT SIZE="))) { |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1460 if (((t - s) < finish) && ((t - s) >= start)) { |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1461 gtk_editable_delete_text(GTK_EDITABLE(entry), (t - s), |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1462 (t - s) + strlen(tag)); |
846
4b05985bae5e
[gaim-migrate @ 856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
843
diff
changeset
|
1463 g_free(s); |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
1464 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
1465 t = s; |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1466 } else |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1467 t++; |
68 | 1468 } |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1469 } else { |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1470 while ((t = strstr(t, tag))) { |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1471 if (((t - s) < finish) && ((t - s) >= start)) { |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1472 gtk_editable_delete_text(GTK_EDITABLE(entry), (t - s), |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1473 (t - s) + strlen(tag)); |
846
4b05985bae5e
[gaim-migrate @ 856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
843
diff
changeset
|
1474 g_free(s); |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
1475 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
1476 t = s; |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1477 } else |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1478 t++; |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
1479 } |
66 | 1480 } |
1481 g_free(s); | |
1482 } | |
1483 | |
1440
6330d0bb309f
[gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1439
diff
changeset
|
1484 static char *html_logize(char *p) |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1485 { |
1103
7aabbbaae829
[gaim-migrate @ 1113]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
1486 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1487 char *temp_p = p; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1488 char *buffer_p; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1489 char *buffer_start; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1490 int num_cr = 0; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1491 int char_len = 0; |
1103
7aabbbaae829
[gaim-migrate @ 1113]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
1492 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1493 while (*temp_p != '\0') { |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1494 char_len++; |
1440
6330d0bb309f
[gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1439
diff
changeset
|
1495 if ((*temp_p == '\n') || ((*temp_p == '<') && (*(temp_p + 1) == '!'))) |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1496 num_cr++; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1497 ++temp_p; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1498 } |
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 temp_p = p; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1501 buffer_p = g_malloc(char_len + (4 * num_cr) + 1); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1502 buffer_start = buffer_p; |
1103
7aabbbaae829
[gaim-migrate @ 1113]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
1503 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1504 while (*temp_p != '\0') { |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1505 if (*temp_p == '\n') { |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1506 *buffer_p++ = '<'; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1507 *buffer_p++ = 'B'; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1508 *buffer_p++ = 'R'; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1509 *buffer_p++ = '>'; |
1440
6330d0bb309f
[gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1439
diff
changeset
|
1510 *buffer_p++ = '\n'; |
6330d0bb309f
[gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1439
diff
changeset
|
1511 } else if ((*temp_p == '<') && (*(temp_p + 1) == '!')) { |
6330d0bb309f
[gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1439
diff
changeset
|
1512 *buffer_p++ = '&'; |
2994 | 1513 *buffer_p++ = 'l'; |
1440
6330d0bb309f
[gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1439
diff
changeset
|
1514 *buffer_p++ = 't'; |
6330d0bb309f
[gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1439
diff
changeset
|
1515 *buffer_p++ = ';'; |
6330d0bb309f
[gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1439
diff
changeset
|
1516 } else |
6330d0bb309f
[gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1439
diff
changeset
|
1517 *buffer_p++ = *temp_p; |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1518 ++temp_p; |
1103
7aabbbaae829
[gaim-migrate @ 1113]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
1519 } |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1520 *buffer_p = '\0'; |
1103
7aabbbaae829
[gaim-migrate @ 1113]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
1521 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1522 return buffer_start; |
1103
7aabbbaae829
[gaim-migrate @ 1113]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
1523 } |
7aabbbaae829
[gaim-migrate @ 1113]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
1524 |
66 | 1525 void surround(GtkWidget *entry, char *pre, char *post) |
1526 { | |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2722
diff
changeset
|
1527 int temp, pos = GTK_OLD_EDITABLE(entry)->current_pos; |
66 | 1528 int dummy; |
1529 int start, finish; | |
1133 | 1530 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1531 if (convo_options & OPT_CONVO_CHECK_SPELLING) { |
1133 | 1532 gtkspell_detach(GTK_TEXT(entry)); |
1533 } | |
1534 | |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2722
diff
changeset
|
1535 if (GTK_OLD_EDITABLE(entry)->has_selection) { |
66 | 1536 remove_tags(entry, pre); |
1537 remove_tags(entry, post); | |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2722
diff
changeset
|
1538 start = GTK_OLD_EDITABLE(entry)->selection_start_pos; |
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2722
diff
changeset
|
1539 finish = GTK_OLD_EDITABLE(entry)->selection_end_pos; |
66 | 1540 if (start > finish) { |
1541 dummy = finish; | |
1542 finish = start; | |
1543 start = dummy; | |
1544 } | |
1545 dummy = start; | |
1546 gtk_editable_insert_text(GTK_EDITABLE(entry), pre, strlen(pre), &dummy); | |
1547 dummy = finish + strlen(pre); | |
1548 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
|
1549 gtk_editable_select_region(GTK_EDITABLE(entry), start, |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1550 finish + strlen(pre) + strlen(post)); |
66 | 1551 } else { |
649 | 1552 temp = pos; |
66 | 1553 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
|
1554 if (temp == pos) { |
649 | 1555 dummy = pos + strlen(pre); |
1556 gtk_editable_insert_text(GTK_EDITABLE(entry), post, strlen(post), &dummy); | |
1557 gtk_editable_set_position(GTK_EDITABLE(entry), dummy); | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1558 } else { |
649 | 1559 dummy = pos; |
1560 gtk_editable_insert_text(GTK_EDITABLE(entry), post, strlen(post), &dummy); | |
1561 gtk_editable_set_position(GTK_EDITABLE(entry), pos); | |
1562 } | |
66 | 1563 } |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1564 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1565 if (convo_options & OPT_CONVO_CHECK_SPELLING) { |
1133 | 1566 gtkspell_attach(GTK_TEXT(entry)); |
1567 } | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1568 |
66 | 1569 gtk_widget_grab_focus(entry); |
1570 } | |
1571 | |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
337
diff
changeset
|
1572 void advance_past(GtkWidget *entry, char *pre, char *post) |
66 | 1573 { |
1574 char *s, *s2; | |
1575 int pos; | |
1576 if (invert_tags(entry, pre, post, 1)) | |
1577 return; | |
1578 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); | |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2722
diff
changeset
|
1579 pos = GTK_OLD_EDITABLE(entry)->current_pos; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1244
diff
changeset
|
1580 debug_printf(_("Currently at %d, "), pos); |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1581 s2 = strstr(&s[pos], post); |
523
023c3851db0a
[gaim-migrate @ 533]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
520
diff
changeset
|
1582 if (s2) { |
66 | 1583 pos = s2 - s + strlen(post); |
523
023c3851db0a
[gaim-migrate @ 533]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
520
diff
changeset
|
1584 } else { |
023c3851db0a
[gaim-migrate @ 533]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
520
diff
changeset
|
1585 gtk_editable_insert_text(GTK_EDITABLE(entry), post, strlen(post), &pos); |
023c3851db0a
[gaim-migrate @ 533]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
520
diff
changeset
|
1586 } |
846
4b05985bae5e
[gaim-migrate @ 856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
843
diff
changeset
|
1587 g_free(s); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1244
diff
changeset
|
1588 debug_printf(_("Setting position to %d\n"), pos); |
66 | 1589 gtk_editable_set_position(GTK_EDITABLE(entry), pos); |
1590 gtk_widget_grab_focus(entry); | |
1591 } | |
1592 | |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
1593 void toggle_fg_color(GtkWidget *color, struct conversation *c) |
66 | 1594 { |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1595 if (state_lock) |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1596 return; |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1597 if (GTK_TOGGLE_BUTTON(color)->active) |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
1598 show_fgcolor_dialog(c, color); |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
1599 else if (c->fg_color_dialog) |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
1600 cancel_fgcolor(color, c); |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
1601 else |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1602 advance_past(c->entry, "<FONT COLOR>", "</FONT>"); |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
1603 } |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
1604 |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
1605 void toggle_bg_color(GtkWidget *color, struct conversation *c) |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
1606 { |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
1607 if (state_lock) |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1608 return; |
858
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
1609 if (GTK_TOGGLE_BUTTON(color)->active) |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
1610 show_bgcolor_dialog(c, color); |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
1611 else if (c->bg_color_dialog) |
3de6e98e8898
[gaim-migrate @ 868]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
856
diff
changeset
|
1612 cancel_bgcolor(color, c); |
189
50dc3db25513
[gaim-migrate @ 199]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
187
diff
changeset
|
1613 else |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1614 advance_past(c->entry, "<BODY BGCOLOR>", "</BODY>"); |
66 | 1615 } |
1616 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1617 void toggle_font(GtkWidget *font, struct conversation *c) |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
1618 { |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1619 if (state_lock) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1620 return; |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1621 if (GTK_TOGGLE_BUTTON(font)->active) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1622 show_font_dialog(c, font); |
563
8d6e2de1fb64
[gaim-migrate @ 573]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
557
diff
changeset
|
1623 else if (c->font_dialog) |
8d6e2de1fb64
[gaim-migrate @ 573]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
557
diff
changeset
|
1624 cancel_font(font, c); |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1625 else |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1626 advance_past(c->entry, "<FONT FACE>", "</FONT>"); |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
1627 } |
611
0f7e5ff95f71
[gaim-migrate @ 621]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
610
diff
changeset
|
1628 |
3671 | 1629 void insert_link_cb(GtkWidget *w, struct conversation *c) |
1630 { | |
1631 show_add_link(c->link, c); | |
1632 } | |
1633 | |
608 | 1634 void toggle_link(GtkWidget *linky, struct conversation *c) |
1635 { | |
1636 if (state_lock) | |
1637 return; | |
3671 | 1638 |
1639 if (GTK_TOGGLE_BUTTON(c->link)->active) | |
1640 show_add_link(c->link, c); | |
1641 | |
608 | 1642 else if (c->link_dialog) |
3671 | 1643 cancel_link(c->link, c); |
608 | 1644 else |
1645 advance_past(c->entry, "<A HREF>", "</A>"); | |
3671 | 1646 |
1647 gtk_widget_grab_focus(c->entry); | |
608 | 1648 } |
66 | 1649 |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
337
diff
changeset
|
1650 void do_strike(GtkWidget *strike, GtkWidget *entry) |
66 | 1651 { |
1652 if (state_lock) | |
1653 return; | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1654 |
66 | 1655 if (GTK_TOGGLE_BUTTON(strike)->active) |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1656 surround(entry, "<STRIKE>", "</STRIKE>"); |
66 | 1657 else |
1658 advance_past(entry, "<STRIKE>", "</STRIKE>"); | |
1133 | 1659 |
66 | 1660 } |
1661 | |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
337
diff
changeset
|
1662 void do_bold(GtkWidget *bold, GtkWidget *entry) |
66 | 1663 { |
1664 if (state_lock) | |
1665 return; | |
1666 if (GTK_TOGGLE_BUTTON(bold)->active) | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1667 surround(entry, "<B>", "</B>"); |
66 | 1668 else |
1669 advance_past(entry, "<B>", "</B>"); | |
3671 | 1670 |
1671 gtk_widget_grab_focus(entry); | |
66 | 1672 } |
1673 | |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
337
diff
changeset
|
1674 void do_underline(GtkWidget *underline, GtkWidget *entry) |
66 | 1675 { |
1676 if (state_lock) | |
1677 return; | |
1678 if (GTK_TOGGLE_BUTTON(underline)->active) | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1679 surround(entry, "<U>", "</U>"); |
66 | 1680 else |
1681 advance_past(entry, "<U>", "</U>"); | |
3671 | 1682 |
1683 gtk_widget_grab_focus(entry); | |
66 | 1684 } |
1685 | |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
337
diff
changeset
|
1686 void do_italic(GtkWidget *italic, GtkWidget *entry) |
66 | 1687 { |
1688 if (state_lock) | |
1689 return; | |
1690 if (GTK_TOGGLE_BUTTON(italic)->active) | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1691 surround(entry, "<I>", "</I>"); |
66 | 1692 else |
1693 advance_past(entry, "<I>", "</I>"); | |
3671 | 1694 |
1695 gtk_widget_grab_focus(entry); | |
66 | 1696 } |
1697 | |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
1698 /* 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
|
1699 /* currently set to 15 chars */ |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
1700 |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
337
diff
changeset
|
1701 void do_small(GtkWidget *small, GtkWidget *entry) |
66 | 1702 { |
1703 if (state_lock) | |
1704 return; | |
3671 | 1705 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1706 surround(entry, "<FONT SIZE=\"1\">", "</FONT>"); |
3671 | 1707 |
1708 gtk_widget_grab_focus(entry); | |
66 | 1709 } |
1710 | |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
337
diff
changeset
|
1711 void do_normal(GtkWidget *normal, GtkWidget *entry) |
66 | 1712 { |
1713 if (state_lock) | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1714 return; |
3671 | 1715 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1716 surround(entry, "<FONT SIZE=\"3\">", "</FONT>"); |
3671 | 1717 |
1718 gtk_widget_grab_focus(entry); | |
66 | 1719 } |
1720 | |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
337
diff
changeset
|
1721 void do_big(GtkWidget *big, GtkWidget *entry) |
66 | 1722 { |
1723 if (state_lock) | |
1724 return; | |
3671 | 1725 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1726 surround(entry, "<FONT SIZE=\"5\">", "</FONT>"); |
3671 | 1727 |
1728 gtk_widget_grab_focus(entry); | |
66 | 1729 } |
1730 | |
1731 void check_everything(GtkWidget *entry) | |
1732 { | |
1733 struct conversation *c; | |
206 | 1734 |
66 | 1735 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
|
1736 if (!c) |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1737 return; |
66 | 1738 if (invert_tags(entry, "<B>", "</B>", 0)) |
1739 quiet_set(c->bold, TRUE); | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1740 else if (count_tag(entry, "<B>", "</B>")) |
66 | 1741 quiet_set(c->bold, TRUE); |
1742 else | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1743 quiet_set(c->bold, FALSE); |
66 | 1744 if (invert_tags(entry, "<I>", "</I>", 0)) |
1745 quiet_set(c->italic, TRUE); | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1746 else if (count_tag(entry, "<I>", "</I>")) |
66 | 1747 quiet_set(c->italic, TRUE); |
1748 else | |
1749 quiet_set(c->italic, FALSE); | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1750 |
66 | 1751 if (invert_tags(entry, "<FONT COLOR", "</FONT>", 0)) |
854 | 1752 quiet_set(c->fgcolorbtn, TRUE); |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1753 else if (count_tag(entry, "<FONT COLOR", "</FONT>")) |
854 | 1754 quiet_set(c->fgcolorbtn, TRUE); |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1755 else |
854 | 1756 quiet_set(c->fgcolorbtn, FALSE); |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1757 |
861
00fb90babcb2
[gaim-migrate @ 871]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
860
diff
changeset
|
1758 if (invert_tags(entry, "<BODY BGCOLOR", "</BODY>", 0)) |
00fb90babcb2
[gaim-migrate @ 871]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
860
diff
changeset
|
1759 quiet_set(c->bgcolorbtn, TRUE); |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1760 else if (count_tag(entry, "<BODY BGCOLOR", "</BODY>")) |
861
00fb90babcb2
[gaim-migrate @ 871]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
860
diff
changeset
|
1761 quiet_set(c->bgcolorbtn, TRUE); |
00fb90babcb2
[gaim-migrate @ 871]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
860
diff
changeset
|
1762 else |
00fb90babcb2
[gaim-migrate @ 871]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
860
diff
changeset
|
1763 quiet_set(c->bgcolorbtn, FALSE); |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1764 |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1765 if (invert_tags(entry, "<FONT FACE", "</FONT>", 0)) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1766 quiet_set(c->font, TRUE); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1767 else if (count_tag(entry, "<FONT FACE", "</FONT>")) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1768 quiet_set(c->font, TRUE); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1769 else |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1770 quiet_set(c->font, FALSE); |
66 | 1771 |
1772 if (invert_tags(entry, "<A HREF", "</A>", 0)) | |
1773 quiet_set(c->link, TRUE); | |
1774 else if (count_tag(entry, "<A HREF", "</A>")) | |
1775 quiet_set(c->link, TRUE); | |
1776 else | |
1777 quiet_set(c->link, FALSE); | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1778 |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1779 if (invert_tags(entry, "<U>", "</U>", 0)) |
66 | 1780 quiet_set(c->underline, TRUE); |
1781 else if (count_tag(entry, "<U>", "</U>")) | |
1782 quiet_set(c->underline, TRUE); | |
1783 else | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1784 quiet_set(c->underline, FALSE); |
66 | 1785 } |
1786 | |
1787 | |
1788 /*------------------------------------------------------------------------*/ | |
1789 /* Takin care of the window.. */ | |
1790 /*------------------------------------------------------------------------*/ | |
1791 | |
3431 | 1792 static char* nick_colors[] = { |
1793 "#ba55d3", /* Medium Orchid */ | |
1794 "#ee82ee", /* Violet */ | |
1795 "#c715b4", /* Medium Violet Red */ | |
1796 "#ff69b4", /* Hot Pink */ | |
1797 "#ff6347", /* Tomato */ | |
1798 "#fa8c00", /* Dark Orange */ | |
1799 "#fa8072" /* Salmon */ | |
1800 "#b22222", /* Fire Brick */ | |
1801 "#f4a460", /* Sandy Brown */ | |
1802 "#cd5c5c", /* Indian Red */ | |
1803 "#bc8f8f", /* Rosy Brown */ | |
1804 "#f0e68c", /* Khaki */ | |
1805 "#bdb76b", /* Dark Khaki */ | |
1806 "#228b22", /* Forest Green */ | |
1807 "#9acd32", /* Yellow Green */ | |
1808 "#32cd32", /* Lime Green */ | |
1809 "#3cb371", /* Medium Sea Green */ | |
1810 "#2e8b57", /* Sea Green */ | |
1811 "#8fbc8f", /* Dark Sea Green */ | |
1812 "#66cdaa", /* Medium Aquamarine */ | |
1813 "#5f9ea0", /* Cadet Blue */ | |
1814 "#48d1cc", /* Medium Turquoise */ | |
1815 "#00ced1", /* Dark Turquoise */ | |
1816 "#4682b4", /* Stell Blue */ | |
1817 "#00bfff", /* Deep Sky Blue */ | |
1818 "#1690ff", /* Dodger Blue */ | |
1819 "#4169ff", /* Royal Blue */ | |
1820 "#6a5acd", /* Slate Blue */ | |
1821 "#6495ed", /* Cornflower Blue */ | |
1822 "#708090", /* Slate gray */ | |
1823 "#ffdead", /* Navajo White */ | |
1824 }; | |
1825 #define NUM_NICK_COLORS (sizeof(nick_colors) / sizeof(char *)) | |
66 | 1826 |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1827 /* 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
|
1828 * 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
|
1829 void write_to_conv(struct conversation *c, char *what, int flags, char *who, time_t mtime, gint length) |
66 | 1830 { |
1735
00f74db70f2d
[gaim-migrate @ 1745]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1732
diff
changeset
|
1831 char buf[BUF_LONG]; |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1832 char *str; |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1833 FILE *fd; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1834 char colour[10]; |
741
58a6e6e26695
[gaim-migrate @ 751]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
738
diff
changeset
|
1835 struct buddy *b; |
1244 | 1836 int gtk_font_options = 0; |
1440
6330d0bb309f
[gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1439
diff
changeset
|
1837 GString *logstr; |
1735
00f74db70f2d
[gaim-migrate @ 1745]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1732
diff
changeset
|
1838 char buf2[BUF_LONG]; |
1764 | 1839 char mdate[64]; |
2993 | 1840 int unhighlight = 0; |
1841 | |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2855
diff
changeset
|
1842 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
|
1843 return; |
837aa71710c5
[gaim-migrate @ 2277]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2264
diff
changeset
|
1844 |
2447
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1845 if (!c->is_chat && !g_list_find(conversations, c)) |
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1846 return; |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1847 |
2794
2d3f47783a22
[gaim-migrate @ 2807]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2788
diff
changeset
|
1848 gtk_widget_show(c->window); |
2d3f47783a22
[gaim-migrate @ 2807]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2788
diff
changeset
|
1849 |
1772
896432d66303
[gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
1850 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
|
1851 if (!who) { |
896432d66303
[gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
1852 if (flags & WFLAG_SEND) { |
896432d66303
[gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
1853 b = find_buddy(c->gc, c->gc->username); |
2213
a226ebf4be47
[gaim-migrate @ 2223]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2210
diff
changeset
|
1854 if (b && strcmp(b->name, b->show)) |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
1855 who = b->show; |
3205 | 1856 else if (c->gc->user->alias[0]) |
1857 who = c->gc->user->alias; | |
2210
3a6fd1e8f00a
[gaim-migrate @ 2220]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2202
diff
changeset
|
1858 else if (c->gc->displayname[0]) |
3a6fd1e8f00a
[gaim-migrate @ 2220]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2202
diff
changeset
|
1859 who = c->gc->displayname; |
1772
896432d66303
[gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
1860 else |
896432d66303
[gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
1861 who = c->gc->username; |
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 b = find_buddy(c->gc, c->name); |
896432d66303
[gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
1864 if (b) |
896432d66303
[gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
1865 who = b->show; |
896432d66303
[gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
1866 else |
896432d66303
[gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
1867 who = c->name; |
896432d66303
[gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
1868 } |
896432d66303
[gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
1869 } else { |
896432d66303
[gaim-migrate @ 1782]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
1870 b = find_buddy(c->gc, who); |
745
d693b83e4933
[gaim-migrate @ 755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
741
diff
changeset
|
1871 if (b) |
d693b83e4933
[gaim-migrate @ 755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
741
diff
changeset
|
1872 who = b->show; |
741
58a6e6e26695
[gaim-migrate @ 751]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
738
diff
changeset
|
1873 } |
474
7720d0f9da8e
[gaim-migrate @ 484]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
473
diff
changeset
|
1874 } |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1875 |
2447
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1876 strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime)); |
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1877 |
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1878 gtk_font_options = gtk_font_options ^ GTK_IMHTML_NO_COMMENTS; |
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1879 |
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1880 if (convo_options & OPT_CONVO_IGNORE_COLOUR) |
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1881 gtk_font_options = gtk_font_options ^ GTK_IMHTML_NO_COLOURS; |
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1882 |
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1883 if (convo_options & OPT_CONVO_IGNORE_FONTS) |
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1884 gtk_font_options = gtk_font_options ^ GTK_IMHTML_NO_FONTS; |
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1885 |
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1886 if (convo_options & OPT_CONVO_IGNORE_SIZES) |
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1887 gtk_font_options = gtk_font_options ^ GTK_IMHTML_NO_SIZES; |
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1888 |
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1889 if (!(logging_options & OPT_LOG_STRIP_HTML)) |
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2426
diff
changeset
|
1890 gtk_font_options = gtk_font_options ^ GTK_IMHTML_RETURN_LOG; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
1891 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1892 if (flags & WFLAG_SYSTEM) { |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1893 if (convo_options & OPT_CONVO_SHOW_TIME) |
1764 | 1894 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
|
1895 else |
1815
f15d449b3167
[gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1813
diff
changeset
|
1896 g_snprintf(buf, BUF_LONG, "<B>%s</B>", what); |
1735
00f74db70f2d
[gaim-migrate @ 1745]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1732
diff
changeset
|
1897 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
|
1898 mdate, what); |
66 | 1899 |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2855
diff
changeset
|
1900 gtk_imhtml_append_text(GTK_IMHTML(c->text), buf2, -1, 0); |
66 | 1901 |
1525
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1486
diff
changeset
|
1902 if (logging_options & OPT_LOG_STRIP_HTML) { |
1735
00f74db70f2d
[gaim-migrate @ 1745]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1732
diff
changeset
|
1903 char *t1 = strip_html(buf); |
1479
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
1904 c->history = g_string_append(c->history, t1); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
1905 c->history = g_string_append(c->history, "\n"); |
1486
b72a33d07ce8
[gaim-migrate @ 1496]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1479
diff
changeset
|
1906 g_free(t1); |
1479
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
1907 } else { |
1735
00f74db70f2d
[gaim-migrate @ 1745]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1732
diff
changeset
|
1908 c->history = g_string_append(c->history, buf); |
1479
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
1909 c->history = g_string_append(c->history, "<BR>\n"); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
1910 } |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
1911 |
3457 | 1912 if (!(flags & WFLAG_NOLOG) && ((c->is_chat && (logging_options & OPT_LOG_CHATS)) |
1913 || (!c->is_chat && (logging_options & OPT_LOG_CONVOS)) | |
1914 || find_log_info(c->name))) { | |
1437
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
1915 char *t1; |
699
f8acdd22065a
[gaim-migrate @ 709]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
698
diff
changeset
|
1916 char nm[256]; |
66 | 1917 |
1525
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1486
diff
changeset
|
1918 if (logging_options & OPT_LOG_STRIP_HTML) { |
1735
00f74db70f2d
[gaim-migrate @ 1745]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1732
diff
changeset
|
1919 t1 = strip_html(buf); |
1437
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
1920 } else { |
1735
00f74db70f2d
[gaim-migrate @ 1745]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1732
diff
changeset
|
1921 t1 = buf; |
1437
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
1922 } |
699
f8acdd22065a
[gaim-migrate @ 709]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
698
diff
changeset
|
1923 if (c->is_chat) |
f8acdd22065a
[gaim-migrate @ 709]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
698
diff
changeset
|
1924 g_snprintf(nm, 256, "%s.chat", c->name); |
f8acdd22065a
[gaim-migrate @ 709]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
698
diff
changeset
|
1925 else |
f8acdd22065a
[gaim-migrate @ 709]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
698
diff
changeset
|
1926 g_snprintf(nm, 256, "%s", c->name); |
3457 | 1927 fd = open_log_file(nm, c->is_chat); |
2004
699ddd727a49
[gaim-migrate @ 2014]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1970
diff
changeset
|
1928 if (fd) { |
1525
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1486
diff
changeset
|
1929 if (logging_options & OPT_LOG_STRIP_HTML) { |
1437
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
1930 fprintf(fd, "%s\n", t1); |
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
1931 } else { |
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
1932 fprintf(fd, "%s<BR>\n", t1); |
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
1933 } |
1067
649199f4730e
[gaim-migrate @ 1077]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
1934 fclose(fd); |
936 | 1935 } |
1525
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1486
diff
changeset
|
1936 if (logging_options & OPT_LOG_STRIP_HTML) { |
1437
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
1937 g_free(t1); |
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
1938 } |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1939 } |
2385
bdc74764245c
[gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
1940 } else if (flags & WFLAG_NOLOG) { |
bdc74764245c
[gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
1941 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
|
1942 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
|
1943 } else { |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1944 if (flags & WFLAG_WHISPER) { |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1945 /* if we're whispering, it's not an autoresponse */ |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2855
diff
changeset
|
1946 if (meify(what, length)) { |
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, "#6C2585"); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1950 } else { |
2138
cfa83a1b3d49
[gaim-migrate @ 2148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2124
diff
changeset
|
1951 str = g_malloc(1024); |
cfa83a1b3d49
[gaim-migrate @ 2148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2124
diff
changeset
|
1952 g_snprintf(str, 1024, "*%s*:", who); |
2374
9e9385cddcc6
[gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1953 strcpy(colour, "#00ff00"); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1954 } |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1955 } else { |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2855
diff
changeset
|
1956 if (meify(what, length)) { |
2138
cfa83a1b3d49
[gaim-migrate @ 2148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2124
diff
changeset
|
1957 str = g_malloc(1024); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1958 if (flags & WFLAG_AUTO) |
2138
cfa83a1b3d49
[gaim-migrate @ 2148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2124
diff
changeset
|
1959 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, who); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1960 else |
2138
cfa83a1b3d49
[gaim-migrate @ 2148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2124
diff
changeset
|
1961 g_snprintf(str, 1024, "***%s", who); |
2374
9e9385cddcc6
[gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1962 if (flags & WFLAG_NICK) |
2375
09fe1b00d31f
[gaim-migrate @ 2388]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2374
diff
changeset
|
1963 strcpy(colour, "#af7f00"); |
2374
9e9385cddcc6
[gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1964 else |
9e9385cddcc6
[gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1965 strcpy(colour, "#062585"); |
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 str = g_malloc(1024); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1968 if (flags & WFLAG_AUTO) |
2138
cfa83a1b3d49
[gaim-migrate @ 2148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2124
diff
changeset
|
1969 g_snprintf(str, 1024, "%s %s", who, AUTO_RESPONSE); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1970 else |
2138
cfa83a1b3d49
[gaim-migrate @ 2148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2124
diff
changeset
|
1971 g_snprintf(str, 1024, "%s:", who); |
2374
9e9385cddcc6
[gaim-migrate @ 2387]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
1972 if (flags & WFLAG_NICK) |
2375
09fe1b00d31f
[gaim-migrate @ 2388]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2374
diff
changeset
|
1973 strcpy(colour, "#af7f00"); |
3367 | 1974 else if (flags & WFLAG_RECV) { |
1975 if (flags & WFLAG_COLORIZE) { | |
1976 char *u = who; | |
1977 int m = 0; | |
1978 while (*u) { | |
1979 m = m + *u; | |
1980 u++; | |
1981 } | |
1982 m = m % NUM_NICK_COLORS; | |
1983 strcpy(colour, nick_colors[m]); | |
1984 } else { | |
1985 strcpy(colour, "#ff0000"); | |
1986 } | |
1987 } else if (flags & WFLAG_RECV) | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1988 strcpy(colour, "#ff0000"); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1989 else if (flags & WFLAG_SEND) |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1990 strcpy(colour, "#0000ff"); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1991 } |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1992 } |
66 | 1993 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1994 if (convo_options & OPT_CONVO_SHOW_TIME) |
1437
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
1995 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
|
1996 "<B>%s</B></FONT> ", colour, mdate, str); |
1437
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
1997 else |
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
1998 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
|
1999 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
|
2000 "<B>%s</B></FONT> ", colour, mdate, str); |
66 | 2001 |
473
f9bb7761c52b
[gaim-migrate @ 483]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
472
diff
changeset
|
2002 g_free(str); |
f9bb7761c52b
[gaim-migrate @ 483]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
472
diff
changeset
|
2003 |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2855
diff
changeset
|
2004 gtk_imhtml_append_text(GTK_IMHTML(c->text), buf2, -1, 0); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2855
diff
changeset
|
2005 |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2855
diff
changeset
|
2006 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
|
2007 |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2855
diff
changeset
|
2008 gtk_imhtml_append_text(GTK_IMHTML(c->text), "<BR>", -1, 0); |
66 | 2009 |
2857
7a6f33cd6721
[gaim-migrate @ 2870]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2856
diff
changeset
|
2010 /* 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
|
2011 if (logging_options & OPT_LOG_STRIP_HTML) { |
1479
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2012 char *t1, *t2; |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2013 t1 = strip_html(buf); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2014 t2 = strip_html(what); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2015 c->history = g_string_append(c->history, t1); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2016 c->history = g_string_append(c->history, t2); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2017 c->history = g_string_append(c->history, "\n"); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2018 g_free(t1); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2019 g_free(t2); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2020 } else { |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2021 char *t1, *t2; |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2022 t1 = html_logize(buf); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2023 t2 = html_logize(what); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2024 c->history = g_string_append(c->history, t1); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2025 c->history = g_string_append(c->history, t2); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2026 c->history = g_string_append(c->history, "\n"); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2027 c->history = g_string_append(c->history, logstr->str); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2028 c->history = g_string_append(c->history, "<BR>\n"); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2029 g_free(t1); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2030 g_free(t2); |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2031 } |
4c62ead808a2
[gaim-migrate @ 1489]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1464
diff
changeset
|
2032 |
2857
7a6f33cd6721
[gaim-migrate @ 2870]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2856
diff
changeset
|
2033 /* XXX this needs to be updated for the new length argument */ |
3457 | 2034 if ((c->is_chat && (logging_options & OPT_LOG_CHATS)) |
2035 || (!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
|
2036 char *t1, *t2; |
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
2037 char *nm = g_malloc(256); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2038 if (c->is_chat) |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2039 g_snprintf(nm, 256, "%s.chat", c->name); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2040 else |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2041 g_snprintf(nm, 256, "%s", c->name); |
66 | 2042 |
1525
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1486
diff
changeset
|
2043 if (logging_options & OPT_LOG_STRIP_HTML) { |
1437
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
2044 t1 = strip_html(buf); |
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
2045 t2 = strip_html(what); |
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
2046 } else { |
1440
6330d0bb309f
[gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1439
diff
changeset
|
2047 t1 = html_logize(buf); |
6330d0bb309f
[gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1439
diff
changeset
|
2048 t2 = html_logize(what); |
1437
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
2049 } |
3457 | 2050 fd = open_log_file(nm, c->is_chat); |
2004
699ddd727a49
[gaim-migrate @ 2014]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1970
diff
changeset
|
2051 if (fd) { |
1525
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1486
diff
changeset
|
2052 if (logging_options & OPT_LOG_STRIP_HTML) { |
1437
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
2053 fprintf(fd, "%s%s\n", t1, t2); |
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
2054 } else { |
1440
6330d0bb309f
[gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1439
diff
changeset
|
2055 fprintf(fd, "%s%s%s<BR>\n", t1, t2, logstr->str); |
6330d0bb309f
[gaim-migrate @ 1450]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1439
diff
changeset
|
2056 g_string_free(logstr, TRUE); |
1437
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
2057 } |
1067
649199f4730e
[gaim-migrate @ 1077]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
2058 fclose(fd); |
936 | 2059 } |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
2060 g_free(t1); |
1437
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
2061 g_free(t2); |
1f0660a2c893
[gaim-migrate @ 1447]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1434
diff
changeset
|
2062 g_free(nm); |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
2063 } |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
2064 } |
66 | 2065 |
3597 | 2066 if (!flags & WFLAG_NOLOG && ((c->is_chat && (chat_options & OPT_CHAT_POPUP)) || |
2067 (!c->is_chat && (im_options & OPT_IM_POPUP)))) | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
2068 gdk_window_show(c->window->window); |
3022 | 2069 if (flags & WFLAG_RECV) |
2070 reset_typing(g_strdup(c->name)); | |
66 | 2071 |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2072 /* tab highlighting */ |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2073 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
|
2074 return; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2075 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
|
2076 return; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2077 if (!(flags & WFLAG_RECV) && !(flags & WFLAG_SYSTEM)) |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2078 return; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2079 if ((c->unseen == 2) || ((c->unseen == 1) && !(flags & WFLAG_NICK))) |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2080 return; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2081 |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2082 if (c->is_chat) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2083 int offs; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2084 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
|
2085 offs = g_list_length(conversations); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2086 else |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2087 offs = 0; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2088 if (gtk_notebook_get_current_page(GTK_NOTEBOOK(chat_notebook)) == |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2089 g_list_index(chats, c) + offs) |
2993 | 2090 unhighlight = 1; |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2091 } else { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2092 if (gtk_notebook_get_current_page(GTK_NOTEBOOK(convo_notebook)) == |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2093 g_list_index(conversations, c)) |
2993 | 2094 unhighlight = 1; |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2095 } |
2993 | 2096 if ((c->unseen != -1) && unhighlight) /* If there's no typing message |
2097 and we're on the same tab, don't bother | |
2098 changing the color. */ | |
2099 return; | |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2100 |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2101 { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2102 GtkNotebook *notebook = GTK_NOTEBOOK(c->is_chat ? chat_notebook : convo_notebook); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2103 int offs = ((convo_options & OPT_CONVO_COMBINE) && |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2104 (im_options & OPT_IM_ONE_WINDOW) && c->is_chat) ? |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2105 g_list_length(conversations) : 0; |
1692
a312d64a995d
[gaim-migrate @ 1702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1663
diff
changeset
|
2106 GList *ws = (c->is_chat ? chats : conversations); |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2107 GtkWidget *label = gtk_notebook_get_tab_label(notebook, |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2108 gtk_notebook_get_nth_page(notebook, |
3022 | 2109 offs + g_list_index(ws, c))); |
2625
d8d2df2bdf01
[gaim-migrate @ 2638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2619
diff
changeset
|
2110 GtkStyle *style; |
d8d2df2bdf01
[gaim-migrate @ 2638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2619
diff
changeset
|
2111 style = gtk_style_new(); |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2112 if (!GTK_WIDGET_REALIZED(label)) |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2113 gtk_widget_realize(label); |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2722
diff
changeset
|
2114 gtk_style_set_font(style, gdk_font_ref(gtk_style_get_font(label->style))); |
2993 | 2115 if (!unhighlight && flags & WFLAG_NICK) { |
2625
d8d2df2bdf01
[gaim-migrate @ 2638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2619
diff
changeset
|
2116 style->fg[0].red = 0x0000; |
d8d2df2bdf01
[gaim-migrate @ 2638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2619
diff
changeset
|
2117 style->fg[0].green = 0x0000; |
d8d2df2bdf01
[gaim-migrate @ 2638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2619
diff
changeset
|
2118 style->fg[0].blue = 0xcccc; |
d8d2df2bdf01
[gaim-migrate @ 2638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2619
diff
changeset
|
2119 c->unseen = 2; |
2993 | 2120 } else if (!unhighlight) { |
2625
d8d2df2bdf01
[gaim-migrate @ 2638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2619
diff
changeset
|
2121 style->fg[0].red = 0xcccc; |
d8d2df2bdf01
[gaim-migrate @ 2638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2619
diff
changeset
|
2122 style->fg[0].green = 0x0000; |
d8d2df2bdf01
[gaim-migrate @ 2638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2619
diff
changeset
|
2123 style->fg[0].blue = 0x0000; |
d8d2df2bdf01
[gaim-migrate @ 2638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2619
diff
changeset
|
2124 c->unseen = 1; |
2993 | 2125 } else { |
2126 c->unseen = 0; | |
2625
d8d2df2bdf01
[gaim-migrate @ 2638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2619
diff
changeset
|
2127 } |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2128 gtk_widget_set_style(label, style); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2129 gtk_style_unref(style); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2130 } |
66 | 2131 } |
2132 | |
2993 | 2133 void update_progress(struct conversation *c, float percent) { |
3044 | 2134 |
2993 | 2135 if (percent >= 1 && !(c->progress)) |
2136 return; | |
2137 | |
2138 if (percent >= 1) { | |
2139 gtk_widget_destroy(c->progress); | |
2140 c->progress = NULL; | |
2141 return; | |
2142 } | |
2143 | |
2144 if (!c->progress) { | |
2145 GtkBox *box = GTK_BOX(c->text->parent->parent); | |
2146 c->progress = gtk_progress_bar_new(); | |
2147 gtk_box_pack_end(box, c->progress, FALSE, FALSE, 0); | |
2148 gtk_widget_set_usize (c->progress, 1, 8); | |
2149 gtk_widget_show (c->progress); | |
2150 } | |
2151 | |
2152 if (percent < 1) | |
2153 gtk_progress_set_percentage(GTK_PROGRESS(c->progress), percent); | |
2154 } | |
66 | 2155 |
3671 | 2156 GtkWidget *build_conv_menubar(struct conversation *c) |
2157 { | |
3704 | 2158 GtkWidget *hb; |
3671 | 2159 GtkWidget *menubar; |
2160 GtkWidget *menu; | |
2161 GtkWidget *menuitem; | |
2162 | |
3704 | 2163 |
2164 hb = gtk_handle_box_new(); | |
2165 | |
3671 | 2166 menubar = gtk_menu_bar_new(); |
2167 | |
3704 | 2168 gtk_container_add(GTK_CONTAINER(hb), menubar); |
2169 | |
3671 | 2170 menu = gtk_menu_new(); |
2171 | |
2172 /* The file menu */ | |
2173 menuitem = gaim_new_item(NULL, _("File")); | |
2174 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu); | |
2175 gtk_menu_bar_append(GTK_MENU_BAR(menubar), menuitem); | |
2176 | |
2177 gaim_new_item_from_stock(menu, _("_Save Conversation"), "gtk-save-as", GTK_SIGNAL_FUNC(save_convo), c, 0, 0, NULL); | |
2178 | |
2179 gaim_new_item_from_stock(menu, _("View _History"), NULL, GTK_SIGNAL_FUNC(conv_show_log), GINT_TO_POINTER(c->name), 0, 0, NULL); | |
2180 | |
2181 menuitem = gtk_menu_item_new(); | |
2182 gtk_menu_append(GTK_MENU(menu), menuitem); | |
2183 /* | |
2184 c->sendfile_btn = gaim_new_item_from_pixbuf(menu, _("Send File"), "send-file-small.png", NULL, NULL, 0, 0, NULL); */ | |
2185 | |
2186 gaim_new_item_from_pixbuf(menu, _("Insert URL"), NULL, GTK_SIGNAL_FUNC(insert_link_cb), c, 0, 0, NULL); | |
2187 c->image_menubtn = gaim_new_item_from_pixbuf(menu, _("Insert Image"), "insert-image-small.png", GTK_SIGNAL_FUNC(insert_image), c, 0, 0, NULL); | |
2188 | |
2189 menuitem = gtk_menu_item_new(); | |
2190 gtk_menu_append(GTK_MENU(menu), menuitem); | |
2191 | |
2192 gaim_new_item_from_stock(menu, _("_Close"), "gtk-close", GTK_SIGNAL_FUNC(close_callback), c, 0, 0, NULL); | |
2193 | |
2194 /* The Options menu */ | |
2195 menu = gtk_menu_new(); | |
2196 | |
2197 menuitem = gaim_new_item(NULL, _("Options")); | |
2198 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu); | |
2199 gtk_menu_bar_append(GTK_MENU_BAR(menubar), menuitem); | |
2200 | |
2201 /* Logging */ | |
2202 menuitem = gtk_check_menu_item_new_with_mnemonic(_("Enable _Logging")); | |
2203 c->log_button = menuitem; /* We should save this */ | |
2204 | |
2205 state_lock = 1; | |
3699 | 2206 |
3671 | 2207 if (find_log_info(c->name)) |
3699 | 2208 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE); |
3671 | 2209 else |
3699 | 2210 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), FALSE); |
2211 | |
3671 | 2212 state_lock = 0; |
2213 | |
2214 gtk_signal_connect(GTK_OBJECT(menuitem), "toggled", GTK_SIGNAL_FUNC(toggle_loggle), c); | |
2215 | |
2216 /* Sounds */ | |
2217 | |
2218 gtk_menu_append(GTK_MENU(menu), menuitem); | |
2219 | |
2220 menuitem = gtk_check_menu_item_new_with_mnemonic(_("Enable _Sounds")); | |
2221 c->makesound = 1; | |
2222 gtk_signal_connect(GTK_OBJECT(menuitem), "toggled", GTK_SIGNAL_FUNC(toggle_sound), c); | |
3679 | 2223 state_lock = 1; |
3671 | 2224 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE); |
3679 | 2225 state_lock = 0; |
3671 | 2226 gtk_menu_append(GTK_MENU(menu), menuitem); |
2227 | |
2228 | |
2229 | |
2230 /* Now set the current values or something */ | |
2231 gtk_widget_set_sensitive(GTK_WIDGET(c->log_button), (logging_options & OPT_LOG_CONVOS) ? FALSE : TRUE); | |
2232 | |
3704 | 2233 gtk_widget_show_all(hb); |
2234 | |
2235 return hb; | |
3671 | 2236 |
2237 } | |
2238 | |
3689 | 2239 GtkWidget *build_conv_toolbar(struct conversation *c) |
3671 | 2240 { |
2241 GtkWidget *vbox; | |
2242 GtkWidget *hbox; | |
2243 GtkWidget *button; | |
2244 GtkWidget *sep; | |
2245 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); | |
2246 /* | |
2247 c->toolbar = toolbar; | |
2248 c->bold = bold; | |
2249 c->strike = strike; | |
2250 c->italic = italic; | |
2251 c->underline = underline; | |
2252 c->log_button = wood; | |
2253 c->viewer_button = viewer; | |
2254 c->fgcolorbtn = fgcolorbtn; | |
2255 c->bgcolorbtn = bgcolorbtn; | |
2256 c->link = link; | |
2257 c->wood = wood; | |
2258 c->font = font; | |
2259 c->smiley = smiley; | |
2260 c->imagebtn = image; | |
2261 c->speaker = speaker; | |
2262 c->speaker_p = speaker_p; | |
2263 */ | |
2264 | |
2265 vbox = gtk_vbox_new(FALSE, 0); | |
2266 sep = gtk_hseparator_new(); | |
2267 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); | |
2268 | |
2269 hbox = gtk_hbox_new(FALSE, 5); | |
2270 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
2271 | |
2272 /* Bold */ | |
2273 button = gaim_pixbuf_toolbar_button_from_stock("gtk-bold"); | |
2274 gtk_size_group_add_widget(sg, button); | |
2275 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2276 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(do_bold), c->entry); | |
2277 c->bold = button; /* We should remember this */ | |
2278 | |
2279 /* Italic */ | |
2280 button = gaim_pixbuf_toolbar_button_from_stock("gtk-italic"); | |
2281 gtk_size_group_add_widget(sg, button); | |
2282 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2283 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(do_italic), c->entry); | |
2284 c->italic = button; /* We should remember this */ | |
2285 | |
2286 /* Underline */ | |
2287 button = gaim_pixbuf_toolbar_button_from_stock("gtk-underline"); | |
2288 gtk_size_group_add_widget(sg, button); | |
2289 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2290 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(do_underline), c->entry); | |
2291 c->underline = button; /* We should remember this */ | |
2292 | |
2293 /* Sep */ | |
2294 sep = gtk_vseparator_new(); | |
2295 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0); | |
2296 | |
2297 /* Increase font size */ | |
2298 button = gaim_pixbuf_toolbar_button_from_file("text_bigger.png"); | |
2299 gtk_size_group_add_widget(sg, button); | |
2300 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2301 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(do_big), c->entry); | |
2302 | |
2303 /* Normal Font Size */ | |
2304 button = gaim_pixbuf_toolbar_button_from_file("text_normal.png"); | |
2305 gtk_size_group_add_widget(sg, button); | |
2306 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2307 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(do_normal), c->entry); | |
2308 c->font = button; /* We should remember this */ | |
2309 | |
2310 /* Decrease font size */ | |
2311 button = gaim_pixbuf_toolbar_button_from_file("text_smaller.png"); | |
2312 gtk_size_group_add_widget(sg, button); | |
2313 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2314 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(do_small), c->entry); | |
2315 | |
2316 /* Sep */ | |
2317 sep = gtk_vseparator_new(); | |
2318 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0); | |
2319 | |
2320 /* Font Color */ | |
2321 button = gaim_pixbuf_toolbar_button_from_stock("gtk-select-color"); | |
2322 gtk_size_group_add_widget(sg, button); | |
2323 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2324 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_fg_color), c); | |
2325 c->fgcolorbtn = button; /* We should remember this */ | |
2326 | |
2327 /* Font Color */ | |
2328 button = gaim_pixbuf_toolbar_button_from_stock("gtk-select-color"); | |
2329 gtk_size_group_add_widget(sg, button); | |
2330 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2331 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_bg_color), c); | |
2332 c->bgcolorbtn = button; /* We should remember this */ | |
2333 | |
2334 | |
2335 /* Sep */ | |
2336 sep = gtk_vseparator_new(); | |
2337 gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 0); | |
2338 | |
2339 /* Insert IM Image */ | |
2340 button = gaim_pixbuf_toolbar_button_from_file("insert-image-small.png"); | |
2341 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(insert_image), c); | |
2342 gtk_size_group_add_widget(sg, button); | |
2343 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2344 c->imagebtn = button; | |
2345 | |
2346 /* Insert Link */ | |
2347 button = gaim_pixbuf_toolbar_button_from_file("insert-link-small.png"); | |
2348 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_link), c); | |
2349 gtk_size_group_add_widget(sg, button); | |
2350 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2351 c->link = button; | |
2352 | |
2353 /* Insert Smiley */ | |
2354 button = gaim_pixbuf_toolbar_button_from_file("insert-smiley-small.png"); | |
2355 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(insert_smiley), c); | |
2356 gtk_size_group_add_widget(sg, button); | |
2357 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2358 c->smiley = button; | |
2359 | |
2360 sep = gtk_hseparator_new(); | |
2361 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); | |
2362 | |
2363 gtk_widget_show_all(vbox); | |
2364 | |
2365 return vbox; | |
2366 } | |
2367 | |
1898
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2368 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
|
2369 { |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2370 struct conversation *cnv = gtk_object_get_user_data(m); |
1898
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2371 |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2372 if (cnv->gc == c) |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2373 return; |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2374 |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2375 cnv->gc = c; |
1340 | 2376 |
2787
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
2377 set_convo_title(cnv); |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
2378 |
1342 | 2379 update_buttons_by_protocol(cnv); |
1898
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2380 |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
2381 update_icon(cnv); |
2231
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
2382 update_checkbox(cnv); |
3050 | 2383 update_smilies(cnv); |
3081 | 2384 gaim_setup_imhtml_smileys(cnv->text); |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2385 } |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2386 |
2379
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2387 int set_dispstyle(int chat) |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2388 { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2389 int dispstyle; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2390 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2391 if (chat) { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2392 switch (chat_options & (OPT_CHAT_BUTTON_TEXT | OPT_CHAT_BUTTON_XPM)) { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2393 case OPT_CHAT_BUTTON_TEXT: |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2394 dispstyle = 1; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2395 break; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2396 case OPT_CHAT_BUTTON_XPM: |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2397 dispstyle = 0; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2398 break; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2399 default: /* both or neither */ |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2400 dispstyle = 2; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2401 break; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2402 } |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2403 } else { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2404 switch (im_options & (OPT_IM_BUTTON_TEXT | OPT_IM_BUTTON_XPM)) { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2405 case OPT_IM_BUTTON_TEXT: |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2406 dispstyle = 1; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2407 break; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2408 case OPT_IM_BUTTON_XPM: |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2409 dispstyle = 0; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2410 break; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2411 default: /* both or neither */ |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2412 dispstyle = 2; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2413 break; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2414 } |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2415 } |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2416 return dispstyle; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2417 } |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2375
diff
changeset
|
2418 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2419 void update_convo_add_button(struct conversation *c) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2420 { |
3716
d7e83b4db191
[gaim-migrate @ 3849]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3705
diff
changeset
|
2421 /*int dispstyle = set_dispstyle(0);*/ |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2422 GtkWidget *parent = c->add->parent; |
1663
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2423 gboolean rebuild = FALSE; |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
2424 |
1352 | 2425 if (find_buddy(c->gc, c->name)) { |
1663
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2426 if (!gtk_object_get_user_data(GTK_OBJECT(c->add))) { |
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2427 gtk_widget_destroy(c->add); |
3671 | 2428 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
|
2429 rebuild = TRUE; |
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2430 } |
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2431 if (c->gc) { |
1352 | 2432 if (c->gc->prpl->remove_buddy == NULL) |
2433 gtk_widget_set_sensitive(c->add, FALSE); | |
2434 else | |
2435 gtk_widget_set_sensitive(c->add, TRUE); | |
1663
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2436 } else |
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2437 gtk_widget_set_sensitive(c->add, FALSE); |
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2438 gtk_object_set_user_data(GTK_OBJECT(c->add), c); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2439 } else { |
1663
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2440 if (gtk_object_get_user_data(GTK_OBJECT(c->add))) { |
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2441 gtk_widget_destroy(c->add); |
3671 | 2442 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
|
2443 rebuild = TRUE; |
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2444 } |
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2445 if (c->gc) { |
1352 | 2446 if (c->gc->prpl->add_buddy == NULL) |
2447 gtk_widget_set_sensitive(c->add, FALSE); | |
2448 else | |
2449 gtk_widget_set_sensitive(c->add, TRUE); | |
1663
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2450 } else |
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2451 gtk_widget_set_sensitive(c->add, FALSE); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2452 } |
1352 | 2453 |
1663
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2454 if (rebuild) { |
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2455 gtk_signal_connect(GTK_OBJECT(c->add), "clicked", GTK_SIGNAL_FUNC(add_callback), c); |
3671 | 2456 gtk_box_pack_start(GTK_BOX(parent), c->add, FALSE, FALSE, 0); |
2457 gtk_box_reorder_child(GTK_BOX(parent), c->add, 3); | |
2458 gtk_button_set_relief(GTK_BUTTON(c->add), GTK_RELIEF_NONE); | |
2459 gtk_size_group_add_widget(c->sg, c->add); | |
1663
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2460 gtk_widget_show(c->add); |
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2461 } |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2462 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2463 |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2464 static void create_convo_menu(struct conversation *cnv) |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2465 { |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2466 GtkWidget *menu, *opt; |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2467 GSList *g = connections; |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2468 struct gaim_connection *c; |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1228
diff
changeset
|
2469 char buf[2048]; |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2470 |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2471 if (g_slist_length(g) < 2) |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2472 gtk_widget_hide(cnv->menu->parent); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2473 else { |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2474 menu = gtk_menu_new(); |
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 while (g) { |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2477 c = (struct gaim_connection *)g->data; |
3572 | 2478 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
|
2479 opt = gtk_menu_item_new_with_label(buf); |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2480 gtk_object_set_user_data(GTK_OBJECT(opt), cnv); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2481 gtk_signal_connect(GTK_OBJECT(opt), "activate", |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2482 GTK_SIGNAL_FUNC(convo_sel_send), c); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2483 gtk_widget_show(opt); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2484 gtk_menu_append(GTK_MENU(menu), opt); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2485 g = g->next; |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2486 } |
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 gtk_option_menu_remove_menu(GTK_OPTION_MENU(cnv->menu)); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2489 gtk_option_menu_set_menu(GTK_OPTION_MENU(cnv->menu), menu); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2490 gtk_option_menu_set_history(GTK_OPTION_MENU(cnv->menu), 0); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2491 |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2492 gtk_widget_show(cnv->menu); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2493 gtk_widget_show(cnv->menu->parent); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2494 } |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2495 } |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2496 |
2111
109669b3887e
[gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2109
diff
changeset
|
2497 void redo_convo_menus() |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2498 { |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2499 GList *c = conversations; |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2500 struct conversation *C; |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2501 |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2502 while (c) { |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2503 C = (struct conversation *)c->data; |
1898
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2504 c = c->next; |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2505 |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2506 create_convo_menu(C); |
993
eacd93d0089a
[gaim-migrate @ 1003]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
2507 |
2111
109669b3887e
[gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2109
diff
changeset
|
2508 if (g_slist_find(connections, C->gc)) |
2487
43a75ca5b909
[gaim-migrate @ 2500]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2483
diff
changeset
|
2509 set_convo_gc(C, C->gc); |
43a75ca5b909
[gaim-migrate @ 2500]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2483
diff
changeset
|
2510 else |
43a75ca5b909
[gaim-migrate @ 2500]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2483
diff
changeset
|
2511 set_convo_gc(C, connections ? connections->data : NULL); |
2111
109669b3887e
[gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2109
diff
changeset
|
2512 } |
109669b3887e
[gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2109
diff
changeset
|
2513 } |
109669b3887e
[gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2109
diff
changeset
|
2514 |
109669b3887e
[gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2109
diff
changeset
|
2515 void convo_menu_remove(struct gaim_connection *gc) |
109669b3887e
[gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2109
diff
changeset
|
2516 { |
109669b3887e
[gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2109
diff
changeset
|
2517 GList *c = conversations; |
109669b3887e
[gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2109
diff
changeset
|
2518 struct conversation *C; |
109669b3887e
[gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2109
diff
changeset
|
2519 |
109669b3887e
[gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2109
diff
changeset
|
2520 while (c) { |
109669b3887e
[gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2109
diff
changeset
|
2521 C = (struct conversation *)c->data; |
109669b3887e
[gaim-migrate @ 2121]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2109
diff
changeset
|
2522 c = c->next; |
2109
3110ea142888
[gaim-migrate @ 2119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2104
diff
changeset
|
2523 |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
2524 remove_icon(C); |
2231
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
2525 remove_checkbox(C); |
1898
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2526 } |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2527 } |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2528 |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2529 void set_convo_gc(struct conversation *c, struct gaim_connection *gc) |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2530 { |
2722
abecab600451
[gaim-migrate @ 2735]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2706
diff
changeset
|
2531 if (gc) |
abecab600451
[gaim-migrate @ 2735]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2706
diff
changeset
|
2532 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
|
2533 |
1898
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2534 if (c->gc == gc) |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2535 return; |
993
eacd93d0089a
[gaim-migrate @ 1003]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
2536 |
1898
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2537 c->gc = gc; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2538 |
2787
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
2539 set_convo_title(c); |
1898
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2540 update_buttons_by_protocol(c); |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2541 |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
2542 update_icon(c); |
2231
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
2543 update_checkbox(c); |
3051 | 2544 update_smilies(c); |
3081 | 2545 gaim_setup_imhtml_smileys(c->text); |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2546 } |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2547 |
1340 | 2548 void update_buttons_by_protocol(struct conversation *c) |
2549 { | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
2550 if (!c->gc) { |
2619
536198196dc6
[gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
2551 if (c->info) |
536198196dc6
[gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
2552 gtk_widget_set_sensitive(c->info, FALSE); |
536198196dc6
[gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
2553 if (c->send) |
536198196dc6
[gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
2554 gtk_widget_set_sensitive(c->send, FALSE); |
536198196dc6
[gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
2555 if (c->warn) |
536198196dc6
[gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
2556 gtk_widget_set_sensitive(c->warn, FALSE); |
536198196dc6
[gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
2557 if (c->block) |
536198196dc6
[gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
2558 gtk_widget_set_sensitive(c->block, FALSE); |
536198196dc6
[gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
2559 if (c->add) |
536198196dc6
[gaim-migrate @ 2632]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2582
diff
changeset
|
2560 gtk_widget_set_sensitive(c->add, FALSE); |
2546
d392e9b867e9
[gaim-migrate @ 2559]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2541
diff
changeset
|
2561 if (c->whisper) |
d392e9b867e9
[gaim-migrate @ 2559]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2541
diff
changeset
|
2562 gtk_widget_set_sensitive(c->whisper, FALSE); |
d392e9b867e9
[gaim-migrate @ 2559]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2541
diff
changeset
|
2563 if (c->invite) |
d392e9b867e9
[gaim-migrate @ 2559]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2541
diff
changeset
|
2564 gtk_widget_set_sensitive(c->invite, FALSE); |
1352 | 2565 return; |
2566 } | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
2567 |
1532
249a770bebd7
[gaim-migrate @ 1542]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
2568 if (c->gc->prpl->get_info == NULL && c->info) |
1340 | 2569 gtk_widget_set_sensitive(c->info, FALSE); |
1398
f6b0cf1f4c3b
[gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1370
diff
changeset
|
2570 else if (c->info) |
1340 | 2571 gtk_widget_set_sensitive(c->info, TRUE); |
3671 | 2572 /* |
2573 if (!c->is_chat && c->gc->prpl->file_transfer_out) | |
2574 gtk_widget_set_sensitive(c->sendfile_btn, TRUE); | |
2575 else | |
2576 gtk_widget_set_sensitive(c->sendfile_btn, FALSE); | |
2577 */ | |
2094
be10a1243ed7
[gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
2578 if (c->is_chat) { |
be10a1243ed7
[gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
2579 if (c->gc->prpl->chat_send == NULL && c->send) |
be10a1243ed7
[gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
2580 gtk_widget_set_sensitive(c->send, FALSE); |
be10a1243ed7
[gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
2581 else |
be10a1243ed7
[gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
2582 gtk_widget_set_sensitive(c->send, TRUE); |
3671 | 2583 |
3044 | 2584 gtk_widget_set_sensitive(c->imagebtn, FALSE); |
3671 | 2585 gtk_widget_set_sensitive(c->image_menubtn, FALSE); |
2094
be10a1243ed7
[gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
2586 } else { |
be10a1243ed7
[gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
2587 if (c->gc->prpl->send_im == NULL && c->send) |
be10a1243ed7
[gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
2588 gtk_widget_set_sensitive(c->send, FALSE); |
be10a1243ed7
[gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
2589 else |
be10a1243ed7
[gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
2590 gtk_widget_set_sensitive(c->send, TRUE); |
3671 | 2591 if (c->gc->prpl->options & OPT_PROTO_IM_IMAGE) { |
3044 | 2592 gtk_widget_set_sensitive(c->imagebtn, TRUE); |
3671 | 2593 gtk_widget_set_sensitive(c->image_menubtn, TRUE); |
2594 } | |
2595 else { | |
2596 gtk_widget_set_sensitive(c->image_menubtn, FALSE); | |
3044 | 2597 gtk_widget_set_sensitive(c->imagebtn, FALSE); |
3671 | 2598 } |
2094
be10a1243ed7
[gaim-migrate @ 2104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
2599 } |
1341 | 2600 |
1343 | 2601 if (c->gc->prpl->warn == NULL && c->warn) |
1341 | 2602 gtk_widget_set_sensitive(c->warn, FALSE); |
1398
f6b0cf1f4c3b
[gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1370
diff
changeset
|
2603 else if (c->warn) |
1341 | 2604 gtk_widget_set_sensitive(c->warn, TRUE); |
2605 | |
1343 | 2606 if (c->gc->prpl->add_permit == NULL && c->block) |
1341 | 2607 gtk_widget_set_sensitive(c->block, FALSE); |
1398
f6b0cf1f4c3b
[gaim-migrate @ 1408]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1370
diff
changeset
|
2608 else if (c->block) |
1341 | 2609 gtk_widget_set_sensitive(c->block, TRUE); |
2610 | |
1343 | 2611 if (c->add) |
2612 update_convo_add_button(c); | |
2613 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
2614 if (c->whisper) { |
1343 | 2615 if (c->gc->prpl->chat_whisper == NULL) |
2616 gtk_widget_set_sensitive(c->whisper, FALSE); | |
2617 else | |
2618 gtk_widget_set_sensitive(c->whisper, TRUE); | |
2619 } | |
2620 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
2621 if (c->invite) { |
1343 | 2622 if (c->gc->prpl->chat_invite == NULL) |
2623 gtk_widget_set_sensitive(c->invite, FALSE); | |
2624 else | |
2625 gtk_widget_set_sensitive(c->invite, TRUE); | |
2626 } | |
1340 | 2627 } |
2628 | |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2629 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
|
2630 { |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2631 GtkWidget *label = gtk_notebook_get_tab_label(notebook, |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2632 gtk_notebook_get_nth_page(notebook, page_num)); |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2633 GtkStyle *style; |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2634 struct conversation *c; |
3677 | 2635 |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2636 if ((convo_options & OPT_CONVO_COMBINE) && |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2637 (im_options & OPT_IM_ONE_WINDOW) && |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2638 (chat_options & OPT_CHAT_ONE_WINDOW)) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2639 int len = g_list_length(conversations); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2640 if (page_num < len) |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2641 c = g_list_nth_data(conversations, page_num); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2642 else |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2643 c = g_list_nth_data(chats, page_num - len); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2644 } else if (GTK_WIDGET(notebook) == convo_notebook) |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2645 c = g_list_nth_data(conversations, page_num); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2646 else |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2647 c = g_list_nth_data(chats, page_num); |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2648 if (c && c->window && c->entry) |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2649 gtk_window_set_focus(GTK_WINDOW(c->window), c->entry); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2650 if (!GTK_WIDGET_REALIZED(label)) |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2651 return; |
2993 | 2652 if (c->unseen == -1) return; |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2653 style = gtk_style_new(); |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2722
diff
changeset
|
2654 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
|
2655 gtk_widget_set_style(label, style); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2656 gtk_style_unref(style); |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2657 if (c) |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2658 c->unseen = 0; |
3677 | 2659 |
2660 if (!c->is_chat) { | |
2661 GtkWidget *menubar; | |
3683 | 2662 GtkWidget *parent = convo_notebook->parent; |
3677 | 2663 |
2664 gtk_widget_freeze_child_notify(GTK_WIDGET(c->window)); | |
3683 | 2665 |
2666 if (convo_menubar != NULL) | |
2667 gtk_widget_destroy(convo_menubar); | |
2668 | |
3677 | 2669 menubar = build_conv_menubar(c); |
2670 gtk_box_pack_start(GTK_BOX(parent), menubar, FALSE, TRUE, 0); | |
2671 gtk_box_reorder_child(GTK_BOX(parent), menubar, 0); | |
2672 convo_menubar = menubar; | |
2673 | |
2674 gtk_widget_thaw_child_notify(GTK_WIDGET(c->window)); | |
2675 } else { | |
2676 gtk_widget_destroy(convo_menubar); | |
3683 | 2677 convo_menubar = NULL; |
3677 | 2678 } |
3705 | 2679 |
2680 gtk_imhtml_to_bottom(c->text); | |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2681 } |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2682 |
2993 | 2683 void show_typing(struct conversation *c) { |
2684 | |
2685 if (c->is_chat) /* We shouldn't be getting typing notifications from chats. */ | |
2686 return; | |
2687 if (im_options & OPT_IM_ONE_WINDOW) { /* We'll make the tab green */ | |
3003 | 2688 GtkStyle *style; |
2689 GtkNotebook *notebook = GTK_NOTEBOOK(c->is_chat ? chat_notebook : convo_notebook); | |
2690 int offs = ((convo_options & OPT_CONVO_COMBINE) && | |
2691 (im_options & OPT_IM_ONE_WINDOW) && c->is_chat) ? | |
2692 g_list_length(conversations) : 0; | |
2693 GList *ws = (c->is_chat ? chats : conversations); | |
2694 GtkWidget *label = gtk_notebook_get_tab_label(notebook, | |
2695 gtk_notebook_get_nth_page(notebook, | |
2696 offs + g_list_index(ws, c))); | |
2993 | 2697 style = gtk_style_new(); |
2698 if (!GTK_WIDGET_REALIZED(label)) | |
2699 gtk_widget_realize(label); | |
2700 gtk_style_set_font(style, gdk_font_ref(gtk_style_get_font(label->style))); | |
2701 style->fg[0].red = 0x0000; | |
2702 style->fg[0].green = 0x9999; | |
2703 style->fg[0].blue = 0x0000; | |
2704 gtk_widget_set_style(label, style); | |
2705 debug_printf("setting style\n"); | |
2706 gtk_style_unref(style); | |
2707 c->unseen = -1; | |
2708 } else { | |
2709 GtkWindow *win = (GtkWindow *)c->window; | |
2710 char *buf; | |
2711 if (strstr(win->title, " [TYPING]")) | |
2712 return; | |
2713 buf = g_malloc(strlen(win->title) + strlen(" [TYPING]") + 1); | |
2714 g_snprintf(buf, | |
2715 strlen(win->title) + strlen(" [TYPING]") + 1, "%s [TYPING]", | |
2716 win->title); | |
2717 gtk_window_set_title(win, buf); | |
2718 g_free(buf); | |
2719 } | |
2720 | |
2721 } | |
2722 | |
2723 /* This returns a boolean, so that it can timeout */ | |
2724 gboolean reset_typing(char *name) { | |
2725 struct conversation *c = find_conversation(name); | |
2726 if (!c) { | |
2727 g_free(name); | |
2728 return FALSE; | |
2729 } | |
2730 /* Reset the title (if necessary) */ | |
2731 if (c->is_chat) { | |
2732 g_free(name); | |
2733 c->typing_timeout = 0; | |
2734 return FALSE; | |
2735 } | |
2736 if (!(im_options & OPT_IM_ONE_WINDOW)) { | |
2737 GtkWindow *win = (GtkWindow*)c->window; | |
2738 char *new_title; | |
2739 if (strstr(win->title, " [TYPING]")) { | |
2740 new_title = g_malloc(strlen(win->title) - strlen("[TYPING]")); | |
2741 g_snprintf(new_title, strlen(win->title) - strlen("[TYPING]"), win->title); | |
2742 gtk_window_set_title(win, new_title); | |
2743 g_free(new_title); | |
2744 | |
2745 } | |
2746 } else if (c->unseen == -1) { | |
2747 GtkNotebook *notebook = GTK_NOTEBOOK(convo_notebook); | |
2748 int offs = ((convo_options & OPT_CONVO_COMBINE) && | |
2749 (im_options & OPT_IM_ONE_WINDOW) && c->is_chat) ? | |
2750 g_list_length(conversations) : 0; | |
2751 GList *ws = (conversations); | |
2752 GtkWidget *label = gtk_notebook_get_tab_label(notebook, | |
2753 gtk_notebook_get_nth_page(notebook, | |
2754 offs + g_list_index(ws, c))); | |
2755 GtkStyle *style; | |
2756 style = gtk_style_new(); | |
2757 if (!GTK_WIDGET_REALIZED(label)) | |
2758 gtk_widget_realize(label); | |
2759 gtk_style_set_font(style, gdk_font_ref(gtk_style_get_font(label->style))); | |
2760 c->unseen = 0; | |
2761 gtk_widget_set_style(label, style); | |
2762 gtk_style_unref(style); | |
2763 } | |
2764 g_free(name); | |
2765 c->typing_timeout = 0; | |
2766 return FALSE; | |
2767 } | |
1340 | 2768 |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2769 void show_conv(struct conversation *c) |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2770 { |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2771 GtkWidget *win; |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2772 GtkWidget *cont; |
615 | 2773 GtkWidget *text; |
2774 GtkWidget *sw; | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2775 GtkWidget *send; |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2776 GtkWidget *info; |
615 | 2777 GtkWidget *warn; |
2778 GtkWidget *block; | |
3716
d7e83b4db191
[gaim-migrate @ 3849]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3705
diff
changeset
|
2779 /*GtkWidget *close;*/ |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2780 GtkWidget *entry; |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2781 GtkWidget *bbox; |
615 | 2782 GtkWidget *vbox; |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2783 GtkWidget *vbox2; |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2784 GtkWidget *paned; |
615 | 2785 GtkWidget *add; |
623 | 2786 GtkWidget *toolbar; |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2787 GtkWidget *hbox; |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2788 GtkWidget *label; |
3671 | 2789 GtkWidget *menubar; |
2790 | |
2791 c->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
2792 |
1219
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2793 c->font_dialog = NULL; |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
2794 c->fg_color_dialog = NULL; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
2795 c->bg_color_dialog = NULL; |
1219
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2796 c->smiley_dialog = NULL; |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2797 c->link_dialog = NULL; |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2798 c->log_dialog = NULL; |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2799 sprintf(c->fontface, "%s", fontface); |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2800 c->hasfont = 0; |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2801 c->bgcol = bgcolor; |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2802 c->hasbg = 0; |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2803 c->fgcol = fgcolor; |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2804 c->hasfg = 0; |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2805 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
2806 if (im_options & OPT_IM_ONE_WINDOW) { |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2807 if (!all_convos) { |
3677 | 2808 GtkWidget *testidea; |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2809 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
|
2810 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
|
2811 all_chats = all_convos; |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2812 gtk_window_set_wmclass(GTK_WINDOW(win), "conversation", "Gaim"); |
2335
2c595fc5f1f8
[gaim-migrate @ 2348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2334
diff
changeset
|
2813 gtk_window_set_policy(GTK_WINDOW(win), TRUE, TRUE, FALSE); |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2814 gtk_container_border_width(GTK_CONTAINER(win), 0); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2815 gtk_widget_realize(win); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2816 gtk_window_set_title(GTK_WINDOW(win), _("Gaim - Conversations")); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2817 gtk_signal_connect(GTK_OBJECT(win), "delete_event", |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2818 GTK_SIGNAL_FUNC(delete_all_convo), NULL); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2819 |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2820 convo_notebook = gtk_notebook_new(); |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2821 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
|
2822 chat_notebook = convo_notebook; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
2823 if (im_options & OPT_IM_SIDE_TAB) { |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
2824 if (im_options & OPT_IM_BR_TAB) { |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
2825 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(convo_notebook), |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
2826 GTK_POS_RIGHT); |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
2827 } else { |
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
2828 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(convo_notebook), |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
2829 GTK_POS_LEFT); |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
2830 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
2831 } else { |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
2832 if (im_options & OPT_IM_BR_TAB) { |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
2833 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(convo_notebook), |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
2834 GTK_POS_BOTTOM); |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
2835 } else { |
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
2836 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(convo_notebook), |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
2837 GTK_POS_TOP); |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
2838 } |
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
2839 } |
1596
f5845007e3bc
[gaim-migrate @ 1606]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1595
diff
changeset
|
2840 gtk_notebook_set_scrollable(GTK_NOTEBOOK(convo_notebook), TRUE); |
1597
c1a8a7c40424
[gaim-migrate @ 1607]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1596
diff
changeset
|
2841 gtk_notebook_popup_enable(GTK_NOTEBOOK(convo_notebook)); |
3677 | 2842 |
2843 testidea = gtk_vbox_new(FALSE, 0); | |
2844 | |
2845 menubar = build_conv_menubar(c); | |
2846 gtk_box_pack_start(GTK_BOX(testidea), menubar, FALSE, TRUE, 0); | |
3683 | 2847 gtk_box_pack_start(GTK_BOX(testidea), convo_notebook, TRUE, TRUE, 0); |
2848 gtk_widget_show(testidea); | |
2849 gtk_widget_show(convo_notebook); | |
3677 | 2850 convo_menubar = menubar; |
2851 | |
2852 gtk_container_add(GTK_CONTAINER(win), testidea); | |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2853 gtk_signal_connect(GTK_OBJECT(convo_notebook), "switch-page", |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2854 GTK_SIGNAL_FUNC(convo_switch), NULL); |
3683 | 2855 |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2856 } else |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2857 win = c->window = all_convos; |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2858 |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2859 cont = gtk_vbox_new(FALSE, 5); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2860 gtk_container_set_border_width(GTK_CONTAINER(cont), 5); |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
2861 /* 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
|
2862 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
|
2863 g_list_index(conversations, c)); |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2864 gtk_widget_show(cont); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2865 } else { |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2866 cont = win = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2867 c->window = win; |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2868 gtk_object_set_user_data(GTK_OBJECT(win), c); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2869 gtk_window_set_wmclass(GTK_WINDOW(win), "conversation", "Gaim"); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2870 gtk_window_set_policy(GTK_WINDOW(win), TRUE, TRUE, TRUE); |
3671 | 2871 gtk_container_border_width(GTK_CONTAINER(win), 0); |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2872 gtk_widget_realize(win); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2873 gtk_signal_connect(GTK_OBJECT(win), "delete_event", |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2874 GTK_SIGNAL_FUNC(delete_event_convo), c); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2875 } |
2787
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
2876 set_convo_title(c); |
623 | 2877 |
1219
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2878 paned = gtk_vpaned_new(); |
1228
6773043cf9f6
[gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1227
diff
changeset
|
2879 gtk_paned_set_gutter_size(GTK_PANED(paned), 15); |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2880 gtk_container_add(GTK_CONTAINER(cont), paned); |
1219
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2881 gtk_widget_show(paned); |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2882 |
1228
6773043cf9f6
[gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1227
diff
changeset
|
2883 vbox = gtk_vbox_new(FALSE, 5); |
1219
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2884 gtk_paned_pack1(GTK_PANED(paned), vbox, FALSE, TRUE); |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2885 gtk_widget_show(vbox); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2886 |
3677 | 2887 if (!(im_options & OPT_IM_ONE_WINDOW)) { |
2888 menubar = build_conv_menubar(c); | |
2889 gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0); | |
2890 } | |
3671 | 2891 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
2892 sw = gtk_scrolled_window_new(NULL, NULL); |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
2893 c->sw = sw; |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
2894 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
|
2895 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
|
2896 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
|
2897 gtk_widget_show(sw); |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2898 |
1428
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
2899 text = gtk_imhtml_new(NULL, NULL); |
1219
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2900 c->text = text; |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2901 gtk_container_add(GTK_CONTAINER(sw), text); |
1428
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
2902 GTK_LAYOUT(text)->hadjustment->step_increment = 10.0; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
2903 GTK_LAYOUT(text)->vadjustment->step_increment = 10.0; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
2904 if (convo_options & OPT_CONVO_SHOW_TIME) |
1428
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
2905 gtk_imhtml_show_comments(GTK_IMHTML(text), TRUE); |
1815
f15d449b3167
[gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1813
diff
changeset
|
2906 gaim_setup_imhtml(text); |
1219
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2907 gtk_widget_show(text); |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2908 |
1228
6773043cf9f6
[gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1227
diff
changeset
|
2909 vbox2 = gtk_vbox_new(FALSE, 5); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2910 gtk_paned_pack2(GTK_PANED(paned), vbox2, FALSE, FALSE); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2911 gtk_widget_show(vbox2); |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2912 |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2913 hbox = gtk_hbox_new(FALSE, 0); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2914 gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2915 gtk_widget_show(hbox); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2916 |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2917 label = gtk_label_new(_("Send message as: ")); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2918 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2919 gtk_widget_show(label); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2920 |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2921 c->menu = gtk_option_menu_new(); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2922 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
|
2923 gtk_widget_show(c->menu); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2924 |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
936
diff
changeset
|
2925 create_convo_menu(c); |
1219
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2926 |
1898
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2927 c->lbox = gtk_hbox_new(FALSE, 0); |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2928 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
|
2929 gtk_widget_show(c->lbox); |
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2930 |
1227
25611364a504
[gaim-migrate @ 1237]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1219
diff
changeset
|
2931 entry = gtk_text_new(NULL, NULL); |
25611364a504
[gaim-migrate @ 1237]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1219
diff
changeset
|
2932 c->entry = entry; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
2933 if (!(im_options & OPT_IM_ONE_WINDOW)) |
1594
ac8eddd16e89
[gaim-migrate @ 1604]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1592
diff
changeset
|
2934 gtk_window_set_focus(GTK_WINDOW(c->window), c->entry); |
1227
25611364a504
[gaim-migrate @ 1237]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1219
diff
changeset
|
2935 |
3689 | 2936 toolbar = build_conv_toolbar(c); |
1228
6773043cf9f6
[gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1227
diff
changeset
|
2937 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
|
2938 |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2939 gtk_object_set_user_data(GTK_OBJECT(entry), c); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2940 gtk_text_set_editable(GTK_TEXT(entry), TRUE); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
2941 gtk_text_set_word_wrap(GTK_TEXT(entry), TRUE); |
3304 | 2942 |
3338 | 2943 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
|
2944 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
2945 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
|
2946 gtk_signal_connect(GTK_OBJECT(entry), "key_press_event", GTK_SIGNAL_FUNC(keypress_callback), c); |
3731 | 2947 gtk_signal_connect(GTK_OBJECT(entry), "insert-text", GTK_SIGNAL_FUNC(insert_text_callback), c); |
2948 gtk_signal_connect(GTK_OBJECT(entry), "delete-text", GTK_SIGNAL_FUNC(delete_text_callback), c); | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
2949 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
|
2950 entry); |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
2951 if (convo_options & OPT_CONVO_CHECK_SPELLING) |
1117
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
2952 gtkspell_attach(GTK_TEXT(c->entry)); |
1228
6773043cf9f6
[gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1227
diff
changeset
|
2953 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
|
2954 gtk_widget_show(entry); |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2955 |
1898
73d73939f698
[gaim-migrate @ 1908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1889
diff
changeset
|
2956 c->bbox = bbox = gtk_hbox_new(FALSE, 5); |
1228
6773043cf9f6
[gaim-migrate @ 1238]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1227
diff
changeset
|
2957 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
|
2958 gtk_widget_show(bbox); |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2959 |
3671 | 2960 /* I'm leaving this here just incase we want to bring this back. I'd rather not have the close |
2961 * button any more. If we do, though, it needs to be on the left side. I might bring it back and put | |
2962 * it on that side. */ | |
2963 | |
2964 /* | |
1219
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2965 close = picture_button2(win, _("Close"), cancel_xpm, dispstyle); |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2966 c->close = close; |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2967 gtk_object_set_user_data(GTK_OBJECT(close), c); |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2968 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
|
2969 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
|
2970 gtk_widget_show(close); |
3671 | 2971 |
1219
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2972 c->sep1 = gtk_vseparator_new(); |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2973 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
|
2974 gtk_widget_show(c->sep1); |
3671 | 2975 */ |
2976 | |
2977 /* Put the send button on the right */ | |
2978 send = gaim_pixbuf_button_from_stock(_("Send"), "gtk-convert", GAIM_BUTTON_VERTICAL); | |
2979 c->send = send; | |
2980 gtk_signal_connect(GTK_OBJECT(send), "clicked", GTK_SIGNAL_FUNC(send_callback), c); | |
2981 gtk_box_pack_end(GTK_BOX(bbox), send, FALSE, FALSE, 0); | |
2982 gtk_widget_show(send); | |
2983 | |
2984 c->sep2 = gtk_vseparator_new(); | |
2985 gtk_box_pack_end(GTK_BOX(bbox), c->sep2, FALSE, TRUE, 0); | |
2986 gtk_widget_show(c->sep2); | |
2987 | |
2988 /* And put the other buttons on the left */ | |
1219
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2989 |
1663
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2990 if (c->gc && find_buddy(c->gc, c->name) != NULL) { |
3671 | 2991 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
|
2992 gtk_object_set_user_data(GTK_OBJECT(add), c); |
0f7d2284296f
[gaim-migrate @ 1673]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
2993 } else |
3671 | 2994 add = gaim_pixbuf_button_from_stock(_("Add"), "gtk-add", GAIM_BUTTON_VERTICAL); |
2995 | |
1219
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2996 c->add = add; |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
2997 gtk_signal_connect(GTK_OBJECT(add), "clicked", GTK_SIGNAL_FUNC(add_callback), c); |
3671 | 2998 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
|
2999 gtk_widget_show(add); |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
3000 |
3671 | 3001 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
|
3002 c->warn = warn; |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
3003 gtk_signal_connect(GTK_OBJECT(warn), "clicked", GTK_SIGNAL_FUNC(warn_callback), c); |
3671 | 3004 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
|
3005 gtk_widget_show(warn); |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
3006 |
3671 | 3007 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
|
3008 c->info = info; |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
3009 gtk_signal_connect(GTK_OBJECT(info), "clicked", GTK_SIGNAL_FUNC(info_callback), c); |
3671 | 3010 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
|
3011 gtk_widget_show(info); |
2528fc35aa32
[gaim-migrate @ 1229]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1215
diff
changeset
|
3012 |
3671 | 3013 |
3014 block = gaim_pixbuf_button_from_stock(_("Block"), "gtk-stop", GAIM_BUTTON_VERTICAL); | |
3015 c->block = block; | |
3016 gtk_signal_connect(GTK_OBJECT(block), "clicked", GTK_SIGNAL_FUNC(block_callback), c); | |
3017 gtk_box_pack_start(GTK_BOX(bbox), block, FALSE, FALSE, 0); | |
3018 gtk_widget_show(block); | |
3019 | |
3020 /* I don't know if these should have borders. They look kind of dumb | |
3021 * with borders. */ | |
3022 gtk_button_set_relief(GTK_BUTTON(info), GTK_RELIEF_NONE); | |
3023 gtk_button_set_relief(GTK_BUTTON(add), GTK_RELIEF_NONE); | |
3024 gtk_button_set_relief(GTK_BUTTON(warn), GTK_RELIEF_NONE); | |
3025 gtk_button_set_relief(GTK_BUTTON(send), GTK_RELIEF_NONE); | |
3026 gtk_button_set_relief(GTK_BUTTON(block), GTK_RELIEF_NONE); | |
3027 | |
3028 gtk_size_group_add_widget(c->sg, info); | |
3029 gtk_size_group_add_widget(c->sg, add); | |
3030 gtk_size_group_add_widget(c->sg, warn); | |
3031 gtk_size_group_add_widget(c->sg, send); | |
3032 gtk_size_group_add_widget(c->sg, block); | |
3033 | |
3034 gtk_box_reorder_child(GTK_BOX(bbox), c->warn, 1); | |
3035 gtk_box_reorder_child(GTK_BOX(bbox), c->block, 2); | |
3036 gtk_box_reorder_child(GTK_BOX(bbox), c->add, 3); | |
3037 gtk_box_reorder_child(GTK_BOX(bbox), c->info, 4); | |
3038 | |
666
71ea550c22ac
[gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
661
diff
changeset
|
3039 |
1340 | 3040 update_buttons_by_protocol(c); |
3671 | 3041 |
3470 | 3042 if (!(im_options & OPT_IM_ONE_WINDOW)) |
3043 gtk_widget_grab_focus(c->entry); | |
66 | 3044 gtk_widget_show(win); |
3045 } | |
3046 | |
3047 | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
3048 void toggle_spellchk() |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
3049 { |
1117
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3050 GList *cnv = conversations; |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3051 GSList *cht; |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3052 struct conversation *c; |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3053 GSList *con = connections; |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3054 struct gaim_connection *gc; |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3055 |
3209 | 3056 if (convo_options & OPT_CONVO_CHECK_SPELLING){ |
3057 /*If ispell fails to start, start aspell. This is the way that | |
3058 Gabber does it. -- lorien420@myrealbox.com */ | |
3059 if (gtkspell_start(NULL, ispell_cmd)<0){ | |
3060 debug_printf("gtkspell failed to start when using ispell\n"); | |
3061 if (gtkspell_start(NULL, aspell_cmd)<0){ | |
3062 debug_printf("gtkspell failed to start when using aspell\n"); | |
3063 } else | |
3064 debug_printf("gtkspell started with aspell\n"); | |
3065 } else { | |
3066 debug_printf("gtkspell started with ispell\n"); | |
3067 } | |
3068 } | |
2460
049822b93239
[gaim-migrate @ 2473]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2449
diff
changeset
|
3069 |
1117
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3070 while (cnv) { |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3071 c = (struct conversation *)cnv->data; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
3072 if (convo_options & OPT_CONVO_CHECK_SPELLING) |
1117
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3073 gtkspell_attach(GTK_TEXT(c->entry)); |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3074 else |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3075 gtkspell_detach(GTK_TEXT(c->entry)); |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3076 cnv = cnv->next; |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3077 } |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3078 |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3079 while (con) { |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3080 gc = (struct gaim_connection *)con->data; |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3081 cht = gc->buddy_chats; |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3082 while (cht) { |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3083 c = (struct conversation *)cht->data; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
3084 if (convo_options & OPT_CONVO_CHECK_SPELLING) |
1117
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3085 gtkspell_attach(GTK_TEXT(c->entry)); |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3086 else |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3087 gtkspell_detach(GTK_TEXT(c->entry)); |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3088 cht = cht->next; |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3089 } |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3090 con = con->next; |
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3091 } |
2460
049822b93239
[gaim-migrate @ 2473]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2449
diff
changeset
|
3092 |
049822b93239
[gaim-migrate @ 2473]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2449
diff
changeset
|
3093 if (!(convo_options & OPT_CONVO_CHECK_SPELLING)) |
049822b93239
[gaim-migrate @ 2473]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2449
diff
changeset
|
3094 gtkspell_stop(); |
1117
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
3095 } |
1428
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3096 |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3097 void toggle_timestamps() |
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 GList *cnv = conversations; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3100 GSList *cht; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3101 struct conversation *c; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3102 GSList *con = connections; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3103 struct gaim_connection *gc; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3104 |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3105 while (cnv) { |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3106 c = (struct conversation *)cnv->data; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
3107 if (convo_options & OPT_CONVO_SHOW_TIME) |
1428
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3108 gtk_imhtml_show_comments(GTK_IMHTML(c->text), TRUE); |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3109 else |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3110 gtk_imhtml_show_comments(GTK_IMHTML(c->text), FALSE); |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3111 cnv = cnv->next; |
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 while (con) { |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3115 gc = (struct gaim_connection *)con->data; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3116 cht = gc->buddy_chats; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3117 while (cht) { |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3118 c = (struct conversation *)cht->data; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
3119 if (convo_options & OPT_CONVO_SHOW_TIME) |
1428
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3120 gtk_imhtml_show_comments(GTK_IMHTML(c->text), TRUE); |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3121 else |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3122 gtk_imhtml_show_comments(GTK_IMHTML(c->text), FALSE); |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3123 cht = cht->next; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3124 } |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3125 con = con->next; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3126 } |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3127 } |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3128 |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3129 void toggle_smileys() |
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 GList *cnv = conversations; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3132 GSList *cht; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3133 struct conversation *c; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3134 GSList *con = connections; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3135 struct gaim_connection *gc; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3136 |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3137 while (cnv) { |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3138 c = (struct conversation *)cnv->data; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
3139 if (convo_options & OPT_CONVO_SHOW_SMILEY) |
1428
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3140 gtk_imhtml_show_smileys(GTK_IMHTML(c->text), TRUE); |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3141 else |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3142 gtk_imhtml_show_smileys(GTK_IMHTML(c->text), FALSE); |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3143 cnv = cnv->next; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3144 } |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3145 |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3146 while (con) { |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3147 gc = (struct gaim_connection *)con->data; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3148 cht = gc->buddy_chats; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3149 while (cht) { |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3150 c = (struct conversation *)cht->data; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
3151 if (convo_options & OPT_CONVO_SHOW_SMILEY) |
1428
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3152 gtk_imhtml_show_smileys(GTK_IMHTML(c->text), TRUE); |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3153 else |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3154 gtk_imhtml_show_smileys(GTK_IMHTML(c->text), FALSE); |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3155 cht = cht->next; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3156 } |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3157 con = con->next; |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3158 } |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1414
diff
changeset
|
3159 } |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3160 |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3161 void im_tabize() |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3162 { |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3163 /* evil, evil i tell you! evil! */ |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
3164 if (im_options & OPT_IM_ONE_WINDOW) { |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3165 GList *x = conversations; |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3166 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
|
3167 all_convos = all_chats; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3168 convo_notebook = chat_notebook; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3169 } |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3170 while (x) { |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3171 struct conversation *c = x->data; |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3172 GtkWidget *imhtml, *win; |
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 imhtml = c->text; |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3175 win = c->window; |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3176 remove_icon(c); |
2231
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3177 remove_checkbox(c); |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3178 show_conv(c); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3179 gtk_widget_destroy(c->text); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3180 gtk_widget_reparent(imhtml, c->sw); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3181 c->text = imhtml; |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3182 gtk_widget_destroy(win); |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3183 update_icon(c); |
2231
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3184 update_checkbox(c); |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3185 set_convo_title(c); |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3186 |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3187 x = x->next; |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3188 } |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3189 } else { |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3190 GList *x, *m; |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3191 x = m = conversations; |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3192 conversations = NULL; |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3193 while (x) { |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3194 struct conversation *c = x->data; |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3195 GtkWidget *imhtml; |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3196 |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3197 imhtml = c->text; |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3198 remove_icon(c); |
2231
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3199 remove_checkbox(c); |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3200 show_conv(c); |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3201 gtk_container_remove(GTK_CONTAINER(c->sw), c->text); |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3202 gtk_widget_reparent(imhtml, c->sw); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3203 c->text = imhtml; |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3204 update_icon(c); |
2231
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3205 update_checkbox(c); |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3206 set_convo_title(c); |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3207 |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3208 x = x->next; |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3209 } |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3210 conversations = m; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3211 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
|
3212 if (chats) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3213 struct conversation *c; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3214 while (m) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3215 gtk_notebook_remove_page(GTK_NOTEBOOK(chat_notebook), 0); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3216 m = m->next; |
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 c = chats->data; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3219 gtk_window_set_focus(GTK_WINDOW(c->window), c->entry); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3220 } else { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3221 if (all_convos) |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3222 gtk_widget_destroy(all_convos); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3223 all_chats = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3224 chat_notebook = NULL; |
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 } else if (all_convos) |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3227 gtk_widget_destroy(all_convos); |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3228 all_convos = NULL; |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
3229 convo_notebook = NULL; |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3230 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3231 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3232 |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3233 void convo_tabize() |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3234 { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3235 GList *x, *m; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3236 GtkWidget *tmp; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3237 |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3238 if (!chats && !conversations) |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3239 return; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3240 |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3241 if (convo_options & OPT_CONVO_COMBINE) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3242 if (!chats) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3243 all_chats = all_convos; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3244 chat_notebook = convo_notebook; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3245 return; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3246 } else if (!conversations) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3247 all_convos = all_chats; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3248 convo_notebook = chat_notebook; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3249 return; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3250 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3251 } else { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3252 if (!chats) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3253 all_chats = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3254 chat_notebook = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3255 return; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3256 } else if (!conversations) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3257 all_convos = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3258 convo_notebook = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3259 return; |
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 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3262 |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3263 tmp = all_convos; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3264 if (convo_options & OPT_CONVO_COMBINE) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3265 all_convos = all_chats; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3266 convo_notebook = chat_notebook; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3267 } else { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3268 all_convos = NULL; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3269 convo_notebook = NULL; |
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 = m = conversations; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3272 while (x) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3273 struct conversation *c = x->data; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3274 GtkWidget *imhtml; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3275 |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3276 imhtml = c->text; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3277 remove_icon(c); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3278 remove_checkbox(c); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3279 show_conv(c); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3280 gtk_container_remove(GTK_CONTAINER(c->sw), c->text); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3281 gtk_widget_reparent(imhtml, c->sw); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3282 c->text = imhtml; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3283 update_icon(c); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3284 update_checkbox(c); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3285 |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3286 x = x->next; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3287 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3288 |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3289 conversations = m; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3290 if (convo_options & OPT_CONVO_COMBINE) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3291 if (tmp) |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3292 gtk_widget_destroy(tmp); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3293 } else { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3294 while (m) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3295 gtk_notebook_remove_page(GTK_NOTEBOOK(chat_notebook), 0); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3296 m = m->next; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3297 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3298 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3299 m = conversations; |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3300 while (m) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3301 set_convo_title(m->data); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3302 m = m->next; |
1573
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3303 } |
3a8bd72f431f
[gaim-migrate @ 1583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1532
diff
changeset
|
3304 } |
1587
69a004b5820a
[gaim-migrate @ 1597]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1583
diff
changeset
|
3305 |
2787
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3306 void set_convo_title(struct conversation *c) |
1587
69a004b5820a
[gaim-migrate @ 1597]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1583
diff
changeset
|
3307 { |
2787
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3308 struct buddy *b; |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3309 char *text; |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3310 int index; |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3311 GtkNotebook *nb; |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3312 |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3313 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
|
3314 text = b->show; |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3315 else |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3316 text = c->name; |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3317 |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3318 if (im_options & OPT_IM_ONE_WINDOW) { |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3319 nb = GTK_NOTEBOOK(convo_notebook); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3320 index = g_list_index(conversations, c); |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2834
diff
changeset
|
3321 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
|
3322 } else { |
2834
66b1112d948f
[gaim-migrate @ 2847]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2832
diff
changeset
|
3323 char buf[256]; |
3457 | 3324 if ((find_log_info(c->name)) || (c->is_chat && (logging_options & OPT_LOG_CHATS)) |
3325 || (!c->is_chat && (logging_options & OPT_LOG_CONVOS))) | |
2834
66b1112d948f
[gaim-migrate @ 2847]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2832
diff
changeset
|
3326 g_snprintf(buf, sizeof(buf), LOG_CONVERSATION_TITLE, text); |
66b1112d948f
[gaim-migrate @ 2847]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2832
diff
changeset
|
3327 else |
66b1112d948f
[gaim-migrate @ 2847]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2832
diff
changeset
|
3328 g_snprintf(buf, sizeof(buf), CONVERSATION_TITLE, text); |
66b1112d948f
[gaim-migrate @ 2847]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2832
diff
changeset
|
3329 gtk_window_set_title(GTK_WINDOW(c->window), buf); |
66b1112d948f
[gaim-migrate @ 2847]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2832
diff
changeset
|
3330 } |
2787
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3331 } |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3332 |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3333 void set_convo_titles() |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3334 { |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3335 GList *c = conversations; |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3336 while (c) { |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3337 set_convo_title(c->data); |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3338 c = c->next; |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
3339 } |
1587
69a004b5820a
[gaim-migrate @ 1597]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1583
diff
changeset
|
3340 } |
1590
b4e54a752676
[gaim-migrate @ 1600]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1587
diff
changeset
|
3341 |
b4e54a752676
[gaim-migrate @ 1600]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1587
diff
changeset
|
3342 void raise_convo_tab(struct conversation *c) |
b4e54a752676
[gaim-migrate @ 1600]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1587
diff
changeset
|
3343 { |
b4e54a752676
[gaim-migrate @ 1600]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1587
diff
changeset
|
3344 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
|
3345 gdk_window_show(c->window->window); |
1590
b4e54a752676
[gaim-migrate @ 1600]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1587
diff
changeset
|
3346 } |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
3347 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3348 void update_im_tabs() |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3349 { |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
3350 if (!convo_notebook || !all_convos) |
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
3351 return; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
3352 if (im_options & OPT_IM_SIDE_TAB) { |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
3353 if (im_options & OPT_IM_BR_TAB) { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3354 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
|
3355 } else { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3356 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
|
3357 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3358 } else { |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
3359 if (im_options & OPT_IM_BR_TAB) { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3360 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
|
3361 } else { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3362 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
|
3363 } |
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
3364 } |
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
3365 } |
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
3366 |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3367 void update_chat_tabs() |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3368 { |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
3369 if (!chat_notebook || !all_chats) |
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
3370 return; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
3371 if (chat_options & OPT_CHAT_SIDE_TAB) { |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
3372 if (chat_options & OPT_CHAT_BR_TAB) { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3373 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
|
3374 } else { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3375 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
|
3376 } |
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
3377 } else { |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
3378 if (chat_options & OPT_CHAT_BR_TAB) { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3379 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
|
3380 } else { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3381 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
|
3382 } |
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
3383 } |
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1735
diff
changeset
|
3384 } |
1759
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3385 |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3386 void update_convo_color(gboolean fg) |
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 GList *c = conversations; |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3389 struct conversation *b; |
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 while (c) { |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3392 b = c->data; |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3393 c = c->next; |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3394 if (fg) { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3395 if (b->hasfg) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3396 continue; |
1759
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3397 b->fgcol = fgcolor; |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3398 } else { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3399 if (b->hasbg) |
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 b->bgcol = bgcolor; |
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 } |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3404 } |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3405 |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3406 void update_convo_font() |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3407 { |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3408 GList *c = conversations; |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3409 struct conversation *b; |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3410 |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3411 while (c) { |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3412 b = c->data; |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3413 c = c->next; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3414 if (b->hasfont) |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2363
diff
changeset
|
3415 continue; |
1759
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3416 sprintf(b->fontface, "%s", fontface); |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3417 } |
e0f936b4c91a
[gaim-migrate @ 1769]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1757
diff
changeset
|
3418 } |
2191
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 #include <gdk-pixbuf/gdk-pixbuf.h> |
2227
a93a6fe22330
[gaim-migrate @ 2237]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2213
diff
changeset
|
3421 |
a93a6fe22330
[gaim-migrate @ 2237]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2213
diff
changeset
|
3422 #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
|
3423 ? 48 : 50) |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3424 |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3425 static gboolean redraw_icon(gpointer data) |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3426 { |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3427 struct conversation *c = data; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3428 |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3429 GdkPixbuf *buf; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3430 GdkPixbuf *scale; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3431 GdkPixmap *pm; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3432 GdkBitmap *bm; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3433 gint delay; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3434 |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3435 if (!g_list_find(conversations, c)) { |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3436 debug_printf("I think this is a bug.\n"); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3437 return FALSE; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3438 } |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3439 |
3367 | 3440 gdk_pixbuf_animation_iter_advance(c->iter, NULL); |
3441 buf = gdk_pixbuf_animation_iter_get_pixbuf(c->iter); | |
3442 scale = gdk_pixbuf_scale_simple(buf, | |
3443 MAX(gdk_pixbuf_get_width(buf) * SCALE(c->anim) / | |
3444 gdk_pixbuf_animation_get_width(c->anim), 1), | |
3445 MAX(gdk_pixbuf_get_height(buf) * SCALE(c->anim) / | |
3446 gdk_pixbuf_animation_get_height(c->anim), 1), | |
3447 GDK_INTERP_NEAREST); | |
3448 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); | |
3449 gdk_pixbuf_unref(scale); | |
3450 gtk_pixmap_set(GTK_PIXMAP(c->icon), pm, bm); | |
3451 gdk_pixmap_unref(pm); | |
3380 | 3452 gtk_widget_queue_draw(c->icon); |
3367 | 3453 if (bm) |
3454 gdk_bitmap_unref(bm); | |
3380 | 3455 delay = gdk_pixbuf_animation_iter_get_delay_time(c->iter) / 10; |
3367 | 3456 |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3457 c->icon_timer = gtk_timeout_add(delay * 10, redraw_icon, c); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3458 return FALSE; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3459 } |
2499
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3460 |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3461 static void stop_anim(GtkObject *obj, 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 if (c->icon_timer) |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3464 gtk_timeout_remove(c->icon_timer); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3465 c->icon_timer = 0; |
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 |
2513
6e52448f352a
[gaim-migrate @ 2526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2502
diff
changeset
|
3468 static void start_anim(GtkObject *obj, struct conversation *c) |
6e52448f352a
[gaim-migrate @ 2526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2502
diff
changeset
|
3469 { |
6e52448f352a
[gaim-migrate @ 2526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2502
diff
changeset
|
3470 int delay; |
3380 | 3471 delay = gdk_pixbuf_animation_iter_get_delay_time(c->iter) / 10; |
3097 | 3472 if (c->anim) |
3473 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
|
3474 } |
6e52448f352a
[gaim-migrate @ 2526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2502
diff
changeset
|
3475 |
2499
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3476 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
|
3477 { |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3478 gtk_widget_destroy(c->save_icon); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3479 c->save_icon = NULL; |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3480 return TRUE; |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3481 } |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3482 |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3483 static void do_save_icon(GtkObject *obj, struct conversation *c) |
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 FILE *file; |
3466 | 3486 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
|
3487 if (file_is_dir(f, c->save_icon)) |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3488 return; |
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 file = fopen(f, "w"); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3491 if (file) { |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3492 int len; |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3493 void *data = get_icon_data(c->gc, normalize(c->name), &len); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3494 if (data) |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3495 fwrite(data, 1, len, file); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3496 fclose(file); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3497 } else { |
3427 | 3498 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
|
3499 } |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3500 |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3501 gtk_widget_destroy(c->save_icon); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3502 c->save_icon = NULL; |
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 static void cancel_save_icon(GtkObject *obj, struct conversation *c) |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3506 { |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3507 gtk_widget_destroy(c->save_icon); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3508 c->save_icon = NULL; |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3509 } |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3510 |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3511 static void save_icon(GtkObject *obj, struct conversation *c) |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3512 { |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3513 char buf[BUF_LEN]; |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3514 |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3515 if (c->save_icon) { |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3516 gdk_window_raise(c->save_icon->window); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3517 return; |
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 |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3520 c->save_icon = gtk_file_selection_new(_("Gaim - Save Icon")); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3521 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(c->save_icon)); |
3630 | 3522 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
|
3523 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
|
3524 gtk_signal_connect(GTK_OBJECT(c->save_icon), "delete_event", |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3525 GTK_SIGNAL_FUNC(des_save_icon), c); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3526 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
|
3527 GTK_SIGNAL_FUNC(do_save_icon), c); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3528 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
|
3529 GTK_SIGNAL_FUNC(cancel_save_icon), c); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3530 |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3531 gtk_widget_show(c->save_icon); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3532 } |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3533 |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3534 static gboolean icon_menu(GtkObject *obj, GdkEventButton *e, struct conversation *c) |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3535 { |
3250 | 3536 static GtkWidget *menu = NULL; |
2499
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3537 GtkWidget *button; |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3538 |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3539 if (e->button != 3) |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3540 return FALSE; |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3541 if (e->type != GDK_BUTTON_PRESS) |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3542 return FALSE; |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3543 |
3250 | 3544 /* |
3545 * If a menu already exists, destroy it before creating a new one, | |
3546 * thus freeing-up the memory it occupied. | |
3547 */ | |
3548 if(menu) | |
3549 gtk_widget_destroy(menu); | |
3550 | |
2499
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3551 menu = gtk_menu_new(); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3552 |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3553 if (c->icon_timer) { |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3554 button = gtk_menu_item_new_with_label(_("Disable Animation")); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3555 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
|
3556 gtk_menu_append(GTK_MENU(menu), button); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3557 gtk_widget_show(button); |
3367 | 3558 } |
3559 else if (c->anim && !(gdk_pixbuf_animation_is_static_image(c->anim))) | |
3560 { | |
2513
6e52448f352a
[gaim-migrate @ 2526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2502
diff
changeset
|
3561 button = gtk_menu_item_new_with_label(_("Enable Animation")); |
6e52448f352a
[gaim-migrate @ 2526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2502
diff
changeset
|
3562 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
|
3563 gtk_menu_append(GTK_MENU(menu), button); |
6e52448f352a
[gaim-migrate @ 2526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2502
diff
changeset
|
3564 gtk_widget_show(button); |
2499
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3565 } |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3566 |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3567 button = gtk_menu_item_new_with_label(_("Hide Icon")); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3568 gtk_signal_connect_object(GTK_OBJECT(button), "activate", |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3569 GTK_SIGNAL_FUNC(remove_icon), (void *)c); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3570 gtk_menu_append(GTK_MENU(menu), button); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3571 gtk_widget_show(button); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3572 |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3573 button = gtk_menu_item_new_with_label(_("Save Icon As...")); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3574 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
|
3575 gtk_menu_append(GTK_MENU(menu), button); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3576 gtk_widget_show(button); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3577 |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3578 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
|
3579 |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3580 return TRUE; |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3581 } |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3582 |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3583 void remove_icon(struct conversation *c) |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3584 { |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3585 if (c->icon) |
2895
63cdece2348d
[gaim-migrate @ 2908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2891
diff
changeset
|
3586 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
|
3587 c->icon = NULL; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3588 if (c->anim) |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3589 gdk_pixbuf_animation_unref(c->anim); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3590 c->anim = NULL; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3591 if (c->icon_timer) |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3592 gtk_timeout_remove(c->icon_timer); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3593 c->icon_timer = 0; |
3374 | 3594 if(c->iter) |
3699 | 3595 g_object_unref(G_OBJECT(c->iter)); |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3596 } |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3597 |
3035 | 3598 void update_smilies(struct conversation *c) |
3599 { | |
3600 GSList *smilies; | |
3601 | |
3056 | 3602 if (!c) |
3603 return; | |
3604 | |
3605 if (!c->gc) | |
3606 return; | |
3607 | |
3035 | 3608 if (c->gc->prpl->smiley_list) { |
3050 | 3609 gtk_imhtml_remove_smileys(GTK_IMHTML(c->text)); |
3035 | 3610 smilies = c->gc->prpl->smiley_list(); |
3611 | |
3612 while (smilies) { | |
3613 struct _prpl_smiley *smile = | |
3614 (struct _prpl_smiley *)smilies->data; | |
3615 | |
3616 gtk_imhtml_associate_smiley(GTK_IMHTML(c->text), smile->key, smile->xpm); | |
3617 smilies = g_slist_next(smilies); | |
3618 } | |
3050 | 3619 } else { |
3620 gtk_imhtml_reset_smileys(GTK_IMHTML(c->text)); | |
3035 | 3621 } |
3622 } | |
3623 | |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3624 void update_icon(struct conversation *c) |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3625 { |
2521
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3626 char filename[256]; |
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3627 FILE *file; |
3380 | 3628 GError *err = NULL; |
3466 | 3629 |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3630 void *data; |
3367 | 3631 int len, delay; |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3632 |
2521
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3633 GdkPixbuf *buf; |
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3634 |
2499
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3635 GtkWidget *event; |
2895
63cdece2348d
[gaim-migrate @ 2908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2891
diff
changeset
|
3636 GtkWidget *frame; |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3637 GdkPixbuf *scale; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3638 GdkPixmap *pm; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3639 GdkBitmap *bm; |
2264
2993b6091a53
[gaim-migrate @ 2274]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
3640 int sf = 0; |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3641 |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3642 if (!c) |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3643 return; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3644 |
2231
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3645 remove_icon(c); |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3646 |
2323
bde2481bb4db
[gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
3647 if (im_options & OPT_IM_HIDE_ICONS) |
bde2481bb4db
[gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
3648 return; |
bde2481bb4db
[gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
3649 |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3650 if (!c->gc) |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3651 return; |
2195
d615f7e2d8c4
[gaim-migrate @ 2205]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2191
diff
changeset
|
3652 |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3653 data = get_icon_data(c->gc, normalize(c->name), &len); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3654 if (!data) |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3655 return; |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3656 |
2521
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3657 /* 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
|
3658 * we'll do it differently when gdk-pixbuf-loader isn't leaky anymore. */ |
3630 | 3659 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
|
3660 file = fopen(filename, "w"); |
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3661 if (!file) |
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3662 return; |
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3663 fwrite(data, 1, len, file); |
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3664 fclose(file); |
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3665 |
3367 | 3666 c->anim = gdk_pixbuf_animation_new_from_file(filename, &err); |
3380 | 3667 if (err) { |
3668 debug_printf("Buddy icon error: %s\n", err->message); | |
3669 g_error_free(err); | |
3670 } | |
2521
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3671 /* make sure we remove the file as soon as possible */ |
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3672 unlink(filename); |
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3673 |
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3674 if (!c->anim) |
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3675 return; |
f42fceb6a9ea
[gaim-migrate @ 2534]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2513
diff
changeset
|
3676 |
3380 | 3677 if (gdk_pixbuf_animation_is_static_image(c->anim)) { |
3678 c->iter = NULL; | |
3679 delay = 0; | |
3680 buf = gdk_pixbuf_animation_get_static_image(c->anim); | |
3681 } else { | |
3367 | 3682 c->iter = gdk_pixbuf_animation_get_iter(c->anim, NULL); |
3683 buf = gdk_pixbuf_animation_iter_get_pixbuf(c->iter); | |
3380 | 3684 delay = gdk_pixbuf_animation_iter_get_delay_time(c->iter); |
3685 delay = delay / 10; | |
3686 } | |
3687 sf = SCALE(c->anim); | |
3367 | 3688 scale = gdk_pixbuf_scale_simple(buf, |
3689 MAX(gdk_pixbuf_get_width(buf) * sf / | |
3690 gdk_pixbuf_animation_get_width(c->anim), 1), | |
3691 MAX(gdk_pixbuf_get_height(buf) * sf / | |
3692 gdk_pixbuf_animation_get_height(c->anim), 1), | |
3693 GDK_INTERP_NEAREST); | |
3380 | 3694 |
3695 if (delay) | |
3696 c->icon_timer = gtk_timeout_add(delay * 10, redraw_icon, c); | |
3367 | 3697 |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3698 |
2936 | 3699 gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3700 gdk_pixbuf_unref(scale); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3701 |
2895
63cdece2348d
[gaim-migrate @ 2908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2891
diff
changeset
|
3702 frame = gtk_frame_new(NULL); |
2936 | 3703 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
|
3704 gtk_box_pack_start(GTK_BOX(c->bbox), frame, FALSE, FALSE, 5); |
3671 | 3705 gtk_box_reorder_child(GTK_BOX(c->bbox), frame, 0); |
2895
63cdece2348d
[gaim-migrate @ 2908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2891
diff
changeset
|
3706 gtk_widget_show(frame); |
63cdece2348d
[gaim-migrate @ 2908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2891
diff
changeset
|
3707 |
2499
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3708 event = gtk_event_box_new(); |
2895
63cdece2348d
[gaim-migrate @ 2908]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2891
diff
changeset
|
3709 gtk_container_add(GTK_CONTAINER(frame), event); |
2499
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3710 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
|
3711 gtk_widget_show(event); |
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3712 |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3713 c->icon = gtk_pixmap_new(pm, bm); |
2264
2993b6091a53
[gaim-migrate @ 2274]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
3714 gtk_widget_set_usize(c->icon, sf, sf); |
2499
933e139fd0d3
[gaim-migrate @ 2512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2487
diff
changeset
|
3715 gtk_container_add(GTK_CONTAINER(event), c->icon); |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3716 gtk_widget_show(c->icon); |
3012 | 3717 if(im_options & OPT_IM_NO_ANIMATION) |
3013 | 3718 stop_anim(NULL, c); |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3719 gdk_pixmap_unref(pm); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3720 if (bm) |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3721 gdk_bitmap_unref(bm); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3722 } |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3723 |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3724 void got_new_icon(struct gaim_connection *gc, char *who) |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3725 { |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3726 struct conversation *c = find_conversation(who); |
2245
31157c54fe6e
[gaim-migrate @ 2255]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2239
diff
changeset
|
3727 if (c && (c->gc == gc)) |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3728 update_icon(c); |
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
3729 } |
2231
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3730 |
2323
bde2481bb4db
[gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
3731 void set_hide_icons() |
bde2481bb4db
[gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
3732 { |
bde2481bb4db
[gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
3733 GList *c = conversations; |
bde2481bb4db
[gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
3734 while (c) { |
bde2481bb4db
[gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
3735 update_icon(c->data); |
bde2481bb4db
[gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
3736 c = c->next; |
bde2481bb4db
[gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
3737 } |
bde2481bb4db
[gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
3738 } |
bde2481bb4db
[gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
3739 |
3013 | 3740 void set_anim() |
3741 { | |
3742 GList *c = conversations; | |
3097 | 3743 if (im_options & OPT_IM_HIDE_ICONS) |
3744 return; | |
3013 | 3745 while (c) { |
3746 if(im_options & OPT_IM_NO_ANIMATION) | |
3747 stop_anim(NULL, c->data); | |
3748 else | |
3749 start_anim(NULL, c->data); | |
3750 c = c->next; | |
3751 } | |
3752 } | |
3753 | |
2231
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3754 static void remove_checkbox(struct conversation *c) |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3755 { |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3756 if (c->check) |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3757 gtk_container_remove(GTK_CONTAINER(c->lbox), c->check); |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3758 c->check = NULL; |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3759 } |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3760 |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3761 static void update_checkbox(struct conversation *c) |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3762 { |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3763 if (!c) |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3764 return; |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3765 |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3766 remove_checkbox(c); |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3767 |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3768 if (!c->gc) |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3769 return; |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3770 |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2699
diff
changeset
|
3771 if (!c->gc->checkbox) |
2231
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3772 return; |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3773 |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2699
diff
changeset
|
3774 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
|
3775 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
|
3776 gtk_widget_show(c->check); |
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2227
diff
changeset
|
3777 } |