diff --git a/src/admininterface.cpp b/src/admininterface.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a3ac76dd8dd13fc28d1663be90ad90a25ba97bf8 --- /dev/null +++ b/src/admininterface.cpp @@ -0,0 +1,55 @@ +/** + * libtransport -- C++ library for easy XMPP Transports development + * + * Copyright (C) 2011, Jan Kaluza + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + */ + +#include "transport/admininterface.h" +#include "transport/user.h" +#include "transport/transport.h" +#include "transport/storagebackend.h" +#include "transport/conversationmanager.h" +#include "transport/rostermanager.h" +#include "storageresponder.h" +#include "log4cxx/logger.h" + +using namespace log4cxx; + +namespace Transport { + +static LoggerPtr logger = Logger::getLogger("AdminInterface"); + +AdminInterface::AdminInterface(Component *component, StorageBackend *storageBackend) { + m_component = component; + m_storageBackend = storageBackend; + + m_component->getStanzaChannel()->onMessageReceived.connect(bind(&AdminInterface::handleMessageReceived, this, _1)); +} + +AdminInterface::~AdminInterface() { +} + +void AdminInterface::handleMessageReceived(Swift::Message::ref message) { + if (!message->getTo().getNode().empty()) + return; + if (message->getFrom().getNode() != CONFIG_STRING(m_component->getConfig(), "service.admin_username")) + return; + + LOG4CXX_INFO(logger, "Message from admin received"); +} + +}