Next Previous Contents

7. Miscellaneous Functions

This chapter is for all functions and variables that did not fit nicely in any of the others. They are available in all modes.

7.1 _slrn_version

Usage

Integer _slrn_version

Description

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.

Example

In version 0.9.7.1, _slrn_version is 90701 (note that leading zeroes are omitted).

See Also

_slrn_version_string

7.2 _slrn_version_string

Usage

String _slrn_version_string

Description

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").

See Also

_slrn_version

7.3 datestring_to_unixtime

Usage

Integer datestring_to_unixtime (String date)

Description

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.

Example

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")); }

7.4 get_bg_color

Usage

String get_bg_color (String obj)

Description

This function returns the current background color of the object specified by obj.

Notes

Due to a limitation in S-Lang, this function only works on Unix.

7.5 get_fg_color

Usage

String get_fg_color (String obj)

Description

This function returns the current foreground color of the object specified by obj.

Notes

Due to a limitation in S-Lang, this function only works on Unix.

7.6 get_variable_value

Usage

Value get_variable_value (String v)

Description

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.

See Also

set_integer_variable, set_string_variable

7.7 quit

Usage

Void quit (Integer exit_status)

Description

This function will cause the newsreader to exit with exit status specified by exit_status.

See Also

call

7.8 register_hook

Usage

Integer register_hook (String hook, String function)

Description

register_hook can be used to call a given function whenever one of slrn's hooks 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.

See Also

unregister_hook

7.9 reload_scorefile

Usage

Void reload_scorefile (Integer apply_now)

Description

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.

Notes

Outside article mode, apply_now has no effect.

7.10 server_name

Usage

String server_name ()

Description

The server_name function returns the name of the current server.

See Also

current_newsgroup

7.11 set_color

Usage

Void set_color (String obj, String fg, String bg)

Description

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.

7.12 set_color_attr

Usage

Void set_color_attr (String obj, String fg, String bg, Integer attr)

Description

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

7.13 set_ignore_quotes

Usage

Void set_ignore_quotes (Array_Type regexps)

Description

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.

Example

set_ignore_quotes (["^>", "^|"]);

Notes

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.

7.14 set_integer_variable

Usage

Void set_integer_variable (String name, Integer v)

Description

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.

See Also

set_string_variable, get_variable_value

7.15 set_string_variable

Usage

Void set_string_variable (String name, String v)

Description

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.

See Also

set_integer_variable, get_variable_value

7.16 set_strip_re_regexp

Usage

Void set_strip_re_regexp (Array_Type regexps)

Description

This function allows you to change the setting of the strip_re_regexp configuration command. It works like set_ignore_quotes.

Notes

This function is only available if slrn was compiled with S-Lang 1.4.x.

See Also

set_ignore_quotes, set_strip_sig_regexp, set_strip_was_regexp

7.17 set_strip_sig_regexp

Usage

Void set_strip_sig_regexp (Array_Type regexps)

Description

This function allows you to change the setting of the strip_sig_regexp configuration command. It works like set_ignore_quotes.

Notes

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.

See Also

set_ignore_quotes, set_strip_re_regexp, set_strip_was_regexp

7.18 set_strip_was_regexp

Usage

Void set_strip_was_regexp (Array_Type regexps)

Description

This function allows you to change the setting of the strip_was_regexp configuration command. It works like set_ignore_quotes.

Notes

This function is only available if slrn was compiled with S-Lang 1.4.x.

See Also

set_ignore_quotes, set_strip_re_regexp, set_strip_sig_regexp

7.19 set_utf8_conversion_table

Usage

Void set_utf8_conversion_table (Array_Type table)

Description

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]);
Notes

This function is only available if slrn was compiled with S-Lang 1.4.x.

7.20 setlocale

Usage

String setlocale (Integer category, String locale)

Description

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.

7.21 tt_send

Usage

Void tt_send (String_Type s)

Description

This function may be used to send a string directly to the display without any involvement of the screen management layer.

See Also

message, update

7.22 unregister_hook

Usage

Integer unregister_hook (String hook, String function)

Description

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.
See Also

register_hook

7.23 update

Usage

update ()

Description

This function may be used to force the display to be updated.

See Also

message


Next Previous Contents