bool PluginPackage::fetchInfo() { if (!load()) return false; NPP_GetValueProcPtr gv = (NPP_GetValueProcPtr)m_module->resolve("NP_GetValue"); typedef char *(*NPP_GetMIMEDescriptionProcPtr)(); NPP_GetMIMEDescriptionProcPtr gm = (NPP_GetMIMEDescriptionProcPtr)m_module->resolve("NP_GetMIMEDescription"); if (!gm || !gv) return false; char *buf = 0; NPError err = gv(0, NPPVpluginNameString, (void*) &buf); if (err != NPERR_NO_ERROR) return false; m_name = buf; err = gv(0, NPPVpluginDescriptionString, (void*) &buf); if (err != NPERR_NO_ERROR) return false; m_description = buf; determineModuleVersionFromDescription(); String mimeDescription = gm(); setMIMEDescription(mimeDescription); m_infoIsFromCache = false; return true; }
bool PluginPackage::fetchInfo() { const char *errmsg; if (!load()) return false; NPP_GetValueProcPtr getValue = 0; NP_GetMIMEDescriptionFuncPtr getMIMEDescription = 0; getValue = reinterpret_cast<NPP_GetValueProcPtr>(dlsym(m_module, "NP_GetValue")); if ((errmsg = dlerror())) { EINA_LOG_ERR("Could not get symbol NP_GetValue: %s", errmsg); return false; } getMIMEDescription = reinterpret_cast<NP_GetMIMEDescriptionFuncPtr>(dlsym(m_module, "NP_GetMIMEDescription")); if ((errmsg = dlerror())) { EINA_LOG_ERR("Could not get symbol NP_GetMIMEDescription: %s", errmsg); return false; } char* buffer = 0; NPError err = getValue(0, NPPVpluginNameString, static_cast<void*>(&buffer)); if (err != NPERR_NO_ERROR) return false; m_name = buffer; buffer = 0; err = getValue(0, NPPVpluginDescriptionString, static_cast<void*>(&buffer)); if (err != NPERR_NO_ERROR) return false; m_description = buffer; determineModuleVersionFromDescription(); String description = getMIMEDescription(); Vector<String> types; description.split(UChar(';'), false, types); for (size_t i = 0; i < types.size(); ++i) { Vector<String> mime; types[i].split(UChar(':'), true, mime); if (!mime.isEmpty() > 0) { Vector<String> exts; if (mime.size() > 1) mime[1].split(UChar(','), false, exts); determineQuirks(mime[0]); m_mimeToExtensions.add(mime[0], exts); if (mime.size() > 2) m_mimeToDescriptions.add(mime[0], mime[2]); } } return true; }
bool PluginPackage::fetchInfo() { if (!load()) return false; char* buf = 0; NPError err = m_pluginFuncs.getvalue(0, NPPVpluginNameString, (void *)&buf); m_name = buf; err = m_pluginFuncs.getvalue(0, NPPVpluginDescriptionString, (void *)&buf); m_description = buf; determineModuleVersionFromDescription(); String s = m_npInterface->NP_GetMIMEDescription(); Vector<String> types; s.split(UChar('|'), false, types); // <MIME1>;<ext1,ext2,ext3,...>;<Description>|<MIME2>|<MIME3>|... for (int i = 0; i < types.size(); ++i) { Vector<String> mime; types[i].split(UChar(';'), true, mime); // <MIME1>;<ext1,ext2,ext3,...>;<Description> if (mime.size() > 0) { Vector<String> exts; if (mime.size() > 1) mime[1].split(UChar(','), false, exts); // <ext1,ext2,ext3,...> m_mimeToExtensions.add(mime[0], exts); // <MIME>,<ext1,ext2,ext3> if (mime.size() > 2) m_mimeToDescriptions.add(mime[0], mime[2]); // <MIME>,<Description> } } unload(); return true; }
bool PluginPackage::fetchInfo() { if (!load()) return false; NP_GetMIMEDescriptionFuncPtr NP_GetMIMEDescription = 0; NPP_GetValueProcPtr NPP_GetValue = 0; g_module_symbol(m_module, "NP_GetMIMEDescription", (void**)&NP_GetMIMEDescription); g_module_symbol(m_module, "NP_GetValue", (void**)&NPP_GetValue); if (!NP_GetMIMEDescription || !NPP_GetValue) return false; char* buffer = 0; NPError err = NPP_GetValue(0, NPPVpluginNameString, &buffer); if (err == NPERR_NO_ERROR) m_name = String::fromUTF8(buffer); buffer = 0; err = NPP_GetValue(0, NPPVpluginDescriptionString, &buffer); if (err == NPERR_NO_ERROR) { m_description = String::fromUTF8(buffer); determineModuleVersionFromDescription(); } const gchar* types = NP_GetMIMEDescription(); if (!types) return true; gchar** mimeDescs = g_strsplit(types, ";", -1); for (int i = 0; mimeDescs[i] && mimeDescs[i][0]; i++) { GOwnPtr<char> mime(g_utf8_strdown(mimeDescs[i], -1)); gchar** mimeData = g_strsplit(mime.get(), ":", 3); if (g_strv_length(mimeData) < 3) { g_strfreev(mimeData); continue; } String description = String::fromUTF8(mimeData[2]); gchar** extensions = g_strsplit(mimeData[1], ",", -1); Vector<String> extVector; for (int j = 0; extensions[j]; j++) extVector.append(String::fromUTF8(extensions[j])); determineQuirks(mimeData[0]); m_mimeToExtensions.add(mimeData[0], extVector); m_mimeToDescriptions.add(mimeData[0], description); g_strfreev(extensions); g_strfreev(mimeData); } g_strfreev(mimeDescs); return true; }
bool PluginPackage::fetchInfo() { if (!load()) return false; // FIXME: Find a better way to get around the fetchinfo load. // We are fetching the info. Technically we have not loaded the plugin. PluginView::Init will load the plugin so decrement the counter m_loadCount--; NP_GetMIMEDescriptionFuncPtr getDescription = (NP_GetMIMEDescriptionFuncPtr) dlsym(m_module, "NP_GetMIMEDescription"); NPP_GetValueProcPtr getValue = (NPP_GetValueProcPtr) dlsym(m_module, "NP_GetValue"); if (!getDescription || !getValue) return false; char* buf = 0; NPError err = getValue(0, NPPVpluginNameString, (void *) &buf); if (err != NPERR_NO_ERROR) return false; m_name = buf; err = getValue(0, NPPVpluginDescriptionString, (void *) &buf); if (err != NPERR_NO_ERROR) return false; m_description = buf; determineModuleVersionFromDescription(); String s = getDescription(); Vector<String> types; s.split(UChar(';'), false, types); for (unsigned i = 0; i < types.size(); ++i) { Vector<String> mime; types[i].split(UChar(':'), true, mime); if (mime.size() > 0) { Vector<String> extensions; if (mime.size() > 1) mime[1].split(UChar(','), false, extensions); determineQuirks(mime[0]); m_mimeToExtensions.add(mime[0], extensions); if (mime.size() > 2) m_mimeToDescriptions.add(mime[0], mime[2]); } } return true; }
bool PluginPackage::fetchInfo() { if (!load()) return false; NP_GetMIMEDescriptionFuncPtr NP_GetMIMEDescription = 0; NPP_GetValueProcPtr NPP_GetValue = 0; NP_GetMIMEDescription = (NP_GetMIMEDescriptionFuncPtr)dlsym(m_module,"NP_GetMIMEDescription"); NPP_GetValue = (NPP_GetValueProcPtr)dlsym(m_module,"NP_GetValue"); if (!NP_GetMIMEDescription || !NPP_GetValue) return false; char* buffer = 0; NPError err = NPP_GetValue(0, NPPVpluginNameString, &buffer); if (err != NPERR_NO_ERROR) return false; m_name = String::fromUTF8(buffer); buffer = 0; err = NPP_GetValue(0, NPPVpluginDescriptionString, &buffer); if (err != NPERR_NO_ERROR) return false; m_description = String::fromUTF8(buffer); determineModuleVersionFromDescription(); String description = String::fromUTF8(NP_GetMIMEDescription()); Vector<String> types; description.split(UChar(';'), false, types); for (unsigned i = 0; i < types.size(); ++i) { Vector<String> mime; types[i].split(UChar(':'), true, mime); if (mime.size() > 0) { Vector<String> exts; if (mime.size() > 1) mime[1].split(UChar(','), false, exts); m_mimeToExtensions.add(mime[0], exts); if (mime.size() > 2) m_mimeToDescriptions.add(mime[0], mime[2]); } } return true; }
bool PluginPackage::fetchInfo() { if (!load()) return false; NPP_GetValueProcPtr gv = (NPP_GetValueProcPtr)m_module->resolve("NP_GetValue"); typedef char *(*NPP_GetMIMEDescriptionProcPtr)(); NPP_GetMIMEDescriptionProcPtr gm = (NPP_GetMIMEDescriptionProcPtr)m_module->resolve("NP_GetMIMEDescription"); if (!gm || !gv) { return false; } char *buf = 0; NPError err = gv(0, NPPVpluginNameString, (void *)&buf); if (err != NPERR_NO_ERROR) { return false; } m_name = buf; err = gv(0, NPPVpluginDescriptionString, (void *)&buf); if (err != NPERR_NO_ERROR) { return false; } m_description = buf; determineModuleVersionFromDescription(); String s = gm(); Vector<String> types; s.split(UChar(';'), false, types); for (int i = 0; i < types.size(); ++i) { Vector<String> mime; types[i].split(UChar(':'), true, mime); if (mime.size() > 0) { Vector<String> exts; if (mime.size() > 1) mime[1].split(UChar(','), false, exts); determineQuirks(mime[0]); m_mimeToExtensions.add(mime[0], exts); if (mime.size() > 2) m_mimeToDescriptions.add(mime[0], mime[2]); } } return true; }
bool PluginPackage::fetchInfo() { if (!load()) return false; WKCPluginInfo info = {0}; if (!wkcPluginGetInfoPeer(m_module, &info)) return false; CString cname = CString::newUninitialized(info.fNameLen, info.fName); CString cdesc = CString::newUninitialized(info.fDescriptionLen, info.fDescription); CString cmime = CString::newUninitialized(info.fMIMEDescriptionLen, info.fMIMEDescription); CString cexts = CString::newUninitialized(info.fExtensionLen, info.fExtension); CString ctypes = CString::newUninitialized(info.fFileOpenNameLen, info.fFileOpenName); if (!wkcPluginGetInfoPeer(m_module, &info)) return false; m_name = info.fName; m_description = info.fDescription; determineModuleVersionFromDescription(); String smimes = info.fMIMEDescription; Vector<String> mimes; if (info.fType==WKC_PLUGIN_TYPE_WIN) { String e = info.fExtension; String d = info.fFileOpenName; Vector<String> exts; Vector<String> descs; Vector<String> iexts; smimes.split('|', mimes); e.split('|', true, exts); d.split('|', true, descs); for (int i=0; i<mimes.size(); i++) { determineQuirks(mimes[0]); String v = i<descs.size() ? descs[i] : ""; m_mimeToDescriptions.add(mimes[i], v); if (i<exts.size()) { exts[i].split(',', iexts); } else { iexts.clear(); } m_mimeToExtensions.add(mimes[i], iexts); } } else { smimes.split(';', mimes); for (int i=0; i<mimes.size(); i++) { Vector<String> desc; Vector<String> exts; mimes[i].split(':', true, desc); if (desc.size()<3) continue; desc[1].split(',', exts); determineQuirks(desc[0]); m_mimeToDescriptions.add(desc[0], desc[2]); m_mimeToExtensions.add(desc[0], exts); } } return true; }