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