Mercurial > pidgin
comparison src/plugin.c @ 12703:df49362e0378
[gaim-migrate @ 15046]
This should allow us to load plugin info from pre-1.0.0 plugins.
committer: Tailor Script <tailor@pidgin.im>
| author | Richard Laager <rlaager@wiktel.com> |
|---|---|
| date | Tue, 03 Jan 2006 20:02:58 +0000 |
| parents | 2b53185e5d8f |
| children | 69713c02a702 |
comparison
equal
deleted
inserted
replaced
| 12702:ba7834d6e2c9 | 12703:df49362e0378 |
|---|---|
| 352 { | 352 { |
| 353 gaim_plugin_destroy(plugin); | 353 gaim_plugin_destroy(plugin); |
| 354 return NULL; | 354 return NULL; |
| 355 } | 355 } |
| 356 | 356 |
| 357 if (plugin->info->magic != GAIM_PLUGIN_MAGIC || | 357 /* Really old plugins. */ |
| 358 plugin->info->major_version != GAIM_MAJOR_VERSION || | 358 if (plugin->info->magic != GAIM_PLUGIN_MAGIC) |
| 359 { | |
| 360 gaim_debug_error("plugins", "%s is unloadable: plugin magic mismatch %d (need %d)\n", | |
| 361 plugin->path, plugin->info->magic, GAIM_PLUGIN_MAGIC); | |
| 362 | |
| 363 if (plugin->info->magic >= 2 && plugin->info->magic <= 4) | |
| 364 { | |
| 365 struct _GaimPluginInfo2 | |
| 366 { | |
| 367 unsigned int api_version; | |
| 368 GaimPluginType type; | |
| 369 char *ui_requirement; | |
| 370 unsigned long flags; | |
| 371 GList *dependencies; | |
| 372 GaimPluginPriority priority; | |
| 373 | |
| 374 char *id; | |
| 375 char *name; | |
| 376 char *version; | |
| 377 char *summary; | |
| 378 char *description; | |
| 379 char *author; | |
| 380 char *homepage; | |
| 381 | |
| 382 gboolean (*load)(GaimPlugin *plugin); | |
| 383 gboolean (*unload)(GaimPlugin *plugin); | |
| 384 void (*destroy)(GaimPlugin *plugin); | |
| 385 | |
| 386 void *ui_info; | |
| 387 void *extra_info; | |
| 388 GaimPluginUiInfo *prefs_info; | |
| 389 GList *(*actions)(GaimPlugin *plugin, gpointer context); | |
| 390 } *info2 = (struct _GaimPluginInfo2 *)plugin->info; | |
| 391 | |
| 392 /* This leaks... but only for ancient plugins, so deal with it. */ | |
| 393 plugin->info = g_new0(GaimPluginInfo, 1); | |
| 394 | |
| 395 /* We don't really need all these to display the plugin info, but | |
| 396 * I'm copying them all for good measure. */ | |
| 397 plugin->info->magic = info2->api_version; | |
| 398 plugin->info->type = info2->type; | |
| 399 plugin->info->ui_requirement = info2->ui_requirement; | |
| 400 plugin->info->flags = info2->flags; | |
| 401 plugin->info->dependencies = info2->dependencies; | |
| 402 plugin->info->id = info2->id; | |
| 403 plugin->info->name = info2->name; | |
| 404 plugin->info->version = info2->version; | |
| 405 plugin->info->summary = info2->summary; | |
| 406 plugin->info->description = info2->description; | |
| 407 plugin->info->author = info2->author; | |
| 408 plugin->info->homepage = info2->homepage; | |
| 409 plugin->info->load = info2->load; | |
| 410 plugin->info->unload = info2->unload; | |
| 411 plugin->info->destroy = info2->destroy; | |
| 412 plugin->info->ui_info = info2->ui_info; | |
| 413 plugin->info->extra_info = info2->extra_info; | |
| 414 | |
| 415 if (info2->api_version >= 3) | |
| 416 plugin->info->prefs_info = info2->prefs_info; | |
| 417 | |
| 418 if (info2->api_version >= 4) | |
| 419 plugin->info->actions = info2->actions; | |
| 420 | |
| 421 plugin->unloadable = TRUE; | |
| 422 return plugin; | |
| 423 } | |
| 424 | |
| 425 gaim_plugin_destroy(plugin); | |
| 426 return NULL; | |
| 427 } | |
| 428 | |
| 429 if (plugin->info->major_version != GAIM_MAJOR_VERSION || | |
| 359 plugin->info->minor_version > GAIM_MINOR_VERSION) | 430 plugin->info->minor_version > GAIM_MINOR_VERSION) |
| 360 { | 431 { |
| 361 plugin->error = g_strdup_printf("ABI version mismatch %d.%d.x (need %d.%d.x)", | 432 plugin->error = g_strdup_printf("ABI version mismatch %d.%d.x (need %d.%d.x)", |
| 362 plugin->info->major_version, plugin->info->minor_version, | 433 plugin->info->major_version, plugin->info->minor_version, |
| 363 GAIM_MAJOR_VERSION, GAIM_MINOR_VERSION); | 434 GAIM_MAJOR_VERSION, GAIM_MINOR_VERSION); |
