emacs/test/lisp/erc/resources/base/display-message/statusmsg.eld
F. Jason Park 49bfea4386 Use templates for formatting chat messages in ERC
* doc/misc/erc.texi: Replace option `erc-format-nick-function' with
`erc-show-speaker-membership-status'.
* etc/ERC-NEWS: Mention shift to template-based speaker formatting.
Also mention in-buffer STATUSMSG support and various name changes and
new formatting-related options.
* lisp/erc/erc-backend.el (erc-format-privmessage): Remove forward
declaration.
(erc--determine-speaker-message-format-args): Add forward declaration.
(erc--statusmsg-target): New utility function for detecting whether
the current target is status-prefixed.
(erc-current-message-catalog): Move here from lisp/erc/erc.el.
(erc--message-speaker-catalog): New variable.
(erc--speaker-status-prefix-wanted-p): New variable specifically for
the function `erc-format-@nick' to signal it wants status-prefixes
prepended to the displayed nick.
(erc-server-PRIVMSG): Initialize `let'-bound value of
`erc--msg-prop-overrides' to a dummy `erc--tmp' property with a null
value that `erc-display-message' will "strip" before calling its
hooks.  Move away from the rather blunt symbol `msg' as a useful value
for `erc--msg'.  Instead, allow `erc-display-message' to assign the
most appropriate value based on context.  Also, bind the variable
`erc-current-message-catalog' to whatever the buffer's
`erc--message-speaker-catalog' happens to be.  Future internal modules
can set this to alternative catalogs as needed.  Additionally, detect
STATUSMSG prefixes on targets and inform the formatting logic of the
verdict.  Lastly, and most importantly, use the function
`erc--determine-speaker-message-format-args' instead of
`erc-format-privmessage' for message formatting.  Pass along the
returned "catalog key" and spec parameters to `erc-display-message'.
However, for NOTICEs, continue to render the string, as before, for
the two "echo notice" hooks.
* lisp/erc/erc-common.el (erc--ctcp-response): New "subsclass" of
`erc-response' for smuggling extra information to CTCP query handlers
in a mostly backwards-compatible way.  The same approach could be
taken with the "echo notice" hooks mentioned above.
* lisp/erc/erc-dcc.el (erc-dcc-chat-filter): Add `erc--spkr' and
`erc--speaker' properties even though these chat buffers are not
`erc-mode' buffers.
* lisp/erc/erc-fill.el (erc-fill--wrap-last-msg,
erc-fill--wrap-max-lull): Add doc strings.
(erc-fill--wrap-continued-message-p): Rework to look for `erc--spkr'-
`erc--msg' combinations as indicators of speaker continuity.
(erc-fill--wrap-rejigger-region): Remove reference to the no longer
relevant `erc-stamp-type'.  Instead, use the `erc--msg' property
combined with the `erc-timestamp' field to detect date stamps because
all are currently left-sided.
* lisp/erc/erc-stamp.el (erc-stamp--propertize-left-date-stamp): Don't
add superfluous `erc-stamp-type' property.
* lisp/erc/erc.el (erc--msg-props): Revise purpose and meaning of
`erc--msg' by removing possible value `msg', which was previously
meant to indicate that a message had a "speaker".  Instead, rely on
the separate `erc--spkr' property to convey this information, with
`erc--msg' now expressing a "type" or "role".
(erc--use-language-catalog-for-ctcp-action-p): New variable, a
compatibility switch to help transition from the `ACTION' entry of the
language catalog to the `ctcp-action' family of entries in the new
`-speaker' catalog.
(erc--ensure-spkr-prop): Update to include any passed-in environmental
overrides.
(erc--send-action-display): Restore pre-5.6 behavior when
compatibility flag enabled.  Otherwise, use new `-speaker' catalog for
formatting inserted message.
(erc--send-message-external): Overhaul to behave more faithfully in
mimicking a line submitted at the prompt of the current target buffer.
(erc--own-property-names): Remove `erc-stamp-type'.
(erc-ensure-target-buffer-on-privmsg): Add new choice variant for old
default behavior and change meaning of default to mean "except for
STATUSMSGs".  This option is newly revived for ERC 5.6.
(erc--message-speaker-statusmsg, erc--message-speaker-statusmsg-input,
erc--message-speaker-input, erc--message-speaker-input-chan-privmsg,
erc--message-speaker-input-chan-notice,
erc--message-speaker-input-query-privmsg,
erc--message-speaker-input-query-notice,
erc--message-speaker-chan-privmsg, erc--message-speaker-query-privmsg,
erc--message-speaker-chan-notice, erc--message-speaker-query-notice,
erc--message-speaker-ctcp-action,
erc--message-speaker-ctcp-action-input,
erc--message-speaker-ctcp-action-statusmsg,
erc--message-speaker-ctcp-action-statusmsg-input): New variables for
new `speaker' format-template catalog.
(erc--speakerize-nick): New helper function.
(erc--determine-speaker-message-format-args): New function to find the
appropriate format key from various contextual parameters.  Could
become the default of a function-valued variable for internal use.
(erc-show-speaker-membership-status): New option.
(erc-format-nick-function, erc-speaker-from-channel-member-function):
Declare former as an obsolete alias for the latter, and redefine
purpose slightly.
(erc-format-nick-function, erc-determine-speaker-from-user): Rename
former to latter and obsolete the old name.
(erc-format-nick, erc-determine-speaker-from-user): Rename former to
latter and obsolete old name.
(erc-format-@nick): Deprecate and adapt for use with new
template-based formatting paradigm.
(erc-format-my-nick): Move `erc-speaker' text prop toward head of
list, meaning it will end up beneath `font-lock-face' in the final
output.
(erc--format-speaker-input-message): New function to replace
`erc-format-my-nick' in-tree.
(erc-process-ctcp-query): Don't bind `erc--msg' to `msg'.  Instead,
rely on `erc-display-message' to set it to the current template key.
(erc-ctcp-query-ACTION): Prefer using formatting template, but attempt
to simulate pre-5.6 behavior when compatibility flag enabled.
(erc-display-msg): Use `erc--format-speaker-input-message' instead of
`erc-format-my-nick'.  Ignore `erc--msg-prop-overrides' with null
values.
(erc-current-message-catalog): Move to erc-backend.el.
* test/lisp/erc/erc-scenarios-base-statusmsg.el: New file.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--left/display-margin-mode): Expect format catalog
key instead of unhelpful `msg' as value of `erc--msg' prop.
* test/lisp/erc/erc-tests.el (erc-message): Render format template in
mock function and expect string in assertions.
(erc-tests--format-privmessage): New function, a helper for the
following test.
(erc-format-privmessage, erc--determine-speaker-message-format-args):
Rename former to latter and suppress deprecation warning.
(erc--determine-speaker-message-format-args/queries,
erc--determine-speaker-message-format-args/queries-as-channel): New
tests.
(erc-tests--format-my-nick): New helper function for the following
test.
(erc--format-speaker-input-message): New test.
* test/lisp/erc/resources/base/display-message/statusmsg.eld: New
file.  (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Update.
2023-12-17 20:17:55 -08:00

47 lines
3 KiB
Text

;; -*- mode: lisp-data; -*-
((nick 10 "NICK tester"))
((user 10 "USER tester 0 * :tester")
(0.00 ":irc.foonet.org 001 tester :Welcome to the foonet IRC Network tester")
(0.02 ":irc.foonet.org 002 tester :Your host is irc.foonet.org, running version ergo-v2.11.1")
(0.01 ":irc.foonet.org 003 tester :This server was created Thu, 07 Dec 2023 08:04:35 UTC")
(0.00 ":irc.foonet.org 004 tester irc.foonet.org ergo-v2.11.1 BERTZios CEIMRUabefhiklmnoqstuv Iabefhkloqv")
(0.00 ":irc.foonet.org 005 tester AWAYLEN=390 BOT=B CASEMAPPING=ascii CHANLIMIT=#:100 CHANMODES=Ibe,k,fl,CEMRUimnstu CHANNELLEN=64 CHANTYPES=# CHATHISTORY=1000 ELIST=U EXCEPTS EXTBAN=,m FORWARD=f INVEX :are supported by this server")
(0.01 ":irc.foonet.org 005 tester KICKLEN=390 MAXLIST=beI:60 MAXTARGETS=4 MODES MONITOR=100 NETWORK=foonet NICKLEN=32 PREFIX=(qaohv)~&@%+ STATUSMSG=~&@%+ TARGMAX=NAMES:1,LIST:1,KICK:,WHOIS:1,USERHOST:10,PRIVMSG:4,TAGMSG:4,NOTICE:4,MONITOR:100 TOPICLEN=390 UTF8ONLY WHOX :are supported by this server")
(0.01 ":irc.foonet.org 005 tester draft/CHATHISTORY=1000 :are supported by this server")
(0.00 ":irc.foonet.org 251 tester :There are 0 users and 4 invisible on 1 server(s)")
(0.00 ":irc.foonet.org 252 tester 0 :IRC Operators online")
(0.00 ":irc.foonet.org 253 tester 0 :unregistered connections")
(0.00 ":irc.foonet.org 254 tester 2 :channels formed")
(0.00 ":irc.foonet.org 255 tester :I have 4 clients and 0 servers")
(0.02 ":irc.foonet.org 265 tester 4 5 :Current local users 4, max 5")
(0.00 ":irc.foonet.org 266 tester 4 5 :Current global users 4, max 5")
(0.00 ":irc.foonet.org 422 tester :MOTD File is missing")
(0.00 ":irc.foonet.org 221 tester +i")
(0.00 ":irc.foonet.org NOTICE tester :This server is in debug mode and is logging all user I/O. If you do not wish for everything you send to be readable by the server owner(s), please disconnect."))
((mode-tester 10 "MODE tester +i"))
((join-mine 10 "JOIN #mine")
(0.01 ":irc.foonet.org 221 tester +i")
(0.00 ":tester!~u@2jv6nwu4af69s.irc JOIN #mine")
(0.02 ":irc.foonet.org 353 tester = #mine :@tester +dummy")
(0.01 ":irc.foonet.org 366 tester #mine :End of NAMES list"))
((mode-mine 10 "MODE #mine")
(0.00 ":irc.foonet.org 324 tester #mine +Cnt")
(0.02 ":irc.foonet.org 329 tester #mine 1702026418")
(0.04 ":dummy!~u@2jv6nwu4af69s.irc PRIVMSG +#mine :hello")
(0.03 ":dummy!~u@2jv6nwu4af69s.irc PRIVMSG +#mine :there")
(0.05 ":dummy!~u@2jv6nwu4af69s.irc PRIVMSG +#mine :\1ACTION sad\1")
(0.03 ":dummy!~u@2jv6nwu4af69s.irc PRIVMSG +#mine :\1ACTION glad\1"))
((privmsg-statusmsg 10 "PRIVMSG +#mine :howdy"))
((privmsg-statusmsg-action 10 "PRIVMSG +#mine :tenderfoot")
;; These are simulated "echoed messages"
(0.05 ":tester!~u@2jv6nwu4af69s.irc PRIVMSG +#mine :\1ACTION mad\1")
(0.05 ":tester!~u@2jv6nwu4af69s.irc PRIVMSG +#mine :\1ACTION chad\1"))
((privmsg-prefixed 10 "PRIVMSG #mine :\1ACTION ready\1")
(0.04 ":dummy!~u@2jv6nwu4af69s.irc PRIVMSG +#mine :okie")
(0.05 ":dummy!~u@2jv6nwu4af69s.irc PRIVMSG +#mine :\1ACTION dokie\1")
(0.04 ":dummy!~u@2jv6nwu4af69s.irc PRIVMSG #mine :\1ACTION out\1"))