Function: erc-message

erc-message is a byte-compiled function defined in erc-backend.el.gz.

Signature

(erc-message MESSAGE-COMMAND LINE &optional FORCE)

Documentation

Send LINE, possibly expanding a target specifier beforehand.

Expect MESSAGE-COMMAND to be an IRC command with a single positional target parameter followed by a trailing parameter.

If the target is ",", the last person you've got a message from will be used. If the target is ".", the last person you've sent a message to will be used.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-backend.el.gz
(defun erc-message (message-command line &optional force)
  "Send LINE, possibly expanding a target specifier beforehand.
Expect MESSAGE-COMMAND to be an IRC command with a single
positional target parameter followed by a trailing parameter.

If the target is \",\", the last person you've got a message from will
be used.  If the target is \".\", the last person you've sent a message
to will be used."
  (cond
   ((string-match "^\\s-*\\(\\S-+\\) ?\\(.*\\)" line)
    (let* ((tgt (match-string 1 line))
           (s (match-string 2 line))
           (server-buffer (erc-server-buffer))
           (peers (buffer-local-value 'erc-server-last-peers server-buffer)))
      (erc-log (format "cmd: MSG(%s): [%s] %s" message-command tgt s))
      (cond
       ((string= tgt ",")
        (setq tgt (car peers)))
       ((string= tgt ".")
        (setq tgt (cdr peers))))
      (cond
       (tgt
        (with-current-buffer server-buffer
          (setq erc-server-last-peers (cons (car peers) tgt)))
        (erc-server-send (format "%s %s :%s" message-command tgt s)
                         force))
       (t
        (erc-display-message nil 'error (current-buffer) 'no-target))))
    t)
   (t nil)))