libpurple/plugins/helloworld.c

branch
soc.2013.gobjectification
changeset 34963
de6836a8b324
parent 34449
bbcb198650b7
child 34964
54ebd3dcae16
equal deleted inserted replaced
34962:d18669b989b6 34963:de6836a8b324
45 45
46 #include <notify.h> 46 #include <notify.h>
47 #include <plugin.h> 47 #include <plugin.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
92 plugin_load (PurplePlugin * plugin) 87 plugin_load (PurplePlugin * plugin)
93 { 88 {
94 purple_notify_message (plugin, PURPLE_NOTIFY_MSG_INFO, "Hello World!", 89 purple_notify_message (plugin, PURPLE_NOTIFY_MSG_INFO, "Hello World!",
95 "This is the Hello World! plugin :)", NULL, NULL, 90 "This is the Hello World! plugin :)", NULL, NULL,
96 NULL, NULL); 91 NULL, NULL);
97
98 helloworld_plugin = plugin; /* assign this here so we have a valid handle later */
99 92
100 return TRUE; 93 return TRUE;
101 } 94 }
102 95
103 /* For specific notes on the meanings of each of these members, consult the C Plugin Howto 96 /* For specific notes on the meanings of each of these members, consult the C Plugin Howto

mercurial