comparison plugins/links/links.hpp @ 768:d8bf53170fb6

Plugin links: fix various errors, closes #912 @2h Import uriparser to decode URLs correctly with fragment and query support for a better link decomposition. Improve pre-check message to allow people writing text after the link, e.g: http://example.org <- you should check this Improve relocation. Split code for better style.
author David Demelier <markand@malikania.fr>
date Wed, 24 Oct 2018 21:05:00 +0200
parents
children 8c44bbcbbab9
comparison
equal deleted inserted replaced
767:a2db884f2e4b 768:d8bf53170fb6
1 /*
2 * links.hpp -- links plugin
3 *
4 * Copyright (c) 2013-2018 David Demelier <markand@malikania.fr>
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19 #ifndef IRCCD_LINKS_HPP
20 #define IRCCD_LINKS_HPP
21
22 /**
23 * \file links.hpp
24 * \brief Links plugin.
25 */
26
27 #include <irccd/daemon/plugin.hpp>
28
29 namespace irccd {
30
31 /**
32 * \brief Links plugin.
33 */
34 class links_plugin : public plugin {
35 public:
36 // options.
37 static inline unsigned conf_timeout{30U};
38
39 // formats.
40 static inline std::string format_info{"#{title}"};
41
42 public:
43 /**
44 * Inherited constructors.
45 */
46 using plugin::plugin;
47
48 /**
49 * \copydoc plugin::get_name
50 */
51 auto get_name() const noexcept -> std::string_view override;
52
53 /**
54 * \copydoc plugin::get_author
55 */
56 auto get_author() const noexcept -> std::string_view override;
57
58 /**
59 * \copydoc plugin::get_license
60 */
61 auto get_license() const noexcept -> std::string_view override;
62
63 /**
64 * \copydoc plugin::get_summary
65 */
66 auto get_summary() const noexcept -> std::string_view override;
67
68 /**
69 * \copydoc plugin::get_version
70 */
71 auto get_version() const noexcept -> std::string_view override;
72
73 /**
74 * \copydoc plugin::set_options
75 */
76 void set_options(const map&) override;
77
78 /**
79 * \copydoc plugin::set_formats
80 */
81 void set_formats(const map&) override;
82
83 /**
84 * \copydoc plugin::handle_message
85 */
86 void handle_message(irccd&, const message_event&) override;
87
88 /**
89 * Export ABI.
90 *
91 * \return the compiled version
92 */
93 static auto abi() -> version;
94
95 /**
96 * Create the plugin
97 *
98 * \param id the plugin id
99 * \return the compiled version
100 */
101 static auto init(std::string) -> std::unique_ptr<plugin>;
102 };
103
104 } // !irccd
105
106 #endif // !IRCCD_LINKS_HPP