hrev44814 adds 1 changeset to branch 'master' old head: 3d49fa31ec7d4c6e12adc3b4e520796aee1837a5 new head: 1346bfbf6957d938493ff3a0e6fb360b3aba6816 ---------------------------------------------------------------------------- 1346bfb: urlwrapper: Handle the doi: URI scheme The DOI (Digital Object Identifier) is a unique identifier for (scientific and other...) publications. While the doi: URI scheme was only a draft, it's not totally unlikely that we ever hit such a URI, in this case we just redirect to the official DOI website. cf. http://tools.ietf.org/html/draft-paskin-doi-uri [ FranÃois Revol <revol@xxxxxxx> ] ---------------------------------------------------------------------------- Revision: hrev44814 Commit: 1346bfbf6957d938493ff3a0e6fb360b3aba6816 URL: http://cgit.haiku-os.org/haiku/commit/?id=1346bfb Author: FranÃois Revol <revol@xxxxxxx> Date: Fri Nov 9 21:22:02 2012 UTC ---------------------------------------------------------------------------- 2 files changed, 22 insertions(+), 1 deletion(-) src/bin/urlwrapper.cpp | 20 ++++++++++++++++++++ src/bin/urlwrapper.rdef | 3 ++- ---------------------------------------------------------------------------- diff --git a/src/bin/urlwrapper.cpp b/src/bin/urlwrapper.cpp index ef29186..389549d 100644 --- a/src/bin/urlwrapper.cpp +++ b/src/bin/urlwrapper.cpp @@ -222,6 +222,7 @@ UrlWrapper::ArgvReceived(int32 argc, char** argv) const char* failc = " || read -p 'Press any key'"; const char* pausec = " ; read -p 'Press any key'"; char* args[] = { (char *)"/bin/sh", (char *)"-c", NULL, NULL}; + status_t err; BPrivate::Support::BUrl url(argv[1]); @@ -503,6 +504,25 @@ UrlWrapper::ArgvReceived(int32 argc, char** argv) return; } + if (proto == "doi") { + BString url("http://dx.doi.org/";); + BString mimetype; + + url << full; + BPrivate::Support::BUrl u(url.String()); + args[0] = const_cast<char*>("urlwrapper"); //XXX + args[1] = (char*)u.String(); + args[2] = NULL; + mimetype = kURLHandlerSigBase; + mimetype += u.Proto(); + + err = be_roster->Launch(mimetype.String(), 1, args + 1); + if (err != B_OK && err != B_ALREADY_RUNNING) + err = be_roster->Launch(kAppSig, 1, args + 1); + // TODO: handle errors + return; + } + /* More ? diff --git a/src/bin/urlwrapper.rdef b/src/bin/urlwrapper.rdef index ca6dc20..26fd69f 100644 --- a/src/bin/urlwrapper.rdef +++ b/src/bin/urlwrapper.rdef @@ -25,6 +25,7 @@ resource(1, "BEOS:FILE_TYPES") message "types" = "application/x-vnd.Be.URL.ssh", "types" = "application/x-vnd.Be.URL.ftp", "types" = "application/x-vnd.Be.URL.sftp", - "types" = "application/x-vnd.Be.URL.finger" + "types" = "application/x-vnd.Be.URL.finger", + "types" = "application/x-vnd.Be.URL.doi" };