diff options
author | Vincent Sanders <vince@kyllikki.org> | 2014-01-16 00:52:17 +0000 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2014-01-16 00:52:17 +0000 |
commit | d47fed45245ddcecfb69d1e951ce627bdb6a44ff (patch) | |
tree | 53eacf0d3bea9804c53dd7e59ad335959474ced5 | |
parent | 38cb39339a8f1f9a0afb69340a404fd767db5a79 (diff) | |
download | netsurf-d47fed45245ddcecfb69d1e951ce627bdb6a44ff.tar.gz netsurf-d47fed45245ddcecfb69d1e951ce627bdb6a44ff.tar.bz2 |
move 401 login into operation table
-rw-r--r-- | amiga/gui.c | 1 | ||||
-rwxr-xr-x | amiga/login.c | 1 | ||||
-rwxr-xr-x | amiga/login.h | 4 | ||||
-rw-r--r-- | atari/gui.c | 4 | ||||
-rwxr-xr-x | atari/login.c | 3 | ||||
-rw-r--r-- | beos/gui.cpp | 2 | ||||
-rw-r--r-- | beos/gui.h | 3 | ||||
-rw-r--r-- | beos/login.cpp | 1 | ||||
-rw-r--r-- | cocoa/gui.m | 8 | ||||
-rw-r--r-- | desktop/401login.h | 31 | ||||
-rw-r--r-- | desktop/browser.c | 1 | ||||
-rw-r--r-- | desktop/gui.h | 35 | ||||
-rw-r--r-- | desktop/gui_factory.c | 9 | ||||
-rw-r--r-- | desktop/netsurf.c | 4 | ||||
-rw-r--r-- | framebuffer/Makefile.target | 2 | ||||
-rw-r--r-- | framebuffer/login.c | 25 | ||||
-rw-r--r-- | gtk/gui.c | 1 | ||||
-rw-r--r-- | gtk/gui.h | 6 | ||||
-rw-r--r-- | gtk/login.c | 1 | ||||
-rw-r--r-- | monkey/401login.c | 3 | ||||
-rw-r--r-- | monkey/401login.h | 9 | ||||
-rw-r--r-- | monkey/main.c | 2 | ||||
-rw-r--r-- | riscos/401login.c | 1 | ||||
-rw-r--r-- | riscos/gui.c | 1 | ||||
-rw-r--r-- | riscos/gui.h | 2 | ||||
-rw-r--r-- | utils/utils.h | 4 | ||||
-rw-r--r-- | windows/Makefile.target | 2 | ||||
-rw-r--r-- | windows/login.c | 25 |
28 files changed, 69 insertions, 122 deletions
diff --git a/amiga/gui.c b/amiga/gui.c index d651ef11e..ad172207b 100644 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -5159,6 +5159,7 @@ static struct gui_browser_table amiga_browser_table = { .cert_verify = gui_cert_verify, .filename_from_path = filename_from_path, .path_add_part = path_add_part, + .login = gui_401login_open, }; /** Normal entry point from OS */ diff --git a/amiga/login.c b/amiga/login.c index 816ece675..05d5d2470 100755 --- a/amiga/login.c +++ b/amiga/login.c @@ -16,7 +16,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "desktop/401login.h" #include "amiga/os3support.h" #include "amiga/gui.h" #include "amiga/object.h" diff --git a/amiga/login.h b/amiga/login.h index 2ad5d8bdc..e3f77901f 100755 --- a/amiga/login.h +++ b/amiga/login.h @@ -24,4 +24,8 @@ struct gui_login_window; BOOL ami_401login_event(struct gui_login_window *lw); + +void gui_401login_open(nsurl *url, const char *realm, + nserror (*cb)(bool proceed, void *pw), void *cbpw); + #endif diff --git a/atari/gui.c b/atari/gui.c index 55a23a84a..95cfe55ed 100644 --- a/atari/gui.c +++ b/atari/gui.c @@ -38,7 +38,6 @@ #include "desktop/local_history.h" #include "desktop/plotters.h" #include "desktop/netsurf.h" -#include "desktop/401login.h" #include "utils/nsoption.h" #include "desktop/save_complete.h" @@ -742,7 +741,7 @@ static void gui_set_clipboard(const char *buffer, size_t length, } } -void gui_401login_open(nsurl *url, const char *realm, +static void gui_401login_open(nsurl *url, const char *realm, nserror (*cb)(bool proceed, void *pw), void *cbpw) { bool bres; @@ -1078,6 +1077,7 @@ static struct gui_browser_table atari_browser_table = { .cert_verify = gui_cert_verify, .filename_from_path = filename_from_path, .path_add_part = path_add_part, + .login = gui_401login_open, }; /* #define WITH_DBG_LOGFILE 1 */ diff --git a/atari/login.c b/atari/login.c index 461a2f985..81636aebb 100755 --- a/atari/login.c +++ b/atari/login.c @@ -16,18 +16,17 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "desktop/401login.h" #include <unistd.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> #include <cflib.h> + #include "utils/config.h" #include "content/content.h" #include "content/hlcache.h" #include "content/urldb.h" #include "desktop/browser.h" -#include "desktop/401login.h" #include "desktop/gui.h" #include "utils/errors.h" #include "utils/utils.h" diff --git a/beos/gui.cpp b/beos/gui.cpp index 3600e85d0..4a6475894 100644 --- a/beos/gui.cpp +++ b/beos/gui.cpp @@ -49,7 +49,6 @@ extern "C" { #include "content/fetchers/curl.h" #include "content/fetchers/resource.h" #include "content/urldb.h" -#include "desktop/401login.h" #include "desktop/browser_private.h" #include "desktop/gui.h" #include "desktop/netsurf.h" @@ -1071,6 +1070,7 @@ static struct gui_browser_table beos_browser_table = { .launch_url = gui_launch_url, .filename_from_path = filename_from_path, .path_add_part = path_add_part, + .login = gui_401login_open, }; diff --git a/beos/gui.h b/beos/gui.h index b9d66320c..ea1a8ad3a 100644 --- a/beos/gui.h +++ b/beos/gui.h @@ -32,6 +32,9 @@ extern bool replicated; int gui_init_replicant(int argc, char** argv); +extern "C" void gui_401login_open(nsurl *url, const char *realm, + nserror (*cb)(bool proceed, void *pw), void *cbpw); + extern char *options_file_location; diff --git a/beos/login.cpp b/beos/login.cpp index 90cadde7b..5cd7a3c83 100644 --- a/beos/login.cpp +++ b/beos/login.cpp @@ -31,7 +31,6 @@ extern "C" { #include "content/content.h" #include "content/urldb.h" #include "desktop/browser.h" -#include "desktop/401login.h" #include "desktop/gui.h" #include "utils/messages.h" #include "utils/url.h" diff --git a/cocoa/gui.m b/cocoa/gui.m index f9cb2e4c7..a49ea9ea2 100644 --- a/cocoa/gui.m +++ b/cocoa/gui.m @@ -31,7 +31,6 @@ #import "desktop/browser_private.h" #import "utils/nsoption.h" #import "desktop/textinput.h" -#import "desktop/401login.h" #import "utils/utils.h" #import "utils/log.h" #import "image/ico.h" @@ -274,13 +273,6 @@ static void gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs, cb( false, cbpw ); } - -void gui_401login_open(nsurl *url, const char *realm, - nserror (*cb)(bool proceed, void *pw), void *cbpw) -{ - cb( false, cbpw ); -} - static char *filename_from_path(char *path) { return strdup( [[[NSString stringWithUTF8String: path] lastPathComponent] UTF8String] ); diff --git a/desktop/401login.h b/desktop/401login.h deleted file mode 100644 index 1c8140bae..000000000 --- a/desktop/401login.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2003 John M Bell <jmb202@ecs.soton.ac.uk> - * - * This file is part of NetSurf, http://www.netsurf-browser.org/ - * - * NetSurf 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; version 2 of the License. - * - * NetSurf 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 this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef NETSURF_DESKTOP_401LOGIN_H -#define NETSURF_DESKTOP_401LOGIN_H - -#include <stdbool.h> - -#include "utils/config.h" -#include "utils/nsurl.h" -#include "utils/errors.h" - -void gui_401login_open(nsurl *url, const char *realm, - nserror (*cb)(bool proceed, void *pw), void *cbpw); - -#endif diff --git a/desktop/browser.c b/desktop/browser.c index d65033097..f66e27576 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -41,7 +41,6 @@ #include "content/fetch.h" #include "content/hlcache.h" #include "content/urldb.h" -#include "desktop/401login.h" #include "desktop/browser_private.h" #include "desktop/download.h" #include "desktop/frames.h" diff --git a/desktop/gui.h b/desktop/gui.h index 102aade45..cd116e9c1 100644 --- a/desktop/gui.h +++ b/desktop/gui.h @@ -301,6 +301,23 @@ struct gui_browser_table { */ void (*poll)(bool active); + /** + * Return the filename part of a full path + * + * \param path full path and filename + * \return filename (will be freed with free()) + */ + char *(*filename_from_path)(char *path); + + /** + * Add a path component/filename to an existing path + * + * \param path buffer containing path + free space + * \param length length of buffer "path" + * \param newpart string containing path component to add to path + * \return true on success + */ + bool (*path_add_part)(char *path, int length, const char *newpart); /* Optional entries */ @@ -345,22 +362,10 @@ struct gui_browser_table { void (*cert_verify)(nsurl *url, const struct ssl_cert_info *certs, unsigned long num, nserror (*cb)(bool proceed, void *pw), void *cbpw); /** - * Return the filename part of a full path - * - * \param path full path and filename - * \return filename (will be freed with free()) - */ - char *(*filename_from_path)(char *path); - - /** - * Add a path component/filename to an existing path - * - * \param path buffer containing path + free space - * \param length length of buffer "path" - * \param newpart string containing path component to add to path - * \return true on success + * Prompt user for login */ - bool (*path_add_part)(char *path, int length, const char *newpart); + void (*login)(nsurl *url, const char *realm, + nserror (*cb)(bool proceed, void *pw), void *cbpw); }; diff --git a/desktop/gui_factory.c b/desktop/gui_factory.c index cd5031b0d..1bd683df7 100644 --- a/desktop/gui_factory.c +++ b/desktop/gui_factory.c @@ -304,6 +304,12 @@ static void gui_default_cert_verify(nsurl *url, cb(false, cbpw); } +static void gui_default_401login_open(nsurl *url, const char *realm, + nserror (*cb)(bool proceed, void *pw), void *cbpw) +{ + cb(false, cbpw); +} + static nserror verify_browser_register(struct gui_browser_table *gbt) { @@ -343,6 +349,9 @@ static nserror verify_browser_register(struct gui_browser_table *gbt) if (gbt->cert_verify == NULL) { gbt->cert_verify = gui_default_cert_verify; } + if (gbt->login == NULL) { + gbt->login = gui_default_401login_open; + } return NSERROR_OK; } diff --git a/desktop/netsurf.c b/desktop/netsurf.c index 5589f51a5..d294073ba 100644 --- a/desktop/netsurf.c +++ b/desktop/netsurf.c @@ -37,10 +37,8 @@ #include "image/image.h" #include "image/image_cache.h" #include "desktop/netsurf.h" -#include "desktop/401login.h" #include "desktop/browser.h" #include "desktop/system_colour.h" -#include "desktop/gui.h" #include "desktop/gui_factory.h" #include "utils/nsoption.h" #include "desktop/searchweb.h" @@ -96,7 +94,7 @@ static nserror netsurf_llcache_query_handler(const llcache_query *query, { switch (query->type) { case LLCACHE_QUERY_AUTH: - gui_401login_open(query->url, query->data.auth.realm, cb, cbpw); + guit->browser->login(query->url, query->data.auth.realm, cb, cbpw); break; case LLCACHE_QUERY_REDIRECT: /** \todo Need redirect query dialog */ diff --git a/framebuffer/Makefile.target b/framebuffer/Makefile.target index 5c658925e..58a504b17 100644 --- a/framebuffer/Makefile.target +++ b/framebuffer/Makefile.target @@ -135,7 +135,7 @@ $(eval $(foreach V,$(filter FB_IMAGE_%,$(.VARIABLES)),$(call convert_image,$($(V # S_FRAMEBUFFER are sources purely for the framebuffer build S_FRAMEBUFFER := gui.c framebuffer.c schedule.c \ - thumbnail.c misc.c bitmap.c filetype.c login.c findfile.c \ + thumbnail.c misc.c bitmap.c filetype.c findfile.c \ localhistory.c clipboard.c S_FRAMEBUFFER_FBTK := fbtk.c event.c fill.c bitmap.c user.c window.c \ diff --git a/framebuffer/login.c b/framebuffer/login.c deleted file mode 100644 index 7a5e195f4..000000000 --- a/framebuffer/login.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2008 Vincent Sanders <vince@simtec.co.uk> - * - * This file is part of NetSurf, http://www.netsurf-browser.org/ - * - * NetSurf 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; version 2 of the License. - * - * NetSurf 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 this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "desktop/401login.h" - -void gui_401login_open(nsurl *url, const char *realm, - nserror (*cb)(bool proceed, void *pw), void *cbpw) -{ - cb(false, cbpw); -} @@ -1143,6 +1143,7 @@ static struct gui_browser_table nsgtk_browser_table = { .cert_verify = gui_cert_verify, .filename_from_path = filename_from_path, .path_add_part = path_add_part, + .login = gui_401login_open, }; /** @@ -29,7 +29,8 @@ #include <inttypes.h> #include <stdbool.h> #include <gtk/gtk.h> -//#include <glade/glade.h> + +#include "utils/nsurl.h" struct glade_file_location_s { char *netsurf; @@ -60,5 +61,8 @@ extern GdkPixbuf *favicon_pixbuf; /* favicon default pixbuf */ uint32_t gtk_gui_gdkkey_to_nskey(GdkEventKey *); +extern void gui_401login_open(nsurl *url, const char *realm, + nserror (*cb)(bool proceed, void *pw), void *cbpw); + #endif /* GTK_GUI_H */ diff --git a/gtk/login.c b/gtk/login.c index 3b8d68254..baf37d094 100644 --- a/gtk/login.c +++ b/gtk/login.c @@ -28,7 +28,6 @@ #include "content/hlcache.h" #include "content/urldb.h" #include "desktop/browser.h" -#include "desktop/401login.h" #include "desktop/gui.h" #include "utils/messages.h" #include "utils/url.h" diff --git a/monkey/401login.c b/monkey/401login.c index 605a21aa9..8b4d33d7d 100644 --- a/monkey/401login.c +++ b/monkey/401login.c @@ -16,12 +16,13 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "desktop/401login.h" #include "utils/ring.h" #include <stdlib.h> #include <stdio.h> +#include "monkey/401login.h" + typedef struct monkey401 { struct monkey401 *r_next, *r_prev; uint32_t num; diff --git a/monkey/401login.h b/monkey/401login.h new file mode 100644 index 000000000..e78355ea2 --- /dev/null +++ b/monkey/401login.h @@ -0,0 +1,9 @@ + +#include <stdbool.h> + +#include "utils/nsurl.h" +#include "utils/errors.h" + + +void gui_401login_open(nsurl *url, const char *realm, + nserror (*cb)(bool proceed, void *pw), void *cbpw); diff --git a/monkey/main.c b/monkey/main.c index 1922393a8..b6f5c434d 100644 --- a/monkey/main.c +++ b/monkey/main.c @@ -26,6 +26,7 @@ #include "monkey/dispatch.h" #include "monkey/browser.h" #include "monkey/cert.h" +#include "monkey/401login.h" #include "content/urldb.h" #include "content/fetchers/resource.h" @@ -161,6 +162,7 @@ static struct gui_browser_table monkey_browser_table = { .cert_verify = gui_cert_verify, .filename_from_path = filename_from_path, .path_add_part = path_add_part, + .login = gui_401login_open, }; int diff --git a/riscos/401login.c b/riscos/401login.c index 6740f54e5..e6772b820 100644 --- a/riscos/401login.c +++ b/riscos/401login.c @@ -27,7 +27,6 @@ #include "content/hlcache.h" #include "content/urldb.h" #include "desktop/browser.h" -#include "desktop/401login.h" #include "desktop/gui.h" #include "riscos/dialog.h" #include "riscos/wimp_event.h" diff --git a/riscos/gui.c b/riscos/gui.c index c780abfcf..f7dc6c962 100644 --- a/riscos/gui.c +++ b/riscos/gui.c @@ -2362,6 +2362,7 @@ static struct gui_browser_table riscos_browser_table = { .cert_verify = gui_cert_verify, .filename_from_path = filename_from_path, .path_add_part = path_add_part, + .login = gui_401login_open, }; diff --git a/riscos/gui.h b/riscos/gui.h index b45bd472c..89a539300 100644 --- a/riscos/gui.h +++ b/riscos/gui.h @@ -127,6 +127,8 @@ extern struct gui_download_table *riscos_download_table; /* in 401login.c */ void ro_gui_401login_init(void); +void gui_401login_open(nsurl *url, const char *realm, + nserror (*cb)(bool proceed, void *pw), void *cbpw); /* in window.c */ bool ro_gui_window_dataload(struct gui_window *g, wimp_message *message); diff --git a/utils/utils.h b/utils/utils.h index e3b3647ea..d56330e10 100644 --- a/utils/utils.h +++ b/utils/utils.h @@ -184,9 +184,11 @@ inline static char digit2uppercase_hex(unsigned char digit) { /* Platform specific functions */ void die(const char * const error); void warn_user(const char *warning, const char *detail); +void PDF_Password(char **owner_pass, char **user_pass, char *path); + +/* only riscos */ query_id query_user(const char *query, const char *detail, const query_callback *cb, void *pw, const char *yes, const char *no); void query_close(query_id); -void PDF_Password(char **owner_pass, char **user_pass, char *path); #endif diff --git a/windows/Makefile.target b/windows/Makefile.target index cad28b575..87544e3db 100644 --- a/windows/Makefile.target +++ b/windows/Makefile.target @@ -65,7 +65,7 @@ S_RESOURCES := windows_resource.o # S_WINDOWS are sources purely for the windows build S_WINDOWS := main.c window.c gui.c drawable.c misc.c plot.c findfile.c \ font.c bitmap.c about.c prefs.c download.c filetype.c \ - localhistory.c login.c schedule.c thumbnail.c windbg.c + localhistory.c schedule.c thumbnail.c windbg.c S_WINDOWS := $(addprefix windows/,$(S_WINDOWS)) # This is the final source build list diff --git a/windows/login.c b/windows/login.c deleted file mode 100644 index 7a5e195f4..000000000 --- a/windows/login.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2008 Vincent Sanders <vince@simtec.co.uk> - * - * This file is part of NetSurf, http://www.netsurf-browser.org/ - * - * NetSurf 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; version 2 of the License. - * - * NetSurf 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 this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "desktop/401login.h" - -void gui_401login_open(nsurl *url, const char *realm, - nserror (*cb)(bool proceed, void *pw), void *cbpw) -{ - cb(false, cbpw); -} |