diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2003-10-25 19:20:13 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2003-10-25 19:20:13 +0000 |
commit | c9e188a4d1634d9c7d2292a8d04e02f313f37f3b (patch) | |
tree | a58742b163820d4ee839f4a035603afa50243e63 /riscos | |
parent | ed449261f62cb56a9d6eb7d16f7d54d79bbea1f4 (diff) | |
download | netsurf-c9e188a4d1634d9c7d2292a8d04e02f313f37f3b.tar.gz netsurf-c9e188a4d1634d9c7d2292a8d04e02f313f37f3b.tar.bz2 |
[project @ 2003-10-25 19:20:13 by jmb]
HTTP Auth login improved (greatly).
Addresses all three issues in the previous version.
svn path=/import/netsurf/; revision=382
Diffstat (limited to 'riscos')
-rw-r--r-- | riscos/401login.c | 52 |
1 files changed, 25 insertions, 27 deletions
diff --git a/riscos/401login.c b/riscos/401login.c index edd081cc0..81f4ba75e 100644 --- a/riscos/401login.c +++ b/riscos/401login.c @@ -6,8 +6,11 @@ */ #include <assert.h> +#include <ctype.h> #include <string.h> #include "oslib/wimp.h" +#include "netsurf/content/content.h" +#include "netsurf/desktop/browser.h" #include "netsurf/desktop/401login.h" #include "netsurf/desktop/gui.h" #include "netsurf/riscos/gui.h" @@ -16,7 +19,6 @@ #include "netsurf/utils/utils.h" static void get_unamepwd(void); -static void do_thing(void); static wimp_window *dialog_401; extern wimp_w dialog_401li; @@ -26,6 +28,7 @@ struct login LOGIN; static char *uname; static char* url; static char *pwd; +static struct browser_window *bwin; /** * Load the 401 login window template. @@ -50,6 +53,21 @@ void ro_gui_401login_init(void) wimp_NO_FONTS, name, 0, 0, 0); } +void gui_401login_open(struct browser_window *bw, struct content *c, char *realm) { + + char *murl, *host; + int i; + + murl = c->url; + host = get_host_from_url(murl); + bwin = bw; + + ro_gui_401login_open(host, realm, murl); + + xfree(host); +} + + /** * Open a 401 login window. */ @@ -62,7 +80,7 @@ void ro_gui_401login_open(char *host, char* realm, char *fetchurl) /* fill in download window icons */ dialog_401->icons[ICON_401LOGIN_HOST].data.indirected_text.text = - host; + xstrdup(host); dialog_401->icons[ICON_401LOGIN_HOST].data.indirected_text.size = strlen(host) + 1; dialog_401->icons[ICON_401LOGIN_REALM].data.indirected_text.text = @@ -90,12 +108,9 @@ void ro_gui_401login_click(wimp_pointer *pointer) { switch (pointer->i) { case ICON_401LOGIN_LOGIN: if (pointer->buttons == wimp_CLICK_SELECT) { - LOG(("here")); get_unamepwd(); ro_gui_dialog_close(dialog_401li); - do_thing(); - LOGIN.string = 0; /* TODO: keep the details until we - * access a new site */ + browser_window_open_location(bwin, url); } else ro_gui_dialog_close(dialog_401li); @@ -106,9 +121,7 @@ void ro_gui_401login_click(wimp_pointer *pointer) { else { get_unamepwd(); ro_gui_dialog_close(dialog_401li); - do_thing(); - LOGIN.string = 0; /* TODO: keep the details until we - * access a new site */ + browser_window_open_location(bwin, url); } break; default: break; @@ -117,24 +130,9 @@ void ro_gui_401login_click(wimp_pointer *pointer) { void get_unamepwd() { - LOGIN.string = xcalloc(strlen(uname)+strlen(pwd)+2, sizeof(char)); - - sprintf(LOGIN.string, "%s:%s", uname, pwd); - LOG(("%s", LOGIN.string)); -} + char *lidets = xcalloc(strlen(uname)+strlen(pwd)+2, sizeof(char)); -void do_thing() { + sprintf(lidets, "%s:%s", uname, pwd); - struct gui_window *gw; - - /* TODO: fix this. For now we just open the page in the - * first window in the list. */ - for (gw=window_list; gw!=NULL; gw=gw->next) { - if (gw->type == GUI_BROWSER_WINDOW /*&& - (strcasecmp(gw->url, url)==0 || - strcasecmp(gw->data.browser.bw->url, url)==0)*/) - break; - } - if (gw != NULL) - browser_window_open_location_historical(gw->data.browser.bw, url, 0, 0); + login_list_add(url, lidets); } |