| 84 @c PURPLE_PLUGIN_MAGIC, and @c PURPLE_INIT_PLUGIN(). |
88 @c PURPLE_PLUGIN_MAGIC, and @c PURPLE_INIT_PLUGIN(). |
| 85 |
89 |
| 86 Our last include is version.h which defines @c PURPLE_MAJOR_VERSION, and |
90 Our last include is version.h which defines @c PURPLE_MAJOR_VERSION, and |
| 87 @c PURPLE_MINOR_VERSION. There is not much you need to know about these, |
91 @c PURPLE_MINOR_VERSION. There is not much you need to know about these, |
| 88 except that they are required and will stop your plugin from crashing Pidgin |
92 except that they are required and will stop your plugin from crashing Pidgin |
| 89 when something has changed that you plugin does not know about yet. |
93 when something has changed that your plugin does not know about yet. |
| 90 |
94 |
| 91 plugin_load is not required. It is called when the plugin is loaded so that |
95 @c plugin_load is not required. It is called when the plugin is loaded so |
| 92 you can initialize any variables and so on. But in this plugin we'll just |
96 that you can initialize any variables and so on. In this plugin we'll just |
| 93 use it to display a message. |
97 use it to display a message. |
| 94 |
98 |
| 95 Next we have the @c PurplePluginInfo structure. Every plugin MUST have one of |
99 Next we have the @c PurplePluginInfo structure. Every plugin MUST have one of |
| 96 these. Below is a code snipet of the same struct used in @c hello_world with |
100 these. Below is a code snipet of the same struct used in @c hello_world with |
| 97 comments describing what each is. |
101 comments describing what each is. |
| 223 core plugins to have a UI configuration |
227 core plugins to have a UI configuration |
| 224 frame. You can find an example of this |
228 frame. You can find an example of this |
| 225 code in: |
229 code in: |
| 226 libpurple/plugins/pluginpref_example.c |
230 libpurple/plugins/pluginpref_example.c |
| 227 */ |
231 */ |
| 228 NULL /* Finally, the last member of the structure |
232 NULL, /* This is a function pointer where you can define |
| 229 is a function pointer where you can define |
|
| 230 "plugin actions". The UI controls how |
233 "plugin actions". The UI controls how |
| 231 they're displayed. It should be of the |
234 they're displayed. It should be of the |
| 232 type: |
235 type: |
| 233 |
236 |
| 234 GList *function_name(PurplePlugin *plugin, |
237 GList *function_name(PurplePlugin *plugin, |
| 235 gpointer context) |
238 gpointer context) |
| 236 |
239 |
| 237 It must return a GList of |
240 It must return a GList of |
| 238 PurplePluginActions. |
241 PurplePluginActions. |
| 239 */ |
242 */ |
| |
243 NULL, /* This is a pointer reserved for future use. |
| |
244 We set it to NULL to indicate we don't |
| |
245 need it. |
| |
246 */ |
| |
247 NULL, /* This is a pointer reserved for future use. |
| |
248 We set it to NULL to indicate we don't |
| |
249 need it. |
| |
250 */ |
| |
251 NULL, /* This is a pointer reserved for future use. |
| |
252 We set it to NULL to indicate we don't |
| |
253 need it. |
| |
254 */ |
| |
255 NULL /* This is a pointer reserved for future use. |
| |
256 We set it to NULL to indicate we don't |
| |
257 need it. |
| |
258 */ |
| 240 }; |
259 }; |
| 241 @endcode |
260 @endcode |
| 242 |
261 |
| 243 Finally we have @c init_plugin and @c PURPLE_INIT_PLUGIN. @c init_plugin is |
262 Finally we have @c init_plugin and @c PURPLE_INIT_PLUGIN. @c init_plugin is |
| 244 a function that gets called when libpurple probes the plugin. Most plugins |
263 a function that gets called when libpurple probes the plugin. Most plugins |