Sat, 27 Aug 2016 18:16:01 -0500
connection: Add purple_connection_take_error()
This patch adds a purple_connection_take_error() function, which
is functionally equivalent to purple_connection_g_error(), except
that it takes ownership of the passed GError.
This is useful to simplify error handling so that the GError doesn't
have to be freed, or, in the future potentially copied, if it's no
longer needed where it's generated. It can also allow for GErrors
being generated without storing them in a variable. This would be
reasonably common if/when all PurpleConnection errors are passed
in via GError.
| 6677 | 1 | #include "internal.h" |
| 2 | #include "debug.h" | |
|
36367
891eea799578
Renamed plugin.[ch] to plugins.[ch], since we (will) no longer have a PurplePlugin structure.
Ankit Vani <a@nevitus.org>
parents:
20288
diff
changeset
|
3 | #include "plugins.h" |
| 9954 | 4 | #include "version.h" |
| 90 | 5 | |
|
13690
bcb427c64568
[gaim-migrate @ 16091]
Richard Laager <rlaager@pidgin.im>
parents:
11256
diff
changeset
|
6 | /** Plugin id : type-author-name (to guarantee uniqueness) */ |
|
bcb427c64568
[gaim-migrate @ 16091]
Richard Laager <rlaager@pidgin.im>
parents:
11256
diff
changeset
|
7 | #define SIMPLE_PLUGIN_ID "core-ewarmenhoven-simple" |
|
bcb427c64568
[gaim-migrate @ 16091]
Richard Laager <rlaager@pidgin.im>
parents:
11256
diff
changeset
|
8 | |
| 36742 | 9 | static PurplePluginInfo * |
| 10 | plugin_query(GError **error) | |
| 11 | { | |
| 12 | const gchar * const authors[] = { | |
| 13 | "Eric Warmenhoven <eric@warmenhoven.org>", | |
| 14 | NULL | |
| 15 | }; | |
| 16 | ||
| 17 | return purple_plugin_info_new( | |
| 18 | "id", SIMPLE_PLUGIN_ID, | |
| 19 | "name", N_("Simple Plugin"), | |
| 20 | "version", DISPLAY_VERSION, | |
| 21 | "category", N_("Testing"), | |
| 22 | "summary", N_("Tests to see that most things are working."), | |
| 23 | "description", N_("Tests to see that most things are working."), | |
| 24 | "authors", authors, | |
| 25 | "website", PURPLE_WEBSITE, | |
| 26 | "abi-version", PURPLE_ABI_VERSION, | |
| 27 | NULL | |
| 28 | ); | |
| 29 | } | |
| 30 | ||
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
3565
diff
changeset
|
31 | static gboolean |
| 36742 | 32 | plugin_load(PurplePlugin *plugin, GError **error) |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
3565
diff
changeset
|
33 | { |
| 15884 | 34 | purple_debug(PURPLE_DEBUG_INFO, "simple", "simple plugin loaded.\n"); |
|
94
0c6ba3d3fa90
[gaim-migrate @ 104]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
92
diff
changeset
|
35 | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
3565
diff
changeset
|
36 | return TRUE; |
| 90 | 37 | } |
| 38 | ||
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
3565
diff
changeset
|
39 | static gboolean |
| 36742 | 40 | plugin_unload(PurplePlugin *plugin, GError **error) |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
3565
diff
changeset
|
41 | { |
| 15884 | 42 | purple_debug(PURPLE_DEBUG_INFO, "simple", "simple plugin unloaded.\n"); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
3565
diff
changeset
|
43 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
3565
diff
changeset
|
44 | return TRUE; |
| 90 | 45 | } |
|
92
b2cc29da946e
[gaim-migrate @ 102]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
90
diff
changeset
|
46 | |
| 36742 | 47 | PURPLE_PLUGIN_INIT(simple, plugin_query, plugin_load, plugin_unload); |