Thu, 07 Aug 2025 21:40:13 -0500
Add an avatar-for-display property to Purple.ContactInfo
Testing Done:
Ran the tests under valgrind and called in the turtles.
Reviewed at https://reviews.imfreedom.org/r/4086/
|
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 | |
|
43268
515f561d53bd
Remove some unused markup functions
Gary Kramlich <grim@reaperworld.com>
parents:
43168
diff
changeset
|
27 | static const char * |
|
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
|
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 | /* 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
|
87 | * - \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
|
88 | * - 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
|
89 | * - 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
|
90 | * - 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
|
91 | * - <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
|
92 | */ |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
95 | 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
|
96 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
98 | 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
|
99 | 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
|
100 | 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
|
101 | 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
|
102 | 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
|
103 | 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
|
104 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
106 | 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
|
107 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
109 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
111 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
113 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
115 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | /* 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
|
117 | 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
|
118 | 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
|
119 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
121 | 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
|
122 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
124 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
126 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
128 | 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
|
129 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
131 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
133 | 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
|
134 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
136 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
138 | 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
|
139 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
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 | 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
|
144 | 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
|
145 | 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
|
146 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | /* 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
|
148 | * 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
|
149 | * 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
|
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 | 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
|
152 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
154 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | /* 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
|
157 | * 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
|
158 | 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
|
159 | 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
|
160 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
162 | 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
|
163 | 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
|
164 | /* 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
|
165 | 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
|
166 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
168 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
170 | 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
|
171 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
173 | 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
|
174 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
176 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | /* 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
|
179 | 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
|
180 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | /* 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
|
182 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | /* 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
|
185 | * 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
|
186 | 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
|
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 | 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
|
189 | 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
|
190 | 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
|
191 | 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
|
192 | 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
|
193 | 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
|
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 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | /* 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
|
198 | * 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
|
199 | 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
|
200 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
202 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | /* 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
|
204 | 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
|
205 | 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
|
206 | (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
|
207 | 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
|
208 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
210 | 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
|
211 | 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
|
212 | 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
|
213 | 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
|
214 | 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
|
215 | 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
|
216 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | /* 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
|
220 | * 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
|
221 | 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
|
222 | || 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
|
223 | || 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
|
224 | || 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
|
225 | || 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
|
226 | || 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
|
227 | || 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
|
228 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
229 | 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
|
230 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | /* 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
|
232 | 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
|
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 | 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
|
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 | 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
|
237 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
239 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | /* 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
|
241 | 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
|
242 | 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
|
243 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
246 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
248 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
250 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
252 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
255 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
257 | 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
|
258 | 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
|
259 | 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
|
260 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
263 | 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
|
264 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
267 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
269 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
271 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
274 | 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
|
275 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
277 | 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
|
278 | 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
|
279 | 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
|
280 | 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
|
281 | 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
|
282 | 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
|
283 | 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
|
284 | 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
|
285 | 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
|
286 | 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
|
287 | 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
|
288 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
292 | 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
|
293 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
295 | !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
|
296 | !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
|
297 | 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
|
298 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
300 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
303 | 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
|
304 | 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
|
305 | 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
|
306 | 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
|
307 | 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
|
308 | { |
|
43106
7cd7744de3bc
Don't unescape html in purple_markup_linkify
Gary Kramlich <grim@reaperworld.com>
parents:
42594
diff
changeset
|
309 | 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
|
310 | 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
|
311 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
313 | 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
|
314 | 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
|
315 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
317 | 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
|
318 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
320 | 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
|
321 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 (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
|
324 | 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
|
325 | 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
|
326 | 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
|
327 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | url_buf = g_strndup(c, t - c); |
|
42521
a8e758b503eb
Simplify PidginInfoPane by using bindings everywhere
Gary Kramlich <grim@reaperworld.com>
parents:
42181
diff
changeset
|
329 | 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
|
330 | urlprefix, |
|
43106
7cd7744de3bc
Don't unescape html in purple_markup_linkify
Gary Kramlich <grim@reaperworld.com>
parents:
42594
diff
changeset
|
331 | 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
|
332 | 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
|
333 | 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
|
334 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
337 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
340 | 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
|
341 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
343 | 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
|
344 | 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
|
345 | 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
|
346 | 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
|
347 | 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
|
348 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
350 | 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
|
351 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
353 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
355 | 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
|
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(*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
|
358 | 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
|
359 | 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
|
360 | 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
|
361 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
364 | 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
|
365 | 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
|
366 | } 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
|
367 | 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
|
368 | } 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
|
369 | 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
|
370 | 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
|
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 | } 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
|
373 | inside_html = TRUE; |
|
42521
a8e758b503eb
Simplify PidginInfoPane by using bindings everywhere
Gary Kramlich <grim@reaperworld.com>
parents:
42181
diff
changeset
|
374 | 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
|
375 | while (1) { |
|
42521
a8e758b503eb
Simplify PidginInfoPane by using bindings everywhere
Gary Kramlich <grim@reaperworld.com>
parents:
42181
diff
changeset
|
376 | 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
|
377 | 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
|
378 | 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
|
379 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
381 | 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
|
382 | 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
|
383 | 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
|
384 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | } 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
|
387 | 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
|
388 | } 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
|
389 | 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
|
390 | } 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
|
391 | 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
|
392 | } 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
|
393 | 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
|
394 | } 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
|
395 | 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
|
396 | } 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
|
397 | 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
|
398 | } 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
|
399 | 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
|
400 | } 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
|
401 | 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
|
402 | } 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
|
403 | 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
|
404 | 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
|
405 | 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
|
406 | 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
|
407 | 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
|
408 | 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
|
409 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
411 | 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
|
412 | 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
|
413 | 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
|
414 | 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
|
415 | 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
|
416 | 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
|
417 | 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
|
418 | 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
|
419 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
421 | 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
|
422 | tmpurlbuf = purple_unescape_html(url_buf); |
|
42521
a8e758b503eb
Simplify PidginInfoPane by using bindings everywhere
Gary Kramlich <grim@reaperworld.com>
parents:
42181
diff
changeset
|
423 | 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
|
424 | 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
|
425 | 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
|
426 | 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
|
427 | 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
|
428 | 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
|
429 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
431 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | } 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
|
433 | 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
|
434 | 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
|
435 | 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
|
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 | 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
|
438 | 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
|
439 | 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
|
440 | 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
|
441 | 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
|
442 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
445 | 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
|
446 | /* 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
|
447 | 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
|
448 | 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
|
449 | ((*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
|
450 | !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
|
451 | (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
|
452 | /* 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
|
453 | 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
|
454 | 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
|
455 | 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
|
456 | } 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
|
457 | 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
|
458 | 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
|
459 | 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
|
460 | 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
|
461 | 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
|
462 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
467 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
469 | /* 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
|
470 | 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
|
471 | 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
|
472 | 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
|
473 | |
|
43123
4d3b58b6cf06
Use g_string_free_and_steal
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43106
diff
changeset
|
474 | 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
|
475 | 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
|
476 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | /* 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
|
478 | 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
|
479 | 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
|
480 | *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
|
481 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
484 | if (purple_email_is_valid(tmpurlbuf)) { |
|
42521
a8e758b503eb
Simplify PidginInfoPane by using bindings everywhere
Gary Kramlich <grim@reaperworld.com>
parents:
42181
diff
changeset
|
485 | 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
|
486 | 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
|
487 | } 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
|
488 | 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
|
489 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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_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
|
491 | 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
|
492 | 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
|
493 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
495 | } 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
|
496 | 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
|
497 | 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
|
498 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
502 | 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
|
503 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
507 | 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
|
508 | 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
|
509 | 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
|
510 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
513 | 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
|
514 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
516 | 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
|
517 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | } |
|
43123
4d3b58b6cf06
Use g_string_free_and_steal
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43106
diff
changeset
|
519 | 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
|
520 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | |
|
43168
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
522 | char * |
|
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
523 | 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
|
524 | { |
|
43168
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
525 | GString *ret; |
|
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
526 | 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
|
527 | |
|
43168
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
528 | if(in == NULL) { |
|
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
529 | return NULL; |
|
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
530 | } |
|
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
|
531 | |
|
43168
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
532 | ret = g_string_new(""); |
|
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
533 | while(*c) { |
|
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
534 | int len; |
|
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
535 | 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
|
536 | |
|
43168
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
537 | 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
|
538 | g_string_append(ret, ent); |
|
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
539 | c += len; |
|
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
540 | } else { |
|
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
541 | 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
|
542 | c++; |
|
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
543 | } |
|
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
544 | } |
|
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
|
545 | |
|
43168
866ae0f43fa7
Fix indent of purple_unescape_text
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43123
diff
changeset
|
546 | 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
|
547 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
550 | { |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 *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
|
552 | 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
|
553 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
555 | 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
|
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 | 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
|
558 | 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
|
559 | 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
|
560 | 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
|
561 | |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | 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
|
563 | 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
|
564 | 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
|
565 | } 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
|
566 | 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
|
567 | 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
|
568 | } 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
|
569 | 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
|
570 | 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
|
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 | } |
|
2c5b4dc2e86a
Pull the purple_markup_* api out of util.[ch] 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 | |
|
43123
4d3b58b6cf06
Use g_string_free_and_steal
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43106
diff
changeset
|
574 | 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
|
575 | } |