/usr/include/QTweetLib/qtweetuserstream.h is in libqtweetlib-dev 0.5+repack1-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | /* Copyright (c) 2010, Antonie Jovanoski
*
* All rights reserved.
*
* 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.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Contact e-mail: Antonie Jovanoski <minimoog77_at_gmail.com>
*/
#ifndef QTWEETUSERSTREAM_H
#define QTWEETUSERSTREAM_H
#include <QObject>
#include <QNetworkReply>
#include "qtweetlib_global.h"
#ifdef STREAM_LOGGER
#include <QFile>
#endif
class QNetworkAccessManager;
class QNetworkReply;
class OAuthTwitter;
class QAuthenticator;
class QTimer;
class QTweetStatus;
class QTweetDMStatus;
/**
* Class for fetching user stream
*/
class QTWEETLIBSHARED_EXPORT QTweetUserStream : public QObject
{
Q_OBJECT
public:
QTweetUserStream(QObject *parent = 0);
void setOAuthTwitter(OAuthTwitter* oauthTwitter);
OAuthTwitter* oauthTwitter() const;
signals:
/**
* Emits stream elements
*/
void stream(const QByteArray& );
/**
* Emits tweets (parsed) elements from stream
*/
void statusesStream(const QTweetStatus& status);
/**
* Emits friends list of id of authenticated user.
* Emited immediately after connecting to the user stream.
* If there is no reconnect it won't be emited again.
*/
void friendsList(const QList<qint64> friends);
/**
* Emits direct message when is arrived in the stream
*/
void directMessageStream(const QTweetDMStatus& directMessage);
/**
* Emits deletion of status in the stream
*/
void deleteStatusStream(qint64 id, qint64 userid);
/**
* Emited when user stream is reconnected after failure
* Usefull when user stream connection fails to fetch missed tweets with REST API
*/
void reconnected();
/**
* Emited when user stream doesn't connect and backoff timer reaches maximum value (300 seconds)
* Usefull when users stream fails to revert to REST API
*/
void failureConnect();
public slots:
void startFetching();
private slots:
void replyFinished();
void replyReadyRead();
void replyTimeout();
void parsingFinished(const QVariant& json, bool ok, const QString& errorMsg);
private:
void parseStream(const QByteArray& );
void parseFriendsList(const QVariantMap& streamObject);
void parseDirectMessage(const QVariantMap& streamObject);
void parseDeleteStatus(const QVariantMap& streamObject);
QByteArray m_cachedResponse;
OAuthTwitter *m_oauthTwitter;
QNetworkReply *m_reply;
QTimer *m_backofftimer;
QTimer *m_timeoutTimer;
bool m_streamTryingReconnect;
#ifdef STREAM_LOGGER
QFile m_streamLog;
#endif
};
#endif // QTWEETUSERSTREAM_H
|