annotate src/protocols/yahoo/util.c @ 6573:cc41123c684a

[gaim-migrate @ 7095] Bjoern Voigt writes: "As far as I can see, you commited a patch, which adds support for "Get User Info" on Yahoo and MSN. It's not my small Yahoo Get Info patch, it's the bigger one, which parses Yahoo and MSN profile pages. I prepared a patch for it, which adds i18n macros to this patch. Please commit the attached patch i18n21.patch. The patch works fine for Yahoo contacts with English language preference. Unfortunately the patch doesn't work with contacts with other language preferences. The problem is, that in Yahoo every user can set up a language for his/her profile. So http://profiles.yahoo.com/CONTACT can deliver English, German, French, ... pages, depending on CONTACT's preference. The yahoo_get_info() functions doesn't handle this and it's not easy to handle this. I have some ideas, how to fix this issue. I like to discuss this with the author of the patch or in gaim-devel." committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Fri, 22 Aug 2003 20:06:18 +0000
parents e34907332e46
children 42fdf16f1dad
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6513
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
1 /*
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
2 * gaim
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
3 *
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
4 * Some code copyright 2003 Tim Ringenbach <omarvo@hotmail.com>
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
5 * (marv on irc.freenode.net)
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
6 *
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
10 * (at your option) any later version.
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
11 *
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
15 * GNU General Public License for more details.
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
16 *
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
20 *
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
21 */
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
22
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
23 #ifdef HAVE_CONFIG_H
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
24 #include "config.h"
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
25 #endif
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
26
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
27 #include "prpl.h"
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
28 #include "debug.h"
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
29
6546
e34907332e46 [gaim-migrate @ 7068]
Mark Doliner <mark@kingant.net>
parents: 6513
diff changeset
30 #include <string.h>
e34907332e46 [gaim-migrate @ 7068]
Mark Doliner <mark@kingant.net>
parents: 6513
diff changeset
31
6513
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
32
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
33 /*
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
34 * I found these on some website but i don't know that they actually
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
35 * work (or are supposed to work). I didn't impliment them yet.
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
36 *
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
37 * [0;30m ---black
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
38 * [1;37m ---white
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
39 * [0;37m ---tan
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
40 * [0;38m ---light black
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
41 * [1;39m ---dark blue
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
42 * [0;32m ---green
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
43 * [0;33m ---yellow
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
44 * [0;35m ---pink
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
45 * [1;35m ---purple
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
46 * [1;30m ---light blue
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
47 * [0;31m ---red
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
48 * [0;34m ---blue
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
49 * [0;36m ---aqua
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
50 * (shift+comma)lyellow(shift+period) ---light yellow
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
51 * (shift+comma)lgreen(shift+period) ---light green
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
52 [2;30m <--white out
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
53
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
54 */
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
55
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
56
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
57 static GHashTable *ht = NULL;
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
58
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
59 void yahoo_init_colorht()
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
60 {
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
61 ht = g_hash_table_new(g_str_hash, g_str_equal);
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
62
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
63 g_hash_table_insert(ht, "30", "<FONT COLOR=\"#000000\">"); /* black */
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
64 g_hash_table_insert(ht, "31", "<FONT COLOR=\"#0000FF\">"); /* blue */
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
65 g_hash_table_insert(ht, "32", "<FONT COLOR=\"#008080\">"); /* cyan */ /* 00b2b2 */
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
66 g_hash_table_insert(ht, "33", "<FONT COLOR=\"#808080\">"); /* gray */ /* 808080 */
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
67 g_hash_table_insert(ht, "34", "<FONT COLOR=\"#008000\">"); /* green */ /* 00c200 */
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
68 g_hash_table_insert(ht, "35", "<FONT COLOR=\"#FF0080\">"); /* pink */ /* ffafaf */
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
69 g_hash_table_insert(ht, "36", "<FONT COLOR=\"#800080\">"); /* purple */ /* b200b2 */
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
70 g_hash_table_insert(ht, "37", "<FONT COLOR=\"#FF8000\">"); /* orange */ /* ffff00 */
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
71 g_hash_table_insert(ht, "38", "<FONT COLOR=\"#FF0000\">"); /* red */
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
72 g_hash_table_insert(ht, "39", "<FONT COLOR=\"#808000\">"); /* olive */ /* 546b50 */
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
73
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
74 g_hash_table_insert(ht, "1", "<B>");
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
75 g_hash_table_insert(ht, "x1", "</B>");
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
76 g_hash_table_insert(ht, "2", "<I>");
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
77 g_hash_table_insert(ht, "x2", "</I>");
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
78 g_hash_table_insert(ht, "4", "<U>");
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
79 g_hash_table_insert(ht, "x4", "</U>");
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
80
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
81 g_hash_table_insert(ht, "<black>", "<FONT COLOR=\"#000000\">");
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
82 g_hash_table_insert(ht, "<blue>", "<FONT COLOR=\"#0000FF\">");
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
83 g_hash_table_insert(ht, "<cyan>", "<FONT COLOR=\"#008284\">");
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
84 g_hash_table_insert(ht, "<gray>", "<FONT COLOR=\"#848284\">");
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
85 g_hash_table_insert(ht, "<green>", "<FONT COLOR=\"#008200\">");
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
86 g_hash_table_insert(ht, "<pink>", "<FONT COLOR=\"#FF0084\">");
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
87 g_hash_table_insert(ht, "<purple>", "<FONT COLOR=\"#840084\">");
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
88 g_hash_table_insert(ht, "<orange>", "<FONT COLOR=\"#FF8000\">");
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
89 g_hash_table_insert(ht, "<red>", "<FONT COLOR=\"#FF0000\">");
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
90 g_hash_table_insert(ht, "<yellow>", "<FONT COLOR=\"#848200\">");
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
91
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
92 g_hash_table_insert(ht, "</black>", "</FONT>");
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
93 g_hash_table_insert(ht, "</blue>", "</FONT>");
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
94 g_hash_table_insert(ht, "</cyan>", "</FONT>");
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
95 g_hash_table_insert(ht, "</gray>", "</FONT>");
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
96 g_hash_table_insert(ht, "</green>", "</FONT>");
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
97 g_hash_table_insert(ht, "</pink>", "</FONT>");
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
98 g_hash_table_insert(ht, "</purple>", "</FONT>");
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
99 g_hash_table_insert(ht, "</orange>", "</FONT>");
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
100 g_hash_table_insert(ht, "</red>", "</FONT>");
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
101 g_hash_table_insert(ht, "</yellow>", "</FONT>");
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
102
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
103 /* remove these once we have proper support for <FADE> and <ALT> */
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
104 g_hash_table_insert(ht, "</fade>", "");
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
105 g_hash_table_insert(ht, "</alt>", "");
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
106 }
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
107
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
108 void yahoo_dest_colorht()
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
109 {
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
110 g_hash_table_destroy(ht);
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
111 }
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
112
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
113 char *yahoo_codes_to_html(char *x)
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
114 {
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
115 GString *s, *tmp;
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
116 int i, j, xs, nomoreendtags = 0;
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
117 char *match, *ret;
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
118
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
119
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
120 s = g_string_sized_new(strlen(x));
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
121
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
122 for (i = 0, xs = strlen(x); i < xs; i++) {
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
123 if ((x[i] == 0x1b) && (x[i+1] == '[')) {
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
124 j = i + 1;
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
125
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
126 while (j++ < xs) {
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
127 if (x[j] != 'm')
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
128 continue;
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
129 else {
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
130 tmp = g_string_new_len(x + i + 2, j - i - 2);
6546
e34907332e46 [gaim-migrate @ 7068]
Mark Doliner <mark@kingant.net>
parents: 6513
diff changeset
131 if ((tmp->str[0] == '#'))
6513
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
132 g_string_append_printf(s, "<FONT COLOR=\"%s\">", tmp->str);
6546
e34907332e46 [gaim-migrate @ 7068]
Mark Doliner <mark@kingant.net>
parents: 6513
diff changeset
133 else if ((match = (char *) g_hash_table_lookup(ht, tmp->str)))
6513
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
134 g_string_append(s, match);
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
135 else {
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
136 gaim_debug(GAIM_DEBUG_ERROR, "yahoo",
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
137 "Unknown ansi code 'ESC[%sm'.\n", tmp->str);
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
138 g_string_free(tmp, TRUE);
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
139 break;
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
140 }
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
141
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
142 i = j;
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
143 g_string_free(tmp, TRUE);
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
144 break;
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
145 }
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
146 }
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
147
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
148
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
149 } else if (!nomoreendtags && (x[i] == '<')) {
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
150 j = i + 1;
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
151
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
152 while (j++ < xs) {
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
153 if (x[j] != '>')
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
154 if (j == xs) {
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
155 g_string_append_c(s, '<');
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
156 nomoreendtags = 1;
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
157 }
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
158 else
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
159 continue;
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
160 else {
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
161 tmp = g_string_new_len(x + i, j - i + 1);
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
162 g_string_ascii_down(tmp);
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
163
6546
e34907332e46 [gaim-migrate @ 7068]
Mark Doliner <mark@kingant.net>
parents: 6513
diff changeset
164 if ((match = (char *) g_hash_table_lookup(ht, tmp->str)))
6513
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
165 g_string_append(s, match);
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
166 else if (!g_ascii_strncasecmp(tmp->str, "<FADE ", 6) ||
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
167 !g_ascii_strncasecmp(tmp->str, "<ALT ", 5) ||
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
168 !g_ascii_strncasecmp(tmp->str, "<SND ", 5)) {
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
169
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
170 /* remove this if gtkhtml ever supports any of these */
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
171 i = j;
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
172 g_string_free(tmp, TRUE);
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
173 break;
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
174
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
175 } else {
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
176 g_string_append_c(s, '<');
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
177 g_string_free(tmp, TRUE);
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
178 break;
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
179 }
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
180
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
181 i = j;
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
182 g_string_free(tmp, TRUE);
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
183 break;
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
184 }
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
185
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
186 }
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
187
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
188
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
189
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
190 } else {
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
191 g_string_append_c(s, x[i]);
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
192 }
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
193 }
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
194
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
195 ret = s->str;
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
196 g_string_free(s, FALSE);
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
197 gaim_debug(GAIM_DEBUG_MISC, "yahoo", "Returning string: '%s'.\n", ret);
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
198 return ret;
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
199 }