11 #include "message.hpp"
13 using namespace Huggle;
73 this->Sending =
false;
110 if (query->
Result->Failed)
113 Fail(
"unable to retrieve the edit token");
118 QDomNodeList l = d.elementsByTagName(
"page");
122 Fail(
"no token was returned by request");
126 QDomElement element = l.at(0).toElement();
127 if (!element.attributes().contains(
"edittoken"))
130 Fail(
"the result doesn't contain the token");
134 token = element.attribute(
"edittoken");
144 +
"&text=" + QUrl::toPercentEncoding(this->
text)
145 +
"&token=" + QUrl::toPercentEncoding(this->
token);
148 query->
Parameters =
"title=" + QUrl::toPercentEncoding(
user->
GetTalk()) +
"§ion=new§iontitle="
150 +
"&text=" + QUrl::toPercentEncoding(this->
text)
151 +
"&token=" + QUrl::toPercentEncoding(this->
token);
163 if (query->
Result->Failed)
165 Fail(
"Failed to deliver the message");
173 QDomNodeList l = d.elementsByTagName(
"edit");
176 QDomElement element = l.at(0).toElement();
177 if (element.attributes().contains(
"result"))
179 if (element.attribute(
"result") ==
"Success")
185 item.Result =
"Success";
186 item.
Type = HistoryMessage;
Message(WikiUser *target, QString Message, QString Summary)
WikiUser * user
User to deliver a message to.
static void Log(QString Message)
Write text to terminal as well as ring log.
History * _History
Pointer to history.
QString token
Token that is needed in order to write to page.
QString Target
This is optional property which contains a label of target this query is for.
static QString UserName
User name.
virtual bool Processed()
Returns true in case that query is processed.
void UnregisterConsumer(const int consumer)
This function will remove a string which prevent the object from being removed.
void RegisterConsumer(const int consumer)
Registers a consumer.
void Fail(QString reason)
static void AppendQuery(Query *item)
Insert a query to internal list of running queries, so that they can be watched This will insert it t...
QString Username
Username.
This is similar to query, just it's more simple, you can use it to deliver messages to users...
void Prepend(HistoryItem item)
Insert a new item to top of list.
void SetAction(const Action action)
Change the action type.
Query * Dependency
If this dependency is not a NULL then a message is sent after it is Processed (see Query::Processed()...
bool UsingPOST
Whether the query will submit parameters using POST data.
HistoryType Type
Type of item.
static QString EditSuffixOfHuggle
Suffix used by huggle.
QString text
Text of message that will be appended to talk page.
static void DebugLog(QString Message, unsigned int Verbosity=1)
This log is only shown if verbosity is same or larger than requested verbosity.
QString Parameters
Parameters for action, for example page title.
History consist of these items.
bool Finished()
Returns true in case that message was sent.
QString GetTalk()
Return a link to talk page of this user (like User talk:Jimbo)
void Send()
Send a message to user.
static MainWindow * Main
Pointer to main.
This class can be used to execute any kind of api query on any wiki.
bool Section
If edit will be created in new section.
QString Data
Data retrieved by query.
QueryResult * Result
Result of query, see documentation of QueryResult for more.