summaryrefslogtreecommitdiff
path: root/louloulibs/xmpp
diff options
context:
space:
mode:
Diffstat (limited to 'louloulibs/xmpp')
-rw-r--r--louloulibs/xmpp/adhoc_commands_handler.hpp11
-rw-r--r--louloulibs/xmpp/adhoc_session.hpp12
-rw-r--r--louloulibs/xmpp/jid.hpp11
-rw-r--r--louloulibs/xmpp/xmpp_component.hpp10
-rw-r--r--louloulibs/xmpp/xmpp_parser.cpp4
-rw-r--r--louloulibs/xmpp/xmpp_parser.hpp16
-rw-r--r--louloulibs/xmpp/xmpp_stanza.hpp8
7 files changed, 37 insertions, 35 deletions
diff --git a/louloulibs/xmpp/adhoc_commands_handler.hpp b/louloulibs/xmpp/adhoc_commands_handler.hpp
index 0614b2f..65b094d 100644
--- a/louloulibs/xmpp/adhoc_commands_handler.hpp
+++ b/louloulibs/xmpp/adhoc_commands_handler.hpp
@@ -21,6 +21,12 @@ public:
commands{}
{ }
~AdhocCommandsHandler() = default;
+
+ AdhocCommandsHandler(const AdhocCommandsHandler&) = delete;
+ AdhocCommandsHandler(AdhocCommandsHandler&&) = delete;
+ AdhocCommandsHandler& operator=(const AdhocCommandsHandler&) = delete;
+ AdhocCommandsHandler& operator=(AdhocCommandsHandler&&) = delete;
+
/**
* Returns the list of available commands.
*/
@@ -63,11 +69,6 @@ private:
* Of the form: {{session_id, owner_jid}, session}.
*/
std::map<std::pair<const std::string, const std::string>, AdhocSession> sessions;
-
- AdhocCommandsHandler(const AdhocCommandsHandler&) = delete;
- AdhocCommandsHandler(AdhocCommandsHandler&&) = delete;
- AdhocCommandsHandler& operator=(const AdhocCommandsHandler&) = delete;
- AdhocCommandsHandler& operator=(AdhocCommandsHandler&&) = delete;
};
#endif // ADHOC_COMMANDS_HANDLER_HPP
diff --git a/louloulibs/xmpp/adhoc_session.hpp b/louloulibs/xmpp/adhoc_session.hpp
index e98b6a8..0966c4e 100644
--- a/louloulibs/xmpp/adhoc_session.hpp
+++ b/louloulibs/xmpp/adhoc_session.hpp
@@ -25,6 +25,12 @@ public:
explicit AdhocSession(const AdhocCommand& command, const std::string& owner_jid,
const std::string& to_jid);
~AdhocSession() = default;
+
+ AdhocSession(const AdhocSession&) = delete;
+ AdhocSession(AdhocSession&&) = delete;
+ AdhocSession& operator=(const AdhocSession&) = delete;
+ AdhocSession& operator=(AdhocSession&&) = delete;
+
/**
* Return the function to be executed, found in our AdhocCommand, for the
* current_step. And increment the current_step.
@@ -80,12 +86,6 @@ public:
* any key in there.
*/
std::map<std::string, std::string> vars;
-
-private:
- AdhocSession(const AdhocSession&) = delete;
- AdhocSession(AdhocSession&&) = delete;
- AdhocSession& operator=(const AdhocSession&) = delete;
- AdhocSession& operator=(AdhocSession&&) = delete;
};
#endif // ADHOC_SESSION_HPP
diff --git a/louloulibs/xmpp/jid.hpp b/louloulibs/xmpp/jid.hpp
index e2ee586..5ff5a4f 100644
--- a/louloulibs/xmpp/jid.hpp
+++ b/louloulibs/xmpp/jid.hpp
@@ -11,6 +11,11 @@ class Jid
public:
explicit Jid(const std::string& jid);
+ Jid(const Jid&) = delete;
+ Jid(Jid&&) = delete;
+ Jid& operator=(const Jid&) = delete;
+ Jid& operator=(Jid&&) = delete;
+
std::string domain;
std::string local;
std::string resource;
@@ -23,12 +28,6 @@ public:
{
return this->local + "@" + this->domain + "/" + this->resource;
}
-
-private:
- Jid(const Jid&) = delete;
- Jid(Jid&&) = delete;
- Jid& operator=(const Jid&) = delete;
- Jid& operator=(Jid&&) = delete;
};
/**
diff --git a/louloulibs/xmpp/xmpp_component.hpp b/louloulibs/xmpp/xmpp_component.hpp
index 07322dd..913e337 100644
--- a/louloulibs/xmpp/xmpp_component.hpp
+++ b/louloulibs/xmpp/xmpp_component.hpp
@@ -38,6 +38,11 @@ public:
explicit XmppComponent(std::shared_ptr<Poller> poller, const std::string& hostname, const std::string& secret);
virtual ~XmppComponent() = default;
+ XmppComponent(const XmppComponent&) = delete;
+ XmppComponent(XmppComponent&&) = delete;
+ XmppComponent& operator=(const XmppComponent&) = delete;
+ XmppComponent& operator=(XmppComponent&&) = delete;
+
void on_connection_failed(const std::string& reason) override final;
void on_connected() override final;
void on_connection_close(const std::string& error) override final;
@@ -231,11 +236,6 @@ protected:
std::unordered_map<std::string, std::function<void(const Stanza&)>> stanza_handlers;
AdhocCommandsHandler adhoc_commands_handler;
-
- XmppComponent(const XmppComponent&) = delete;
- XmppComponent(XmppComponent&&) = delete;
- XmppComponent& operator=(const XmppComponent&) = delete;
- XmppComponent& operator=(XmppComponent&&) = delete;
};
#endif // XMPP_COMPONENT_INCLUDED
diff --git a/louloulibs/xmpp/xmpp_parser.cpp b/louloulibs/xmpp/xmpp_parser.cpp
index 69de145..dc12000 100644
--- a/louloulibs/xmpp/xmpp_parser.cpp
+++ b/louloulibs/xmpp/xmpp_parser.cpp
@@ -118,7 +118,7 @@ void XmppParser::end_element(const XML_Char*)
this->stanza_event(*this->current_node);
// Note: deleting all the children of our parent deletes ourself,
// so current_node is an invalid pointer after this line
- this->current_node->get_parent()->delete_all_children();
+ parent->delete_all_children();
}
this->current_node = parent;
}
@@ -139,7 +139,7 @@ void XmppParser::stanza_event(const Stanza& stanza) const
try {
callback(stanza);
} catch (const std::exception& e) {
- log_debug("Unhandled exception: " << e.what());
+ log_error("Unhandled exception: " << e.what());
}
}
}
diff --git a/louloulibs/xmpp/xmpp_parser.hpp b/louloulibs/xmpp/xmpp_parser.hpp
index 3474b13..93c6c53 100644
--- a/louloulibs/xmpp/xmpp_parser.hpp
+++ b/louloulibs/xmpp/xmpp_parser.hpp
@@ -32,13 +32,13 @@ class XmppParser
public:
explicit XmppParser();
~XmppParser();
+ XmppParser(const XmppParser&) = delete;
+ XmppParser& operator=(const XmppParser&) = delete;
+ XmppParser(XmppParser&&) = delete;
+ XmppParser& operator=(XmppParser&&) = delete;
public:
/**
- * Init the XML parser and install the callbacks
- */
- void init_xml_parser();
- /**
* Feed the parser with some XML data
*/
int feed(const char* data, const int len, const bool is_final);
@@ -99,6 +99,11 @@ public:
private:
/**
+ * Init the XML parser and install the callbacks
+ */
+ void init_xml_parser();
+
+ /**
* Expat structure.
*/
XML_Parser parser;
@@ -123,9 +128,6 @@ private:
std::vector<std::function<void(const Stanza&)>> stanza_callbacks;
std::vector<std::function<void(const XmlNode&)>> stream_open_callbacks;
std::vector<std::function<void(const XmlNode&)>> stream_close_callbacks;
-
- XmppParser(const XmppParser&) = delete;
- XmppParser& operator=(const XmppParser&) = delete;
};
#endif // XMPP_PARSER_INCLUDED
diff --git a/louloulibs/xmpp/xmpp_stanza.hpp b/louloulibs/xmpp/xmpp_stanza.hpp
index 77ab206..28b8414 100644
--- a/louloulibs/xmpp/xmpp_stanza.hpp
+++ b/louloulibs/xmpp/xmpp_stanza.hpp
@@ -25,7 +25,6 @@ class XmlNode
public:
explicit XmlNode(const std::string& name, XmlNode* parent);
explicit XmlNode(const std::string& name);
- XmlNode(XmlNode&& node) = default;
/**
* The copy constructor does not copy the parent attribute. The children
* nodes are all copied recursively.
@@ -42,6 +41,10 @@ public:
this->add_child(std::make_unique<XmlNode>(*child));
}
+ XmlNode(XmlNode&& node) = default;
+ XmlNode& operator=(const XmlNode&) = delete;
+ XmlNode& operator=(XmlNode&&) = delete;
+
~XmlNode() = default;
void delete_all_children();
@@ -129,9 +132,6 @@ private:
std::vector<std::unique_ptr<XmlNode>> children;
std::string inner;
std::string tail;
-
- XmlNode& operator=(const XmlNode&) = delete;
- XmlNode& operator=(XmlNode&&) = delete;
};
std::ostream& operator<<(std::ostream& os, const XmlNode& node);