| 56 #define PLUGIN_ID "core-debugexample" |
56 #define PLUGIN_ID "core-debugexample" |
| 57 |
57 |
| 58 /* Common practice in third-party plugins is to define convenience macros for |
58 /* Common practice in third-party plugins is to define convenience macros for |
| 59 * many of the fields of the plugin info struct, so we'll do that for the |
59 * many of the fields of the plugin info struct, so we'll do that for the |
| 60 * purposes of demonstration. */ |
60 * purposes of demonstration. */ |
| 61 #define PLUGIN_AUTHOR "John Bailey <rekkanoryo@cpw.pidgin.im>" |
61 #define PLUGIN_AUTHORS { "John Bailey <rekkanoryo@cpw.pidgin.im>", NULL } |
| |
62 |
| |
63 static PurplePluginInfo * |
| |
64 plugin_query(GError **error) |
| |
65 { |
| |
66 const gchar * const authors[] = PLUGIN_AUTHORS; |
| |
67 |
| |
68 return purple_plugin_info_new( |
| |
69 "id", PLUGIN_ID, |
| |
70 "name", "Debug API Example", |
| |
71 "version", DISPLAY_VERSION, |
| |
72 "category", "Example", |
| |
73 "summary", "Debug API Example", |
| |
74 "description", "Debug API Example", |
| |
75 "authors", authors, |
| |
76 "website", "https://pidgin.im", |
| |
77 "abi-version", PURPLE_ABI_VERSION, |
| |
78 NULL |
| |
79 ); |
| |
80 } |
| 62 |
81 |
| 63 /* As we've covered before, libpurple calls this function, if present, when it |
82 /* As we've covered before, libpurple calls this function, if present, when it |
| 64 * loads the plugin. Here we're using it to show off the capabilities of the |
83 * loads the plugin. Here we're using it to show off the capabilities of the |
| 65 * debug API and just blindly returning TRUE to tell libpurple it's safe to |
84 * debug API and just blindly returning TRUE to tell libpurple it's safe to |
| 66 * continue loading. */ |
85 * continue loading. */ |
| 67 static gboolean |
86 static gboolean |
| 68 plugin_load(PurplePlugin *plugin) |
87 plugin_load(PurplePlugin *plugin, GError **error) |
| 69 { |
88 { |
| 70 /* Define these for convenience--we're just using them to show the |
89 /* Define these for convenience--we're just using them to show the |
| 71 * similarities of the debug functions to the standard printf(). */ |
90 * similarities of the debug functions to the standard printf(). */ |
| 72 gint i = 256; |
91 gint i = 256; |
| 73 gfloat f = 512.1024; |
92 gfloat f = 512.1024; |
| 95 |
114 |
| 96 /* Now just return TRUE to tell libpurple to finish loading. */ |
115 /* Now just return TRUE to tell libpurple to finish loading. */ |
| 97 return TRUE; |
116 return TRUE; |
| 98 } |
117 } |
| 99 |
118 |
| 100 static PurplePluginInfo info = { |
119 static gboolean |
| 101 PURPLE_PLUGIN_MAGIC, /* magic number */ |
120 plugin_unload(PurplePlugin *plugin, GError **error) |
| 102 PURPLE_MAJOR_VERSION, /* purple major */ |
|
| 103 PURPLE_MINOR_VERSION, /* purple minor */ |
|
| 104 PURPLE_PLUGIN_STANDARD, /* plugin type */ |
|
| 105 NULL, /* UI requirement */ |
|
| 106 0, /* flags */ |
|
| 107 NULL, /* dependencies */ |
|
| 108 PURPLE_PRIORITY_DEFAULT, /* priority */ |
|
| 109 |
|
| 110 PLUGIN_ID, /* id */ |
|
| 111 "Debug API Example", /* name */ |
|
| 112 DISPLAY_VERSION, /* version */ |
|
| 113 "Debug API Example", /* summary */ |
|
| 114 "Debug API Example", /* description */ |
|
| 115 PLUGIN_AUTHOR, /* author */ |
|
| 116 "https://pidgin.im", /* homepage */ |
|
| 117 |
|
| 118 plugin_load, /* load */ |
|
| 119 NULL, /* unload */ |
|
| 120 NULL, /* destroy */ |
|
| 121 |
|
| 122 NULL, /* ui info */ |
|
| 123 NULL, /* extra info */ |
|
| 124 NULL, /* prefs info */ |
|
| 125 NULL, /* actions */ |
|
| 126 NULL, /* reserved */ |
|
| 127 NULL, /* reserved */ |
|
| 128 NULL, /* reserved */ |
|
| 129 NULL /* reserved */ |
|
| 130 }; |
|
| 131 |
|
| 132 static void |
|
| 133 init_plugin(PurplePlugin *plugin) |
|
| 134 { |
121 { |
| |
122 return TRUE; |
| 135 } |
123 } |
| 136 |
124 |
| 137 PURPLE_INIT_PLUGIN(debugexample, init_plugin, info) |
125 PURPLE_PLUGIN_INIT(debugexample, plugin_query, plugin_load, plugin_unload); |
| 138 |
126 |