comparison src/gtkconv.c @ 10999:56cfc50d2a81

[gaim-migrate @ 12841] Fix the right-click menus on the tags disappearing when mouse released. Rlaager also noticed that if the buddy name contains an escaped entity, the offsets are screwy - fix that too. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Thu, 09 Jun 2005 05:17:56 +0000
parents 57e3e958ff49
children 2b772e7094ef
comparison
equal deleted inserted replaced
10998:9a397c858639 10999:56cfc50d2a81
4824 gc->prpl); 4824 gc->prpl);
4825 4825
4826 menu = create_chat_menu(conv, buddyname, 4826 menu = create_chat_menu(conv, buddyname,
4827 prpl_info, gc); 4827 prpl_info, gc);
4828 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, 4828 gtk_menu_popup(GTK_MENU(menu), NULL, NULL,
4829 NULL, GTK_WIDGET(imhtml), 3, 4829 NULL, GTK_WIDGET(imhtml),
4830 GDK_CURRENT_TIME); 4830 btn_event->button,
4831 btn_event->time);
4831 4832
4832 /* Don't propagate the event any further */ 4833 /* Don't propagate the event any further */
4833 return TRUE; 4834 return TRUE;
4834 } 4835 }
4835 } 4836 }
4934 } else if (flags & GAIM_MESSAGE_RAW) { 4935 } else if (flags & GAIM_MESSAGE_RAW) {
4935 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), message, 0); 4936 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), message, 0);
4936 } else { 4937 } else {
4937 char *new_message = g_memdup(message, length); 4938 char *new_message = g_memdup(message, length);
4938 char *who_escaped = (who ? g_markup_escape_text(who, strlen(who)) : g_strdup("")); 4939 char *who_escaped = (who ? g_markup_escape_text(who, strlen(who)) : g_strdup(""));
4939 int tag_start_offset = 0, tag_end_offset = 0; 4940 /* The initial offset is to deal with
4941 * escaped entities making the string longer */
4942 int tag_start_offset = (who ? (strlen(who_escaped) - strlen(who)) : 0);
4943 int tag_end_offset = 0;
4940 4944
4941 if (flags & GAIM_MESSAGE_WHISPER) { 4945 if (flags & GAIM_MESSAGE_WHISPER) {
4942 str = g_malloc(1024); 4946 str = g_malloc(1024);
4943 4947
4944 /* If we're whispering, it's not an autoresponse. */ 4948 /* If we're whispering, it's not an autoresponse. */
4945 if (gaim_message_meify(new_message, -1 )) { 4949 if (gaim_message_meify(new_message, -1 )) {
4946 g_snprintf(str, 1024, "***%s", who_escaped); 4950 g_snprintf(str, 1024, "***%s", who_escaped);
4947 strcpy(color, "#6C2585"); 4951 strcpy(color, "#6C2585");
4948 tag_start_offset = 3; 4952 tag_start_offset += 3;
4949 } 4953 }
4950 else { 4954 else {
4951 g_snprintf(str, 1024, "*%s*:", who_escaped); 4955 g_snprintf(str, 1024, "*%s*:", who_escaped);
4952 tag_start_offset = 1; 4956 tag_start_offset += 1;
4953 tag_end_offset = 2; 4957 tag_end_offset = 2;
4954 strcpy(color, "#00FF00"); 4958 strcpy(color, "#00FF00");
4955 } 4959 }
4956 } 4960 }
4957 else { 4961 else {
4958 if (gaim_message_meify(new_message, -1)) { 4962 if (gaim_message_meify(new_message, -1)) {
4959 str = g_malloc(1024); 4963 str = g_malloc(1024);
4960 4964
4961 if (flags & GAIM_MESSAGE_AUTO_RESP) { 4965 if (flags & GAIM_MESSAGE_AUTO_RESP) {
4962 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, who_escaped); 4966 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, who_escaped);
4963 tag_start_offset = 4 4967 tag_start_offset += 4
4964 + strlen(AUTO_RESPONSE); 4968 + strlen(AUTO_RESPONSE);
4965 } else { 4969 } else {
4966 g_snprintf(str, 1024, "***%s", who_escaped); 4970 g_snprintf(str, 1024, "***%s", who_escaped);
4967 tag_start_offset = 3; 4971 tag_start_offset += 3;
4968 } 4972 }
4969 4973
4970 if (flags & GAIM_MESSAGE_NICK) 4974 if (flags & GAIM_MESSAGE_NICK)
4971 strcpy(color, "#AF7F00"); 4975 strcpy(color, "#AF7F00");
4972 else 4976 else
4974 } 4978 }
4975 else { 4979 else {
4976 str = g_malloc(1024); 4980 str = g_malloc(1024);
4977 if (flags & GAIM_MESSAGE_AUTO_RESP) { 4981 if (flags & GAIM_MESSAGE_AUTO_RESP) {
4978 g_snprintf(str, 1024, "%s %s", who_escaped, AUTO_RESPONSE); 4982 g_snprintf(str, 1024, "%s %s", who_escaped, AUTO_RESPONSE);
4979 tag_start_offset = 1 4983 tag_start_offset += 1
4980 + strlen(AUTO_RESPONSE); 4984 + strlen(AUTO_RESPONSE);
4981 } else { 4985 } else {
4982 g_snprintf(str, 1024, "%s:", who_escaped); 4986 g_snprintf(str, 1024, "%s:", who_escaped);
4983 tag_end_offset = 1; 4987 tag_end_offset = 1;
4984 } 4988 }