Add header

This commit is contained in:
jun7 2018-05-22 15:20:07 +09:00
parent 5a0bcaa238
commit 93501dccc8

32
ab.c
View File

@ -1,4 +1,22 @@
//added /*
Copyright 2018 jun7@hush.mail
This file is part of wyebadblock.
wyebadblock is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
wyebadblock is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with wyebadblock. If not, see <http://www.gnu.org/licenses/>.
*/
#include "wyebrun.h" #include "wyebrun.h"
#define EXE "wyebab" #define EXE "wyebab"
@ -24,15 +42,12 @@ static bool check(const char *requri, const char *pageuri)
if (ruri && !*ruri) return false; if (ruri && !*ruri) return false;
return true; return true;
} }
static gboolean reqcb(WebKitWebPage *page, WebKitURIRequest *req, static gboolean reqcb(WebKitWebPage *kp, WebKitURIRequest *req,
WebKitURIResponse *r, gpointer p) WebKitURIResponse *r, gpointer p)
{ {
if (g_object_get_data(G_OBJECT(page), "adblock") == (gpointer)'n') if (g_object_get_data(G_OBJECT(kp), "adblock") == (gpointer)'n')
return false; return false;
const char *requri = webkit_uri_request_get_uri(req);
const char *pageuri = webkit_web_page_get_uri(page);
if (first) if (first)
{ {
if (webkit_uri_request_get_http_headers(req)) if (webkit_uri_request_get_http_headers(req))
@ -41,7 +56,8 @@ static gboolean reqcb(WebKitWebPage *page, WebKitURIRequest *req,
return false; return false;
} }
if (check(requri, pageuri)) return false; if (check(webkit_uri_request_get_uri(req),
webkit_web_page_get_uri(kp))) return false;
return true; return true;
} }
@ -106,8 +122,6 @@ G_MODULE_EXPORT void webkit_web_extension_initialize_with_user_data(
#include "ephy-uri-tester.h" #include "ephy-uri-tester.h"
#include "ephy-uri-tester.c" #include "ephy-uri-tester.c"
static EphyUriTester *tester = NULL; static EphyUriTester *tester = NULL;
static GThread *initt = NULL; static GThread *initt = NULL;