libpurple/plugins/helloworld.c

branch
soc.2013.gobjectification.plugins
changeset 36790
224906e4600c
parent 36782
64936dae41a3
child 36794
ab220f8db631
equal deleted inserted replaced
36789:88387185047c 36790:224906e4600c
45 45
46 #include <notify.h> 46 #include <notify.h>
47 #include <plugins.h> 47 #include <plugins.h>
48 #include <version.h> 48 #include <version.h>
49 49
50 /* we're adding this here and assigning it in plugin_load because we need
51 * a valid plugin handle for our call to purple_notify_message() in the
52 * plugin_action_test_cb() callback function */
53 PurplePlugin *helloworld_plugin = NULL;
54
55 /* This function is the callback for the plugin action we added. All we're 50 /* This function is the callback for the plugin action we added. All we're
56 * doing here is displaying a message. When the user selects the plugin 51 * doing here is displaying a message. When the user selects the plugin
57 * action, this function is called. */ 52 * action, this function is called. */
58 static void 53 static void
59 plugin_action_test_cb (PurplePluginAction * action) 54 plugin_action_test_cb (PurplePluginAction * action)
60 { 55 {
61 purple_notify_message (helloworld_plugin, PURPLE_NOTIFY_MSG_INFO, 56 purple_notify_message (action->plugin, PURPLE_NOTIFY_MSG_INFO,
62 "Plugin Actions Test", "This is a plugin actions test :)", NULL, NULL, 57 "Plugin Actions Test", "This is a plugin actions test :)", NULL, NULL,
63 NULL, NULL); 58 NULL, NULL);
64 } 59 }
65 60
66 /* we tell libpurple in the PurplePluginInfo struct to call this function to 61 /* we tell libpurple in the PurplePluginInfo struct to call this function to
120 { 115 {
121 purple_notify_message (plugin, PURPLE_NOTIFY_MSG_INFO, "Hello World!", 116 purple_notify_message (plugin, PURPLE_NOTIFY_MSG_INFO, "Hello World!",
122 "This is the Hello World! plugin :)", NULL, NULL, 117 "This is the Hello World! plugin :)", NULL, NULL,
123 NULL, NULL); 118 NULL, NULL);
124 119
125 helloworld_plugin = plugin; /* assign this here so we have a valid handle later */
126
127 return TRUE; 120 return TRUE;
128 } 121 }
129 122
130 static gboolean 123 static gboolean
131 plugin_unload (PurplePlugin * plugin, GError ** error) 124 plugin_unload (PurplePlugin * plugin, GError ** error)

mercurial