comparison src/util.c @ 5545:7a64114641c3

[gaim-migrate @ 5946] I've been rewriting the prefs to move from gaimrc to prefs.xml. This will NOT compile! I don't want to see complaints about this, as it's CVS, and you should only be using it if you can put up with things like this. Also, don't ask how long it'll take until it compiles again. It may be several days. This is a big migration. Even when it works, it may not run right. However, it's made a lot of progress, and I plan to actively work on it today and tomorrow. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Thu, 29 May 2003 19:10:24 +0000
parents 6f35b80c5ffa
children 9eb5b13fd412
comparison
equal deleted inserted replaced
5544:0028381fa874 5545:7a64114641c3
43 #include <iconv.h> 43 #include <iconv.h>
44 #endif 44 #endif
45 #include <math.h> 45 #include <math.h>
46 #include "gaim.h" 46 #include "gaim.h"
47 #include "prpl.h" 47 #include "prpl.h"
48 #include "prefs.h"
48 49
49 #ifndef _WIN32 50 #ifndef _WIN32
50 #include <sys/socket.h> 51 #include <sys/socket.h>
51 #include <arpa/inet.h> 52 #include <arpa/inet.h>
52 #else 53 #else
652 char *tmp = g_malloc(length); 653 char *tmp = g_malloc(length);
653 654
654 buf = g_malloc(length); 655 buf = g_malloc(length);
655 g_snprintf(buf, length, "%s", text); 656 g_snprintf(buf, length, "%s", text);
656 657
657 if (font_options & OPT_FONT_BOLD) { 658 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")) {
658 g_snprintf(tmp, length, "<B>%s</B>", buf); 659 g_snprintf(tmp, length, "<B>%s</B>", buf);
659 strcpy(buf, tmp); 660 strcpy(buf, tmp);
660 } 661 }
661 662
662 if (font_options & OPT_FONT_ITALIC) { 663 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")) {
663 g_snprintf(tmp, length, "<I>%s</I>", buf); 664 g_snprintf(tmp, length, "<I>%s</I>", buf);
664 strcpy(buf, tmp); 665 strcpy(buf, tmp);
665 } 666 }
666 667
667 if (font_options & OPT_FONT_UNDERLINE) { 668 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")) {
668 g_snprintf(tmp, length, "<U>%s</U>", buf); 669 g_snprintf(tmp, length, "<U>%s</U>", buf);
669 strcpy(buf, tmp); 670 strcpy(buf, tmp);
670 } 671 }
671 672
672 if (font_options & OPT_FONT_STRIKE) { 673 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_strikethrough")) {
673 g_snprintf(tmp, length, "<S>%s</S>", buf); 674 g_snprintf(tmp, length, "<S>%s</S>", buf);
674 strcpy(buf, tmp); 675 strcpy(buf, tmp);
675 } 676 }
676 677
677 if (font_options & OPT_FONT_FACE) { 678 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_font")) {
679 const char *fontface;
680
681 fontface = gaim_prefs_get_string("/gaim/gtk/conversations/font_face");
682
678 g_snprintf(tmp, length, "<FONT FACE=\"%s\">%s</FONT>", fontface, buf); 683 g_snprintf(tmp, length, "<FONT FACE=\"%s\">%s</FONT>", fontface, buf);
679 strcpy(buf, tmp); 684 strcpy(buf, tmp);
680 } 685 }
681 686
682 if (font_options & OPT_FONT_SIZE) { 687 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_size")) {
688 int fontsize = gaim_prefs_get_int("/gaim/gtk/conversations/font_size");
689
683 g_snprintf(tmp, length, "<FONT SIZE=\"%d\">%s</FONT>", fontsize, buf); 690 g_snprintf(tmp, length, "<FONT SIZE=\"%d\">%s</FONT>", fontsize, buf);
684 strcpy(buf, tmp); 691 strcpy(buf, tmp);
685 } 692 }
686 693
687 if (font_options & OPT_FONT_FGCOL) { 694 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_fgcolor")) {
688 g_snprintf(tmp, length, "<FONT COLOR=\"#%02X%02X%02X\">%s</FONT>", fgcolor.red/256, 695 GdkColor fgcolor;
689 fgcolor.green/256, fgcolor.blue/256, buf); 696
697 gdk_color_parse(
698 gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"),
699 &fgcolor);
700
701 g_snprintf(tmp, length, "<FONT COLOR=\"#%02X%02X%02X\">%s</FONT>",
702 fgcolor.red/256, fgcolor.green/256, fgcolor.blue/256, buf);
690 strcpy(buf, tmp); 703 strcpy(buf, tmp);
691 } 704 }
692 705
693 if (font_options & OPT_FONT_BGCOL) { 706 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_bgcolor")) {
694 g_snprintf(tmp, length, "<BODY BGCOLOR=\"#%02X%02X%02X\">%s</BODY>", bgcolor.red/256, 707 GdkColor bgcolor;
695 bgcolor.green/256, bgcolor.blue/256, buf); 708
709 gdk_color_parse(
710 gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"),
711 &bgcolor);
712
713 g_snprintf(tmp, length, "<BODY BGCOLOR=\"#%02X%02X%02X\">%s</BODY>",
714 bgcolor.red/256, bgcolor.green/256, bgcolor.blue/256, buf);
696 strcpy(buf, tmp); 715 strcpy(buf, tmp);
697 } 716 }
698 717
699 g_free(tmp); 718 g_free(tmp);
700 return buf; 719 return buf;