mirror of
https://github.com/weechat/weechat.git
synced 2026-07-05 01:03:14 +02:00
Rename developer doc (-devel to -dev)
This commit is contained in:
@@ -0,0 +1,257 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
|
||||
WeeChat documentation (german version)
|
||||
|
||||
Copyright (c) 2003-2008 by FlashCode <flashcode@flashtux.org>
|
||||
|
||||
This manual is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This manual is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
-->
|
||||
|
||||
<chapter id="chapPlugins">
|
||||
<title>Plugins</title>
|
||||
|
||||
<para>
|
||||
<!-- TRANSLATION NEEDED -->
|
||||
This chapter describes WeeChat plugin API and default plugins provided with
|
||||
WeeChat.
|
||||
</para>
|
||||
|
||||
<section id="secPluginsInWeeChat">
|
||||
<title>Plugins in WeeChat</title>
|
||||
|
||||
<para>
|
||||
Ein Plugin ist ein C-Programm, dass WeeChat-Funktionen aufrufen kann,
|
||||
die in einem Interface definiert sind.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Dieses C-Programm braucht nicht den Quellcode von WeeChat (aber die
|
||||
API-Beschreibung) und kann dynamisch mit dem folgenden Kommando in
|
||||
WeeChat geladen werden
|
||||
<command>/plugin</command>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Das Plugin muss in Form einer dynamischen Bibliothek vorliegen,
|
||||
damit es das Betriebssystem dynamisch laden kann.
|
||||
Unter GNU/Linux besitzt die Datei die Endung ".so", unter
|
||||
Windows ".dll".
|
||||
</para>
|
||||
|
||||
</section>
|
||||
|
||||
<section id="secWriteAPlugin">
|
||||
<title>Ein Plugin schreiben</title>
|
||||
|
||||
<para>
|
||||
Das Plugin muss die Datei "weechat-plugin.h" einbinden (verfügbar
|
||||
im WeeChat-Quellcode).
|
||||
Diese Datei definiert die Strukturen und Typen um mit WeeChat
|
||||
zu kommunizieren.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<!-- TRANSLATION NEEDED -->
|
||||
The plugin must use some mandatory macros (to define some variables)
|
||||
and some functions (without them the plugin can't load):
|
||||
|
||||
<informaltable colsep="0" frame="none">
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Macro</entry>
|
||||
<entry>Description</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><literal>WEECHAT_PLUGIN_NAME</literal></entry>
|
||||
<entry>plugin name</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>WEECHAT_PLUGIN_DESCRIPTION</literal></entry>
|
||||
<entry>short description of plugin</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>WEECHAT_PLUGIN_VERSION</literal></entry>
|
||||
<entry>plugin version</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>WEECHAT_PLUGIN_WEECHAT_VERSION</literal></entry>
|
||||
<entry>
|
||||
target WeeChat version where plugin will run (warning: plugin
|
||||
will not run on any other WeeChat version!)
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>WEECHAT_PLUGIN_LICENSE</literal></entry>
|
||||
<entry>plugin license</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
|
||||
<informaltable colsep="0" frame="none">
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Funktion</entry>
|
||||
<entry>Beschreibung</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><literal>int weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])</literal></entry>
|
||||
<entry>
|
||||
<!-- TRANSLATION NEEDED -->
|
||||
function called when plugin is loaded, must return
|
||||
WEECHAT_RC_OK if successful, WEECHAT_RC_ERROR if error
|
||||
(if error, plugin will NOT be loaded), argc/argv are arguments
|
||||
for plugin (given on command line by user)
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>int weechat_plugin_end (struct t_weechat_plugin *plugin)</literal></entry>
|
||||
<entry>Funktion wird beim Abschalten aufgerufen</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
|
||||
<!-- &plugin_api.de.xml; -->
|
||||
|
||||
<section id="secCompilePlugin">
|
||||
<title>Übersetzen eines Plugins</title>
|
||||
|
||||
<para>
|
||||
Das Übersetzen braucht keine WeeChat-Quellen, aber die Datei
|
||||
"<literal>weechat-plugin.h</literal>".
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Um ein Plugin zu übersetzen, das aus einer Datei "toto.c" besteht
|
||||
(unter GNU/Linux):
|
||||
<screen>
|
||||
<prompt>$ </prompt><userinput>gcc -fPIC -Wall -c toto.c</userinput>
|
||||
<prompt>$ </prompt><userinput>gcc -shared -fPIC -o libtoto.so toto.o</userinput>
|
||||
</screen>
|
||||
</para>
|
||||
|
||||
</section>
|
||||
|
||||
<section id="secLoadPlugin">
|
||||
<title>Laden des Plugins in WeeChat</title>
|
||||
|
||||
<para>
|
||||
Kopiere die Datei "libtoto.so" in das Plugin-Verzeichnis der
|
||||
systemweiten Dateien WeeChats (zum Beispiel:
|
||||
"<literal>/usr/local/lib/weechat/plugins</literal>") oder in das
|
||||
Plugin-Verzeichnis des Users (zum Beispiel:
|
||||
"<literal>/home/xxxxx/.weechat/plugins</literal>").
|
||||
</para>
|
||||
|
||||
<para>
|
||||
In WeeChat:
|
||||
<screen><userinput>/plugin load toto</userinput></screen>
|
||||
</para>
|
||||
|
||||
</section>
|
||||
|
||||
<section id="secPluginExample">
|
||||
<title>Plugin Beispiel</title>
|
||||
|
||||
<para>
|
||||
<!-- TRANSLATION NEEDED -->
|
||||
Full example of plugin, which adds a /double command, which displays
|
||||
two times arguments on current buffer, or execute two times a command
|
||||
(ok that's not very useful, but that's just an example!):
|
||||
<screen>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "weechat-plugin.h"
|
||||
|
||||
WEECHAT_PLUGIN_NAME("double");
|
||||
WEECHAT_PLUGIN_DESCRIPTION("Test plugin for WeeChat");
|
||||
WEECHAT_PLUGIN_AUTHOR("FlashCode <flashcode@flashtux.org>");
|
||||
WEECHAT_PLUGIN_VERSION("0.1");
|
||||
WEECHAT_PLUGIN_WEECHAT_VERSION("0.2.7");
|
||||
WEECHAT_PLUGIN_LICENSE("GPL3");
|
||||
|
||||
struct t_weechat_plugin *weechat_plugin = NULL;
|
||||
|
||||
|
||||
/* "/double" command manager */
|
||||
|
||||
int
|
||||
double_cmd (void *data, struct t_gui_buffer *buffer, int argc,
|
||||
char **argv, char **argv_eol)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) argv;
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
weechat_command (NULL, argv_eol[1]);
|
||||
weechat_command (NULL, argv_eol[1]);
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
int
|
||||
weechat_plugin_init (struct t_weechat_plugin *plugin,
|
||||
int argc, char *argv[])
|
||||
{
|
||||
weechat_plugin = plugin;
|
||||
|
||||
weechat_hook_command ("double",
|
||||
"Display two times a message",
|
||||
"msg",
|
||||
"msg: message to display two times",
|
||||
NULL,
|
||||
&double_cmd, NULL);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
int
|
||||
weechat_plugin_end (struct t_weechat_plugin *plugin)
|
||||
{
|
||||
/* nothing done here */
|
||||
(void) plugin;
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
</screen>
|
||||
</para>
|
||||
|
||||
</section>
|
||||
|
||||
</section>
|
||||
|
||||
&plugin_irc.de.xml;
|
||||
|
||||
<!-- &plugin_charset.de.xml; -->
|
||||
|
||||
&plugin_fifo.de.xml;
|
||||
|
||||
<!-- &plugin_scripts.de.xml; -->
|
||||
|
||||
&plugin_xfer.de.xml;
|
||||
|
||||
</chapter>
|
||||
Reference in New Issue
Block a user