From 555eb57d29614a23572df12d59f02ebf5fdd2672 Mon Sep 17 00:00:00 2001 From: Jeremy Lainé Date: Mon, 23 Aug 2010 08:09:31 +0000 Subject: rename QXmppSession to QXmppSessionIq for consistency --- src/QXmppIncomingClient.cpp | 2 +- src/QXmppOutgoingClient.cpp | 11 ++++------ src/QXmppSession.cpp | 53 --------------------------------------------- src/QXmppSession.h | 43 ------------------------------------ src/QXmppSessionIq.cpp | 44 +++++++++++++++++++++++++++++++++++++ src/QXmppSessionIq.h | 45 ++++++++++++++++++++++++++++++++++++++ src/src.pro | 4 ++-- 7 files changed, 96 insertions(+), 106 deletions(-) delete mode 100644 src/QXmppSession.cpp delete mode 100644 src/QXmppSession.h create mode 100644 src/QXmppSessionIq.cpp create mode 100644 src/QXmppSessionIq.h (limited to 'src') diff --git a/src/QXmppIncomingClient.cpp b/src/QXmppIncomingClient.cpp index 565a17c9..1211bc18 100644 --- a/src/QXmppIncomingClient.cpp +++ b/src/QXmppIncomingClient.cpp @@ -29,7 +29,7 @@ #include "QXmppBind.h" #include "QXmppConstants.h" #include "QXmppMessage.h" -#include "QXmppSession.h" +#include "QXmppSessionIq.h" #include "QXmppStreamFeatures.h" #include "QXmppUtils.h" diff --git a/src/QXmppOutgoingClient.cpp b/src/QXmppOutgoingClient.cpp index 145f5b1d..83f8f895 100644 --- a/src/QXmppOutgoingClient.cpp +++ b/src/QXmppOutgoingClient.cpp @@ -47,7 +47,7 @@ #include "QXmppPingIq.h" #include "QXmppRpcIq.h" #include "QXmppRosterIq.h" -#include "QXmppSession.h" +#include "QXmppSessionIq.h" #include "QXmppStreamInitiationIq.h" #include "QXmppVCard.h" #include "QXmppVersionIq.h" @@ -389,13 +389,9 @@ void QXmppOutgoingClient::handleStanza(const QDomElement &nodeRecv) if(id == d->sessionId) { - QXmppSession session; + QXmppSessionIq session; session.parse(nodeRecv); - // get back add configuration whether to send - // roster and intial presence in beginning - // process SessionIq - // xmpp connection made d->sessionStarted = true; emit connected(); @@ -424,7 +420,8 @@ void QXmppOutgoingClient::handleStanza(const QDomElement &nodeRecv) // start session if it is available if (d->sessionAvailable) { - QXmppSession session(QXmppIq::Set); + QXmppSessionIq session; + session.setType(QXmppIq::Set); session.setTo(configuration().domain()); d->sessionId = session.id(); sendPacket(session); diff --git a/src/QXmppSession.cpp b/src/QXmppSession.cpp deleted file mode 100644 index 9ee988d3..00000000 --- a/src/QXmppSession.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2008-2010 The QXmpp developers - * - * Authors: - * Manjeet Dahiya - * Jeremy Lainé - * - * Source: - * http://code.google.com/p/qxmpp - * - * This file is a part of QXmpp library. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - */ - -#include -#include - -#include "QXmppSession.h" -#include "QXmppConstants.h" -#include "QXmppUtils.h" - -QXmppSession::QXmppSession() -{ -} - -QXmppSession::QXmppSession(QXmppIq::Type type) - : QXmppIq(type) -{ -} - -bool QXmppSession::isSession(const QDomElement &element) -{ - QDomElement sessionElement = element.firstChildElement("session"); - return (sessionElement.namespaceURI() == ns_session); -} - -void QXmppSession::toXmlElementFromChild(QXmlStreamWriter *writer) const -{ - writer->writeStartElement("session");; - writer->writeAttribute("xmlns", ns_session); - writer->writeEndElement(); -} - diff --git a/src/QXmppSession.h b/src/QXmppSession.h deleted file mode 100644 index 83ba464f..00000000 --- a/src/QXmppSession.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2008-2010 The QXmpp developers - * - * Author: - * Manjeet Dahiya - * Jeremy Lainé - * - * Source: - * http://code.google.com/p/qxmpp - * - * This file is a part of QXmpp library. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - */ - - -#ifndef QXMPPSESSION_H -#define QXMPPSESSION_H - -#include "QXmppIq.h" - -class QXmppSession : public QXmppIq -{ -public: - QXmppSession(); - QXmppSession(QXmppIq::Type type); - - static bool isSession(const QDomElement &element); - -private: - void toXmlElementFromChild(QXmlStreamWriter *writer) const; -}; - -#endif // QXMPPSESSION_H diff --git a/src/QXmppSessionIq.cpp b/src/QXmppSessionIq.cpp new file mode 100644 index 00000000..a9875783 --- /dev/null +++ b/src/QXmppSessionIq.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2008-2010 The QXmpp developers + * + * Authors: + * Manjeet Dahiya + * Jeremy Lainé + * + * Source: + * http://code.google.com/p/qxmpp + * + * This file is a part of QXmpp library. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + */ + +#include +#include + +#include "QXmppSessionIq.h" +#include "QXmppConstants.h" +#include "QXmppUtils.h" + +bool QXmppSessionIq::isSessionIq(const QDomElement &element) +{ + QDomElement sessionElement = element.firstChildElement("session"); + return (sessionElement.namespaceURI() == ns_session); +} + +void QXmppSessionIq::toXmlElementFromChild(QXmlStreamWriter *writer) const +{ + writer->writeStartElement("session");; + writer->writeAttribute("xmlns", ns_session); + writer->writeEndElement(); +} + diff --git a/src/QXmppSessionIq.h b/src/QXmppSessionIq.h new file mode 100644 index 00000000..9abc7e24 --- /dev/null +++ b/src/QXmppSessionIq.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2008-2010 The QXmpp developers + * + * Author: + * Manjeet Dahiya + * Jeremy Lainé + * + * Source: + * http://code.google.com/p/qxmpp + * + * This file is a part of QXmpp library. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + */ + + +#ifndef QXMPPSESSIONIQ_H +#define QXMPPSESSIONIQ_H + +#include "QXmppIq.h" + +/// \brief The QXmppSessionIq class represents an IQ used for session +/// establishment as defined by RFC 5921. + +class QXmppSessionIq : public QXmppIq +{ +public: + static bool isSessionIq(const QDomElement &element); + +private: + /// \cond + void toXmlElementFromChild(QXmlStreamWriter *writer) const; + /// \endcond +}; + +#endif // QXMPPSESSION_H diff --git a/src/src.pro b/src/src.pro index 14d20884..b9c652c3 100644 --- a/src/src.pro +++ b/src/src.pro @@ -51,7 +51,7 @@ HEADERS += QXmppUtils.h \ QXmppRoster.h \ QXmppRosterIq.h \ QXmppRosterManager.h \ - QXmppSession.h \ + QXmppSessionIq.h \ QXmppSocks.h \ QXmppStanza.h \ QXmppStream.h \ @@ -99,7 +99,7 @@ SOURCES += QXmppUtils.cpp \ QXmppPresence.cpp \ QXmppRosterIq.cpp \ QXmppRosterManager.cpp \ - QXmppSession.cpp \ + QXmppSessionIq.cpp \ QXmppSocks.cpp \ QXmppStanza.cpp \ QXmppStream.cpp \ -- cgit v1.2.3