Gnome ReadNews Perl Functions

All the functions described below are defined in the GRN module. So, you have to use them like this: $var = GRN::function_name(parameter).


add_command(context, name, handler)

Adds a command named name (this name will appear in the menu) with the subroutine named handler to the GRN's list of commands.
context is an integer which defines the scope of the command:
0 Everywhere
1 Main window
2 Message editing (posting and sending) window
3 Message posting window
4 Message sending window


add_hook(name, handler)

Adds a hook named name with the subroutine named handler to the GRN's list of hooks.


entry_text_delete(entry, start, end)

Deletes a text of the entry specified by the start and end parameters.


text entry_text_get(entry, start, end)

Returns a text of the entry specified by the start and end parameters. The entry is a string. The values can be found in the include/grn_consts.h and src/grn_msgwin.c, src/grn_msgsend.c, src/grn_msgwin.c files.


entry_text_set(entry, string)

Inserts a text to the current position of the entry.


error_dialog(context, message)

Makes a call to grn_error() function defined in grn_util.h. context and message are strings.


value get_config(param)

Returns a configuration parameter param (which is a string). The following params are available:
Parameter name Description Return type
ver Grn's version string
version Grn's version string
srv_autoconnect True, if "autoconnect to server" is on integer
scripts_autoload If scripts load on startup (always true) integer
server NNTP server name string
name Person's full name string
email E-mail address string
replyto Reply-To address string
organization Organization name string
re_quoting Quoting regexp string
fontN Grn's font names. N may be 0-4 string
fgcolorN Grn's foreground colors. N may be 0-2 string
bgcolorN Grn's background colors. N may be 0-2 string
cfm_group_read "Mark group read" confirmation integer
cfm_group_unread "Mark group unread" confirmation integer
cfm_thread_read "Mark thread read" confirmation integer
cfm_thread_unread "Mark thread unread" confirmation integer
cfm_abort_posting "Abort posting" confirmation integer
cfm_show_warnings "Show warnings" confirmation integer
cfm_show_messages "Show informational messages" confirmation integer


string get_color_pal(index)

Returns a color palette element pointed by index. The first element has an index = 1. The returned value is a string in Xresource format (e.g. "#3FBCDD").


string get_font_pal(index)

Returns a font palette element pointed by index. The first element has an index = 1.


string html_escape(string)

Returns an escaped string for use with PreShow hook or any other functions which require a valid HTML or XML text.


mew_text_delete (start, end)

Delete a text specified by the start and end parameters. Each of them can be -1.


text mew_text_get (start, end)

Returns a text in message editing widget starting at start and ending at end. Any of these parameters can be -1. This means that the returned text starts at the beginning or at the end of the entire text, respectively.


(start, end) mew_text_get_selection

Returns a selection position in message editing widget. Returns empty list if no selection available.


mew_text_insert(string)

Inserts the string into the message editing widget at the current cursor position.


mew_text_select(start, end)

Selects the text in message editing widget from start to end.


string subst_vars(src)

Makes a variables substitution in src. The list of valid variables may be found here.