libpurple/purplemarkup.h

Mon, 12 May 2025 20:25:16 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Mon, 12 May 2025 20:25:16 -0500
changeset 43246
0e9bbe9b4da8
parent 42614
b75a5bbf6c35
child 43268
515f561d53bd
permissions
-rw-r--r--

Handle formatting in server messages

Testing Done:
Used the default motd on my local ergo server to verify that formatting was working.

Reviewed at https://reviews.imfreedom.org/r/3991/

40564
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
40578
4118acc90778 Fix a small typo.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40564
diff changeset
2 * Purple - Internet Messaging Library
40564
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * Purple is the legal property of its developers, whose names are too numerous
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42408
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: 42408
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: 42408
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: 42408
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: 42408
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: 42408
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: 42408
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: 42408
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: 42408
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: 42408
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: 42408
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 #if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION)
41276
03f98ece6b26 Fix a ton of missing and incorrect global header guards
Gary Kramlich <grim@reaperworld.com>
parents: 41207
diff changeset
24 # error "only <purple.h> may be included directly"
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
25 #endif
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 #ifndef PURPLE_MARKUP_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
28 #define PURPLE_MARKUP_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
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 #include <glib.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
31
42393
408884ab47a9 Export symbols and add Since tags for 2.7 API
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41940
diff changeset
32 #include "purpleversion.h"
408884ab47a9 Export symbols and add Since tags for 2.7 API
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41940
diff changeset
33
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
34 G_BEGIN_DECLS
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 /**
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * purple_markup_html_to_xhtml:
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 * @html: The HTML markup.
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * @dest_xhtml: The destination XHTML output.
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * @dest_plain: The destination plain-text output.
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 *
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * Converts HTML markup to XHTML.
42408
94151c4d26b5 Add Since tags/visibility exports to utility functions
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42393
diff changeset
43 *
42614
b75a5bbf6c35 Remove the micro version from since tags for libpurple part 3
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
44 * Since: 2.0
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
45 */
42408
94151c4d26b5 Add Since tags/visibility exports to utility functions
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42393
diff changeset
46 PURPLE_AVAILABLE_IN_ALL
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
47 void purple_markup_html_to_xhtml(const char *html, char **dest_xhtml,
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 char **dest_plain);
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 /**
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * purple_markup_strip_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
52 * @str: The string to strip HTML from.
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 *
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * Strips HTML tags from a string.
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 *
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * Returns: The new string without HTML. You must g_free this string
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * when finished with it.
42408
94151c4d26b5 Add Since tags/visibility exports to utility functions
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42393
diff changeset
58 *
42614
b75a5bbf6c35 Remove the micro version from since tags for libpurple part 3
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
59 * Since: 2.0
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
60 */
42408
94151c4d26b5 Add Since tags/visibility exports to utility functions
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42393
diff changeset
61 PURPLE_AVAILABLE_IN_ALL
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
62 char *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
63
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 /**
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * purple_markup_linkify:
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * @str: The string to linkify.
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 *
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * Adds the necessary HTML code to turn URIs into HTML links in a string.
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 *
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * Returns: The new string with all URIs surrounded in standard
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * HTML &lt;a href="whatever"&gt;&lt;/a&gt; tags. You must g_free()
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * this string when finished with it.
42408
94151c4d26b5 Add Since tags/visibility exports to utility functions
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42393
diff changeset
73 *
42614
b75a5bbf6c35 Remove the micro version from since tags for libpurple part 3
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
74 * Since: 2.0
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
75 */
42408
94151c4d26b5 Add Since tags/visibility exports to utility functions
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42393
diff changeset
76 PURPLE_AVAILABLE_IN_ALL
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
77 char *purple_markup_linkify(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
78
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 /**
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * purple_unescape_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
81 * @text: The string in which to unescape any HTML entities
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 *
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * Unescapes HTML entities to their literal characters in 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
84 * For example "&amp;amp;" is replaced by '&amp;' and so on. Also converts
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * numerical entities (e.g. "&amp;\#38;" is also '&amp;').
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 *
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * This function currently supports the following named entities:
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * "&amp;amp;", "&amp;lt;", "&amp;gt;", "&amp;copy;", "&amp;quot;",
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * "&amp;reg;", "&amp;apos;"
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 *
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91 * purple_unescape_html() is similar, but also converts "&lt;br&gt;" 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
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 * See purple_unescape_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
94 *
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * Returns: The text with HTML entities literalized. You must g_free
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * this string when finished with it.
42393
408884ab47a9 Export symbols and add Since tags for 2.7 API
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41940
diff changeset
97 *
42614
b75a5bbf6c35 Remove the micro version from since tags for libpurple part 3
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
98 * Since: 2.7
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
99 */
42393
408884ab47a9 Export symbols and add Since tags for 2.7 API
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41940
diff changeset
100 PURPLE_AVAILABLE_IN_2_7
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
101 char *purple_unescape_text(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
102
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 /**
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * purple_unescape_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
105 * @html: The string in which to unescape any HTML entities
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 *
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * Unescapes HTML entities to their literal characters and converts
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * "&lt;br&gt;" to "\n". See purple_unescape_text() for more details.
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * See purple_unescape_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
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 * Returns: The text with HTML entities literalized. You must g_free
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * this string when finished with it.
42408
94151c4d26b5 Add Since tags/visibility exports to utility functions
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42393
diff changeset
114 *
42614
b75a5bbf6c35 Remove the micro version from since tags for libpurple part 3
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
115 * Since: 2.0
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
116 */
42408
94151c4d26b5 Add Since tags/visibility exports to utility functions
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42393
diff changeset
117 PURPLE_AVAILABLE_IN_ALL
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
118 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
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 /**
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * purple_markup_slice:
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * @str: The input NUL terminated, HTML, UTF-8 (or ASCII) string.
41083
590d533cf290 Fix several typos in libpurple
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40584
diff changeset
123 * @x: The character offset into an unformatted version of str to begin at.
590d533cf290 Fix several typos in libpurple
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40584
diff changeset
124 * @y: The character offset (into an unformatted version of str) of one past
590d533cf290 Fix several typos in libpurple
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40584
diff changeset
125 * the last character to include in the slice.
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
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 * Returns a newly allocated substring of the HTML UTF-8 string "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
128 * The markup is preserved such that the substring will have the same
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * formatting as original string, even though some tags may have been
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * opened before "x", or may close after "y". All open tags are 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
131 * at the end of the returned string, in the proper order.
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 *
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * Note that x and y are in character offsets, not byte offsets, and
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * are offsets into an unformatted version of str. Because of this,
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * this function may be sensitive to changes in GtkIMHtml and may 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
136 * when used with other UI's. libpurple users are encouraged to report and
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * work out any problems encountered.
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 *
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * Returns: The HTML slice of string, with all formatting retained.
42408
94151c4d26b5 Add Since tags/visibility exports to utility functions
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42393
diff changeset
140 *
42614
b75a5bbf6c35 Remove the micro version from since tags for libpurple part 3
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
141 * Since: 2.0
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
142 */
42408
94151c4d26b5 Add Since tags/visibility exports to utility functions
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42393
diff changeset
143 PURPLE_AVAILABLE_IN_ALL
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
144 char *purple_markup_slice(const char *str, guint x, guint y);
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
145
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * purple_markup_get_tag_name:
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
148 * @tag: The string starting a HTML 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
149 *
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * Returns a newly allocated string containing the name of 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
151 * located at "tag". Tag is expected to point to a '<', and contain
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * a '>' sometime after that. If there is no '>' and the string is
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * not NUL terminated, this function can be expected to segfault.
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * Returns: A string containing the name of the tag.
42408
94151c4d26b5 Add Since tags/visibility exports to utility functions
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42393
diff changeset
156 *
42614
b75a5bbf6c35 Remove the micro version from since tags for libpurple part 3
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
157 * Since: 2.0
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
158 */
42408
94151c4d26b5 Add Since tags/visibility exports to utility functions
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42393
diff changeset
159 PURPLE_AVAILABLE_IN_ALL
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
160 char *purple_markup_get_tag_name(const char *tag);
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] to purplemarkup.[ch]. No code was changed just moved it from one file to the other.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
161
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 /**
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * purple_markup_unescape_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
164 * @text: A string containing an HTML 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
165 * @length: If not %NULL, the string length of the entity is stored in this location.
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * Returns a constant string of the character representation of the 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
168 * entity pointed to by @text. For example, purple_markup_unescape_entity("&amp;amp;")
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * will return "&amp;". The @text variable is expected to point to an '&amp;',
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * the first character of the entity. If given an unrecognized entity, the function
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * returns %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
172 *
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * Note that this function, unlike purple_unescape_html(), does not search
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * the string for the entity, does not replace the entity, and does not
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * return a newly allocated string.
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 * Returns: A constant string containing the character representation of the given entity.
42408
94151c4d26b5 Add Since tags/visibility exports to utility functions
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42393
diff changeset
178 *
42614
b75a5bbf6c35 Remove the micro version from since tags for libpurple part 3
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
179 * Since: 2.0
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
180 */
42408
94151c4d26b5 Add Since tags/visibility exports to utility functions
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42393
diff changeset
181 PURPLE_AVAILABLE_IN_ALL
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
182 const char * 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
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 G_END_DECLS
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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
2c5b4dc2e86a Pull the purple_markup_* api out of util.[ch] 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 #endif /* PURPLE_MARKUP_H */

mercurial