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:
parent
e1ae6a0cdf
commit
8bedf25bf8
@ -1,5 +1,31 @@
|
|||||||
def goto_url_hook(url):
|
dumbprefixes = {
|
||||||
return None
|
"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):
|
def follow_url_hook(url):
|
||||||
return None
|
return None
|
||||||
|
@ -21,7 +21,8 @@
|
|||||||
/* The events that will trigger the functions below and what they are expected
|
/* The events that will trigger the functions below and what they are expected
|
||||||
* to do is explained in doc/events.txt */
|
* to do is explained in doc/events.txt */
|
||||||
|
|
||||||
extern PyObject *pDict, *pModule;
|
extern PyObject *pDict;
|
||||||
|
extern PyObject *pModule;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
do_script_hook_goto_url(struct session *ses, unsigned char **url)
|
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 {
|
} else {
|
||||||
str = struri(cur_loc(ses)->vs.uri);
|
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)) {
|
if (pValue && (pValue != Py_None)) {
|
||||||
const unsigned char *res = PyString_AsString(pValue);
|
const unsigned char *res = PyString_AsString(pValue);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user