![]() |
LeechCraft 0.6.70-16373-g319c272718
Modular cross-platform feature rich live environment.
|
A customized cookie jar with additional features. More...
#include "customcookiejar.h"
Inheritance diagram for LC::Util::CustomCookieJar:
Collaboration diagram for LC::Util::CustomCookieJar:Signals | |
| void | cookiesAdded (const QList< QNetworkCookie > &) |
| void | cookiesRemoved (const QList< QNetworkCookie > &) |
Public Member Functions | |
| CustomCookieJar (QObject *parent=nullptr) | |
| Constructs the cookie jar. | |
| void | SetFilterTrackingCookies (bool filter) |
| void | SetEnabled (bool enabled) |
| Enables or disables the cookies. | |
| void | SetExactDomainMatch (bool enabled) |
| Sets whether exact domain matching is enabled. | |
| void | SetWhitelist (const QList< QRegExp > &list) |
| Sets the cookies whitelist. | |
| void | SetBlacklist (const QList< QRegExp > &list) |
| Sets the cookies blacklist. | |
| QByteArray | Save () const |
| void | Load (const QByteArray &data) |
| void | CollectGarbage () |
| QList< QNetworkCookie > | cookiesForUrl (const QUrl &url) const override |
| Returns cookies for the given url. | |
| bool | setCookiesFromUrl (const QList< QNetworkCookie > &cookieList, const QUrl &url) override |
| Adds the cookieList for the given url to the jar. | |
A customized cookie jar with additional features.
Allows one to filter tracking cookies, filter duplicate cookies and has unlimited storage period.
Definition at line 25 of file customcookiejar.h.
|
explicit |
Constructs the cookie jar.
Filtering of tracking cookies is false by default, and cookies aren't restored.
| [in] | parent | The parent object. |
Definition at line 21 of file customcookiejar.cpp.
| void LC::Util::CustomCookieJar::CollectGarbage | ( | ) |
Removes duplicate cookies.
Definition at line 93 of file customcookiejar.cpp.
References LC::Util::Filter().
Here is the call graph for this function:
|
signal |
|
override |
Returns cookies for the given url.
This function automatically filters out duplicate cookies.
If the cookie jar is disabled, this function does nothing.
| [in] | url | The url to return cookies for. |
Definition at line 112 of file customcookiejar.cpp.
References LC::Util::Filter().
Referenced by setCookiesFromUrl().
Here is the call graph for this function:
Here is the caller graph for this function:
|
signal |
| void LC::Util::CustomCookieJar::Load | ( | const QByteArray & | data | ) |
Restores the cookies from the array previously obtained from Save().
| [in] | data | Serialized cookies. |
Definition at line 71 of file customcookiejar.cpp.
References cookiesAdded(), and LC::Util::Filter().
Referenced by LC::Util::SvcAuth::VkAuthManager::VkAuthManager(), and LC::Util::SvcAuth::VkAuthManager::ClearAuthData().
Here is the call graph for this function:
Here is the caller graph for this function:| QByteArray LC::Util::CustomCookieJar::Save | ( | ) | const |
Serializes the cookie jar contents into a QByteArray suitable for storage.
Definition at line 51 of file customcookiejar.cpp.
References LC::Util::Filter().
Here is the call graph for this function:Sets the cookies blacklist.
Cookies whose domains match regexps from the list will always be rejected until they are also present in the whitelist, in which case they are accepted.
| [in] | list | The blacklist. |
Definition at line 46 of file customcookiejar.cpp.
|
override |
Adds the cookieList for the given url to the jar.
If the cookie jar is disabled, this function does nothing.
| [in] | cookieList | The list of cookies to add. |
| [in] | url | The url to set cookies for. |
Definition at line 194 of file customcookiejar.cpp.
References cookiesAdded(), cookiesForUrl(), cookiesRemoved(), LC::Util::Filter(), and LC::Util::MakeScopeGuard().
Here is the call graph for this function:Enables or disables the cookies.
If cookie jar is disabled, no new cookies will be saved and no cookies will be returned for any URL.
| [in] | enabled | Whether the cookie jar should be enabled. |
Definition at line 31 of file customcookiejar.cpp.
References LC::Util::Filter().
Here is the call graph for this function:Sets whether exact domain matching is enabled.
| [in] | enabled | Whether exact matching is enabled. |
Definition at line 36 of file customcookiejar.cpp.
References LC::Util::Filter().
Here is the call graph for this function:Enables or disables filtering tracking cookies.
| [in] | filter | Whether to filter tracking cookies. |
Definition at line 26 of file customcookiejar.cpp.
References LC::Util::Filter().
Here is the call graph for this function:Sets the cookies whitelist.
Cookies whose domains match regexps from the list will always be accepted even despite the SetFilterTrackingCookies() and SetExactDomainMatch() settings.
If a cookie domain matches both a whitelist regexp and blacklist regexp, it is accepted.
If cookies are disabled via SetEnabled(), this option has no effect.
| [in] | list | The whitelist. |
Definition at line 41 of file customcookiejar.cpp.