SDK: add ChatHandler options

- fix classes names to capitalize
- add set -e to bash scripts
- code cleanup

Change-Id: Icc5c096afac62b7fe88f15496b15c4bfb45a9b0d
GitLab: #5
diff --git a/GreenScreen/build.sh b/GreenScreen/build.sh
index 85733fd..fd936e8 100755
--- a/GreenScreen/build.sh
+++ b/GreenScreen/build.sh
@@ -1,5 +1,6 @@
 #! /bin/bash
 # Build the plugin for the project
+set -e
 export OSTYPE
 ARCH=$(arch)
 EXTRAPATH=''
diff --git a/GreenScreen/main.cpp b/GreenScreen/main.cpp
index d669ded..406c7ce 100644
--- a/GreenScreen/main.cpp
+++ b/GreenScreen/main.cpp
@@ -52,11 +52,11 @@
 
     // If invokeService doesn't return an error
     if (api) {
-        std::map<std::string, std::string> ppm;
-        api->invokeService(api, "getPluginPreferences", &ppm);
+        std::map<std::string, std::string> preferences;
+        api->invokeService(api, "getPluginPreferences", &preferences);
         std::string dataPath;
         api->invokeService(api, "getPluginDataPath", &dataPath);
-        auto fmp = std::make_unique<jami::PluginMediaHandler>(std::move(ppm), std::move(dataPath));
+        auto fmp = std::make_unique<jami::PluginMediaHandler>(std::move(preferences), std::move(dataPath));
 
         if (!api->manageComponent(api, "CallMediaHandlerManager", fmp.release())) {
             return pluginExit;
diff --git a/GreenScreen/pluginMediaHandler.cpp b/GreenScreen/pluginMediaHandler.cpp
index fe6ab46..44d68c7 100644
--- a/GreenScreen/pluginMediaHandler.cpp
+++ b/GreenScreen/pluginMediaHandler.cpp
@@ -22,6 +22,7 @@
 #include "pluginMediaHandler.h"
 // Logger
 #include "pluglog.h"
+#include <string_view>
 const char sep = separator();
 const std::string TAG = "FORESEG";
 
@@ -29,12 +30,12 @@
 
 namespace jami {
 
-PluginMediaHandler::PluginMediaHandler(std::map<std::string, std::string>&& ppm,
+PluginMediaHandler::PluginMediaHandler(std::map<std::string, std::string>&& preferences,
                                        std::string&& datapath)
     : datapath_ {datapath}
-    , ppm_ {ppm}
+    , preferences_ {preferences}
 {
-    setGlobalPluginParameters(ppm_);
+    setGlobalPluginParameters(preferences_);
     setId(datapath_);
     mVS = std::make_shared<VideoSubscriber>(datapath_);
 }
@@ -43,12 +44,12 @@
 PluginMediaHandler::notifyAVFrameSubject(const StreamData& data, jami::avSubjectPtr subject)
 {
     std::ostringstream oss;
-    std::string direction = data.direction ? "Receive" : "Preview";
+    std::string_view direction = data.direction ? "Receive" : "Preview";
     oss << "NEW SUBJECT: [" << data.id << "," << direction << "]" << std::endl;
 
     bool preferredStreamDirection = false;
-    auto it = ppm_.find("streamslist");
-    if (it != ppm_.end()) {
+    auto it = preferences_.find("streamslist");
+    if (it != preferences_.end()) {
         Plog::log(Plog::LogPriority::INFO, TAG, "SET PARAMETERS");
         preferredStreamDirection = it->second == "in";
     }
@@ -80,8 +81,8 @@
 void
 PluginMediaHandler::setPreferenceAttribute(const std::string& key, const std::string& value)
 {
-    auto it = ppm_.find(key);
-    if (it != ppm_.end() && it->second != value) {
+    auto it = preferences_.find(key);
+    if (it != preferences_.end() && it->second != value) {
         it->second = value;
         if (key == "background") {
             mVS->setBackground(value);
diff --git a/GreenScreen/pluginMediaHandler.h b/GreenScreen/pluginMediaHandler.h
index 41a1693..3962246 100644
--- a/GreenScreen/pluginMediaHandler.h
+++ b/GreenScreen/pluginMediaHandler.h
@@ -35,7 +35,7 @@
 class PluginMediaHandler : public jami::CallMediaHandler
 {
 public:
-    PluginMediaHandler(std::map<std::string, std::string>&& ppm, std::string&& dataPath);
+    PluginMediaHandler(std::map<std::string, std::string>&& preferences, std::string&& dataPath);
     ~PluginMediaHandler();
 
     virtual void notifyAVFrameSubject(const StreamData& data, avSubjectPtr subject) override;
@@ -49,7 +49,7 @@
 
 private:
     const std::string datapath_;
-    std::map<std::string, std::string> ppm_;
+    std::map<std::string, std::string> preferences_;
     std::string attached_ {'0'};
 };
 } // namespace jami