pidgin/gtkconv.c

changeset 21955
4014918b95fc
parent 21940
4bcf061ef95b
child 21963
bba34dfb2416
equal deleted inserted replaced
21954:ffb38ad2e4d6 21955:4014918b95fc
93 CONV_NUM_COLUMNS 93 CONV_NUM_COLUMNS
94 } PidginInfopaneColumns; 94 } PidginInfopaneColumns;
95 95
96 #define PIDGIN_CONV_ALL ((1 << 7) - 1) 96 #define PIDGIN_CONV_ALL ((1 << 7) - 1)
97 97
98 #define SEND_COLOR "#204a87" 98 #define DEFAULT_SEND_COLOR "#204a87"
99 #define RECV_COLOR "#cc0000" 99 #define DEFAULT_RECV_COLOR "#cc0000"
100 #define HIGHLIGHT_COLOR "#AF7F00" 100 #define DEFAULT_HIGHLIGHT_COLOR "#AF7F00"
101 #define DEFAULT_ACTION_COLOR "#062585"
101 102
102 /* Undef this to turn off "custom-smiley" debug messages */ 103 /* Undef this to turn off "custom-smiley" debug messages */
103 #define DEBUG_CUSTOM_SMILEY 104 #define DEBUG_CUSTOM_SMILEY
104 105
105 #define LUMINANCE(c) (float)((0.3*(c.red))+(0.59*(c.green))+(0.11*(c.blue))) 106 #define LUMINANCE(c) (float)((0.3*(c.red))+(0.59*(c.green))+(0.11*(c.blue)))
3788 g_free(tmp); 3789 g_free(tmp);
3789 3790
3790 if (is_me) 3791 if (is_me)
3791 { 3792 {
3792 GdkColor send_color; 3793 GdkColor send_color;
3793 gdk_color_parse(SEND_COLOR, &send_color); 3794 gdk_color_parse(DEFAULT_SEND_COLOR, &send_color);
3794 3795
3795 #if GTK_CHECK_VERSION(2,6,0) 3796 #if GTK_CHECK_VERSION(2,6,0)
3796 gtk_list_store_insert_with_values(ls, &iter, 3797 gtk_list_store_insert_with_values(ls, &iter,
3797 /* 3798 /*
3798 * The GTK docs are mute about the effects of the "row" value for performance. 3799 * The GTK docs are mute about the effects of the "row" value for performance.
5600 strcpy(color, "#00FF00"); 5601 strcpy(color, "#00FF00");
5601 } 5602 }
5602 } 5603 }
5603 else { 5604 else {
5604 if (purple_message_meify(new_message, -1)) { 5605 if (purple_message_meify(new_message, -1)) {
5606 GdkColor *col;
5605 str = g_malloc(1024); 5607 str = g_malloc(1024);
5606 5608
5607 if (flags & PURPLE_MESSAGE_AUTO_RESP) { 5609 if (flags & PURPLE_MESSAGE_AUTO_RESP) {
5608 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, alias_escaped); 5610 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, alias_escaped);
5609 tag_start_offset += 4 5611 tag_start_offset += 4
5612 g_snprintf(str, 1024, "***%s", alias_escaped); 5614 g_snprintf(str, 1024, "***%s", alias_escaped);
5613 tag_start_offset += 3; 5615 tag_start_offset += 3;
5614 } 5616 }
5615 5617
5616 if (flags & PURPLE_MESSAGE_NICK) 5618 if (flags & PURPLE_MESSAGE_NICK)
5617 strcpy(color, HIGHLIGHT_COLOR); 5619 gtk_widget_style_get(GTK_WIDGET(gtkconv->imhtml), "highlight-name-color", &col, NULL);
5618 else 5620 else
5619 strcpy(color, "#062585"); 5621 gtk_widget_style_get(GTK_WIDGET(gtkconv->imhtml), "action-name-color", &col, NULL);
5622
5623 if(col) {
5624 g_snprintf(color, sizeof(color), "#%02X%02X%02X",
5625 col->red >> 8, col->green >> 8, col->blue >> 8);
5626 }
5627 else {
5628 if (flags & PURPLE_MESSAGE_NICK)
5629 strcpy(color, DEFAULT_HIGHLIGHT_COLOR);
5630 else
5631 strcpy(color, DEFAULT_ACTION_COLOR);
5632 }
5620 } 5633 }
5621 else { 5634 else {
5622 str = g_malloc(1024); 5635 str = g_malloc(1024);
5623 if (flags & PURPLE_MESSAGE_AUTO_RESP) { 5636 if (flags & PURPLE_MESSAGE_AUTO_RESP) {
5624 g_snprintf(str, 1024, "%s %s", alias_escaped, AUTO_RESPONSE); 5637 g_snprintf(str, 1024, "%s %s", alias_escaped, AUTO_RESPONSE);
5626 + strlen(AUTO_RESPONSE); 5639 + strlen(AUTO_RESPONSE);
5627 } else { 5640 } else {
5628 g_snprintf(str, 1024, "%s:", alias_escaped); 5641 g_snprintf(str, 1024, "%s:", alias_escaped);
5629 tag_end_offset = 1; 5642 tag_end_offset = 1;
5630 } 5643 }
5631 if (flags & PURPLE_MESSAGE_NICK) 5644 if (flags & PURPLE_MESSAGE_NICK) {
5632 strcpy(color, HIGHLIGHT_COLOR); 5645 GdkColor *col;
5646 gtk_widget_style_get(GTK_WIDGET(gtkconv->imhtml), "highlight-name-color", &col, NULL);
5647 if(col) {
5648 g_snprintf(color, sizeof(color), "#%02X%02X%02X",
5649 col->red >> 8, col->green >> 8, col->blue >> 8);
5650 }
5651 else {
5652 strcpy(color, DEFAULT_HIGHLIGHT_COLOR);
5653 }
5654 }
5633 else if (flags & PURPLE_MESSAGE_RECV) { 5655 else if (flags & PURPLE_MESSAGE_RECV) {
5634 if (type == PURPLE_CONV_TYPE_CHAT) { 5656 if (type == PURPLE_CONV_TYPE_CHAT) {
5635 GdkColor *col = get_nick_color(gtkconv, name); 5657 GdkColor *col = get_nick_color(gtkconv, name);
5636 5658
5637 g_snprintf(color, sizeof(color), "#%02X%02X%02X", 5659 g_snprintf(color, sizeof(color), "#%02X%02X%02X",
5638 col->red >> 8, col->green >> 8, col->blue >> 8); 5660 col->red >> 8, col->green >> 8, col->blue >> 8);
5639 } else 5661 } else {
5640 strcpy(color, RECV_COLOR); 5662 GdkColor *col;
5663 gtk_widget_style_get(GTK_WIDGET(gtkconv->imhtml), "receive-name-color", &col, NULL);
5664 if(col) {
5665 g_snprintf(color, sizeof(color), "#%02X%02X%02X",
5666 col->red >> 8, col->green >> 8, col->blue >> 8);
5667 }
5668 else {
5669 strcpy(color, DEFAULT_RECV_COLOR);
5670 }
5671 }
5641 } 5672 }
5642 else if (flags & PURPLE_MESSAGE_SEND) 5673 else if (flags & PURPLE_MESSAGE_SEND) {
5643 strcpy(color, SEND_COLOR); 5674 GdkColor *col;
5675 gtk_widget_style_get(GTK_WIDGET(gtkconv->imhtml), "send-name-color", &col, NULL);
5676 if(col) {
5677 g_snprintf(color, sizeof(color), "#%02X%02X%02X",
5678 col->red >> 8, col->green >> 8, col->blue >> 8);
5679 }
5680 else {
5681 strcpy(color, DEFAULT_SEND_COLOR);
5682 }
5683 }
5644 else { 5684 else {
5645 purple_debug_error("gtkconv", "message missing flags\n"); 5685 purple_debug_error("gtkconv", "message missing flags\n");
5646 strcpy(color, "#000000"); 5686 strcpy(color, "#000000");
5647 } 5687 }
5648 } 5688 }
9921 GdkColor *colors = g_new(GdkColor, numcolors); 9961 GdkColor *colors = g_new(GdkColor, numcolors);
9922 GdkColor nick_highlight; 9962 GdkColor nick_highlight;
9923 GdkColor send_color; 9963 GdkColor send_color;
9924 time_t breakout_time; 9964 time_t breakout_time;
9925 9965
9926 gdk_color_parse(HIGHLIGHT_COLOR, &nick_highlight); 9966 gdk_color_parse(DEFAULT_HIGHLIGHT_COLOR, &nick_highlight);
9927 gdk_color_parse(SEND_COLOR, &send_color); 9967 gdk_color_parse(DEFAULT_SEND_COLOR, &send_color);
9928 9968
9929 srand(background.red + background.green + background.blue + 1); 9969 srand(background.red + background.green + background.blue + 1);
9930 9970
9931 breakout_time = time(NULL) + 3; 9971 breakout_time = time(NULL) + 3;
9932 9972

mercurial