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