comparison src/gtkimhtml.c @ 5177:1c739f2ce94f

[gaim-migrate @ 5541] this will fix gaim's parsing of urls with & in them, when they're sent properly as winaim does, and as gaim does over jabber. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sat, 19 Apr 2003 20:58:50 +0000
parents 376349b04123
children 2d7f9a092b81
comparison
equal deleted inserted replaced
5176:6911a84cbab1 5177:1c739f2ce94f
748 gtk_imhtml_get_html_opt (gchar *tag, 748 gtk_imhtml_get_html_opt (gchar *tag,
749 const gchar *opt) 749 const gchar *opt)
750 { 750 {
751 gchar *t = tag; 751 gchar *t = tag;
752 gchar *e, *a; 752 gchar *e, *a;
753 gchar *val;
754 gint len;
755 gchar c;
756 GString *ret;
753 757
754 while (g_ascii_strncasecmp (t, opt, strlen (opt))) { 758 while (g_ascii_strncasecmp (t, opt, strlen (opt))) {
755 gboolean quote = FALSE; 759 gboolean quote = FALSE;
756 if (*t == '\0') break; 760 if (*t == '\0') break;
757 while (*t && !((*t == ' ') && !quote)) { 761 while (*t && !((*t == ' ') && !quote)) {
771 if ((*t == '\"') || (*t == '\'')) { 775 if ((*t == '\"') || (*t == '\'')) {
772 e = a = ++t; 776 e = a = ++t;
773 while (*e && (*e != *(t - 1))) e++; 777 while (*e && (*e != *(t - 1))) e++;
774 if (*e == '\0') { 778 if (*e == '\0') {
775 return NULL; 779 return NULL;
776 } else 780 } else
777 return g_strndup (a, e - a); 781 val = g_strndup(a, e - a);
778 } else { 782 } else {
779 e = a = t; 783 e = a = t;
780 while (*e && !isspace ((gint) *e)) e++; 784 while (*e && !isspace ((gint) *e)) e++;
781 return g_strndup (a, e - a); 785 val = g_strndup(a, e - a);
782 } 786 }
787
788 ret = g_string_new("");
789 e = val;
790 while(*e) {
791 if(gtk_imhtml_is_amp_escape(e, &c, &len)) {
792 ret = g_string_append_c(ret, c);
793 e += len;
794 } else {
795 ret = g_string_append_c(ret, *e);
796 e++;
797 }
798 }
799
800 g_free(val);
801 val = ret->str;
802 g_string_free(ret, FALSE);
803 return val;
783 } 804 }
784 805
785 806
786 807
787 #define NEW_TEXT_BIT 0 808 #define NEW_TEXT_BIT 0