Skip to content
Snippets Groups Projects
Commit 60926a66 authored by Aline Gondim Santos's avatar Aline Gondim Santos
Browse files

modify enable_plugin usage

Change-Id: I0d41bd1a8e55371748d36a1b5c3654ec03f6fd5b
parent 8d40c627
Branches
No related tags found
No related merge requests found
...@@ -348,12 +348,13 @@ static ArchivePtr createArchiveDiskWriter() { ...@@ -348,12 +348,13 @@ static ArchivePtr createArchiveDiskWriter() {
archive_write_free(a); archive_write_free(a);
}}; }};
} }
#endif
//========================== //==========================
std::vector<std::string> listArchiveContent(const std::string &archivePath) std::vector<std::string> listArchiveContent(const std::string &archivePath)
{ {
std::vector<std::string> fileNames; std::vector<std::string> fileNames;
#ifdef ENABLE_PLUGIN
ArchivePtr archiveReader = createArchiveReader(); ArchivePtr archiveReader = createArchiveReader();
struct archive_entry* entry; struct archive_entry* entry;
int r; int r;
...@@ -371,12 +372,13 @@ std::vector<std::string> listArchiveContent(const std::string &archivePath) ...@@ -371,12 +372,13 @@ std::vector<std::string> listArchiveContent(const std::string &archivePath)
std::string fileEntry = archive_entry_pathname(entry) ? archive_entry_pathname(entry) : "Undefined"; std::string fileEntry = archive_entry_pathname(entry) ? archive_entry_pathname(entry) : "Undefined";
fileNames.push_back(fileEntry); fileNames.push_back(fileEntry);
} }
#endif
return fileNames; return fileNames;
} }
void uncompressArchive(const std::string &archivePath, const std::string &dir, const FileMatchPair& f) void uncompressArchive(const std::string &archivePath, const std::string &dir, const FileMatchPair& f)
{ {
#ifdef ENABLE_PLUGIN
int r; int r;
ArchivePtr archiveReader = createArchiveReader(); ArchivePtr archiveReader = createArchiveReader();
...@@ -452,11 +454,14 @@ void uncompressArchive(const std::string &archivePath, const std::string &dir, c ...@@ -452,11 +454,14 @@ void uncompressArchive(const std::string &archivePath, const std::string &dir, c
} }
} }
} }
#endif
} }
std::vector<uint8_t> readFileFromArchive(const std::string &archivePath, std::vector<uint8_t> readFileFromArchive(const std::string &archivePath,
const std::string &fileRelativePathName) const std::string &fileRelativePathName)
{ {
std::vector<uint8_t> fileContent;
#ifdef ENABLE_PLUGIN
long r; long r;
ArchivePtr archiveReader = createArchiveReader(); ArchivePtr archiveReader = createArchiveReader();
struct archive_entry* entry; struct archive_entry* entry;
...@@ -489,7 +494,6 @@ std::vector<uint8_t> readFileFromArchive(const std::string &archivePath, ...@@ -489,7 +494,6 @@ std::vector<uint8_t> readFileFromArchive(const std::string &archivePath,
if(fileEntry == fileRelativePathName){ if(fileEntry == fileRelativePathName){
// Copying the data content // Copying the data content
DataBlock db; DataBlock db;
std::vector<uint8_t> fileContent;
while(true) { while(true) {
r = readDataBlock(archiveReader,db); r = readDataBlock(archiveReader,db);
...@@ -513,7 +517,8 @@ std::vector<uint8_t> readFileFromArchive(const std::string &archivePath, ...@@ -513,7 +517,8 @@ std::vector<uint8_t> readFileFromArchive(const std::string &archivePath,
} }
} }
throw std::runtime_error("File " + fileRelativePathName + " not found in the archive"); throw std::runtime_error("File " + fileRelativePathName + " not found in the archive");
#endif
return fileContent;
} }
#endif //ENABLE_PLUGIN
}} // namespace jami::archiver }} // namespace jami::archiver
...@@ -88,7 +88,6 @@ std::vector<uint8_t> decompressGzip(const std::string& path); ...@@ -88,7 +88,6 @@ std::vector<uint8_t> decompressGzip(const std::string& path);
*/ */
gzFile openGzip(const std::string& path, const char *mode); gzFile openGzip(const std::string& path, const char *mode);
#ifdef ENABLE_PLUGIN
/** /**
* @brief listArchiveContent * @brief listArchiveContent
* @param archivePath * @param archivePath
...@@ -120,7 +119,6 @@ void uncompressArchive(const std::string& path, const std::string &dir, const Fi ...@@ -120,7 +119,6 @@ void uncompressArchive(const std::string& path, const std::string &dir, const Fi
*/ */
std::vector<uint8_t> readFileFromArchive(const std::string &path, std::vector<uint8_t> readFileFromArchive(const std::string &path,
const std::string &fileRelativePathName); const std::string &fileRelativePathName);
#endif //ENABLE_PLUGIN
} }
} // namespace jami } // namespace jami
...@@ -265,6 +265,7 @@ int JamiPluginManager::uninstallPlugin(const std::string &rootPath) ...@@ -265,6 +265,7 @@ int JamiPluginManager::uninstallPlugin(const std::string &rootPath)
bool JamiPluginManager::loadPlugin(const std::string &rootPath) bool JamiPluginManager::loadPlugin(const std::string &rootPath)
{ {
#ifdef ENABLE_PLUGIN
try try
{ {
bool status = pm_.load(getPluginDetails(rootPath).at("soPath")); bool status = pm_.load(getPluginDetails(rootPath).at("soPath"));
...@@ -279,10 +280,13 @@ bool JamiPluginManager::loadPlugin(const std::string &rootPath) ...@@ -279,10 +280,13 @@ bool JamiPluginManager::loadPlugin(const std::string &rootPath)
JAMI_ERR() << e.what(); JAMI_ERR() << e.what();
return false; return false;
} }
#endif
return false;
} }
bool JamiPluginManager::unloadPlugin(const std::string &rootPath) bool JamiPluginManager::unloadPlugin(const std::string &rootPath)
{ {
#ifdef ENABLE_PLUGIN
try try
{ {
bool status = pm_.unload(getPluginDetails(rootPath).at("soPath")); bool status = pm_.unload(getPluginDetails(rootPath).at("soPath"));
...@@ -297,6 +301,8 @@ bool JamiPluginManager::unloadPlugin(const std::string &rootPath) ...@@ -297,6 +301,8 @@ bool JamiPluginManager::unloadPlugin(const std::string &rootPath)
JAMI_ERR() << e.what(); JAMI_ERR() << e.what();
return false; return false;
} }
#endif
return false;
} }
void JamiPluginManager::togglePlugin(const std::string &rootPath, bool toggle) void JamiPluginManager::togglePlugin(const std::string &rootPath, bool toggle)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment