From e9b7d2bc465260a06142223968db674e028ce110 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Wed, 24 Dec 2008 16:52:07 +0100 Subject: [PATCH] Add bar, command, network and info functions in english developer guide --- doc/en/dev/plugin_c_api.en.xml | 820 ++++++++++++++++++++++++++++++++- 1 file changed, 806 insertions(+), 14 deletions(-) diff --git a/doc/en/dev/plugin_c_api.en.xml b/doc/en/dev/plugin_c_api.en.xml index 58eabed6f..6bf7f6b88 100644 --- a/doc/en/dev/plugin_c_api.en.xml +++ b/doc/en/dev/plugin_c_api.en.xml @@ -1779,8 +1779,8 @@ void weechat_exec_on_files ( - : pointer given to callback when calling it - found + : pointer given to callback when it is + called by WeeChat @@ -7582,9 +7582,531 @@ weechat_nicklist_remove_all (my_buffer); Functions for bars. - - Missing doc! - + + +
+ weechat_bar_item_new + + + Prototype: + +struct t_gui_bar_item *weechat_bar_item_new ( + const char *name, + char *(build_callback)(void *data, + struct t_gui_bar_item *item, + struct t_gui_window *window), + void *build_callback_data); + + + + Create a new bar item. + + + Arguments: + + + + : bar item name + + + + + : function called when bar item + is built: it must return content of bar item + + + + + : pointer given to build + callback, when it is called by Weechat + + + + + + Return value: pointer to new bar item, NULL if an error occured. + + + Example: + +char * +my_build_callback (void *data, + struct t_gui_bar_item *item, + struct t_gui_window *window) +{ + return strdup ("my content"); +} + +struct t_gui_bar_item *my_item = weechat_bar_item_new ("myitem", + &my_build_callback, + NULL); + + +
+ +
+ weechat_bar_item_update + + + Prototype: + +void weechat_bar_item_update (const char *name); + + + + Update content of a bar item, by calling its build callback. + + + Arguments: + + + + : bar item name + + + + + + Example: + +weechat_bar_item_update ("myitem"); + + +
+ +
+ weechat_bar_item_remove + + + Prototype: + +void weechat_bar_item_remove (struct t_gui_bar_item *item); + + + + Remove a bar item. + + + Arguments: + + + + : bar item pointer + + + + + + Example: + +weechat_bar_item_remove (&my_item); + + +
+ + + +
+ weechat_bar_new + + + Prototype: + +struct t_gui_bar *weechat_bar_new ( + const char *name, + const char *hidden, + const char *priority, + const char *type, + const char *condition, + const char *position, + const char *filling_top_bottom, + const char *filling_left_right, + const char *size, + const char *size_max, + const char *color_fg, + const char *color_delim, + const char *color_bg, + const char *separator, + const char *items); + + + + Create a new item. + + + Arguments: + + + + : bar item name + + + + + : "on" if bar is hidden, "off" is bar is + visible + + + + + : bar priority (integer) + + + + + : "root" (bar displayed once, outside + windows), or "window" (bar displayed in each window) + + + + + : condition for displaying bar, one of + following: + + + + + Condition + Description + + + + + active + + bar is displayed in active window only + + + + inactive + + bar is displayed in inactive window(s) only + + + + nicklist + bar is displayed in window(s) with nicklist + + + + + + + + + : "top", "bottom", "left" or "right" + + + + + : filling when bar is in + position "top" or "bottom", one of following: + + + + + Filling + Description + + + + + horizontal + + items are filled horitontally (space after each item) + + + + vertical + + items are filled verticaly (new line after each item) + + + + columns_horizontal + + items are filled horizontally, displayed with columns + + + + columns_vertical + + items are filled vertically, displayed with columns + + + + + + + + + + : filling when bar is in + position "left" or "right", one of following: + + + + + Filling + Description + + + + + horizontal + + items are filled horitontally (space after each item) + + + + vertical + + items are filled verticaly (new line after each item) + + + + columns_horizontal + + items are filled horizontally, displayed with columns + + + + columns_vertical + + items are filled vertically, displayed with columns + + + + + + + + + + : bar size in chars (0 means automatic + size) + + + + + : max size for bar (0 means no max size) + + + + + : color for text in bar + + + + + : color for delimiters in bar + + + + + : background color for bar + + + + + : "on" if bar has separator line with + other windows/bars, "off" otherwise + + + + + : list of items in bar, separated by comma + (space between items), or "+" (glued items) + + + + + + Return value: pointer to new bar, NULL if an error occured. + + + Example: + +struct t_gui_bar *my_bar = + weechat_bar_new ("mybar", + "off", + 100, + "window", + "", + "top", + "horizontal", + "vertical", + "0", + "5", + "default", + "cyan", + "blue", + "off", + "time,buffer_number+buffer_name"); + + +
+ +
+ weechat_bar_set + + + Prototype: + +int weechat_bar_set (struct t_gui_bar *bar, + const char *property, + const char *value); + + + + Set a new value for a bar property. + + + Arguments: + + + + : bar pointer + + + + + : property name: name, hidden, priority, + conditions, position, filling_top_bottom, filling_left_right, + size, size_max, color_fg, color_delim, color_bg, separator, items + (see ) + + + + + : new value for property + + + + + + Return value: 1 if new value was set, 0 if an error occured. + + + Example: weechat_bar_set (mybar, "position", "bottom"); + +
+ +
+ weechat_bar_update + + + Prototype: + +void weechat_bar_update (const char *name); + + + + Refresh content of a bar on screen. + + + Arguments: + + + + : bar name + + + + + + Example: weechat_bar_update ("mybar"); + +
+ +
+ weechat_bar_remove + + + Prototype: + +void weechat_bar_remove (struct t_gui_bar *bar); + + + + Remove a bar. + + + Arguments: + + + + : bar pointer + + + + + + Example: weechat_bar_remove (mybar); + +
@@ -7597,9 +8119,44 @@ weechat_nicklist_remove_all (my_buffer); Functions for executing WeeChat commands. - - Missing doc! - +
+ weechat_command + + + Prototype: + +void weechat_command (struct t_gui_buffer *buffer, + const char *command); + + + + Execute a command. + + + Arguments: + + + + : buffer pointer (command is executed + on this buffer, use NULL for WeeChat core buffer) + + + + + : command to execute (if beginning with a + "/"), or text is sent to buffer (without leading "/") + + + + + + Example: + +weechat_command (weechat_buffer_search ("irc", "freenode.#weechat"), + "/whois FlashCode"); + + +
@@ -7612,9 +8169,131 @@ weechat_nicklist_remove_all (my_buffer); Network functions. - - Missing doc! - +
+ weechat_network_pass_proxy + + + Prototype: + +int weechat_network_pass_proxy (const char *proxy, + int sock, + const char *address, + int port); + + + + Establish a connection/authentification to a proxy. + + + Arguments: + + + + : proxy name to use + + + + + : socket to use + + + + + : address (hostname or IP) + + + + + : port + + + + + + Return value: 1 if connection is ok, 0 if an error occured. + + + Example: + +if (weechat_network_pass_proxy ("myproxy", sock, "irc.freenode.net", 6667)) +{ + /* OK */ +} +else +{ + /* error */ +} + + +
+ +
+ weechat_network_network_connect_to + + + Prototype: + +int weechat_network_connect_to (const char *proxy, + int sock, + unsigned long address, + int port); + + + + Establish a connection to a remote host. + + + Arguments: + + + + : proxy name to use + + + + + : socket to use + + + + + : address + + + + + : port + + + + + + Return value: 1 if connection is ok, 0 if an error occured. + + + Example: + +struct sockaddr_in addr; +socklen_t length; +unsigned long address; + +memset (&addr, 0, sizeof (struct sockaddr_in)); +length = sizeof (addr); +getsockname (sock, (struct sockaddr *) &addr, &length); +addr.sin_family = AF_INET; +address = ntohl (addr.sin_addr.s_addr); + +if (weechat_network_connect_to (NULL, sock, address, 6667)) +{ + /* OK */ +} +else +{ + /* error */ +} + + +
@@ -7627,9 +8306,122 @@ weechat_nicklist_remove_all (my_buffer); Functions to get infos. - - Missing doc! - +
+ weechat_into_get + + + Prototype: + +const char *weechat_info_get (const char *info_name, + const char *arguments); + + + + Get info from WeeChat or other plugin. + + + Arguments: + + + + : info name to read, from WeeChat + core or other plugin (see plugin doc for infos returned by + each plugin). WeeChat core infos are: + + + + + Info + Description + Example + + + + + version + WeeChat version + 0.2.7 + + + date + WeeChat compilation date + Dec 25 2008 + + + dir_separator + + directory separator: "/" under GNU/Linux, "\" under + MS-Windows + + / + + + weechat_dir + WeeChat home directory + /home/login/.weechat + + + weechat_libdir + WeeChat lib directory + /usr/lib/weechat + + + weechat_sharedir + WeeChat share directory + /usr/share/weechat + + + weechat_localedir + WeeChat locale directory + /usr/share/locale + + + charset_terminal + terminal charset + UTF-8 + + + charset_internal + internal WeeChat charset (always "UTF-8") + UTF-8 + + + inactivity + keyboard inactivity (in seconds) + 12 + + + filters_enabled + 1 if filters are enabled, otherwise 0 + 1 + + + + + + + + + : arguments for info asked (optional, + NULL if no argument is needed) + + + + + + Return value: const string with info asked, NULL if an error occured. + + + Example: + +weechat_printf (NULL, "Current WeeChat version is: %s (compiled on %s)", + weechat_info_get ("version", NULL), + weechat_info_get ("date", NULL)); +weechat_printf (NULL, "WeeChat home is: %s", + weechat_info_get ("weechat_dir")); + + +