From 2507f8306c97c727f4c2b90d26d5caebeaaa55c9 Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Sat, 23 Apr 2011 12:47:45 -0400 Subject: [PATCH] Revert change of jreen namespace, as we were tracking Jreen trunk correctly but our submodule was behind on clean checkouts. Updated now. Revert "The Jreen guys went and changed capitalization of their namespace, which" This reverts commit 41f1ac9713689dc915e81e2c61eaa70387518c19. --- src/sip/jreen/avatarmanager.cpp | 26 +++--- src/sip/jreen/avatarmanager.h | 8 +- src/sip/jreen/jabber.cpp | 18 ++-- src/sip/jreen/jabber_p.cpp | 98 ++++++++++----------- src/sip/jreen/jabber_p.h | 26 +++--- src/sip/jreen/tomahawksipmessage.h | 2 +- src/sip/jreen/tomahawksipmessagefactory.cpp | 2 +- src/sip/jreen/tomahawksipmessagefactory.h | 6 +- 8 files changed, 93 insertions(+), 93 deletions(-) diff --git a/src/sip/jreen/avatarmanager.cpp b/src/sip/jreen/avatarmanager.cpp index 8d6c2492f..366d805e1 100644 --- a/src/sip/jreen/avatarmanager.cpp +++ b/src/sip/jreen/avatarmanager.cpp @@ -12,7 +12,7 @@ #include #include -AvatarManager::AvatarManager(jreen::Client *client) : +AvatarManager::AvatarManager(Jreen::Client *client) : m_cacheDir(TomahawkUtils::appDataDir().absolutePath().append("/jreen/")) { m_client = client; @@ -20,8 +20,8 @@ AvatarManager::AvatarManager(jreen::Client *client) : m_cachedAvatars = m_cacheDir.entryList(); connect(m_client, SIGNAL(serverFeaturesReceived(QSet)), SLOT(onNewConnection())); - connect(m_client, SIGNAL(newPresence(jreen::Presence)), SLOT(onNewPresence(jreen::Presence))); - connect(m_client, SIGNAL(newIQ(jreen::IQ)), SLOT(onNewIq(jreen::IQ))); + connect(m_client, SIGNAL(newPresence(Jreen::Presence)), SLOT(onNewPresence(Jreen::Presence))); + connect(m_client, SIGNAL(newIQ(Jreen::IQ)), SLOT(onNewIq(Jreen::IQ))); connect(this, SIGNAL(newAvatar(QString)), SLOT(onNewAvatar(QString))); } @@ -40,14 +40,14 @@ void AvatarManager::fetchVCard(const QString &jid) { qDebug() << Q_FUNC_INFO; - jreen::IQ iq(jreen::IQ::Get, jid ); - iq.addExtension(new jreen::VCard()); - m_client->send( iq, this, SLOT( onNewIq( jreen::IQ, int ) ), 0 ); + Jreen::IQ iq(Jreen::IQ::Get, jid ); + iq.addExtension(new Jreen::VCard()); + m_client->send( iq, this, SLOT( onNewIq( Jreen::IQ, int ) ), 0 ); } -void AvatarManager::onNewPresence(const jreen::Presence& presence) +void AvatarManager::onNewPresence(const Jreen::Presence& presence) { - jreen::VCardUpdate::Ptr update = presence.findExtension(); + Jreen::VCardUpdate::Ptr update = presence.findExtension(); if(update) { qDebug() << "vcard: found update for " << presence.from().full(); @@ -74,9 +74,9 @@ void AvatarManager::onNewPresence(const jreen::Presence& presence) } } -void AvatarManager::onNewIq(const jreen::IQ& iq, int context) +void AvatarManager::onNewIq(const Jreen::IQ& iq, int context) { - jreen::VCard *vcard = iq.findExtension().data(); + Jreen::VCard *vcard = iq.findExtension().data(); if(vcard) { iq.accept(); @@ -86,7 +86,7 @@ void AvatarManager::onNewIq(const jreen::IQ& iq, int context) QString id = iq.from().full(); QString avatarHash; - const jreen::VCard::Photo &photo = vcard->photo(); + const Jreen::VCard::Photo &photo = vcard->photo(); if (!photo.data().isEmpty()) { qDebug() << "vcard: got photo data" << id; @@ -118,8 +118,8 @@ void AvatarManager::onNewIq(const jreen::IQ& iq, int context) { qDebug() << Q_FUNC_INFO << "got own vcard"; - jreen::Presence presence = m_client->presence(); - jreen::VCardUpdate::Ptr update = presence.findExtension(); + Jreen::Presence presence = m_client->presence(); + Jreen::VCardUpdate::Ptr update = presence.findExtension(); if (update->photoHash() != avatarHash) { qDebug() << Q_FUNC_INFO << "Updating own presence..."; diff --git a/src/sip/jreen/avatarmanager.h b/src/sip/jreen/avatarmanager.h index e84a04867..71852285c 100644 --- a/src/sip/jreen/avatarmanager.h +++ b/src/sip/jreen/avatarmanager.h @@ -12,7 +12,7 @@ class AvatarManager : public QObject Q_OBJECT public: - AvatarManager(jreen::Client *client); + AvatarManager(Jreen::Client *client); virtual ~AvatarManager(); QPixmap avatar(const QString &jid) const; @@ -21,8 +21,8 @@ signals: void newAvatar( const QString &jid ); private slots: - void onNewPresence( const jreen::Presence& presence ); - void onNewIq(const jreen::IQ &iq, int context = 0 ); + void onNewPresence( const Jreen::Presence& presence ); + void onNewIq(const Jreen::IQ &iq, int context = 0 ); void onNewConnection(); void onNewAvatar( const QString &jid ); @@ -34,7 +34,7 @@ private: QDir avatarDir(const QString &avatarHash) const; bool isCached(const QString &avatarHash) const; - jreen::Client *m_client; + Jreen::Client *m_client; QStringList m_cachedAvatars; QDir m_cacheDir; QMap m_JidsAvatarHashes; diff --git a/src/sip/jreen/jabber.cpp b/src/sip/jreen/jabber.cpp index 269e69eb9..e01c5d93e 100644 --- a/src/sip/jreen/jabber.cpp +++ b/src/sip/jreen/jabber.cpp @@ -162,18 +162,18 @@ JabberPlugin::onAuthError( int code, const QString& msg ) { switch( code ) { - case jreen::Client::AuthorizationError: + case Jreen::Client::AuthorizationError: emit error( SipPlugin::AuthError, msg ); break; - case jreen::Client::HostUnknown: - case jreen::Client::ItemNotFound: - case jreen::Client::RemoteStreamError: - case jreen::Client::RemoteConnectionFailed: - case jreen::Client::InternalServerError: - case jreen::Client::SystemShutdown: - case jreen::Client::Conflict: - case jreen::Client::Unknown: + case Jreen::Client::HostUnknown: + case Jreen::Client::ItemNotFound: + case Jreen::Client::RemoteStreamError: + case Jreen::Client::RemoteConnectionFailed: + case Jreen::Client::InternalServerError: + case Jreen::Client::SystemShutdown: + case Jreen::Client::Conflict: + case Jreen::Client::Unknown: emit error( SipPlugin::ConnectionError, msg ); break; diff --git a/src/sip/jreen/jabber_p.cpp b/src/sip/jreen/jabber_p.cpp index 0b482f6cd..1af6693d7 100644 --- a/src/sip/jreen/jabber_p.cpp +++ b/src/sip/jreen/jabber_p.cpp @@ -61,10 +61,10 @@ Jabber_p::Jabber_p( const QString& jid, const QString& password, const QString& qsrand(QDateTime::currentDateTime().toTime_t()); // setup JID object - m_jid = jreen::JID( jid ); + m_jid = Jreen::JID( jid ); // general client setup - m_client = new jreen::Client( jid, password ); + m_client = new Jreen::Client( jid, password ); if ( !server.isEmpty() ) { m_client->setServer( server ); @@ -74,18 +74,18 @@ Jabber_p::Jabber_p( const QString& jid, const QString& password, const QString& m_client->setResource( QString( "tomahawk%1" ).arg( QString::number( qrand() % 10000 ) ) ); // add VCardUpdate extension to own presence - m_client->presence().addExtension( new jreen::VCardUpdate() ); + m_client->presence().addExtension( new Jreen::VCardUpdate() ); // initialize the AvatarManager m_avatarManager = new AvatarManager(m_client); // setup disco m_client->disco()->setSoftwareVersion( "Tomahawk Player", TOMAHAWK_VERSION, CMAKE_SYSTEM ); - m_client->disco()->addIdentity( jreen::Disco::Identity( "client", "type", "tomahawk", "en" ) ); + m_client->disco()->addIdentity( Jreen::Disco::Identity( "client", "type", "tomahawk", "en" ) ); m_client->disco()->addFeature( TOMAHAWK_FEATURE ); // setup caps node, legacy peer detection - used before 0.1 - jreen::Capabilities::Ptr caps = m_client->presence().findExtension(); + Jreen::Capabilities::Ptr caps = m_client->presence().findExtension(); caps->setNode( TOMAHAWK_CAP_NODE_NAME ); // print connection parameters @@ -93,16 +93,16 @@ Jabber_p::Jabber_p( const QString& jid, const QString& password, const QString& qDebug() << "Our Server set to:" << m_client->server(); qDebug() << "Our Port set to" << m_client->port(); - m_client->setConnectionImpl( new jreen::TcpConnection( m_client->server(), m_client->port() ) ); + m_client->setConnectionImpl( new Jreen::TcpConnection( m_client->server(), m_client->port() ) ); // setup slots - connect(qobject_cast(m_client->connection()), SIGNAL(error(const jreen::Connection::SocketError&)), SLOT(onError(const jreen::Connection::SocketError&))); + connect(qobject_cast(m_client->connection()), SIGNAL(error(const Jreen::Connection::SocketError&)), SLOT(onError(const Jreen::Connection::SocketError&))); connect(m_client, SIGNAL(serverFeaturesReceived(QSet)), SLOT(onConnect())); - connect(m_client, SIGNAL(disconnected(jreen::Client::DisconnectReason)), SLOT(onDisconnect(jreen::Client::DisconnectReason))); + connect(m_client, SIGNAL(disconnected(Jreen::Client::DisconnectReason)), SLOT(onDisconnect(Jreen::Client::DisconnectReason))); connect(m_client, SIGNAL(destroyed(QObject*)), this, SLOT(onDestroy(QObject*))); - connect(m_client, SIGNAL(newMessage(jreen::Message)), SLOT(onNewMessage(jreen::Message))); - connect(m_client, SIGNAL(newPresence(jreen::Presence)), SLOT(onNewPresence(jreen::Presence))); - connect(m_client, SIGNAL(newIQ(jreen::IQ)), SLOT(onNewIq(jreen::IQ))); + connect(m_client, SIGNAL(newMessage(Jreen::Message)), SLOT(onNewMessage(Jreen::Message))); + connect(m_client, SIGNAL(newPresence(Jreen::Presence)), SLOT(onNewPresence(Jreen::Presence))); + connect(m_client, SIGNAL(newIQ(Jreen::IQ)), SLOT(onNewIq(Jreen::IQ))); connect(m_avatarManager, SIGNAL(newAvatar(QString)), SLOT(onNewAvatar(QString))); @@ -146,7 +146,7 @@ Jabber_p::sendMsg( const QString& to, const QString& msg ) if( m_legacy_peers.contains( to ) ) { qDebug() << Q_FUNC_INFO << to << "Send legacy message" << msg; - jreen::Message m( jreen::Message::Chat, jreen::JID(to), msg); + Jreen::Message m( Jreen::Message::Chat, Jreen::JID(to), msg); m_client->send( m ); return; @@ -184,10 +184,10 @@ Jabber_p::sendMsg( const QString& to, const QString& msg ) qDebug() << "Send sip messsage to " << to; - jreen::IQ iq( jreen::IQ::Set, to ); + Jreen::IQ iq( Jreen::IQ::Set, to ); iq.addExtension( sipMessage ); - m_client->send( iq, this, SLOT( onNewIq( jreen::IQ, int ) ), SipMessageSent ); + m_client->send( iq, this, SLOT( onNewIq( Jreen::IQ, int ) ), SipMessageSent ); } @@ -234,31 +234,31 @@ Jabber_p::onConnect() qDebug() << "Connected as:" << m_jid.full(); // set presence to least valid value - m_client->setPresence(jreen::Presence::XA, "Got Tomahawk? http://gettomahawk.com", -127); + m_client->setPresence(Jreen::Presence::XA, "Got Tomahawk? http://gettomahawk.com", -127); // set ping timeout to 15 secs (TODO: verify if this works) m_client->setPingInterval(15000); // load roster - m_roster = new jreen::SimpleRoster( m_client ); + m_roster = new Jreen::SimpleRoster( m_client ); m_roster->load(); //FIXME: this implementation is totally broken atm, so it's disabled to avoid harm :P // join MUC with bare jid as nickname //TODO: make the room a list of rooms and make that configurable QString mucNickname = QString( "tomahawk@conference.qutim.org/" ).append( QString( m_jid.bare() ).replace( "@", "-" ) ); - m_room = new jreen::MUCRoom(m_client, jreen::JID( mucNickname ) ); + m_room = new Jreen::MUCRoom(m_client, Jreen::JID( mucNickname ) ); //m_room->setHistorySeconds(0); //m_room->join(); // treat muc participiants like contacts - connect( m_room, SIGNAL( messageReceived( jreen::Message, bool ) ), this, SLOT( onNewMessage( jreen::Message ) ) ); - connect( m_room, SIGNAL( presenceReceived( jreen::Presence, const jreen::MUCRoom::Participant* ) ), this, SLOT( onNewPresence( jreen::Presence ) ) ); + connect( m_room, SIGNAL( messageReceived( Jreen::Message, bool ) ), this, SLOT( onNewMessage( Jreen::Message ) ) ); + connect( m_room, SIGNAL( presenceReceived( Jreen::Presence, const Jreen::MUCRoom::Participant* ) ), this, SLOT( onNewPresence( Jreen::Presence ) ) ); } void -Jabber_p::onDisconnect( jreen::Client::DisconnectReason reason ) +Jabber_p::onDisconnect( Jreen::Client::DisconnectReason reason ) { QString error; bool reconnect = false; @@ -266,39 +266,39 @@ Jabber_p::onDisconnect( jreen::Client::DisconnectReason reason ) switch( reason ) { - case jreen::Client::User: + case Jreen::Client::User: error = "User Interaction"; break; - case jreen::Client::HostUnknown: + case Jreen::Client::HostUnknown: error = "Host is unknown"; break; - case jreen::Client::ItemNotFound: + case Jreen::Client::ItemNotFound: error = "Item not found"; break; - case jreen::Client::AuthorizationError: + case Jreen::Client::AuthorizationError: error = "Authorization Error"; break; - case jreen::Client::RemoteStreamError: + case Jreen::Client::RemoteStreamError: error = "Remote Stream Error"; reconnect = true; break; - case jreen::Client::RemoteConnectionFailed: + case Jreen::Client::RemoteConnectionFailed: error = "Remote Connection failed"; break; - case jreen::Client::InternalServerError: + case Jreen::Client::InternalServerError: error = "Internal Server Error"; reconnect = true; break; - case jreen::Client::SystemShutdown: + case Jreen::Client::SystemShutdown: error = "System shutdown"; reconnect = true; reconnectInSeconds = 60; break; - case jreen::Client::Conflict: + case Jreen::Client::Conflict: error = "Conflict"; break; - case jreen::Client::Unknown: + case Jreen::Client::Unknown: error = "Unknown"; break; @@ -309,7 +309,7 @@ Jabber_p::onDisconnect( jreen::Client::DisconnectReason reason ) } qDebug() << "Disconnected from server:" << error; - if( reason != jreen::Client::User ) + if( reason != Jreen::Client::User ) { emit authError( reason, error ); } @@ -321,7 +321,7 @@ Jabber_p::onDisconnect( jreen::Client::DisconnectReason reason ) } void -Jabber_p::onNewMessage( const jreen::Message& m ) +Jabber_p::onNewMessage( const Jreen::Message& m ) { QString from = m.from().full(); QString msg = m.body(); @@ -340,7 +340,7 @@ Jabber_p::onNewMessage( const jreen::Message& m ) " are trying to reach is probably not signed on, so please try again later!") ); // this is not a sip message, so we send it directly through the client - m_client->send( jreen::Message ( jreen::Message::Chat, jreen::JID(to), response) ); + m_client->send( Jreen::Message ( Jreen::Message::Chat, Jreen::JID(to), response) ); return; } @@ -350,9 +350,9 @@ Jabber_p::onNewMessage( const jreen::Message& m ) } -void Jabber_p::onNewPresence( const jreen::Presence& presence) +void Jabber_p::onNewPresence( const Jreen::Presence& presence) { - jreen::JID jid = presence.from(); + Jreen::JID jid = presence.from(); QString fulljid( jid.full() ); @@ -367,7 +367,7 @@ void Jabber_p::onNewPresence( const jreen::Presence& presence) } // ignore anyone not Running tomahawk: - jreen::Capabilities::Ptr caps = presence.findExtension(); + Jreen::Capabilities::Ptr caps = presence.findExtension(); if ( caps && ( caps->node() == TOMAHAWK_CAP_NODE_NAME ) ) { // must be a jreen resource, implementation in gloox was broken @@ -382,10 +382,10 @@ void Jabber_p::onNewPresence( const jreen::Presence& presence) // request disco features QString node = caps->node() + '#' + caps->ver(); - jreen::IQ iq( jreen::IQ::Get, jid ); - iq.addExtension( new jreen::Disco::Info( node ) ); + Jreen::IQ iq( Jreen::IQ::Get, jid ); + iq.addExtension( new Jreen::Disco::Info( node ) ); - m_client->send( iq, this, SLOT( onNewIq( jreen::IQ, int ) ), RequestDisco ); + m_client->send( iq, this, SLOT( onNewIq( Jreen::IQ, int ) ), RequestDisco ); } else if( !caps ) { @@ -394,25 +394,25 @@ void Jabber_p::onNewPresence( const jreen::Presence& presence) } void -Jabber_p::onNewIq( const jreen::IQ &iq, int context ) +Jabber_p::onNewIq( const Jreen::IQ &iq, int context ) { if( context == RequestDisco ) { qDebug() << Q_FUNC_INFO << "Received disco IQ..."; - jreen::Disco::Info *discoInfo = iq.findExtension().data(); + Jreen::Disco::Info *discoInfo = iq.findExtension().data(); if(!discoInfo) return; iq.accept(); QString fulljid = iq.from().full(); - jreen::DataForm::Ptr form = discoInfo->form(); + Jreen::DataForm::Ptr form = discoInfo->form(); if(discoInfo->features().contains( TOMAHAWK_FEATURE )) { qDebug() << Q_FUNC_INFO << fulljid << "Running tomahawk/feature enabled: yes"; // the actual presence doesn't matter, it just needs to be "online" - handlePeerStatus( fulljid, jreen::Presence::Available ); + handlePeerStatus( fulljid, Jreen::Presence::Available ); } else { @@ -426,7 +426,7 @@ Jabber_p::onNewIq( const jreen::IQ &iq, int context ) // add to legacy peers, so we can send text messages instead of iqs m_legacy_peers.append( fulljid ); - handlePeerStatus( fulljid, jreen::Presence::Available ); + handlePeerStatus( fulljid, Jreen::Presence::Available ); } } } @@ -485,13 +485,13 @@ Jabber_p::onNewIq( const jreen::IQ &iq, int context ) } bool -Jabber_p::presenceMeansOnline( jreen::Presence::Type p ) +Jabber_p::presenceMeansOnline( Jreen::Presence::Type p ) { switch(p) { - case jreen::Presence::Invalid: - case jreen::Presence::Unavailable: - case jreen::Presence::Error: + case Jreen::Presence::Invalid: + case Jreen::Presence::Unavailable: + case Jreen::Presence::Error: return false; break; default: @@ -500,7 +500,7 @@ Jabber_p::presenceMeansOnline( jreen::Presence::Type p ) } void -Jabber_p::handlePeerStatus( const jreen::JID& jid, jreen::Presence::Type presenceType ) +Jabber_p::handlePeerStatus( const Jreen::JID& jid, Jreen::Presence::Type presenceType ) { QString fulljid = jid.full(); diff --git a/src/sip/jreen/jabber_p.h b/src/sip/jreen/jabber_p.h index 156b396ce..c8c77a2ee 100644 --- a/src/sip/jreen/jabber_p.h +++ b/src/sip/jreen/jabber_p.h @@ -75,13 +75,13 @@ public slots: void addContact( const QString& jid, const QString& msg = QString() ); void disconnect(); - void onDisconnect(jreen::Client::DisconnectReason reason); + void onDisconnect(Jreen::Client::DisconnectReason reason); void onConnect(); private slots: - virtual void onNewPresence( const jreen::Presence& presence ); - virtual void onNewMessage( const jreen::Message& msg ); - virtual void onError( const jreen::Connection::SocketError& e ) + virtual void onNewPresence( const Jreen::Presence& presence ); + virtual void onNewMessage( const Jreen::Message& msg ); + virtual void onError( const Jreen::Connection::SocketError& e ) { qDebug() << e; } @@ -89,19 +89,19 @@ private slots: { qDebug() << Q_FUNC_INFO; } - virtual void onNewIq( const jreen::IQ &iq, int context = NoContext ); + virtual void onNewIq( const Jreen::IQ &iq, int context = NoContext ); virtual void onNewAvatar( const QString &jid ); private: - bool presenceMeansOnline( jreen::Presence::Type p ); - void handlePeerStatus( const jreen::JID &jid, jreen::Presence::Type presenceType ); + bool presenceMeansOnline( Jreen::Presence::Type p ); + void handlePeerStatus( const Jreen::JID &jid, Jreen::Presence::Type presenceType ); - jreen::Client *m_client; - jreen::MUCRoom *m_room; - jreen::SimpleRoster *m_roster; - jreen::JID m_jid; - QMap m_presences; - QMap m_peers; + Jreen::Client *m_client; + Jreen::MUCRoom *m_room; + Jreen::SimpleRoster *m_roster; + Jreen::JID m_jid; + QMap m_presences; + QMap m_peers; QString m_server; enum IqContext { NoContext, RequestDisco, RequestedDisco, SipMessageSent, RequestedVCard }; diff --git a/src/sip/jreen/tomahawksipmessage.h b/src/sip/jreen/tomahawksipmessage.h index 3faa7b3c9..da1c376c5 100644 --- a/src/sip/jreen/tomahawksipmessage.h +++ b/src/sip/jreen/tomahawksipmessage.h @@ -6,7 +6,7 @@ #define TOMAHAWK_SIP_MESSAGE_NS QLatin1String("http://www.tomhawk-player.org/sip/transports") class TomahawkSipMessagePrivate; -class TomahawkSipMessage : public jreen::StanzaExtension +class TomahawkSipMessage : public Jreen::StanzaExtension { J_EXTENSION(TomahawkSipMessage, "") Q_DECLARE_PRIVATE(TomahawkSipMessage) diff --git a/src/sip/jreen/tomahawksipmessagefactory.cpp b/src/sip/jreen/tomahawksipmessagefactory.cpp index bd3de68bf..20a0a9ba8 100644 --- a/src/sip/jreen/tomahawksipmessagefactory.cpp +++ b/src/sip/jreen/tomahawksipmessagefactory.cpp @@ -5,7 +5,7 @@ #include #include -using namespace jreen; +using namespace Jreen; TomahawkSipMessageFactory::TomahawkSipMessageFactory() { diff --git a/src/sip/jreen/tomahawksipmessagefactory.h b/src/sip/jreen/tomahawksipmessagefactory.h index ef902a86e..318208710 100644 --- a/src/sip/jreen/tomahawksipmessagefactory.h +++ b/src/sip/jreen/tomahawksipmessagefactory.h @@ -21,7 +21,7 @@ #include -class TomahawkSipMessageFactory : public jreen::StanzaExtensionFactory +class TomahawkSipMessageFactory : public Jreen::StanzaExtensionFactory { public: TomahawkSipMessageFactory(); @@ -31,8 +31,8 @@ public: void handleStartElement(const QStringRef &name, const QStringRef &uri, const QXmlStreamAttributes &attributes); void handleEndElement(const QStringRef &name, const QStringRef &uri); void handleCharacterData(const QStringRef &text); - void serialize(jreen::StanzaExtension *extension, QXmlStreamWriter *writer); - jreen::StanzaExtension::Ptr createExtension(); + void serialize(Jreen::StanzaExtension *extension, QXmlStreamWriter *writer); + Jreen::StanzaExtension::Ptr createExtension(); private: enum State { AtNowhere, AtTransport, AtCandidate } m_state; int m_depth;