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