This chapter is for all functions and variables that did not fit nicely in any of the others. They are available in all modes.
Integer _slrn_version
The _slrn_version
variable is read only. It is an integer value
representing the slrn's version number -- version aa.bb.cc.dd becomes
aabbccdd.
In version 0.9.7.1, _slrn_version
is 90701 (note that leading
zeroes are omitted).
_slrn_version_string
String _slrn_version_string
The _slrn_version_string
variable is read only. It contains the
version string as displayed by the program itself (e.g. "0.9.7.1").
_slrn_version
Integer datestring_to_unixtime (String date)
This function converts the date string date
(in any format commonly
used in "Date:" header lines) to an integer value, giving the number of
seconds since 00:00:00 GMT, January 1, 1970.
The following function returns the date of the currently selected header as seconds since the Epoch:
define get_article_time () { return datestring_to_unixtime(extract_article_header("Date")); }
String get_bg_color (String obj)
This function returns the current background color of the object
specified by obj
.
Due to a limitation in S-Lang, this function only works on Unix.
String get_fg_color (String obj)
This function returns the current foreground color of the object
specified by obj
.
Due to a limitation in S-Lang, this function only works on Unix.
Value get_variable_value (String v)
This function returns the value of an internal variable specified
by v
. Here v
must be one of the variable names that can be
used in .slrnrc
`set' commands. The type of the object returned will
depend upon the type of the object v
represents.
set_integer_variable, set_string_variable
Void quit (Integer exit_status)
This function will cause the newsreader to exit with exit status
specified by exit_status
.
call
Integer register_hook (String hook, String function)
register_hook can be used to call a given function
whenever one of
slrn's hook
s is executed. It returns one of the following values:
0: Hook does not exist or may not be defined multiple times.
1: Function successfully registered.
2: Given function was already registered for this hook.
3: Undefined function successfully registered.
If you register multiple functions for the same hook, they will be called
in the order in which they were registered. If a function with the name
of a hook is defined, it gets called after those that were registered
using this function.
It is possible to register a function first and define it afterwards. In this case, register_hook returns 3.
cc_hook, make_from_string_hook and subject_compare_hook may only be defined once, as they return a value and slrn only expects a single return value when calling them.
unregister_hook
Void reload_scorefile (Integer apply_now)
This function can be used to reload the scorefile after a macro changed
it. If the integer apply_now
is 1, the new scores are immediately
applied. If it is 0, the new scores are used the next time you enter a
group; if -1, the user is queried.
Outside article mode, apply_now
has no effect.
String server_name ()
The server_name
function returns the name of the current server.
current_newsgroup
Void set_color (String obj, String fg, String bg)
This function may be used to set the foreground and background
colors of an object. The obj
parameter specifies the object and
the fg
and bg
parameters specify the foreground and background
colors, respectively.
Void set_color_attr (String obj, String fg, String bg, Integer attr)
This functions works like set_color, but has the additional argument
attr
that allows you to assign attributes to the color object (if
your terminal supports this). attr
can be 0 (if you do not want any
attributes to take effect) or any combination of the following constants:
ATTR_BLINK blinking text
ATTR_BOLD bold text
ATTR_REV inverse text
ATTR_ULINE underlined text
Void set_ignore_quotes (Array_Type regexps)
This function allows you to change the setting of the ignore_quotes
configuration command. regexps
has to be a (one-dimensional) array
of 1-5 strings that are interpreted as regular expressions to detect
quoted lines.
set_ignore_quotes (["^>", "^|"]);
This function is only available if slrn was compiled with S-Lang 1.4.x. The effect of this command becomes visible with the next article you download. If one is currently displayed, it remains unaffected.
Void set_integer_variable (String name, Integer v)
This function may be used to set the value of the internal integer
variable specified by name
to value v
. name
must be an integer
variable name allowed in .slrnrc set
commands.
set_string_variable, get_variable_value
Void set_string_variable (String name, String v)
This function may be used to set the value of the internal string
variable specified by name
to value v
. name
must be a string
variable name allowed in .slrnrc set
commands.
set_integer_variable, get_variable_value
Void set_strip_re_regexp (Array_Type regexps)
This function allows you to change the setting of the strip_re_regexp configuration command. It works like set_ignore_quotes.
This function is only available if slrn was compiled with S-Lang 1.4.x.
set_ignore_quotes, set_strip_sig_regexp, set_strip_was_regexp
Void set_strip_sig_regexp (Array_Type regexps)
This function allows you to change the setting of the strip_sig_regexp configuration command. It works like set_ignore_quotes.
This function is only available if slrn was compiled with S-Lang 1.4.x. The effect of this command becomes visible with the next article you download. If one is currently displayed, it remains unaffected.
set_ignore_quotes, set_strip_re_regexp, set_strip_was_regexp
Void set_strip_was_regexp (Array_Type regexps)
This function allows you to change the setting of the strip_was_regexp configuration command. It works like set_ignore_quotes.
This function is only available if slrn was compiled with S-Lang 1.4.x.
set_ignore_quotes, set_strip_re_regexp, set_strip_sig_regexp
Void set_utf8_conversion_table (Array_Type table)
This function can be used to define a conversion table for decoding
UTF-8. table
has to be a two-dimensional array of integer values
that has two columns: The left column contains the Unicode characters you
want to convert, the right column the corresponding local characters.
When decoding, any non-ASCII characters that cannot be found in your
table are displayed as question marks. If table
has no rows, UTF-8
will be converted to Latin 1, which is also the default if this function
is not called. Thus, you can reset the default using
set_utf8_conversion_table (Integer_Type[2,0]);
This function is only available if slrn was compiled with S-Lang 1.4.x.
String setlocale (Integer category, String locale)
You can use this function to change the current locale at runtime. You
may want to do this if you read groups in different languages. The
syntax is identical to the one of setlocale(3). For category
, the
following constants are defined:
LC_CTYPE : affects character handling (e.g. which 8bit characters
are regarded as upper/lower case)
LC_TIME : affects the formatting of dates (12-hour vs. 24-hour
clock, language of month names etc.)
The locale
can be any locale supported by your system. If it is an
empty string, the locale to use will be taken from the environment. The
function will return the name of the locale that was actually selected.
Please note that locales are not supported by all systems. In this case, this function will trigger an slang error.
Void tt_send (String_Type s)
This function may be used to send a string directly to the display without any involvement of the screen management layer.
message, update
Integer unregister_hook (String hook, String function)
This function is used to unregister functions that were assigned to a hook using register_hook. Its return values are:
0: Hook does not exist or function is not assigned to it.
1: Function successfully unregistered.
register_hook
update ()
This function may be used to force the display to be updated.
message