diff doc/dbg_interactive.py.sample @ 1176:f0b328ea2fdb

Added initial support for hooks in the dbg_interactive extension
author Sebastien Decugis <sdecugis@freediameter.net>
date Mon, 03 Jun 2013 14:18:43 +0800
parents 11724ff78638
children e5010975da35
line wrap: on
line diff
--- a/doc/dbg_interactive.py.sample	Mon Jun 03 12:13:17 2013 +0800
+++ b/doc/dbg_interactive.py.sample	Mon Jun 03 14:18:43 2013 +0800
@@ -664,7 +664,18 @@
 
 ############# HOOKS ############
 
-# TODO
+def my_hook_cb(type, msg, peer, other, oldpmd):
+    print "callback type ", type, " called: ", msg, other, oldpmd
+    return "this is the new pmd"
+
+# Create a wrapped fd_hook_data_hdl:
+datahdl = fd_hook_data_hdl()
+
+# Register the hook callback:
+hdl = fd_hook_hdl(1 << HOOK_MESSAGE_SENT, my_hook_cb, datahdl)
+
+
+
 
 ############# PEERS ############
 
"Welcome to our mercurial repository"