2003-07-30 17:06:22 +04:00
|
|
|
/*
|
|
|
|
* This file is part of NetSurf, http://netsurf.sourceforge.net/
|
|
|
|
* Licensed under the GNU General Public License,
|
|
|
|
* http://www.opensource.org/licenses/gpl-license
|
|
|
|
* Copyright 2003 Rob Jackson <jacko@xms.ms>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include "oslib/uri.h"
|
|
|
|
#include "oslib/wimp.h"
|
2004-01-05 05:10:59 +03:00
|
|
|
#include "netsurf/utils/config.h"
|
2003-07-30 17:06:22 +04:00
|
|
|
#include "netsurf/desktop/browser.h"
|
|
|
|
#include "netsurf/riscos/theme.h"
|
|
|
|
#include "netsurf/desktop/gui.h"
|
|
|
|
#include "netsurf/riscos/gui.h"
|
|
|
|
#include "netsurf/utils/log.h"
|
|
|
|
#include "netsurf/utils/utils.h"
|
|
|
|
|
2004-01-05 05:10:59 +03:00
|
|
|
#ifdef WITH_URI
|
|
|
|
|
2003-07-30 17:06:22 +04:00
|
|
|
void ro_uri_message_received(uri_full_message_process*);
|
|
|
|
|
|
|
|
|
|
|
|
void ro_uri_message_received(uri_full_message_process* uri_message)
|
|
|
|
{
|
|
|
|
uri_h uri_handle;
|
|
|
|
char* uri_requested;
|
|
|
|
|
|
|
|
struct browser_window* bw;
|
|
|
|
int uri_length;
|
|
|
|
|
|
|
|
uri_handle = uri_message->handle;
|
|
|
|
|
|
|
|
LOG(("URI message... %s, handle = %d", uri_message->uri,
|
|
|
|
(int)uri_message->handle));
|
|
|
|
|
|
|
|
if ( (strspn(uri_message->uri, "http://") != strlen("http://")) &&
|
|
|
|
(strspn(uri_message->uri, "https://") != strlen("https://")) &&
|
|
|
|
(strspn(uri_message->uri, "file:/") != strlen("file:/")) )
|
|
|
|
return;
|
|
|
|
|
|
|
|
else LOG(("URI message deemed relevant"));
|
|
|
|
|
|
|
|
uri_message->your_ref = uri_message->my_ref;
|
|
|
|
uri_message->action = message_URI_PROCESS_ACK;
|
|
|
|
|
|
|
|
xwimp_send_message(wimp_USER_MESSAGE_ACKNOWLEDGE,
|
|
|
|
(wimp_message*)uri_message,
|
|
|
|
uri_message->sender);
|
|
|
|
|
|
|
|
xuri_request_uri(0, 0, 0, uri_handle, &uri_length);
|
2003-12-27 01:11:28 +03:00
|
|
|
uri_requested = xcalloc((unsigned int)uri_length, sizeof(char));
|
2003-07-30 17:06:22 +04:00
|
|
|
|
|
|
|
if (uri_requested == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
xuri_request_uri(0, uri_requested, uri_length, uri_handle, NULL);
|
|
|
|
|
|
|
|
bw = create_browser_window(browser_TITLE | browser_TOOLBAR
|
2004-01-05 05:10:59 +03:00
|
|
|
| browser_SCROLL_X_ALWAYS | browser_SCROLL_Y_ALWAYS, 640, 480
|
|
|
|
#ifdef WITH_FRAMES
|
|
|
|
, NULL
|
|
|
|
#endif
|
|
|
|
);
|
2003-07-30 17:06:22 +04:00
|
|
|
|
|
|
|
gui_window_show(bw->window);
|
|
|
|
browser_window_open_location(bw, uri_requested);
|
|
|
|
|
|
|
|
wimp_set_caret_position(bw->window->data.browser.toolbar,
|
2003-11-20 03:16:31 +03:00
|
|
|
ICON_TOOLBAR_URL,
|
2003-07-30 17:06:22 +04:00
|
|
|
0,0,-1, (int) strlen(bw->window->url) - 1);
|
|
|
|
|
|
|
|
|
|
|
|
xfree(uri_requested);
|
|
|
|
}
|
2004-01-05 05:10:59 +03:00
|
|
|
#endif
|