From d70554143554f1a4ed3d225d30a6e49227f40fc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Sun, 11 Feb 2018 23:29:58 +0100 Subject: =?UTF-8?q?Send=20a=20item-not-found=20error=20when=20the=20?= =?UTF-8?q?=E2=80=9Cafter=E2=80=9D=20value=20is=20not=20in=20the=20archive?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/database/database.hpp | 1 + src/xmpp/biboumi_component.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/database/database.hpp b/src/database/database.hpp index 810af16..fb62c34 100644 --- a/src/database/database.hpp +++ b/src/database/database.hpp @@ -22,6 +22,7 @@ class Database { public: using time_point = std::chrono::system_clock::time_point; + struct RecordNotFound: public std::exception {}; struct Uuid: Column { static constexpr auto name = "uuid_"; }; diff --git a/src/xmpp/biboumi_component.cpp b/src/xmpp/biboumi_component.cpp index cd6d570..405ac15 100644 --- a/src/xmpp/biboumi_component.cpp +++ b/src/xmpp/biboumi_component.cpp @@ -467,8 +467,12 @@ void BiboumiComponent::handle_iq(const Stanza& stanza) #ifdef USE_DATABASE else if ((query = stanza.get_child("query", MAM_NS))) { - if (this->handle_mam_request(stanza)) - stanza_error.disable(); + try { + if (this->handle_mam_request(stanza)) + stanza_error.disable(); + } catch (const Database::RecordNotFound& exc) { + error_name = "item-not-found"; + } } else if ((query = stanza.get_child("query", MUC_OWNER_NS))) { -- cgit v1.2.3