Mon, 12 May 2025 20:25:16 -0500
Handle formatting in server messages
Testing Done:
Used the default motd on my local ergo server to verify that formatting was working.
Reviewed at https://reviews.imfreedom.org/r/3991/
|
40564
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
40578
4118acc90778
Fix a small typo.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40564
diff
changeset
|
2 | * Purple - Internet Messaging Library |
|
40564
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * Purple is the legal property of its developers, whose names are too numerous |
|
42594
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42521
diff
changeset
|
6 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
40564
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * source distribution. |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * |
|
42594
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42521
diff
changeset
|
9 | * This library is free software; you can redistribute it and/or modify it |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42521
diff
changeset
|
10 | * under the terms of the GNU General Public License as published by the Free |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42521
diff
changeset
|
11 | * Software Foundation; either version 2 of the License, or (at your option) |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42521
diff
changeset
|
12 | * any later version. |
|
40564
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * |
|
42594
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42521
diff
changeset
|
14 | * This library is distributed in the hope that it will be useful, but WITHOUT |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42521
diff
changeset
|
15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42521
diff
changeset
|
16 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42521
diff
changeset
|
17 | * more details. |
|
40564
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | * |
|
42594
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42521
diff
changeset
|
19 | * You should have received a copy of the GNU General Public License along with |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42521
diff
changeset
|
20 | * this library; if not, see <https://www.gnu.org/licenses/>. |
|
40564
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | #include "purplemarkup.h" |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | #include "util.h" |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | const char * |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | purple_markup_unescape_entity(const char *text, int *length) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | const char *pln; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | int len; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | if (!text || *text != '&') |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | return NULL; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | #define IS_ENTITY(s) (!g_ascii_strncasecmp(text, s, (len = sizeof(s) - 1))) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | if(IS_ENTITY("&")) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | pln = "&"; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | else if(IS_ENTITY("<")) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | pln = "<"; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | else if(IS_ENTITY(">")) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | pln = ">"; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | else if(IS_ENTITY(" ")) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | pln = " "; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | else if(IS_ENTITY("©")) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | pln = "\302\251"; /* or use g_unichar_to_utf8(0xa9); */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | else if(IS_ENTITY(""")) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | pln = "\""; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | else if(IS_ENTITY("®")) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | pln = "\302\256"; /* or use g_unichar_to_utf8(0xae); */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
52 | else if(IS_ENTITY("'")) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | pln = "\'"; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
54 | else if(text[1] == '#' && (g_ascii_isxdigit(text[2]) || text[2] == 'x')) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | static char buf[7]; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | const char *start = text + 2; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | char *end; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | guint64 pound; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | int base = 10; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
60 | int buflen; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | if (*start == 'x') { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | base = 16; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
64 | start++; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
66 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | pound = g_ascii_strtoull(start, &end, base); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
68 | if (pound == 0 || pound > INT_MAX || *end != ';') { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
69 | return NULL; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
70 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | len = (end - text) + 1; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
74 | buflen = g_unichar_to_utf8((gunichar)pound, buf); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | buf[buflen] = '\0'; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
76 | pln = buf; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
77 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
78 | else |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
79 | return NULL; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
80 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
81 | if (length) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
82 | *length = len; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
83 | return pln; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
84 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
85 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
86 | struct purple_parse_tag { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
87 | char *src_tag; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
88 | char *dest_tag; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
89 | gboolean ignore; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | }; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
91 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
92 | /* NOTE: Do not put `do {} while(0)` around this macro (as this is the method |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
93 | recommended in the GCC docs). It contains 'continue's that should |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
94 | affect the while-loop in purple_markup_html_to_xhtml and doing the |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
95 | above would break that. |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
96 | Also, remember to put braces in constructs that require them for |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
97 | multiple statements when using this macro. */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
98 | #define ALLOW_TAG_ALT(x, y) if(!g_ascii_strncasecmp(c, "<" x " ", strlen("<" x " "))) { \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
99 | const char *o = c + strlen("<" x); \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
100 | const char *p = NULL, *q = NULL, *r = NULL; \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
101 | /* o = iterating over full tag \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
102 | * p = > (end of tag) \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
103 | * q = start of quoted bit \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
104 | * r = < inside tag \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
105 | */ \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
106 | GString *innards = g_string_new(""); \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
107 | while(o && *o) { \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
108 | if(!q && (*o == '\"' || *o == '\'') ) { \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
109 | q = o; \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
110 | } else if(q) { \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
111 | if(*o == *q) { /* end of quoted bit */ \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
112 | char *unescaped = g_strndup(q+1, o-q-1); \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
113 | char *escaped = g_markup_escape_text(unescaped, -1); \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
114 | g_string_append_printf(innards, "%c%s%c", *q, escaped, *q); \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
115 | g_free(unescaped); \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
116 | g_free(escaped); \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
117 | q = NULL; \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | } else if(*c == '\\') { \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
119 | o++; \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
120 | } \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
121 | } else if(*o == '<') { \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
122 | r = o; \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
123 | } else if(*o == '>') { \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
124 | p = o; \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
125 | break; \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
126 | } else { \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
127 | innards = g_string_append_c(innards, *o); \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
128 | } \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | o++; \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
130 | } \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
131 | if(p && !r) { /* got an end of tag and no other < earlier */\ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
132 | if(*(p-1) != '/') { \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
133 | struct purple_parse_tag *pt = g_new0(struct purple_parse_tag, 1); \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
134 | pt->src_tag = x; \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
135 | pt->dest_tag = y; \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
136 | tags = g_list_prepend(tags, pt); \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
137 | } \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
138 | if(xhtml) { \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
139 | xhtml = g_string_append(xhtml, "<" y); \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
140 | xhtml = g_string_append(xhtml, innards->str); \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
141 | xhtml = g_string_append_c(xhtml, '>'); \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
142 | } \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
143 | c = p + 1; \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
144 | } else { /* got end of tag with earlier < *or* didn't get anything */ \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
145 | if(xhtml) \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
146 | xhtml = g_string_append(xhtml, "<"); \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
147 | if(plain) \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
148 | plain = g_string_append_c(plain, '<'); \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
149 | c++; \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
150 | } \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
151 | g_string_free(innards, TRUE); \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
152 | continue; \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
153 | } \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
154 | if(!g_ascii_strncasecmp(c, "<" x, strlen("<" x)) && \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
155 | (*(c+strlen("<" x)) == '>' || \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
156 | !g_ascii_strncasecmp(c+strlen("<" x), "/>", 2))) { \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
157 | if(xhtml) \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
158 | xhtml = g_string_append(xhtml, "<" y); \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
159 | c += strlen("<" x); \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
160 | if(*c != '/') { \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
161 | struct purple_parse_tag *pt = g_new0(struct purple_parse_tag, 1); \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
162 | pt->src_tag = x; \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
163 | pt->dest_tag = y; \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
164 | tags = g_list_prepend(tags, pt); \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
165 | if(xhtml) \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
166 | xhtml = g_string_append_c(xhtml, '>'); \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
167 | } else { \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
168 | if(xhtml) \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
169 | xhtml = g_string_append(xhtml, "/>");\ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
170 | } \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
171 | c = strchr(c, '>') + 1; \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
172 | continue; \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
173 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
174 | /* Don't forget to check the note above for ALLOW_TAG_ALT. */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
175 | #define ALLOW_TAG(x) ALLOW_TAG_ALT(x, x) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
176 | void |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
177 | purple_markup_html_to_xhtml(const char *html, char **xhtml_out, |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
178 | char **plain_out) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
179 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
180 | GString *xhtml = NULL; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
181 | GString *plain = NULL; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
182 | GString *url = NULL; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
183 | GString *cdata = NULL; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
184 | GList *tags = NULL, *tag; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
185 | const char *c = html; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
186 | char quote = '\0'; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
187 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
188 | #define CHECK_QUOTE(ptr) if (*(ptr) == '\'' || *(ptr) == '\"') \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
189 | quote = *(ptr++); \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
190 | else \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
191 | quote = '\0'; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
192 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
193 | #define VALID_CHAR(ptr) (*(ptr) && *(ptr) != quote && (quote || (*(ptr) != ' ' && *(ptr) != '>'))) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
194 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
195 | g_return_if_fail(xhtml_out != NULL || plain_out != NULL); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
196 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
197 | if(xhtml_out) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
198 | xhtml = g_string_new(""); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
199 | if(plain_out) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
200 | plain = g_string_new(""); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
201 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
202 | while(c && *c) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
203 | if(*c == '<') { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
204 | if(*(c+1) == '/') { /* closing tag */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
205 | tag = tags; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
206 | while(tag) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
207 | struct purple_parse_tag *pt = tag->data; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
208 | if(!g_ascii_strncasecmp((c+2), pt->src_tag, strlen(pt->src_tag)) && *(c+strlen(pt->src_tag)+2) == '>') { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
209 | c += strlen(pt->src_tag) + 3; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
210 | break; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
211 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
212 | tag = tag->next; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
213 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
214 | if(tag) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
215 | while(tags) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
216 | struct purple_parse_tag *pt = tags->data; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
217 | if(xhtml && !pt->ignore) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
218 | g_string_append_printf(xhtml, "</%s>", pt->dest_tag); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
219 | if(plain && purple_strequal(pt->src_tag, "a")) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
220 | /* if this is a link, we have to add the url to the plaintext, too */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
221 | if (cdata && url && |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
222 | (!g_string_equal(cdata, url) && (g_ascii_strncasecmp(url->str, "mailto:", 7) != 0 || |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
223 | g_utf8_collate(url->str + 7, cdata->str) != 0))) |
|
42181
a39305511805
Fix leaks in purple markup
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
224 | { |
|
a39305511805
Fix leaks in purple markup
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
225 | char *unescaped = purple_unescape_html(url->str); |
|
a39305511805
Fix leaks in purple markup
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
226 | g_string_append_printf(plain, " <%s>", |
|
a39305511805
Fix leaks in purple markup
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
227 | g_strstrip(unescaped)); |
|
a39305511805
Fix leaks in purple markup
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
228 | g_free(unescaped); |
|
a39305511805
Fix leaks in purple markup
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
229 | } |
|
40564
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
230 | if (cdata) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
231 | g_string_free(cdata, TRUE); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
232 | cdata = NULL; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
233 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
234 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
235 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
236 | if(tags == tag) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
237 | break; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
238 | tags = g_list_delete_link(tags, tags); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
239 | g_free(pt); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
240 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
241 | g_free(tag->data); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
242 | tags = g_list_delete_link(tags, tag); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
243 | } else { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
244 | /* a closing tag we weren't expecting... |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
245 | * we'll let it slide, if it's really a tag...if it's |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
246 | * just a </ we'll escape it properly */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
247 | const char *end = c+2; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
248 | while(*end && g_ascii_isalpha(*end)) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
249 | end++; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
250 | if(*end == '>') { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
251 | c = end+1; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
252 | } else { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
253 | if(xhtml) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
254 | xhtml = g_string_append(xhtml, "<"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
255 | if(plain) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
256 | plain = g_string_append_c(plain, '<'); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
257 | c++; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
258 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
259 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
260 | } else { /* opening tag */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
261 | ALLOW_TAG("blockquote"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
262 | ALLOW_TAG("cite"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
263 | ALLOW_TAG("div"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
264 | ALLOW_TAG("em"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
265 | ALLOW_TAG("h1"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
266 | ALLOW_TAG("h2"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
267 | ALLOW_TAG("h3"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
268 | ALLOW_TAG("h4"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
269 | ALLOW_TAG("h5"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
270 | ALLOW_TAG("h6"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
271 | /* we only allow html to start the message */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
272 | if(c == html) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
273 | ALLOW_TAG("html"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
274 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
275 | ALLOW_TAG_ALT("i", "em"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
276 | ALLOW_TAG_ALT("italic", "em"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
277 | ALLOW_TAG("li"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
278 | ALLOW_TAG("ol"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
279 | ALLOW_TAG("p"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
280 | ALLOW_TAG("pre"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
281 | ALLOW_TAG("q"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
282 | ALLOW_TAG("span"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
283 | ALLOW_TAG("ul"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
284 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
285 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
286 | /* we skip <HR> because it's not legal in XHTML-IM. However, |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
287 | * we still want to send something sensible, so we put a |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
288 | * linebreak in its place. <BR> also needs special handling |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
289 | * because putting a </BR> to close it would just be dumb. */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
290 | if((!g_ascii_strncasecmp(c, "<br", 3) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
291 | || !g_ascii_strncasecmp(c, "<hr", 3)) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
292 | && (*(c+3) == '>' || |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
293 | !g_ascii_strncasecmp(c+3, "/>", 2) || |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
294 | !g_ascii_strncasecmp(c+3, " />", 3))) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
295 | c = strchr(c, '>') + 1; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
296 | if(xhtml) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
297 | xhtml = g_string_append(xhtml, "<br/>"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
298 | if(plain && *c != '\n') |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
299 | plain = g_string_append_c(plain, '\n'); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
300 | continue; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
301 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
302 | if(!g_ascii_strncasecmp(c, "<b>", 3) || !g_ascii_strncasecmp(c, "<bold>", strlen("<bold>")) || !g_ascii_strncasecmp(c, "<strong>", strlen("<strong>"))) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
303 | struct purple_parse_tag *pt = g_new0(struct purple_parse_tag, 1); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
304 | if (*(c+2) == '>') |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
305 | pt->src_tag = "b"; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
306 | else if (*(c+2) == 'o') |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
307 | pt->src_tag = "bold"; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
308 | else |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
309 | pt->src_tag = "strong"; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
310 | pt->dest_tag = "span"; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
311 | tags = g_list_prepend(tags, pt); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
312 | c = strchr(c, '>') + 1; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
313 | if(xhtml) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
314 | xhtml = g_string_append(xhtml, "<span style='font-weight: bold;'>"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
315 | continue; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
316 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
317 | if(!g_ascii_strncasecmp(c, "<u>", 3) || !g_ascii_strncasecmp(c, "<underline>", strlen("<underline>"))) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
318 | struct purple_parse_tag *pt = g_new0(struct purple_parse_tag, 1); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
319 | pt->src_tag = *(c+2) == '>' ? "u" : "underline"; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
320 | pt->dest_tag = "span"; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
321 | tags = g_list_prepend(tags, pt); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
322 | c = strchr(c, '>') + 1; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
323 | if (xhtml) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
324 | xhtml = g_string_append(xhtml, "<span style='text-decoration: underline;'>"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
325 | continue; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
326 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
327 | if(!g_ascii_strncasecmp(c, "<s>", 3) || !g_ascii_strncasecmp(c, "<strike>", strlen("<strike>"))) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
328 | struct purple_parse_tag *pt = g_new0(struct purple_parse_tag, 1); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
329 | pt->src_tag = *(c+2) == '>' ? "s" : "strike"; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
330 | pt->dest_tag = "span"; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
331 | tags = g_list_prepend(tags, pt); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
332 | c = strchr(c, '>') + 1; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
333 | if(xhtml) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
334 | xhtml = g_string_append(xhtml, "<span style='text-decoration: line-through;'>"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
335 | continue; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
336 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
337 | if(!g_ascii_strncasecmp(c, "<sub>", 5)) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
338 | struct purple_parse_tag *pt = g_new0(struct purple_parse_tag, 1); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
339 | pt->src_tag = "sub"; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
340 | pt->dest_tag = "span"; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
341 | tags = g_list_prepend(tags, pt); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
342 | c = strchr(c, '>') + 1; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
343 | if(xhtml) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
344 | xhtml = g_string_append(xhtml, "<span style='vertical-align:sub;'>"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
345 | continue; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
346 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
347 | if(!g_ascii_strncasecmp(c, "<sup>", 5)) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
348 | struct purple_parse_tag *pt = g_new0(struct purple_parse_tag, 1); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
349 | pt->src_tag = "sup"; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
350 | pt->dest_tag = "span"; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
351 | tags = g_list_prepend(tags, pt); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
352 | c = strchr(c, '>') + 1; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
353 | if(xhtml) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
354 | xhtml = g_string_append(xhtml, "<span style='vertical-align:super;'>"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
355 | continue; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
356 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
357 | if (!g_ascii_strncasecmp(c, "<img", 4) && (*(c+4) == '>' || *(c+4) == ' ')) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
358 | const char *p = c + 4; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
359 | GString *src = NULL, *alt = NULL; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
360 | #define ESCAPE(from, to) \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
361 | CHECK_QUOTE(from); \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
362 | while (VALID_CHAR(from)) { \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
363 | int len; \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
364 | if ((*from == '&') && (purple_markup_unescape_entity(from, &len) == NULL)) \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
365 | to = g_string_append(to, "&"); \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
366 | else if (*from == '\'') \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
367 | to = g_string_append(to, "'"); \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
368 | else \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
369 | to = g_string_append_c(to, *from); \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
370 | from++; \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
371 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
372 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
373 | while (*p && *p != '>') { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
374 | if (!g_ascii_strncasecmp(p, "src=", 4)) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
375 | const char *q = p + 4; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
376 | if (src) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
377 | g_string_free(src, TRUE); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
378 | src = g_string_new(""); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
379 | ESCAPE(q, src); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
380 | p = q; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
381 | } else if (!g_ascii_strncasecmp(p, "alt=", 4)) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
382 | const char *q = p + 4; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
383 | if (alt) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
384 | g_string_free(alt, TRUE); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
385 | alt = g_string_new(""); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
386 | ESCAPE(q, alt); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
387 | p = q; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
388 | } else { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
389 | p++; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
390 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
391 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
392 | #undef ESCAPE |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
393 | if ((c = strchr(p, '>')) != NULL) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
394 | c++; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
395 | else |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
396 | c = p; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
397 | /* src and alt are required! */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
398 | if(src && xhtml) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
399 | g_string_append_printf(xhtml, "<img src='%s' alt='%s' />", g_strstrip(src->str), alt ? alt->str : ""); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
400 | if(alt) { |
|
42181
a39305511805
Fix leaks in purple markup
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
401 | if(plain) { |
|
a39305511805
Fix leaks in purple markup
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
402 | char *unescaped = purple_unescape_html(alt->str); |
|
a39305511805
Fix leaks in purple markup
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
403 | plain = g_string_append(plain, unescaped); |
|
a39305511805
Fix leaks in purple markup
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
404 | g_free(unescaped); |
|
a39305511805
Fix leaks in purple markup
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
405 | } |
|
a39305511805
Fix leaks in purple markup
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
406 | if(!src && xhtml) { |
|
40564
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
407 | xhtml = g_string_append(xhtml, alt->str); |
|
42181
a39305511805
Fix leaks in purple markup
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
408 | } |
|
40564
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
409 | g_string_free(alt, TRUE); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
410 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
411 | g_string_free(src, TRUE); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
412 | continue; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
413 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
414 | if (!g_ascii_strncasecmp(c, "<a", 2) && (*(c+2) == '>' || *(c+2) == ' ')) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
415 | const char *p = c + 2; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
416 | struct purple_parse_tag *pt; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
417 | while (*p && *p != '>') { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
418 | if (!g_ascii_strncasecmp(p, "href=", 5)) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
419 | const char *q = p + 5; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
420 | if (url) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
421 | g_string_free(url, TRUE); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
422 | url = g_string_new(""); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
423 | if (cdata) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
424 | g_string_free(cdata, TRUE); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
425 | cdata = g_string_new(""); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
426 | CHECK_QUOTE(q); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
427 | while (VALID_CHAR(q)) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
428 | int len; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
429 | if ((*q == '&') && (purple_markup_unescape_entity(q, &len) == NULL)) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
430 | url = g_string_append(url, "&"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
431 | else if (*q == '"') |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
432 | url = g_string_append(url, """); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
433 | else |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
434 | url = g_string_append_c(url, *q); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
435 | q++; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
436 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
437 | p = q; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
438 | } else { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
439 | p++; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
440 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
441 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
442 | if ((c = strchr(p, '>')) != NULL) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
443 | c++; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
444 | else |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
445 | c = p; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
446 | pt = g_new0(struct purple_parse_tag, 1); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
447 | pt->src_tag = "a"; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
448 | pt->dest_tag = "a"; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
449 | tags = g_list_prepend(tags, pt); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
450 | if(xhtml) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
451 | g_string_append_printf(xhtml, "<a href=\"%s\">", url ? g_strstrip(url->str) : ""); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
452 | continue; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
453 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
454 | #define ESCAPE(from, to) \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
455 | CHECK_QUOTE(from); \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
456 | while (VALID_CHAR(from)) { \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
457 | int len; \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
458 | if ((*from == '&') && (purple_markup_unescape_entity(from, &len) == NULL)) \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
459 | to = g_string_append(to, "&"); \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
460 | else if (*from == '\'') \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
461 | to = g_string_append_c(to, '\"'); \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
462 | else \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
463 | to = g_string_append_c(to, *from); \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
464 | from++; \ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
465 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
466 | if(!g_ascii_strncasecmp(c, "<font", 5) && (*(c+5) == '>' || *(c+5) == ' ')) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
467 | const char *p = c + 5; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
468 | GString *style = g_string_new(""); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
469 | struct purple_parse_tag *pt; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
470 | while (*p && *p != '>') { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
471 | if (!g_ascii_strncasecmp(p, "back=", 5)) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
472 | const char *q = p + 5; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
473 | GString *color = g_string_new(""); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
474 | ESCAPE(q, color); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
475 | g_string_append_printf(style, "background: %s; ", color->str); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
476 | g_string_free(color, TRUE); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
477 | p = q; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
478 | } else if (!g_ascii_strncasecmp(p, "color=", 6)) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
479 | const char *q = p + 6; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
480 | GString *color = g_string_new(""); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
481 | ESCAPE(q, color); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
482 | g_string_append_printf(style, "color: %s; ", color->str); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
483 | g_string_free(color, TRUE); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
484 | p = q; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
485 | } else if (!g_ascii_strncasecmp(p, "face=", 5)) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
486 | const char *q = p + 5; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
487 | GString *face = g_string_new(""); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
488 | ESCAPE(q, face); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
489 | g_string_append_printf(style, "font-family: %s; ", g_strstrip(face->str)); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
490 | g_string_free(face, TRUE); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
491 | p = q; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
492 | } else if (!g_ascii_strncasecmp(p, "size=", 5)) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
493 | const char *q = p + 5; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
494 | int sz; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
495 | const char *size = "medium"; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
496 | CHECK_QUOTE(q); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
497 | sz = atoi(q); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
498 | switch (sz) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
499 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
500 | case 1: |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
501 | size = "xx-small"; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
502 | break; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
503 | case 2: |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
504 | size = "small"; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
505 | break; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
506 | case 3: |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
507 | size = "medium"; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
508 | break; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
509 | case 4: |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
510 | size = "large"; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
511 | break; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
512 | case 5: |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
513 | size = "x-large"; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
514 | break; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
515 | case 6: |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
516 | case 7: |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
517 | size = "xx-large"; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
518 | break; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
519 | default: |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
520 | break; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
521 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
522 | g_string_append_printf(style, "font-size: %s; ", size); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
523 | p = q; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
524 | } else { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
525 | p++; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
526 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
527 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
528 | if ((c = strchr(p, '>')) != NULL) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
529 | c++; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
530 | else |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
531 | c = p; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
532 | pt = g_new0(struct purple_parse_tag, 1); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
533 | pt->src_tag = "font"; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
534 | pt->dest_tag = "span"; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
535 | tags = g_list_prepend(tags, pt); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
536 | if(style->len && xhtml) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
537 | g_string_append_printf(xhtml, "<span style='%s'>", g_strstrip(style->str)); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
538 | else |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
539 | pt->ignore = TRUE; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
540 | g_string_free(style, TRUE); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
541 | continue; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
542 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
543 | #undef ESCAPE |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
544 | if (!g_ascii_strncasecmp(c, "<body ", 6)) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
545 | const char *p = c + 6; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
546 | gboolean did_something = FALSE; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
547 | while (*p && *p != '>') { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
548 | if (!g_ascii_strncasecmp(p, "bgcolor=", 8)) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
549 | const char *q = p + 8; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
550 | struct purple_parse_tag *pt = g_new0(struct purple_parse_tag, 1); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
551 | GString *color = g_string_new(""); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
552 | CHECK_QUOTE(q); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
553 | while (VALID_CHAR(q)) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
554 | color = g_string_append_c(color, *q); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
555 | q++; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
556 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
557 | if (xhtml) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
558 | g_string_append_printf(xhtml, "<span style='background: %s;'>", g_strstrip(color->str)); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
559 | g_string_free(color, TRUE); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
560 | if ((c = strchr(p, '>')) != NULL) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
561 | c++; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
562 | else |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
563 | c = p; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
564 | pt->src_tag = "body"; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
565 | pt->dest_tag = "span"; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
566 | tags = g_list_prepend(tags, pt); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
567 | did_something = TRUE; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
568 | break; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
569 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
570 | p++; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
571 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
572 | if (did_something) continue; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
573 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
574 | /* this has to come after the special case for bgcolor */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
575 | ALLOW_TAG("body"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
576 | if(!g_ascii_strncasecmp(c, "<!--", strlen("<!--"))) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
577 | char *p = strstr(c + strlen("<!--"), "-->"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
578 | if(p) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
579 | if(xhtml) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
580 | xhtml = g_string_append(xhtml, "<!--"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
581 | c += strlen("<!--"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
582 | continue; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
583 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
584 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
585 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
586 | if(xhtml) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
587 | xhtml = g_string_append(xhtml, "<"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
588 | if(plain) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
589 | plain = g_string_append_c(plain, '<'); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
590 | c++; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
591 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
592 | } else if(*c == '&') { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
593 | char buf[7]; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
594 | const char *pln; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
595 | int len; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
596 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
597 | if ((pln = purple_markup_unescape_entity(c, &len)) == NULL) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
598 | len = 1; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
599 | g_snprintf(buf, sizeof(buf), "%c", *c); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
600 | pln = buf; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
601 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
602 | if(xhtml) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
603 | xhtml = g_string_append_len(xhtml, c, len); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
604 | if(plain) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
605 | plain = g_string_append(plain, pln); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
606 | if(cdata) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
607 | cdata = g_string_append_len(cdata, c, len); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
608 | c += len; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
609 | } else { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
610 | if(xhtml) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
611 | xhtml = g_string_append_c(xhtml, *c); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
612 | if(plain) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
613 | plain = g_string_append_c(plain, *c); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
614 | if(cdata) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
615 | cdata = g_string_append_c(cdata, *c); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
616 | c++; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
617 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
618 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
619 | if(xhtml) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
620 | for (tag = tags; tag ; tag = tag->next) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
621 | struct purple_parse_tag *pt = tag->data; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
622 | if(!pt->ignore) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
623 | g_string_append_printf(xhtml, "</%s>", pt->dest_tag); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
624 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
625 | } |
|
42181
a39305511805
Fix leaks in purple markup
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
626 | g_clear_list(&tags, g_free); |
|
40564
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
627 | if(xhtml_out) |
|
43123
4d3b58b6cf06
Use g_string_free_and_steal
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43106
diff
changeset
|
628 | *xhtml_out = g_string_free_and_steal(xhtml); |
|
40564
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
629 | if(plain_out) |
|
43123
4d3b58b6cf06
Use g_string_free_and_steal
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43106
diff
changeset
|
630 | *plain_out = g_string_free_and_steal(plain); |
|
40564
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
631 | if(url) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
632 | g_string_free(url, TRUE); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
633 | if (cdata) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
634 | g_string_free(cdata, TRUE); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
635 | #undef CHECK_QUOTE |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
636 | #undef VALID_CHAR |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
637 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
638 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
639 | /* The following are probably reasonable changes: |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
640 | * - \n should be converted to a normal space |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
641 | * - in addition to <br>, <p> and <div> etc. should also be converted into \n |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
642 | * - We want to turn </td>#whitespace<td> sequences into a single tab |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
643 | * - We want to turn </tr>#whitespace<tr> sequences into a single \n |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
644 | * - <script>...</script> and <style>...</style> should be completely removed |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
645 | */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
646 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
647 | char * |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
648 | purple_markup_strip_html(const char *str) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
649 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
650 | int i, j, k, entlen; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
651 | gboolean visible = TRUE; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
652 | gboolean closing_td_p = FALSE; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
653 | gchar *str2; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
654 | const gchar *cdata_close_tag = NULL, *ent; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
655 | gchar *href = NULL; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
656 | int href_st = 0; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
657 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
658 | if(!str) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
659 | return NULL; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
660 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
661 | str2 = g_strdup(str); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
662 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
663 | for (i = 0, j = 0; str2[i]; i++) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
664 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
665 | if (str2[i] == '<') |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
666 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
667 | if (cdata_close_tag) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
668 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
669 | /* Note: Don't even assume any other tag is a tag in CDATA */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
670 | if (g_ascii_strncasecmp(str2 + i, cdata_close_tag, |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
671 | strlen(cdata_close_tag)) == 0) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
672 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
673 | i += strlen(cdata_close_tag) - 1; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
674 | cdata_close_tag = NULL; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
675 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
676 | continue; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
677 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
678 | else if (g_ascii_strncasecmp(str2 + i, "<td", 3) == 0 && closing_td_p) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
679 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
680 | str2[j++] = '\t'; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
681 | visible = TRUE; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
682 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
683 | else if (g_ascii_strncasecmp(str2 + i, "</td>", 5) == 0) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
684 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
685 | closing_td_p = TRUE; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
686 | visible = FALSE; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
687 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
688 | else |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
689 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
690 | closing_td_p = FALSE; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
691 | visible = TRUE; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
692 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
693 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
694 | k = i + 1; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
695 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
696 | if(g_ascii_isspace(str2[k])) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
697 | visible = TRUE; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
698 | else if (str2[k]) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
699 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
700 | /* Scan until we end the tag either implicitly (closed start |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
701 | * tag) or explicitly, using a sloppy method (i.e., < or > |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
702 | * inside quoted attributes will screw us up) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
703 | */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
704 | while (str2[k] && str2[k] != '<' && str2[k] != '>') |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
705 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
706 | k++; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
707 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
708 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
709 | /* If we've got an <a> tag with an href, save the address |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
710 | * to print later. */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
711 | if (g_ascii_strncasecmp(str2 + i, "<a", 2) == 0 && |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
712 | g_ascii_isspace(str2[i+2])) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
713 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
714 | int st; /* start of href, inclusive [ */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
715 | int end; /* end of href, exclusive ) */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
716 | char delim = ' '; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
717 | /* Find start of href */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
718 | for (st = i + 3; st < k; st++) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
719 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
720 | if (g_ascii_strncasecmp(str2+st, "href=", 5) == 0) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
721 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
722 | st += 5; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
723 | if (str2[st] == '"' || str2[st] == '\'') |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
724 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
725 | delim = str2[st]; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
726 | st++; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
727 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
728 | break; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
729 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
730 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
731 | /* find end of address */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
732 | for (end = st; end < k && str2[end] != delim; end++) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
733 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
734 | /* All the work is done in the loop construct above. */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
735 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
736 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
737 | /* If there's an address, save it. If there was |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
738 | * already one saved, kill it. */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
739 | if (st < k) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
740 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
741 | char *tmp; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
742 | g_free(href); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
743 | tmp = g_strndup(str2 + st, end - st); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
744 | href = purple_unescape_html(tmp); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
745 | g_free(tmp); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
746 | href_st = j; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
747 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
748 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
749 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
750 | /* Replace </a> with an ascii representation of the |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
751 | * address the link was pointing to. */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
752 | else if (href != NULL && g_ascii_strncasecmp(str2 + i, "</a>", 4) == 0) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
753 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
754 | size_t hrlen = strlen(href); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
755 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
756 | /* Only insert the href if it's different from the CDATA. */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
757 | if ((hrlen != (gsize)(j - href_st) || |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
758 | strncmp(str2 + href_st, href, hrlen)) && |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
759 | (hrlen != (gsize)(j - href_st + 7) || /* 7 == strlen("http://") */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
760 | strncmp(str2 + href_st, href + 7, hrlen - 7))) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
761 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
762 | str2[j++] = ' '; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
763 | str2[j++] = '('; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
764 | memmove(str2 + j, href, hrlen); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
765 | j += hrlen; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
766 | str2[j++] = ')'; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
767 | g_free(href); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
768 | href = NULL; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
769 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
770 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
771 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
772 | /* Check for tags which should be mapped to newline (but ignore some of |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
773 | * the tags at the beginning of the text) */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
774 | else if ((j && (g_ascii_strncasecmp(str2 + i, "<p>", 3) == 0 |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
775 | || g_ascii_strncasecmp(str2 + i, "<tr", 3) == 0 |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
776 | || g_ascii_strncasecmp(str2 + i, "<hr", 3) == 0 |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
777 | || g_ascii_strncasecmp(str2 + i, "<li", 3) == 0 |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
778 | || g_ascii_strncasecmp(str2 + i, "<div", 4) == 0)) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
779 | || g_ascii_strncasecmp(str2 + i, "<br", 3) == 0 |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
780 | || g_ascii_strncasecmp(str2 + i, "</table>", 8) == 0) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
781 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
782 | str2[j++] = '\n'; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
783 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
784 | /* Check for tags which begin CDATA and need to be closed */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
785 | else if (g_ascii_strncasecmp(str2 + i, "<script", 7) == 0) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
786 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
787 | cdata_close_tag = "</script>"; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
788 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
789 | else if (g_ascii_strncasecmp(str2 + i, "<style", 6) == 0) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
790 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
791 | cdata_close_tag = "</style>"; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
792 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
793 | /* Update the index and continue checking after the tag */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
794 | i = (str2[k] == '<' || str2[k] == '\0')? k - 1: k; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
795 | continue; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
796 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
797 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
798 | else if (cdata_close_tag) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
799 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
800 | continue; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
801 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
802 | else if (!g_ascii_isspace(str2[i])) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
803 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
804 | visible = TRUE; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
805 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
806 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
807 | if (str2[i] == '&' && (ent = purple_markup_unescape_entity(str2 + i, &entlen)) != NULL) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
808 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
809 | while (*ent) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
810 | str2[j++] = *ent++; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
811 | i += entlen - 1; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
812 | continue; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
813 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
814 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
815 | if (visible) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
816 | str2[j++] = g_ascii_isspace(str2[i])? ' ': str2[i]; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
817 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
818 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
819 | g_free(href); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
820 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
821 | str2[j] = '\0'; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
822 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
823 | return str2; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
824 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
825 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
826 | static gboolean |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
827 | badchar(char c) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
828 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
829 | switch (c) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
830 | case ' ': |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
831 | case ',': |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
832 | case '\0': |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
833 | case '\n': |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
834 | case '\r': |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
835 | case '<': |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
836 | case '>': |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
837 | case '"': |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
838 | return TRUE; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
839 | default: |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
840 | return FALSE; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
841 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
842 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
843 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
844 | static gboolean |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
845 | badentity(const char *c) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
846 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
847 | if (!g_ascii_strncasecmp(c, "<", 4) || |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
848 | !g_ascii_strncasecmp(c, ">", 4) || |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
849 | !g_ascii_strncasecmp(c, """, 6)) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
850 | return TRUE; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
851 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
852 | return FALSE; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
853 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
854 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
855 | static const char * |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
856 | process_link(GString *ret, |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
857 | const char *start, const char *c, |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
858 | int matchlen, |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
859 | const char *urlprefix, |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
860 | int inside_paren) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
861 | { |
|
43106
7cd7744de3bc
Don't unescape html in purple_markup_linkify
Gary Kramlich <grim@reaperworld.com>
parents:
42594
diff
changeset
|
862 | char *url_buf = NULL; |
|
40564
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
863 | const char *t; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
864 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
865 | for (t = c;; t++) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
866 | if (!badchar(*t) && !badentity(t)) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
867 | continue; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
868 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
869 | if (t - c == matchlen) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
870 | break; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
871 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
872 | if (*t == ',' && *(t + 1) != ' ') { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
873 | continue; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
874 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
875 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
876 | if (t > start && *(t - 1) == '.') |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
877 | t--; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
878 | if (t > start && *(t - 1) == ')' && inside_paren > 0) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
879 | t--; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
880 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
881 | url_buf = g_strndup(c, t - c); |
|
42521
a8e758b503eb
Simplify PidginInfoPane by using bindings everywhere
Gary Kramlich <grim@reaperworld.com>
parents:
42181
diff
changeset
|
882 | g_string_append_printf(ret, "<a href=\"%s%s\">%s</a>", |
|
40564
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
883 | urlprefix, |
|
43106
7cd7744de3bc
Don't unescape html in purple_markup_linkify
Gary Kramlich <grim@reaperworld.com>
parents:
42594
diff
changeset
|
884 | url_buf, url_buf); |
|
40564
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
885 | g_free(url_buf); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
886 | return t; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
887 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
888 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
889 | return c; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
890 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
891 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
892 | char * |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
893 | purple_markup_linkify(const char *text) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
894 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
895 | const char *c, *t, *q = NULL; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
896 | char *tmpurlbuf, *url_buf; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
897 | gunichar g; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
898 | gboolean inside_html = FALSE; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
899 | int inside_paren = 0; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
900 | GString *ret; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
901 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
902 | if (text == NULL) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
903 | return NULL; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
904 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
905 | ret = g_string_new(""); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
906 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
907 | c = text; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
908 | while (*c) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
909 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
910 | if(*c == '(' && !inside_html) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
911 | inside_paren++; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
912 | ret = g_string_append_c(ret, *c); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
913 | c++; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
914 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
915 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
916 | if(inside_html) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
917 | if(*c == '>') { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
918 | inside_html = FALSE; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
919 | } else if(!q && (*c == '\"' || *c == '\'')) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
920 | q = c; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
921 | } else if(q) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
922 | if(*c == *q) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
923 | q = NULL; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
924 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
925 | } else if(*c == '<') { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
926 | inside_html = TRUE; |
|
42521
a8e758b503eb
Simplify PidginInfoPane by using bindings everywhere
Gary Kramlich <grim@reaperworld.com>
parents:
42181
diff
changeset
|
927 | if (!g_ascii_strncasecmp(c, "<a", 2)) { |
|
40564
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
928 | while (1) { |
|
42521
a8e758b503eb
Simplify PidginInfoPane by using bindings everywhere
Gary Kramlich <grim@reaperworld.com>
parents:
42181
diff
changeset
|
929 | if (!g_ascii_strncasecmp(c, "/a>", 3)) { |
|
40564
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
930 | inside_html = FALSE; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
931 | break; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
932 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
933 | ret = g_string_append_c(ret, *c); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
934 | c++; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
935 | if (!(*c)) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
936 | break; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
937 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
938 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
939 | } else if (!g_ascii_strncasecmp(c, "http://", 7)) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
940 | c = process_link(ret, text, c, 7, "", inside_paren); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
941 | } else if (!g_ascii_strncasecmp(c, "https://", 8)) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
942 | c = process_link(ret, text, c, 8, "", inside_paren); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
943 | } else if (!g_ascii_strncasecmp(c, "ftp://", 6)) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
944 | c = process_link(ret, text, c, 6, "", inside_paren); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
945 | } else if (!g_ascii_strncasecmp(c, "sftp://", 7)) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
946 | c = process_link(ret, text, c, 7, "", inside_paren); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
947 | } else if (!g_ascii_strncasecmp(c, "file://", 7)) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
948 | c = process_link(ret, text, c, 7, "", inside_paren); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
949 | } else if (!g_ascii_strncasecmp(c, "www.", 4) && c[4] != '.' && (c == text || badchar(c[-1]) || badentity(c-1))) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
950 | c = process_link(ret, text, c, 4, "http://", inside_paren); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
951 | } else if (!g_ascii_strncasecmp(c, "ftp.", 4) && c[4] != '.' && (c == text || badchar(c[-1]) || badentity(c-1))) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
952 | c = process_link(ret, text, c, 4, "ftp://", inside_paren); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
953 | } else if (!g_ascii_strncasecmp(c, "xmpp:", 5) && (c == text || badchar(c[-1]) || badentity(c-1))) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
954 | c = process_link(ret, text, c, 5, "", inside_paren); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
955 | } else if (!g_ascii_strncasecmp(c, "mailto:", 7)) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
956 | t = c; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
957 | while (1) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
958 | if (badchar(*t) || badentity(t)) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
959 | char *d; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
960 | if (t - c == 7) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
961 | break; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
962 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
963 | if (t > text && *(t - 1) == '.') |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
964 | t--; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
965 | if ((d = strstr(c + 7, "?")) != NULL && d < t) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
966 | url_buf = g_strndup(c + 7, d - c - 7); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
967 | else |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
968 | url_buf = g_strndup(c + 7, t - c - 7); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
969 | if (!purple_email_is_valid(url_buf)) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
970 | g_free(url_buf); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
971 | break; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
972 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
973 | g_free(url_buf); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
974 | url_buf = g_strndup(c, t - c); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
975 | tmpurlbuf = purple_unescape_html(url_buf); |
|
42521
a8e758b503eb
Simplify PidginInfoPane by using bindings everywhere
Gary Kramlich <grim@reaperworld.com>
parents:
42181
diff
changeset
|
976 | g_string_append_printf(ret, "<a href=\"%s\">%s</a>", |
|
40564
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
977 | tmpurlbuf, url_buf); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
978 | g_free(url_buf); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
979 | g_free(tmpurlbuf); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
980 | c = t; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
981 | break; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
982 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
983 | t++; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
984 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
985 | } else if (c != text && (*c == '@')) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
986 | int flag; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
987 | GString *gurl_buf = NULL; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
988 | const char illegal_chars[] = "!@#$%^&*()[]{}/|\\<>\":;\r\n \0"; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
989 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
990 | if (strchr(illegal_chars,*(c - 1)) || strchr(illegal_chars, *(c + 1))) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
991 | flag = 0; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
992 | else { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
993 | flag = 1; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
994 | gurl_buf = g_string_new(""); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
995 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
996 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
997 | t = c; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
998 | while (flag) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
999 | /* iterate backwards grabbing the local part of an email address */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1000 | g = g_utf8_get_char(t); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1001 | if (badchar(*t) || (g >= 127) || (*t == '(') || |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1002 | ((*t == ';') && ((t > (text+2) && (!g_ascii_strncasecmp(t - 3, "<", 4) || |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1003 | !g_ascii_strncasecmp(t - 3, ">", 4))) || |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1004 | (t > (text+4) && (!g_ascii_strncasecmp(t - 5, """, 6)))))) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1005 | /* local part will already be part of ret, strip it out */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1006 | ret = g_string_truncate(ret, ret->len - (c - t)); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1007 | ret = g_string_append_unichar(ret, g); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1008 | break; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1009 | } else { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1010 | g_string_prepend_unichar(gurl_buf, g); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1011 | t = g_utf8_find_prev_char(text, t); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1012 | if (t < text) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1013 | ret = g_string_assign(ret, ""); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1014 | break; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1015 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1016 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1017 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1018 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1019 | t = g_utf8_find_next_char(c, NULL); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1020 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1021 | while (flag) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1022 | /* iterate forwards grabbing the domain part of an email address */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1023 | g = g_utf8_get_char(t); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1024 | if (badchar(*t) || (g >= 127) || (*t == ')') || badentity(t)) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1025 | char *d; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1026 | |
|
43123
4d3b58b6cf06
Use g_string_free_and_steal
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43106
diff
changeset
|
1027 | url_buf = g_string_free_and_steal(gurl_buf); |
|
40564
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1028 | gurl_buf = NULL; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1029 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1030 | /* strip off trailing periods */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1031 | if (*url_buf) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1032 | for (d = url_buf + strlen(url_buf) - 1; *d == '.'; d--, t--) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1033 | *d = '\0'; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1034 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1035 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1036 | tmpurlbuf = purple_unescape_html(url_buf); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1037 | if (purple_email_is_valid(tmpurlbuf)) { |
|
42521
a8e758b503eb
Simplify PidginInfoPane by using bindings everywhere
Gary Kramlich <grim@reaperworld.com>
parents:
42181
diff
changeset
|
1038 | g_string_append_printf(ret, "<a href=\"mailto:%s\">%s</a>", |
|
40564
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1039 | tmpurlbuf, url_buf); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1040 | } else { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1041 | g_string_append(ret, url_buf); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1042 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1043 | g_free(url_buf); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1044 | g_free(tmpurlbuf); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1045 | c = t; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1046 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1047 | break; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1048 | } else { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1049 | g_string_append_unichar(gurl_buf, g); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1050 | t = g_utf8_find_next_char(t, NULL); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1051 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1052 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1053 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1054 | if (gurl_buf) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1055 | g_string_free(gurl_buf, TRUE); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1056 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1057 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1058 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1059 | if(*c == ')' && !inside_html) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1060 | inside_paren--; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1061 | ret = g_string_append_c(ret, *c); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1062 | c++; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1063 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1064 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1065 | if (*c == 0) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1066 | break; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1067 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1068 | ret = g_string_append_c(ret, *c); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1069 | c++; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1070 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1071 | } |
|
43123
4d3b58b6cf06
Use g_string_free_and_steal
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43106
diff
changeset
|
1072 | return g_string_free_and_steal(ret); |
|
40564
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1073 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1074 | |
|
43168
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
1075 | char * |
|
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
1076 | purple_unescape_text(const char *in) |
|
40564
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1077 | { |
|
43168
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
1078 | GString *ret; |
|
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
1079 | const char *c = in; |
|
40564
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1080 | |
|
43168
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
1081 | if(in == NULL) { |
|
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
1082 | return NULL; |
|
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
1083 | } |
|
40564
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1084 | |
|
43168
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
1085 | ret = g_string_new(""); |
|
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
1086 | while(*c) { |
|
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
1087 | int len; |
|
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
1088 | const char *ent; |
|
40564
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1089 | |
|
43168
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
1090 | if((ent = purple_markup_unescape_entity(c, &len)) != NULL) { |
|
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
1091 | g_string_append(ret, ent); |
|
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
1092 | c += len; |
|
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
1093 | } else { |
|
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
1094 | g_string_append_c(ret, *c); |
|
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
1095 | c++; |
|
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
1096 | } |
|
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
1097 | } |
|
40564
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1098 | |
|
43168
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
1099 | return g_string_free_and_steal(ret); |
|
40564
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1100 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1101 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1102 | char *purple_unescape_html(const char *html) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1103 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1104 | GString *ret; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1105 | const char *c = html; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1106 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1107 | if (html == NULL) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1108 | return NULL; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1109 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1110 | ret = g_string_new(""); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1111 | while (*c) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1112 | int len; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1113 | const char *ent; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1114 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1115 | if ((ent = purple_markup_unescape_entity(c, &len)) != NULL) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1116 | g_string_append(ret, ent); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1117 | c += len; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1118 | } else if (!strncmp(c, "<br>", 4)) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1119 | g_string_append_c(ret, '\n'); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1120 | c += 4; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1121 | } else { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1122 | g_string_append_c(ret, *c); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1123 | c++; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1124 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1125 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1126 | |
|
43123
4d3b58b6cf06
Use g_string_free_and_steal
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43106
diff
changeset
|
1127 | return g_string_free_and_steal(ret); |
|
40564
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1128 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1129 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1130 | char * |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1131 | purple_markup_slice(const char *str, guint x, guint y) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1132 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1133 | GString *ret; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1134 | GQueue *q; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1135 | guint z = 0; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1136 | gboolean appended = FALSE; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1137 | gunichar c; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1138 | char *tag; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1139 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1140 | g_return_val_if_fail(str != NULL, NULL); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1141 | g_return_val_if_fail(x <= y, NULL); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1142 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1143 | if (x == y) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1144 | return g_strdup(""); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1145 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1146 | ret = g_string_new(""); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1147 | q = g_queue_new(); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1148 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1149 | while (*str && (z < y)) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1150 | c = g_utf8_get_char(str); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1151 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1152 | if (c == '<') { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1153 | char *end = strchr(str, '>'); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1154 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1155 | if (!end) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1156 | g_string_free(ret, TRUE); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1157 | while ((tag = g_queue_pop_head(q))) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1158 | g_free(tag); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1159 | g_queue_free(q); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1160 | return NULL; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1161 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1162 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1163 | if (!g_ascii_strncasecmp(str, "<img ", 5)) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1164 | z += strlen("[Image]"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1165 | } else if (!g_ascii_strncasecmp(str, "<br", 3)) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1166 | z += 1; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1167 | } else if (!g_ascii_strncasecmp(str, "<hr>", 4)) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1168 | z += strlen("\n---\n"); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1169 | } else if (!g_ascii_strncasecmp(str, "</", 2)) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1170 | /* pop stack */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1171 | char *tmp; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1172 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1173 | tmp = g_queue_pop_head(q); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1174 | g_free(tmp); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1175 | /* z += 0; */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1176 | } else { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1177 | /* push it unto the stack */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1178 | char *tmp; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1179 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1180 | tmp = g_strndup(str, end - str + 1); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1181 | g_queue_push_head(q, tmp); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1182 | /* z += 0; */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1183 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1184 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1185 | if (z >= x) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1186 | g_string_append_len(ret, str, end - str + 1); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1187 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1188 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1189 | str = end; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1190 | } else if (c == '&') { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1191 | char *end = strchr(str, ';'); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1192 | if (!end) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1193 | g_string_free(ret, TRUE); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1194 | while ((tag = g_queue_pop_head(q))) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1195 | g_free(tag); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1196 | g_queue_free(q); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1197 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1198 | return NULL; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1199 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1200 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1201 | if (z >= x) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1202 | g_string_append_len(ret, str, end - str + 1); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1203 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1204 | z++; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1205 | str = end; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1206 | } else { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1207 | if (z == x && z > 0 && !appended) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1208 | GList *l = q->tail; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1209 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1210 | while (l) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1211 | tag = l->data; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1212 | g_string_append(ret, tag); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1213 | l = l->prev; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1214 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1215 | appended = TRUE; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1216 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1217 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1218 | if (z >= x) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1219 | g_string_append_unichar(ret, c); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1220 | z++; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1221 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1222 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1223 | str = g_utf8_next_char(str); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1224 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1225 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1226 | while ((tag = g_queue_pop_head(q))) { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1227 | char *name; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1228 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1229 | name = purple_markup_get_tag_name(tag); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1230 | g_string_append_printf(ret, "</%s>", name); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1231 | g_free(name); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1232 | g_free(tag); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1233 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1234 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1235 | g_queue_free(q); |
|
43123
4d3b58b6cf06
Use g_string_free_and_steal
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43106
diff
changeset
|
1236 | return g_string_free_and_steal(ret); |
|
40564
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1237 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1238 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1239 | char * |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1240 | purple_markup_get_tag_name(const char *tag) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1241 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1242 | int i; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1243 | g_return_val_if_fail(tag != NULL, NULL); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1244 | g_return_val_if_fail(*tag == '<', NULL); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1245 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1246 | for (i = 1; tag[i]; i++) |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1247 | if (tag[i] == '>' || tag[i] == ' ' || tag[i] == '/') |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1248 | break; |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1249 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1250 | return g_strndup(tag+1, i-1); |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1251 | } |