Mercurial > pidgin.yaz
annotate libpurple/protocols/yahoo/util.c @ 28326:0ab7b436a563
Better string for Yahoo error 52. Someone might want to try improving it still.
author | John Bailey <rekkanoryo@rekkanoryo.org> |
---|---|
date | Sat, 01 Aug 2009 16:14:02 +0000 |
parents | ed11d1cabbe4 |
children | 5ac0a83f0b21 1e02e65ce301 |
rev | line source |
---|---|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /* |
15823 | 2 * purple |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
4 * Some code copyright 2003 Tim Ringenbach <omarvo@hotmail.com> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
5 * (marv on irc.freenode.net) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
6 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * This program is free software; you can redistribute it and/or modify |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
8 * it under the terms of the GNU General Public License as published by |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * the Free Software Foundation; either version 2 of the License, or |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * GNU General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU General Public License |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 * along with this program; if not, write to the Free Software |
19680
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19197
diff
changeset
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
20 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
22 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 #ifdef HAVE_CONFIG_H |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
24 #include "config.h" |
27193
510f07e1f5c1
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents:
23916
diff
changeset
|
25 #endif /* HAVE_CONFIG_H */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
26 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
27 #include "debug.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 #include "internal.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 #include "prpl.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 |
27395
ef5f0cde8d74
Update for file renames.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27384
diff
changeset
|
31 #include "libymsg.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 #include <string.h> |
23916
18a1f0fe5f40
Do a better job of detecting if the yahoo account is connecting through a HTTP
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23033
diff
changeset
|
34 |
18a1f0fe5f40
Do a better job of detecting if the yahoo account is connecting through a HTTP
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23033
diff
changeset
|
35 gboolean |
18a1f0fe5f40
Do a better job of detecting if the yahoo account is connecting through a HTTP
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23033
diff
changeset
|
36 yahoo_account_use_http_proxy(PurpleConnection *conn) |
18a1f0fe5f40
Do a better job of detecting if the yahoo account is connecting through a HTTP
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23033
diff
changeset
|
37 { |
18a1f0fe5f40
Do a better job of detecting if the yahoo account is connecting through a HTTP
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23033
diff
changeset
|
38 PurpleProxyInfo *ppi = purple_proxy_get_setup(conn->account); |
18a1f0fe5f40
Do a better job of detecting if the yahoo account is connecting through a HTTP
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23033
diff
changeset
|
39 return (ppi->type == PURPLE_PROXY_HTTP || ppi->type == PURPLE_PROXY_USE_ENVVAR); |
18a1f0fe5f40
Do a better job of detecting if the yahoo account is connecting through a HTTP
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23033
diff
changeset
|
40 } |
18a1f0fe5f40
Do a better job of detecting if the yahoo account is connecting through a HTTP
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23033
diff
changeset
|
41 |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
42 /* |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
43 * Returns cookies formatted as a null terminated string for the given connection. |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
44 * Must g_free return value. |
27193
510f07e1f5c1
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents:
23916
diff
changeset
|
45 * |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
46 * TODO:will work, but must test for strict correctness |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
47 */ |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
48 gchar* yahoo_get_cookies(PurpleConnection *gc) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
49 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
50 gchar *ans = NULL; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
51 gchar *cur; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
52 char firstflag = 1; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
53 gchar *t1,*t2,*t3; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
54 GSList *tmp; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
55 GSList *cookies; |
28025
908be3822215
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27501
diff
changeset
|
56 cookies = ((YahooData*)(gc->proto_data))->cookies; |
22018
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
57 tmp = cookies; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
58 while(tmp) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
59 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
60 cur = tmp->data; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
61 t1 = ans; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
62 t2 = g_strrstr(cur, ";expires="); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
63 if(t2 == NULL) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
64 t2 = g_strrstr(cur, "; expires="); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
65 if(t2 == NULL) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
66 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
67 if(firstflag) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
68 ans = g_strdup_printf("%c=%s", cur[0], cur+2); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
69 else |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
70 ans = g_strdup_printf("%s; %c=%s", t1, cur[0], cur+2); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
71 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
72 else |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
73 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
74 t3 = strstr(t2+1, ";"); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
75 if(t3 != NULL) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
76 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
77 t2[0] = '\0'; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
78 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
79 if(firstflag) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
80 ans = g_strdup_printf("%c=%s%s", cur[0], cur+2, t3); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
81 else |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
82 ans = g_strdup_printf("%s; %c=%s%s", t1, cur[0], cur+2, t3); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
83 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
84 t2[0] = ';'; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
85 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
86 else |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
87 { |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
88 t2[0] = '\0'; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
89 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
90 if(firstflag) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
91 ans = g_strdup_printf("%c=%s", cur[0], cur+2); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
92 else |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
93 ans = g_strdup_printf("%s; %c=%s", t1, cur[0], cur+2); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
94 |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
95 t2[0] = ';'; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
96 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
97 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
98 if(firstflag) |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
99 firstflag = 0; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
100 else |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
101 g_free(t1); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
102 tmp = g_slist_next(tmp); |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
103 } |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
104 return ans; |
118046227581
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents:
21831
diff
changeset
|
105 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
106 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
107 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
108 * Encode some text to send to the yahoo server. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
109 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
110 * @param gc The connection handle. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
111 * @param str The null terminated utf8 string to encode. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
112 * @param utf8 If not @c NULL, whether utf8 is okay or not. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 * Even if it is okay, we may not use it. If we |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
114 * used it, we set this to @c TRUE, else to |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
115 * @c FALSE. If @c NULL, false is assumed, and |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
116 * it is not dereferenced. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
117 * @return The g_malloced string in the appropriate encoding. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
118 */ |
15823 | 119 char *yahoo_string_encode(PurpleConnection *gc, const char *str, gboolean *utf8) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
120 { |
28025
908be3822215
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27501
diff
changeset
|
121 YahooData *yd = gc->proto_data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
122 char *ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
123 const char *to_codeset; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
124 |
23033
bf7ce9629402
applied changes from a5e7a62db1d43009f4ff463b7fe67ff3a7275a78
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22155
diff
changeset
|
125 if (yd->jp) |
bf7ce9629402
applied changes from a5e7a62db1d43009f4ff463b7fe67ff3a7275a78
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22155
diff
changeset
|
126 return g_strdup(str); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
127 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
128 if (utf8 && *utf8) /* FIXME: maybe don't use utf8 if it'll fit in latin1 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 return g_strdup(str); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
130 |
23033
bf7ce9629402
applied changes from a5e7a62db1d43009f4ff463b7fe67ff3a7275a78
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22155
diff
changeset
|
131 to_codeset = purple_account_get_string(purple_connection_get_account(gc), "local_charset", "ISO-8859-1"); |
bf7ce9629402
applied changes from a5e7a62db1d43009f4ff463b7fe67ff3a7275a78
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22155
diff
changeset
|
132 ret = g_convert_with_fallback(str, -1, to_codeset, "UTF-8", "?", NULL, NULL, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
133 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
134 if (ret) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
135 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
136 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
137 return g_strdup(""); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
138 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
139 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
140 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
141 * Decode some text received from the server. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
142 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
143 * @param gc The gc handle. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
144 * @param str The null terminated string to decode. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
145 * @param utf8 Did the server tell us it was supposed to be utf8? |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
146 * @return The decoded, utf-8 string, which must be g_free()'d. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
147 */ |
15823 | 148 char *yahoo_string_decode(PurpleConnection *gc, const char *str, gboolean utf8) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
149 { |
28025
908be3822215
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27501
diff
changeset
|
150 YahooData *yd = gc->proto_data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
151 char *ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
152 const char *from_codeset; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
153 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
154 if (utf8) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
155 if (g_utf8_validate(str, -1, NULL)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
156 return g_strdup(str); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
157 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
158 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
159 if (yd->jp) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
160 from_codeset = "SHIFT_JIS"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
161 else |
15823 | 162 from_codeset = purple_account_get_string(purple_connection_get_account(gc), "local_charset", "ISO-8859-1"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
163 |
19197
47942d19f301
Use -1 as length with g_convert() functions instead of strlen()
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16109
diff
changeset
|
164 ret = g_convert_with_fallback(str, -1, "UTF-8", from_codeset, NULL, NULL, NULL, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 if (ret) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
167 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
168 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 return g_strdup(""); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
170 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
171 |
22123
840e7e1b6dac
disapproval of revision '947ccb889812585e6d53eac13fc12734d8481e33'
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22121
diff
changeset
|
172 char *yahoo_convert_to_numeric(const char *str) |
840e7e1b6dac
disapproval of revision '947ccb889812585e6d53eac13fc12734d8481e33'
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22121
diff
changeset
|
173 { |
22134
33abfb98a460
Since I needed to bring back yahoo_convert_to_numeric, I figured I could at
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22123
diff
changeset
|
174 GString *gstr = NULL; |
22155
a886e43210b1
Fix (hopefully) the last problem in this function. Refs #3295.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22134
diff
changeset
|
175 const unsigned char *p; |
22123
840e7e1b6dac
disapproval of revision '947ccb889812585e6d53eac13fc12734d8481e33'
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22121
diff
changeset
|
176 |
22134
33abfb98a460
Since I needed to bring back yahoo_convert_to_numeric, I figured I could at
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22123
diff
changeset
|
177 gstr = g_string_sized_new(strlen(str) * 6 + 1); |
33abfb98a460
Since I needed to bring back yahoo_convert_to_numeric, I figured I could at
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22123
diff
changeset
|
178 |
22155
a886e43210b1
Fix (hopefully) the last problem in this function. Refs #3295.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22134
diff
changeset
|
179 for (p = (unsigned char *)str; *p; p++) { |
22134
33abfb98a460
Since I needed to bring back yahoo_convert_to_numeric, I figured I could at
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22123
diff
changeset
|
180 g_string_append_printf(gstr, "&#%u;", *p); |
22123
840e7e1b6dac
disapproval of revision '947ccb889812585e6d53eac13fc12734d8481e33'
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22121
diff
changeset
|
181 } |
22134
33abfb98a460
Since I needed to bring back yahoo_convert_to_numeric, I figured I could at
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22123
diff
changeset
|
182 |
28080 | 183 return g_string_free(gstr, FALSE); |
22123
840e7e1b6dac
disapproval of revision '947ccb889812585e6d53eac13fc12734d8481e33'
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22121
diff
changeset
|
184 } |
840e7e1b6dac
disapproval of revision '947ccb889812585e6d53eac13fc12734d8481e33'
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22121
diff
changeset
|
185 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
186 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
187 * I found these on some website but i don't know that they actually |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
188 * work (or are supposed to work). I didn't implement them yet. |
27193
510f07e1f5c1
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents:
23916
diff
changeset
|
189 * |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
190 * [0;30m ---black |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
191 * [1;37m ---white |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
192 * [0;37m ---tan |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
193 * [0;38m ---light black |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
194 * [1;39m ---dark blue |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
195 * [0;32m ---green |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
196 * [0;33m ---yellow |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
197 * [0;35m ---pink |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
198 * [1;35m ---purple |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
199 * [1;30m ---light blue |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
200 * [0;31m ---red |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
201 * [0;34m ---blue |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
202 * [0;36m ---aqua |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 * (shift+comma)lyellow(shift+period) ---light yellow |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
204 * (shift+comma)lgreen(shift+period) ---light green |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
205 [2;30m <--white out |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
206 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
207 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
208 static GHashTable *ht = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
209 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
210 void yahoo_init_colorht() |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
211 { |
27501
8368e4fb7d3a
Don't double-free the color hash table when deinitializing both prpl-yahoo
Mark Doliner <mark@kingant.net>
parents:
27395
diff
changeset
|
212 if (ht != NULL) |
8368e4fb7d3a
Don't double-free the color hash table when deinitializing both prpl-yahoo
Mark Doliner <mark@kingant.net>
parents:
27395
diff
changeset
|
213 /* Hash table has already been initialized */ |
8368e4fb7d3a
Don't double-free the color hash table when deinitializing both prpl-yahoo
Mark Doliner <mark@kingant.net>
parents:
27395
diff
changeset
|
214 return; |
8368e4fb7d3a
Don't double-free the color hash table when deinitializing both prpl-yahoo
Mark Doliner <mark@kingant.net>
parents:
27395
diff
changeset
|
215 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
216 ht = g_hash_table_new(g_str_hash, g_str_equal); |
27501
8368e4fb7d3a
Don't double-free the color hash table when deinitializing both prpl-yahoo
Mark Doliner <mark@kingant.net>
parents:
27395
diff
changeset
|
217 /* the numbers in comments are what gyach uses, but i think they're incorrect */ |
28116
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
218 #ifdef USE_CSS_FORMATTING |
28087
1b440a47dc04
Change Yahoo to send <span> tags with a color style attribute instead of <font>
Mark Doliner <mark@kingant.net>
parents:
28086
diff
changeset
|
219 g_hash_table_insert(ht, "30", "<span style=\"color: #000000\">"); /* black */ |
1b440a47dc04
Change Yahoo to send <span> tags with a color style attribute instead of <font>
Mark Doliner <mark@kingant.net>
parents:
28086
diff
changeset
|
220 g_hash_table_insert(ht, "31", "<span style=\"color: #0000FF\">"); /* blue */ |
1b440a47dc04
Change Yahoo to send <span> tags with a color style attribute instead of <font>
Mark Doliner <mark@kingant.net>
parents:
28086
diff
changeset
|
221 g_hash_table_insert(ht, "32", "<span style=\"color: #008080\">"); /* cyan */ /* 00b2b2 */ |
1b440a47dc04
Change Yahoo to send <span> tags with a color style attribute instead of <font>
Mark Doliner <mark@kingant.net>
parents:
28086
diff
changeset
|
222 g_hash_table_insert(ht, "33", "<span style=\"color: #808080\">"); /* gray */ /* 808080 */ |
1b440a47dc04
Change Yahoo to send <span> tags with a color style attribute instead of <font>
Mark Doliner <mark@kingant.net>
parents:
28086
diff
changeset
|
223 g_hash_table_insert(ht, "34", "<span style=\"color: #008000\">"); /* green */ /* 00c200 */ |
1b440a47dc04
Change Yahoo to send <span> tags with a color style attribute instead of <font>
Mark Doliner <mark@kingant.net>
parents:
28086
diff
changeset
|
224 g_hash_table_insert(ht, "35", "<span style=\"color: #FF0080\">"); /* pink */ /* ffafaf */ |
1b440a47dc04
Change Yahoo to send <span> tags with a color style attribute instead of <font>
Mark Doliner <mark@kingant.net>
parents:
28086
diff
changeset
|
225 g_hash_table_insert(ht, "36", "<span style=\"color: #800080\">"); /* purple */ /* b200b2 */ |
1b440a47dc04
Change Yahoo to send <span> tags with a color style attribute instead of <font>
Mark Doliner <mark@kingant.net>
parents:
28086
diff
changeset
|
226 g_hash_table_insert(ht, "37", "<span style=\"color: #FF8000\">"); /* orange */ /* ffff00 */ |
1b440a47dc04
Change Yahoo to send <span> tags with a color style attribute instead of <font>
Mark Doliner <mark@kingant.net>
parents:
28086
diff
changeset
|
227 g_hash_table_insert(ht, "38", "<span style=\"color: #FF0000\">"); /* red */ |
1b440a47dc04
Change Yahoo to send <span> tags with a color style attribute instead of <font>
Mark Doliner <mark@kingant.net>
parents:
28086
diff
changeset
|
228 g_hash_table_insert(ht, "39", "<span style=\"color: #808000\">"); /* olive */ /* 546b50 */ |
28116
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
229 #else |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
230 g_hash_table_insert(ht, "30", "<font color=\"#000000\">"); /* black */ |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
231 g_hash_table_insert(ht, "31", "<font color=\"#0000FF\">"); /* blue */ |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
232 g_hash_table_insert(ht, "32", "<font color=\"#008080\">"); /* cyan */ /* 00b2b2 */ |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
233 g_hash_table_insert(ht, "33", "<font color=\"#808080\">"); /* gray */ /* 808080 */ |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
234 g_hash_table_insert(ht, "34", "<font color=\"#008000\">"); /* green */ /* 00c200 */ |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
235 g_hash_table_insert(ht, "35", "<font color=\"#FF0080\">"); /* pink */ /* ffafaf */ |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
236 g_hash_table_insert(ht, "36", "<font color=\"#800080\">"); /* purple */ /* b200b2 */ |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
237 g_hash_table_insert(ht, "37", "<font color=\"#FF8000\">"); /* orange */ /* ffff00 */ |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
238 g_hash_table_insert(ht, "38", "<font color=\"#FF0000\">"); /* red */ |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
239 g_hash_table_insert(ht, "39", "<font color=\"#808000\">"); /* olive */ /* 546b50 */ |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
240 #endif /* !USE_CSS_FORMATTING */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 |
28086
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
28082
diff
changeset
|
242 g_hash_table_insert(ht, "1", "<b>"); |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
28082
diff
changeset
|
243 g_hash_table_insert(ht, "x1", "</b>"); |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
28082
diff
changeset
|
244 g_hash_table_insert(ht, "2", "<i>"); |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
28082
diff
changeset
|
245 g_hash_table_insert(ht, "x2", "</i>"); |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
28082
diff
changeset
|
246 g_hash_table_insert(ht, "4", "<u>"); |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
28082
diff
changeset
|
247 g_hash_table_insert(ht, "x4", "</u>"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
248 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
249 /* these just tell us the text they surround is supposed |
15823 | 250 * to be a link. purple figures that out on its own so we |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
251 * just ignore it. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
252 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
253 g_hash_table_insert(ht, "l", ""); /* link start */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
254 g_hash_table_insert(ht, "xl", ""); /* link end */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
255 |
28116
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
256 #ifdef USE_CSS_FORMATTING |
28087
1b440a47dc04
Change Yahoo to send <span> tags with a color style attribute instead of <font>
Mark Doliner <mark@kingant.net>
parents:
28086
diff
changeset
|
257 g_hash_table_insert(ht, "<black>", "<span style=\"color: #000000\">"); |
1b440a47dc04
Change Yahoo to send <span> tags with a color style attribute instead of <font>
Mark Doliner <mark@kingant.net>
parents:
28086
diff
changeset
|
258 g_hash_table_insert(ht, "<blue>", "<span style=\"color: #0000FF\">"); |
1b440a47dc04
Change Yahoo to send <span> tags with a color style attribute instead of <font>
Mark Doliner <mark@kingant.net>
parents:
28086
diff
changeset
|
259 g_hash_table_insert(ht, "<cyan>", "<span style=\"color: #008284\">"); |
1b440a47dc04
Change Yahoo to send <span> tags with a color style attribute instead of <font>
Mark Doliner <mark@kingant.net>
parents:
28086
diff
changeset
|
260 g_hash_table_insert(ht, "<gray>", "<span style=\"color: #848284\">"); |
1b440a47dc04
Change Yahoo to send <span> tags with a color style attribute instead of <font>
Mark Doliner <mark@kingant.net>
parents:
28086
diff
changeset
|
261 g_hash_table_insert(ht, "<green>", "<span style=\"color: #008200\">"); |
1b440a47dc04
Change Yahoo to send <span> tags with a color style attribute instead of <font>
Mark Doliner <mark@kingant.net>
parents:
28086
diff
changeset
|
262 g_hash_table_insert(ht, "<pink>", "<span style=\"color: #FF0084\">"); |
1b440a47dc04
Change Yahoo to send <span> tags with a color style attribute instead of <font>
Mark Doliner <mark@kingant.net>
parents:
28086
diff
changeset
|
263 g_hash_table_insert(ht, "<purple>", "<span style=\"color: #840084\">"); |
1b440a47dc04
Change Yahoo to send <span> tags with a color style attribute instead of <font>
Mark Doliner <mark@kingant.net>
parents:
28086
diff
changeset
|
264 g_hash_table_insert(ht, "<orange>", "<span style=\"color: #FF8000\">"); |
1b440a47dc04
Change Yahoo to send <span> tags with a color style attribute instead of <font>
Mark Doliner <mark@kingant.net>
parents:
28086
diff
changeset
|
265 g_hash_table_insert(ht, "<red>", "<span style=\"color: #FF0000\">"); |
1b440a47dc04
Change Yahoo to send <span> tags with a color style attribute instead of <font>
Mark Doliner <mark@kingant.net>
parents:
28086
diff
changeset
|
266 g_hash_table_insert(ht, "<yellow>", "<span style=\"color: #848200\">"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
267 |
28087
1b440a47dc04
Change Yahoo to send <span> tags with a color style attribute instead of <font>
Mark Doliner <mark@kingant.net>
parents:
28086
diff
changeset
|
268 g_hash_table_insert(ht, "</black>", "</span>"); |
1b440a47dc04
Change Yahoo to send <span> tags with a color style attribute instead of <font>
Mark Doliner <mark@kingant.net>
parents:
28086
diff
changeset
|
269 g_hash_table_insert(ht, "</blue>", "</span>"); |
1b440a47dc04
Change Yahoo to send <span> tags with a color style attribute instead of <font>
Mark Doliner <mark@kingant.net>
parents:
28086
diff
changeset
|
270 g_hash_table_insert(ht, "</cyan>", "</span>"); |
1b440a47dc04
Change Yahoo to send <span> tags with a color style attribute instead of <font>
Mark Doliner <mark@kingant.net>
parents:
28086
diff
changeset
|
271 g_hash_table_insert(ht, "</gray>", "</span>"); |
1b440a47dc04
Change Yahoo to send <span> tags with a color style attribute instead of <font>
Mark Doliner <mark@kingant.net>
parents:
28086
diff
changeset
|
272 g_hash_table_insert(ht, "</green>", "</span>"); |
1b440a47dc04
Change Yahoo to send <span> tags with a color style attribute instead of <font>
Mark Doliner <mark@kingant.net>
parents:
28086
diff
changeset
|
273 g_hash_table_insert(ht, "</pink>", "</span>"); |
1b440a47dc04
Change Yahoo to send <span> tags with a color style attribute instead of <font>
Mark Doliner <mark@kingant.net>
parents:
28086
diff
changeset
|
274 g_hash_table_insert(ht, "</purple>", "</span>"); |
1b440a47dc04
Change Yahoo to send <span> tags with a color style attribute instead of <font>
Mark Doliner <mark@kingant.net>
parents:
28086
diff
changeset
|
275 g_hash_table_insert(ht, "</orange>", "</span>"); |
1b440a47dc04
Change Yahoo to send <span> tags with a color style attribute instead of <font>
Mark Doliner <mark@kingant.net>
parents:
28086
diff
changeset
|
276 g_hash_table_insert(ht, "</red>", "</span>"); |
1b440a47dc04
Change Yahoo to send <span> tags with a color style attribute instead of <font>
Mark Doliner <mark@kingant.net>
parents:
28086
diff
changeset
|
277 g_hash_table_insert(ht, "</yellow>", "</span>"); |
28116
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
278 #else |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
279 g_hash_table_insert(ht, "<black>", "<font color=\"#000000\">"); |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
280 g_hash_table_insert(ht, "<blue>", "<font color=\"#0000FF\">"); |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
281 g_hash_table_insert(ht, "<cyan>", "<font color=\"#008284\">"); |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
282 g_hash_table_insert(ht, "<gray>", "<font color=\"#848284\">"); |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
283 g_hash_table_insert(ht, "<green>", "<font color=\"#008200\">"); |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
284 g_hash_table_insert(ht, "<pink>", "<font color=\"#FF0084\">"); |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
285 g_hash_table_insert(ht, "<purple>", "<font color=\"#840084\">"); |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
286 g_hash_table_insert(ht, "<orange>", "<font color=\"#FF8000\">"); |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
287 g_hash_table_insert(ht, "<red>", "<font color=\"#FF0000\">"); |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
288 g_hash_table_insert(ht, "<yellow>", "<font color=\"#848200\">"); |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
289 |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
290 g_hash_table_insert(ht, "</black>", "</font>"); |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
291 g_hash_table_insert(ht, "</blue>", "</font>"); |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
292 g_hash_table_insert(ht, "</cyan>", "</font>"); |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
293 g_hash_table_insert(ht, "</gray>", "</font>"); |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
294 g_hash_table_insert(ht, "</green>", "</font>"); |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
295 g_hash_table_insert(ht, "</pink>", "</font>"); |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
296 g_hash_table_insert(ht, "</purple>", "</font>"); |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
297 g_hash_table_insert(ht, "</orange>", "</font>"); |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
298 g_hash_table_insert(ht, "</red>", "</font>"); |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
299 g_hash_table_insert(ht, "</yellow>", "</font>"); |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
300 #endif /* !USE_CSS_FORMATTING */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
301 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
302 /* remove these once we have proper support for <FADE> and <ALT> */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
303 g_hash_table_insert(ht, "</fade>", ""); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
304 g_hash_table_insert(ht, "</alt>", ""); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
305 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
306 /* these are the normal html yahoo sends (besides <font>). |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
307 * anything else will get turned into <tag>, so if I forgot |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
308 * about something, please add it. Why Yahoo! has to send unescaped |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
309 * <'s and >'s that aren't supposed to be html is beyond me. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
310 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
311 g_hash_table_insert(ht, "<b>", "<b>"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
312 g_hash_table_insert(ht, "<i>", "<i>"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
313 g_hash_table_insert(ht, "<u>", "<u>"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
314 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
315 g_hash_table_insert(ht, "</b>", "</b>"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
316 g_hash_table_insert(ht, "</i>", "</i>"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
317 g_hash_table_insert(ht, "</u>", "</u>"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
318 g_hash_table_insert(ht, "</font>", "</font>"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
319 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
320 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
321 void yahoo_dest_colorht() |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
322 { |
27501
8368e4fb7d3a
Don't double-free the color hash table when deinitializing both prpl-yahoo
Mark Doliner <mark@kingant.net>
parents:
27395
diff
changeset
|
323 if (ht == NULL) |
8368e4fb7d3a
Don't double-free the color hash table when deinitializing both prpl-yahoo
Mark Doliner <mark@kingant.net>
parents:
27395
diff
changeset
|
324 /* Hash table has already been destroyed */ |
8368e4fb7d3a
Don't double-free the color hash table when deinitializing both prpl-yahoo
Mark Doliner <mark@kingant.net>
parents:
27395
diff
changeset
|
325 return; |
8368e4fb7d3a
Don't double-free the color hash table when deinitializing both prpl-yahoo
Mark Doliner <mark@kingant.net>
parents:
27395
diff
changeset
|
326 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
327 g_hash_table_destroy(ht); |
27501
8368e4fb7d3a
Don't double-free the color hash table when deinitializing both prpl-yahoo
Mark Doliner <mark@kingant.net>
parents:
27395
diff
changeset
|
328 ht = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
329 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
330 |
28116
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
331 #ifndef USE_CSS_FORMATTING |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
332 static int point_to_html(int x) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
333 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
334 if (x < 9) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
335 return 1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
336 if (x < 11) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
337 return 2; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
338 if (x < 13) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
339 return 3; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
340 if (x < 17) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
341 return 4; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
342 if (x < 25) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
343 return 5; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
344 if (x < 35) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
345 return 6; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
346 return 7; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
347 } |
28116
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
348 #endif /* !USE_CSS_FORMATTING */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
349 |
28116
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
350 /* |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
351 * The Yahoo font size value is given in pt, even thougth the HTML |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
352 * standard for <font size="x"> treats the size as a number on a |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
353 * scale between 1 and 7. Let's get rid of this shoddyness and |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
354 * convert it to CSS. |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
355 */ |
28105
516993d86e72
Stop using a GString when a gchar* will do fine
Mark Doliner <mark@kingant.net>
parents:
28104
diff
changeset
|
356 static void _font_tags_fix_size(const char *tag, GString *dest) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
357 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
358 char *x, *end; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
359 int size; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
360 |
28105
516993d86e72
Stop using a GString when a gchar* will do fine
Mark Doliner <mark@kingant.net>
parents:
28104
diff
changeset
|
361 if (((x = strstr(tag, "size"))) && ((x = strchr(x, '=')))) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
362 while (*x && !g_ascii_isdigit(*x)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
363 x++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
364 if (*x) { |
28116
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
365 #ifndef USE_CSS_FORMATTING |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
366 int htmlsize; |
28116
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
367 #endif /* !USE_CSS_FORMATTING */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
368 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
369 size = strtol(x, &end, 10); |
28116
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
370 |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
371 #ifdef USE_CSS_FORMATTING |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
372 g_string_append_len(dest, tag, x - tag - 7); |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
373 g_string_append(dest, end + 1); |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
374 g_string_append_printf(dest, "<span style=\"font-size: %dpt\">", size); |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
375 #else |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
376 htmlsize = point_to_html(size); |
28105
516993d86e72
Stop using a GString when a gchar* will do fine
Mark Doliner <mark@kingant.net>
parents:
28104
diff
changeset
|
377 g_string_append_len(dest, tag, x - tag); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
378 g_string_append_printf(dest, "%d", htmlsize); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
379 g_string_append_printf(dest, "\" absz=\"%d", size); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
380 g_string_append(dest, end); |
28116
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
381 #endif /* !USE_CSS_FORMATTING */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
382 } else { |
28105
516993d86e72
Stop using a GString when a gchar* will do fine
Mark Doliner <mark@kingant.net>
parents:
28104
diff
changeset
|
383 g_string_append(dest, tag); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
384 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
385 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
386 } else { |
28105
516993d86e72
Stop using a GString when a gchar* will do fine
Mark Doliner <mark@kingant.net>
parents:
28104
diff
changeset
|
387 g_string_append(dest, tag); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
388 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
389 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
390 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
391 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
392 char *yahoo_codes_to_html(const char *x) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
393 { |
28103
8660d8bc467c
Minor optimization when sending and receiving messages on Yahoo: only
Mark Doliner <mark@kingant.net>
parents:
28102
diff
changeset
|
394 size_t x_len; |
28105
516993d86e72
Stop using a GString when a gchar* will do fine
Mark Doliner <mark@kingant.net>
parents:
28104
diff
changeset
|
395 GString *s; |
28103
8660d8bc467c
Minor optimization when sending and receiving messages on Yahoo: only
Mark Doliner <mark@kingant.net>
parents:
28102
diff
changeset
|
396 int i, j; |
28105
516993d86e72
Stop using a GString when a gchar* will do fine
Mark Doliner <mark@kingant.net>
parents:
28104
diff
changeset
|
397 gchar *tmp; |
28108
2b3a9a68e0bc
Of course I got it backwards
Mark Doliner <mark@kingant.net>
parents:
28107
diff
changeset
|
398 gboolean no_more_gt_brackets = FALSE; |
28104
70219821df98
Make match a const char *, and remove two unnecessary casts
Mark Doliner <mark@kingant.net>
parents:
28103
diff
changeset
|
399 const char *match; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
400 |
28103
8660d8bc467c
Minor optimization when sending and receiving messages on Yahoo: only
Mark Doliner <mark@kingant.net>
parents:
28102
diff
changeset
|
401 x_len = strlen(x); |
8660d8bc467c
Minor optimization when sending and receiving messages on Yahoo: only
Mark Doliner <mark@kingant.net>
parents:
28102
diff
changeset
|
402 s = g_string_sized_new(x_len); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
403 |
28103
8660d8bc467c
Minor optimization when sending and receiving messages on Yahoo: only
Mark Doliner <mark@kingant.net>
parents:
28102
diff
changeset
|
404 for (i = 0; i < x_len; i++) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
405 if ((x[i] == 0x1b) && (x[i+1] == '[')) { |
28107 | 406 /* This escape sequence signifies the beginning of some |
407 * text formatting code */ | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
408 j = i + 1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
409 |
28103
8660d8bc467c
Minor optimization when sending and receiving messages on Yahoo: only
Mark Doliner <mark@kingant.net>
parents:
28102
diff
changeset
|
410 while (j++ < x_len) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
411 if (x[j] != 'm') |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
412 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
413 else { |
28105
516993d86e72
Stop using a GString when a gchar* will do fine
Mark Doliner <mark@kingant.net>
parents:
28104
diff
changeset
|
414 /* We've reached the end of the formatting code, yay */ |
516993d86e72
Stop using a GString when a gchar* will do fine
Mark Doliner <mark@kingant.net>
parents:
28104
diff
changeset
|
415 tmp = g_strndup(x + i + 2, j - i - 2); |
516993d86e72
Stop using a GString when a gchar* will do fine
Mark Doliner <mark@kingant.net>
parents:
28104
diff
changeset
|
416 if (tmp[0] == '#') |
28116
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
417 #ifdef USE_CSS_FORMATTING |
28105
516993d86e72
Stop using a GString when a gchar* will do fine
Mark Doliner <mark@kingant.net>
parents:
28104
diff
changeset
|
418 g_string_append_printf(s, "<span style=\"color: %s\">", tmp); |
28116
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
419 #else |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
420 g_string_append_printf(s, "<font color=\"%s\">", tmp); |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
28108
diff
changeset
|
421 #endif /* !USE_CSS_FORMATTING */ |
28105
516993d86e72
Stop using a GString when a gchar* will do fine
Mark Doliner <mark@kingant.net>
parents:
28104
diff
changeset
|
422 else if ((match = g_hash_table_lookup(ht, tmp))) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
423 g_string_append(s, match); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
424 else { |
27384
377e063ecda5
Convert the yahoo prpl to using the debug convenience functions instead of
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27219
diff
changeset
|
425 purple_debug_error("yahoo", |
28105
516993d86e72
Stop using a GString when a gchar* will do fine
Mark Doliner <mark@kingant.net>
parents:
28104
diff
changeset
|
426 "Unknown ansi code 'ESC[%sm'.\n", tmp); |
516993d86e72
Stop using a GString when a gchar* will do fine
Mark Doliner <mark@kingant.net>
parents:
28104
diff
changeset
|
427 g_free(tmp); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
428 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
429 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
430 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
431 i = j; |
28105
516993d86e72
Stop using a GString when a gchar* will do fine
Mark Doliner <mark@kingant.net>
parents:
28104
diff
changeset
|
432 g_free(tmp); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
433 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
434 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
435 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
436 |
28108
2b3a9a68e0bc
Of course I got it backwards
Mark Doliner <mark@kingant.net>
parents:
28107
diff
changeset
|
437 } else if (!no_more_gt_brackets && (x[i] == '<')) { |
28107 | 438 /* The start of an HTML tag */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
439 j = i; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
440 |
28103
8660d8bc467c
Minor optimization when sending and receiving messages on Yahoo: only
Mark Doliner <mark@kingant.net>
parents:
28102
diff
changeset
|
441 while (j++ < x_len) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
442 if (x[j] != '>') |
28103
8660d8bc467c
Minor optimization when sending and receiving messages on Yahoo: only
Mark Doliner <mark@kingant.net>
parents:
28102
diff
changeset
|
443 if (j == x_len) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
444 g_string_append(s, "<"); |
28108
2b3a9a68e0bc
Of course I got it backwards
Mark Doliner <mark@kingant.net>
parents:
28107
diff
changeset
|
445 no_more_gt_brackets = TRUE; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
446 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
447 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
448 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
449 else { |
28105
516993d86e72
Stop using a GString when a gchar* will do fine
Mark Doliner <mark@kingant.net>
parents:
28104
diff
changeset
|
450 tmp = g_strndup(x + i, j - i + 1); |
516993d86e72
Stop using a GString when a gchar* will do fine
Mark Doliner <mark@kingant.net>
parents:
28104
diff
changeset
|
451 g_ascii_strdown(tmp, -1); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
452 |
28105
516993d86e72
Stop using a GString when a gchar* will do fine
Mark Doliner <mark@kingant.net>
parents:
28104
diff
changeset
|
453 if ((match = g_hash_table_lookup(ht, tmp))) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
454 g_string_append(s, match); |
28105
516993d86e72
Stop using a GString when a gchar* will do fine
Mark Doliner <mark@kingant.net>
parents:
28104
diff
changeset
|
455 else if (!strncmp(tmp, "<fade ", 6) || |
516993d86e72
Stop using a GString when a gchar* will do fine
Mark Doliner <mark@kingant.net>
parents:
28104
diff
changeset
|
456 !strncmp(tmp, "<alt ", 5) || |
516993d86e72
Stop using a GString when a gchar* will do fine
Mark Doliner <mark@kingant.net>
parents:
28104
diff
changeset
|
457 !strncmp(tmp, "<snd ", 5)) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
458 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
459 /* remove this if gtkimhtml ever supports any of these */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
460 i = j; |
28105
516993d86e72
Stop using a GString when a gchar* will do fine
Mark Doliner <mark@kingant.net>
parents:
28104
diff
changeset
|
461 g_free(tmp); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
462 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
463 |
28105
516993d86e72
Stop using a GString when a gchar* will do fine
Mark Doliner <mark@kingant.net>
parents:
28104
diff
changeset
|
464 } else if (!strncmp(tmp, "<font ", 6)) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
465 _font_tags_fix_size(tmp, s); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
466 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
467 g_string_append(s, "<"); |
28105
516993d86e72
Stop using a GString when a gchar* will do fine
Mark Doliner <mark@kingant.net>
parents:
28104
diff
changeset
|
468 g_free(tmp); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
469 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
470 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
471 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
472 i = j; |
28105
516993d86e72
Stop using a GString when a gchar* will do fine
Mark Doliner <mark@kingant.net>
parents:
28104
diff
changeset
|
473 g_free(tmp); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
474 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
475 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
476 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
477 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
478 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
479 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
480 if (x[i] == '<') |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
481 g_string_append(s, "<"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
482 else if (x[i] == '>') |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
483 g_string_append(s, ">"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
484 else if (x[i] == '&') |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
485 g_string_append(s, "&"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
486 else if (x[i] == '"') |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
487 g_string_append(s, """); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
488 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
489 g_string_append_c(s, x[i]); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
490 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
491 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
492 |
28080 | 493 purple_debug_misc("yahoo", "yahoo_codes_to_html: Returning string: '%s'.\n", s->str); |
494 return g_string_free(s, FALSE); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
495 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
496 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
497 /* borrowed from gtkimhtml */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
498 #define MAX_FONT_SIZE 7 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
499 #define POINT_SIZE(x) (_point_sizes [MIN ((x > 0 ? x : 1), MAX_FONT_SIZE) - 1]) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
500 static const gint _point_sizes [] = { 8, 10, 12, 14, 20, 30, 40 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
501 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
502 enum fatype { size, color, face, junk }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
503 typedef struct { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
504 enum fatype type; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
505 union { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
506 int size; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
507 char *color; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
508 char *face; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
509 char *junk; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
510 } u; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
511 } fontattr; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
512 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
513 static void fontattr_free(fontattr *f) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
514 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
515 if (f->type == color) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
516 g_free(f->u.color); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
517 else if (f->type == face) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
518 g_free(f->u.face); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
519 g_free(f); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
520 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
521 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
522 static void yahoo_htc_queue_cleanup(GQueue *q) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
523 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
524 char *tmp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
525 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
526 while ((tmp = g_queue_pop_tail(q))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
527 g_free(tmp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
528 g_queue_free(q); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
529 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
530 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
531 static void _parse_font_tag(const char *src, GString *dest, int *i, int *j, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
532 int len, GQueue *colors, GQueue *tags, GQueue *ftattr) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
533 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
534 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
535 int m, n, vstart; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
536 gboolean quote = 0, done = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
537 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
538 m = *j; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
539 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
540 while (1) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
541 m++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
542 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
543 if (m >= len) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
544 g_string_append(dest, &src[*i]); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
545 *i = len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
546 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
547 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
548 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
549 if (src[m] == '=') { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
550 n = vstart = m; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
551 while (1) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
552 n++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
553 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
554 if (n >= len) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
555 m = n; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
556 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
557 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
558 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
559 if (src[n] == '"') { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
560 if (!quote) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
561 quote = 1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
562 vstart = n; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
563 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
564 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
565 done = 1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
566 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
567 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
568 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
569 if (!quote && ((src[n] == ' ') || (src[n] == '>'))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
570 done = 1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
571 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
572 if (done) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
573 if (!g_ascii_strncasecmp(&src[*j+1], "FACE", m - *j - 1)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
574 fontattr *f; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
575 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
576 f = g_new(fontattr, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
577 f->type = face; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
578 f->u.face = g_strndup(&src[vstart+1], n-vstart-1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
579 if (!ftattr) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
580 ftattr = g_queue_new(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
581 g_queue_push_tail(ftattr, f); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
582 m = n; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
583 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
584 } else if (!g_ascii_strncasecmp(&src[*j+1], "SIZE", m - *j - 1)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
585 fontattr *f; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
586 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
587 f = g_new(fontattr, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
588 f->type = size; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
589 f->u.size = POINT_SIZE(strtol(&src[vstart+1], NULL, 10)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
590 if (!ftattr) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
591 ftattr = g_queue_new(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
592 g_queue_push_tail(ftattr, f); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
593 m = n; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
594 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
595 } else if (!g_ascii_strncasecmp(&src[*j+1], "COLOR", m - *j - 1)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
596 fontattr *f; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
597 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
598 f = g_new(fontattr, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
599 f->type = color; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
600 f->u.color = g_strndup(&src[vstart+1], n-vstart-1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
601 if (!ftattr) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
602 ftattr = g_queue_new(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
603 g_queue_push_head(ftattr, f); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
604 m = n; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
605 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
606 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
607 fontattr *f; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
608 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
609 f = g_new(fontattr, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
610 f->type = junk; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
611 f->u.junk = g_strndup(&src[*j+1], n-*j); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
612 if (!ftattr) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
613 ftattr = g_queue_new(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
614 g_queue_push_tail(ftattr, f); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
615 m = n; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
616 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
617 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
618 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
619 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
620 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
621 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
622 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
623 if (src[m] == ' ') |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
624 *j = m; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
625 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
626 if (src[m] == '>') { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
627 gboolean needendtag = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
628 fontattr *f; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
629 GString *tmp = g_string_new(NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
630 char *colorstr; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
631 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
632 if (!g_queue_is_empty(ftattr)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
633 while ((f = g_queue_pop_tail(ftattr))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
634 switch (f->type) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
635 case size: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
636 if (!needendtag) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
637 needendtag = 1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
638 g_string_append(dest, "<font "); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
639 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
640 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
641 g_string_append_printf(dest, "size=\"%d\" ", f->u.size); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
642 fontattr_free(f); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
643 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
644 case face: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
645 if (!needendtag) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
646 needendtag = 1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
647 g_string_append(dest, "<font "); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
648 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
649 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
650 g_string_append_printf(dest, "face=\"%s\" ", f->u.face); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
651 fontattr_free(f); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
652 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
653 case junk: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
654 if (!needendtag) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
655 needendtag = 1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
656 g_string_append(dest, "<font "); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
657 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
658 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
659 g_string_append(dest, f->u.junk); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
660 fontattr_free(f); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
661 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
662 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
663 case color: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
664 if (needendtag) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
665 g_string_append(tmp, "</font>"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
666 dest->str[dest->len-1] = '>'; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
667 needendtag = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
668 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
669 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
670 colorstr = g_queue_peek_tail(colors); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
671 g_string_append(tmp, colorstr ? colorstr : "\033[#000000m"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
672 g_string_append_printf(dest, "\033[%sm", f->u.color); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
673 g_queue_push_tail(colors, g_strdup_printf("\033[%sm", f->u.color)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
674 fontattr_free(f); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
675 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
676 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
677 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
678 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
679 g_queue_free(ftattr); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
680 ftattr = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
681 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
682 if (needendtag) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
683 dest->str[dest->len-1] = '>'; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
684 g_queue_push_tail(tags, g_strdup("</font>")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
685 g_string_free(tmp, TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
686 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
687 g_queue_push_tail(tags, tmp->str); |
28082
a7e9a0a885e9
Oh shit no it wasn't. I have no one to blame but fear itself.
Mark Doliner <mark@kingant.net>
parents:
28081
diff
changeset
|
688 g_string_free(tmp, FALSE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
689 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
690 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
691 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
692 *i = *j = m; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
693 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
694 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
695 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
696 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
697 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
698 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
699 char *yahoo_html_to_codes(const char *src) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
700 { |
28103
8660d8bc467c
Minor optimization when sending and receiving messages on Yahoo: only
Mark Doliner <mark@kingant.net>
parents:
28102
diff
changeset
|
701 GQueue *colors, *tags; |
8660d8bc467c
Minor optimization when sending and receiving messages on Yahoo: only
Mark Doliner <mark@kingant.net>
parents:
28102
diff
changeset
|
702 size_t src_len; |
8660d8bc467c
Minor optimization when sending and receiving messages on Yahoo: only
Mark Doliner <mark@kingant.net>
parents:
28102
diff
changeset
|
703 int i, j; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
704 GString *dest; |
28080 | 705 char *esc; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
706 GQueue *ftattr = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
707 gboolean no_more_specials = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
708 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
709 colors = g_queue_new(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
710 tags = g_queue_new(); |
28103
8660d8bc467c
Minor optimization when sending and receiving messages on Yahoo: only
Mark Doliner <mark@kingant.net>
parents:
28102
diff
changeset
|
711 src_len = strlen(src); |
8660d8bc467c
Minor optimization when sending and receiving messages on Yahoo: only
Mark Doliner <mark@kingant.net>
parents:
28102
diff
changeset
|
712 dest = g_string_sized_new(src_len); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
713 |
28103
8660d8bc467c
Minor optimization when sending and receiving messages on Yahoo: only
Mark Doliner <mark@kingant.net>
parents:
28102
diff
changeset
|
714 for (i = 0; i < src_len; i++) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
715 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
716 if (!no_more_specials && src[i] == '<') { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
717 j = i; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
718 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
719 while (1) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
720 j++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
721 |
28103
8660d8bc467c
Minor optimization when sending and receiving messages on Yahoo: only
Mark Doliner <mark@kingant.net>
parents:
28102
diff
changeset
|
722 if (j >= src_len) { /* no '>' */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
723 g_string_append_c(dest, src[i]); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
724 no_more_specials = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
725 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
726 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
727 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
728 if (src[j] == '<') { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
729 /* FIXME: This doesn't convert outgoing entities. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
730 * However, I suspect this case may never |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
731 * happen anymore because of the entities. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
732 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
733 g_string_append_len(dest, &src[i], j - i); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
734 i = j - 1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
735 if (ftattr) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
736 fontattr *f; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
737 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
738 while ((f = g_queue_pop_head(ftattr))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
739 fontattr_free(f); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
740 g_queue_free(ftattr); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
741 ftattr = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
742 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
743 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
744 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
745 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
746 if (src[j] == ' ') { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
747 if (!g_ascii_strncasecmp(&src[i+1], "BODY", j - i - 1)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
748 char *t = strchr(&src[j], '>'); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
749 if (!t) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
750 g_string_append(dest, &src[i]); |
28103
8660d8bc467c
Minor optimization when sending and receiving messages on Yahoo: only
Mark Doliner <mark@kingant.net>
parents:
28102
diff
changeset
|
751 i = src_len; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
752 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
753 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
754 i = t - src; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
755 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
756 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
757 } else if (!g_ascii_strncasecmp(&src[i+1], "A HREF=\"", j - i - 1)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
758 j += 7; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
759 g_string_append(dest, "\033[lm"); |
28119 | 760 if (purple_str_has_prefix(src + j, "mailto:")) |
761 j += sizeof("mailto:") - 1; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
762 while (1) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
763 g_string_append_c(dest, src[j]); |
28103
8660d8bc467c
Minor optimization when sending and receiving messages on Yahoo: only
Mark Doliner <mark@kingant.net>
parents:
28102
diff
changeset
|
764 if (++j >= src_len) { |
8660d8bc467c
Minor optimization when sending and receiving messages on Yahoo: only
Mark Doliner <mark@kingant.net>
parents:
28102
diff
changeset
|
765 i = src_len; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
766 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
767 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
768 if (src[j] == '"') { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
769 g_string_append(dest, "\033[xlm"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
770 while (1) { |
28103
8660d8bc467c
Minor optimization when sending and receiving messages on Yahoo: only
Mark Doliner <mark@kingant.net>
parents:
28102
diff
changeset
|
771 if (++j >= src_len) { |
8660d8bc467c
Minor optimization when sending and receiving messages on Yahoo: only
Mark Doliner <mark@kingant.net>
parents:
28102
diff
changeset
|
772 i = src_len; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
773 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
774 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
775 if (!g_ascii_strncasecmp(&src[j], "</A>", 4)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
776 j += 3; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
777 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
778 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
779 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
780 i = j; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
781 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
782 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
783 } |
16109
8e61e7be988b
Stop Yahoo sending SPAN tags, fixes Yahoo part of ticket 78
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
784 } else if (!g_ascii_strncasecmp(&src[i+1], "SPAN", j - i - 1)) { /* drop span tags */ |
8e61e7be988b
Stop Yahoo sending SPAN tags, fixes Yahoo part of ticket 78
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
785 while (1) { |
28103
8660d8bc467c
Minor optimization when sending and receiving messages on Yahoo: only
Mark Doliner <mark@kingant.net>
parents:
28102
diff
changeset
|
786 if (++j >= src_len) { |
16109
8e61e7be988b
Stop Yahoo sending SPAN tags, fixes Yahoo part of ticket 78
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
787 g_string_append(dest, &src[i]); |
28103
8660d8bc467c
Minor optimization when sending and receiving messages on Yahoo: only
Mark Doliner <mark@kingant.net>
parents:
28102
diff
changeset
|
788 i = src_len; |
16109
8e61e7be988b
Stop Yahoo sending SPAN tags, fixes Yahoo part of ticket 78
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
789 break; |
8e61e7be988b
Stop Yahoo sending SPAN tags, fixes Yahoo part of ticket 78
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
790 } |
8e61e7be988b
Stop Yahoo sending SPAN tags, fixes Yahoo part of ticket 78
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
791 if (src[j] == '>') { |
8e61e7be988b
Stop Yahoo sending SPAN tags, fixes Yahoo part of ticket 78
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
792 i = j; |
8e61e7be988b
Stop Yahoo sending SPAN tags, fixes Yahoo part of ticket 78
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
793 break; |
8e61e7be988b
Stop Yahoo sending SPAN tags, fixes Yahoo part of ticket 78
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
794 } |
8e61e7be988b
Stop Yahoo sending SPAN tags, fixes Yahoo part of ticket 78
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
795 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
796 } else if (g_ascii_strncasecmp(&src[i+1], "FONT", j - i - 1)) { /* not interested! */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
797 while (1) { |
28103
8660d8bc467c
Minor optimization when sending and receiving messages on Yahoo: only
Mark Doliner <mark@kingant.net>
parents:
28102
diff
changeset
|
798 if (++j >= src_len) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
799 g_string_append(dest, &src[i]); |
28103
8660d8bc467c
Minor optimization when sending and receiving messages on Yahoo: only
Mark Doliner <mark@kingant.net>
parents:
28102
diff
changeset
|
800 i = src_len; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
801 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
802 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
803 if (src[j] == '>') { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
804 g_string_append_len(dest, &src[i], j - i + 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
805 i = j; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
806 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
807 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
808 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
809 } else { /* yay we have a font tag */ |
28103
8660d8bc467c
Minor optimization when sending and receiving messages on Yahoo: only
Mark Doliner <mark@kingant.net>
parents:
28102
diff
changeset
|
810 _parse_font_tag(src, dest, &i, &j, src_len, colors, tags, ftattr); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
811 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
812 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
813 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
814 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
815 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
816 if (src[j] == '>') { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
817 /* This has some problems like the FIXME for the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
818 * '<' case. and like that case, I suspect the case |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
819 * that this has problems is won't happen anymore anyway. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
820 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
821 int sublen = j - i - 1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
822 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
823 if (sublen) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
824 if (!g_ascii_strncasecmp(&src[i+1], "B", sublen)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
825 g_string_append(dest, "\033[1m"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
826 } else if (!g_ascii_strncasecmp(&src[i+1], "/B", sublen)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
827 g_string_append(dest, "\033[x1m"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
828 } else if (!g_ascii_strncasecmp(&src[i+1], "I", sublen)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
829 g_string_append(dest, "\033[2m"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
830 } else if (!g_ascii_strncasecmp(&src[i+1], "/I", sublen)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
831 g_string_append(dest, "\033[x2m"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
832 } else if (!g_ascii_strncasecmp(&src[i+1], "U", sublen)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
833 g_string_append(dest, "\033[4m"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
834 } else if (!g_ascii_strncasecmp(&src[i+1], "/U", sublen)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
835 g_string_append(dest, "\033[x4m"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
836 } else if (!g_ascii_strncasecmp(&src[i+1], "/A", sublen)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
837 g_string_append(dest, "\033[xlm"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
838 } else if (!g_ascii_strncasecmp(&src[i+1], "BR", sublen)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
839 g_string_append_c(dest, '\n'); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
840 } else if (!g_ascii_strncasecmp(&src[i+1], "/BODY", sublen)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
841 /* mmm, </body> tags. *BURP* */ |
16109
8e61e7be988b
Stop Yahoo sending SPAN tags, fixes Yahoo part of ticket 78
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
842 } else if (!g_ascii_strncasecmp(&src[i+1], "/SPAN", sublen)) { |
8e61e7be988b
Stop Yahoo sending SPAN tags, fixes Yahoo part of ticket 78
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
843 /* </span> tags. dangerously close to </spam> */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
844 } else if (!g_ascii_strncasecmp(&src[i+1], "/FONT", sublen) && g_queue_peek_tail(tags)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
845 char *etag, *cl; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
846 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
847 etag = g_queue_pop_tail(tags); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
848 if (etag) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
849 g_string_append(dest, etag); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
850 if (!strcmp(etag, "</font>")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
851 cl = g_queue_pop_tail(colors); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
852 if (cl) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
853 g_free(cl); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
854 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
855 g_free(etag); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
856 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
857 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
858 g_string_append_len(dest, &src[i], j - i + 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
859 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
860 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
861 g_string_append_len(dest, &src[i], j - i + 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
862 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
863 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
864 i = j; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
865 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
866 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
867 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
868 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
869 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
870 } else { |
28103
8660d8bc467c
Minor optimization when sending and receiving messages on Yahoo: only
Mark Doliner <mark@kingant.net>
parents:
28102
diff
changeset
|
871 if (((src_len - i) >= 4) && !strncmp(&src[i], "<", 4)) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
872 g_string_append_c(dest, '<'); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
873 i += 3; |
28103
8660d8bc467c
Minor optimization when sending and receiving messages on Yahoo: only
Mark Doliner <mark@kingant.net>
parents:
28102
diff
changeset
|
874 } else if (((src_len - i) >= 4) && !strncmp(&src[i], ">", 4)) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
875 g_string_append_c(dest, '>'); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
876 i += 3; |
28103
8660d8bc467c
Minor optimization when sending and receiving messages on Yahoo: only
Mark Doliner <mark@kingant.net>
parents:
28102
diff
changeset
|
877 } else if (((src_len - i) >= 5) && !strncmp(&src[i], "&", 5)) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
878 g_string_append_c(dest, '&'); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
879 i += 4; |
28103
8660d8bc467c
Minor optimization when sending and receiving messages on Yahoo: only
Mark Doliner <mark@kingant.net>
parents:
28102
diff
changeset
|
880 } else if (((src_len - i) >= 6) && !strncmp(&src[i], """, 6)) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
881 g_string_append_c(dest, '"'); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
882 i += 5; |
28103
8660d8bc467c
Minor optimization when sending and receiving messages on Yahoo: only
Mark Doliner <mark@kingant.net>
parents:
28102
diff
changeset
|
883 } else if (((src_len - i) >= 6) && !strncmp(&src[i], "'", 6)) { |
21831
543306932d15
Make yahoo_html_to_codes deal with ' in messages being sent. Also correct
Will Thompson <will.thompson@collabora.co.uk>
parents:
19680
diff
changeset
|
884 g_string_append_c(dest, '\''); |
543306932d15
Make yahoo_html_to_codes deal with ' in messages being sent. Also correct
Will Thompson <will.thompson@collabora.co.uk>
parents:
19680
diff
changeset
|
885 i += 5; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
886 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
887 g_string_append_c(dest, src[i]); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
888 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
889 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
890 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
891 |
28080 | 892 esc = g_strescape(dest->str, NULL); |
27384
377e063ecda5
Convert the yahoo prpl to using the debug convenience functions instead of
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27219
diff
changeset
|
893 purple_debug_misc("yahoo", "yahoo_html_to_codes: Returning string: '%s'.\n", esc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
894 g_free(esc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
895 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
896 yahoo_htc_queue_cleanup(colors); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
897 yahoo_htc_queue_cleanup(tags); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
898 |
28080 | 899 return g_string_free(dest, FALSE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
900 } |