Huggle  build:^490^dce1e5c
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
wikiedit.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 WIKIEDIT_H
12 #define WIKIEDIT_H
13 
14 #include <QString>
15 #include <QThread>
16 #include <QMutex>
17 #include <QDateTime>
18 #include <QtXml>
19 #include <QList>
20 #include "apiquery.hpp"
21 #include "collectable.hpp"
22 #include "wikiuser.hpp"
23 #include "wikipage.hpp"
24 
25 #define WIKI_UNKNOWN_REVID -1
26 
27 namespace Huggle
28 {
29  enum WarningLevel
30  {
31  WarningLevelNone,
32  WarningLevel1,
33  WarningLevel2,
34  WarningLevel3,
35  WarningLevel4
36  };
37 
38  enum WEStatus
39  {
40  StatusNone,
41  StatusProcessed,
42  StatusPostProcessed
43  };
44 
45  class WikiPage;
46  class WikiEdit;
47  class WikiUser;
48 
49  //! Edits are post processed in this thread
50  class ProcessorThread : public QThread
51  {
52  Q_OBJECT
53  public:
54  static QList<WikiEdit *> PendingEdits;
55  static QMutex EditLock;
56  void Process(WikiEdit *edit);
57  protected:
58  void run();
59  };
60 
61  class Query;
62  class ApiQuery;
63 
64  //! Wiki edit
65 
66  //! Basically all changes to pages can be represented by this class
67  class WikiEdit : public Collectable
68  {
69  public:
70  //! This list contains reference to all existing edits in memory
71  static QList<WikiEdit*> EditList;
72  //! Creates a new empty wiki edit
73  WikiEdit();
74  ~WikiEdit();
75  //! Get a level of warning from talk page
76  static int GetLevel(QString page);
77  //! This function is called by core
79  //! This function is called by internals of huggle
80  void PostProcess();
81  //! Return a full url to edit
82  QString GetFullUrl();
83  //! Return true in case this edit was post processed already
84  bool IsPostProcessed();
85  void ProcessWords();
86  //! Page that was changed by edit
88  //! User who changed the page
90  //! Edit is a minor edit
91  bool Minor;
92  //! Edit is a bot edit
93  bool Bot;
94  //! Edit is a new page
95  bool NewPage;
96  //! Size of change of edit
97  int Size;
98  //! Diff id
99  int Diff;
100  //! Priority in queue
101  int Priority;
102  //! Old id
103  int OldID;
104  //! Revision ID
105  int RevID;
106  WEStatus Status;
107  //! Current warning level
109  //! Summary of edit
110  QString Summary;
111  QString RollbackToken;
112  QString DiffText;
113  //! If this is true the edit was made by huggle
115  //! If this is true the edit was made by some other
116  //! tool for vandalism reverting
118  //! Edit was made by you
119  bool OwnEdit;
120  WikiEdit *Previous;
121  WikiEdit *Next;
122  long Score;
123  QStringList ScoreWords;
124  bool PostProcessing;
125  bool ProcessingByWorkerThread;
126  QDateTime Time;
127  bool ProcessedByWorkerThread;
128  private:
129  bool ProcessingRevs;
130  bool ProcessingDiff;
131  ApiQuery* ProcessingQuery;
132  ApiQuery* DifferenceQuery;
133  };
134 }
135 
136 #endif // WIKIEDIT_H
int OldID
Old id.
Definition: wikiedit.hpp:103
Base for all items that are supposed to be collected by garbage collector.
Definition: collectable.hpp:34
bool NewPage
Edit is a new page.
Definition: wikiedit.hpp:95
int RevID
Revision ID.
Definition: wikiedit.hpp:105
static QList< WikiEdit * > EditList
This list contains reference to all existing edits in memory.
Definition: wikiedit.hpp:71
int Priority
Priority in queue.
Definition: wikiedit.hpp:101
Mediawiki page.
Definition: wikipage.hpp:43
Edits are post processed in this thread.
Definition: wikiedit.hpp:50
QString Summary
Summary of edit.
Definition: wikiedit.hpp:110
WarningLevel CurrentUserWarningLevel
Current warning level.
Definition: wikiedit.hpp:108
void ProcessWords()
Definition: wikiedit.cpp:219
bool EditMadeByHuggle
If this is true the edit was made by huggle.
Definition: wikiedit.hpp:114
void PostProcess()
This function is called by internals of huggle.
Definition: wikiedit.cpp:254
bool IsPostProcessed()
Return true in case this edit was post processed already.
Definition: wikiedit.cpp:297
WikiEdit()
Creates a new empty wiki edit.
Definition: wikiedit.cpp:15
bool Minor
Edit is a minor edit.
Definition: wikiedit.hpp:91
int Diff
Diff id.
Definition: wikiedit.hpp:99
static int GetLevel(QString page)
Get a level of warning from talk page.
Definition: wikiedit.cpp:388
WikiUser * User
User who changed the page.
Definition: wikiedit.hpp:89
QString GetFullUrl()
Return a full url to edit.
Definition: wikiedit.cpp:291
bool FinalizePostProcessing()
This function is called by core.
Definition: wikiedit.cpp:57
int Size
Size of change of edit.
Definition: wikiedit.hpp:97
Wiki edit.
Definition: wikiedit.hpp:67
This class can be used to execute any kind of api query on any wiki.
Definition: apiquery.hpp:55
bool Bot
Edit is a bot edit.
Definition: wikiedit.hpp:93
bool OwnEdit
Edit was made by you.
Definition: wikiedit.hpp:119
WikiPage * Page
Page that was changed by edit.
Definition: wikiedit.hpp:87
Query base class for all http queries executed by huggle.
Definition: query.hpp:64