(erc-log-irc-protocol line nil)
(erc-parse-server-response process line)))))))
-(defsubst erc-server-reconnect-p (event)
+(define-inline erc-server-reconnect-p (event)
"Return non-nil if ERC should attempt to reconnect automatically.
EVENT is the message received from the closed connection process."
- (or erc-server-reconnecting
- (and erc-server-auto-reconnect
- (not erc-server-banned)
- ;; make sure we don't infinitely try to reconnect, unless the
- ;; user wants that
- (or (eq erc-server-reconnect-attempts t)
- (and (integerp erc-server-reconnect-attempts)
- (< erc-server-reconnect-count
- erc-server-reconnect-attempts)))
- (or erc-server-timed-out
- (not (string-match "^deleted" event)))
- ;; open-network-stream-nowait error for connection refused
- (if (string-match "^failed with code 111" event) 'nonblocking t))))
+ (inline-letevals (event)
+ (inline-quote
+ (or erc-server-reconnecting
+ (and erc-server-auto-reconnect
+ (not erc-server-banned)
+ ;; make sure we don't infinitely try to reconnect, unless the
+ ;; user wants that
+ (or (eq erc-server-reconnect-attempts t)
+ (and (integerp erc-server-reconnect-attempts)
+ (< erc-server-reconnect-count
+ erc-server-reconnect-attempts)))
+ (or erc-server-timed-out
+ (not (string-match "^deleted" ,event)))
+ ;; open-network-stream-nowait error for connection refused
+ (if (string-match "^failed with code 111" ,event) 'nonblocking t))))))
(defun erc-process-sentinel-2 (event buffer)
"Called when `erc-process-sentinel-1' has detected an unexpected disconnect."
(const :tag "Do not try to detect success" nil)))))
-(defsubst erc-nickserv-alist-sender (network &optional entry)
- (nth 1 (or entry (assoc network erc-nickserv-alist))))
+(define-inline erc-nickserv-alist-sender (network &optional entry)
+ (inline-quote (nth 1 (or ,entry (assoc ,network erc-nickserv-alist)))))
-(defsubst erc-nickserv-alist-regexp (network &optional entry)
- (nth 2 (or entry (assoc network erc-nickserv-alist))))
+(define-inline erc-nickserv-alist-regexp (network &optional entry)
+ (inline-quote (nth 2 (or ,entry (assoc ,network erc-nickserv-alist)))))
-(defsubst erc-nickserv-alist-nickserv (network &optional entry)
- (nth 3 (or entry (assoc network erc-nickserv-alist))))
+(define-inline erc-nickserv-alist-nickserv (network &optional entry)
+ (inline-quote (nth 3 (or ,entry (assoc ,network erc-nickserv-alist)))))
-(defsubst erc-nickserv-alist-ident-keyword (network &optional entry)
- (nth 4 (or entry (assoc network erc-nickserv-alist))))
+(define-inline erc-nickserv-alist-ident-keyword (network &optional entry)
+ (inline-quote (nth 4 (or ,entry (assoc ,network erc-nickserv-alist)))))
-(defsubst erc-nickserv-alist-use-nick-p (network &optional entry)
- (nth 5 (or entry (assoc network erc-nickserv-alist))))
+(define-inline erc-nickserv-alist-use-nick-p (network &optional entry)
+ (inline-quote (nth 5 (or ,entry (assoc ,network erc-nickserv-alist)))))
-(defsubst erc-nickserv-alist-ident-command (network &optional entry)
- (nth 6 (or entry (assoc network erc-nickserv-alist))))
+(define-inline erc-nickserv-alist-ident-command (network &optional entry)
+ (inline-quote (nth 6 (or ,entry (assoc ,network erc-nickserv-alist)))))
-(defsubst erc-nickserv-alist-identified-regexp (network &optional entry)
- (nth 7 (or entry (assoc network erc-nickserv-alist))))
+(define-inline erc-nickserv-alist-identified-regexp (network &optional entry)
+ (inline-quote (nth 7 (or ,entry (assoc ,network erc-nickserv-alist)))))
;; Functions:
;; This is useful for ordered name completion.
(last-message-time nil))
-(defsubst erc-get-channel-user (nick)
+(define-inline erc-get-channel-user (nick)
"Find the (USER . CHANNEL-DATA) element corresponding to NICK
in the current buffer's `erc-channel-users' hash table."
- (gethash (erc-downcase nick) erc-channel-users))
+ (inline-quote (gethash (erc-downcase ,nick) erc-channel-users)))
-(defsubst erc-get-server-user (nick)
+(define-inline erc-get-server-user (nick)
"Find the USER corresponding to NICK in the current server's
`erc-server-users' hash table."
- (erc-with-server-buffer
- (gethash (erc-downcase nick) erc-server-users)))
+ (inline-quote (erc-with-server-buffer
+ (gethash (erc-downcase ,nick) erc-server-users))))
-(defsubst erc-add-server-user (nick user)
+(define-inline erc-add-server-user (nick user)
"This function is for internal use only.
Adds USER with nickname NICK to the `erc-server-users' hash table."
- (erc-with-server-buffer
- (puthash (erc-downcase nick) user erc-server-users)))
+ (inline-quote
+ (erc-with-server-buffer
+ (puthash (erc-downcase ,nick) ,user erc-server-users))))
-(defsubst erc-remove-server-user (nick)
+(define-inline erc-remove-server-user (nick)
"This function is for internal use only.
Removes the user with nickname NICK from the `erc-server-users'
`erc-channel-users' lists of other buffers.
See also: `erc-remove-user'."
- (erc-with-server-buffer
- (remhash (erc-downcase nick) erc-server-users)))
+ (inline-quote
+ (erc-with-server-buffer
+ (remhash (erc-downcase ,nick) erc-server-users))))
(defun erc-change-user-nickname (user new-nick)
"This function is for internal use only.
erc-channel-users)
(clrhash erc-channel-users)))
-(defsubst erc-channel-user-owner-p (nick)
+(define-inline erc-channel-user-owner-p (nick)
"Return non-nil if NICK is an owner of the current channel."
- (and nick
- (hash-table-p erc-channel-users)
- (let ((cdata (erc-get-channel-user nick)))
- (and cdata (cdr cdata)
- (erc-channel-user-owner (cdr cdata))))))
-
-(defsubst erc-channel-user-admin-p (nick)
+ (inline-letevals (nick)
+ (inline-quote
+ (and ,nick
+ (hash-table-p erc-channel-users)
+ (let ((cdata (erc-get-channel-user ,nick)))
+ (and cdata (cdr cdata)
+ (erc-channel-user-owner (cdr cdata))))))))
+
+(define-inline erc-channel-user-admin-p (nick)
"Return non-nil if NICK is an admin in the current channel."
- (and nick
+ (inline-letevals (nick)
+ (inline-quote
+ (and ,nick
(hash-table-p erc-channel-users)
- (let ((cdata (erc-get-channel-user nick)))
+ (let ((cdata (erc-get-channel-user ,nick)))
(and cdata (cdr cdata)
- (erc-channel-user-admin (cdr cdata))))))
+ (erc-channel-user-admin (cdr cdata))))))))
-(defsubst erc-channel-user-op-p (nick)
+(define-inline erc-channel-user-op-p (nick)
"Return non-nil if NICK is an operator in the current channel."
- (and nick
+ (inline-letevals (nick)
+ (inline-quote
+ (and ,nick
(hash-table-p erc-channel-users)
- (let ((cdata (erc-get-channel-user nick)))
+ (let ((cdata (erc-get-channel-user ,nick)))
(and cdata (cdr cdata)
- (erc-channel-user-op (cdr cdata))))))
+ (erc-channel-user-op (cdr cdata))))))))
-(defsubst erc-channel-user-halfop-p (nick)
+(define-inline erc-channel-user-halfop-p (nick)
"Return non-nil if NICK is a half-operator in the current channel."
- (and nick
+ (inline-letevals (nick)
+ (inline-quote
+ (and ,nick
(hash-table-p erc-channel-users)
- (let ((cdata (erc-get-channel-user nick)))
+ (let ((cdata (erc-get-channel-user ,nick)))
(and cdata (cdr cdata)
- (erc-channel-user-halfop (cdr cdata))))))
+ (erc-channel-user-halfop (cdr cdata))))))))
-(defsubst erc-channel-user-voice-p (nick)
+(define-inline erc-channel-user-voice-p (nick)
"Return non-nil if NICK has voice in the current channel."
- (and nick
+ (inline-letevals (nick)
+ (inline-quote
+ (and ,nick
(hash-table-p erc-channel-users)
- (let ((cdata (erc-get-channel-user nick)))
+ (let ((cdata (erc-get-channel-user ,nick)))
(and cdata (cdr cdata)
- (erc-channel-user-voice (cdr cdata))))))
+ (erc-channel-user-voice (cdr cdata))))))))
(defun erc-get-channel-user-list ()
"Return a list of users in the current channel. Each element
(add-hook hook fun nil t)
fun))
-(defsubst erc-log (string)
+(define-inline erc-log (string)
"Logs STRING if logging is on (see `erc-log-p')."
- (when erc-log-p
- (erc-log-aux string)))
+ (inline-quote
+ (when erc-log-p
+ (erc-log-aux ,string))))
(defun erc-server-buffer ()
"Return the server buffer for the current buffer's process.