module BBS::Goodbye
The last screen of a call, the way our boards hang up: thanks for calling, a note, where to find more of us, and NO CARRIER. On a modern terminal it is one write (::modern); on a C64 a reversed bar, then the modem’s +++, ATH0 and NO CARRIER a moment apart (::petscii).
call do |_ctx, runner| BBS::Goodbye.modern(runner, title: 'Feedia', note: "The stories are their publishers'.") nil end
Constants
- PAUSES
-
The seconds
::petsciiwaits before+++, beforeATH0and before NO CARRIER. - URL
-
Where more of us are.
Public Class Methods
# File lib/bbs/goodbye.rb, line 39 def self.modern(out, title:, note: nil, url: URL, clear: true) out.write(modern_text(title: title, note: note, url: url, clear: clear)) nil end
Writes ::modern_text to out, anything with a write method: a BBS::FlowRunner, a BBS::Session, an IO. The arguments are those of ::modern_text.
BBS::Goodbye.modern(runner, title: 'Commodex BBS', note: 'Games from wikidata.org (CC0).')
Returns nil.
# File lib/bbs/goodbye.rb, line 24 def self.modern_text(title:, note: nil, url: URL, clear: true) more = [note, "More of us: #{url}"].compact.join(' ') a = Ansi "#{a::RESET}#{a::CLEAR if clear}#{a::CRLF} #{a::WHITE}Thanks for calling #{title}.#{a::RESET}#{a::CRLF} " \ "#{a::DIM_GREY}#{more}#{a::RESET}#{a::CRLF * 2} #{a::BRIGHT_RED}NO CARRIER#{a::RESET}#{a::CRLF * 2}" end
The text of ::modern: the screen cleared (unless clear is false), “Thanks for calling title.” in white, then dim note (when given) and “More of us: url”, then NO CARRIER in red.
# File lib/bbs/goodbye.rb, line 64 def self.petscii(screen, title: nil, bar: nil, note: nil, url: URL, color: Petscii::Colors::CY, width: nil) screen = Petscii::Screen.new(screen) unless screen.respond_to?(:say) width ||= screen.respond_to?(:cols) ? screen.cols - 1 : Petscii::COLS - 1 screen.cls screen.puts screen.puts bar_line(bar || "thanks for calling #{title}", color, width) screen.puts block_given? ? yield(screen) : screen.say([note, "More of us: #{url}"].compact.join(' '), color: Petscii::Colors::GR) screen.puts hang_up(screen) nil end
The goodbye of a C64 board on screen, a BBS::Petscii::Screen (or a board’s screen with cls, puts and say), or on a session, which gets a BBS::Petscii::Screen. It clears the screen and writes:
-
a reversed bar in
color,widthcolumns: “bar”, by default “ thanks for callingtitle” -
what the block writes on the screen it is given, or else
note(when given) and “More of us:url” as a dim paragraph -
after PAUSES:
+++,ATH0and NO CARRIER in red
- width
-
the bar’s width; default the screen’s
colsless one, or 39
BBS::Goodbye.petscii(screen, title: 'feedia', color: YE, note: "The stories are their publishers'.") BBS::Goodbye.petscii(screen, title: 'the ttg wiki') do |s| s.puts " #{GR}the wiki on the web:#{LG}" end
Returns nil. Raises what the session raises when the caller has hung up (IOError, Errno::EPIPE …).