comparison src/gtkconv.c @ 4895:9e50494f63a1

[gaim-migrate @ 5227] IM image support. javabsp did most of the hard work, I just cleaned it up and fixed the bugs ;-) committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Wed, 26 Mar 2003 06:19:44 +0000
parents dc6de8ad81ae
children 3c649fe22e2c
comparison
equal deleted inserted replaced
4894:eea963dcd1ed 4895:9e50494f63a1
213 g_signal_connect_swapped( 213 g_signal_connect_swapped(
214 G_OBJECT(GTK_FILE_SELECTION(window)->cancel_button), 214 G_OBJECT(GTK_FILE_SELECTION(window)->cancel_button),
215 "clicked", G_CALLBACK(gtk_widget_destroy), window); 215 "clicked", G_CALLBACK(gtk_widget_destroy), window);
216 216
217 gtk_widget_show(window); 217 gtk_widget_show(window);
218 218 /*
219 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.image), 219 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.image),
220 FALSE); 220 FALSE);
221 */
221 } 222 }
222 223
223 static void 224 static void
224 insert_link_cb(GtkWidget *w, struct gaim_conversation *conv) 225 insert_link_cb(GtkWidget *w, struct gaim_conversation *conv)
225 { 226 {
3869 char mdate[64]; 3870 char mdate[64];
3870 char color[10]; 3871 char color[10];
3871 char *str; 3872 char *str;
3872 char *with_font_tag; 3873 char *with_font_tag;
3873 3874
3875
3876 if(length == -1)
3877 length = strlen(message) + 1;
3878
3874 gtkconv = GAIM_GTK_CONVERSATION(conv); 3879 gtkconv = GAIM_GTK_CONVERSATION(conv);
3875 gc = gaim_conversation_get_gc(conv); 3880 gc = gaim_conversation_get_gc(conv);
3876 3881
3877 strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime)); 3882 strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime));
3878 3883
3954 message); 3959 message);
3955 3960
3956 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf, -1, 0); 3961 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf, -1, 0);
3957 } 3962 }
3958 else { 3963 else {
3959 char *new_message = g_strdup(message); 3964 char *new_message = g_memdup(message, length);
3960 3965
3961 if (flags & WFLAG_WHISPER) { 3966 if (flags & WFLAG_WHISPER) {
3962 str = g_malloc(1024); 3967 str = g_malloc(1024);
3963 3968
3964 /* If we're whispering, it's not an autoresponse. */ 3969 /* If we're whispering, it's not an autoresponse. */
3965 if (meify(new_message, length)) { 3970 if (meify(new_message, length)) {
4030 4035
4031 g_free(str); 4036 g_free(str);
4032 4037
4033 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, -1, 0); 4038 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, -1, 0);
4034 4039
4035 if(gc) 4040 if(gc){
4036 with_font_tag = g_strdup_printf("<font sml=\"%s\">%s</font>", 4041 char *pre = g_strdup_printf("<font sml=\"%s\">", gc->prpl->name);
4037 gc->prpl->name, new_message); 4042 char *post = "</font>";
4043 int pre_len = strlen(pre);
4044 int post_len = strlen(post);
4045
4046 with_font_tag = g_malloc(length + pre_len + post_len + 1);
4047
4048 strcpy(with_font_tag, pre);
4049 memcpy(with_font_tag + pre_len, new_message, length);
4050 strcpy(with_font_tag + pre_len + length, post);
4051
4052 length += pre_len + post_len;
4053 g_free(pre);
4054 }
4038 else 4055 else
4039 with_font_tag = g_strdup(new_message); 4056 with_font_tag = g_memdup(new_message, length);
4040 4057
4041 log_str = gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), 4058 log_str = gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml),
4042 with_font_tag, length, 4059 with_font_tag, length, gtk_font_options);
4043 gtk_font_options);
4044 4060
4045 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", -1, 0); 4061 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", -1, 0);
4046 4062
4047 /* XXX This needs to be updated for the new length argument. */ 4063 /* XXX This needs to be updated for the new length argument. */
4048 if (logging_options & OPT_LOG_STRIP_HTML) { 4064 if (logging_options & OPT_LOG_STRIP_HTML) {