summaryrefslogtreecommitdiff
path: root/lisp/net/zeroconf.el
diff options
context:
space:
mode:
authorMichael Albinus <albinus@detlef>2010-07-03 12:52:17 +0200
committerMichael Albinus <albinus@detlef>2010-07-03 12:52:17 +0200
commit112dbc0eee5f7960fd754fb75e44d998cf9b4a5b (patch)
treeb5597113a55e896371091b5104a933587b277a26 /lisp/net/zeroconf.el
parentad3e6f4474d2737be89456332319e8efbdb382c4 (diff)
downloademacs-112dbc0eee5f7960fd754fb75e44d998cf9b4a5b.tar.gz
* net/zeroconf.el (zeroconf-service-remove-hook): New defun.
Diffstat (limited to 'lisp/net/zeroconf.el')
-rw-r--r--lisp/net/zeroconf.el17
1 files changed, 17 insertions, 0 deletions
diff --git a/lisp/net/zeroconf.el b/lisp/net/zeroconf.el
index b0b98fc57f3..43719aa9763 100644
--- a/lisp/net/zeroconf.el
+++ b/lisp/net/zeroconf.el
@@ -336,6 +336,23 @@ The attributes of SERVICE can be retrieved via the functions
(puthash type l-hook zeroconf-service-removed-hooks-hash)))
(t (error "EVENT must be either `:new' or `:removed'"))))
+(defun zeroconf-service-remove-hook (type event function)
+ "Remove FUNCTION from the hook of service type TYPE.
+
+EVENT must be either :new or :removed and has to match the event
+type used when registering FUNCTION."
+ (let* ((table (cond
+ ((equal event :new)
+ zeroconf-service-added-hooks-hash)
+ ((equal event :removed)
+ zeroconf-service-removed-hooks-hash)
+ (t (error "EVENT must be either `:new' or `:removed'"))))
+ (l-hook (gethash type table nil)))
+ (remove-hook 'l-hook function)
+ (if l-hook
+ (puthash type l-hook table)
+ (remhash type table))))
+
(defun zeroconf-get-host ()
"Returns the local host name as string."
(dbus-call-method