summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/net/zeroconf.el17
2 files changed, 21 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e791d21f507..50de27e6b2d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
+2010-07-03 Jan Moringen <jan.moringen@uni-bielefeld.de>
+
+ * net/zeroconf.el (zeroconf-service-remove-hook): New defun.
+
2010-06-30 Dan Nicolaescu <dann@ics.uci.edu>
Avoid displaying files with a nil state in vc-dir.
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