Mercurial > irccd
comparison tests/src/libirccd/dynlib-plugin/test_plugin.cpp @ 773:8c44bbcbbab9
Misc: style, cleanup and update
author | David Demelier <markand@malikania.fr> |
---|---|
date | Fri, 26 Oct 2018 13:01:00 +0200 |
parents | 9d13aabfd63a |
children | ca16ca53c347 |
comparison
equal
deleted
inserted
replaced
772:f5ccf65ae929 | 773:8c44bbcbbab9 |
---|---|
22 | 22 |
23 namespace irccd { | 23 namespace irccd { |
24 | 24 |
25 class test_plugin : public plugin { | 25 class test_plugin : public plugin { |
26 private: | 26 private: |
27 map config_; | 27 map config_; |
28 | 28 |
29 public: | 29 public: |
30 test_plugin() | 30 test_plugin() |
31 : plugin("test") | 31 : plugin("test") |
32 { | 32 { |
33 } | 33 } |
34 | 34 |
35 auto get_options() const -> map override | 35 auto get_options() const -> map override |
36 { | 36 { |
37 return config_; | 37 return config_; |
38 } | 38 } |
39 | 39 |
40 auto get_name() const noexcept -> std::string_view override | 40 auto get_name() const noexcept -> std::string_view override |
41 { | 41 { |
42 return "test"; | 42 return "test"; |
43 } | 43 } |
44 | 44 |
45 void handle_command(irccd&, const message_event&) override | 45 void handle_command(irccd&, const message_event&) override |
46 { | 46 { |
47 config_["command"] = "true"; | 47 config_["command"] = "true"; |
48 } | 48 } |
49 | 49 |
50 void handle_connect(irccd&, const connect_event&) override | 50 void handle_connect(irccd&, const connect_event&) override |
51 { | 51 { |
52 config_["connect"] = "true"; | 52 config_["connect"] = "true"; |
53 } | 53 } |
54 | 54 |
55 void handle_invite(irccd&, const invite_event&) override | 55 void handle_invite(irccd&, const invite_event&) override |
56 { | 56 { |
57 config_["invite"] = "true"; | 57 config_["invite"] = "true"; |
58 } | 58 } |
59 | 59 |
60 void handle_join(irccd&, const join_event&) override | 60 void handle_join(irccd&, const join_event&) override |
61 { | 61 { |
62 config_["join"] = "true"; | 62 config_["join"] = "true"; |
63 } | 63 } |
64 | 64 |
65 void handle_kick(irccd&, const kick_event&) override | 65 void handle_kick(irccd&, const kick_event&) override |
66 { | 66 { |
67 config_["kick"] = "true"; | 67 config_["kick"] = "true"; |
68 } | 68 } |
69 | 69 |
70 void handle_load(irccd&) override | 70 void handle_load(irccd&) override |
71 { | 71 { |
72 config_["load"] = "true"; | 72 config_["load"] = "true"; |
73 } | 73 } |
74 | 74 |
75 void handle_message(irccd&, const message_event&) override | 75 void handle_message(irccd&, const message_event&) override |
76 { | 76 { |
77 config_["message"] = "true"; | 77 config_["message"] = "true"; |
78 } | 78 } |
79 | 79 |
80 void handle_me(irccd&, const me_event&) override | 80 void handle_me(irccd&, const me_event&) override |
81 { | 81 { |
82 config_["me"] = "true"; | 82 config_["me"] = "true"; |
83 } | 83 } |
84 | 84 |
85 void handle_mode(irccd&, const mode_event&) override | 85 void handle_mode(irccd&, const mode_event&) override |
86 { | 86 { |
87 config_["mode"] = "true"; | 87 config_["mode"] = "true"; |
88 } | 88 } |
89 | 89 |
90 void handle_names(irccd&, const names_event&) override | 90 void handle_names(irccd&, const names_event&) override |
91 { | 91 { |
92 config_["names"] = "true"; | 92 config_["names"] = "true"; |
93 } | 93 } |
94 | 94 |
95 void handle_nick(irccd&, const nick_event&) override | 95 void handle_nick(irccd&, const nick_event&) override |
96 { | 96 { |
97 config_["nick"] = "true"; | 97 config_["nick"] = "true"; |
98 } | 98 } |
99 | 99 |
100 void handle_notice(irccd&, const notice_event&) override | 100 void handle_notice(irccd&, const notice_event&) override |
101 { | 101 { |
102 config_["notice"] = "true"; | 102 config_["notice"] = "true"; |
103 } | 103 } |
104 | 104 |
105 void handle_part(irccd&, const part_event&) override | 105 void handle_part(irccd&, const part_event&) override |
106 { | 106 { |
107 config_["part"] = "true"; | 107 config_["part"] = "true"; |
108 } | 108 } |
109 | 109 |
110 void handle_reload(irccd&) override | 110 void handle_reload(irccd&) override |
111 { | 111 { |
112 config_["reload"] = "true"; | 112 config_["reload"] = "true"; |
113 } | 113 } |
114 | 114 |
115 void handle_topic(irccd&, const topic_event&) override | 115 void handle_topic(irccd&, const topic_event&) override |
116 { | 116 { |
117 config_["topic"] = "true"; | 117 config_["topic"] = "true"; |
118 } | 118 } |
119 | 119 |
120 void handle_unload(irccd&) override | 120 void handle_unload(irccd&) override |
121 { | 121 { |
122 config_["unload"] = "true"; | 122 config_["unload"] = "true"; |
123 } | 123 } |
124 | 124 |
125 void handle_whois(irccd&, const whois_event&) override | 125 void handle_whois(irccd&, const whois_event&) override |
126 { | 126 { |
127 config_["whois"] = "true"; | 127 config_["whois"] = "true"; |
128 } | 128 } |
129 | 129 |
130 static auto abi() -> version | 130 static auto abi() -> version |
131 { | 131 { |
132 return version(); | 132 return version(); |
133 } | 133 } |
134 | 134 |
135 static auto init(std::string) -> std::unique_ptr<plugin> | 135 static auto init(std::string) -> std::unique_ptr<plugin> |
136 { | 136 { |
137 return std::make_unique<test_plugin>(); | 137 return std::make_unique<test_plugin>(); |
138 } | 138 } |
139 }; | 139 }; |
140 | 140 |
141 BOOST_DLL_ALIAS(test_plugin::abi, irccd_abi_test_plugin) | 141 BOOST_DLL_ALIAS(test_plugin::abi, irccd_abi_test_plugin) |
142 BOOST_DLL_ALIAS(test_plugin::init, irccd_init_test_plugin) | 142 BOOST_DLL_ALIAS(test_plugin::init, irccd_init_test_plugin) |
143 | 143 |