| 348 PurplePerlScript *gps; |
374 PurplePerlScript *gps; |
| 349 char *basename; |
375 char *basename; |
| 350 |
376 |
| 351 info = g_new0(PurplePluginInfo, 1); |
377 info = g_new0(PurplePluginInfo, 1); |
| 352 gps = g_new0(PurplePerlScript, 1); |
378 gps = g_new0(PurplePerlScript, 1); |
| |
379 gps->info_strings = g_new0(PurplePerlInfoStrings, 1); |
| 353 |
380 |
| 354 info->magic = PURPLE_PLUGIN_MAGIC; |
381 info->magic = PURPLE_PLUGIN_MAGIC; |
| 355 info->major_version = PURPLE_MAJOR_VERSION; |
382 info->major_version = PURPLE_MAJOR_VERSION; |
| 356 info->minor_version = PURPLE_MINOR_VERSION; |
383 info->minor_version = PURPLE_MINOR_VERSION; |
| 357 info->type = PURPLE_PLUGIN_STANDARD; |
384 info->type = PURPLE_PLUGIN_STANDARD; |
| 367 basename); |
394 basename); |
| 368 g_free(basename); |
395 g_free(basename); |
| 369 |
396 |
| 370 /* We know this one exists. */ |
397 /* We know this one exists. */ |
| 371 key = hv_fetch(plugin_info, "name", strlen("name"), 0); |
398 key = hv_fetch(plugin_info, "name", strlen("name"), 0); |
| 372 info->name = g_strdup(SvPVutf8_nolen(*key)); |
399 info->name = gps->info_strings->name = g_strdup(SvPVutf8_nolen(*key)); |
| 373 /* Set id here in case we don't find one later. */ |
400 /* Set id here in case we don't find one later. */ |
| 374 info->id = g_strdup(info->name); |
401 info->id = gps->info_strings->id = g_strdup(info->name); |
| 375 |
402 |
| 376 #ifdef PURPLE_GTKPERL |
403 #ifdef PURPLE_GTKPERL |
| 377 if ((key = hv_fetch(plugin_info, "GTK_UI", |
404 if ((key = hv_fetch(plugin_info, "GTK_UI", |
| 378 strlen("GTK_UI"), 0))) |
405 strlen("GTK_UI"), 0))) |
| 379 info->ui_requirement = PURPLE_GTK_PLUGIN_TYPE; |
406 info->ui_requirement = PURPLE_GTK_PLUGIN_TYPE; |
| 380 #endif |
407 #endif |
| 381 |
408 |
| 382 if ((key = hv_fetch(plugin_info, "url", |
409 if ((key = hv_fetch(plugin_info, "url", |
| 383 strlen("url"), 0))) |
410 strlen("url"), 0))) |
| 384 info->homepage = g_strdup(SvPVutf8_nolen(*key)); |
411 info->homepage = gps->info_strings->homepage = g_strdup(SvPVutf8_nolen(*key)); |
| 385 |
412 |
| 386 if ((key = hv_fetch(plugin_info, "author", |
413 if ((key = hv_fetch(plugin_info, "author", |
| 387 strlen("author"), 0))) |
414 strlen("author"), 0))) |
| 388 info->author = g_strdup(SvPVutf8_nolen(*key)); |
415 info->author = gps->info_strings->author = g_strdup(SvPVutf8_nolen(*key)); |
| 389 |
416 |
| 390 if ((key = hv_fetch(plugin_info, "summary", |
417 if ((key = hv_fetch(plugin_info, "summary", |
| 391 strlen("summary"), 0))) |
418 strlen("summary"), 0))) |
| 392 info->summary = g_strdup(SvPVutf8_nolen(*key)); |
419 info->summary = gps->info_strings->summary = g_strdup(SvPVutf8_nolen(*key)); |
| 393 |
420 |
| 394 if ((key = hv_fetch(plugin_info, "description", |
421 if ((key = hv_fetch(plugin_info, "description", |
| 395 strlen("description"), 0))) |
422 strlen("description"), 0))) |
| 396 info->description = g_strdup(SvPVutf8_nolen(*key)); |
423 info->description = gps->info_strings->description = g_strdup(SvPVutf8_nolen(*key)); |
| 397 |
424 |
| 398 if ((key = hv_fetch(plugin_info, "version", |
425 if ((key = hv_fetch(plugin_info, "version", |
| 399 strlen("version"), 0))) |
426 strlen("version"), 0))) |
| 400 info->version = g_strdup(SvPVutf8_nolen(*key)); |
427 info->version = gps->info_strings->version = g_strdup(SvPVutf8_nolen(*key)); |
| 401 |
428 |
| 402 /* We know this one exists. */ |
429 /* We know this one exists. */ |
| 403 key = hv_fetch(plugin_info, "load", strlen("load"), 0); |
430 key = hv_fetch(plugin_info, "load", strlen("load"), 0); |
| 404 gps->load_sub = g_strdup_printf("%s::%s", gps->package, |
431 gps->load_sub = g_strdup_printf("%s::%s", gps->package, |
| 405 SvPVutf8_nolen(*key)); |
432 SvPVutf8_nolen(*key)); |
| 410 gps->package, |
437 gps->package, |
| 411 SvPVutf8_nolen(*key)); |
438 SvPVutf8_nolen(*key)); |
| 412 |
439 |
| 413 if ((key = hv_fetch(plugin_info, "id", |
440 if ((key = hv_fetch(plugin_info, "id", |
| 414 strlen("id"), 0))) { |
441 strlen("id"), 0))) { |
| 415 g_free(info->id); |
442 g_free(gps->info_strings->id); |
| 416 info->id = g_strdup_printf("perl-%s", |
443 info->id = gps->info_strings->id = g_strdup_printf("perl-%s", |
| 417 SvPVutf8_nolen(*key)); |
444 SvPVutf8_nolen(*key)); |
| 418 } |
445 } |
| 419 |
446 |
| 420 /********************************************************/ |
447 /********************************************************/ |
| 421 /* Only one of the next two options should be present */ |
448 /* Only one of the next two options should be present */ |
| 598 destroy_perl_plugin(PurplePlugin *plugin) |
625 destroy_perl_plugin(PurplePlugin *plugin) |
| 599 { |
626 { |
| 600 if (plugin->info != NULL) { |
627 if (plugin->info != NULL) { |
| 601 PurplePerlScript *gps; |
628 PurplePerlScript *gps; |
| 602 |
629 |
| 603 g_free(plugin->info->name); |
|
| 604 g_free(plugin->info->id); |
|
| 605 g_free(plugin->info->homepage); |
|
| 606 g_free(plugin->info->author); |
|
| 607 g_free(plugin->info->summary); |
|
| 608 g_free(plugin->info->description); |
|
| 609 g_free(plugin->info->version); |
|
| 610 |
|
| 611 gps = (PurplePerlScript *)plugin->info->extra_info; |
630 gps = (PurplePerlScript *)plugin->info->extra_info; |
| 612 if (gps != NULL) { |
631 if (gps != NULL) { |
| |
632 perl_infostrings_free(gps->info_strings); |
| |
633 gps->info_strings = NULL; |
| |
634 |
| 613 g_free(gps->package); |
635 g_free(gps->package); |
| 614 g_free(gps->load_sub); |
636 g_free(gps->load_sub); |
| 615 g_free(gps->unload_sub); |
637 g_free(gps->unload_sub); |
| 616 g_free(gps->prefs_sub); |
638 g_free(gps->prefs_sub); |
| 617 #ifdef PURPLE_GTKPERL |
639 #ifdef PURPLE_GTKPERL |