libpurple/plugins/simple.c

Sun, 16 Aug 2020 18:58:39 -0500

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Sun, 16 Aug 2020 18:58:39 -0500
changeset 40514
30d9cbf04922
parent 40439
e9838d634d5e
permissions
-rw-r--r--

Fix some leaks.

Also, expand `g_ascii_dtostr` buffers to `G_ASCII_DTOSTR_BUF_SIZE`.

This is the size it's guaranteed to be under, so might as well have it be that size. It not too much bigger than the existing choice anyway.

Testing Done:
Compile only.

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

39959
e47fcffd061b migrate the libpurple plugins to using purple.h only
Gary Kramlich <grim@reaperworld.com>
parents: 36742
diff changeset
1 /*
e47fcffd061b migrate the libpurple plugins to using purple.h only
Gary Kramlich <grim@reaperworld.com>
parents: 36742
diff changeset
2 * This program is free software; you can redistribute it and/or
e47fcffd061b migrate the libpurple plugins to using purple.h only
Gary Kramlich <grim@reaperworld.com>
parents: 36742
diff changeset
3 * modify it under the terms of the GNU General Public License as
e47fcffd061b migrate the libpurple plugins to using purple.h only
Gary Kramlich <grim@reaperworld.com>
parents: 36742
diff changeset
4 * published by the Free Software Foundation; either version 2 of the
e47fcffd061b migrate the libpurple plugins to using purple.h only
Gary Kramlich <grim@reaperworld.com>
parents: 36742
diff changeset
5 * License, or (at your option) any later version.
e47fcffd061b migrate the libpurple plugins to using purple.h only
Gary Kramlich <grim@reaperworld.com>
parents: 36742
diff changeset
6 *
e47fcffd061b migrate the libpurple plugins to using purple.h only
Gary Kramlich <grim@reaperworld.com>
parents: 36742
diff changeset
7 * This program is distributed in the hope that it will be useful, but
e47fcffd061b migrate the libpurple plugins to using purple.h only
Gary Kramlich <grim@reaperworld.com>
parents: 36742
diff changeset
8 * WITHOUT ANY WARRANTY; without even the implied warranty of
e47fcffd061b migrate the libpurple plugins to using purple.h only
Gary Kramlich <grim@reaperworld.com>
parents: 36742
diff changeset
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
e47fcffd061b migrate the libpurple plugins to using purple.h only
Gary Kramlich <grim@reaperworld.com>
parents: 36742
diff changeset
10 * General Public License for more details.
e47fcffd061b migrate the libpurple plugins to using purple.h only
Gary Kramlich <grim@reaperworld.com>
parents: 36742
diff changeset
11 *
e47fcffd061b migrate the libpurple plugins to using purple.h only
Gary Kramlich <grim@reaperworld.com>
parents: 36742
diff changeset
12 * You should have received a copy of the GNU General Public License
e47fcffd061b migrate the libpurple plugins to using purple.h only
Gary Kramlich <grim@reaperworld.com>
parents: 36742
diff changeset
13 * along with this program; if not, write to the Free Software
e47fcffd061b migrate the libpurple plugins to using purple.h only
Gary Kramlich <grim@reaperworld.com>
parents: 36742
diff changeset
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
e47fcffd061b migrate the libpurple plugins to using purple.h only
Gary Kramlich <grim@reaperworld.com>
parents: 36742
diff changeset
15 * 02111-1301, USA.
e47fcffd061b migrate the libpurple plugins to using purple.h only
Gary Kramlich <grim@reaperworld.com>
parents: 36742
diff changeset
16 */
e47fcffd061b migrate the libpurple plugins to using purple.h only
Gary Kramlich <grim@reaperworld.com>
parents: 36742
diff changeset
17
40439
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 39959
diff changeset
18 #include <glib/gi18n-lib.h>
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 39959
diff changeset
19
39959
e47fcffd061b migrate the libpurple plugins to using purple.h only
Gary Kramlich <grim@reaperworld.com>
parents: 36742
diff changeset
20 #include <purple.h>
90
6a145e05be78 [gaim-migrate @ 100]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
21
13690
bcb427c64568 [gaim-migrate @ 16091]
Richard Laager <rlaager@pidgin.im>
parents: 11256
diff changeset
22 /** Plugin id : type-author-name (to guarantee uniqueness) */
bcb427c64568 [gaim-migrate @ 16091]
Richard Laager <rlaager@pidgin.im>
parents: 11256
diff changeset
23 #define SIMPLE_PLUGIN_ID "core-ewarmenhoven-simple"
bcb427c64568 [gaim-migrate @ 16091]
Richard Laager <rlaager@pidgin.im>
parents: 11256
diff changeset
24
36742
5d43951cabc0 More refactoring
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
25 static PurplePluginInfo *
5d43951cabc0 More refactoring
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
26 plugin_query(GError **error)
5d43951cabc0 More refactoring
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
27 {
5d43951cabc0 More refactoring
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
28 const gchar * const authors[] = {
5d43951cabc0 More refactoring
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
29 "Eric Warmenhoven <eric@warmenhoven.org>",
5d43951cabc0 More refactoring
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
30 NULL
5d43951cabc0 More refactoring
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
31 };
5d43951cabc0 More refactoring
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
32
5d43951cabc0 More refactoring
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
33 return purple_plugin_info_new(
5d43951cabc0 More refactoring
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
34 "id", SIMPLE_PLUGIN_ID,
5d43951cabc0 More refactoring
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
35 "name", N_("Simple Plugin"),
5d43951cabc0 More refactoring
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
36 "version", DISPLAY_VERSION,
5d43951cabc0 More refactoring
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
37 "category", N_("Testing"),
5d43951cabc0 More refactoring
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
38 "summary", N_("Tests to see that most things are working."),
5d43951cabc0 More refactoring
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
39 "description", N_("Tests to see that most things are working."),
5d43951cabc0 More refactoring
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
40 "authors", authors,
5d43951cabc0 More refactoring
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
41 "website", PURPLE_WEBSITE,
5d43951cabc0 More refactoring
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
42 "abi-version", PURPLE_ABI_VERSION,
5d43951cabc0 More refactoring
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
43 NULL
5d43951cabc0 More refactoring
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
44 );
5d43951cabc0 More refactoring
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
45 }
5d43951cabc0 More refactoring
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
46
5205
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 3565
diff changeset
47 static gboolean
36742
5d43951cabc0 More refactoring
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
48 plugin_load(PurplePlugin *plugin, GError **error)
5205
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 3565
diff changeset
49 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
50 purple_debug(PURPLE_DEBUG_INFO, "simple", "simple plugin loaded.\n");
94
0c6ba3d3fa90 [gaim-migrate @ 104]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents: 92
diff changeset
51
5205
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 3565
diff changeset
52 return TRUE;
90
6a145e05be78 [gaim-migrate @ 100]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
53 }
6a145e05be78 [gaim-migrate @ 100]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
54
5205
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 3565
diff changeset
55 static gboolean
36742
5d43951cabc0 More refactoring
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
56 plugin_unload(PurplePlugin *plugin, GError **error)
5205
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 3565
diff changeset
57 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
58 purple_debug(PURPLE_DEBUG_INFO, "simple", "simple plugin unloaded.\n");
5205
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 3565
diff changeset
59
242b8aa81328 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 3565
diff changeset
60 return TRUE;
90
6a145e05be78 [gaim-migrate @ 100]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
61 }
92
b2cc29da946e [gaim-migrate @ 102]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents: 90
diff changeset
62
36742
5d43951cabc0 More refactoring
Ankit Vani <a@nevitus.org>
parents: 36367
diff changeset
63 PURPLE_PLUGIN_INIT(simple, plugin_query, plugin_load, plugin_unload);

mercurial