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

goto_url_hook takes 2 params not 1. Some dumbprefixes defined in hooks.py

This commit is contained in:
witekfl 2006-01-29 14:58:03 +01:00 committed by Jonas Fonseca
parent e1ae6a0cdf
commit 8bedf25bf8
2 changed files with 32 additions and 4 deletions

View File

@ -1,5 +1,31 @@
def goto_url_hook(url):
return None
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 follow_url_hook(url):
return None

View File

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