comparison src/util.c @ 5943:a4f2aba0848d

[gaim-migrate @ 6384] This should fix corruption in the blist, accounts, and pounces when some protocol plugins cannot load. Some parts of gaim now use the new unique Plugin or Protocol Plugin IDs, while some still use the old protocol numbers. Accounts kind of used both, and when prpls were missing, it had trouble finding accounts. It would find the names, even without mapping the protocol numbers to IDs, and any duplicate accounts would get nuked. That would then affect pounce saving. Anyhow, long story short (well, it's already long, too late for that), this should fix all that mess. And introduce new mess, but hopefully temporary mess. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Mon, 23 Jun 2003 02:00:15 +0000
parents 124ca6f5e895
children 74b281b4ae29
comparison
equal deleted inserted replaced
5942:d0320de18feb 5943:a4f2aba0848d
587 } 587 }
588 cpy[cnt] = '\0'; 588 cpy[cnt] = '\0';
589 return (cpy); 589 return (cpy);
590 } 590 }
591 591
592 char *stylize(const gchar *text, int length)
593 {
594 gchar *buf;
595 char *tmp = g_malloc(length);
596
597 buf = g_malloc(length);
598 g_snprintf(buf, length, "%s", text);
599
600 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")) {
601 g_snprintf(tmp, length, "<B>%s</B>", buf);
602 strcpy(buf, tmp);
603 }
604
605 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")) {
606 g_snprintf(tmp, length, "<I>%s</I>", buf);
607 strcpy(buf, tmp);
608 }
609
610 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")) {
611 g_snprintf(tmp, length, "<U>%s</U>", buf);
612 strcpy(buf, tmp);
613 }
614
615 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_strikethrough")) {
616 g_snprintf(tmp, length, "<S>%s</S>", buf);
617 strcpy(buf, tmp);
618 }
619
620 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_font")) {
621 const char *fontface;
622
623 fontface = gaim_prefs_get_string("/gaim/gtk/conversations/font_face");
624
625 g_snprintf(tmp, length, "<FONT FACE=\"%s\">%s</FONT>", fontface, buf);
626 strcpy(buf, tmp);
627 }
628
629 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_size")) {
630 int fontsize = gaim_prefs_get_int("/gaim/gtk/conversations/font_size");
631
632 g_snprintf(tmp, length, "<FONT SIZE=\"%d\">%s</FONT>", fontsize, buf);
633 strcpy(buf, tmp);
634 }
635
636 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_fgcolor")) {
637 GdkColor fgcolor;
638
639 gdk_color_parse(
640 gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"),
641 &fgcolor);
642
643 g_snprintf(tmp, length, "<FONT COLOR=\"#%02X%02X%02X\">%s</FONT>",
644 fgcolor.red/256, fgcolor.green/256, fgcolor.blue/256, buf);
645 strcpy(buf, tmp);
646 }
647
648 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_bgcolor")) {
649 GdkColor bgcolor;
650
651 gdk_color_parse(
652 gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"),
653 &bgcolor);
654
655 g_snprintf(tmp, length, "<BODY BGCOLOR=\"#%02X%02X%02X\">%s</BODY>",
656 bgcolor.red/256, bgcolor.green/256, bgcolor.blue/256, buf);
657 strcpy(buf, tmp);
658 }
659
660 g_free(tmp);
661 return buf;
662 }
663
664 void show_usage(int mode, const char *name)
665 {
666 switch (mode) {
667 case 0: /* full help text */
668 printf(_("Gaim %s\n"
669 "Usage: %s [OPTION]...\n\n"
670 " -a, --acct display account editor window\n"
671 " -w, --away[=MESG] make away on signon (optional argument MESG specifies\n"
672 " name of away message to use)\n"
673 " -l, --login[=NAME] automatically login (optional argument NAME specifies\n"
674 " account(s) to use, seperated by commas)\n"
675 " -n, --loginwin don't automatically login; show login window\n"
676 " -u, --user=NAME use account NAME\n"
677 " -f, --file=FILE use FILE as config\n"
678 " -d, --debug print debugging messages to stdout\n"
679 " -v, --version display the current version and exit\n"
680 " -h, --help display this help and exit\n"), VERSION, name);
681 break;
682 case 1: /* short message */
683 printf(_("Gaim %s. Try `%s -h' for more information.\n"), VERSION, name);
684 break;
685 }
686 }
687
688 GSList *message_split(char *message, int limit) 592 GSList *message_split(char *message, int limit)
689 { 593 {
690 static GSList *ret = NULL; 594 static GSList *ret = NULL;
691 int lastgood = 0, curgood = 0, curpos = 0, len = strlen(message); 595 int lastgood = 0, curgood = 0, curpos = 0, len = strlen(message);
692 gboolean intag = FALSE; 596 gboolean intag = FALSE;