Huggle  build:^490^dce1e5c
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
Huggle::Core Class Reference

Miscelanceous system functions, all of these functions are static. More...

#include <core.hpp>

Static Public Member Functions

static void AppendQuery (Query *item)
 Insert a query to internal list of running queries, so that they can be watched This will insert it to a process list in main form. More...
 
static void CheckQueries ()
 Check if all running queries are finished and if so it removes them from list.
 
static void DebugLog (QString Message, unsigned int Verbosity=1)
 This log is only shown if verbosity is same or larger than requested verbosity.
 
static void DeleteEdit (WikiEdit *edit)
 Remove edit in proper manner.
 
static void DeveloperError ()
 Display a message box telling user that function is not allowed during developer mode.
 
static EditQueryEditPage (WikiPage *page, QString text, QString summary="Edited using huggle", bool minor=false)
 
static void ExceptionHandler (Exception *exception)
 
static void ExtensionLoad ()
 Load extensions (libraries as well as python)
 
static void FinalizeMessages ()
 
static QString GetKeyFromValue (QString item)
 
static QString GetKeyOfWarningTypeFromWarningName (QString id)
 
static QString GetNameOfWarningTypeFromWarningKey (QString key)
 
static QString GetProjectScriptURL (WikiSite Project)
 Return a script url like http://en.wikipedia.org/w/.
 
static QString GetProjectScriptURL ()
 Return a script url like http://en.wikipedia.org/w/.
 
static QString GetProjectURL (WikiSite Project)
 Helper function that will return URL of project in question. More...
 
static QString GetProjectURL ()
 Return a base url of current project.
 
static QString GetProjectWikiURL (WikiSite Project)
 Return a full url like http://en.wikipedia.org/wiki/.
 
static QString GetProjectWikiURL ()
 Return a full url like http://en.wikipedia.org/wiki/.
 
static QString GetSummaryOfWarningTypeFromWarningKey (QString key)
 
static QString GetValueFromKey (QString item)
 
static void Init ()
 Function which is called as one of first when huggle is loaded.
 
static void InsertToRingLog (QString text)
 
static void LoadDB ()
 
static void LoadDefs ()
 Load a definitions of problematic users, see WikiUser::ProblematicUsers for details.
 
static void LoadLocalizations ()
 
static QString Localize (QString key)
 
static void Log (QString Message)
 Write text to terminal as well as ring log. More...
 
static MessageMessageUser (WikiUser *user, QString message, QString title, QString summary, bool section=true, Query *dependency=NULL)
 MessageUser Message user. More...
 
static void ParsePats (QString text)
 Parse a part patterns for score words.
 
static void ParseWords (QString text)
 
static void PostProcessEdit (WikiEdit *_e)
 
static bool PreflightCheck (WikiEdit *_e)
 Check if we can revert this edit.
 
static void PreProcessEdit (WikiEdit *_e)
 
static void ProcessEdit (WikiEdit *e)
 
static bool ReportPreFlightCheck ()
 
static QString RetrieveTemplateToWarn (QString type)
 
static RevertQueryRevertEdit (WikiEdit *_e, QString summary="", bool minor=false, bool rollback=true, bool keep=false)
 RevertEdit Reverts the edit. More...
 
static QStringList RingLogToQStringList ()
 Return a ring log as qstring list. More...
 
static QString RingLogToText ()
 Return a ring log represented as 1 huge string.
 
static int RunningQueriesGetCount ()
 
static void SaveDefs ()
 Store a definitions of problematic users, see WikiUser::ProblematicUsers for details.
 
static void Shutdown ()
 Terminate the process, call this after you release all resources and finish all queries.
 
static QString Trim (QString text)
 Remove leading and finishing space of string.
 
static void VersionRead ()
 VersionRead - read the version from embedded git file. More...
 

Static Public Attributes

static WikiPageAIVP = NULL
 Pointer to AIV page.
 
static QList< iExtension * > Extensions
 List of extensions loaded in huggle.
 
static Loginf_Login = NULL
 Login form.
 
static QList< HuggleQueueFilter * > FilterDB
 
static QString HtmlFooter = "</table></body></html>"
 This string contains a html footer.
 
static QString HtmlHeader = ""
 This string contains a html header.
 
static QList< Language * > LocalizationData
 Languages D:
 
static MainWindowMain = NULL
 Pointer to main.
 
static QList< EditQuery * > PendingMods
 Pending changes.
 
static HuggleFeedPrimaryFeedProvider = NULL
 Pointer to primary feed provider.
 
static QList< WikiEdit * > ProcessingEdits
 
static bool Running = true
 Change this to false when you want to terminate all threads properly (you will need to wait few ms)
 
static HuggleFeedSecondaryFeedProvider = NULL
 Pointer to secondary feed provider.
 
static QDateTime StartupTime = QDateTime::currentDateTime()
 
static WikiPageUAAP = NULL
 Pointer to UAA page.
 

Static Private Member Functions

static void LocalInit (QString name)
 Initializes a localization with given name. More...
 
static LanguageMakeLanguage (QString text, QString name)
 

Static Private Attributes

static QList< Message * > Messages
 List of all messages that are being sent.
 
static ProcessorThreadProcessor = NULL
 This is a post-processor for edits.
 
static QStringList RingLog
 Ring log is a buffer that contains system messages.
 
static QList< Query * > RunningQueries
 List of all running queries.
 

Detailed Description

Miscelanceous system functions, all of these functions are static.

Making any instance of this class is nonsense don't do it :D

Definition at line 105 of file core.hpp.

Member Function Documentation

QString Core::GetProjectURL ( WikiSite  Project)
static

Helper function that will return URL of project in question.

Parameters
ProjectSite
Returns
String with url

Definition at line 649 of file core.cpp.

References Huggle::Configuration::GetURLProtocolPrefix(), and Huggle::WikiSite::URL.

void Core::LocalInit ( QString  name)
staticprivate

Initializes a localization with given name.

This function will create a new localization object using built-in localization file using Core::MakeLanguage() and insert that to language list

Parameters
nameName of a localization that is a name of language without txt suffix in localization folder

Definition at line 937 of file core.cpp.

References LocalizationData.

void Core::Log ( QString  Message)
static

Write text to terminal as well as ring log.

Parameters
MessageMessage to log

Definition at line 563 of file core.cpp.

References Huggle::MainWindow::lUnwrittenLogs, Main, and Huggle::MainWindow::UnwrittenLogs.

Referenced by Huggle::MainWindow::_ReportUser(), Huggle::VandalNw::Connect(), DebugLog(), Huggle::HuggleWeb::DisplayDiff(), Huggle::MainWindow::Exit(), ExtensionLoad(), Huggle::Message::Fail(), Huggle::WikiEdit::FinalizePostProcessing(), Huggle::Message::Finish(), Huggle::HuggleTool::FinishPage(), Huggle::MainWindow::ForceWarn(), Huggle::Login::GetToken(), Init(), Huggle::Configuration::LoadConfig(), LoadDefs(), Huggle::MainWindow::MainWindow(), MessageUser(), Huggle::MainWindow::on_actionBlock_user_triggered(), Huggle::MainWindow::on_actionClear_talk_page_of_user_triggered(), Huggle::MainWindow::on_actionDelete_triggered(), Huggle::MainWindow::on_actionEdit_info_triggered(), Huggle::MainWindow::on_actionProtect_triggered(), Huggle::MainWindow::on_actionReport_user_2_triggered(), Huggle::MainWindow::on_actionReport_user_triggered(), Huggle::MainWindow::on_actionReport_username_triggered(), Huggle::MainWindow::on_actionWiki_triggered(), Huggle::UAAReport::onTick(), Huggle::EditQuery::Processed(), Huggle::RevertQuery::ProcessRevert(), Huggle::MainWindow::ReconnectIRC(), Huggle::HuggleFeedProviderWiki::Refresh(), Huggle::MainWindow::Revert(), Huggle::RevertQuery::Rollback(), Huggle::Configuration::SaveConfig(), SaveDefs(), Shutdown(), Huggle::HuggleFeedProviderIRC::Start(), Huggle::HuggleFeedProviderIRC::Stop(), Huggle::MainWindow::Warn(), and Huggle::MainWindow::Welcome().

Message * Core::MessageUser ( WikiUser user,
QString  message,
QString  title,
QString  summary,
bool  section = true,
Query dependency = NULL 
)
static

MessageUser Message user.

Parameters
userPointer to user
messageText of message
titleTitle
summarySummary
sectionWhether this message should be created in a new section
dependencyQuery that is used as a dependency, if it's not NULL the system will wait for it to finish before the message is sent
Returns

Definition at line 427 of file core.cpp.

References Huggle::Message::Dependency, Log(), Messages, Huggle::Message::Section, Huggle::Message::Send(), Huggle::Message::title, and Huggle::WikiUser::Username.

Referenced by Huggle::MainWindow::ForceWarn(), Huggle::MainWindow::Warn(), and Huggle::MainWindow::Welcome().

void Core::PostProcessEdit ( WikiEdit _e)
static
void Core::PreProcessEdit ( WikiEdit _e)
static

Check the edit summary and similar in order to determine several edit attributes etc

Definition at line 747 of file core.cpp.

References Huggle::WikiEdit::Bot, Huggle::WikiEdit::EditMadeByHuggle, Huggle::Configuration::EditSuffixOfHuggle, Huggle::WikiEdit::Summary, and Huggle::WikiEdit::User.

RevertQuery * Core::RevertEdit ( WikiEdit _e,
QString  summary = "",
bool  minor = false,
bool  rollback = true,
bool  keep = false 
)
static

RevertEdit Reverts the edit.

Parameters
_ePointer to edit that needs to be reverted
summarySummary to use if this is empty the default revert summary is used
minorIf revert should be considered as minor edit
rollbackIf rollback feature should be used
keepWhether the query produced by this function should not be automatically deleted
Returns
Pointer to api query that executes this revert

Definition at line 855 of file core.cpp.

References AppendQuery(), Huggle::Configuration::EnforceManualSoftwareRollback, Huggle::WikiEdit::Page, Huggle::RevertQuery::Process(), Huggle::Collectable::RegisterConsumer(), Huggle::WikiEdit::User, and Huggle::RevertQuery::UsingSR.

Referenced by Huggle::MainWindow::Revert().

QStringList Core::RingLogToQStringList ( )
static

Return a ring log as qstring list.

Returns
QStringList

Definition at line 724 of file core.cpp.

References RingLog.

Referenced by Huggle::MainWindow::MainWindow().

void Core::VersionRead ( )
static

VersionRead - read the version from embedded git file.

This function may be called also from terminal parser

Definition at line 627 of file core.cpp.

References Huggle::Configuration::HuggleVersion.

Referenced by Init().

Member Data Documentation

QList< WikiEdit * > Core::ProcessingEdits
static

This is a list of all edits that are being processed by some way whole list needs to be checked and probed everytime once a while

Definition at line 124 of file core.hpp.

Referenced by PostProcessEdit().


The documentation for this class was generated from the following files: