/[weechat]/weechat/doc/weechat_doc_es.texi
ViewVC logotype

Diff of /weechat/doc/weechat_doc_es.texi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.25 by flashcode, Sun Oct 2 20:52:40 2005 UTC revision 1.26 by flashcode, Mon Oct 17 20:54:30 2005 UTC
# Line 36  Line 36 
36    
37  @title WeeChat - Gui@'on de usuario.  @title WeeChat - Gui@'on de usuario.
38  @subtitle Cliente IRC r@'apido, peque@~no y extensible  @subtitle Cliente IRC r@'apido, peque@~no y extensible
39  @subtitle Documentaci@'on para WeeChat v0.1.6-cvs - 2 de octubre de 2005  @subtitle Documentaci@'on para WeeChat v0.1.6-cvs - 17 de octubre de 2005
40    
41  @author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>  @author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
42    
# Line 66  License versi@'on 2 o posterior. Line 66  License versi@'on 2 o posterior.
66  * Introduccion:: Presentaci@'on de WeeChat  * Introduccion:: Presentaci@'on de WeeChat
67  * Instalacion:: Instalaci@'on de WeeChat  * Instalacion:: Instalaci@'on de WeeChat
68  * Uso:: Utilizaci@'on de WeeChat  * Uso:: Utilizaci@'on de WeeChat
69  * Extensiones:: Extensiones de WeeChat  * Plugins:: WeeChat plugins
70  * Autores / Soporte:: Contactar los autores y obtener soporte  * Autores / Soporte:: Contactar los autores y obtener soporte
71  @end menu  @end menu
72    
# Line 201  Luego, lee las instructiones para Paquet Line 201  Luego, lee las instructiones para Paquet
201    
202  @c ******************************* Utilisaci@'on ********************************  @c ******************************* Utilisaci@'on ********************************
203    
204  @node Uso, Extensiones, Instalacion, Top  @node Uso, Plugins, Instalacion, Top
205  @chapter Uso  @chapter Uso
206    
207  @menu  @menu
# Line 429  Color para el texto de entrada (alias)@* Line 429  Color para el texto de entrada (alias)@*
429  Typo: color (color Curses @'o Gtk), valor por defecto: 'lightcyan'@*  Typo: color (color Curses @'o Gtk), valor por defecto: 'lightcyan'@*
430  @item col_input_delimiters  @item col_input_delimiters
431  Color for input text (delimiters)@*  Color for input text (delimiters)@*
432  Typo: color (color Curses @'o Gtk), valor por defecto: 'cyan'@*  Typo: color (color Curses @'o Gtk), valor por defecto: 'lightgreen'@*
433  @item col_input_bg  @item col_input_bg
434  Color de fondo para la ventana de entrada@*  Color de fondo para la ventana de entrada@*
435  Typo: color (color Curses @'o Gtk), valor por defecto: 'default'@*  Typo: color (color Curses @'o Gtk), valor por defecto: 'default'@*
# Line 628  Typo: cadena (cualquier cadena), valor p Line 628  Typo: cadena (cualquier cadena), valor p
628  @item proxy_password  @item proxy_password
629  Contrase@~na para el servidor proxy@*  Contrase@~na para el servidor proxy@*
630  Typo: cadena (cualquier cadena), valor por defecto: ''@*  Typo: cadena (cualquier cadena), valor por defecto: ''@*
631    @item plugins_path
632    Path for searching plugins@*
633    Typo: cadena (cualquier cadena), valor por defecto: '~/.weechat/plugins'@*
634    @item plugins_autoload
635    Comma separated list of plugins to load automatically at startup, "*" means all plugins found (names may be partial, for example "perl" is ok for "libperl.so")@*
636    Typo: cadena (cualquier cadena), valor por defecto: '*'@*
637    @item plugins_extension
638    Standard plugins extension in filename, used for autoload (if empty, then all files are loaded when autoload is "*")@*
639    Typo: cadena (cualquier cadena), valor por defecto: '.so'@*
640  @item server_name  @item server_name
641  Nombre asociado al servidor IRC (para mostrar solamente)@*  Nombre asociado al servidor IRC (para mostrar solamente)@*
642  Typo: cadena (cualquier cadena), valor por defecto: ''@*  Typo: cadena (cualquier cadena), valor por defecto: ''@*
# Line 906  desatar: desata una clave(si "all", se r Line 915  desatar: desata una clave(si "all", se r
915  funciones: lista funciones internas para el anclaje de claves@*  funciones: lista funciones internas para el anclaje de claves@*
916  reset: restaura anclajes a los valores por defecto y elimina todos los anclajes personales (usar cuidadosamente)@*  reset: restaura anclajes a los valores por defecto y elimina todos los anclajes personales (usar cuidadosamente)@*
917  @*  @*
918  @item perl  [load fichero] | [autoload] | [reload] | [unload]  @item plugin  [load fichero] | [autoload] | [reload] | [unload]
 @*  
 lista/carga/descarga de los Perl scripts@*  
 @*  
 fichero: Perl script (archivo) a cargar@*  
 @*  
 Sin argumentos, el comando /perl lista todos los Perl scripts cargados.@*  
 @*  
 @item python  [load fichero] | [autoload] | [reload] | [unload]  
 @*  
 lista/carga/descarga de los Python scripts@*  
 @*  
 fichero: Python script (archivo) a cargar@*  
 @*  
 Sin argumentos, el comando /python lista todos los Python scripts cargados.@*  
 @*  
 @item ruby  [load fichero] | [autoload] | [reload] | [unload]  
919  @*  @*
920  lista/carga/descarga de los Ruby scripts@*  list/load/unload plugins@*
921  @*  @*
922  fichero: Ruby script (archivo) a cargar@*  filename: WeeChat plugin (file) to load@*
923  @*  @*
924  Sin argumentos, el comando /ruby lista todos los Ruby scripts cargados.@*  Without argument, /plugin command lists all loaded plugins.@*
925  @*  @*
926  @item server  [nombre_de_servidor] | [nombre_de_servidor nombre/IP puerto [-auto | -noauto] [-ipv6] [-ssl] [-pwd contrase@~na] [-nicks alias1 alias2 alias3] [-username nombre de usuario] [-realname nombre_real] [-command comando] [-autojoin canal[,canal]] ] | [del nombre_de_servidor]  @item server  [nombre_de_servidor] | [nombre_de_servidor nombre/IP puerto [-auto | -noauto] [-ipv6] [-ssl] [-pwd contrase@~na] [-nicks alias1 alias2 alias3] [-username nombre de usuario] [-realname nombre_real] [-command comando] [-autojoin canal[,canal]] ] | [del nombre_de_servidor]
927  @*  @*
# Line 1141  mensaje: mensaje a enviar@* Line 1134  mensaje: mensaje a enviar@*
1134  @*  @*
1135  cambiar modo del canal o del usuario@*  cambiar modo del canal o del usuario@*
1136  @*  @*
1137  modos del canal:@*  channel modes:@*
1138    canal: nombre del canal a modificar@*    channel: channel name to modify@*
1139    o: dar/coger privilegios de operador de canal@*    o: give/take channel operator privileges@*
1140    p: indicador de canal privado@*    p: private channel flag@*
1141    s: indicador de canal secreto@*    s: secret channel flag@*
1142    i: indicador de canal s@'olo con invitaci@'on@*    i: invite-only channel flag@*
1143    t: indicador de tema s@'olo modificable por operador de canal@*    t: topic settable by channel operator only flag@*
1144    n: ningún mensaje al canal desde el exterior@*    n: no messages to channel from clients on the outside@*
1145    m: canal moderado@*    m: moderated channel@*
1146    l: fijar el l@'imite de usuarios para el canal@*    l: set the user limit to channel@*
1147    b: establecer una m@'ascara de baneo para mantener fuera a usuarios@*    b: set a ban mask to keep users out@*
1148    v: dar/quitar la capacidad de hablar en un canal moderado@*    e: set exception mask@*
1149    k: definir una clave (contrase@~na) de canal@*    v: give/take the ability to speak on a moderated channel@*
1150  modos de usuario:@*    k: set a channel key (password)@*
1151    usuario: usuario a modificar@*  user modes:@*
1152    i: marcar a un usuario como invisible@*    nickname: nickname to modify@*
1153    s: marcar a un usuario para recibir noticias del servidor@*    i: mark a user as invisible@*
1154    w: el usuario recibe golpes@*    s: mark a user for receive server notices@*
1155    o: indicador de operador@*    w: user receives wallops@*
1156      o: operator flag@*
1157  @*  @*
1158  @item motd  [target]  @item motd  [target]
1159  @*  @*
# Line 1502  Si el script se llama "auto_weechat_comm Line 1496  Si el script se llama "auto_weechat_comm
1496  @command{./auto_weechat_command "freenode,#weechat *Hola"}  @command{./auto_weechat_command "freenode,#weechat *Hola"}
1497    
1498    
1499  @c ******************************* Extensions *********************************  @c ******************************** Plugins ***********************************
1500    
1501  @node Extensiones, Autores / Soporte, Uso, Top  @node Plugins, Autores / Soporte, Uso, Top
1502  @chapter Extensiones  @chapter Plugins
1503    
1504  @menu  @menu
1505  * Programas Perl::  * Plugins in WeeChat::
1506  * Programas Python::  * Write a plugin::
1507  * Programas Ruby::  * Plugin example::
1508    * Scripts plugins::
1509  @end menu  @end menu
1510    
1511  @node Programas Perl, Programas Python, Extensiones, Extensiones  @node Plugins in WeeChat, Write a plugin, Plugins, Plugins
1512  @section Programas Perl  @section Plugins in WeeChat
1513    
1514    A plugin is a C program which can call WeeChat functions defined in an
1515    interface.@*
1516    @*
1517    This C program does not need WeeChat sources to compile and can be
1518    dynamically loaded into WeeChat with command @command{/plugin}.@*
1519    @*
1520    The plugin has to be a dynamic library, for dynamic loading by
1521    operating system.
1522    Under GNU/Linux, the file has ``.so'' extension.
1523    
1524    @node Write a plugin, Plugin example, Plugins in WeeChat, Plugins
1525    @section Write a plugin
1526    
1527    @subsection Base rules
1528    
1529    The plugin should include ``weechat-plugin.h'' file (available in
1530    WeeChat source code).@*
1531    This file defines structures and types used to communicate with WeeChat.@*
1532    @*
1533    The plugin must have some variables and functions (mandatory, without
1534    them the plugin can't load):@*
1535    @itemize @bullet
1536    @item variables for plugin description:
1537    @itemize @minus
1538    @item plugin_name[]: plugin name
1539    @item plugin_version[]: plugin version
1540    @item plugin_description[]: short description of plugin
1541    @end itemize
1542    @item functions for init and end of plugin:
1543    @itemize @minus
1544    @item weechat_plugin_init: function called when plugin is loaded
1545    @item weechat_plugin_end: function called when plugin is unloaded
1546    @end itemize
1547    @end itemize
1548    
1549    @subsection API functions
1550    
1551    The plugin can call some functions defined in t_weechat_plugin structure.@*
1552    These functions are detailed below:
1553    
1554    @itemize @bullet
1555    @item
1556    @command{int ascii_strcasecmp (t_weechat_plugin *plugin,
1557    char *string1, char *string2)}@*
1558    @*
1559    locale and case independent string comparison.@*
1560    
1561    @emph{Arguments:}
1562    @itemize @minus
1563    @item @option{plugin}: pointer to plugin structure
1564    @item @option{string1}: first string for comparison
1565    @item @option{string2}: second string for comparison
1566    @end itemize
1567    @*
1568    @emph{Return value:}@*
1569    @*
1570    Difference between two strings: negative if chaine1 < chaine2,
1571    nul if chaine1 == chaine 2, positive if chaine1 > chaine2@*
1572    @*
1573    @emph{Example:}@*
1574    @*
1575    @code{if (plugin->ascii_strcasecmp (plugin, "abc", "def") != 0) ...}@*
1576    
1577    @*
1578    
1579    @item
1580    @command{char **explode_string (t_weechat_plugin *plugin,
1581    char *string, char *separators, int num_items_max, int *num_items)}@*
1582    @*
1583    Explode a string according to one or more delimiter(s).@*
1584    
1585    @emph{Param@`etres :}
1586    @itemize @minus
1587    @item @option{plugin}: pointer to plugin structure
1588    @item @option{string}: string to explode
1589    @item @option{separators}: delimiters used for explosion
1590    @item @option{num_items_max}: maximum number of items created (0 means
1591    no limit)
1592    @item @option{num_items}: pointer to int which will contain number of
1593    items created
1594    @end itemize
1595    @*
1596    @emph{Return value:}@*
1597    @*
1598    Array of strings, NULL if problem.@*
1599    Note: the result has to be free by a call to ``free_exploded_string''
1600    function after use.@*
1601    @*
1602    @emph{Example:}@*
1603    @*
1604    @code{char *argv;}@*
1605    @code{int argc;}@*
1606    @code{argv = plugin->explode_string (plugin, string, " ", 0, &argc);}@*
1607    @code{...}@*
1608    @code{if (argv != NULL)}@*
1609    @code{plugin->free_exploded_string (plugin, argv);}@*
1610    @*
1611    
1612    @item
1613    @command{char **free_exploded_string (t_weechat_plugin *plugin,
1614    char **string)}@*
1615    @*
1616    Free memory used by a string explosion.@*
1617    
1618    @emph{Arguments:}
1619    @itemize @minus
1620    @item @option{plugin}: pointer to plugin structure
1621    @item @option{string}: string exploded by ``explode_string'' function
1622    @end itemize
1623    @*
1624    @emph{Return value:}@*
1625    @*
1626    None.@*
1627    @*
1628    @emph{Example:}@*
1629    @*
1630    @code{char *argv;}@*
1631    @code{int argc;}@*
1632    @code{argv = plugin->explode_string (plugin, string, " ", 0, &argc);}@*
1633    @code{...}@*
1634    @code{if (argv != NULL)}@*
1635    @code{plugin->free_exploded_string (plugin, argv);}@*
1636    @*
1637    
1638    @item
1639    @command{void exec_on_files (t_weechat_plugin *plugin, char *directory,
1640    int (*callback)(t_weechat_plugin *, char *))}@*
1641    @*
1642    Execute a function on all files of a directory.@*
1643    
1644    @emph{Arguments:}
1645    @itemize @minus
1646    @item @option{plugin}: pointer to plugin structure
1647    @item @option{directory}: directory for searching files
1648    @item @option{callback}: function called for each file found
1649    @end itemize
1650    @*
1651    @emph{Return value:}@*
1652    @*
1653    Aucune.@*
1654    @*
1655    @emph{Exemple :}@*
1656    @*
1657    @code{int callback (t_weechat_plugin *plugin, char *file)}@*
1658    @code{@{}@*
1659    @code{@ @ @ @ plugin->printf_server (plugin, "file: %s", file);}@*
1660    @code{@ @ @ @ return 1;}@*
1661    @code{@}}@*
1662    @code{}@*
1663    @code{...}@*
1664    @code{plugin->exec_on_files (plugin, "/tmp", &callback);}@*
1665    @*
1666    
1667    @item
1668    @command{void printf (t_weechat_plugin *plugin,
1669    char *server, char *channel, char *message, ...)}@*
1670    @*
1671    Display a message on a WeeChat buffer, identified by server and
1672    channel (both may be NULL).@*
1673    
1674    @emph{Arguments:}
1675    @itemize @minus
1676    @item @option{plugin}: pointer to plugin structure
1677    @item @option{server}: name of server to find buffer for message
1678    display (may be NULL)
1679    @item @option{channel}: name of channel to find buffer for message
1680    display (may be NULL)
1681    @item @option{message}: message
1682    @end itemize
1683    @*
1684    @emph{Return value:}@*
1685    @*
1686    None.@*
1687    @*
1688    @emph{Examples:}@*
1689    @*
1690    @code{plugin->printf (NULL, NULL, "hello");}@*
1691    @code{plugin->printf (NULL, "#weechat", "hello");}@*
1692    @code{plugin->printf ("freenode", "#weechat", "hello");}@*
1693    @*
1694    
1695    @item
1696    @command{void printf_server (t_weechat_plugin *plugin,
1697    char *message, ...)}@*
1698    @*
1699    Display a message on server buffer.@*
1700    
1701    @emph{Param@`etres :}
1702    @itemize @minus
1703    @item @option{plugin}: pointer to plugin structure
1704    @item @option{message}: message
1705    @end itemize
1706    @*
1707    @emph{Return value:}@*
1708    @*
1709    None.@*
1710    @*
1711    @emph{Example:}@*
1712    @*
1713    @code{plugin->printf_server ("hello");}@*
1714    @*
1715    
1716    @item
1717    @command{void printf_infobar (t_weechat_plugin *plugin,
1718    int time, char *message, ...)}@*
1719    @*
1720    Display a message in infobar for a specified time.@*
1721    
1722    @emph{Arguments:}
1723    @itemize @minus
1724    @item @option{plugin}: pointer to plugin structure
1725    @item @option{time}: time in seconds for displaying message (0 means
1726    never erased)
1727    @item @option{message}: message
1728    @end itemize
1729    @*
1730    @emph{Return value:}@*
1731    @*
1732    None.@*
1733    @*
1734    @emph{Example:}@*
1735    @*
1736    @code{plugin->printf_infobar (5, "hello");}@*
1737    @*
1738    
1739    @item
1740    @command{t_plugin_msg_handler *msg_handler_add (t_weechat_plugin
1741    *plugin, char *message, t_plugin_handler_func *handler_func,
1742    char *handler_args, void *handler_pointer)}@*
1743    @*
1744    Add an IRC message handler, called when an IRC message is received.@*
1745    
1746    @emph{Arguments:}
1747    @itemize @minus
1748    @item @option{plugin}: pointer to plugin structure
1749    @item @option{message}: IRC message (for example: ``PRIVMSG'')
1750    @item @option{handler_func}: function called when message is received
1751    @item @option{handler_args}: arguments given to function when called
1752    @item @option{handler_pointer}: pointer given to function when called
1753    @end itemize
1754    @*
1755    @emph{Return value:}@*
1756    @*
1757    Pointer to new message handler.@*
1758    @*
1759    @emph{Example:}@*
1760    @*
1761    @code{int msg_kick (t_weechat_plugin *plugin, char *server,
1762    char *command, char *arguments, char *handler_args,
1763    void *handler_pointer)}@*
1764    @code{@{}@*
1765    @code{@ @ @ @ plugin->printf (plugin, server, NULL, "KICK received");}@*
1766    @code{@}}@*
1767    @code{...}@*
1768    @code{plugin->msg_handler_add (plugin, "KICK", &msg_kick, NULL, NULL);}@*
1769    @*
1770    
1771    @item
1772    @command{void msg_handler_remove (t_weechat_plugin *plugin,
1773    t_plugin_msg_handler *msg_handler)}@*
1774    @*
1775    Remove an IRC message handler.@*
1776    
1777    @emph{Param@`etres :}
1778    @itemize @minus
1779    @item @option{plugin}: pointer to plugin structure
1780    @item @option{msg_handler}: handler to remove
1781    @end itemize
1782    @*
1783    @emph{Return value:}@*
1784    @*
1785    None.@*
1786    @*
1787    @emph{Example:}@*
1788    @*
1789    @code{plugin->msg_handler_remove (plugin, my_msg_handler);}@*
1790    @*
1791    
1792    @item
1793    @command{void msg_handler_remove_all (t_weechat_plugin *plugin)}@*
1794    @*
1795    Remove all IRC message handlers for a plugin.@*
1796    
1797    @emph{Arguments:}
1798    @itemize @minus
1799    @item @option{plugin}: pointer to plugin structure
1800    @end itemize
1801    @*
1802    @emph{Return value:}@*
1803    @*
1804    None.@*
1805    @*
1806    @emph{Example:}@*
1807    @*
1808    @code{plugin->msg_handler_remove_all (plugin);}@*
1809    @*
1810    
1811    @item
1812    @command{t_plugin_cmd_handler *cmd_handler_add (t_weechat_plugin
1813    *plugin, char *command, char *description, char *arguments,
1814    char *arguments_description, t_plugin_handler_func *handler_func,
1815    char *handler_args, void *handler_pointer)}@*
1816    @*
1817    Add a WeeChat command handler, called when user uses command
1818    (for example /command).@*
1819    
1820    @emph{Arguments:}
1821    @itemize @minus
1822    @item @option{plugin}: pointer to plugin structure
1823    @item @option{commande}: the new command
1824    @item @option{description}: command description (displayed by /help
1825    command)
1826    @item @option{arguments}: short description of command arguments
1827    (displayed by /help command)
1828    @item @option{arguments_description}: long description of command
1829    arguments (displayed by /help command)
1830    @item @option{handler_func}: function called when comand is executed
1831    @item @option{handler_args}: arguments given to function when called
1832    @item @option{handler_pointer}: pointer given to function when called
1833    @end itemize
1834    @*
1835    @emph{Return value:}@*
1836    @*
1837    Pointer to new command handler.@*
1838    @*
1839    @emph{Example:}@*
1840    @*
1841    @code{int cmd_test (t_weechat_plugin *plugin, char *server,
1842    char *command, char *arguments, char *handler_args,
1843    void *handler_pointer)}@*
1844    @code{@{}@*
1845    @code{@ @ @ @ plugin->printf (plugin, server, NULL, "test command,
1846    file: %s", (arguments) ? arguments : "none");}@*
1847    @code{@}}@*
1848    @code{...}@*
1849    @code{plugin->cmd_handler_add (plugin, "test", "Test command",
1850    "[file]", "file: a file name", &cmd_test, NULL, NULL);}@*
1851    @*
1852    
1853  @subsection Cargar/descargar programas Perl  @item
1854    @command{void cmd_handler_remove (t_weechat_plugin *plugin,
1855    t_plugin_cmd_handler *cmd_handler)}@*
1856    @*
1857    Remove a command handler.@*
1858    
1859    @emph{Arguments:}
1860    @itemize @minus
1861    @item @option{plugin}: pointer to plugin structure
1862    @item @option{cmd_handler}: command handler to remove
1863    @end itemize
1864    @*
1865    @emph{Return value:}@*
1866    @*
1867    None.@*
1868    @*
1869    @emph{Example:}@*
1870    @*
1871    @code{plugin->cmd_handler_remove (plugin, my_cmd_handler);}@*
1872    @*
1873    
1874    @item
1875    @command{void cmd_handler_remove_all (t_weechat_plugin *plugin)}@*
1876    @*
1877    Remove all command handlers for a plugin.@*
1878    
1879    @emph{Arguments:}
1880    @itemize @minus
1881    @item @option{plugin}: pointer to plugin structure
1882    @end itemize
1883    @*
1884    @emph{Return value:}@*
1885    @*
1886    None.@*
1887    @*
1888    @emph{Example :}@*
1889    @*
1890    @code{plugin->cmd_handler_remove_all (plugin);}@*
1891    @*
1892    
1893    @item
1894    @command{void exec_command (t_weechat_plugin
1895    *plugin, char *server, char *channel, char *command)}@*
1896    @*
1897    Execute a WeeChat command (or send a message to a channel).@*
1898    
1899    @emph{Arguments:}
1900    @itemize @minus
1901    @item @option{plugin}: pointer to plugin structure
1902    @item @option{server}: name of server for executing command (may be
1903    NULL)
1904    @item @option{channel}: name of channel for executing command (may be
1905    NULL)
1906    @item @option{command}: command
1907    @end itemize
1908    @*
1909    @emph{Return value:}@*
1910    @*
1911    None.@*
1912    @*
1913    @emph{Examples:}@*
1914    @*
1915    @code{plugin->exec_command (plugin, NULL, NULL, "/help nick");}@*
1916    @code{plugin->exec_command (plugin, "freenode", "#weechat", "hello");}@*
1917    @*
1918    
1919    @item
1920    @command{char *get_info (t_weechat_plugin
1921    *plugin, char *info, char *server, char *channel)}@*
1922    @*
1923    Return an info about WeeChat or a channel.@*
1924    
1925    @emph{Param@`etres :}
1926    @itemize @minus
1927    @item @option{plugin}: pointer to plugin structure
1928    @item @option{info}: name of info to read:
1929    @itemize @minus
1930    @item @option{version}: get WeeChat's version
1931    @item @option{nick}: get nick
1932    @item @option{channel}: get channel name
1933    @item @option{server}: get server name
1934    @item @option{away}: get ``away'' flag
1935    @item @option{weechat_dir}: get WeeChat home dir
1936    @item @option{weechat_libdir}: get WeeChat system lib dir
1937    @item @option{weechat_sharedir}: get WeeChat system share dir
1938    @end itemize
1939    @item @option{server}: name of server for reading info (if needed)
1940    @item @option{channel}: name of channel for reading info (if needed)
1941    @end itemize
1942    @*
1943    @emph{Return value:}@*
1944    @*
1945    Information asked, NULL if not found.@*
1946    Note: result has to be free by a call to ``free'' function after
1947    use.@*
1948    @*
1949    @emph{Examples:}@*
1950    @*
1951    @code{char *version = plugin->get_info (plugin, "version", NULL, NULL);}@*
1952    @code{char *nick = plugin->get_info (plugin, "nick", "freenode", NULL);}@*
1953    @*
1954    
1955    @item
1956    @command{t_plugin_info_dcc *get_dcc_info (t_weechat_plugin *plugin)}@*
1957    @*
1958    Returns list of DCC currently active or finished.@*
1959    
1960    @emph{Arguments:}
1961    @itemize @minus
1962    @item @option{plugin}: pointer to plugin structure
1963    @end itemize
1964    @*
1965    @emph{Return value:}@*
1966    @*
1967    Chained list of DCC.@*
1968    Note: result has to be free by a call to ``free_dcc_info'' function
1969    after use.@*
1970    @*
1971    @emph{Example:}@*
1972    @*
1973    @code{t_plugin_dcc_info *dcc_info = plugin->get_dcc_info (plugin);}@*
1974    @code{for (ptr_dcc = dcc_info; ptr_dcc; ptr_dcc =
1975    ptr_dcc->next_dcc)}@*
1976    @code{@{}@*
1977    @code{@ @ @ @ plugin->printf_server (plugin, "DCC type=%d, with: %s",
1978    ptr_dcc->type, ptr_dcc->nick);}@*
1979    @code{@}}@*
1980    @*
1981    
1982    @item
1983    @command{void free_dcc_info (t_weechat_plugin *plugin,
1984    t_plugin_dcc_info *dcc_info)}@*
1985    @*
1986    Free memory used by a DCC list.@*
1987    
1988    @emph{Param@`etres :}
1989    @itemize @minus
1990    @item @option{plugin}: pointer to plugin structure
1991    @item @option{dcc_info}: pointer to DCC list returned by
1992    ``get_dcc_info'' function
1993    @end itemize
1994    @*
1995    @emph{Return value:}@*
1996    @*
1997    None.@*
1998    @*
1999    @emph{Example:}@*
2000    @*
2001    @code{plugin->free_dcc_info (plugin, dcc_info);}@*
2002    @*
2003    
2004    @item
2005    @command{char *get_config (t_weechat_plugin
2006    *plugin, char *option)}@*
2007    @*
2008    Return value of a WeeChat config option.@*
2009    
2010    @emph{Arguments:}
2011    @itemize @minus
2012    @item @option{plugin}: pointer to plugin structure
2013    @item @option{option}: name of option to read
2014    @end itemize
2015    @*
2016    @emph{Return value:}@*
2017    @*
2018    Value of option, NULL if not found.@*
2019    Note: result has to be free by a call to ``free'' function after
2020    use.@*
2021    @*
2022    @emph{Examples:}@*
2023    @*
2024    @code{char *value1 = plugin->get_config (plugin, "look_set_title");}@*
2025    @code{char *value2 = plugin->get_config (plugin, "freenode.server_autojoin");}@*
2026    @*
2027    
2028    @end itemize
2029    
2030    @subsection Compile plugin
2031    
2032    Compile does not need WeeChat sources, only file
2033    ``weechat-plugin.h''.@*
2034    
2035    To compile a plugin which has one file ``toto.c'' (sous GNU/Linux):@*
2036    @*
2037    gcc -fPIC -Wall -c toto.c@*
2038    gcc -shared -fPIC -o libtoto.so toto.o
2039    
2040    @subsection Load plugin under WeeChat
2041    
2042    Copy ``libtoto.so'' file into general plugins dir (for example
2043    /usr/local/lib/weechat/plugins) or into user's plugins dir (for
2044    example /home/xxxxx/.weechat/plugins).@*
2045    @*
2046    Under WeeChat:@*
2047    @command{/plugin load toto}
2048    
2049    @node Plugin example, Scripts plugins, Write a plugin, Plugins
2050    @section Plugin example
2051    
2052    Full example of plugin, which adds a /double command, which displays
2053    two times arguments on current channel (ok that's not very useful, but
2054    that's just an example!):
2055    
2056    @verbatim
2057    #include <stdlib.h>
2058    
2059    #include "weechat-plugin.h"
2060    
2061    char plugin_name[]        = "Toto";
2062    char plugin_version[]     = "0.1";
2063    char plugin_description[] = "Test plugin for WeeChat";
2064    
2065    /* gestionnaire de commande "/hello" */
2066    
2067    int toto_cmd_double (t_weechat_plugin *plugin, char *server,
2068                        char *command, char *arguments,
2069                        char *handler_args, void *handler_pointer)
2070    {
2071        if (arguments && arguments[0] && (arguments[0] != '/'))
2072        {
2073            plugin->exec_command (plugin, NULL, NULL, arguments);
2074            plugin->exec_command (plugin, NULL, NULL, arguments);
2075        }
2076        return 1;
2077    }
2078    
2079    int weechat_plugin_init (t_weechat_plugin *plugin)
2080    {
2081        plugin->cmd_handler_add (plugin, "double",
2082                                 "Display two times a message",
2083                                 "msg",
2084                                 "msg: message",
2085                                 &toto_cmd_double,
2086                                 NULL, NULL);
2087        return 1;
2088    }
2089    
2090    int weechat_plugin_end (t_weechat_plugin *plugin)
2091    {
2092        /* on ne fait rien ici */
2093        return 1;
2094    }
2095    @end verbatim
2096    
2097    @node Scripts plugins, , Plugin example, Plugins
2098    @section Scripts plugins
2099    
2100    Three plugins are provided with WeeChat to load scripts: Perl,
2101    Python and Ruby.
2102    
2103    @subsection Perl scripts
2104    
2105    @subsubsection Cargar/descargar programas Perl
2106    
2107  Los programas Perl se cargan y descargan con el comando @command{/perl}  Los programas Perl se cargan y descargan con el comando @command{/perl}
2108  (escribiendo @kbd{/help perl} en WeeChat para obtener la ayuda acerca del comando).@*  (escribiendo @kbd{/help perl} en WeeChat para obtener la ayuda acerca del comando).@*
# Line 1530  Cargar un programa Perl: @kbd{/perl load Line 2116  Cargar un programa Perl: @kbd{/perl load
2116  Listar los programas Perl cargados: @kbd{/perl}@*  Listar los programas Perl cargados: @kbd{/perl}@*
2117  @end itemize  @end itemize
2118    
2119  @subsection Interfaz WeeChat / Perl  @subsubsection Interfaz WeeChat / Perl
2120    
2121  @itemize @bullet  @itemize @bullet
2122  @item  @item
# Line 1550  tener un nombre distinto) Line 2136  tener un nombre distinto)
2136  @end itemize  @end itemize
2137  @*  @*
2138  @emph{Ejemplo:}@*  @emph{Ejemplo:}@*
2139    @*
2140  @code{weechat::register ("ejemplo", "1.0", "fin_ejemplo", "programa de ejemplo...");}@*  @code{weechat::register ("ejemplo", "1.0", "fin_ejemplo", "programa de ejemplo...");}@*
2141  @*  @*
2142    
# Line 1565  Escribe un mensaje en un canal.@* Line 2152  Escribe un mensaje en un canal.@*
2152  @item @option{servidor}: (opcional) nombre interno del servidor  @item @option{servidor}: (opcional) nombre interno del servidor
2153  @end itemize  @end itemize
2154  @*  @*
2155  @emph{Ejemplo:}@*  @emph{Ejemplos:}@*
2156    @*
2157  @code{weechat::print ("mensaje");}@*  @code{weechat::print ("mensaje");}@*
2158  @code{weechat::print ("mensaje", "#weechat");}@*  @code{weechat::print ("mensaje", "#weechat");}@*
2159  @code{weechat::print ("mensaje", "#weechat", "freenode");}@*  @code{weechat::print ("mensaje", "#weechat", "freenode");}@*
# Line 1584  Escribir un mensaje en la barra de infor Line 2172  Escribir un mensaje en la barra de infor
2172  @end itemize  @end itemize
2173  @*  @*
2174  @emph{Ejemplo:}@*  @emph{Ejemplo:}@*
2175    @*
2176  @code{weechat::print_infobar (5, "mensaje");}@*  @code{weechat::print_infobar (5, "mensaje");}@*
2177  @*  @*
2178    
# Line 1604  RFC 2812: @uref{ftp://ftp.rfc-editor.org Line 2193  RFC 2812: @uref{ftp://ftp.rfc-editor.org
2193  @end itemize  @end itemize
2194  @*  @*
2195  @emph{Ejemplo:}@*  @emph{Ejemplo:}@*
2196    @*
2197  @code{weechat::add_message_handler ("privmsg", mi_funcion);}@*  @code{weechat::add_message_handler ("privmsg", mi_funcion);}@*
2198  @code{sub mi_funcion}@*  @code{sub mi_funcion}@*
2199  @code{@{ }@*  @code{@{ }@*
# Line 1627  Puede ser un comando que ya existe, y en Line 2217  Puede ser un comando que ya existe, y en
2217  el antiguo. Ten cuidado cuando sustituyas a un comando de WeeChat, no podr@'a acceder  el antiguo. Ten cuidado cuando sustituyas a un comando de WeeChat, no podr@'a acceder
2218  al antiguo comando si el script Perl est@'a cargado.  al antiguo comando si el script Perl est@'a cargado.
2219  @item @option{funcion}: funci@'on Perl assiciada al comando.  @item @option{funcion}: funci@'on Perl assiciada al comando.
2220    @item @option{description}: command description (displayed by /help
2221    command)
2222    @item @option{arguments}: short description of command arguments
2223    (displayed by /help command)
2224    @item @option{arguments_description}: long description of command
2225    arguments (displayed by /help command)
2226  @end itemize  @end itemize
2227  @*  @*
2228  @emph{Ejemplo:}@*  @emph{Ejemplo:}@*
2229    @*
2230  @code{weechat::add_command_handler ("comando", mi_comando);}@*  @code{weechat::add_command_handler ("comando", mi_comando);}@*
2231  @code{sub mi_comando}@*  @code{sub mi_comando}@*
2232  @code{@{ }@*  @code{@{ }@*
# Line 1651  Execute a command or send a message to a Line 2248  Execute a command or send a message to a
2248  @end itemize  @end itemize
2249  @*  @*
2250  @emph{Examples:}@*  @emph{Examples:}@*
2251    @*
2252  @code{weechat::command ("hello world!");}@*  @code{weechat::command ("hello world!");}@*
2253  @code{weechat::command ("/kick toto please leave this chan", "#weechat");}@*  @code{weechat::command ("/kick toto please leave this chan", "#weechat");}@*
2254  @code{weechat::command ("/nick newnick", "", "freenode");}@*  @code{weechat::command ("/nick newnick", "", "freenode");}@*
# Line 1664  Obtener informaciones distintas sobre We Line 2262  Obtener informaciones distintas sobre We
2262  @emph{Par@'ametros:}  @emph{Par@'ametros:}
2263  @itemize @minus  @itemize @minus
2264  @item @option{nombre}: nombre de la informaci@'on que se quiere obtener:  @item @option{nombre}: nombre de la informaci@'on que se quiere obtener:
 @item @option{servidor}: nombre interno del servidor  
2265  @itemize @minus  @itemize @minus
2266  @item @option{0 o version}: obtener la versi@'on de WeeChat  @item @option{version}: obtener la versi@'on de WeeChat
2267  @item @option{1 o nick}: obtener el seud@'onimo  @item @option{nick}: obtener el seud@'onimo
2268  @item @option{2 o channel}: obtener el nombre del canal  @item @option{channel}: obtener el nombre del canal
2269  @item @option{3 o server}: obtener el nombre del servidor  @item @option{server}: obtener el nombre del servidor
2270  @item @option{4 o weechatdir}: obtener el directorio home de WeeChat  @item @option{away}: get ``away'' flag
2271  @item @option{5 o away}: obtener la informaci@'on "away" del servidor  @item @option{weechat_dir}: get WeeChat home dir
2272    @item @option{weechat_libdir}: get WeeChat system lib dir
2273    @item @option{weechat_sharedir}: get WeeChat system share dir
2274  @end itemize  @end itemize
2275    @item @option{servidor}: nombre interno del servidor
2276  @end itemize  @end itemize
2277  @*  @*
2278  @emph{Ejemplos:}@*  @emph{Ejemplos:}@*
2279    @*
2280  @code{$version = weechat::get_info("version");}@*  @code{$version = weechat::get_info("version");}@*
2281  @code{$nick = weechat::get_info("nick", "freenode");}@*  @code{$nick = weechat::get_info("nick", "freenode");}@*
2282  @*  @*
2283    
2284    @item
2285    @command{weechat::get_dcc_info ( );}@*
2286    @*
2287    Get DCC list.@*
2288    
2289    Returned array has following fields:
2290    @itemize @minus
2291    @item server: IRC server
2292    @item channel: IRC channel
2293    @item type: DCC type:
2294    @itemize @minus
2295    @item 0: chat (received)
2296    @item 1: chat (sent)
2297    @item 2: file (receiving)
2298    @item 3: file (sending)
2299  @end itemize  @end itemize
2300    @item status: DCC status:
2301    @itemize @minus
2302    @item 0: waiting
2303    @item 1: connecting
2304    @item 2: active
2305    @item 3: done
2306    @item 4: failed
2307    @item 5: aborted
2308    @end itemize
2309    @item start_time: date/time of DCC creation
2310    @item start_transfer: date/time of transfer start
2311    @item addr: remote address
2312    @item port: port used for DCC
2313    @item nick: remote nick
2314    @item filename: filename
2315    @item local_filename: local filename
2316    @item size: file size
2317    @item pos: current position in file
2318    @item start_resume: restart position after interruption
2319    @item bytes_per_sec: bytes sent/received per second
2320    @end itemize
2321    @*
2322    
2323  @node Programas Python, Programas Ruby, Programas Perl, Extensiones  @item
2324  @section Programas Python  @command{weechat::get_config ( name );}@*
2325    @*
2326    Get WeeChat config option value.@*
2327    
2328  @subsection Cargar/descargar programas Python  @emph{Arguments:}
2329    @itemize @minus
2330    @item @option{name}: name of option
2331    @end itemize
2332    @*
2333    @emph{Examples:}@*
2334    @*
2335    @code{$value1 = weechat::get_config ("look_set_title");}@*
2336    @code{$value2 = weechat::get_config ("freenode.server_autojoin");}@*
2337    @*
2338    
2339    @end itemize
2340    
2341    @subsection Python scripts
2342    
2343    @subsubsection Cargar/descargar programas Python
2344    
2345  Los programas Python se cargan y descargan con el comando @command{/python}  Los programas Python se cargan y descargan con el comando @command{/python}
2346  (escribiendo @kbd{/help python} en WeeChat para obtener la ayuda acerca del comando).@*  (escribiendo @kbd{/help python} en WeeChat para obtener la ayuda acerca del comando).@*
# Line 1699  Cargar un programa Python: @kbd{/python Line 2354  Cargar un programa Python: @kbd{/python
2354  Listar los programas Python cargados: @kbd{/python}@*  Listar los programas Python cargados: @kbd{/python}@*
2355  @end itemize  @end itemize
2356    
2357  @subsection Interfaz WeeChat / Python  @subsubsection Interfaz WeeChat / Python
2358    
2359  @itemize @bullet  @itemize @bullet
2360  @item  @item
# Line 1719  tener un nombre distinto) Line 2374  tener un nombre distinto)
2374  @end itemize  @end itemize
2375  @*  @*
2376  @emph{Ejemplo:}@*  @emph{Ejemplo:}@*
2377    @*
2378  @code{weechat.register ("ejemplo", "1.0", "fin_ejemplo", "programa de ejemplo...")}@*  @code{weechat.register ("ejemplo", "1.0", "fin_ejemplo", "programa de ejemplo...")}@*
2379  @*  @*
2380    
# Line 1734  Escribe un mensaje en un canal.@* Line 2390  Escribe un mensaje en un canal.@*
2390  @item @option{servidor}: (opcional) nombre interno del servidor  @item @option{servidor}: (opcional) nombre interno del servidor
2391  @end itemize  @end itemize
2392  @*  @*
2393  @emph{Ejemplo:}@*  @emph{Ejemplos:}@*
2394    @*
2395  @code{weechat.prnt ("mensaje")}@*  @code{weechat.prnt ("mensaje")}@*
2396  @code{weechat.prnt ("mensaje", "#weechat")}@*  @code{weechat.prnt ("mensaje", "#weechat")}@*
2397  @code{weechat.prnt ("mensaje", "#weechat", "freenode")}@*  @code{weechat.prnt ("mensaje", "#weechat", "freenode")}@*
# Line 1753  Escribir un mensaje en la barra de infor Line 2410  Escribir un mensaje en la barra de infor
2410  @end itemize  @end itemize
2411  @*  @*
2412  @emph{Ejemplo:}@*  @emph{Ejemplo:}@*
2413    @*
2414  @code{weechat.print_infobar (5, "mensaje")}@*  @code{weechat.print_infobar (5, "mensaje")}@*
2415  @*  @*
2416    
# Line 1773  RFC 2812: @uref{ftp://ftp.rfc-editor.org Line 2431  RFC 2812: @uref{ftp://ftp.rfc-editor.org
2431  @end itemize  @end itemize
2432  @*  @*
2433  @emph{Ejemplo:}@*  @emph{Ejemplo:}@*
2434    @*
2435  @code{weechat.add_message_handler ("privmsg", mi_funcion)}@*  @code{weechat.add_message_handler ("privmsg", mi_funcion)}@*
2436  @code{def mi_funcion(servidor, args):}@*  @code{def mi_funcion(servidor, args):}@*
2437  @code{@ @ @ @ weechat.prnt("servidor="+servidor)}@*  @code{@ @ @ @ weechat.prnt("servidor="+servidor)}@*
# Line 1794  Puede ser un comando que ya existe, y en Line 2453  Puede ser un comando que ya existe, y en
2453  el antiguo. Ten cuidado cuando sustituyas a un comando de WeeChat, no podr@'a acceder  el antiguo. Ten cuidado cuando sustituyas a un comando de WeeChat, no podr@'a acceder
2454  al antiguo comando si el script Python est@'a cargado.  al antiguo comando si el script Python est@'a cargado.
2455  @item @option{funcion}: funci@'on Python assiciada al comando.  @item @option{funcion}: funci@'on Python assiciada al comando.
2456    @item @option{description}: command description (displayed by /help
2457    command)
2458    @item @option{arguments}: short description of command arguments
2459    (displayed by /help command)
2460    @item @option{arguments_description}: long description of command
2461    arguments (displayed by /help command)
2462  @end itemize  @end itemize
2463  @*  @*
2464  @emph{Ejemplo:}@*  @emph{Ejemplo:}@*
2465    @*
2466  @code{weechat.add_command_handler ("comando", mi_comando)}@*  @code{weechat.add_command_handler ("comando", mi_comando)}@*
2467  @code{def mi_comando(servidor, args):}@*  @code{def mi_comando(servidor, args):}@*
2468  @code{@ @ @ @ weechat.prnt("Servidor:"+servidor+" Par@'ametros:"+args)}@*  @code{@ @ @ @ weechat.prnt("Servidor:"+servidor+" Par@'ametros:"+args)}@*
# Line 1815  Execute a command or send a message to a Line 2481  Execute a command or send a message to a
2481  @end itemize  @end itemize
2482  @*  @*
2483  @emph{Examples:}@*  @emph{Examples:}@*
2484    @*
2485  @code{weechat.command ("hello world!")}@*  @code{weechat.command ("hello world!")}@*
2486  @code{weechat.command ("/kick toto please leave this chan", "#weechat")}@*  @code{weechat.command ("/kick toto please leave this chan", "#weechat")}@*
2487  @code{weechat.command ("/nick newnick", "", "freenode")}@*  @code{weechat.command ("/nick newnick", "", "freenode")}@*
# Line 1828  Obtener informaciones distintas sobre We Line 2495  Obtener informaciones distintas sobre We
2495  @emph{Par@'ametros:}  @emph{Par@'ametros:}
2496  @itemize @minus  @itemize @minus
2497  @item @option{nombre}: nombre de la informaci@'on que se quiere obtener:  @item @option{nombre}: nombre de la informaci@'on que se quiere obtener:
 @item @option{servidor}: nombre interno del servidor  
2498  @itemize @minus  @itemize @minus
2499  @item @option{0 o version}: obtener la versi@'on de WeeChat  @item @option{version}: obtener la versi@'on de WeeChat
2500  @item @option{1 o nick}: obtener el seud@'onimo  @item @option{nick}: obtener el seud@'onimo
2501  @item @option{2 o channel}: obtener el nombre del canal  @item @option{channel}: obtener el nombre del canal
2502  @item @option{3 o server}: obtener el nombre del servidor  @item @option{server}: obtener el nombre del servidor
2503  @item @option{4 o weechatdir}: obtener el directorio home de WeeChat  @item @option{away}: get ``away'' flag
2504  @item @option{5 o away}: obtener la informaci@'on "away" del servidor  @item @option{weechat_dir}: get WeeChat home dir
2505    @item @option{weechat_libdir}: get WeeChat system lib dir
2506    @item @option{weechat_sharedir}: get WeeChat system share dir
2507  @end itemize  @end itemize
2508    @item @option{servidor}: nombre interno del servidor
2509  @end itemize  @end itemize
2510  @*  @*
2511  @emph{Ejemplos:}@*  @emph{Ejemplos:}@*
2512    @*
2513  @code{$version = weechat.get_info("version")}@*  @code{$version = weechat.get_info("version")}@*
2514  @code{$nick = weechat.get_info("nick", "freenode")}@*  @code{$nick = weechat.get_info("nick", "freenode")}@*
2515  @*  @*
2516    
2517    @item
2518    @command{weechat.get_dcc_info ( );}@*
2519    @*
2520    Get DCC list.@*
2521    
2522    Returned array has following fields:
2523    @itemize @minus
2524    @item server: IRC server
2525    @item channel: IRC channel
2526    @item type: DCC type:
2527    @itemize @minus
2528    @item 0: chat (received)
2529    @item 1: chat (sent)
2530    @item 2: file (receiving)
2531    @item 3: file (sending)
2532  @end itemize  @end itemize
2533    @item status: DCC status:
2534    @itemize @minus
2535    @item 0: waiting
2536    @item 1: connecting
2537    @item 2: active
2538    @item 3: done
2539    @item 4: failed
2540    @item 5: aborted
2541    @end itemize
2542    @item start_time: date/time of DCC creation
2543    @item start_transfer: date/time of transfer start
2544    @item addr: remote address
2545    @item port: port used for DCC
2546    @item nick: remote nick
2547    @item filename: filename
2548    @item local_filename: local filename
2549    @item size: file size
2550    @item pos: current position in file
2551    @item start_resume: restart position after interruption
2552    @item bytes_per_sec: bytes sent/received per second
2553    @end itemize
2554    @*
2555    
2556  @node Programas Ruby, , Programas Python, Extensiones  @item
2557  @section Programas Ruby  @command{weechat.get_config ( name );}@*
2558    @*
2559    Get WeeChat config option value.@*
2560    
2561    @emph{Arguments:}
2562    @itemize @minus
2563    @item @option{name}: name of option
2564    @end itemize
2565    @*
2566    @emph{Examples:}@*
2567    @*
2568    @code{$value1 = weechat.get_config ("look_set_title");}@*
2569    @code{$value2 = weechat.get_config ("freenode.server_autojoin");}@*
2570    @*
2571    
2572    @end itemize
2573    
2574    @subsection Ruby scripts
2575    
2576  @exclamdown{}No desarrollado!  @exclamdown{}No desarrollado!
2577    
2578    
2579  @c **************************** Autores / Soporte *****************************  @c **************************** Autores / Soporte *****************************
2580    
2581  @node Autores / Soporte, , Extensiones, Top  @node Autores / Soporte, , Plugins, Top
2582  @chapter Autores / Soporte  @chapter Autores / Soporte
2583    
2584  @ifhtml  @ifhtml

Legend:
Removed from v.1.25  
changed lines
  Added in v.1.26

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26