Mercurial > pidgin
comparison src/conversation.c @ 3044:e68e2ba82310
[gaim-migrate @ 3057]
DirectIM Image sending. Not all the kinks are worked out, and it's really hackish at parts, but it works and I think it's stable.
It's late and I have to be up early tommorow, and I want this to be somewhat tested before 0.54 is released so we don't have a repeat of 0.53 ;)
Also, Luke Schierer wins the #gaim MVP award with an inclusion in CREDITS :) Thanks, Luke.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Thu, 14 Mar 2002 07:44:43 +0000 |
parents | 0f1766887ddd |
children | e729c064bc1b |
comparison
equal
deleted
inserted
replaced
3043:5a459387755a | 3044:e68e2ba82310 |
---|---|
51 #include "pixmaps/link.xpm" | 51 #include "pixmaps/link.xpm" |
52 #include "pixmaps/smile_icon.xpm" | 52 #include "pixmaps/smile_icon.xpm" |
53 #include "pixmaps/wood.xpm" | 53 #include "pixmaps/wood.xpm" |
54 #include "pixmaps/save_small.xpm" | 54 #include "pixmaps/save_small.xpm" |
55 #include "pixmaps/speaker.xpm" | 55 #include "pixmaps/speaker.xpm" |
56 #include "pixmaps/image_icon.xpm" | |
56 | 57 |
57 #include "pixmaps/luke03.xpm" | 58 #include "pixmaps/luke03.xpm" |
58 #include "pixmaps/oneeye.xpm" | 59 #include "pixmaps/oneeye.xpm" |
59 #include "pixmaps/crazy4.xpm" | 60 #include "pixmaps/crazy4.xpm" |
60 #include "pixmaps/mrt.xpm" | 61 #include "pixmaps/mrt.xpm" |
403 "clicked", GTK_SIGNAL_FUNC(do_save_convo), window); | 404 "clicked", GTK_SIGNAL_FUNC(do_save_convo), window); |
404 gtk_signal_connect_object(GTK_OBJECT(GTK_FILE_SELECTION(window)->cancel_button), | 405 gtk_signal_connect_object(GTK_OBJECT(GTK_FILE_SELECTION(window)->cancel_button), |
405 "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), (gpointer)window); | 406 "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), (gpointer)window); |
406 gtk_widget_show(window); | 407 gtk_widget_show(window); |
407 } | 408 } |
409 | |
410 static void do_insert_image(GtkObject *obj, GtkWidget *wid) | |
411 { | |
412 struct conversation *c = gtk_object_get_user_data(obj); | |
413 char *name = gtk_file_selection_get_filename(GTK_FILE_SELECTION(wid)); | |
414 char *filename; | |
415 int pos; | |
416 char buf[512]; | |
417 struct stat st; | |
418 int id = g_slist_length(c->images) + 1; | |
419 | |
420 if (file_is_dir(name, wid)) | |
421 return; | |
422 if ((!c->is_chat && g_list_find(conversations, c))) | |
423 name = g_strdup(name); | |
424 else | |
425 name = NULL; | |
426 gtk_widget_destroy(wid); | |
427 if (!name) | |
428 return; | |
429 | |
430 if (stat(name, &st) != 0) { | |
431 debug_printf("Could not stat %s\n", name); | |
432 return; | |
433 } | |
434 | |
435 filename = name; | |
436 while (strchr(filename, '/')) | |
437 filename = strchr(filename, '/') + 1; | |
438 | |
439 g_snprintf(buf, sizeof(buf), | |
440 "<IMG SRC=\"file://%s\" ID=\"%d\" DATASIZE=\"%d\">", | |
441 filename, id, (int)st.st_size); | |
442 | |
443 c->images = g_slist_append(c->images, g_strdup(name)); | |
444 | |
445 if (GTK_OLD_EDITABLE(c->entry)->has_selection) { | |
446 int finish = GTK_OLD_EDITABLE(c->entry)->selection_end_pos; | |
447 gtk_editable_insert_text(GTK_EDITABLE(c->entry), | |
448 buf, strlen(buf), &finish); | |
449 } else { | |
450 pos = GTK_OLD_EDITABLE(c->entry)->current_pos; | |
451 gtk_editable_insert_text(GTK_EDITABLE(c->entry), | |
452 buf, strlen(buf), &pos); | |
453 } | |
454 g_free(name); | |
455 } | |
456 | |
457 void insert_image(GtkWidget *save, struct conversation *c) | |
458 { | |
459 char buf[BUF_LONG]; | |
460 GtkWidget *window = gtk_file_selection_new(_("Gaim - Insert Image")); | |
461 g_snprintf(buf, sizeof(buf), "%s/", g_get_home_dir()); | |
462 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); | |
463 gtk_object_set_user_data(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), c); | |
464 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), | |
465 "clicked", GTK_SIGNAL_FUNC(do_insert_image), window); | |
466 gtk_signal_connect_object(GTK_OBJECT(GTK_FILE_SELECTION(window)->cancel_button), | |
467 "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), (gpointer)window); | |
468 gtk_widget_show(window); | |
469 } | |
470 | |
408 | 471 |
409 void insert_smiley(GtkWidget *smiley, struct conversation *c) | 472 void insert_smiley(GtkWidget *smiley, struct conversation *c) |
410 { | 473 { |
411 if (state_lock) | 474 if (state_lock) |
412 return; | 475 return; |
929 | 992 |
930 | 993 |
931 void send_callback(GtkWidget *widget, struct conversation *c) | 994 void send_callback(GtkWidget *widget, struct conversation *c) |
932 { | 995 { |
933 char *buf, *buf2; | 996 char *buf, *buf2; |
934 int limit, length=0; | 997 int limit; |
998 gulong length=0; | |
935 int err = 0; | 999 int err = 0; |
936 | 1000 |
937 if (!c->gc) | 1001 if (!c->gc) |
938 return; | 1002 return; |
939 | 1003 |
1043 char *bigbuf; | 1107 char *bigbuf; |
1044 GSList *tmplist = c->images; | 1108 GSList *tmplist = c->images; |
1045 id = 1; | 1109 id = 1; |
1046 length = strlen(buffy) + strlen("<BINARY></BINARY>"); | 1110 length = strlen(buffy) + strlen("<BINARY></BINARY>"); |
1047 bigbuf = g_malloc(length); | 1111 bigbuf = g_malloc(length); |
1048 g_snprintf(bigbuf, strlen(buffy)+strlen("<BINARY> "), "%s<BINARY>", buffy); | 1112 g_snprintf(bigbuf, strlen(buffy)+strlen("<BINARY> ") + 1, "%s<BINARY>", buffy); |
1049 offset = strlen(buffy) + strlen("<BINARY>"); | 1113 offset = strlen(buffy) + strlen("<BINARY>"); |
1050 while (tmplist) { | 1114 while (tmplist) { |
1051 FILE *imgfile; | 1115 FILE *imgfile; |
1052 struct stat st; | 1116 char *filename; |
1117 struct stat st; | |
1053 char imgtag[1024]; | 1118 char imgtag[1024]; |
1054 if (stat(tmplist->data, &st) != 0) { | 1119 if (stat(tmplist->data, &st) != 0) { |
1055 debug_printf("Could not stat %s\n", tmplist->data); | 1120 debug_printf("Could not stat %s\n", tmplist->data); |
1056 break; | 1121 break; |
1057 } | 1122 } |
1123 | |
1124 /* Here we check to make sure the user still wants to send the | |
1125 * image. He may have deleted the <img> tag in which case we | |
1126 * don't want to send the binary data. */ | |
1127 filename = tmplist->data; | |
1128 while (strchr(filename, '/')) | |
1129 filename = strchr(filename, '/') + 1; | |
1130 g_snprintf(imgtag, sizeof(imgtag), | |
1131 "<IMG SRC=\"file://%s\" ID=\"%d\" DATASIZE=\"%d\">", | |
1132 filename, id, (int)st.st_size); | |
1133 if (!strstr(buffy, imgtag)) { | |
1134 tmplist = tmplist->next; | |
1135 continue; | |
1136 } | |
1058 g_snprintf(imgtag, sizeof(imgtag), | 1137 g_snprintf(imgtag, sizeof(imgtag), |
1059 "<DATA ID=\"%d\" SIZE=\"%d\">", | 1138 "<DATA ID=\"%d\" SIZE=\"%d\">", |
1060 id, st.st_size); | 1139 id, (int)st.st_size); |
1061 length = length + strlen(imgtag) + st.st_size; | 1140 |
1062 bigbuf = realloc(bigbuf, length); | 1141 length = length + strlen(imgtag) + st.st_size + strlen("</DATA>");; |
1063 if (!(imgfile = fopen(c->images->data, "r"))) { | 1142 bigbuf = g_realloc(bigbuf, length); |
1143 if (!(imgfile = fopen(tmplist->data, "r"))) { | |
1064 debug_printf("Could not open %s\n", tmplist->data); | 1144 debug_printf("Could not open %s\n", tmplist->data); |
1065 break; | 1145 continue; |
1066 } | 1146 } |
1067 g_snprintf(bigbuf + offset, strlen(imgtag) + 1, "%s", imgtag); | 1147 g_snprintf(bigbuf + offset, strlen(imgtag) + 1, "%s", imgtag); |
1068 offset = offset + strlen(imgtag); | 1148 offset = offset + strlen(imgtag); |
1069 fread(bigbuf + offset, 1, st.st_size, imgfile); | 1149 offset = offset + fread(bigbuf + offset, 1, st.st_size, imgfile); |
1070 offset = offset + st.st_size; | 1150 fclose(imgfile); |
1071 g_snprintf(bigbuf + offset, strlen("</DATA>"), "</DATA>"); | 1151 g_snprintf(bigbuf + offset, strlen("</DATA>") + 1, "</DATA>"); |
1072 offset= offset + strlen("</DATA>"); | 1152 offset= offset + strlen("</DATA>"); |
1073 id++; | 1153 id++; |
1074 tmplist = tmplist->next; | 1154 tmplist = tmplist->next; |
1075 } | 1155 } |
1076 | 1156 |
1077 g_snprintf(bigbuf + offset, strlen("</BINARY>"), "</BINARY>"); | 1157 g_snprintf(bigbuf + offset, strlen("</BINARY>") + 1, "</BINARY>"); |
1078 if (serv_send_im(c->gc, c->name, bigbuf, length, imflags) > 0) { | 1158 err =serv_send_im(c->gc, c->name, bigbuf, length, imflags); |
1159 if (err > 0) { | |
1160 GSList *tempy = c->images; | |
1161 while (tempy) { | |
1162 g_free(tempy->data); | |
1163 tempy = tempy->next; | |
1164 } | |
1165 g_slist_free(tempy); | |
1166 c->images = NULL; | |
1079 write_to_conv(c, bigbuf, WFLAG_SEND, NULL, time(NULL), length); | 1167 write_to_conv(c, bigbuf, WFLAG_SEND, NULL, time(NULL), length); |
1080 if (c->makesound && (sound_options & OPT_SOUND_SEND)) | 1168 if (c->makesound && (sound_options & OPT_SOUND_SEND)) |
1081 play_sound(SEND); | 1169 play_sound(SEND); |
1082 if (im_options & OPT_IM_POPDOWN) | 1170 if (im_options & OPT_IM_POPDOWN) |
1083 gtk_widget_hide(c->window); | 1171 gtk_widget_hide(c->window); |
1084 | 1172 |
1173 | |
1085 } | 1174 } |
1086 g_free(bigbuf); | 1175 g_free(bigbuf); |
1087 } else { | 1176 } else { |
1088 if (serv_send_im(c->gc, c->name, buffy, -1, imflags) > 0) | 1177 err =serv_send_im(c->gc, c->name, buffy, -1, imflags); |
1178 if (err > 0) { | |
1089 write_to_conv(c, buf, WFLAG_SEND, NULL, time(NULL), -1); | 1179 write_to_conv(c, buf, WFLAG_SEND, NULL, time(NULL), -1); |
1090 if (c->makesound && (sound_options & OPT_SOUND_SEND)) | 1180 if (c->makesound && (sound_options & OPT_SOUND_SEND)) |
1091 play_sound(SEND); | 1181 play_sound(SEND); |
1092 if (im_options & OPT_IM_POPDOWN) | 1182 if (im_options & OPT_IM_POPDOWN) |
1093 gtk_widget_hide(c->window); | 1183 gtk_widget_hide(c->window); |
1184 } | |
1094 } | 1185 } |
1095 g_free(buffy); | 1186 g_free(buffy); |
1096 } | 1187 } |
1097 | 1188 |
1098 } else { | 1189 } else { |
1105 g_free(buf); | 1196 g_free(buf); |
1106 | 1197 |
1107 if (err < 0) { | 1198 if (err < 0) { |
1108 if (err == -E2BIG) | 1199 if (err == -E2BIG) |
1109 do_error_dialog(_("Unable to send message: too large"), _("Message Error")); | 1200 do_error_dialog(_("Unable to send message: too large"), _("Message Error")); |
1201 else if (err == -ENOTCONN) | |
1202 debug_printf("Not yet connected\n"); | |
1110 else | 1203 else |
1111 do_error_dialog(_("Unable to send message: Unknown reason"), _("Message Error")); | 1204 do_error_dialog(_("Unable to send message: Unknown reason"), _("Message Error")); |
1112 } else { | 1205 } else { |
1113 gtk_editable_delete_text(GTK_EDITABLE(c->entry), 0, -1); | 1206 gtk_editable_delete_text(GTK_EDITABLE(c->entry), 0, -1); |
1114 | 1207 |
1811 gtk_style_unref(style); | 1904 gtk_style_unref(style); |
1812 } | 1905 } |
1813 } | 1906 } |
1814 | 1907 |
1815 void update_progress(struct conversation *c, float percent) { | 1908 void update_progress(struct conversation *c, float percent) { |
1816 while (gtk_events_pending()) | 1909 |
1817 gtk_main_iteration(); | |
1818 | |
1819 if (percent >= 1 && !(c->progress)) | 1910 if (percent >= 1 && !(c->progress)) |
1820 return; | 1911 return; |
1821 | 1912 |
1822 if (percent >= 1) { | 1913 if (percent >= 1) { |
1823 gtk_widget_destroy(c->progress); | 1914 gtk_widget_destroy(c->progress); |
1838 } | 1929 } |
1839 | 1930 |
1840 GtkWidget *build_conv_toolbar(struct conversation *c) | 1931 GtkWidget *build_conv_toolbar(struct conversation *c) |
1841 { | 1932 { |
1842 GdkPixmap *strike_i, *small_i, *normal_i, *big_i, *bold_i, *italic_i, *underline_i, *speaker_i, | 1933 GdkPixmap *strike_i, *small_i, *normal_i, *big_i, *bold_i, *italic_i, *underline_i, *speaker_i, |
1843 *wood_i, *fgcolor_i, *bgcolor_i, *link_i, *font_i, *smiley_i, *save_i; | 1934 *wood_i, *fgcolor_i, *bgcolor_i, *link_i, *font_i, *smiley_i, *save_i, *image_i; |
1844 GtkWidget *strike_p, *small_p, *normal_p, *big_p, *bold_p, *italic_p, *underline_p, *speaker_p, | 1935 GtkWidget *strike_p, *small_p, *normal_p, *big_p, *bold_p, *italic_p, *underline_p, *speaker_p, |
1845 *wood_p, *fgcolor_p, *bgcolor_p, *link_p, *font_p, *smiley_p, *save_p; | 1936 *wood_p, *fgcolor_p, *bgcolor_p, *link_p, *font_p, *smiley_p, *save_p, *image_p; |
1846 GtkWidget *strike, *small, *normal, *big, *bold, *italic, *underline, *speaker, *wood, | 1937 GtkWidget *strike, *small, *normal, *big, *bold, *italic, *underline, *speaker, *wood, |
1847 *fgcolorbtn, *bgcolorbtn, *link, *font, *smiley, *save; | 1938 *fgcolorbtn, *bgcolorbtn, *link, *font, *smiley, *save, *image; |
1848 GdkBitmap *mask; | 1939 GdkBitmap *mask; |
1849 GtkWidget *toolbar; | 1940 GtkWidget *toolbar; |
1850 GtkWidget *win; | 1941 GtkWidget *win; |
1851 GtkWidget *entry; | 1942 GtkWidget *entry; |
1852 | 1943 |
1911 gdk_bitmap_unref(mask); | 2002 gdk_bitmap_unref(mask); |
1912 | 2003 |
1913 smiley_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, &win->style->white, smile_icon_xpm); | 2004 smiley_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, &win->style->white, smile_icon_xpm); |
1914 smiley_p = gtk_pixmap_new(smiley_i, mask); | 2005 smiley_p = gtk_pixmap_new(smiley_i, mask); |
1915 gtk_widget_show(smiley_p); | 2006 gtk_widget_show(smiley_p); |
2007 gdk_bitmap_unref(mask); | |
2008 | |
2009 image_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, &win->style->white, image_icon_xpm); | |
2010 image_p = gtk_pixmap_new(image_i, mask); | |
2011 gtk_widget_show(image_p); | |
1916 gdk_bitmap_unref(mask); | 2012 gdk_bitmap_unref(mask); |
1917 | 2013 |
1918 wood_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, &win->style->white, wood_xpm); | 2014 wood_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, &win->style->white, wood_xpm); |
1919 wood_p = gtk_pixmap_new(wood_i, mask); | 2015 wood_p = gtk_pixmap_new(wood_i, mask); |
1920 gtk_widget_show(wood_p); | 2016 gtk_widget_show(wood_p); |
1985 _("Link"), link_p, GTK_SIGNAL_FUNC(toggle_link), c); | 2081 _("Link"), link_p, GTK_SIGNAL_FUNC(toggle_link), c); |
1986 smiley = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), | 2082 smiley = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
1987 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, | 2083 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, |
1988 NULL, NULL, _("Insert smiley face"), _("Smiley"), | 2084 NULL, NULL, _("Insert smiley face"), _("Smiley"), |
1989 smiley_p, GTK_SIGNAL_FUNC(insert_smiley), c); | 2085 smiley_p, GTK_SIGNAL_FUNC(insert_smiley), c); |
1990 | 2086 image = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), |
2087 NULL, _("Insert IM Image"), _("Image"), | |
2088 image_p, GTK_SIGNAL_FUNC(insert_image), c); | |
2089 | |
1991 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar)); | 2090 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar)); |
1992 | 2091 |
1993 wood = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), | 2092 wood = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
1994 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, | 2093 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, |
1995 NULL, NULL, _("Enable logging"), | 2094 NULL, NULL, _("Enable logging"), |
2025 gtk_button_set_relief(GTK_BUTTON(font), GTK_RELIEF_NONE); | 2124 gtk_button_set_relief(GTK_BUTTON(font), GTK_RELIEF_NONE); |
2026 gtk_button_set_relief(GTK_BUTTON(fgcolorbtn), GTK_RELIEF_NONE); | 2125 gtk_button_set_relief(GTK_BUTTON(fgcolorbtn), GTK_RELIEF_NONE); |
2027 gtk_button_set_relief(GTK_BUTTON(bgcolorbtn), GTK_RELIEF_NONE); | 2126 gtk_button_set_relief(GTK_BUTTON(bgcolorbtn), GTK_RELIEF_NONE); |
2028 gtk_button_set_relief(GTK_BUTTON(link), GTK_RELIEF_NONE); | 2127 gtk_button_set_relief(GTK_BUTTON(link), GTK_RELIEF_NONE); |
2029 gtk_button_set_relief(GTK_BUTTON(smiley), GTK_RELIEF_NONE); | 2128 gtk_button_set_relief(GTK_BUTTON(smiley), GTK_RELIEF_NONE); |
2129 gtk_button_set_relief(GTK_BUTTON(image), GTK_RELIEF_NONE); | |
2030 gtk_button_set_relief(GTK_BUTTON(wood), GTK_RELIEF_NONE); | 2130 gtk_button_set_relief(GTK_BUTTON(wood), GTK_RELIEF_NONE); |
2031 gtk_button_set_relief(GTK_BUTTON(save), GTK_RELIEF_NONE); | 2131 gtk_button_set_relief(GTK_BUTTON(save), GTK_RELIEF_NONE); |
2032 gtk_button_set_relief(GTK_BUTTON(speaker), GTK_RELIEF_NONE); | 2132 gtk_button_set_relief(GTK_BUTTON(speaker), GTK_RELIEF_NONE); |
2033 } | 2133 } |
2034 | 2134 |
2047 gdk_pixmap_unref(link_i); | 2147 gdk_pixmap_unref(link_i); |
2048 gdk_pixmap_unref(smiley_i); | 2148 gdk_pixmap_unref(smiley_i); |
2049 gdk_pixmap_unref(wood_i); | 2149 gdk_pixmap_unref(wood_i); |
2050 gdk_pixmap_unref(save_i); | 2150 gdk_pixmap_unref(save_i); |
2051 gdk_pixmap_unref(speaker_i); | 2151 gdk_pixmap_unref(speaker_i); |
2152 gdk_pixmap_unref(image_i); | |
2052 | 2153 |
2053 c->bold = bold; | 2154 c->bold = bold; |
2054 c->strike = strike; | 2155 c->strike = strike; |
2055 c->italic = italic; | 2156 c->italic = italic; |
2056 c->underline = underline; | 2157 c->underline = underline; |
2059 c->bgcolorbtn = bgcolorbtn; | 2160 c->bgcolorbtn = bgcolorbtn; |
2060 c->link = link; | 2161 c->link = link; |
2061 c->wood = wood; | 2162 c->wood = wood; |
2062 c->font = font; | 2163 c->font = font; |
2063 c->smiley = smiley; | 2164 c->smiley = smiley; |
2165 c->imagebtn = image; | |
2064 | 2166 |
2065 gtk_widget_set_sensitive(c->log_button, ((logging_options & OPT_LOG_ALL)) ? FALSE : TRUE); | 2167 gtk_widget_set_sensitive(c->log_button, ((logging_options & OPT_LOG_ALL)) ? FALSE : TRUE); |
2066 | |
2067 gtk_widget_set_sensitive(c->bold, ((font_options & OPT_FONT_BOLD)) ? FALSE : TRUE); | 2168 gtk_widget_set_sensitive(c->bold, ((font_options & OPT_FONT_BOLD)) ? FALSE : TRUE); |
2068 gtk_widget_set_sensitive(c->italic, ((font_options & OPT_FONT_ITALIC)) ? FALSE : TRUE); | 2169 gtk_widget_set_sensitive(c->italic, ((font_options & OPT_FONT_ITALIC)) ? FALSE : TRUE); |
2069 gtk_widget_set_sensitive(c->underline, ((font_options & OPT_FONT_UNDERLINE)) ? FALSE : TRUE); | 2170 gtk_widget_set_sensitive(c->underline, ((font_options & OPT_FONT_UNDERLINE)) ? FALSE : TRUE); |
2070 gtk_widget_set_sensitive(c->strike, ((font_options & OPT_FONT_STRIKE)) ? FALSE : TRUE); | 2171 gtk_widget_set_sensitive(c->strike, ((font_options & OPT_FONT_STRIKE)) ? FALSE : TRUE); |
2071 | 2172 |
2238 return; | 2339 return; |
2239 | 2340 |
2240 c->gc = gc; | 2341 c->gc = gc; |
2241 | 2342 |
2242 set_convo_title(c); | 2343 set_convo_title(c); |
2243 | |
2244 update_buttons_by_protocol(c); | 2344 update_buttons_by_protocol(c); |
2245 | 2345 |
2246 update_icon(c); | 2346 update_icon(c); |
2247 update_checkbox(c); | 2347 update_checkbox(c); |
2248 } | 2348 } |
2262 gtk_widget_set_sensitive(c->add, FALSE); | 2362 gtk_widget_set_sensitive(c->add, FALSE); |
2263 if (c->whisper) | 2363 if (c->whisper) |
2264 gtk_widget_set_sensitive(c->whisper, FALSE); | 2364 gtk_widget_set_sensitive(c->whisper, FALSE); |
2265 if (c->invite) | 2365 if (c->invite) |
2266 gtk_widget_set_sensitive(c->invite, FALSE); | 2366 gtk_widget_set_sensitive(c->invite, FALSE); |
2267 | |
2268 return; | 2367 return; |
2269 } | 2368 } |
2270 | 2369 |
2271 if (c->gc->prpl->get_info == NULL && c->info) | 2370 if (c->gc->prpl->get_info == NULL && c->info) |
2272 gtk_widget_set_sensitive(c->info, FALSE); | 2371 gtk_widget_set_sensitive(c->info, FALSE); |
2276 if (c->is_chat) { | 2375 if (c->is_chat) { |
2277 if (c->gc->prpl->chat_send == NULL && c->send) | 2376 if (c->gc->prpl->chat_send == NULL && c->send) |
2278 gtk_widget_set_sensitive(c->send, FALSE); | 2377 gtk_widget_set_sensitive(c->send, FALSE); |
2279 else | 2378 else |
2280 gtk_widget_set_sensitive(c->send, TRUE); | 2379 gtk_widget_set_sensitive(c->send, TRUE); |
2380 gtk_widget_set_sensitive(c->imagebtn, FALSE); | |
2281 } else { | 2381 } else { |
2282 if (c->gc->prpl->send_im == NULL && c->send) | 2382 if (c->gc->prpl->send_im == NULL && c->send) |
2283 gtk_widget_set_sensitive(c->send, FALSE); | 2383 gtk_widget_set_sensitive(c->send, FALSE); |
2284 else | 2384 else |
2285 gtk_widget_set_sensitive(c->send, TRUE); | 2385 gtk_widget_set_sensitive(c->send, TRUE); |
2386 if (c->gc->prpl->options & OPT_PROTO_IM_IMAGE) | |
2387 gtk_widget_set_sensitive(c->imagebtn, TRUE); | |
2388 else | |
2389 gtk_widget_set_sensitive(c->imagebtn, FALSE); | |
2286 } | 2390 } |
2287 | 2391 |
2288 if (c->gc->prpl->warn == NULL && c->warn) | 2392 if (c->gc->prpl->warn == NULL && c->warn) |
2289 gtk_widget_set_sensitive(c->warn, FALSE); | 2393 gtk_widget_set_sensitive(c->warn, FALSE); |
2290 else if (c->warn) | 2394 else if (c->warn) |