static void skypeweb_protocol_roomlist_iface_init(PurpleProtocolRoomlistIface *prpl_info) { #endif //PurpleProtocolRoomlistIface #if !PURPLE_VERSION_CHECK(3, 0, 0) prpl_info->roomlist_get_list = skypeweb_roomlist_get_list; #else prpl_info->get_list = skypeweb_roomlist_get_list; #endif #if !PURPLE_VERSION_CHECK(3, 0, 0) // Plugin info info->magic = PURPLE_PLUGIN_MAGIC; info->major_version = PURPLE_MAJOR_VERSION; info->minor_version = PURPLE_MINOR_VERSION; info->type = PURPLE_PLUGIN_PROTOCOL; info->priority = PURPLE_PRIORITY_DEFAULT; info->version = SKYPEWEB_PLUGIN_VERSION; info->summary = N_("Skype for Web Protocol Plugin"); info->description = N_("Skype for Web Protocol Plugin"); info->author = "Eion Robb <*****@*****.**>"; info->homepage = "http://github.com/EionRobb/skype4pidgin"; info->load = plugin_load; info->unload = plugin_unload; info->extra_info = prpl_info; // Protocol info #if PURPLE_MINOR_VERSION >= 5 prpl_info->struct_size = sizeof(PurplePluginProtocolInfo); #endif #if PURPLE_MINOR_VERSION >= 8 prpl_info->add_buddy_with_invite = skypeweb_add_buddy_with_invite; #endif plugin->info = info; return purple_plugin_register(plugin); #endif }
static gboolean probe_perl_plugin(PurplePlugin *plugin) { /* XXX This would be much faster if I didn't create a new * PerlInterpreter every time I probed a plugin */ PerlInterpreter *prober = perl_alloc(); char *argv[] = {"", plugin->path }; gboolean status = TRUE; HV *plugin_info; PERL_SET_CONTEXT(prober); PL_perl_destruct_level = 1; perl_construct(prober); perl_parse(prober, xs_init, 2, argv, NULL); perl_run(prober); plugin_info = perl_get_hv("PLUGIN_INFO", FALSE); if (plugin_info == NULL) status = FALSE; else if (!hv_exists(plugin_info, "perl_api_version", strlen("perl_api_version")) || !hv_exists(plugin_info, "name", strlen("name")) || !hv_exists(plugin_info, "load", strlen("load"))) { /* Not a valid plugin. */ status = FALSE; } else { SV **key; int perl_api_ver; key = hv_fetch(plugin_info, "perl_api_version", strlen("perl_api_version"), 0); perl_api_ver = SvIV(*key); if (perl_api_ver != 2) status = FALSE; else { PurplePluginInfo *info; PurplePerlScript *gps; char *basename; STRLEN len; info = g_new0(PurplePluginInfo, 1); gps = g_new0(PurplePerlScript, 1); info->magic = PURPLE_PLUGIN_MAGIC; info->major_version = PURPLE_MAJOR_VERSION; info->minor_version = PURPLE_MINOR_VERSION; info->type = PURPLE_PLUGIN_STANDARD; info->dependencies = g_list_append(info->dependencies, PERL_PLUGIN_ID); gps->plugin = plugin; basename = g_path_get_basename(plugin->path); purple_perl_normalize_script_name(basename); gps->package = g_strdup_printf("Purple::Script::%s", basename); g_free(basename); /* We know this one exists. */ key = hv_fetch(plugin_info, "name", strlen("name"), 0); info->name = g_strdup(SvPV(*key, len)); /* Set id here in case we don't find one later. */ info->id = g_strdup(SvPV(*key, len)); #ifdef PURPLE_GTKPERL if ((key = hv_fetch(plugin_info, "GTK_UI", strlen("GTK_UI"), 0))) info->ui_requirement = PURPLE_GTK_PLUGIN_TYPE; #endif if ((key = hv_fetch(plugin_info, "url", strlen("url"), 0))) info->homepage = g_strdup(SvPV(*key, len)); if ((key = hv_fetch(plugin_info, "author", strlen("author"), 0))) info->author = g_strdup(SvPV(*key, len)); if ((key = hv_fetch(plugin_info, "summary", strlen("summary"), 0))) info->summary = g_strdup(SvPV(*key, len)); if ((key = hv_fetch(plugin_info, "description", strlen("description"), 0))) info->description = g_strdup(SvPV(*key, len)); if ((key = hv_fetch(plugin_info, "version", strlen("version"), 0))) info->version = g_strdup(SvPV(*key, len)); /* We know this one exists. */ key = hv_fetch(plugin_info, "load", strlen("load"), 0); gps->load_sub = g_strdup_printf("%s::%s", gps->package, SvPV(*key, len)); if ((key = hv_fetch(plugin_info, "unload", strlen("unload"), 0))) gps->unload_sub = g_strdup_printf("%s::%s", gps->package, SvPV(*key, len)); if ((key = hv_fetch(plugin_info, "id", strlen("id"), 0))) { g_free(info->id); info->id = g_strdup_printf("perl-%s", SvPV(*key, len)); } /********************************************************/ /* Only one of the next two options should be present */ /* */ /* prefs_info - Uses non-GUI (read GTK) purple API calls */ /* and creates a PurplePluginPrefInfo type. */ /* */ /* gtk_prefs_info - Requires gtk2-perl be installed by */ /* the user and he must create a */ /* GtkWidget the user and he must */ /* create a GtkWidget representing the */ /* plugin preferences page. */ /********************************************************/ if ((key = hv_fetch(plugin_info, "prefs_info", strlen("prefs_info"), 0))) { /* key now is the name of the Perl sub that * will create a frame for us */ gps->prefs_sub = g_strdup_printf("%s::%s", gps->package, SvPV(*key, len)); info->prefs_info = &ui_info; } #ifdef PURPLE_GTKPERL if ((key = hv_fetch(plugin_info, "gtk_prefs_info", strlen("gtk_prefs_info"), 0))) { /* key now is the name of the Perl sub that * will create a frame for us */ gps->gtk_prefs_sub = g_strdup_printf("%s::%s", gps->package, SvPV(*key, len)); info->ui_info = >k_ui_info; } #endif if ((key = hv_fetch(plugin_info, "plugin_action_sub", strlen("plugin_action_sub"), 0))) { gps->plugin_action_sub = g_strdup_printf("%s::%s", gps->package, SvPV(*key, len)); info->actions = purple_perl_plugin_actions; } plugin->info = info; info->extra_info = gps; status = purple_plugin_register(plugin); } } PL_perl_destruct_level = 1; PERL_SET_CONTEXT(prober); perl_destruct(prober); perl_free(prober); return status; }