Next Previous Contents

2. Article Functions

The intrinsic functions described in this chapter are available in article mode and allow you to manipulate the article window.

2.1 _is_article_visible

Usage

Integer _is_article_visible ()

Description

This function returns information about whether or not the article associated with the current header is visible in a window and whether or not it is attached to the current header. Specifically, it returns a bitmapped value:

      0  : if the article window is hidden and not associated with the
             current header.
      1  : if the article window is showing but the current header
             does not refer to the article.
      2  : if the article window is hidden but attached to the current
             header.
      3  : if the article window is showing and contains the current
             header article.

Example

If one only want to know whether or not there is an article visible in the window, then use

      _is_article_visible () & 1
To determine whether or not it is associated with the current header regardless of whether or not it is showing, use
      _is_article_visible () & 2

See Also

_is_article_visible, is_article_window_zoomed, call

2.2 article_as_string

Usage

String_Type article_as_string ()

Description

This function will return the entire contents of the current article as a string. If no article has been dowloaded, the empty string will be returned. The current article may not be the one associated with the currently selected header.

See Also

raw_article_as_string, replace_article, is_article_visible

2.3 article_cline_as_string

Usage

String_Type article_cline_as_string ()

Description

Returns the current line of the article (i.e. the first one that is displayed in the article pager) as a string. If no article has been downloaded, the empty string will be returned.

See Also

article_as_string, article_cline_number

2.4 article_cline_number

Usage

Integer article_cline_number ()

Description

Returns the number of the line that is currently displayed at the top of the article pager. Counting starts at 1 and ignores hidden lines.

See Also

article_cline_as_string, article_count_lines, article_goto_line

2.5 article_count_lines

Usage

Integer article_count_lines ()

Description

This function returns the total number of visible lines in the article pager. For example, you could use it with article_goto_line to jump to the last line in the pager:

     define article_bob ()
     { 
         () = article_goto_line (article_count_lines ());
     }

2.6 article_goto_line

Usage

Integer article_goto_line (Integer linenum)

Description

Makes the article pager jump to line number linenum (i.e., puts this line at the top of the pager). As in article_cline_number, counting starts at 1 and ignores hidden lines. If you specify 0 or a negative number as the argument, no action is taken and the function returns zero. Otherwise, the new line number is returned. If the article has less than linenum lines, the function goes to the last line.

See Also

article_line_down, article_line_up

2.7 article_line_down

Usage

Integer article_line_down (Integer num)

Description

Scrolls the article down num lines. Returns the number of lines that were actually scrolled.

Notes

If no article is in the pager, scrolling down first downloads an article.

See Also

article_goto_line, article_line_up

2.8 article_line_up

Usage

Integer article_line_up (Integer num)

Description

Scrolls the article up num lines and returns the number of lines that were actually scrolled.

See Also

article_goto_line, article_line_down

2.9 bsearch_article

Usage

Integer bsearch_article (String_Type pat)

Description

This function works like search_article, but does a backward search.

See Also

search_article

2.10 get_article_window_size

Usage

Integer get_article_window_size ()

Description

get_article_window_size may be used to determine the height of the article window.

See Also

set_article_window_size

2.11 get_body_status

Usage

Integer get_body_status ()

Description

When reading from an slrnpull spool in "true offline" mode, the body that belongs to an article header might not yet be on disk. This function returns one of the following values:

   -1  : currently, no header is selected
    0  : the body of the current article is present
    1  : the body of the article is missing
    2  : the body of the article is missing, but requested for download

See Also

request_body

2.12 get_next_art_pgdn_action

Usage

Integer get_next_art_pgdn_action ()

Description

This function may be used to get information about what action slrn will take when an attempt is made to go to the next page of the current article, e.g., by pressing the space key. It returns one of the following integers:

       -1  Not in article mode
        0  Next page of the article will be displayed
        1  The next unread article will be displayed
        2  The newsreader will go to the next newsgroup

2.13 is_article_visible

Usage

Integer is_article_visible ()

Description

This function returns information about whether or not the article associated with the current header is visible in a window. Specifically, it returns:

      0  : if the article window is hidden
      1  : if the article window is showing but the current header
             does not refer to the article
      3  : if the article window contains the current header article

Notes

For some purposes, it may be more useful to the the _is_article_visible function which may be slightly more useful. In fact, is_article_visible may be written in terms of _is_article_visible as

     define is_article_visible ()
     { 
         variable status = _is_article_visible ();
         !if (status & 1) return 0;
         return status;
     }

See Also

_is_article_visible, is_article_window_zoomed, call

2.14 is_article_window_zoomed

Usage

Integer is_article_window_zoomed ()

Description

This function returns 1 if the article window is zoomed, or 0 otherwise.

See Also

is_article_visible, call

2.15 pipe_article

Usage

Void pipe_article (String cmd)

Description

This function may be used to pipe the current article to the command given by the cmd argument. If the article window is hidden, it downloads the article associated with the currently selected header.

See Also

read_mini

2.16 raw_article_as_string

Usage

String_Type raw_article_as_string ()

Description

This function works exactly like article_as_string, except that it returns the article as it was sent by the server, not as it has been prepared for display (e.g. before MIME decoding and character recoding).

Notes

The raw article is no longer available after you called replace_article. In this case, the output is the same as the one of article_as_string.

2.17 re_bsearch_article

Usage

Integer re_bsearch_article (String_Type pat)

Description

This function works like re_search_article, but does a backward search.

See Also

re_search_article

2.18 re_search_article

Usage

Integer re_search_article (String_Type pat)

Description

This function searches forward in the current article for a string matching the regular expression given by the parameter pat. It returns 0 if no matching line is found. Otherwise, it returns 1 and the matching line will be left on the stack as a string.

See Also

re_search_article_first

See Also

search_article

2.19 re_search_article_first

Usage

Integer re_search_article_first (String_Type pat)

Description

Works like re_search_article, but finds the first match in the article (searching from the beginning instead of forward from the current point).

See Also

re_search_article

2.20 replace_article

Usage

replace_article (String_Type string)

Description

The replace_article may be used to replace the text of the currently displayed article with an arbitrary string.

Example

The following code fragment causes the text of an article to be replaced by its lowercase equivalent:

     replace_article (strlow (article_as_string ()));

See Also

article_as_string, is_article_visible

2.21 request_body

Usage

request_body (Integer mode)

Description

If an article does not yet have a body, you can request it for download using this function. Setting mode to 1 requests the body, setting it to 0 un-requests it.

See Also

get_body_status

2.22 save_current_article

Usage

Integer save_current_article (String filename)

Description

This function saves the currently selected article to a file specified by filename. If the article window is hidden, it downloads the the article associated with the currently selected header. It returns 0 upon success; upon failure, it returns -1 and sets an slang error condition.

Notes

This function always creates a new file, overwriting existing ones.

See Also

2.23 search_article

Usage

Integer search_article (String str)

Description

This function searches forward in the current article (if none is visible, in the one associated with the currently selected header) for the string given by the parameter str. It returns 0 if no matching line is found. Otherwise, it returns 1 and the matching line will be left on the stack as a string.

See Also

re_search_article

See Also

search_article_first

2.24 search_article_first

Usage

Integer search_article_first (String_Type pat)

Description

Works like search_article, but finds the first match in the article (searching from the beginning instead of forward from the current point). This means you can find all matches in the article by calling search_article_first once and subsequently using search_article.

See Also

search_article

2.25 set_article_window_size

Usage

Void set_article_window_size (Integer nrows)

Description

The set_article_window_size may be used to set the height of the article window. The variable SCREEN_HEIGHT may be used to facilitate this.

See Also

get_article_window_size


Next Previous Contents