Huggle  build:^490^dce1e5c
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
hugglefeedproviderirc.hpp
1 //This program is free software: you can redistribute it and/or modify
2 //it under the terms of the GNU General Public License as published by
3 //the Free Software Foundation, either version 3 of the License, or
4 //(at your option) any later version.
5 
6 //This program is distributed in the hope that it will be useful,
7 //but WITHOUT ANY WARRANTY; without even the implied warranty of
8 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 //GNU General Public License for more details.
10 
11 #ifndef HUGGLEFEEDPROVIDERIRC_H
12 #define HUGGLEFEEDPROVIDERIRC_H
13 
14 #include <QString>
15 #include <QThread>
16 #include <QList>
17 #include <QMutex>
18 #include <QTcpSocket>
19 #include "hugglefeed.hpp"
20 #include "core.hpp"
21 #include "exception.hpp"
22 #include "configuration.hpp"
23 #include "wikiedit.hpp"
24 
25 namespace Huggle
26 {
27  class HuggleFeedProviderIRC;
28 
29  //! Thread which process the IRC feed
30  class HuggleFeedProviderIRC_t : public QThread
31  {
32  Q_OBJECT
33  public:
34  HuggleFeedProviderIRC_t(QTcpSocket *socket);
36  bool Running;
38  bool IsFinished();
39  protected:
40  void run();
41  private:
42  QTcpSocket *s;
43  bool Stopped;
44  };
45 
46  //! Provider that uses a wikimedia irc recent changes feed to retrieve information about edits
48  {
49  public:
52  bool Start();
53  bool IsWorking();
54  void Stop();
55  bool Restart() { this->Stop(); return this->Start(); }
56  void InsertEdit(WikiEdit *edit);
57  void ParseEdit(QString line);
58  bool IsStopped();
59  bool ContainsEdit();
61  bool IsPaused() { return Paused; }
62  void Pause() { Paused = true; }
63  void Resume() { Paused = false; }
64  bool IsConnected();
65  bool Connected;
66  private:
67  QMutex lock;
68  QList<WikiEdit*> Buffer;
70  QTcpSocket *TcpSocket;
71  bool Paused;
72  };
73 }
74 
75 #endif // HUGGLEFEEDPROVIDERIRC_H
bool IsWorking()
Return true if this feed is operational or not.
bool IsStopped()
Returns true in case that a provider is stopped and can be safely deleted.
void Stop()
Stop the feed engine.
bool Start()
Start the feed engine.
Thread which process the IRC feed.
Feed provider stub class every provider must be derived from this one.
Definition: hugglefeed.hpp:22
bool Restart()
Restart the feed engine.
bool ContainsEdit()
Check if feed is containing some edits in buffer.
WikiEdit * RetrieveEdit()
Return a last edit from cache or NULL.
void Pause()
This is useful to stop parsing edits from irc and like in case that queue is full.
Provider that uses a wikimedia irc recent changes feed to retrieve information about edits...
Wiki edit.
Definition: wikiedit.hpp:67
void Resume()
Resume edit parsing.