# HG changeset patch
# Node ID c5edca666ea022ed201d2e4f134694d92f060ad0
# Parent  87999e4cdb558a039087816778f339f1875b5b7f
diff --git a/libpurple/plugins/hello-world/hello_world.c b/libpurple/plugins/hello-world/hello_world.c
new file mode 100644
--- /dev/null
+++ b/libpurple/plugins/hello-world/hello_world.c
@@ -0,0 +1,47 @@
+#include <purple.h>
+
+static GPluginPluginInfo *
+hello_world_query(GError **error) {
+	const gchar * const authors[] = {
+		"Author Name <aname@example.com>",
+		NULL
+	};
+
+	return purple_plugin_info_new (
+		"id", "hello_world",
+		"name", "Hello World!",
+		"version", "1.0",
+		"category", "Example",
+		"summary", "Hello World Plugin",
+		"description", "Creates a \"Hello World!\" notification when loaded",
+		"authors", authors,
+		"website", "http://helloworld.tld",
+		"abi-version", PURPLE_ABI_VERSION,
+		NULL
+	);
+}
+
+static gboolean
+hello_world_load(GPluginPlugin *plugin, GError **error) {
+	PurpleNotification *notification = NULL;
+	PurpleNotificationManager *manager = NULL;
+
+	notification = purple_notification_new(PURPLE_NOTIFICATION_TYPE_GENERIC,
+	                                       NULL, NULL, NULL);
+	purple_notification_set_title(notification, "Hellow World!");
+	purple_notification_set_subtitle(notification,
+	                                 "This is the Hello World! plugin :)");
+
+	manager = purple_notification_manager_get_default();
+	purple_notification_manager_add(manager, notification);
+	g_clear_object(&notification);
+
+	return TRUE;
+}
+
+static gboolean
+hello_world_unload(GPluginPlugin *plugin, gboolean shutdown, GError **error) {
+	return TRUE;
+}
+
+GPLUGIN_NATIVE_PLUGIN_DECLARE(hello_world)
diff --git a/libpurple/plugins/hello-world/meson.build b/libpurple/plugins/hello-world/meson.build
new file mode 100644
--- /dev/null
+++ b/libpurple/plugins/hello-world/meson.build
@@ -0,0 +1,9 @@
+library('libhelloworld', 'hello_world.c',
+	c_args : [
+		'-DG_LOG_USE_STRUCTURED',
+		'-DG_LOG_DOMAIN="PurplePlugin-HelloWorld"',
+		'-Wno-unused-parameter',
+	],
+	dependencies : [libpurple_dep],
+	name_prefix : '',
+	install : false)
diff --git a/libpurple/plugins/meson.build b/libpurple/plugins/meson.build
--- a/libpurple/plugins/meson.build
+++ b/libpurple/plugins/meson.build
@@ -1,4 +1,5 @@
 subdir('autoaccept')
+subdir('hello-world')
 subdir('idle')
 subdir('joinpart')
 subdir('keychain-access')
diff --git a/libpurple/reference/tut_c_plugins.md b/libpurple/reference/tut_c_plugins.md
--- a/libpurple/reference/tut_c_plugins.md
+++ b/libpurple/reference/tut_c_plugins.md
@@ -1,23 +1,17 @@
 Title: C Plugin Tutorial
 Slug: c-plugin-tutorial
 
-## C Plugin Tutorial
-
-### Introduction
+C plugins are native plugins. They have complete access to all of the API,
+and can do basically whatever they want.
 
-C plugins are native plugins. They have complete access to all of the API,
-and can do basically whatever they want. All of the protocol plugins are
-also written in C.
+# Getting Started
 
-### Getting Started
+To develop a plugin you need to have the libpurple source code or development
+headers for your platform. It is generally a good idea to compile against the
+same version of libpurple that you are running. You may also want to develop
+against the code in our Mercurial repository if you need to use a new feature.
 
-To develop a plugin you need to have the libpurple and (for UI plugins) the
-Pidgin/Finch source code or development headers. It is generally a good idea
-to compile against the same version of Pidgin that you are running. You may
-also want to develop against the code in our Mercurial repository if you need
-to use a new feature. Please do not abuse our Mercurial repository, however.
-
-### An Example
+# An Example
 
 I know every tutorial has a hello world, so why should libpurple be any
 different?
@@ -38,7 +32,7 @@
 		"version", "1.0",
 		"category", "Example",
 		"summary", "Hello World Plugin",
-		"description", "Displays a \"Hello World!\" message when loaded",
+		"description", "Creates a \"Hello World!\" notification when loaded",
 		"authors", authors,
 		"website", "http://helloworld.tld",
 		"abi-version", PURPLE_ABI_VERSION,
@@ -48,9 +42,18 @@
 
 static gboolean
 hello_world_load(GPluginPlugin *plugin, GError **error) {
-	purple_notify_message(plugin, PURPLE_NOTIFY_MSG_INFO, "Hello World!",
-	                      "This is the Hello World! plugin :)",
-	                      NULL, NULL, NULL, NULL);
+	PurpleNotification *notification = NULL;
+	PurpleNotificationManager *manager = NULL;
+
+	notification = purple_notification_new(PURPLE_NOTIFICATION_TYPE_GENERIC,
+	                                       NULL, NULL, NULL);
+	purple_notification_set_title(notification, "Hellow World!");
+	purple_notification_set_subtitle(notification,
+	                                 "This is the Hello World! plugin :)");
+
+	manager = purple_notification_manager_get_default();
+	purple_notification_manager_add(manager, notification);
+	g_clear_object(&notification);
 
 	return TRUE;
 }
@@ -63,41 +66,41 @@
 GPLUGIN_NATIVE_PLUGIN_DECLARE(hello_world)
 ```
 
-Okay, so what does all this mean?  We start off by including purple.h.  This
+Okay, so what does all this mean? We start off by including `purple.h`. This
 file includes all the libpurple header files.
 
 `hello_world_query`, `hello_world_load` and `hello_world_unload` are functions
-that must be implemented in every plugin.  These functions are named according
+that must be implemented in every plugin. These functions are named according
 to the value passed to `GPLUGIN_NATIVE_PLUGIN_DECLARE` which is described
 below.
 
 `hello_world_query` is called when the plugin is queried by the plugin system,
 and returns various information about the plugin in form of a newly created
-instance of `GPluginPluginInfo` or a subclass.  For a list of all available
-properties, see `purple_plugin_info_new()`.
+instance of [class@GPlugin.PluginInfo] or a subclass. For a list of all
+available properties, see [ctor@PluginInfo.new].
 
 If anything should go wrong during the query you can return an error by using
-`g_set_error()` on the `error` argument.
+[func@GLib.set_error] on the `error` argument.
 
 `hello_world_load` is called when the plugin is loaded. That is the user has
 enabled the plugin or libpurple is loading a plugin that was previously loaded.
 You can initialize any variables, register dynamic types, and so on in this
-function.  Plugins may also want to add their preferences to the pref
-tree--more about that later. In this plugin we'll just use it to display a
-message. Just like `hello_world_query` if there are any errors that arise, you
-can call `g_set_error()` on the `error` argument and return `FALSE`.
+function. In this plugin we'll just use it to create and display a
+notification. Just like `hello_world_query` if there are any errors that arise,
+you can call [func@GLib.set_error] on the `error` argument and return `FALSE`.
 
 `hello_world_unload` is called when the plugin is unloaded. That is, when the
 user has manually unloaded the plugin or the program is shutting down. We can
-use it to wrap up everything, and free our variables. If the program is shutting
-down, the `shutdown` argument will be `TRUE`. Again, if there are any errors, you
-can call `g_set_error()` on the `error` argument and return `FALSE`.
+use it to wrap up everything, and free our variables. If the program is
+shutting down, the `shutdown` argument will be `TRUE`. Again, if there are any
+errors, you can call [func@GLib.set_error] on the `error` argument and return
+`FALSE`.
 
 Finally we have `GPLUGIN_NATIVE_PLUGIN_DECLARE()`. It is a helper macro that
 makes creating plugins easier. It has a single argument which is the prefix
 used for the `_query`, `_load`, and `_unload` functions.
 
-### Building
+# Building
 
 You may want to compile your plugin by using your libpurple from the packages
 on your system. You can easily do this with meson build system. Let's say
@@ -125,10 +128,10 @@
 This `meson.build` file will build your plugin and install it into the right
 location for libpurple to find it.
 
-If you're using this example to compile your own plugin. You
-should change the project name at the beginning of the file and change the
-library name which in this case is `libhelloworld`. You will also need to
-change the `G_LOG_DOMAIN` macro to your own log domain.
+If you are using this example to compile your own plugin. You should change the
+project name at the beginning of the file as well as the library name which in
+this case is `libhelloworld`. You will also need to change the `G_LOG_DOMAIN`
+macro to your own log domain.
 
 Now, you can quickly build your plugin with the following commands:
 
