Function: erc-cmd-SOUND

erc-cmd-SOUND is a byte-compiled function defined in erc-sound.el.gz.

Signature

(erc-cmd-SOUND LINE &optional FORCE)

Documentation

Send a CTCP SOUND message to the default target.

If erc-play-sound(var)/erc-play-sound(fun) is non-nil, play the sound as well.

/sound filename optional-message-text

LINE is the text entered, including the command.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-sound.el.gz
(defun erc-cmd-SOUND (line &optional force)
  "Send a CTCP SOUND message to the default target.
If `erc-play-sound' is non-nil, play the sound as well.

/sound filename optional-message-text

LINE is the text entered, including the command."
  (cond
   ((string-match "^\\s-*\\(\\S-+\\)\\(\\s-.*\\)?$" line)
    (let ((file (match-string 1 line))
	  (msg (match-string 2 line))
	  (tgt (erc-default-target)))
      (if (null msg)
	  (setq msg "")
	;; remove the first white space
	(setq msg (substring msg 1)))
      (if tgt
	  (progn
	    (erc-send-ctcp-message tgt (format "SOUND %s %s" file msg) force)
	    (if erc-play-sound (erc-play-sound file)))
	(erc-display-message nil 'error (current-buffer) 'no-target))
      t))
   (t nil)))