-#if 0
-void
-adblock(WebKitWebView *web_view, WebKitWebFrame *frame,
- WebKitWebResource *resource, WebKitNetworkRequest *request,
- WebKitNetworkResponse *response, gpointer data)
-{
- GSList *it = adblock_patterns;
- const gchar *uri;
-
- uri = webkit_network_request_get_uri(request);
- if (show_all_requests)
- fprintf(stderr, " -> %s\n", uri);
-
- while (it)
- {
- if (g_regex_match((GRegex *)(it->data), uri, 0, NULL))
- {
- webkit_network_request_set_uri(request, "about:blank");
- if (show_all_requests)
- fprintf(stderr, " BLOCKED!\n");
- return;
- }
- it = g_slist_next(it);
- }
-}
-
-void
-adblock_load(void)
-{
- GRegex *re = NULL;
- GError *err = NULL;
- GIOChannel *channel = NULL;
- gchar *path = NULL, *buf = NULL;
-
- path = g_build_filename(g_get_user_config_dir(), __NAME__, "adblock.black",
- NULL);
- channel = g_io_channel_new_file(path, "r", &err);
- if (channel != NULL)
- {
- while (g_io_channel_read_line(channel, &buf, NULL, NULL, NULL)
- == G_IO_STATUS_NORMAL)
- {
- g_strstrip(buf);
- if (buf[0] != '#')
- {
- re = g_regex_new(buf,
- G_REGEX_CASELESS | G_REGEX_OPTIMIZE,
- G_REGEX_MATCH_PARTIAL, &err);
- if (err != NULL)
- {
- fprintf(stderr, __NAME__": Could not compile regex: %s\n", buf);
- g_error_free(err);
- err = NULL;
- }
- else
- adblock_patterns = g_slist_append(adblock_patterns, re);
- }
- g_free(buf);
- }
- g_io_channel_shutdown(channel, FALSE, NULL);
- }
- g_free(path);
-}
-#endif
-