Mercurial > pidgin
annotate src/conversation.c @ 654:ea811c6dd3e0
[gaim-migrate @ 664]
with all this hacking i'm surprised we don't ever get through the log
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Thu, 10 Aug 2000 04:13:46 +0000 |
parents | 8db764ce9c3f |
children | 31384b25f7b6 |
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 |
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
344
diff
changeset
|
23 #include "../config.h" |
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
344
diff
changeset
|
24 #endif |
66 | 25 #include <string.h> |
26 #include <sys/time.h> | |
27 #include <sys/types.h> | |
28 #include <sys/stat.h> | |
29 #include <unistd.h> | |
30 #include <stdio.h> | |
31 #include <stdlib.h> | |
210
ec0686b3b03f
[gaim-migrate @ 220]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
209
diff
changeset
|
32 #include <ctype.h> |
66 | 33 #include <gtk/gtk.h> |
34 #include "gtkhtml.h" | |
35 #include <gdk/gdkkeysyms.h> | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
36 #include "convo.h" |
337 | 37 |
604
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
38 #include "pixmaps/underline.xpm" |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
39 #include "pixmaps/bold.xpm" |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
40 #include "pixmaps/italic.xpm" |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
41 #include "pixmaps/small.xpm" |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
42 #include "pixmaps/normal.xpm" |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
43 #include "pixmaps/big.xpm" |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
44 #include "pixmaps/fontface.xpm" |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
45 #include "pixmaps/speaker.xpm" |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
46 /* #include "pixmaps/aimicon2.xpm" */ |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
47 #include "pixmaps/wood.xpm" |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
48 #include "pixmaps/palette.xpm" |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
49 #include "pixmaps/link.xpm" |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
50 #include "pixmaps/strike.xpm" |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
51 |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
52 #include "pixmaps/angel.xpm" |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
53 #include "pixmaps/bigsmile.xpm" |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
54 #include "pixmaps/burp.xpm" |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
55 #include "pixmaps/crossedlips.xpm" |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
56 #include "pixmaps/cry.xpm" |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
57 #include "pixmaps/embarrassed.xpm" |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
58 #include "pixmaps/kiss.xpm" |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
59 #include "pixmaps/moneymouth.xpm" |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
60 #include "pixmaps/sad.xpm" |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
61 #include "pixmaps/scream.xpm" |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
62 #include "pixmaps/smile.xpm" |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
63 #include "pixmaps/smile8.xpm" |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
64 #include "pixmaps/think.xpm" |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
65 #include "pixmaps/tongue.xpm" |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
66 #include "pixmaps/wink.xpm" |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
67 #include "pixmaps/yell.xpm" |
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
68 #include "pixmaps/luke03.xpm" |
610
cadb51c068cb
[gaim-migrate @ 620]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
69 #include "pixmaps/oneeye.xpm" |
604
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
70 |
623 | 71 #include "pixmaps/tmp_send.xpm" |
72 #include "pixmaps/gnome_remove.xpm" | |
73 #include "pixmaps/gnome_add.xpm" | |
74 #include "pixmaps/cancel.xpm" | |
75 #include "pixmaps/warn.xpm" | |
76 #include "pixmaps/tb_search.xpm" | |
604
0b1a132e0f75
[gaim-migrate @ 614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
602
diff
changeset
|
77 |
66 | 78 int state_lock=0; |
79 | |
80 GdkPixmap *dark_icon_pm = NULL; | |
81 GdkBitmap *dark_icon_bm = NULL; | |
82 | |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
83 char *fontface; |
66 | 84 |
85 void check_everything(GtkWidget *entry); | |
275
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
86 char *get_tag_by_prefix(GtkWidget *entry, const char *prefix); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
87 gboolean keypress_callback(GtkWidget *entry, GdkEventKey *event, struct conversation *c); |
66 | 88 |
89 /*------------------------------------------------------------------------*/ | |
90 /* Helpers */ | |
91 /*------------------------------------------------------------------------*/ | |
92 | |
93 | |
94 void quiet_set(GtkWidget *tb, int state) | |
95 { | |
96 state_lock=1; | |
97 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(tb), state); | |
98 state_lock=0; | |
99 } | |
100 | |
101 | |
102 void set_state_lock(int i) | |
103 { | |
104 state_lock = i; | |
105 } | |
106 | |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
107 void toggle_sensitive(GtkWidget *widget, GtkWidget *to_toggle) |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
108 { |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
109 gboolean sensitivity = GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(to_toggle)); |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
110 |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
111 if (sensitivity == TRUE) |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
112 gtk_widget_set_sensitive(GTK_WIDGET(to_toggle), FALSE); |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
113 else |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
114 gtk_widget_set_sensitive(GTK_WIDGET(to_toggle), TRUE); |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
115 |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
116 return; |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
117 } |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
118 |
66 | 119 struct conversation *new_conversation(char *name) |
120 { | |
121 struct conversation *c; | |
122 | |
123 c = find_conversation(name); | |
124 | |
125 if (c != NULL) | |
126 return c; | |
127 | |
128 c = (struct conversation *)g_new0(struct conversation, 1); | |
129 g_snprintf(c->name, sizeof(c->name), "%s", name); | |
130 | |
131 if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(c->name)) { | |
132 FILE *fd; | |
70 | 133 |
373
1d29321843b0
[gaim-migrate @ 383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
363
diff
changeset
|
134 fd = open_log_file(c->name); |
66 | 135 if (!(general_options & OPT_GEN_STRIP_HTML)) |
70 | 136 fprintf(fd, "<HR><BR><H3 Align=Center> ---- New Conversation @ %s ----</H3><BR>\n", full_date()); |
66 | 137 else |
70 | 138 fprintf(fd, " ---- New Conversation @ %s ----\n", full_date()); |
139 | |
66 | 140 fclose(fd); |
141 } | |
142 | |
143 show_conv(c); | |
144 conversations = g_list_append(conversations, c); | |
145 return c; | |
146 } | |
147 | |
148 | |
149 struct conversation *find_conversation(char *name) | |
150 { | |
151 char *cuser = g_malloc(64); | |
152 struct conversation *c; | |
153 GList *cnv = conversations; | |
154 | |
155 strcpy(cuser, normalize(name)); | |
156 | |
157 while(cnv) { | |
158 c = (struct conversation *)cnv->data; | |
159 if(!strcasecmp(cuser, normalize(c->name))) { | |
160 g_free(cuser); | |
161 return c; | |
162 } | |
163 cnv = cnv->next; | |
164 } | |
165 g_free(cuser); | |
166 return NULL; | |
167 } | |
168 | |
275
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
169 /* given the first part of a tag, returns the length up to the final '>'; |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
170 useful for 'remove_tags' calls on variable data, such as <font face> |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
171 tags */ |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
172 char *get_tag_by_prefix(GtkWidget *entry, const char *prefix) |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
173 { |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
174 char *s, *t; |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
175 int i = 0; |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
176 |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
177 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
178 t = s; |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
179 |
411
a330017b3aa4
[gaim-migrate @ 421]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
391
diff
changeset
|
180 if ((t = strstr(s, prefix)) != NULL) |
275
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
181 { |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
182 for (i = 1; t[i] != '\0'; i++) |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
183 { |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
184 |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
185 if (t[i] == '>') |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
186 break; |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
187 } |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
188 |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
189 t = gtk_editable_get_chars(GTK_EDITABLE(entry), (t-s), (t-s) + i + 1); |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
190 } |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
191 return t; |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
192 } |
516
ee4e18868584
[gaim-migrate @ 526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
193 |
ee4e18868584
[gaim-migrate @ 526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
194 void make_direct(struct conversation *c, gboolean direct, struct aim_conn_t *conn, gint watcher) |
ee4e18868584
[gaim-migrate @ 526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
195 { |
ee4e18868584
[gaim-migrate @ 526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
196 char buf[BUF_LONG]; |
ee4e18868584
[gaim-migrate @ 526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
197 if (c == NULL) return; |
ee4e18868584
[gaim-migrate @ 526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
198 c->is_direct = direct; |
ee4e18868584
[gaim-migrate @ 526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
199 if (direct) { |
ee4e18868584
[gaim-migrate @ 526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
200 c->conn = conn; |
ee4e18868584
[gaim-migrate @ 526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
201 c->watcher = watcher; |
ee4e18868584
[gaim-migrate @ 526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
202 g_snprintf(buf, sizeof buf, _("<HR><B>Direct Connection with %s established.</B><BR><HR>"), |
ee4e18868584
[gaim-migrate @ 526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
203 c->name); |
ee4e18868584
[gaim-migrate @ 526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
204 write_to_conv(c, buf, WFLAG_SYSTEM, NULL); |
ee4e18868584
[gaim-migrate @ 526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
205 } else { |
ee4e18868584
[gaim-migrate @ 526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
206 c->conn = NULL; |
ee4e18868584
[gaim-migrate @ 526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
207 gdk_input_remove(c->watcher); |
ee4e18868584
[gaim-migrate @ 526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
208 c->watcher = -1; |
ee4e18868584
[gaim-migrate @ 526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
209 g_snprintf(buf, sizeof buf, _("<HR><B>Direct Connection with %s closed.</B><BR><HR>"), |
ee4e18868584
[gaim-migrate @ 526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
210 c->name); |
ee4e18868584
[gaim-migrate @ 526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
211 write_to_conv(c, buf, WFLAG_SYSTEM, NULL); |
ee4e18868584
[gaim-migrate @ 526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
212 } |
ee4e18868584
[gaim-migrate @ 526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
213 } |
ee4e18868584
[gaim-migrate @ 526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
214 |
66 | 215 /* --------------------------------------------------- |
216 * Function to remove a log file entry | |
217 * --------------------------------------------------- | |
218 */ | |
219 | |
220 void rm_log(struct log_conversation *a) | |
221 { | |
222 struct conversation *cnv = find_conversation(a->name); | |
223 char buf[128]; | |
224 | |
225 log_conversations = g_list_remove(log_conversations, a); | |
226 | |
227 save_prefs(); | |
228 | |
229 if (cnv) { | |
230 if (!(general_options & OPT_GEN_LOG_ALL)) | |
231 g_snprintf(buf, sizeof(buf), CONVERSATION_TITLE, cnv->name); | |
232 else | |
233 g_snprintf(buf, sizeof(buf), LOG_CONVERSATION_TITLE, cnv->name); | |
234 gtk_window_set_title(GTK_WINDOW(cnv->window), buf); | |
235 } | |
236 } | |
237 | |
238 struct log_conversation *find_log_info(char *name) | |
239 { | |
240 char *pname = g_malloc(64); | |
241 GList *lc = log_conversations; | |
242 struct log_conversation *l; | |
243 | |
244 | |
245 strcpy(pname, normalize(name)); | |
246 | |
247 while(lc) { | |
248 l = (struct log_conversation *)lc->data; | |
249 if (!strcasecmp(pname, normalize(l->name))) { | |
250 g_free(pname); | |
251 return l; | |
252 } | |
253 lc = lc->next; | |
254 } | |
255 g_free(pname); | |
256 return NULL; | |
257 } | |
258 | |
625
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
259 void delete_conversation(struct conversation *c) |
66 | 260 { |
625
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
261 conversations = g_list_remove(conversations, c); |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
262 if (c->color_dialog) |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
263 gtk_widget_destroy(c->color_dialog); |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
264 if (c->font_dialog) |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
265 gtk_widget_destroy(c->font_dialog); |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
266 if (c->smiley_dialog) |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
267 gtk_widget_destroy(c->smiley_dialog); |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
268 if (c->link_dialog) |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
269 gtk_widget_destroy(c->link_dialog); |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
270 if (c->log_dialog) |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
271 gtk_widget_destroy(c->log_dialog); |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
272 g_free(c); |
66 | 273 } |
274 | |
275 void update_log_convs() | |
276 { | |
277 GList *cnv = conversations; | |
278 struct conversation *c; | |
279 | |
280 while(cnv) { | |
281 c = (struct conversation *)cnv->data; | |
282 | |
283 if (c->log_button) | |
284 gtk_widget_set_sensitive(c->log_button, ((general_options & OPT_GEN_LOG_ALL)) ? FALSE : TRUE); | |
285 | |
286 cnv = cnv->next; | |
287 } | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
288 |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
289 cnv = buddy_chats; |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
290 while(cnv) { |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
291 c = (struct conversation *)cnv->data; |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
292 |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
293 if (c->log_button) |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
294 gtk_widget_set_sensitive(c->log_button, ((general_options & OPT_GEN_LOG_ALL)) ? FALSE : TRUE); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
295 |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
296 cnv = cnv->next; |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
297 } |
66 | 298 } |
299 | |
300 void update_font_buttons() | |
301 { | |
302 GList *cnv = conversations; | |
303 struct conversation *c; | |
304 | |
305 while (cnv) { | |
306 c = (struct conversation *)cnv->data; | |
307 | |
308 if (c->bold) | |
309 gtk_widget_set_sensitive(c->bold, ((font_options & OPT_FONT_BOLD)) ? FALSE : TRUE); | |
310 | |
311 if (c->italic) | |
312 gtk_widget_set_sensitive(c->italic, ((font_options & OPT_FONT_ITALIC)) ? FALSE : TRUE); | |
313 | |
314 if (c->underline) | |
315 gtk_widget_set_sensitive(c->underline, ((font_options & OPT_FONT_UNDERLINE)) ? FALSE : TRUE); | |
316 | |
317 if (c->strike) | |
318 gtk_widget_set_sensitive(c->strike, ((font_options & OPT_FONT_STRIKE)) ? FALSE : TRUE); | |
319 | |
488
0fcb7e7a263c
[gaim-migrate @ 498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
474
diff
changeset
|
320 if (c->font) |
0fcb7e7a263c
[gaim-migrate @ 498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
474
diff
changeset
|
321 gtk_widget_set_sensitive(c->font, ((font_options & OPT_FONT_FACE)) ? TRUE : FALSE); |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
322 |
66 | 323 cnv = cnv->next; |
324 } | |
325 } | |
326 | |
327 /* | |
328 void update_transparency() | |
329 { | |
330 GList *cnv = conversations; | |
331 struct conversation *c; | |
332 | |
333 This func should be uncalled! | |
334 | |
335 while(cnv) { | |
336 c = (struct conversation *)cnv->data; | |
337 | |
338 if (c->text) | |
339 gtk_html_set_transparent(GTK_HTML(c->text), | |
340 (transparent) ? TRUE : FALSE); | |
341 | |
342 cnv = cnv->next; | |
343 } | |
344 } | |
345 */ | |
346 | |
347 | |
348 /*------------------------------------------------------------------------*/ | |
349 /* Callbacks */ | |
350 /*------------------------------------------------------------------------*/ | |
351 | |
608 | 352 void toggle_loggle(GtkWidget *loggle, struct conversation *c) |
66 | 353 { |
354 if (state_lock) | |
355 return; | |
608 | 356 if (find_log_info(c->name)) |
357 rm_log(find_log_info(c->name)); | |
358 else if (GTK_TOGGLE_BUTTON(loggle)->active) | |
359 show_log_dialog(c); | |
360 else | |
361 cancel_log(NULL, c); | |
66 | 362 } |
363 | |
570 | 364 void insert_smiley(GtkWidget *smiley, struct conversation *c) |
555 | 365 { |
366 if (state_lock) | |
367 return; | |
570 | 368 if (GTK_TOGGLE_BUTTON(smiley)->active) |
369 show_smiley_dialog(c, smiley); | |
370 else if (c->smiley_dialog) | |
371 close_smiley_dialog(smiley, c); | |
372 | |
555 | 373 return; |
374 } | |
375 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
376 int close_callback(GtkWidget *widget, struct conversation *c) |
66 | 377 { |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
378 if (c->window) |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
379 gtk_widget_destroy(c->window); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
380 c->window = NULL; |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
381 |
625
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
382 if (c->color_dialog) |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
383 gtk_widget_destroy(c->color_dialog); |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
384 c->color_dialog = NULL; |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
385 if (c->font_dialog) |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
386 gtk_widget_destroy(c->font_dialog); |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
387 c->font_dialog = NULL; |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
388 if (c->smiley_dialog) |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
389 gtk_widget_destroy(c->smiley_dialog); |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
390 c->smiley_dialog = NULL; |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
391 if (c->link_dialog) |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
392 gtk_widget_destroy(c->link_dialog); |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
393 c->link_dialog = NULL; |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
394 if (c->log_dialog) |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
395 gtk_widget_destroy(c->log_dialog); |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
396 c->log_dialog = NULL; |
ea41ca1658b5
[gaim-migrate @ 635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
624
diff
changeset
|
397 |
511
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
502
diff
changeset
|
398 if (c->is_chat) { |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
399 serv_chat_leave(c->id); |
511
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
502
diff
changeset
|
400 } else { |
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
502
diff
changeset
|
401 if (c->is_direct) { |
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
502
diff
changeset
|
402 if (!USE_OSCAR) { |
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
502
diff
changeset
|
403 /* FIXME */ |
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
502
diff
changeset
|
404 } else { |
515
b33ed0a7f49b
[gaim-migrate @ 525]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
405 gdk_input_remove(c->watcher); |
602
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
406 sprintf(debug_buff, "Closing DirectIM conversation (0x%p)\n", c->conn); |
515
b33ed0a7f49b
[gaim-migrate @ 525]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
407 debug_print(debug_buff); |
b33ed0a7f49b
[gaim-migrate @ 525]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
408 aim_conn_kill(gaim_sess, &c->conn); |
511
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
502
diff
changeset
|
409 } |
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
502
diff
changeset
|
410 } |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
411 delete_conversation(c); |
511
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
502
diff
changeset
|
412 } |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
413 |
66 | 414 return TRUE; |
415 } | |
416 | |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
417 void set_font_face(GtkWidget *widget, struct conversation *c) |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
418 { |
275
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
419 char *pre_fontface, *old_font_face; |
411
a330017b3aa4
[gaim-migrate @ 421]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
391
diff
changeset
|
420 int alloc = 0; |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
421 |
308
e5fa88351dc8
[gaim-migrate @ 318]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
422 if (c->current_fontface[0] && strcmp(c->current_fontface, "(null)")) |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
423 { |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
424 pre_fontface = g_strconcat("<FONT FACE=\"", c->current_fontface, "\">", '\0'); |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
425 alloc++; |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
426 } |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
427 else |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
428 pre_fontface = "<FONT FACE=\"Helvetica\">"; |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
429 |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
430 if (!strcmp(pre_fontface, "<FONT FACE=\"\">")) |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
431 { |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
432 g_free(pre_fontface); |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
433 alloc--; |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
434 pre_fontface = "<FONT FACE=\"Helvetica\">"; |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
435 } |
275
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
436 |
411
a330017b3aa4
[gaim-migrate @ 421]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
391
diff
changeset
|
437 if ((old_font_face = get_tag_by_prefix(c->entry, "<FONT FACE")) != NULL) |
275
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
438 { |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
439 remove_tags(c->entry, old_font_face); |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
440 remove_tags(c->entry, "</FONT>"); |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
441 } |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
442 |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
443 surround(c->entry, pre_fontface, "</FONT>"); |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
444 gtk_widget_grab_focus(c->entry); |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
445 |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
446 if (alloc) |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
447 g_free(pre_fontface); |
275
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
448 |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
449 g_free(old_font_face); /* mem allocated in get_tag_by_prefix() */ |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
450 return; |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
451 } |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
452 |
66 | 453 static gint delete_event_convo(GtkWidget *w, GdkEventAny *e, struct conversation *c) |
454 { | |
455 delete_conversation(c); | |
456 return FALSE; | |
457 } | |
458 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
459 void add_callback(GtkWidget *widget, struct conversation *c) |
66 | 460 { |
461 if (find_buddy(c->name) != NULL) { | |
654
ea811c6dd3e0
[gaim-migrate @ 664]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
650
diff
changeset
|
462 GtkWidget *parent = c->add_button->parent; |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
463 sprintf(debug_buff,_("Removing '%s' from buddylist.\n"), c->name); |
66 | 464 debug_print(debug_buff); |
465 remove_buddy(find_group_by_buddy(c->name), find_buddy(c->name)); | |
466 build_edit_tree(); | |
654
ea811c6dd3e0
[gaim-migrate @ 664]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
650
diff
changeset
|
467 gtk_widget_destroy(c->add_button); |
ea811c6dd3e0
[gaim-migrate @ 664]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
650
diff
changeset
|
468 c->add_button = picture_button2(c->window, NULL, gnome_add_xpm); |
ea811c6dd3e0
[gaim-migrate @ 664]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
650
diff
changeset
|
469 gtk_signal_connect(GTK_OBJECT(c->add_button), "clicked", GTK_SIGNAL_FUNC(add_callback), c); |
ea811c6dd3e0
[gaim-migrate @ 664]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
650
diff
changeset
|
470 gtk_box_pack_end(GTK_BOX(parent), c->add_button, FALSE, FALSE, 0); |
ea811c6dd3e0
[gaim-migrate @ 664]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
650
diff
changeset
|
471 gtk_box_reorder_child(GTK_BOX(parent), c->add_button, 1); |
ea811c6dd3e0
[gaim-migrate @ 664]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
650
diff
changeset
|
472 gtk_widget_show(c->add_button); |
66 | 473 } |
474 else | |
475 { | |
476 show_add_buddy(c->name, NULL); | |
477 } | |
478 | |
479 gtk_widget_grab_focus(c->entry); | |
480 } | |
481 | |
482 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
483 void block_callback(GtkWidget *widget, struct conversation *c) |
66 | 484 { |
485 show_add_perm(c->name); | |
486 gtk_widget_grab_focus(c->entry); | |
487 } | |
488 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
489 void warn_callback(GtkWidget *widget, struct conversation *c) |
66 | 490 { |
491 show_warn_dialog(c->name); | |
492 gtk_widget_grab_focus(c->entry); | |
493 } | |
494 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
495 void info_callback(GtkWidget *w, struct conversation *c) |
66 | 496 { |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
497 if (c->is_chat) { |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
498 char *name; |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
499 GList *i; |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
500 |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
501 i = GTK_LIST(c->list)->selection; |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
502 if (i) |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
503 name = (char *)gtk_object_get_user_data(GTK_OBJECT(i->data)); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
504 else |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
505 return; |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
506 |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
507 serv_get_info(name); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
508 } else { |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
509 serv_get_info(c->name); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
510 gtk_widget_grab_focus(c->entry); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
511 } |
66 | 512 } |
513 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
514 gboolean keypress_callback(GtkWidget *entry, GdkEventKey *event, struct conversation *c) |
66 | 515 { |
573
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
516 int pos; |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
517 if(event->keyval==GDK_Return) { |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
518 if(!(event->state & GDK_SHIFT_MASK) |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
519 && (general_options & OPT_GEN_ENTER_SENDS)) { |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
520 gtk_signal_emit_by_name(GTK_OBJECT(entry), "activate", c); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
521 //to stop the putting in of the enter character |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
522 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
523 } else { |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
524 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
525 pos=gtk_editable_get_position(GTK_EDITABLE(entry)); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
526 gtk_editable_insert_text(GTK_EDITABLE(entry), "\n", 1, &pos); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
527 } |
575
a33616e4e48d
[gaim-migrate @ 585]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
573
diff
changeset
|
528 } else if ((event->state & GDK_CONTROL_MASK) |
a33616e4e48d
[gaim-migrate @ 585]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
573
diff
changeset
|
529 && (general_options & OPT_GEN_CTL_CHARS)) { |
573
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
530 switch (event->keyval) { |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
531 case 'i': |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
532 quiet_set(c->italic, !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(c->italic))); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
533 do_italic(c->italic, c->entry); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
534 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
535 break; |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
536 case 'u': /* ctl-u is GDK_Clear, which clears the line */ |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
537 quiet_set(c->underline, !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(c->underline))); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
538 do_underline(c->underline, c->entry); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
539 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
540 break; |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
541 case 'b': /* ctl-b is GDK_Left, which moves backwards */ |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
542 quiet_set(c->bold, !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(c->bold))); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
543 do_bold(c->bold, c->entry); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
544 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
545 break; |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
546 case 's': |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
547 quiet_set(c->strike, !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(c->strike))); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
548 do_strike(c->strike, c->entry); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
549 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
550 break; |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
551 } |
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
552 } |
66 | 553 |
573
9566a53cde23
[gaim-migrate @ 583]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
554 return TRUE; |
66 | 555 |
556 } | |
557 | |
558 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
559 void send_callback(GtkWidget *widget, struct conversation *c) |
66 | 560 { |
101
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
561 char *buf = g_malloc(BUF_LEN * 4); |
66 | 562 char *buf2; |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
563 char *buf3; |
66 | 564 gchar *buf4; |
565 int hdrlen; | |
566 | |
283
0f14e6d8a51b
[gaim-migrate @ 293]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
275
diff
changeset
|
567 /* FIXME : for USE_OSCAR, libfaim can send messages much longer |
0f14e6d8a51b
[gaim-migrate @ 293]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
275
diff
changeset
|
568 * than this (I think it's about 7K rather than 4K. So we need |
0f14e6d8a51b
[gaim-migrate @ 293]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
275
diff
changeset
|
569 * to do these checks a little bit differently here */ |
66 | 570 buf4 = gtk_editable_get_chars(GTK_EDITABLE(c->entry), 0, -1); |
571 g_snprintf(buf, BUF_LONG, "%s", buf4); | |
572 g_free(buf4); | |
573 | |
574 if (!strlen(buf)) { | |
575 return; | |
576 } | |
577 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
578 gtk_editable_delete_text(GTK_EDITABLE(c->entry), 0, -1); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
579 |
66 | 580 if (general_options & OPT_GEN_SEND_LINKS) { |
581 linkify_text(buf); | |
582 } | |
583 | |
584 /* Let us determine how long the message CAN be. | |
585 * toc_send_im is 11 chars long + 2 quotes. | |
586 * + 2 spaces + 6 for the header + 2 for good | |
587 * measure = 23 bytes + the length of normalize c->name */ | |
588 | |
589 buf2 = g_malloc(BUF_LONG); | |
590 | |
591 hdrlen = 23 + strlen(normalize(c->name)); | |
592 | |
593 /* printf("%d %d %d\n", strlen(buf), hdrlen, BUF_LONG);*/ | |
594 | |
595 if (font_options & OPT_FONT_BOLD) { | |
596 g_snprintf(buf2, BUF_LONG, "<B>%s</B>", buf); | |
597 strcpy(buf, buf2); | |
598 } | |
599 | |
600 if (font_options & OPT_FONT_ITALIC) { | |
601 g_snprintf(buf2, BUF_LONG, "<I>%s</I>", buf); | |
602 strcpy(buf, buf2); | |
603 } | |
604 | |
605 if (font_options & OPT_FONT_UNDERLINE) { | |
606 g_snprintf(buf2, BUF_LONG, "<U>%s</U>", buf); | |
607 strcpy(buf, buf2); | |
608 } | |
609 | |
610 if (font_options & OPT_FONT_STRIKE) { | |
611 g_snprintf(buf2, BUF_LONG, "<STRIKE>%s</STRIKE>", buf); | |
612 strcpy(buf, buf2); | |
613 } | |
101
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
614 |
488
0fcb7e7a263c
[gaim-migrate @ 498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
474
diff
changeset
|
615 if (font_options & OPT_FONT_FACE) { |
0fcb7e7a263c
[gaim-migrate @ 498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
474
diff
changeset
|
616 g_snprintf(buf2, BUF_LONG, "<FONT FACE=\"%s\">%s</FONT>", c->current_fontface, buf); |
0fcb7e7a263c
[gaim-migrate @ 498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
474
diff
changeset
|
617 strcpy(buf, buf2); |
0fcb7e7a263c
[gaim-migrate @ 498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
474
diff
changeset
|
618 } |
0fcb7e7a263c
[gaim-migrate @ 498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
474
diff
changeset
|
619 |
101
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
620 #ifdef GAIM_PLUGINS |
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
621 { |
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
622 GList *ca = callbacks; |
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
623 struct gaim_callback *g; |
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
624 void (*function)(char *, char **, void *); |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
389
diff
changeset
|
625 char *buffy = g_strdup(buf); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
626 enum gaim_event evnt = c->is_chat ? event_chat_send : event_im_send; |
101
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
627 while (ca) { |
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
628 g = (struct gaim_callback *)(ca->data); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
629 if (g->event == evnt && g->function != NULL) { |
101
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
630 function = g->function; |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
389
diff
changeset
|
631 (*function)(c->name, &buffy, g->data); |
101
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
632 } |
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
633 ca = ca->next; |
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
634 } |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
389
diff
changeset
|
635 if (!buffy) { |
102
8c301530b2a3
[gaim-migrate @ 112]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
101
diff
changeset
|
636 g_free(buf2); |
8c301530b2a3
[gaim-migrate @ 112]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
101
diff
changeset
|
637 return; |
8c301530b2a3
[gaim-migrate @ 112]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
101
diff
changeset
|
638 } |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
389
diff
changeset
|
639 g_snprintf(buf, BUF_LONG, "%s", buffy); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
389
diff
changeset
|
640 g_free(buffy); |
101
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
641 } |
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
642 #endif |
66 | 643 |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
644 if (!c->is_chat) { |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
645 buf3 = g_strdup(buf); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
646 write_to_conv(c, buf3, WFLAG_SEND, NULL); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
647 g_free(buf3); |
502
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
648 escape_text(buf); |
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
649 if (escape_message(buf) > MSG_LEN - hdrlen) |
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
650 do_error_dialog(_("Message too long, some data truncated."), _("Error")); |
66 | 651 |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
652 serv_send_im(c->name, buf, 0); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
653 |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
654 if (c->makesound && (sound_options & OPT_SOUND_SEND)) |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
655 play_sound(SEND); |
502
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
656 } else { |
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
657 serv_chat_send(c->id, buf); /* this does escape_text for us */ |
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
658 |
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
659 /* 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
|
660 } |
66 | 661 |
662 quiet_set(c->bold, FALSE); | |
663 quiet_set(c->strike, FALSE); | |
664 quiet_set(c->italic, FALSE); | |
665 quiet_set(c->underline, FALSE); | |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
666 quiet_set(c->font, FALSE); |
66 | 667 quiet_set(c->palette, FALSE); |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
668 quiet_set(c->link, FALSE); |
66 | 669 |
375
1eae69f076d2
[gaim-migrate @ 385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
373
diff
changeset
|
670 if ((general_options & OPT_GEN_BACK_ON_IM) && awaymessage != NULL) { |
66 | 671 do_im_back(); |
672 } | |
673 | |
674 gtk_widget_grab_focus(c->entry); | |
675 | |
488
0fcb7e7a263c
[gaim-migrate @ 498]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
474
diff
changeset
|
676 g_free(buf2); |
101
a9aa982272f9
[gaim-migrate @ 111]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
88
diff
changeset
|
677 g_free(buf); |
66 | 678 } |
679 | |
680 static int | |
681 entry_key_pressed(GtkWidget *w, GtkWidget *entry) | |
682 { | |
683 check_everything(w); | |
684 return TRUE; | |
685 } | |
686 | |
687 /*------------------------------------------------------------------------*/ | |
688 /* HTML-type stuff */ | |
689 /*------------------------------------------------------------------------*/ | |
690 | |
691 int count_tag(GtkWidget *entry, char *s1, char *s2) | |
692 { | |
693 char *p1, *p2; | |
694 int res=0; | |
695 char *tmp, *tmpo, h; | |
696 tmpo = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); | |
697 h = tmpo[GTK_EDITABLE(entry)->current_pos]; | |
698 tmpo[GTK_EDITABLE(entry)->current_pos]='\0'; | |
699 tmp=tmpo; | |
700 do { | |
701 p1 = strstr(tmp, s1); | |
702 p2 = strstr(tmp, s2); | |
703 if (p1 && p2) { | |
704 if (p1 < p2) { | |
705 res=1; | |
706 tmp = p1 +strlen(s1); | |
707 } else if (p2 < p1) { | |
708 res = 0; | |
709 tmp = p2 + strlen(s2); | |
710 } | |
711 } else { | |
712 if (p1) { | |
713 res = 1; | |
714 tmp = p1 + strlen(s1); | |
715 } else if (p2) { | |
716 res = 0; | |
717 tmp = p2 + strlen(s2); | |
718 } | |
719 } | |
720 } while (p1 || p2); | |
721 tmpo[GTK_EDITABLE(entry)->current_pos]=h; | |
722 g_free(tmpo); | |
723 return res; | |
724 } | |
725 | |
726 | |
727 int invert_tags(GtkWidget *entry, char *s1, char *s2, int really) | |
728 { | |
729 int start = GTK_EDITABLE(entry)->selection_start_pos; | |
730 int finish = GTK_EDITABLE(entry)->selection_end_pos; | |
731 char *s; | |
732 | |
733 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); | |
734 if (!strncasecmp(&s[start], s1, strlen(s1)) && | |
735 !strncasecmp(&s[finish - strlen(s2)], s2, strlen(s2))) { | |
736 if (really) { | |
737 gtk_editable_delete_text(GTK_EDITABLE(entry), start, start + strlen(s1)); | |
738 gtk_editable_delete_text(GTK_EDITABLE(entry), finish - strlen(s2) - strlen(s1), finish - strlen(s1)); | |
739 } | |
740 g_free(s); | |
741 return 1; | |
742 } | |
743 g_free(s); | |
744 return 0; | |
745 } | |
746 | |
747 | |
748 void remove_tags(GtkWidget *entry, char *tag) | |
749 { | |
275
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
750 char *s, *t; |
66 | 751 int start = GTK_EDITABLE(entry)->selection_start_pos; |
752 int finish = GTK_EDITABLE(entry)->selection_end_pos; | |
275
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
753 int temp; |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
754 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); |
66 | 755 t = s; |
275
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
756 |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
757 if (start > finish) |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
758 { |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
759 temp = start; |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
760 start = finish; |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
761 finish = temp; |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
762 } |
f9eb3eb9ffde
[gaim-migrate @ 285]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
234
diff
changeset
|
763 |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
764 if (strstr(tag, "<FONT SIZE=")) |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
765 { |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
766 while((t = strstr(t, "<FONT SIZE="))) { |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
767 if (((t-s) < finish) && ((t-s) >= start)) { |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
768 gtk_editable_delete_text(GTK_EDITABLE(entry), (t-s), (t-s) + strlen(tag)); |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
769 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
770 t = s; |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
771 } |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
772 else t++; |
68 | 773 } |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
774 } |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
775 else |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
776 { |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
777 while((t = strstr(t, tag))) { |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
778 if (((t-s) < finish) && ((t-s) >= start)) { |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
779 gtk_editable_delete_text(GTK_EDITABLE(entry), (t-s), (t-s) + strlen(tag)); |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
780 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
781 t = s; |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
782 } |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
783 else t++; |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
784 } |
66 | 785 } |
786 g_free(s); | |
787 } | |
788 | |
789 void surround(GtkWidget *entry, char *pre, char *post) | |
790 { | |
649 | 791 int temp, pos = GTK_EDITABLE(entry)->current_pos; |
66 | 792 int dummy; |
793 int start, finish; | |
794 if (GTK_EDITABLE(entry)->has_selection) { | |
795 remove_tags(entry, pre); | |
796 remove_tags(entry, post); | |
797 start = GTK_EDITABLE(entry)->selection_start_pos; | |
798 finish = GTK_EDITABLE(entry)->selection_end_pos; | |
799 if (start > finish) { | |
800 dummy = finish; | |
801 finish = start; | |
802 start = dummy; | |
803 } | |
804 dummy = start; | |
805 gtk_editable_insert_text(GTK_EDITABLE(entry), pre, strlen(pre), &dummy); | |
806 dummy = finish + strlen(pre); | |
807 gtk_editable_insert_text(GTK_EDITABLE(entry), post, strlen(post), &dummy); | |
808 gtk_editable_select_region(GTK_EDITABLE(entry), start, finish + strlen(pre) + strlen(post)); | |
809 } else { | |
649 | 810 temp = pos; |
66 | 811 gtk_editable_insert_text(GTK_EDITABLE(entry), pre, strlen(pre), &pos); |
649 | 812 if (temp == pos) |
813 { | |
814 dummy = pos + strlen(pre); | |
815 gtk_editable_insert_text(GTK_EDITABLE(entry), post, strlen(post), &dummy); | |
816 gtk_editable_set_position(GTK_EDITABLE(entry), dummy); | |
817 } | |
818 else | |
819 { | |
820 dummy = pos; | |
821 gtk_editable_insert_text(GTK_EDITABLE(entry), post, strlen(post), &dummy); | |
822 gtk_editable_set_position(GTK_EDITABLE(entry), pos); | |
823 } | |
66 | 824 } |
825 gtk_widget_grab_focus(entry); | |
826 } | |
827 | |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
337
diff
changeset
|
828 void advance_past(GtkWidget *entry, char *pre, char *post) |
66 | 829 { |
830 char *s, *s2; | |
831 int pos; | |
832 if (invert_tags(entry, pre, post, 1)) | |
833 return; | |
834 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); | |
835 pos = GTK_EDITABLE(entry)->current_pos; | |
523
023c3851db0a
[gaim-migrate @ 533]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
520
diff
changeset
|
836 sprintf(debug_buff, _("Currently at %d, "), pos); |
66 | 837 debug_print(debug_buff); |
838 s2= strstr(&s[pos], post); | |
523
023c3851db0a
[gaim-migrate @ 533]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
520
diff
changeset
|
839 if (s2) { |
66 | 840 pos = s2 - s + strlen(post); |
523
023c3851db0a
[gaim-migrate @ 533]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
520
diff
changeset
|
841 } else { |
023c3851db0a
[gaim-migrate @ 533]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
520
diff
changeset
|
842 gtk_editable_insert_text(GTK_EDITABLE(entry), post, strlen(post), &pos); |
023c3851db0a
[gaim-migrate @ 533]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
520
diff
changeset
|
843 } |
023c3851db0a
[gaim-migrate @ 533]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
520
diff
changeset
|
844 sprintf(debug_buff, _("Setting position to %d\n"), pos); |
66 | 845 debug_print(debug_buff); |
846 gtk_editable_set_position(GTK_EDITABLE(entry), pos); | |
847 gtk_widget_grab_focus(entry); | |
848 } | |
849 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
850 void toggle_color(GtkWidget *color, struct conversation *c) |
66 | 851 { |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
852 if (state_lock) |
66 | 853 return; |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
854 if (GTK_TOGGLE_BUTTON(color)->active) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
855 show_color_dialog(c, color); |
563
8d6e2de1fb64
[gaim-migrate @ 573]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
557
diff
changeset
|
856 else if (c->color_dialog) |
8d6e2de1fb64
[gaim-migrate @ 573]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
557
diff
changeset
|
857 cancel_color(color, c); |
189
50dc3db25513
[gaim-migrate @ 199]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
187
diff
changeset
|
858 else |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
859 advance_past(c->entry, "<FONT COLOR>", "</FONT>" ); |
66 | 860 } |
861 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
862 void toggle_font(GtkWidget *font, struct conversation *c) |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
863 { |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
864 if (state_lock) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
865 return; |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
866 if (GTK_TOGGLE_BUTTON(font)->active) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
867 show_font_dialog(c, font); |
563
8d6e2de1fb64
[gaim-migrate @ 573]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
557
diff
changeset
|
868 else if (c->font_dialog) |
8d6e2de1fb64
[gaim-migrate @ 573]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
557
diff
changeset
|
869 cancel_font(font, c); |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
870 else |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
871 advance_past(c->entry, "<FONT FACE>", "</FONT>"); |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
872 } |
611
0f7e5ff95f71
[gaim-migrate @ 621]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
610
diff
changeset
|
873 |
608 | 874 void toggle_link(GtkWidget *linky, struct conversation *c) |
875 { | |
876 if (state_lock) | |
877 return; | |
878 if (GTK_TOGGLE_BUTTON(linky)->active) | |
879 show_add_link(linky, c); | |
880 else if (c->link_dialog) | |
881 cancel_link(linky, c); | |
882 else | |
883 advance_past(c->entry, "<A HREF>", "</A>"); | |
884 } | |
66 | 885 |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
337
diff
changeset
|
886 void do_strike(GtkWidget *strike, GtkWidget *entry) |
66 | 887 { |
888 if (state_lock) | |
889 return; | |
890 if (GTK_TOGGLE_BUTTON(strike)->active) | |
891 surround(entry, "<STRIKE>","</STRIKE>"); | |
892 else | |
893 advance_past(entry, "<STRIKE>", "</STRIKE>"); | |
894 } | |
895 | |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
337
diff
changeset
|
896 void do_bold(GtkWidget *bold, GtkWidget *entry) |
66 | 897 { |
898 if (state_lock) | |
899 return; | |
900 if (GTK_TOGGLE_BUTTON(bold)->active) | |
901 surround(entry, "<B>","</B>"); | |
902 else | |
903 advance_past(entry, "<B>", "</B>"); | |
904 } | |
905 | |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
337
diff
changeset
|
906 void do_underline(GtkWidget *underline, GtkWidget *entry) |
66 | 907 { |
908 if (state_lock) | |
909 return; | |
910 if (GTK_TOGGLE_BUTTON(underline)->active) | |
911 surround(entry, "<U>","</U>"); | |
912 else | |
913 advance_past(entry, "<U>", "</U>"); | |
914 } | |
915 | |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
337
diff
changeset
|
916 void do_italic(GtkWidget *italic, GtkWidget *entry) |
66 | 917 { |
918 if (state_lock) | |
919 return; | |
920 if (GTK_TOGGLE_BUTTON(italic)->active) | |
921 surround(entry, "<I>","</I>"); | |
922 else | |
923 advance_past(entry, "<I>", "</I>"); | |
924 } | |
925 | |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
926 /* 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
|
927 /* currently set to 15 chars */ |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
928 |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
337
diff
changeset
|
929 void do_small(GtkWidget *small, GtkWidget *entry) |
66 | 930 { |
931 if (state_lock) | |
932 return; | |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
933 surround(entry, "<FONT SIZE=\"1\">","</FONT>"); |
66 | 934 } |
935 | |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
337
diff
changeset
|
936 void do_normal(GtkWidget *normal, GtkWidget *entry) |
66 | 937 { |
938 if (state_lock) | |
939 return; | |
88 | 940 surround(entry, "<FONT SIZE=\"3\">","</FONT>"); |
66 | 941 } |
942 | |
344
2434adbb8703
[gaim-migrate @ 354]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
337
diff
changeset
|
943 void do_big(GtkWidget *big, GtkWidget *entry) |
66 | 944 { |
945 if (state_lock) | |
946 return; | |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
210
diff
changeset
|
947 surround(entry, "<FONT SIZE=\"5\">","</FONT>"); |
66 | 948 } |
949 | |
950 void check_everything(GtkWidget *entry) | |
951 { | |
952 struct conversation *c; | |
206 | 953 |
66 | 954 c = (struct conversation *)gtk_object_get_user_data(GTK_OBJECT(entry)); |
955 if (!c) return; | |
956 if (invert_tags(entry, "<B>", "</B>", 0)) | |
957 quiet_set(c->bold, TRUE); | |
958 else if (count_tag(entry, "<B>", "</B>")) | |
959 quiet_set(c->bold, TRUE); | |
960 else | |
961 quiet_set(c->bold,FALSE); | |
962 if (invert_tags(entry, "<I>", "</I>", 0)) | |
963 quiet_set(c->italic, TRUE); | |
964 else if (count_tag(entry, "<I>", "</I>")) | |
965 quiet_set(c->italic, TRUE); | |
966 else | |
967 quiet_set(c->italic, FALSE); | |
968 | |
969 if (invert_tags(entry, "<FONT COLOR", "</FONT>", 0)) | |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
970 quiet_set(c->palette, TRUE); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
971 else if (count_tag(entry, "<FONT COLOR", "</FONT>")) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
972 quiet_set(c->palette, TRUE); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
973 else |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
974 quiet_set(c->palette, FALSE); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
975 |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
976 if (invert_tags(entry, "<FONT FACE", "</FONT>", 0)) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
977 quiet_set(c->font, TRUE); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
978 else if (count_tag(entry, "<FONT FACE", "</FONT>")) |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
979 quiet_set(c->font, TRUE); |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
980 else |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
981 quiet_set(c->font, FALSE); |
66 | 982 |
983 if (invert_tags(entry, "<A HREF", "</A>", 0)) | |
984 quiet_set(c->link, TRUE); | |
985 else if (count_tag(entry, "<A HREF", "</A>")) | |
986 quiet_set(c->link, TRUE); | |
987 else | |
988 quiet_set(c->link, FALSE); | |
989 | |
990 if (invert_tags(entry, "<U>", "</U>", 0)) | |
991 quiet_set(c->underline, TRUE); | |
992 else if (count_tag(entry, "<U>", "</U>")) | |
993 quiet_set(c->underline, TRUE); | |
994 else | |
995 quiet_set(c->underline, FALSE); | |
996 | |
997 if (invert_tags(entry, "<STRIKE>", "</STRIKE>", 0)) | |
998 quiet_set(c->strike, TRUE); | |
999 else if (count_tag(entry, "<STRIKE>", "</STRIKE>")) | |
1000 quiet_set(c->strike, TRUE); | |
1001 else | |
1002 quiet_set(c->strike, FALSE); | |
1003 } | |
1004 | |
1005 | |
1006 /*------------------------------------------------------------------------*/ | |
1007 /* Takin care of the window.. */ | |
1008 /*------------------------------------------------------------------------*/ | |
1009 | |
1010 | |
602
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
1011 static GdkPixmap *is_smiley(GtkWidget *window, char *m, int *len) { |
502
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1012 GdkBitmap *mask; |
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1013 GdkPixmap *face = NULL; |
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1014 |
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1015 if (strlen(m) < 2) return face; |
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1016 *len = 2; |
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1017 if ( !strncmp(m, ":)", 2) || |
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1018 !strncmp(m, "=)", 2)) { |
628
a46a68d46d2b
[gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
625
diff
changeset
|
1019 face = gdk_pixmap_create_from_xpm_d(window->window, &mask, &window->style->base[GTK_STATE_NORMAL], smile_xpm); |
502
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1020 } else if (!strncmp(m, ":(", 2) || |
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1021 !strncmp(m, "=(", 2)) { |
628
a46a68d46d2b
[gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
625
diff
changeset
|
1022 face = gdk_pixmap_create_from_xpm_d(window->window, &mask, &window->style->base[GTK_STATE_NORMAL], sad_xpm); |
502
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1023 } else if (!strncmp(m, ";)", 2)) { |
628
a46a68d46d2b
[gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
625
diff
changeset
|
1024 face = gdk_pixmap_create_from_xpm_d(window->window, &mask, &window->style->base[GTK_STATE_NORMAL], wink_xpm); |
629
ce8d8608d05b
[gaim-migrate @ 639]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
628
diff
changeset
|
1025 } else if (!strncmp(m, ":p", 2) || |
ce8d8608d05b
[gaim-migrate @ 639]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
628
diff
changeset
|
1026 !strncmp(m, ":P", 2)) { |
ce8d8608d05b
[gaim-migrate @ 639]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
628
diff
changeset
|
1027 face = gdk_pixmap_create_from_xpm_d(window->window, &mask, &window->style->base[GTK_STATE_NORMAL], tongue_xpm); |
502
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1028 } |
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1029 |
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1030 if (face || strlen(m) < 3) return face; |
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1031 *len = 3; |
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1032 if ( !strncmp(m, ":-)", 3)) { |
628
a46a68d46d2b
[gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
625
diff
changeset
|
1033 face = gdk_pixmap_create_from_xpm_d(window->window, &mask, &window->style->base[GTK_STATE_NORMAL], smile_xpm); |
610
cadb51c068cb
[gaim-migrate @ 620]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
1034 } else if (!strncmp(m, "O-)", 3)) { |
628
a46a68d46d2b
[gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
625
diff
changeset
|
1035 face = gdk_pixmap_create_from_xpm_d(window->window, &mask, &window->style->base[GTK_STATE_NORMAL], oneeye_xpm); |
551 | 1036 } else if (!strncmp(m, "C:)", 3)) { |
628
a46a68d46d2b
[gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
625
diff
changeset
|
1037 face = gdk_pixmap_create_from_xpm_d(window->window, &mask, &window->style->base[GTK_STATE_NORMAL], luke03_xpm); |
502
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1038 } else if (!strncmp(m, ":-(", 3)) { |
628
a46a68d46d2b
[gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
625
diff
changeset
|
1039 face = gdk_pixmap_create_from_xpm_d(window->window, &mask, &window->style->base[GTK_STATE_NORMAL], sad_xpm); |
502
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1040 } else if (!strncmp(m, ";-)", 3)) { |
628
a46a68d46d2b
[gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
625
diff
changeset
|
1041 face = gdk_pixmap_create_from_xpm_d(window->window, &mask, &window->style->base[GTK_STATE_NORMAL], wink_xpm); |
502
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1042 } else if (!strncmp(m, ":-p", 3) || |
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1043 !strncmp(m, ":-P", 3)) { |
628
a46a68d46d2b
[gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
625
diff
changeset
|
1044 face = gdk_pixmap_create_from_xpm_d(window->window, &mask, &window->style->base[GTK_STATE_NORMAL], tongue_xpm); |
502
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1045 } else if (!strncmp(m, "=-O", 3)) { |
628
a46a68d46d2b
[gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
625
diff
changeset
|
1046 face = gdk_pixmap_create_from_xpm_d(window->window, &mask, &window->style->base[GTK_STATE_NORMAL], scream_xpm); |
502
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1047 } else if (!strncmp(m, ":-*", 3)) { |
628
a46a68d46d2b
[gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
625
diff
changeset
|
1048 face = gdk_pixmap_create_from_xpm_d(window->window, &mask, &window->style->base[GTK_STATE_NORMAL], kiss_xpm); |
502
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1049 } else if (!strncmp(m, ">:o", 3)) { |
628
a46a68d46d2b
[gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
625
diff
changeset
|
1050 face = gdk_pixmap_create_from_xpm_d(window->window, &mask, &window->style->base[GTK_STATE_NORMAL], yell_xpm); |
502
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1051 } else if (!strncmp(m, "8-)", 3)) { |
628
a46a68d46d2b
[gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
625
diff
changeset
|
1052 face = gdk_pixmap_create_from_xpm_d(window->window, &mask, &window->style->base[GTK_STATE_NORMAL], smile8_xpm); |
502
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1053 } else if (!strncmp(m, ":-$", 3)) { |
628
a46a68d46d2b
[gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
625
diff
changeset
|
1054 face = gdk_pixmap_create_from_xpm_d(window->window, &mask, &window->style->base[GTK_STATE_NORMAL], moneymouth_xpm); |
502
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1055 } else if (!strncmp(m, ":-!", 3)) { |
628
a46a68d46d2b
[gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
625
diff
changeset
|
1056 face = gdk_pixmap_create_from_xpm_d(window->window, &mask, &window->style->base[GTK_STATE_NORMAL], burp_xpm); |
502
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1057 } else if (!strncmp(m, ":-[", 3)) { |
628
a46a68d46d2b
[gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
625
diff
changeset
|
1058 face = gdk_pixmap_create_from_xpm_d(window->window, &mask, &window->style->base[GTK_STATE_NORMAL], embarrassed_xpm); |
502
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1059 } else if (!strncmp(m, ":'(", 3)) { |
628
a46a68d46d2b
[gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
625
diff
changeset
|
1060 face = gdk_pixmap_create_from_xpm_d(window->window, &mask, &window->style->base[GTK_STATE_NORMAL], cry_xpm); |
502
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1061 } else if (!strncmp(m, ":-\\", 3) || |
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1062 !strncmp(m, ":-/", 3)) { |
628
a46a68d46d2b
[gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
625
diff
changeset
|
1063 face = gdk_pixmap_create_from_xpm_d(window->window, &mask, &window->style->base[GTK_STATE_NORMAL], think_xpm); |
502
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1064 } else if (!strncmp(m, ":-X", 3)) { |
628
a46a68d46d2b
[gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
625
diff
changeset
|
1065 face = gdk_pixmap_create_from_xpm_d(window->window, &mask, &window->style->base[GTK_STATE_NORMAL], crossedlips_xpm); |
502
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1066 } else if (!strncmp(m, ":-D", 3)) { |
628
a46a68d46d2b
[gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
625
diff
changeset
|
1067 face = gdk_pixmap_create_from_xpm_d(window->window, &mask, &window->style->base[GTK_STATE_NORMAL], bigsmile_xpm); |
502
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1068 } |
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1069 |
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1070 if (face || strlen(m) < 4) return face; |
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1071 *len = 4; |
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1072 if ( !strncmp(m, "O:-)", 4)) { |
628
a46a68d46d2b
[gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
625
diff
changeset
|
1073 face = gdk_pixmap_create_from_xpm_d(window->window, &mask, &window->style->base[GTK_STATE_NORMAL], angel_xpm); |
502
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1074 } |
551 | 1075 else if (!strncmp(m, "C:-)", 4)) { |
628
a46a68d46d2b
[gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
625
diff
changeset
|
1076 face = gdk_pixmap_create_from_xpm_d(window->window, &mask, &window->style->base[GTK_STATE_NORMAL], luke03_xpm); |
551 | 1077 } |
502
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1078 |
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1079 if (face || strlen(m) < 6) return face; |
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1080 *len = 6; |
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1081 if ( !strncmp(m, ">:o", 6)) { |
628
a46a68d46d2b
[gaim-migrate @ 638]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
625
diff
changeset
|
1082 face = gdk_pixmap_create_from_xpm_d(window->window, &mask, &window->style->base[GTK_STATE_NORMAL], yell_xpm); |
502
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1083 } |
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1084 |
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1085 return face; |
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1086 } |
4d1e39112cbd
[gaim-migrate @ 512]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
494
diff
changeset
|
1087 |
602
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
1088 void write_html_with_smileys(GtkWidget *window, GtkWidget *html, char *what) |
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
1089 { |
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
1090 int y = 0; |
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
1091 char buf2[BUF_LONG]; |
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
1092 int i; |
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
1093 GdkPixmap *face; |
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
1094 |
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
1095 for (i = 0; i < strlen(what); i++) |
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
1096 { |
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
1097 int len; |
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
1098 if ((face = is_smiley(window, &what[i], &len)) != NULL) { |
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
1099 buf2[y] = 0; |
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
1100 gtk_html_append_text(GTK_HTML(html), buf2, (display_options & OPT_DISP_IGNORE_COLOUR) ? HTML_OPTION_NO_COLOURS : 0); |
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
1101 gtk_html_add_pixmap(GTK_HTML(html), face, 0, 0); |
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
1102 y = 0; |
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
1103 i += len - 1; |
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
1104 } else { |
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
1105 buf2[y] = what[i]; |
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
1106 y++; |
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
1107 |
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
1108 } |
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
1109 } |
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
1110 |
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
1111 if (y) |
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
1112 { |
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
1113 buf2[y] = 0; |
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
1114 gtk_html_append_text(GTK_HTML(html), buf2, (display_options & OPT_DISP_IGNORE_COLOUR) ? HTML_OPTION_NO_COLOURS : 0); |
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
1115 } |
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
1116 } |
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
1117 |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1118 /* 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
|
1119 * normal IM conversation or a chat window. but hopefully it won't matter */ |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1120 void write_to_conv(struct conversation *c, char *what, int flags, char *who) |
66 | 1121 { |
1122 char *buf = g_malloc(BUF_LONG); | |
636
072200640327
[gaim-migrate @ 646]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
629
diff
changeset
|
1123 char buf2[1024]; |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1124 char *str; |
66 | 1125 FILE *fd; |
1126 char colour[10]; | |
636
072200640327
[gaim-migrate @ 646]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
629
diff
changeset
|
1127 int colorv = -1; |
072200640327
[gaim-migrate @ 646]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
629
diff
changeset
|
1128 char *clr; |
389 | 1129 char *smiley = g_malloc(7); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1130 |
474
7720d0f9da8e
[gaim-migrate @ 484]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
473
diff
changeset
|
1131 if (!who) { |
7720d0f9da8e
[gaim-migrate @ 484]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
473
diff
changeset
|
1132 if (flags & WFLAG_SEND) |
7720d0f9da8e
[gaim-migrate @ 484]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
473
diff
changeset
|
1133 who = current_user->username; |
7720d0f9da8e
[gaim-migrate @ 484]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
473
diff
changeset
|
1134 else |
7720d0f9da8e
[gaim-migrate @ 484]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
473
diff
changeset
|
1135 who = c->name; |
7720d0f9da8e
[gaim-migrate @ 484]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
473
diff
changeset
|
1136 } |
337 | 1137 |
66 | 1138 if (flags & WFLAG_SYSTEM) { |
1139 | |
1140 gtk_html_freeze(GTK_HTML(c->text)); | |
1141 | |
1142 gtk_html_append_text(GTK_HTML(c->text), what, 0); | |
337 | 1143 |
1144 gtk_html_append_text(GTK_HTML(c->text), "<BR>", 0); | |
66 | 1145 |
1146 if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(c->name)) { | |
1147 char *t1; | |
1148 | |
1149 if (general_options & OPT_GEN_STRIP_HTML) { | |
1150 t1 = strip_html(what); | |
1151 } else { | |
1152 t1 = what; | |
1153 } | |
373
1d29321843b0
[gaim-migrate @ 383]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
363
diff
changeset
|
1154 fd = open_log_file(c->name); |
66 | 1155 fprintf(fd, "%s\n", t1); |
1156 fclose(fd); | |
1157 if (general_options & OPT_GEN_STRIP_HTML) { | |
1158 g_free(t1); | |
1159 } | |
1160 } | |
1161 | |
1162 } else { | |
636
072200640327
[gaim-migrate @ 646]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
629
diff
changeset
|
1163 if ((clr = strstr(what, "<BODY BGCOLOR=\"#")) != NULL) { |
072200640327
[gaim-migrate @ 646]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
629
diff
changeset
|
1164 sscanf(clr + strlen("<BODY BGCOLOR=\"#"), "%x", &colorv); |
072200640327
[gaim-migrate @ 646]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
629
diff
changeset
|
1165 } |
66 | 1166 |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1167 if (flags & WFLAG_WHISPER) { |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1168 /* if we're whispering, it's not an autoresponse */ |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1169 if (meify(what)) { |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1170 str = g_malloc(64); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1171 g_snprintf(str, 62, "***%s", who); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1172 strcpy(colour, "#6C2585\0"); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1173 } else { |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1174 str = g_malloc(64); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1175 g_snprintf(str, 62, "*%s*:", who); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1176 strcpy(colour, "#00ff00\0"); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1177 } |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1178 } else { |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1179 if (meify(what)) { |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1180 str = g_malloc(64); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1181 if (flags & WFLAG_AUTO) |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1182 g_snprintf(str, 62, "%s ***%s", AUTO_RESPONSE, who); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1183 else |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1184 g_snprintf(str, 62, "***%s", who); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1185 strcpy(colour, "#062585\0"); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1186 } else { |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1187 str = g_malloc(64); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1188 if (flags & WFLAG_AUTO) |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1189 g_snprintf(str, 62, "%s %s", who, AUTO_RESPONSE); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1190 else |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1191 g_snprintf(str, 62, "%s:", who); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1192 if (flags & WFLAG_RECV) |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1193 strcpy(colour, "#ff0000"); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1194 else if (flags & WFLAG_SEND) |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1195 strcpy(colour, "#0000ff"); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1196 } |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1197 } |
66 | 1198 |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1199 if (display_options & OPT_DISP_SHOW_TIME) |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1200 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"%s\"><B>%s %s</B></FONT> ", colour, date(), str); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1201 else |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1202 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"%s\"><B>%s</B></FONT>", colour, str); |
66 | 1203 |
473
f9bb7761c52b
[gaim-migrate @ 483]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
472
diff
changeset
|
1204 g_free(str); |
f9bb7761c52b
[gaim-migrate @ 483]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
472
diff
changeset
|
1205 |
66 | 1206 gtk_html_freeze(GTK_HTML(c->text)); |
1207 | |
636
072200640327
[gaim-migrate @ 646]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
629
diff
changeset
|
1208 if (colorv != -1) { |
072200640327
[gaim-migrate @ 646]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
629
diff
changeset
|
1209 sprintf(buf2, "<BODY BGCOLOR=\"#%x\">", colorv); |
072200640327
[gaim-migrate @ 646]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
629
diff
changeset
|
1210 gtk_html_append_text(GTK_HTML(c->text), buf2, 0); |
072200640327
[gaim-migrate @ 646]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
629
diff
changeset
|
1211 } |
072200640327
[gaim-migrate @ 646]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
629
diff
changeset
|
1212 |
602
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
1213 gtk_html_append_text(GTK_HTML(c->text), buf, 0); |
337 | 1214 |
1215 if (display_options & OPT_DISP_SHOW_SMILEY) | |
1216 { | |
602
02ea095a972a
[gaim-migrate @ 612]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
575
diff
changeset
|
1217 write_html_with_smileys(c->window, c->text, what); |
337 | 1218 } |
1219 else | |
1220 { | |
1221 gtk_html_append_text(GTK_HTML(c->text), what, (display_options & OPT_DISP_IGNORE_COLOUR) ? HTML_OPTION_NO_COLOURS : 0); | |
1222 } | |
66 | 1223 |
636
072200640327
[gaim-migrate @ 646]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
629
diff
changeset
|
1224 if (colorv != -1) { |
072200640327
[gaim-migrate @ 646]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
629
diff
changeset
|
1225 gtk_html_append_text(GTK_HTML(c->text), "</BODY>", 0); |
072200640327
[gaim-migrate @ 646]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
629
diff
changeset
|
1226 } |
66 | 1227 gtk_html_append_text(GTK_HTML(c->text), "<BR>", 0); |
1228 | |
1229 | |
1230 if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(c->name)) { | |
1231 char *t1, *t2; | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1232 char *nm = g_malloc(256); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1233 if (c->is_chat) |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1234 g_snprintf(nm, 256, "%s.chat", c->name); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1235 else |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1236 g_snprintf(nm, 256, "%s", c->name); |
66 | 1237 |
1238 if (general_options & OPT_GEN_STRIP_HTML) { | |
1239 t1 = strip_html(buf); | |
1240 t2 = strip_html(what); | |
1241 } else { | |
1242 t1 = buf; | |
1243 t2 = what; | |
1244 } | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1245 fd = open_log_file(nm); |
66 | 1246 fprintf(fd, "%s%s\n", t1, t2); |
1247 fclose(fd); | |
1248 if (general_options & OPT_GEN_STRIP_HTML) { | |
1249 g_free(t1); | |
1250 g_free(t2); | |
1251 } | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1252 g_free(nm); |
66 | 1253 } |
1254 } | |
1255 | |
1256 /* if (!GTK_WIDGET_MAPPED(c->window)) { | |
1257 | |
1258 if (dark_icon_pm == NULL) | |
1259 dark_icon_pm = gdk_pixmap_create_from_xpm_d(c->window->window, &dark_icon_bm, | |
1260 NULL, (gchar **)aimicon2_xpm); | |
1261 gdk_window_set_icon(c->window->window, NULL, dark_icon_pm, dark_icon_bm); | |
1262 } | |
1263 */ | |
1264 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1265 if ((c->is_chat && (general_options & OPT_GEN_POPUP_CHAT)) || |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1266 (!c->is_chat && (general_options & OPT_GEN_POPUP_WINDOWS))) |
81 | 1267 gdk_window_show(c->window->window); |
66 | 1268 |
491
dcf5fe44396a
[gaim-migrate @ 501]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
488
diff
changeset
|
1269 gtk_html_thaw(GTK_HTML(c->text)); |
dcf5fe44396a
[gaim-migrate @ 501]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
488
diff
changeset
|
1270 |
337 | 1271 g_free(smiley); |
66 | 1272 g_free(buf); |
1273 } | |
1274 | |
1275 | |
1276 | |
206 | 1277 static void check_spelling( GtkEditable * editable, gchar * new_text, |
1278 gint length, gint * position, | |
1279 gpointer data ) | |
1280 { | |
207 | 1281 if (general_options & OPT_GEN_CHECK_SPELLING) |
1282 { | |
1283 gtk_signal_handler_block_by_func(GTK_OBJECT(editable), | |
1284 GTK_SIGNAL_FUNC(check_spelling), data); | |
1285 gtk_text_set_point(GTK_TEXT(editable), *position); | |
1286 gtk_text_insert(GTK_TEXT(editable), NULL, &(GTK_WIDGET(editable)->style->fg[0]), NULL, new_text, length ); | |
1287 if(isspace(new_text[0])) | |
1288 { | |
1289 gtk_text_freeze(GTK_TEXT(editable)); | |
209 | 1290 spell_checker(GTK_WIDGET(editable)); |
207 | 1291 gtk_text_thaw(GTK_TEXT(editable)); |
1292 } | |
1293 gtk_signal_handler_unblock_by_func(GTK_OBJECT(editable), | |
1294 GTK_SIGNAL_FUNC(check_spelling), data); | |
1295 gtk_signal_emit_stop_by_name(GTK_OBJECT(editable), "insert-text"); | |
1296 } | |
206 | 1297 } |
66 | 1298 |
1299 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1300 GtkWidget *build_conv_toolbar(struct conversation *c) { |
555 | 1301 GdkPixmap *strike_i, *small_i, *normal_i, *big_i, *bold_i, *italic_i, *underline_i, *speaker_i, *wood_i, *palette_i, *link_i, *font_i, *smiley_i; |
1302 GtkWidget *strike_p, *small_p, *normal_p, *big_p, *bold_p, *italic_p, *underline_p, *speaker_p, *wood_p, *palette_p, *link_p, *font_p, *smiley_p; | |
1303 GtkWidget *strike, *small, *normal, *big, *bold, *italic, *underline, *speaker, *wood, *palette, *link, *font, *smiley; | |
66 | 1304 GdkBitmap *mask; |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1305 GtkWidget *toolbar; |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1306 GtkWidget *win; |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1307 GtkWidget *entry; |
66 | 1308 |
1309 toolbar = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_ICONS); | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1310 win = c->window; |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1311 entry = c->entry; |
66 | 1312 |
1313 link_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, | |
1314 &win->style->white, link_xpm ); | |
1315 link_p = gtk_pixmap_new(link_i, mask); | |
1316 gtk_widget_show(link_p); | |
1317 | |
1318 palette_i = gdk_pixmap_create_from_xpm_d (win->window, &mask, | |
1319 &win->style->white, palette_xpm ); | |
1320 palette_p = gtk_pixmap_new(palette_i, mask); | |
1321 gtk_widget_show(palette_p); | |
1322 | |
1323 wood_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, | |
1324 &win->style->white, wood_xpm ); | |
1325 wood_p = gtk_pixmap_new(wood_i, mask); | |
1326 gtk_widget_show(wood_p); | |
1327 speaker_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, | |
1328 &win->style->white, speaker_xpm ); | |
1329 speaker_p = gtk_pixmap_new(speaker_i, mask); | |
1330 gtk_widget_show(speaker_p); | |
1331 c->makesound=1; | |
1332 strike_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, | |
1333 &win->style->white, strike_xpm ); | |
1334 strike_p = gtk_pixmap_new(strike_i, mask); | |
1335 gtk_widget_show(strike_p); | |
1336 bold_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, | |
1337 &win->style->white, bold_xpm ); | |
1338 bold_p = gtk_pixmap_new(bold_i, mask); | |
1339 gtk_widget_show(bold_p); | |
1340 italic_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, | |
1341 &win->style->white, italic_xpm ); | |
1342 italic_p = gtk_pixmap_new(italic_i, mask); | |
1343 gtk_widget_show(italic_p); | |
1344 underline_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, | |
1345 &win->style->white, underline_xpm ); | |
1346 underline_p = gtk_pixmap_new(underline_i, mask); | |
1347 gtk_widget_show(underline_p); | |
1348 small_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, | |
1349 &win->style->white, small_xpm ); | |
1350 small_p = gtk_pixmap_new(small_i, mask); | |
1351 gtk_widget_show(small_p); | |
1352 normal_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, | |
1353 &win->style->white, normal_xpm ); | |
1354 normal_p = gtk_pixmap_new(normal_i, mask); | |
1355 gtk_widget_show(normal_p); | |
1356 big_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, | |
1357 &win->style->white, big_xpm ); | |
1358 big_p = gtk_pixmap_new(big_i, mask); | |
1359 gtk_widget_show(big_p); | |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
1360 font_i = gdk_pixmap_create_from_xpm_d ( win->window, &mask, |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
1361 &win->style->white, fontface_xpm ); |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
1362 font_p = gtk_pixmap_new(font_i, mask); |
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
1363 gtk_widget_show(font_p); |
555 | 1364 smiley_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, &win->style->white, smile_xpm); |
1365 smiley_p = gtk_pixmap_new(smiley_i, mask); | |
1366 gtk_widget_show(smiley_p); | |
66 | 1367 |
1368 bold = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), | |
615 | 1369 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, NULL, |
1370 _("Bold"), _("Bold Text"), _("Bold"), bold_p, | |
1371 GTK_SIGNAL_FUNC(do_bold), entry); | |
66 | 1372 italic = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
615 | 1373 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1374 NULL, _("Italics"), _("Italics Text"), |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1375 _("Italics"), italic_p, GTK_SIGNAL_FUNC(do_italic), entry); |
66 | 1376 underline = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
1377 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1378 NULL, _("Underline"), _("Underline Text"), |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1379 _("Underline"), underline_p, GTK_SIGNAL_FUNC(do_underline), entry); |
66 | 1380 strike = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
1381 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1382 NULL, _("Strike"), _("Strike through Text"), |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1383 _("Strike"), strike_p, GTK_SIGNAL_FUNC(do_strike), entry); |
66 | 1384 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar)); |
615 | 1385 small = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), |
1386 _("Small"), _("Decrease font size"), _("Small"), | |
1387 small_p, GTK_SIGNAL_FUNC(do_small), entry); | |
1388 normal = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), | |
1389 _("Normal"), _("Normal font size"), _("Normal"), | |
1390 normal_p, GTK_SIGNAL_FUNC(do_normal), entry); | |
1391 big = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), | |
1392 _("Big"), _("Increase font size"), _("Big"), | |
1393 big_p, GTK_SIGNAL_FUNC(do_big), entry); | |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1394 font = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1395 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1396 NULL, _("Font"), _("Select Font"), |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1397 _("Font"), font_p, GTK_SIGNAL_FUNC(toggle_font), c); |
66 | 1398 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar)); |
1399 link = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), | |
615 | 1400 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, |
611
0f7e5ff95f71
[gaim-migrate @ 621]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
610
diff
changeset
|
1401 NULL, _("Link"), _("Insert Link"), |
615 | 1402 _("Link"), link_p, GTK_SIGNAL_FUNC(toggle_link), c); |
66 | 1403 palette = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
1404 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1405 NULL, _("Color"), _("Text Color"), |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1406 _("Color"), palette_p, GTK_SIGNAL_FUNC(toggle_color), c); |
66 | 1407 wood = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
1408 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1409 NULL, _("Logging"), _("Enable logging"), |
615 | 1410 _("Logging"), wood_p, GTK_SIGNAL_FUNC(toggle_loggle), c); |
555 | 1411 smiley = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
570 | 1412 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, |
1413 NULL, _("Smiley"), _("Insert smiley face"), _("Smiley"), | |
1414 smiley_p, GTK_SIGNAL_FUNC(insert_smiley), c); | |
66 | 1415 speaker = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
615 | 1416 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1417 NULL, _("Sound"), _("Enable sounds"), |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1418 _("Sound"), speaker_p, GTK_SIGNAL_FUNC(set_option), &c->makesound); |
66 | 1419 c->makesound=0; |
1420 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(speaker), TRUE); | |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
1421 |
615 | 1422 state_lock = 1; |
66 | 1423 if (find_log_info(c->name)) |
1424 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(wood), TRUE); | |
1425 else | |
1426 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(wood), FALSE); | |
615 | 1427 state_lock = 0; |
535
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
523
diff
changeset
|
1428 |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
523
diff
changeset
|
1429 /* use a slicker look if the user wants to */ |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
523
diff
changeset
|
1430 if (display_options & OPT_DISP_COOL_LOOK) |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
523
diff
changeset
|
1431 { |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
523
diff
changeset
|
1432 gtk_button_set_relief(GTK_BUTTON(strike), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
523
diff
changeset
|
1433 gtk_button_set_relief(GTK_BUTTON(normal), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
523
diff
changeset
|
1434 gtk_button_set_relief(GTK_BUTTON(big), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
523
diff
changeset
|
1435 gtk_button_set_relief(GTK_BUTTON(bold), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
523
diff
changeset
|
1436 gtk_button_set_relief(GTK_BUTTON(italic), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
523
diff
changeset
|
1437 gtk_button_set_relief(GTK_BUTTON(underline), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
523
diff
changeset
|
1438 gtk_button_set_relief(GTK_BUTTON(speaker), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
523
diff
changeset
|
1439 gtk_button_set_relief(GTK_BUTTON(wood), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
523
diff
changeset
|
1440 gtk_button_set_relief(GTK_BUTTON(palette), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
523
diff
changeset
|
1441 gtk_button_set_relief(GTK_BUTTON(link), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
523
diff
changeset
|
1442 gtk_button_set_relief(GTK_BUTTON(font), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
523
diff
changeset
|
1443 gtk_button_set_relief(GTK_BUTTON(small), GTK_RELIEF_NONE); |
555 | 1444 gtk_button_set_relief(GTK_BUTTON(smiley), GTK_RELIEF_NONE); |
535
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
523
diff
changeset
|
1445 } |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
523
diff
changeset
|
1446 |
66 | 1447 gtk_widget_show(toolbar); |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
636
diff
changeset
|
1448 |
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
636
diff
changeset
|
1449 gdk_pixmap_unref(link_i); |
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
636
diff
changeset
|
1450 gdk_pixmap_unref(palette_i); |
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
636
diff
changeset
|
1451 gdk_pixmap_unref(wood_i); |
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
636
diff
changeset
|
1452 gdk_pixmap_unref(speaker_i); |
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
636
diff
changeset
|
1453 gdk_pixmap_unref(strike_i); |
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
636
diff
changeset
|
1454 gdk_pixmap_unref(bold_i); |
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
636
diff
changeset
|
1455 gdk_pixmap_unref(italic_i); |
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
636
diff
changeset
|
1456 gdk_pixmap_unref(underline_i); |
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
636
diff
changeset
|
1457 gdk_pixmap_unref(small_i); |
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
636
diff
changeset
|
1458 gdk_pixmap_unref(normal_i); |
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
636
diff
changeset
|
1459 gdk_pixmap_unref(big_i); |
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
636
diff
changeset
|
1460 gdk_pixmap_unref(font_i); |
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
636
diff
changeset
|
1461 gdk_pixmap_unref(smiley_i); |
66 | 1462 |
1463 c->bold = bold; | |
1464 c->strike = strike; | |
615 | 1465 c->italic = italic; |
66 | 1466 c->underline = underline; |
615 | 1467 c->log_button = wood; |
66 | 1468 c->palette = palette; |
1469 c->link = link; | |
608 | 1470 c->wood = wood; |
308
e5fa88351dc8
[gaim-migrate @ 318]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
1471 c->font = font; |
570 | 1472 c->smiley = smiley; |
66 | 1473 |
615 | 1474 gtk_widget_set_sensitive(c->log_button, ((general_options & OPT_GEN_LOG_ALL)) ? FALSE : TRUE); |
66 | 1475 |
1476 gtk_widget_set_sensitive(c->bold, ((font_options & OPT_FONT_BOLD)) ? FALSE : TRUE); | |
1477 gtk_widget_set_sensitive(c->italic, ((font_options & OPT_FONT_ITALIC)) ? FALSE : TRUE); | |
1478 gtk_widget_set_sensitive(c->underline, ((font_options & OPT_FONT_UNDERLINE)) ? FALSE : TRUE); | |
1479 gtk_widget_set_sensitive(c->strike, ((font_options & OPT_FONT_STRIKE)) ? FALSE : TRUE); | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1480 |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1481 return toolbar; |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1482 } |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1483 |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1484 |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1485 void show_conv(struct conversation *c) |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1486 { |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1487 GtkWidget *win; |
615 | 1488 char buf[256]; |
1489 GtkWidget *text; | |
1490 GtkWidget *sw; | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1491 GtkWidget *send; |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1492 GtkWidget *info; |
615 | 1493 GtkWidget *warn; |
1494 GtkWidget *block; | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1495 GtkWidget *close; |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1496 GtkWidget *entry; |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1497 GtkWidget *bbox; |
615 | 1498 GtkWidget *vbox; |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1499 GtkWidget *vbox2; |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1500 GtkWidget *paned; |
615 | 1501 GtkWidget *add; |
623 | 1502 GtkWidget *toolbar; |
1503 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1504 win = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
615 | 1505 gtk_window_set_policy(GTK_WINDOW(win), TRUE, TRUE, TRUE); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1506 |
615 | 1507 gtk_widget_realize(win); |
1508 aol_icon(win->window); | |
66 | 1509 |
615 | 1510 c->window = win; |
623 | 1511 |
1512 | |
1513 send = picture_button2(win, _("Send"), tmp_send_xpm); | |
1514 info = picture_button2(win, _("Info"), tb_search_xpm); | |
1515 warn = picture_button2(win, _("Warn"), warn_xpm); | |
1516 close = picture_button2(win, _("Close"), cancel_xpm); | |
615 | 1517 if (find_buddy(c->name) != NULL) |
623 | 1518 add = picture_button2(win, _("Remove"), gnome_remove_xpm); |
615 | 1519 else |
623 | 1520 add = picture_button2(win, _("Add"), gnome_add_xpm); |
1521 block = picture_button2(win, _("Block"), tmp_send_xpm); | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1522 |
535
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
523
diff
changeset
|
1523 /* use a slicker look if the user wants to */ |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
523
diff
changeset
|
1524 if (display_options & OPT_DISP_COOL_LOOK) |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
523
diff
changeset
|
1525 { |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
523
diff
changeset
|
1526 gtk_button_set_relief(GTK_BUTTON(send), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
523
diff
changeset
|
1527 gtk_button_set_relief(GTK_BUTTON(info), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
523
diff
changeset
|
1528 gtk_button_set_relief(GTK_BUTTON(warn), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
523
diff
changeset
|
1529 gtk_button_set_relief(GTK_BUTTON(close), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
523
diff
changeset
|
1530 gtk_button_set_relief(GTK_BUTTON(add), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
523
diff
changeset
|
1531 gtk_button_set_relief(GTK_BUTTON(block), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
523
diff
changeset
|
1532 } |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
523
diff
changeset
|
1533 |
623 | 1534 bbox = gtk_hbox_new(FALSE, 5); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1535 vbox = gtk_vbox_new(FALSE, 0); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1536 vbox2 = gtk_vbox_new(FALSE, 0); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1537 paned = gtk_vpaned_new(); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1538 |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1539 gtk_paned_pack1(GTK_PANED(paned), vbox, FALSE, TRUE); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1540 gtk_paned_pack2(GTK_PANED(paned), vbox2, FALSE, FALSE); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1541 gtk_widget_show(vbox2); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1542 gtk_widget_show(paned); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1543 |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1544 entry = gtk_text_new(NULL, NULL); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1545 gtk_text_set_editable(GTK_TEXT(entry), TRUE); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1546 gtk_text_set_word_wrap(GTK_TEXT(entry), TRUE); |
66 | 1547 gtk_object_set_user_data(GTK_OBJECT(entry), c); |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1548 c->entry = entry; |
615 | 1549 gtk_signal_connect(GTK_OBJECT(entry), "activate", GTK_SIGNAL_FUNC(send_callback),c); |
1550 c->add_button = add; | |
1551 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1552 /* Toolbar */ |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1553 toolbar = build_conv_toolbar(c); |
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1554 |
615 | 1555 /* Text box */ |
1556 text = gtk_html_new(NULL, NULL); | |
66 | 1557 gtk_html_set_editable(GTK_HTML(text), FALSE); |
623 | 1558 /* |
1559 gtk_html_set_transparent(GTK_HTML(text), (transparent) ? TRUE : FALSE); | |
1560 */ | |
1561 | |
615 | 1562 c->text = text; |
66 | 1563 |
615 | 1564 sw = gtk_scrolled_window_new (NULL, NULL); |
623 | 1565 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), |
1566 GTK_POLICY_NEVER, | |
624 | 1567 GTK_POLICY_ALWAYS); |
615 | 1568 gtk_widget_show(sw); |
1569 gtk_container_add(GTK_CONTAINER(sw), text); | |
1570 gtk_widget_show(text); | |
1571 | |
1572 GTK_HTML (text)->hadj->step_increment = 10.0; | |
1573 GTK_HTML (text)->vadj->step_increment = 10.0; | |
1574 gtk_widget_set_usize(sw, 320, 150); | |
66 | 1575 |
1576 /* Ready and pack buttons */ | |
1577 gtk_object_set_user_data(GTK_OBJECT(win), c); | |
1578 gtk_object_set_user_data(GTK_OBJECT(close), c); | |
1579 gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(close_callback), c); | |
1580 gtk_signal_connect(GTK_OBJECT(send), "clicked", GTK_SIGNAL_FUNC(send_callback), c); | |
1581 gtk_signal_connect(GTK_OBJECT(add), "clicked", GTK_SIGNAL_FUNC(add_callback), c); | |
615 | 1582 gtk_signal_connect(GTK_OBJECT(info), "clicked", GTK_SIGNAL_FUNC(info_callback), c); |
1583 gtk_signal_connect(GTK_OBJECT(warn), "clicked", GTK_SIGNAL_FUNC(warn_callback), c); | |
1584 gtk_signal_connect(GTK_OBJECT(block), "clicked", GTK_SIGNAL_FUNC(block_callback), c); | |
66 | 1585 |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
1586 gtk_signal_connect(GTK_OBJECT(entry), "key_press_event", GTK_SIGNAL_FUNC(keypress_callback), c); |
81 | 1587 gtk_widget_set_usize(entry, 300, 25); |
66 | 1588 |
623 | 1589 gtk_box_pack_end(GTK_BOX(bbox), close, FALSE, FALSE, 0); |
1590 gtk_box_pack_end(GTK_BOX(bbox), add, FALSE, FALSE, 0); | |
1591 gtk_box_pack_end(GTK_BOX(bbox), block, FALSE, FALSE, 0); | |
1592 gtk_box_pack_end(GTK_BOX(bbox), warn, FALSE, FALSE, 0); | |
1593 gtk_box_pack_end(GTK_BOX(bbox), info, FALSE, FALSE, 0); | |
1594 gtk_box_pack_end(GTK_BOX(bbox), send, FALSE, FALSE, 0); | |
66 | 1595 |
1596 /* pack and fill the rest */ | |
1597 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 5); | |
615 | 1598 gtk_box_pack_start(GTK_BOX(vbox2), toolbar, FALSE, FALSE, 5); |
81 | 1599 gtk_box_pack_start(GTK_BOX(vbox2), entry, TRUE, TRUE, 5); |
1600 gtk_box_pack_start(GTK_BOX(vbox2), bbox, FALSE, FALSE, 5); | |
66 | 1601 |
1602 gtk_widget_show(send); | |
1603 gtk_widget_show(info); | |
1604 gtk_widget_show(warn); | |
1605 gtk_widget_show(close); | |
615 | 1606 gtk_widget_show(add); |
1607 gtk_widget_show(block); | |
66 | 1608 gtk_widget_show(bbox); |
1609 gtk_widget_show(vbox); | |
1610 gtk_widget_show(entry); | |
1611 gtk_widget_show(text); | |
311
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1612 |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1613 c->font_dialog = NULL; |
0a8b4edc4732
[gaim-migrate @ 321]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
309
diff
changeset
|
1614 c->color_dialog = NULL; |
570 | 1615 c->smiley_dialog = NULL; |
608 | 1616 c->link_dialog = NULL; |
1617 c->log_dialog = NULL; | |
67 | 1618 |
81 | 1619 gtk_container_add(GTK_CONTAINER(win), paned); |
66 | 1620 gtk_container_border_width(GTK_CONTAINER(win), 10); |
1621 | |
1622 if ((find_log_info(c->name)) || ((general_options & OPT_GEN_LOG_ALL))) | |
1623 g_snprintf(buf, sizeof(buf), LOG_CONVERSATION_TITLE, c->name); | |
1624 else | |
1625 g_snprintf(buf, sizeof(buf), CONVERSATION_TITLE, c->name); | |
1626 gtk_window_set_title(GTK_WINDOW(win), buf); | |
1627 gtk_window_set_focus(GTK_WINDOW(win),entry); | |
1628 | |
1629 gtk_signal_connect(GTK_OBJECT(win), "delete_event", GTK_SIGNAL_FUNC(delete_event_convo), c); | |
206 | 1630 gtk_signal_connect(GTK_OBJECT(entry), "insert-text", GTK_SIGNAL_FUNC(check_spelling), entry); |
66 | 1631 gtk_signal_connect(GTK_OBJECT(entry), "key_press_event", GTK_SIGNAL_FUNC(entry_key_pressed), entry); |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
1632 |
315
68637b451377
[gaim-migrate @ 325]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
1633 if (fontface) |
68637b451377
[gaim-migrate @ 325]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
1634 strncpy(c->current_fontface, fontface, sizeof(c->current_fontface)); |
68637b451377
[gaim-migrate @ 325]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
1635 if (fontname) |
68637b451377
[gaim-migrate @ 325]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
311
diff
changeset
|
1636 strncpy(c->current_fontname, fontname, sizeof(c->current_fontname)); |
234
985635758c33
[gaim-migrate @ 244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
230
diff
changeset
|
1637 |
66 | 1638 gtk_widget_show(win); |
1639 } | |
1640 | |
1641 |