Function: erc-process-input-line

erc-process-input-line is a byte-compiled function defined in erc.el.gz.

Signature

(erc-process-input-line LINE &optional FORCE NO-COMMAND)

Documentation

Translate LINE to an RFC1459 command and send it based.

Returns non-nil if the command is actually sent to the server, and nil otherwise.

If the command in the LINE is not bound as a function erc-cmd-<COMMAND>, it is passed to erc-cmd-default. If LINE is not a command (i.e. doesn't start with /<COMMAND>) then it is sent as a message.

An optional FORCE argument forces sending the line when flood protection is in effect. The optional NO-COMMAND argument prohibits this function from interpreting the line as a command.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc.el.gz
(defun erc-process-input-line (line &optional force no-command)
  "Translate LINE to an RFC1459 command and send it based.
Returns non-nil if the command is actually sent to the server, and nil
otherwise.

If the command in the LINE is not bound as a function `erc-cmd-<COMMAND>',
it is passed to `erc-cmd-default'.  If LINE is not a command (i.e. doesn't
start with /<COMMAND>) then it is sent as a message.

An optional FORCE argument forces sending the line when flood
protection is in effect.  The optional NO-COMMAND argument prohibits
this function from interpreting the line as a command."
  (let ((command-list (erc-extract-command-from-line line)))
    (if (and command-list
             (not no-command))
        (let* ((cmd  (nth 0 command-list))
               (args (nth 1 command-list)))
          (condition-case nil
              (if (listp args)
                  (apply cmd args)
                (funcall cmd args))
            (wrong-number-of-arguments
             (erc-display-message nil 'error (current-buffer) 'incorrect-args
                                  ?c (erc-command-name cmd)
                                  ?u (or (erc-get-arglist cmd)
                                         "")
                                  ?d (format "%s\n"
                                             (or (documentation cmd) "")))
             nil)))
      (let ((r (erc-default-target)))
        (if r
            (funcall erc-send-input-line-function r line force)
          (erc-display-message nil 'error (current-buffer) 'no-target)
          nil)))))