Mercurial > pidgin
comparison src/gtkconv.c @ 12216:4d3119205a33
[gaim-migrate @ 14518]
Remove GaimConvImFlags and GaimConvChatFlags - use GaimMessageFlags
everywhere instead.
Add a new GAIM_MESSAGE_IMAGES flag, and set it when sending a message
containing images.
When sending a message, the core will now always send "html" to the prpls,
just like it expects to receive html from the prpls for received messages.
This will allow text prpls such as SILC to support IM images and differentiate
them from user input. Previously gaim_unescape_html() was used before passing
the message to the prpl, now the prpl does this itself if it needs it.
I think I updated all the prpls correctly, but I'm not so sure about sametime.
committer: Tailor Script <tailor@pidgin.im>
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Thu, 24 Nov 2005 20:47:46 +0000 |
parents | bc2b9f925979 |
children | 375f1f3817a8 |
comparison
equal
deleted
inserted
replaced
12215:31b91bfab029 | 12216:4d3119205a33 |
---|---|
488 send_cb(GtkWidget *widget, GaimGtkConversation *gtkconv) | 488 send_cb(GtkWidget *widget, GaimGtkConversation *gtkconv) |
489 { | 489 { |
490 GaimConversation *conv = gtkconv->active_conv; | 490 GaimConversation *conv = gtkconv->active_conv; |
491 GaimAccount *account; | 491 GaimAccount *account; |
492 GaimConnection *gc; | 492 GaimConnection *gc; |
493 GaimMessageFlags flags = 0; | |
493 char *buf, *clean; | 494 char *buf, *clean; |
494 | 495 |
495 account = gaim_conversation_get_account(conv); | 496 account = gaim_conversation_get_account(conv); |
496 | 497 |
497 if (!gaim_account_is_connected(account)) | 498 if (!gaim_account_is_connected(account)) |
513 | 514 |
514 if (strlen(clean) == 0) { | 515 if (strlen(clean) == 0) { |
515 g_free(clean); | 516 g_free(clean); |
516 return; | 517 return; |
517 } | 518 } |
519 | |
520 /* XXX: is there a better way to tell if the message has images? */ | |
521 if (GTK_IMHTML(gtkconv->entry)->im_images != NULL) | |
522 flags |= GAIM_MESSAGE_IMAGES; | |
518 | 523 |
519 gc = gaim_account_get_connection(account); | 524 gc = gaim_account_get_connection(account); |
520 if (gc && (conv->features & GAIM_CONNECTION_NO_NEWLINES)) { | 525 if (gc && (conv->features & GAIM_CONNECTION_NO_NEWLINES)) { |
521 char **bufs; | 526 char **bufs; |
522 int i; | 527 int i; |
523 | 528 |
524 bufs = gtk_imhtml_get_markup_lines(GTK_IMHTML(gtkconv->entry)); | 529 bufs = gtk_imhtml_get_markup_lines(GTK_IMHTML(gtkconv->entry)); |
525 for (i = 0; bufs[i]; i++) { | 530 for (i = 0; bufs[i]; i++) { |
526 send_history_add(conv, bufs[i]); | 531 send_history_add(conv, bufs[i]); |
527 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) | 532 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) |
528 gaim_conv_im_send(GAIM_CONV_IM(conv), bufs[i]); | 533 gaim_conv_im_send_with_flags(GAIM_CONV_IM(conv), bufs[i], flags); |
529 else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) | 534 else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) |
530 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), bufs[i]); | 535 gaim_conv_chat_send_with_flags(GAIM_CONV_CHAT(conv), bufs[i], flags); |
531 } | 536 } |
532 | 537 |
533 g_strfreev(bufs); | 538 g_strfreev(bufs); |
534 | 539 |
535 } else { | 540 } else { |
536 send_history_add(conv, buf); | 541 send_history_add(conv, buf); |
537 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) | 542 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) |
538 gaim_conv_im_send(GAIM_CONV_IM(conv), buf); | 543 gaim_conv_im_send_with_flags(GAIM_CONV_IM(conv), buf, flags); |
539 else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) | 544 else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) |
540 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), buf); | 545 gaim_conv_chat_send_with_flags(GAIM_CONV_CHAT(conv), buf, flags); |
541 } | 546 } |
542 | 547 |
543 g_free(clean); | 548 g_free(clean); |
544 g_free(buf); | 549 g_free(buf); |
545 | 550 |
4971 /* Account is online */ | 4976 /* Account is online */ |
4972 /* Deal with the toolbar */ | 4977 /* Deal with the toolbar */ |
4973 if (conv->features & GAIM_CONNECTION_HTML) | 4978 if (conv->features & GAIM_CONNECTION_HTML) |
4974 { | 4979 { |
4975 buttons = GTK_IMHTML_ALL; /* Everything on */ | 4980 buttons = GTK_IMHTML_ALL; /* Everything on */ |
4976 if (!(prpl_info->options & OPT_PROTO_IM_IMAGE) || | |
4977 conv->features & GAIM_CONNECTION_NO_IMAGES) | |
4978 buttons &= ~GTK_IMHTML_IMAGE; | |
4979 if (conv->features & GAIM_CONNECTION_NO_BGCOLOR) | 4981 if (conv->features & GAIM_CONNECTION_NO_BGCOLOR) |
4980 buttons &= ~GTK_IMHTML_BACKCOLOR; | 4982 buttons &= ~GTK_IMHTML_BACKCOLOR; |
4981 if (conv->features & GAIM_CONNECTION_NO_FONTSIZE) | 4983 if (conv->features & GAIM_CONNECTION_NO_FONTSIZE) |
4982 { | 4984 { |
4983 buttons &= ~GTK_IMHTML_GROW; | 4985 buttons &= ~GTK_IMHTML_GROW; |
4984 buttons &= ~GTK_IMHTML_SHRINK; | 4986 buttons &= ~GTK_IMHTML_SHRINK; |
4985 } | 4987 } |
4986 if (conv->features & GAIM_CONNECTION_NO_URLDESC) | 4988 if (conv->features & GAIM_CONNECTION_NO_URLDESC) |
4987 buttons &= ~GTK_IMHTML_LINKDESC; | 4989 buttons &= ~GTK_IMHTML_LINKDESC; |
4988 } else { | 4990 } else { |
4989 buttons = GTK_IMHTML_SMILEY; | 4991 buttons = GTK_IMHTML_SMILEY | GTK_IMHTML_IMAGE; |
4990 } | 4992 } |
4993 | |
4994 if (!(prpl_info->options & OPT_PROTO_IM_IMAGE) || | |
4995 conv->features & GAIM_CONNECTION_NO_IMAGES) | |
4996 buttons &= ~GTK_IMHTML_IMAGE; | |
4997 | |
4991 gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->entry), buttons); | 4998 gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->entry), buttons); |
4992 gtk_imhtmltoolbar_associate_smileys(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), gaim_account_get_protocol_id(account)); | 4999 gtk_imhtmltoolbar_associate_smileys(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), gaim_account_get_protocol_id(account)); |
4993 | 5000 |
4994 /* Deal with menu items */ | 5001 /* Deal with menu items */ |
4995 gtk_widget_set_sensitive(win->menu.view_log, TRUE); | 5002 gtk_widget_set_sensitive(win->menu.view_log, TRUE); |