24 #include <oslib/wimp.h> 35 #define ICON_401LOGIN_LOGIN 0 36 #define ICON_401LOGIN_CANCEL 1 37 #define ICON_401LOGIN_HOST 2 38 #define ICON_401LOGIN_REALM 3 39 #define ICON_401LOGIN_USERNAME 4 40 #define ICON_401LOGIN_PASSWORD 5 81 const char *username,
const char *password,
93 lwc_string_unref(host);
104 const char *username,
const char *password,
106 const char *password,
114 assert(host != NULL);
115 assert(username != NULL);
116 assert(password != NULL);
125 realm =
"Secure Area";
128 session->
host = lwc_string_ref(host);
129 session->
realm = strdup(realm);
133 len = strlen(username);
134 assert(len <
sizeof(session->
uname));
135 memcpy(session->
uname, username, len + 1);
137 len = strlen(password);
138 assert(len <
sizeof(session->
pwd));
139 memcpy(session->
pwd, password, len + 1);
141 if (!session->
realm) {
143 lwc_string_unref(session->
host);
151 indirected_text.text =
152 (
char *)lwc_string_data(session->
host);
154 indirected_text.size =
155 lwc_string_length(session->
host) + 1;
157 indirected_text.text = session->
realm;
159 indirected_text.size = strlen(session->
realm) + 1;
161 indirected_text.text = session->
uname;
163 indirected_text.size =
sizeof(session->
uname);
165 indirected_text.text = session->
pwd;
167 indirected_text.size =
sizeof(session->
pwd);
170 w = wimp_create_window(dialog_401_template);
198 if (session->
cb != NULL)
199 session->
cb(NULL, NULL, session->
cbpw);
202 lwc_string_unref(session->
host);
203 free(session->
realm);
206 error = xwimp_delete_window(w);
208 NSLOG(netsurf, INFO,
"xwimp_delete_window: 0x%x:%s",
209 error->errnum, error->errmess);
231 session->
cbpw = NULL;
static bool ro_gui_401login_apply(wimp_w w)
char * realm
Authentication realm.
Interface to utility string handling.
Localised message support (interface).
lwc_string * host
Host for user display.
void * cbpw
Continuation data.
void ro_gui_401login_init(void)
Load the 401 login window template.
Automated RISC OS WIMP event handling (interface).
bool ro_gui_wimp_event_register_close_window(wimp_w w, void(*callback)(wimp_w w))
Register a function to be called after the window has been closed.
char uname[256]
Buffer for username.
#define ICON_401LOGIN_LOGIN
nserror
Enumeration of error codes.
#define ICON_401LOGIN_CANCEL
static nserror ro_gui_401login_open(nsurl *url, lwc_string *host, const char *realm, const char *username, const char *password, nserror(*cb)(const char *username, const char *password, void *pw), void *cbpw)
Open a 401 login window.
wimp_window * ro_gui_dialog_load_template(const char *template_name)
Load a template without creating a window.
#define NSLOG(catname, level, logmsg, args...)
nsurl * url
URL being fetched.
bool ro_gui_wimp_event_register_text_field(wimp_w w, wimp_i i)
Register a text field to be automatically handled.
char pwd[256]
Buffer for password.
nserror gui_401login_open(struct nsurl *url, const char *realm, const char *username, const char *password, nserror(*cb)(struct nsurl *url, const char *realm, const char *username, const char *password, void *pw), void *cbpw)
bool ro_gui_wimp_event_register_ok(wimp_w w, wimp_i i, bool(*callback)(wimp_w w))
Register a function to be called for the OK action on a window.
void * ro_gui_wimp_event_get_user_data(wimp_w w)
Gets the user data associated with a window.
lwc_string * nsurl_get_component(const nsurl *url, nsurl_component part)
Get part of a URL as a lwc_string, from a NetSurf URL object.
nserror(* cb)(struct nsurl *, const char *, const char *, const char *, void *)
bool ro_gui_wimp_event_set_user_data(wimp_w w, void *user)
Sets the user data associated with a window.
void ro_gui_dialog_open_persistent(wimp_w parent, wimp_w w, bool pointer)
Open a persistent dialog box relative to the pointer.
bool ro_gui_wimp_event_register_cancel(wimp_w w, wimp_i i)
Register a function to be called for the Cancel action on a window.
Unified URL information database public interface.
nserror(* cb)(const char *username, const char *password, void *pw)
Continuation callback.
#define ICON_401LOGIN_HOST
nsurl * nsurl_ref(nsurl *url)
Increment the reference count to a NetSurf URL object.
#define ICON_401LOGIN_USERNAME
void ro_gui_wimp_event_finalise(wimp_w w)
Free any resources associated with a window.
nserror ro_warn_user(const char *warning, const char *detail)
Display a warning for a serious problem (eg memory exhaustion).
NetSurf URL handling (interface).
#define ICON_401LOGIN_PASSWORD
struct nsurl nsurl
NetSurf URL object.
login window session data
static wimp_window * dialog_401_template
static void ro_gui_401login_close(wimp_w w)
Handle closing of login dialog.
void nsurl_unref(nsurl *url)
Drop a reference to a NetSurf URL object.
#define ICON_401LOGIN_REALM