1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Revert 8bedf25b, "goto_url_hook takes 2 params not 1."

Revert 8bedf25bf8.  Different versions
of ELinks call the Python goto_url_hook with different arguments:

- goto_url_hook(current) in 0.11.0, 0.11.1, and 0.11.2.

- goto_url_hook(new, current) in 0.11.2.GIT since 2007-11-27, commit
  8bedf25bf8 which I'm now reverting.
  No released version of ELinks has used this variant.

- goto_url_hook(new) in 0.12.GIT since 2007-01-01, commit
  26473f72f5.  The hook can call
  elinks.current_url() if desired.

I think it will be less confusing to users if we drop the middle
variant and make the rest of the stable 0.11 branch call the hook in
the same way as 0.11.2 did.  The difference will then be only between
the 0.11 and 0.12 branches.
This commit is contained in:
Kalle Olavi Niemitalo 2007-04-06 14:30:00 +03:00 committed by Kalle Olavi Niemitalo
parent 854cc4b5fd
commit 1dfdb6e19b
2 changed files with 4 additions and 32 deletions

View File

@ -1,31 +1,5 @@
dumbprefixes = {
"7th" : "http://7thguard.net/",
"b" : "http://babelfish.altavista.com/babelfish/tr",
"bz" : "http://bugzilla.elinks.cz",
"bug" : "http://bugzilla.elinks.cz",
"d" : "http://www.dict.org",
"g" : "http://www.google.com/",
"gg" : "http://www.google.com/",
"go" : "http://www.google.com/",
"fm" : "http://www.freshmeat.net/",
"sf" : "http://www.sourceforge.net/",
"dbug" : "http://bugs.debian.org/",
"dpkg" : "http://packages.debian.org/",
"pycur" : "http://www.python.org/doc/current/",
"pydev" : "http://www.python.org/dev/doc/devel/",
"pyhelp" : "http://starship.python.net/crew/theller/pyhelp.cgi",
"pyvault" : "http://www.vex.net/parnassus/",
"e2" : "http://www.everything2.org/",
"sd" : "http://www.slashdot.org/"
}
def goto_url_hook(url, current_url):
global dumbprefixes
if dumbprefixes.has_key(url):
return dumbprefixes[url];
else:
return None
def goto_url_hook(url):
return None
def follow_url_hook(url):
return None

View File

@ -21,8 +21,7 @@
/* The events that will trigger the functions below and what they are expected
* to do is explained in doc/events.txt */
extern PyObject *pDict;
extern PyObject *pModule;
extern PyObject *pDict, *pModule;
static void
do_script_hook_goto_url(struct session *ses, unsigned char **url)
@ -38,8 +37,7 @@ do_script_hook_goto_url(struct session *ses, unsigned char **url)
} else {
str = struri(cur_loc(ses)->vs.uri);
}
pValue = PyObject_CallFunction(pFunc, "ss", *url, str);
pValue = PyObject_CallFunction(pFunc, "s", str);
if (pValue && (pValue != Py_None)) {
const unsigned char *res = PyString_AsString(pValue);