34#include <oslib/inetsuite.h>
35#include <oslib/wimp.h>
56 inetsuite_message_open_url *url_message =
57 (inetsuite_message_open_url*) &message->data;
65 if (url_message->indirect.tag != 0) {
66 url =
strndup(url_message->url, 236);
72 for (i = 0; !iscntrl(url[i]); i++)
77 if (!url_message->indirect.url.offset) {
78 NSLOG(netsurf, INFO,
"no URL in message");
81 if (28 < message->size &&
82 url_message->indirect.body_file.offset) {
84 "POST for URL message not implemented");
87 if (url_message->indirect.url.offset < 28 ||
88 236 <= url_message->indirect.url.offset) {
90 "external pointers in URL message unimplemented");
97 url =
strndup((
char *) url_message +
98 url_message->indirect.url.offset,
99 236 - url_message->indirect.url.offset);
104 for (i = 0; !iscntrl(url[i]); i++)
123 message->your_ref = message->my_ref;
124 error = xwimp_send_message(wimp_USER_MESSAGE_ACKNOWLEDGE, message,
127 NSLOG(netsurf, INFO,
"xwimp_send_message: 0x%x: %s",
128 error->errnum, error->errmess);
153 inetsuite_full_message_open_url_direct message;
155 int len = strlen(url) + 1;
163 message.size = ((20+len+3) & ~3);
164 message.your_ref = 0;
165 message.action = message_INET_SUITE_OPEN_URL;
166 strncpy(message.url, url, 235);
167 message.url[235] = 0;
168 error = xwimp_send_message(wimp_USER_MESSAGE_RECORDED,
169 (wimp_message *) &message, 0);
171 NSLOG(netsurf, INFO,
"xwimp_send_message: 0x%x: %s",
172 error->errnum, error->errmess);
189 colon = strchr(url,
':');
191 NSLOG(netsurf, INFO,
"invalid url '%s'", url);
195 command = malloc(40 + (colon - url) + strlen(url));
201 sprintf(command,
"Alias$URLOpen_%.*s", (
int) (colon - url), url);
202 if (!getenv(command)) {
207 sprintf(command,
"URLOpen_%.*s %s", (
int) (colon - url), url, url);
209 error = xwimp_start_task(command, 0);
211 NSLOG(netsurf, INFO,
"xwimp_start_task: 0x%x: %s",
212 error->errnum, error->errmess);
226 inetsuite_message_open_url *url_message =
227 (inetsuite_message_open_url*) &message->data;
Browser window creation and manipulation interface.
nserror browser_window_create(enum browser_window_create_flags flags, struct nsurl *url, struct nsurl *referrer, struct browser_window *existing, struct browser_window **bw)
Create and open a new root browser window with the given page.
@ BW_CREATE_HISTORY
this will form a new history node (don't set for back/reload/etc)
char * strndup(const char *s, size_t n)
Duplicate up to n characters of a string.
bool fetch_can_fetch(const nsurl *url)
Check if a URL's scheme can be fetched.
Fetching of data from a URL (interface).
nserror
Enumeration of error codes.
#define NSLOG(catname, level, logmsg, args...)
const char * messages_get_errorcode(nserror code)
lookup of a message by errorcode from the standard Messages hash.
Localised message support (interface).
NetSurf URL handling (interface).
nserror nsurl_create(const char *const url_s, nsurl **url)
Create a NetSurf URL object from a URL string.
void nsurl_unref(nsurl *url)
Drop a reference to a NetSurf URL object.
struct nsurl nsurl
NetSurf URL object.
nserror ro_warn_user(const char *warning, const char *detail)
Display a warning for a serious problem (eg memory exhaustion).
Interface to utility string handling.
bool ro_uri_launch(const char *uri)
void ro_url_load(const char *url)
Launch a program to handle an URL, using the ANT protocol Alias$URLOpen_ system.
void ro_url_broadcast(const char *url)
Broadcast an ANT URL message.
void ro_url_message_received(wimp_message *message)
Handle a Message_InetSuiteOpenURL.
void ro_url_bounce(wimp_message *message)
Handle a bounced Message_InetSuiteOpenURL.
ANT URL launching protocol (interface).