diff options
Diffstat (limited to 'Swiften')
28 files changed, 38 insertions, 63 deletions
diff --git a/Swiften/Client/ClientSessionStanzaChannel.cpp b/Swiften/Client/ClientSessionStanzaChannel.cpp index f1cba5d..f48b306 100644 --- a/Swiften/Client/ClientSessionStanzaChannel.cpp +++ b/Swiften/Client/ClientSessionStanzaChannel.cpp @@ -6,10 +6,10 @@ #include <Swiften/Client/ClientSessionStanzaChannel.h> -#include <iostream> - #include <boost/bind.hpp> +#include <Swiften/Base/Log.h> + namespace Swift { ClientSessionStanzaChannel::~ClientSessionStanzaChannel() { @@ -49,7 +49,7 @@ std::string ClientSessionStanzaChannel::getNewIQID() { void ClientSessionStanzaChannel::send(std::shared_ptr<Stanza> stanza) { if (!isAvailable()) { - std::cerr << "Warning: Client: Trying to send a stanza while disconnected." << std::endl; + SWIFT_LOG(warning) << "Client: Trying to send a stanza while disconnected." << std::endl; return; } session->sendStanza(stanza); diff --git a/Swiften/Component/ComponentConnector.cpp b/Swiften/Component/ComponentConnector.cpp index 632eb84..a7375a7 100644 --- a/Swiften/Component/ComponentConnector.cpp +++ b/Swiften/Component/ComponentConnector.cpp @@ -6,8 +6,6 @@ #include <Swiften/Component/ComponentConnector.h> -#include <iostream> - #include <boost/bind.hpp> #include <Swiften/Network/ConnectionFactory.h> diff --git a/Swiften/Component/ComponentSessionStanzaChannel.cpp b/Swiften/Component/ComponentSessionStanzaChannel.cpp index 282d9f1..fd61594 100644 --- a/Swiften/Component/ComponentSessionStanzaChannel.cpp +++ b/Swiften/Component/ComponentSessionStanzaChannel.cpp @@ -6,10 +6,10 @@ #include <Swiften/Component/ComponentSessionStanzaChannel.h> -#include <iostream> - #include <boost/bind.hpp> +#include <Swiften/Base/Log.h> + namespace Swift { void ComponentSessionStanzaChannel::setSession(std::shared_ptr<ComponentSession> session) { @@ -38,7 +38,7 @@ std::string ComponentSessionStanzaChannel::getNewIQID() { void ComponentSessionStanzaChannel::send(std::shared_ptr<Stanza> stanza) { if (!isAvailable()) { - std::cerr << "Warning: Component: Trying to send a stanza while disconnected." << std::endl; + SWIFT_LOG(warning) << "Component: Trying to send a stanza while disconnected." << std::endl; return; } session->sendStanza(stanza); diff --git a/Swiften/Component/CoreComponent.cpp b/Swiften/Component/CoreComponent.cpp index dfa0896..3896bdd 100644 --- a/Swiften/Component/CoreComponent.cpp +++ b/Swiften/Component/CoreComponent.cpp @@ -6,11 +6,10 @@ #include <Swiften/Component/CoreComponent.h> -#include <iostream> - #include <boost/bind.hpp> #include <Swiften/Base/IDGenerator.h> +#include <Swiften/Base/Log.h> #include <Swiften/Component/ComponentSession.h> #include <Swiften/Component/ComponentSessionStanzaChannel.h> #include <Swiften/Network/Connector.h> @@ -34,7 +33,7 @@ CoreComponent::CoreComponent(const JID& jid, const std::string& secret, NetworkF CoreComponent::~CoreComponent() { if (session_ || connection_) { - std::cerr << "Warning: Component not disconnected properly" << std::endl; + SWIFT_LOG(warning) << "Component not disconnected properly" << std::endl; } delete iqRouter_; diff --git a/Swiften/Disco/CapsManager.cpp b/Swiften/Disco/CapsManager.cpp index 337bad6..794cf74 100644 --- a/Swiften/Disco/CapsManager.cpp +++ b/Swiften/Disco/CapsManager.cpp @@ -6,10 +6,9 @@ #include <Swiften/Disco/CapsManager.h> -#include <iostream> - #include <boost/bind.hpp> +#include <Swiften/Base/Log.h> #include <Swiften/Client/StanzaChannel.h> #include <Swiften/Disco/CapsInfoGenerator.h> #include <Swiften/Disco/CapsStorage.h> @@ -54,7 +53,7 @@ void CapsManager::handleDiscoInfoReceived(const JID& from, const std::string& ha requestedDiscoInfos.erase(hash); if (error || !discoInfo || CapsInfoGenerator("", crypto).generateCapsInfo(*discoInfo.get()).getVersion() != hash) { if (warnOnInvalidHash && !error && discoInfo) { - std::cerr << "Warning: Caps from " << from.toString() << " do not verify" << std::endl; + SWIFT_LOG(warning) << "Caps from " << from.toString() << " do not verify" << std::endl; } failingCaps.insert(std::make_pair(from, hash)); std::map<std::string, std::set< std::pair<JID, std::string> > >::iterator i = fallbacks.find(hash); diff --git a/Swiften/Disco/DummyEntityCapsProvider.cpp b/Swiften/Disco/DummyEntityCapsProvider.cpp index 6e9d898..fce38fe 100644 --- a/Swiften/Disco/DummyEntityCapsProvider.cpp +++ b/Swiften/Disco/DummyEntityCapsProvider.cpp @@ -1,13 +1,11 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Disco/DummyEntityCapsProvider.h> -#include <iostream> - namespace Swift { DiscoInfo::ref DummyEntityCapsProvider::getCaps(const JID& jid) const { diff --git a/Swiften/Elements/Whiteboard/WhiteboardColor.cpp b/Swiften/Elements/Whiteboard/WhiteboardColor.cpp index 6bf7e03..037fde4 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardColor.cpp +++ b/Swiften/Elements/Whiteboard/WhiteboardColor.cpp @@ -14,7 +14,6 @@ #include <cstdio> #include <iomanip> -#include <iostream> #include <sstream> #include <Swiften/Base/String.h> diff --git a/Swiften/Entity/PayloadPersister.cpp b/Swiften/Entity/PayloadPersister.cpp index 4b3fb52..3fd246c 100644 --- a/Swiften/Entity/PayloadPersister.cpp +++ b/Swiften/Entity/PayloadPersister.cpp @@ -6,12 +6,11 @@ #include <Swiften/Entity/PayloadPersister.h> -#include <iostream> - #include <boost/filesystem.hpp> #include <boost/filesystem/fstream.hpp> #include <Swiften/Base/ByteArray.h> +#include <Swiften/Base/Log.h> #include <Swiften/Parser/PayloadParser.h> #include <Swiften/Parser/PayloadParserFactory.h> #include <Swiften/Parser/PayloadParsers/UnitTest/PayloadParserTester.h> @@ -35,7 +34,7 @@ void PayloadPersister::savePayload(std::shared_ptr<Payload> payload, const boost file.close(); } catch (const boost::filesystem::filesystem_error& e) { - std::cerr << "ERROR: " << e.what() << std::endl; + SWIFT_LOG(error) << e.what() << std::endl; } } @@ -51,7 +50,7 @@ std::shared_ptr<Payload> PayloadPersister::loadPayload(const boost::filesystem:: } } catch (const boost::filesystem::filesystem_error& e) { - std::cerr << "ERROR: " << e.what() << std::endl; + SWIFT_LOG(error) << e.what() << std::endl; } return std::shared_ptr<Payload>(); } diff --git a/Swiften/JID/JID.cpp b/Swiften/JID/JID.cpp index 6825443..54084d6 100644 --- a/Swiften/JID/JID.cpp +++ b/Swiften/JID/JID.cpp @@ -8,7 +8,6 @@ #include <vector> #include <list> -#include <iostream> #include <string> #ifdef SWIFTEN_CACHE_JID_PREP @@ -19,7 +18,6 @@ #include <boost/algorithm/string/find_format.hpp> #include <boost/algorithm/string/finder.hpp> #include <boost/optional.hpp> -#include <iostream> #include <sstream> #include <Swiften/Base/String.h> diff --git a/Swiften/MUC/MUCBookmarkManager.cpp b/Swiften/MUC/MUCBookmarkManager.cpp index 602e876..a06a0a2 100644 --- a/Swiften/MUC/MUCBookmarkManager.cpp +++ b/Swiften/MUC/MUCBookmarkManager.cpp @@ -6,7 +6,6 @@ #include <Swiften/MUC/MUCBookmarkManager.h> -#include <iostream> #include <memory> #include <boost/bind.hpp> diff --git a/Swiften/Network/UnixProxyProvider.cpp b/Swiften/Network/UnixProxyProvider.cpp index 848de52..6c23add 100644 --- a/Swiften/Network/UnixProxyProvider.cpp +++ b/Swiften/Network/UnixProxyProvider.cpp @@ -10,12 +10,9 @@ * See the COPYING file for more information. */ -#include <stdio.h> -#include <stdlib.h> -#include <iostream> +#include <Swiften/Network/UnixProxyProvider.h> #include <Swiften/Base/foreach.h> -#include <Swiften/Network/UnixProxyProvider.h> #if defined(HAVE_GCONF) # include "Swiften/Network/GConfProxyProvider.h" #endif diff --git a/Swiften/Network/WindowsProxyProvider.cpp b/Swiften/Network/WindowsProxyProvider.cpp index 8f90d1e..75e087a 100644 --- a/Swiften/Network/WindowsProxyProvider.cpp +++ b/Swiften/Network/WindowsProxyProvider.cpp @@ -16,15 +16,13 @@ #include <stdio.h> #include <stdlib.h> -#include <iostream> - #include <boost/lexical_cast.hpp> #include <windows.h> #include <Swiften/Base/ByteArray.h> +#include <Swiften/Base/Log.h> #include <Swiften/Base/foreach.h> -#include <Swiften/Base/log.h> namespace Swift { @@ -86,7 +84,7 @@ HostAddressPort WindowsProxyProvider::getAsHostAddressPort(std::string proxy) { ret = HostAddressPort(HostAddress(tmp.first), port); } catch(...) { - std::cerr << "Exception occured while parsing windows proxy \"getHostAddressPort\"." << std::endl; + SWIFT_LOG(error) << "Exception occured while parsing windows proxy \"getHostAddressPort\"." << std::endl; } return ret; diff --git a/Swiften/Parser/ExpatParser.cpp b/Swiften/Parser/ExpatParser.cpp index fba82e2..2a6b227 100644 --- a/Swiften/Parser/ExpatParser.cpp +++ b/Swiften/Parser/ExpatParser.cpp @@ -1,14 +1,15 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Parser/ExpatParser.h> -#include <iostream> #include <string> + #include <expat.h> + #include <boost/numeric/conversion/cast.hpp> #include <Swiften/Base/String.h> diff --git a/Swiften/Parser/IQParser.cpp b/Swiften/Parser/IQParser.cpp index 573ce07..5cfae34 100644 --- a/Swiften/Parser/IQParser.cpp +++ b/Swiften/Parser/IQParser.cpp @@ -6,10 +6,10 @@ #include <Swiften/Parser/IQParser.h> -#include <iostream> - #include <boost/optional.hpp> +#include <Swiften/Base/Log.h> + namespace Swift { IQParser::IQParser(PayloadParserFactoryCollection* factories) : @@ -32,7 +32,7 @@ void IQParser::handleStanzaAttributes(const AttributeMap& attributes) { getStanzaGeneric()->setType(IQ::Error); } else { - std::cerr << "Unknown IQ type: " << *type << std::endl; + SWIFT_LOG(warning) << "Unknown IQ type: " << *type << std::endl; getStanzaGeneric()->setType(IQ::Get); } } diff --git a/Swiften/Parser/LibXMLParser.cpp b/Swiften/Parser/LibXMLParser.cpp index 10de4f8..a880141 100644 --- a/Swiften/Parser/LibXMLParser.cpp +++ b/Swiften/Parser/LibXMLParser.cpp @@ -8,13 +8,13 @@ #include <cassert> #include <cstring> -#include <iostream> #include <string> #include <boost/numeric/conversion/cast.hpp> #include <libxml/parser.h> +#include <Swiften/Base/Log.h> #include <Swiften/Parser/XMLParserClient.h> namespace Swift { @@ -28,7 +28,7 @@ static void handleStartElement(void* parser, const xmlChar* name, const xmlChar* AttributeMap attributeValues; if (nbDefaulted != 0) { // Just because i don't understand what this means yet :-) - std::cerr << "Unexpected nbDefaulted on XML element" << std::endl; + SWIFT_LOG(error) << "Unexpected nbDefaulted on XML element" << std::endl; } for (int i = 0; i < nbAttributes*5; i += 5) { std::string attributeNS = ""; diff --git a/Swiften/Parser/PayloadParsers/FormParser.cpp b/Swiften/Parser/PayloadParsers/FormParser.cpp index 4a0a26f..5ea75c5 100644 --- a/Swiften/Parser/PayloadParsers/FormParser.cpp +++ b/Swiften/Parser/PayloadParsers/FormParser.cpp @@ -5,7 +5,6 @@ */ #include <Swiften/Parser/PayloadParsers/FormParser.h> -#include <iostream> #include <map> #include <Swiften/Base/foreach.h> diff --git a/Swiften/Parser/PayloadParsers/MUCItemParser.cpp b/Swiften/Parser/PayloadParsers/MUCItemParser.cpp index 0486cb4..ce74671 100644 --- a/Swiften/Parser/PayloadParsers/MUCItemParser.cpp +++ b/Swiften/Parser/PayloadParsers/MUCItemParser.cpp @@ -7,7 +7,6 @@ #include <Swiften/Parser/PayloadParsers/MUCItemParser.h> #include <cassert> -#include <iostream> #include <boost/lexical_cast.hpp> diff --git a/Swiften/Parser/PresenceParser.cpp b/Swiften/Parser/PresenceParser.cpp index 4a27a24..0235a12 100644 --- a/Swiften/Parser/PresenceParser.cpp +++ b/Swiften/Parser/PresenceParser.cpp @@ -6,10 +6,10 @@ #include <Swiften/Parser/PresenceParser.h> -#include <iostream> - #include <boost/optional.hpp> +#include <Swiften/Base/Log.h> + namespace Swift { PresenceParser::PresenceParser(PayloadParserFactoryCollection* factories) : @@ -41,7 +41,7 @@ void PresenceParser::handleStanzaAttributes(const AttributeMap& attributes) { getStanzaGeneric()->setType(Presence::Error); } else { - std::cerr << "Unknown Presence type: " << *type << std::endl; + SWIFT_LOG(error) << "Unknown Presence type: " << *type << std::endl; getStanzaGeneric()->setType(Presence::Available); } } diff --git a/Swiften/Parser/StanzaParser.cpp b/Swiften/Parser/StanzaParser.cpp index da252bf..8be4103 100644 --- a/Swiften/Parser/StanzaParser.cpp +++ b/Swiften/Parser/StanzaParser.cpp @@ -7,7 +7,6 @@ #include <Swiften/Parser/StanzaParser.h> #include <cassert> -#include <iostream> #include <boost/optional.hpp> diff --git a/Swiften/Parser/Tree/ParserElement.cpp b/Swiften/Parser/Tree/ParserElement.cpp index 27bd790..5415945 100644 --- a/Swiften/Parser/Tree/ParserElement.cpp +++ b/Swiften/Parser/Tree/ParserElement.cpp @@ -7,8 +7,6 @@ #include <Swiften/Parser/Tree/ParserElement.h> -#include <iostream> - #include <boost/lambda/bind.hpp> #include <boost/lambda/lambda.hpp> diff --git a/Swiften/Parser/XMPPParser.cpp b/Swiften/Parser/XMPPParser.cpp index 29c02a0..2b45a12 100644 --- a/Swiften/Parser/XMPPParser.cpp +++ b/Swiften/Parser/XMPPParser.cpp @@ -7,7 +7,6 @@ #include <Swiften/Parser/XMPPParser.h> #include <cassert> -#include <iostream> #include <string> #include <Swiften/Elements/ProtocolHeader.h> diff --git a/Swiften/Roster/XMPPRosterController.cpp b/Swiften/Roster/XMPPRosterController.cpp index b5e72f5..57b0645 100644 --- a/Swiften/Roster/XMPPRosterController.cpp +++ b/Swiften/Roster/XMPPRosterController.cpp @@ -6,10 +6,9 @@ #include <Swiften/Roster/XMPPRosterController.h> -#include <iostream> - #include <boost/bind.hpp> +#include <Swiften/Base/Log.h> #include <Swiften/Base/foreach.h> #include <Swiften/Elements/RosterItemPayload.h> #include <Swiften/Queries/IQRouter.h> @@ -68,7 +67,7 @@ void XMPPRosterController::handleRosterReceived(std::shared_ptr<RosterPayload> r xmppRoster_->addContact(item.getJID(), item.getName(), item.getGroups(), item.getSubscription()); } else { - std::cerr << "ERROR: Stored invalid roster item" << std::endl; + SWIFT_LOG(error) << "Stored invalid roster item" << std::endl; } } } diff --git a/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp b/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp index 9a05431..ed010b4 100644 --- a/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp @@ -6,7 +6,6 @@ #include <Swiften/Serializer/PayloadSerializers/FormSerializer.h> -#include <iostream> #include <memory> #include <string> diff --git a/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp b/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp index 5aebca3..34fd149 100644 --- a/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp @@ -12,11 +12,11 @@ #include <Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.h> -#include <iostream> #include <memory> #include <boost/lexical_cast.hpp> +#include <Swiften/Base/Log.h> #include <Swiften/Elements/Whiteboard/WhiteboardDeleteOperation.h> #include <Swiften/Elements/Whiteboard/WhiteboardInsertOperation.h> #include <Swiften/Elements/Whiteboard/WhiteboardUpdateOperation.h> @@ -199,7 +199,7 @@ namespace Swift { case WhiteboardPayload::SessionTerminate: return "session-terminate"; case WhiteboardPayload::UnknownType: - std::cerr << "Warning: Serializing unknown action value." << std::endl; + SWIFT_LOG(warning) << "Serializing unknown action value." << std::endl; return ""; } assert(false); diff --git a/Swiften/Serializer/StanzaSerializer.cpp b/Swiften/Serializer/StanzaSerializer.cpp index de1e8f1..6440fbb 100644 --- a/Swiften/Serializer/StanzaSerializer.cpp +++ b/Swiften/Serializer/StanzaSerializer.cpp @@ -6,10 +6,10 @@ #include <Swiften/Serializer/StanzaSerializer.h> -#include <iostream> #include <sstream> #include <typeinfo> +#include <Swiften/Base/Log.h> #include <Swiften/Base/foreach.h> #include <Swiften/Elements/Stanza.h> #include <Swiften/Serializer/PayloadSerializer.h> @@ -53,7 +53,7 @@ SafeByteArray StanzaSerializer::serialize(std::shared_ptr<ToplevelElement> eleme serializedPayloads += serializer->serialize(payload); } else { - std::cerr << "Could not find serializer for " << typeid(*(payload.get())).name() << std::endl; + SWIFT_LOG(warning) << "Could not find serializer for " << typeid(*(payload.get())).name() << std::endl; } } if (!serializedPayloads.empty()) { diff --git a/Swiften/Serializer/XMPPSerializer.cpp b/Swiften/Serializer/XMPPSerializer.cpp index 8b2fd5c..08b5485 100644 --- a/Swiften/Serializer/XMPPSerializer.cpp +++ b/Swiften/Serializer/XMPPSerializer.cpp @@ -7,11 +7,11 @@ #include <Swiften/Serializer/XMPPSerializer.h> #include <cassert> -#include <iostream> #include <memory> #include <boost/bind.hpp> +#include <Swiften/Base/Log.h> #include <Swiften/Base/foreach.h> #include <Swiften/Elements/ProtocolHeader.h> #include <Swiften/Serializer/AuthChallengeSerializer.h> @@ -90,7 +90,7 @@ SafeByteArray XMPPSerializer::serializeElement(std::shared_ptr<ToplevelElement> return (*i)->serialize(element); } else { - std::cerr << "Could not find serializer for " << typeid(*(element.get())).name() << std::endl; + SWIFT_LOG(warning) << "Could not find serializer for " << typeid(*(element.get())).name() << std::endl; return createSafeByteArray(""); } } diff --git a/Swiften/StreamManagement/StanzaAckRequester.cpp b/Swiften/StreamManagement/StanzaAckRequester.cpp index 8e9e7f3..8941f4a 100644 --- a/Swiften/StreamManagement/StanzaAckRequester.cpp +++ b/Swiften/StreamManagement/StanzaAckRequester.cpp @@ -6,10 +6,9 @@ #include <Swiften/StreamManagement/StanzaAckRequester.h> -#include <iostream> - #include <boost/numeric/conversion/cast.hpp> +#include <Swiften/Base/Log.h> #include <Swiften/Elements/Message.h> namespace Swift { @@ -31,7 +30,7 @@ void StanzaAckRequester::handleAckReceived(unsigned int handledStanzasCount) { unsigned int i = lastHandledStanzasCount; while (i != handledStanzasCount) { if (unackedStanzas.empty()) { - std::cerr << "Warning: Server acked more stanzas than we sent" << std::endl; + SWIFT_LOG(warning) << "Server acked more stanzas than we sent" << std::endl; break; } std::shared_ptr<Stanza> ackedStanza = unackedStanzas.front(); diff --git a/Swiften/Whiteboard/WhiteboardSession.cpp b/Swiften/Whiteboard/WhiteboardSession.cpp index befef4f..c90475a 100644 --- a/Swiften/Whiteboard/WhiteboardSession.cpp +++ b/Swiften/Whiteboard/WhiteboardSession.cpp @@ -12,7 +12,6 @@ #include <Swiften/Whiteboard/WhiteboardSession.h> -#include <iostream> #include <memory> #include <Swiften/Elements/ErrorPayload.h> |