diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index 085727fc2..45beff055 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -77,7 +77,7 @@ IF(BUILD_HTML OR BUILD_PDF)
OUTPUT_VARIABLE DOC_DATE
)
STRING(REPLACE "\n" "" DOC_DATE "${DOC_DATE}")
-
+
CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/date.xml.in
${CMAKE_CURRENT_BINARY_DIR}/date.xml
@@ -116,7 +116,7 @@ IF(BUILD_HTML OR BUILD_PDF)
${CMAKE_CURRENT_SOURCE_DIR}/weechat-html-one.xsl.in
${CMAKE_CURRENT_SOURCE_DIR}/weechat-html.xsl.in
${CMAKE_CURRENT_SOURCE_DIR}/weechat-doc.css
- COMMENT "Building html doc (${dlang})"
+ COMMENT "Building user guide - html doc (${dlang})"
)
ADD_CUSTOM_TARGET(doc-user-html-${dlang} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}/user/index.html)
ADD_CUSTOM_TARGET(doc-user-html-one-${dlang} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/html-one/${dlang}/user/weechat_user.${dlang}.html)
@@ -145,7 +145,7 @@ IF(BUILD_HTML OR BUILD_PDF)
${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/autogen/*
${CMAKE_CURRENT_SOURCE_DIR}/date.xml.in
${CMAKE_CURRENT_SOURCE_DIR}/weechat-html-one.xsl.in
- COMMENT "Building pdf doc (${dlang})"
+ COMMENT "Building user guide - pdf doc (${dlang})"
)
ADD_CUSTOM_TARGET(doc-user-pdf-${dlang} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/pdf/${dlang}/user/weechat_user.${dlang}.pdf)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pdf/${dlang}/user/weechat_user.${dlang}.pdf DESTINATION share/doc/${PROJECT_NAME})
@@ -184,7 +184,7 @@ IF(BUILD_HTML OR BUILD_PDF)
${CMAKE_CURRENT_SOURCE_DIR}/weechat-html-one.xsl.in
${CMAKE_CURRENT_SOURCE_DIR}/weechat-html.xsl.in
${CMAKE_CURRENT_SOURCE_DIR}/weechat-doc.css
- COMMENT "Building html doc (${dlang})"
+ COMMENT "Building developer guide - html doc (${dlang})"
)
ADD_CUSTOM_TARGET(doc-dev-html-${dlang} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}/dev/index.html)
ADD_CUSTOM_TARGET(doc-dev-html-one-${dlang} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/html-one/${dlang}/dev/weechat_dev.${dlang}.html)
@@ -213,7 +213,7 @@ IF(BUILD_HTML OR BUILD_PDF)
${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/autogen/*
${CMAKE_CURRENT_SOURCE_DIR}/date.xml.in
${CMAKE_CURRENT_SOURCE_DIR}/weechat-html-one.xsl.in
- COMMENT "Building pdf doc (${dlang})"
+ COMMENT "Building developer guide - pdf doc (${dlang})"
)
ADD_CUSTOM_TARGET(doc-dev-pdf-${dlang} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/pdf/${dlang}/dev/weechat_dev.${dlang}.pdf)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pdf/${dlang}/dev/weechat_dev.${dlang}.pdf DESTINATION share/doc/${PROJECT_NAME})
diff --git a/doc/de/Makefile.am b/doc/de/Makefile.am
index 8c4363402..dae10391b 100644
--- a/doc/de/Makefile.am
+++ b/doc/de/Makefile.am
@@ -48,29 +48,29 @@ BOOK_COMMON_INCLUDE = authors.$(LANGCODE).xml \
intro.$(LANGCODE).xml
BOOK_USER = weechat_user.$(LANGCODE)
-BOOK_USER_INCLUDE = user/install.$(LANGCODE).xml \
- user/usage.$(LANGCODE).xml \
- user/plugins.$(LANGCODE).xml \
- user/plugin_alias.$(LANGCODE).xml \
- user/plugin_aspell.$(LANGCODE).xml \
- user/plugin_charset.$(LANGCODE).xml \
- user/plugin_fifo.$(LANGCODE).xml \
- user/plugin_irc.$(LANGCODE).xml \
- user/plugin_logger.$(LANGCODE).xml \
- user/plugin_scripts.$(LANGCODE).xml \
+BOOK_USER_INCLUDE = user/install.$(LANGCODE).xml \
+ user/usage.$(LANGCODE).xml \
+ user/plugins.$(LANGCODE).xml \
+ user/plugin_alias.$(LANGCODE).xml \
+ user/plugin_aspell.$(LANGCODE).xml \
+ user/plugin_charset.$(LANGCODE).xml \
+ user/plugin_fifo.$(LANGCODE).xml \
+ user/plugin_irc.$(LANGCODE).xml \
+ user/plugin_logger.$(LANGCODE).xml \
+ user/plugin_scripts.$(LANGCODE).xml \
user/plugin_xfer.$(LANGCODE).xml
BOOK_DEV = weechat_dev.$(LANGCODE)
-BOOK_DEV_INCLUDE = dev/plugin_api.$(LANGCODE).xml \
- dev/plugin_scripts.$(LANGCODE).xml \
- dev/plugins.$(LANGCODE).xml \
- dev/weechat_dev.$(LANGCODE).xml
+BOOK_DEV_INCLUDE = dev/plugins.$(LANGCODE).xml \
+ dev/plugin_api.$(LANGCODE).xml \
+ dev/plugin_c_api.$(LANGCODE).xml \
+ dev/plugin_script_api.$(LANGCODE).xml
QUICKSTART = weechat_quickstart.$(LANGCODE).txt
-EXTRA_DIST = $(BOOK_AUTOGEN_INCLUDE) $(BOOK_COMMON_INCLUDE) \
- user/$(BOOK_USER).xml $(BOOK_USER_INCLUDE) \
- dev/$(BOOK_DEV).xml $(BOOK_DEV_INCLUDE) \
+EXTRA_DIST = $(BOOK_AUTOGEN_INCLUDE) $(BOOK_COMMON_INCLUDE) \
+ user/$(BOOK_USER).xml $(BOOK_USER_INCLUDE) \
+ dev/$(BOOK_DEV).xml $(BOOK_DEV_INCLUDE) \
$(QUICKSTART)
if DBLATEX_FOUND
diff --git a/doc/de/dev/plugin_api.de.xml b/doc/de/dev/plugin_api.de.xml
index fed1bc6d6..f67bae785 100644
--- a/doc/de/dev/plugin_api.de.xml
+++ b/doc/de/dev/plugin_api.de.xml
@@ -21,3507 +21,12 @@ along with this program. If not, see .
-->
-
+
Plugin API
-
- set_charset
-
-
- Prototyp:
-
- void set_charset (t_weechat_plugin *plugin, char *charset)
-
-
-
- Legt neuen Zeichensatz für ein Plugin fest.
-
-
- Argumente:
-
-
-
- : Zeiger auf Plugin-Struktur
-
-
-
-
- : neuer Zeichensatz, der benutzt
- werden soll
-
-
-
-
-
- Beispiel:
- plugin->set_charset (plugin, "ISO-8859-1");
-
-
+ &plugin_c_api.de.xml;
-
- iconv_to_internal
-
-
- Prototyp:
-
- void iconv_to_internal (t_weechat_plugin *plugin, char *charset,
- char *string)
-
-
-
- Konvertiert eine Zeichenkette in das interne Format von WeeChat
- (UTF-8).
-
-
- Argumente:
-
-
-
- : Zeiger auf Plugin-Struktur
-
-
-
-
- : ursprünglicher Zeichensatz, von
- dem konvertiert werden soll
-
-
-
-
- : zu konvertierende Zeichenkette
-
-
-
-
-
- Rückgabewert: konvertierte Zeichenkette
-
-
- Anmerkung: der Speicher, der durch das Ergebnis belegt wird, muss
- mit free() wieder freigegeben werden.
-
-
- Beispiel:
- char *str = plugin->iconv_to_internal (plugin, "ISO-8859-1", "iso string: é à");
-
-
+
-
- iconv_from_internal
-
-
- Prototyp:
-
- void iconv_from_internal (t_weechat_plugin *plugin, char *charset,
- char *string)
-
-
-
- Konvertiert eine Zeichenkette von dem internen WeeChat-Zeichensatz
- (UTF-8) in einen anderen.
-
-
- Argumente:
-
-
-
- : Zeiger auf Plugin-Struktur
-
-
-
-
- : Ziel-Zeichensatz
-
-
-
-
- : zu konvertierende Zeichenkette
-
-
-
-
-
- Rückgabewert: konvertierte Zeichenkette
-
-
- Anmerkung: der Speicher, der durch das Ergebnis belegt wird, muss
- mit free() wieder freigegeben werden.
-
-
- Beispiel:
- char *str = plugin->iconv_from_internal (plugin, "ISO-8859-1", "utf-8 string: é à");
-
-
-
-
- ascii_strcasecmp
-
-
- Prototyp:
-
- int ascii_strcasecmp (t_weechat_plugin *plugin,
- char *string1, char *string2)
-
-
-
- Vergleich von Zeichenketten unabhängig von Sprache und
- Schreibweise (gross/klein).
-
-
- Argumente:
-
-
-
- : Zeiger auf Plugin-Struktur
-
-
-
-
- : erste Zeichenkette des Vergleichs
-
-
-
-
- : zweite Zeichenkette des Vergleichs
-
-
-
-
-
- Rückgabewert: Unterschied zwischen den zwei Zeichenketten: kleiner
- Null wenn
- string1 < string2, Null wenn string1 == string2, grösser Null
- wenn string1 > string2
-
-
- Beispiel:
- if (plugin->ascii_strcasecmp (plugin, "abc", "def") != 0) ...
-
-
-
-
- ascii_strncasecmp
-
-
- Prototyp:
-
- int ascii_strncasecmp (t_weechat_plugin *plugin,
- char *string1, char *string2, int max)
-
-
-
- Vergleich von Zeichenketten unabhängig von Sprache und Schreibweise
- (gross/klein) für höchstens "max" Zeichen.
-
-
- Argumente:
-
-
-
- : Zeiger auf Plugin-Struktur
-
-
-
-
- : erste Zeichenkette des Vergleichs
-
-
-
-
- : zweite Zeichenkette des Vergleichs
-
-
-
-
- : maximale Zahl an Zeichen für den
- Vergleich
-
-
-
-
-
- Rückgabewert: Unterschied zwischen den zwei Zeichenketten: kleiner
- Null wenn string1 < string2, Null wenn string1 == string2,
- grösser Null wenn string1 > string2
-
-
- Beispiel:
- if (plugin->ascii_strncasecmp (plugin, "abc", "def", 2) != 0) ...
-
-
-
-
- explode_string
-
-
- Prototyp:
-
- char **explode_string (t_weechat_plugin *plugin, char *string,
- char *separators, int num_items_max, int *num_items)
-
-
-
- Zerlege eine Zeichenkette entsprechend eines oder mehrerer
- Trennzeichen(s).
-
-
- Argumente:
-
-
-
- : Zeiger auf eine Plugin-Struktur
-
-
-
-
- : zu zerlegende Zeichenkette
-
-
-
-
- : zu verwendende(s) Trennzeichen
-
-
-
-
- : maximale Anzahl an zu
- erzeugenden Teilen (0 = keine Grenze)
-
-
-
-
- : Zeiger auf eine int-Variable,
- die die Anzahl der erzeugten
- Teile enthält
-
-
-
-
-
- Rückgabewert: ein Array von Zeichenketten, NULL bei Fehlern.
-
-
- Hinweis: Das zurückgegebene Array muss nach der Benutzung mittels
- "free_exloded_string" explizit freigegeben werden.
-
-
- Beispiel:
-
-char **argv;
-int argc;
-argv = plugin->explode_string (plugin, string, " ", 0, &argc);
-...
-if (argv != NULL)
- plugin->free_exploded_string (plugin, argv);
-
-
-
-
-
- free_exploded_string
-
-
- Prototyp:
-
- char **free_exploded_string (t_weechat_plugin *plugin,
- char **string)
-
-
-
- Gib ein Array frei, dass infolge der Zerlegung eines Strings
- reserviert wurde.
-
-
- Argumente:
-
-
-
- : Zeiger auf eine Plugin-Struktur
-
-
-
-
- : ein Array von Strings
-
-
-
-
-
- Rückgabewert: keiner (?).
-
-
- Beispiel:
-
-char *argv;
-int argc;
-argv = plugin->explode_string (plugin, string, " ", 0, &argc);
-...
-if (argv != NULL)
- plugin->free_exploded_string (plugin, argv);
-
-
-
-
-
- mkdir_home
-
-
- Prototyp:
-
- int mkdir_home (t_weechat_plugin *plugin, char *directory)
-
-
-
- Erzeugt ein Verzeichnis im WeeChat-Verzeichnis.
-
-
- Argumente:
-
-
-
- : Zeiger auf Pluginstrukur
-
-
-
-
- : Verzeichnis, das erzeugt werden
- soll
-
-
-
-
-
- Rückgabewert: 1 wenn das Verzeichnis erfolgreich erstellt wurde, 0
- wenn ein Fehler aufgetreten ist.
-
-
- Beispiel:
-
-if (!plugin->mkdir_home (plugin, "temp"))
- plugin->print_server(plugin, "Konnte 'temp'-Verzeichnis im WeeChat-Verzeichnis nicht erstellen.");
-
-
-
-
-
- exec_on_files
-
-
- Prototyp:
-
- void exec_on_files (t_weechat_plugin *plugin, char *repertoire,
- int (*callback)(t_weechat_plugin *, char *))
-
-
-
- Führe eine Funktion auf allen Dateien eines Verzeichnisses aus.
-
-
- Argumente:
-
-
-
- : Zeiger auf eine Plugin-Struktur
-
-
-
-
- : Verzeichnis der zu verwendenden
- Dateien
-
-
-
-
- : die anzuwendende Funktion
-
-
-
-
-
- Rückgabewert: keiner.
-
-
- Beispiel:
-
-int callback (t_weechat_plugin *plugin, char *file)
-{
- plugin->print_server (plugin, "file: %s", file);
- return 1;
-}
-...
-plugin->exec_on_files (plugin, "/tmp", &callback);
-
-
-
-
-
- print
-
-
- Prototyp:
-
- void print (t_weechat_plugin *plugin,
- char *server, char *channel, char *message, ...)
-
-
-
- Sende eine Nachricht an einen WeeChat-Puffer, bezeichnet durch
- server und channel (beide können NULL sein, dann wird der aktuelle
- Puffer verwendet).
-
-
- Argumente:
-
-
-
- : Zeiger auf Plugin-Struktur
-
-
-
-
- : interner Name des Servers, zu
- welchem der Puffer gehört, in dem die Nachricht angezeigt
- werden soll (kann NULL sein)
-
-
-
-
- : Name des Channels, in dem die
- Nachricht angezeigt werden soll (kann NULL sein)
-
-
-
-
- : Nachricht
-
-
-
-
-
-
- To display colored text, there are following codes:
-
-
-
-
- Code
- Description
-
-
-
-
- 0x02
-
- bold text
-
-
-
- 0x03 + "xx"
-
- text color "xx"
- (see for colors)
-
-
-
- 0x03 + "xx,yy"
-
- text color "xx"
- and background "yy"
- (see for colors)
-
-
-
- 0x0F
-
- disable color and attributes
-
-
-
- 0x12
-
- reverse video (revert text color with background)
-
-
-
- 0x1F
-
- underlined text
-
-
-
-
-
- Note: the same code (without number for 0x03) may be used to stop
- the attribute.
-
-
- Rückgabewert: keiner.
-
-
- Beispiele:
-
-plugin->print (plugin, NULL, NULL, "hello");
-plugin->print (plugin, NULL, "#weechat", "hello");
-plugin->print (plugin, "freenode", "#weechat", "hello");
-plugin->print (plugin, NULL, NULL,
- "Test: \x02 Fett \x0F\x03%02d Blau \x03%02d Grün",
- plugin->get_irc_color (plugin, "blue"),
- plugin->get_irc_color (plugin, "green"));
-
-
-
-
-
- print_server
-
-
- Prototyp:
-
- void print_server (t_weechat_plugin *plugin,
- char *message, ...)
-
-
-
- Zeige eine Nachricht im aktuellen Server-Puffer.
-
-
- Argumente:
-
-
-
- : Zeiger auf eine Plugin-Struktur
-
-
-
-
- : Nachricht
-
-
-
-
-
-
- To display colored text, see .
-
-
- Rückgabewert: keiner.
-
-
- Beispiel: plugin->print_server (plugin, "hello");
-
-
-
-
- log
-
-
- Prototyp:
-
- void log (t_weechat_plugin *plugin,
- char *server, char *channel, char *message, ...)
-
-
-
- Schreibe eine Nachricht in die Log-Datei (für den entsprechenden
- Server/Channel).
-
-
- Argumente:
-
-
-
- : Zeiger auf eine Plugin-Struktur
-
-
-
-
- : interner Name des Servers, zu
- welchem der Log-Puffer gehört (kann NULL sein)
-
-
-
-
- : Name des Channels, zu welchem der
- Log-Puffer gehört (kann NULL sein)
-
-
-
-
- : Nachricht
-
-
-
-
-
- Rückgabewert: keiner.
-
-
- Beispiel:
-
-plugin->log (plugin, "freenode", "#weechat", "test");
-
-
-
-
-
- msg_handler_add
-
-
- Prototyp:
-
- t_plugin_handler *msg_handler_add (t_weechat_plugin
- *plugin, char *message, t_plugin_handler_func *function,
- char *handler_args, void *handler_pointer)
-
-
-
- Erzeuge einen IRC-Message-Handler, der aufgerufen wird, wenn
- eine Nachricht empfangen wird.
-
-
- Argumente:
-
-
-
- : Zeiger auf eine Plugin-Struktur
-
-
-
-
- : Name (Typ) der IRC-Nachricht ("*"
- für alle Nachrichten).
- Eine Liste der bekannten IRC-Nachrichten ist in den
- RFCs
- 1459
- und
- 2812
- zu finden.
- Weiterhin können sie einen speziellen Namen verwenden, der
- mit "weechat_" beginnt, um spezielle Ereignisse zu
- bearbeiten, wie in der folgenden Tabelle aufgeführt:
-
-
-
-
- Name
- Beschreibung
-
-
-
-
- weechat_pv
- private Nachricht empfangen
-
-
- weechat_highlight
-
- hervorgehobene Nachricht (in einem Channel oder privatem Chat)
-
-
-
- weechat_ctcp
-
- CTCP-Nachricht empfangen (VERSION, PING, ...)
-
-
-
- weechat_dcc
-
- DCC-Nachricht empfangen (Chat oder Datei)
-
-
-
-
-
-
-
-
-
- : Funktion, die aufgerufen wird,
- wenn eine Nachricht empfangen wurde
-
-
- Sie verwendet den folgenden Prototyp:
-
- int my_function (t_weechat_plugin *plugin,
- int argc, char **argv,
- char *handler_args, void *handler_pointer)
-
-
-
- Argument argc ist auf 3 gesetzt, die folgenden Werte sind
- im argv-Array:
-
-
- argv[0] = Server Name
-
-
- argv[1] = IRC Nachricht
-
-
- argv[2] = Kommando Argumente
-
-
-
-
-
-
- : Argumente, die beim Aufruf
- an die Funktion übergeben werden
-
-
-
-
- : pointer given to function
- when called
- : Zeiger, der an die Funktion
- übergeben wird
-
-
-
-
-
- Rückgabewert: Zeiger auf den neuen Handler
-
-
- Hinweis: die Funktion, die aufgerufen wird wenn eine Nachricht
- empfangen wurde, muss einen der folgenden Werte zurückgeben:
-
-
-
- PLUGIN_RC_KO: Funktion ist fehlgschlagen
-
-
-
-
- PLUGIN_RC_OK: Funktion war erfolgreich
-
-
-
-
- PLUGIN_RC_OK_IGNORE_WEECHAT: Die Nachricht
- wird nicht an WeeChat übergeben
-
-
-
-
- PLUGIN_RC_OK_IGNORE_PLUGINS: Die Nachricht
- wird nicht an andere Plugins weitergegeben
-
-
-
-
- PLUGIN_RC_OK_IGNORE_ALL: Die Nachricht
- wird weder an WeeChat noch an andere
- Plugins weitergegeben
-
-
-
-
- PLUGIN_RC_OK_WITH_HIGHLIGHT: Funktion
- erfolgreich vervollständigt und eine Hervorhebung bei den
- empfangenen Nachrichten eingebaut
-
-
-
-
-
- Beispiel:
-
-int msg_kick (t_weechat_plugin *plugin, int argc, char **argv,
- char *handler_args, void *handler_pointer)
-{
- plugin->print (plugin, argv[0], NULL, "KICK received");
- return PLUGIN_RC_OK;
-}
-...
-t_plugin_handler *msg_handler;
-msg_handler = plugin->msg_handler_add (plugin, "KICK",
- &msg_kick, NULL, NULL);
-
-
-
-
-
- cmd_handler_add
-
-
- Prototyp:
-
- t_plugin_handler *cmd_handler_add (t_weechat_plugin
- *plugin, char *command, char *description, char *arguments,
- char *arguments_description, char *completion_template,
- t_plugin_handler_func *fonction, char *handler_args,
- void *handler_pointer)
-
-
-
- Erzeugt einen Handler für ein WeeChat-Kommando, der aufgerufen
- wird, wenn der Anwender das Kommando ausführt (Beispiel: /command).
-
-
- Argumente:
-
-
-
- : Zeiger auf eine Plugin-Struktur
-
-
-
-
- : Name des neuen Kommandos, der auch
- Name eines bereits existierenden Kommandos sein kann (mit
- Bedacht zu verwenden, das ersetzte Kommando ist nicht
- verfügbar, bis das Plugin entfernt wurde)
-
-
-
-
- : kurze Beschreibung des
- Kommandos (angezeigt beim Ausführen von /help command)
-
-
-
-
- : kurze Beschreibung der Argumente
- des Kommandos (angezeigt beim Ausführen von /help command)
-
-
-
-
- : lange Beschreibung
- der Argumente des Kommandos (angezeigt beim Ausführen von
- /help command)
-
-
-
-
- : Vorlage für die
- Vervollständigung; zum Beispiel bedeutet
- "abc|%w def|%i", dass das erste Argument
- "abc" oder ein WeeChat-Kommando sein kann und das zweite
- Argument "def" oder ein IRC-Kommando. Eine leere
- Zeichenkette bedeutet, dass WeeChat für jedes Argument
- einen Nicknamen des gegenwärtigen Channels einsetzt, ein
- NULL oder "-" schaltet die Vervollständigung für alle
- Argumente ab.
-
-
- Die folgenden Ersetzungen können verwendet werden:
-
-
-
-
- Code
- Beschreibung
-
-
-
-
- %-
- keine Vervollständigung für das Argument
-
-
- %*
-
-
- repeat last completion for all following arguments
- (this code has to be at the end of completion
- template, preceded by "|")
-
-
-
- %a
- Alias
-
-
- %A
-
- Aliase und Kommandos (WeeChat, IRC und Plugins)
-
-
-
- %c
- gegenwärtiger Channel
-
-
- %C
- alle channels (inklusive Queries)
-
-
- %f
- Dateiname
-
-
- %h
- Plugin Kommandos
-
-
- %i
- IRC Kommandos (senden)
-
-
- %I
- IRC Kommandos (empfangen)
-
-
- %k
- Grundfunktionen
-
-
- %m
- Nicknamen des gegenwärtigen Servers
-
-
- %M
-
- Nicks auf dem gegenwärtigen Server (in allen
- offenen Channeln)
-
-
-
- %n
- Nicknamen des gegenwärtigen Channels
-
-
- %N
-
- Nicknamen und Hostnamen des gegenwärtigen
- Channels
-
-
-
- %o
- Konfigurationseinstellungen
-
-
- %O
- Plugin Optionen
-
-
- %p
- Standard "part" Nachricht
-
-
- %q
- Standard "quit" Nachricht
-
-
- %s
- Name des gegenwärtigen Servers
-
-
- %S
- Namen aller definierten Server
-
-
- %t
- Topic des gegenwärtigen Channels
-
-
- %v
- Wert einer Konfigurationseinstellung
-
-
- %V
- Wert einer Plugin-Option
-
-
- %w
- WeeChat Kommandos
-
-
-
-
-
-
-
-
- : Funktion, die aufgerufen wird,
- wenn das Kommando ausgeführt wird
-
-
- Sie verwendet den folgenden Prototypen:
-
- int my_function (t_weechat_plugin *plugin,
- int argc, char **argv,
- char *handler_args, void *handler_pointer)
-
-
-
- Das Argument argc ist auf 3 gesetzt, das Array argv enthält
- die folgenden Werte:
-
-
- argv[0] = Server Name
-
-
- argv[1] = Kommando
-
-
- argv[2] = Kommando-Argumente
-
-
-
-
-
-
- : Argumente, die an die Funktion
- übergeben werden
-
-
-
-
- : Zeiger, der an die Funktion
- übergeben wird
-
-
-
-
-
- Rückgabewert: Zeiger auf den neuen Kommando-Handler.
-
-
- Hinweis: die Funktion, die aufgerufen wird, wenn das Kommando
- ausgeführt wird, muss einen der folgende Werte zurückgeben:
-
-
-
- PLUGIN_RC_KO: Funktion ist fehlgeschlagen
-
-
-
-
- PLUGIN_RC_OK: Funktion war erfolgreich
-
-
-
-
-
- Beispiel:
-
-int cmd_test (t_weechat_plugin *plugin, int argc, char **argv,
- char *handler_args, void *handler_pointer)
-{
- plugin->print (plugin, argv[0], NULL,
- "test command, nick: %s",
- (argv[2]) ? argv[2] : "none");
- return PLUGIN_RC_OK;
-}
-...
-t_plugin_handler *cmd_handler;
-cmd_handler = plugin->cmd_handler_add (plugin, "test", "Test command",
- "[nick]", "nick: nick of channel",
- "%n", &cmd_test, NULL, NULL);
-
-
-
-
-
- timer_handler_add
-
-
- Prototyp:
-
- t_plugin_handler *timer_handler_add (t_weechat_plugin
- *plugin, int interval, t_plugin_handler_func *function,
- char *handler_args, void *handler_pointer)
-
-
-
- Erzeuge einen zeitgesteuerten Handler, der periodisch
- eine Funktion aufruft.
-
-
- Argumente:
-
-
-
- : Zeiger auf eine Plugin-Struktur
-
-
-
-
- : Intervall (in Secunden) zwischen
- zwei Aufrufen der Funktion
-
-
-
-
- : Funktion, die aufgerufen wird
-
-
- Sie verwendet den folgenden Prototypen:
-
- int my_function (t_weechat_plugin *plugin,
- int argc, char **argv,
- char *handler_args, void *handler_pointer)
-
-
-
- Das Argument argc ist auf 0 gesetzt und argv ist auf NULL
- gesetzt.
-
-
-
-
- : Argumente der aufgerufenen
- Funktion
-
-
-
-
- : Zeiger, der an die Funktion
- übergeben wird
-
-
-
-
-
- Rückgabewert: Zeiger auf den neuen timer-Handler.
-
-
- Hinweis: die Funktion, die aufgerufen wird, muss einen der folgende
- Werte zurückgeben:
-
-
-
- PLUGIN_RC_KO: Funktion ist fehlgeschlagen
-
-
-
-
- PLUGIN_RC_OK: Funktion war erfolgreich
-
-
-
-
-
- Beispiel:
-
-int my_timer (t_weechat_plugin *plugin, int argc, char **argv,
- char *handler_args, void *handler_pointer)
-{
- plugin->print (plugin, NULL, NULL, "my timer");
- return PLUGIN_RC_OK;
-}
-...
-t_plugin_handler *timer_handler;
-timer_handler = plugin->timer_handler_add (plugin, 60, &my_timer);
-
-
-
-
-
- keyboard_handler_add
-
-
- Prototyp:
-
- t_plugin_handler *keyboard_handler_add (t_weechat_plugin
- *plugin, t_plugin_handler_func *function,
- char *handler_args, void *handler_pointer)
-
-
-
- Erzeugt einen Keyboard-Handler, der nach dem Drücken einer Taste
- aufgerufen wird.
-
-
- Argumente:
-
-
-
- : Zeiger auf eine Plugin-Struktur
-
-
-
-
- : Die Funktion, die aufgerufen wird
-
-
- Sie verwendet den folgenden Prototypen:
-
- int my_function (t_weechat_plugin *plugin,
- int argc, char **argv,
- char *handler_args, void *handler_pointer)
-
-
-
- Das Argument argc ist auf 3 gesetzt, argv enthält die
- folgenden Werte:
-
-
-
- argv[0] = Taste, die gedrückt wurde
- (Name der internen Funktion oder '*' gefolgt von einem
- Tastaturcode)
-
-
-
-
- argv[1] = Kommandozeile vor dem Tastendruck
-
-
-
-
- argv[2] = Kommandozeile nach dem Tastendruck
-
-
-
-
-
-
-
- : Argumente, die bei Aufruf der
- Funktion übergeben
- werden
-
-
-
-
- : Zeiger auf die Funktion,
- der bei Aufruf übergeben
- wird
-
-
-
-
-
- Rückgabewert: Zeiger auf den Handler.
-
-
- Hinweis: Die aufgerufene Funktion muss einen der folgenden Werte
- zurückgeben:
-
-
-
- PLUGIN_RC_KO: Funktion ist fehlgeschlagen
-
-
-
-
- PLUGIN_RC_OK: Funktion war erfolgreich
-
-
-
-
-
- Beispiel:
-
-int my_keyb (t_weechat_plugin *plugin, int argc, char **argv,
- char *handler_args, void *handler_pointer)
-{
- if (argc == 2)
- {
- plugin->print (plugin, NULL, NULL, "key pressed: %s", argv[0]);
- if (argv[1] && (argv[1][0] == '1'))
- plugin->print (plugin, NULL, NULL, "input text changed");
- else
- plugin->print (plugin, NULL, NULL, "input text not changed");
- }
- return PLUGIN_RC_OK;
-}
-...
-t_plugin_handler *keyb_handler;
-keyb_handler = plugin->keyboard_handler_add (plugin, &my_keyb);
-
-
-
-
-
- event_handler_add
-
-
- Prototyp:
-
- t_plugin_handler *event_handler_add (t_weechat_plugin
- *plugin, char *event, t_plugin_handler_func *function,
- char *handler_args, void *handler_pointer)
-
-
-
- Fügt einen Ereignishandler hinzu, der aufgerufen wird, wenn ein
- Ereignis eintritt.
-
-
- Argumente:
-
-
-
- : Zeiger auf Plugin-Strukture
-
-
-
-
- : Ereignis (siehe folgende Tabelle)
-
-
-
-
- : aufgerufene Funktion
-
-
- Es wird folgender Prototyp verwendet:
-
- int my_function (t_weechat_plugin *plugin,
- int argc, char **argv,
- char *handler_args, void *handler_pointer)
-
-
-
-
- Arguments depend on event (see table below).
-
-
-
-
- : Argument, die an die aufgerufene
- Funktion übergeben werden
-
-
-
-
- : Pointer, der an die
- aufgerufene Funktion übergeben werden
-
-
-
-
-
-
- List of events:
-
-
-
-
- Ereignis
- Beschreibung
- Arguments
-
-
-
-
- buffer_open
- ein Puffer wurde geöffnet
-
- argc = 1, argv = { buffer number }
-
-
-
- buffer_close
- ein Puffer wurde geschlossen
-
- argc = 1, argv = { buffer number }
-
-
-
- buffer_move
- a buffer was moved
-
- argc = 2, argv = { new buffer number, old number }
-
-
-
-
-
-
-
- Rückgabewert: Pointer auf den neuen Ereignishandler.
-
-
- Anmerkung: die aufgerufene Function muss einen der folgenden Werte
- zurückgeben:
-
-
-
- PLUGIN_RC_KO: Funktion fehlgeschlagen
-
-
-
-
- PLUGIN_RC_OK: Funktion erfolgreich beendet
-
-
-
-
-
- Beispiel:
-
-int my_event (t_weechat_plugin *plugin, int argc, char **argv,
- char *handler_args, void *handler_pointer)
-{
- plugin->print (plugin, NULL, NULL, "my_event");
- return PLUGIN_RC_OK;
-}
-...
-t_plugin_handler *event_handler;
-event_handler = plugin->event_handler_add (plugin, "buffer_open",
- &my_event);
-
-
-
-
-
- handler_remove
-
-
- Prototyp:
-
- void handler_remove (t_weechat_plugin *plugin,
- t_plugin_handler *handler)
-
-
-
- Entfernt einen Nachrichten- oder Kommando-Handler.
-
-
- Argumente:
-
-
-
- : Zeiger auf eine Plugin-Struktur
-
-
-
-
- : Handler, der entfernt werden soll
-
-
-
-
-
- Rückgabewert: keiner
-
-
- Beispiel:
- plugin->handler_remove (plugin, my_handler);
-
-
-
-
- handler_remove_all
-
-
- Prototyp:
-
- void handler_remove_all (t_weechat_plugin *plugin)
-
-
-
- Entfernt alle Handler eines Plugins.
-
-
- Argumente:
-
-
-
- : Zeiger auf eine Plugin-Struktur
-
-
-
-
-
- Rückgabewert: keiner
-
-
- Beispiel:
- plugin->handler_remove_all (plugin);
-
-
-
-
- modifier_add
-
-
- Prototyp:
-
- t_plugin_modifier *modifier_add (t_weechat_plugin *plugin,
- char *type, char *message, t_plugin_modifier_func *function,
- char *modifier_args, void *modifier_pointer)
-
-
-
- Füge einen Nachrichtenmodifikator hinzu.
-
-
- Argumente:
-
-
-
- : Zeiger auf Plugin-Struktur
-
-
-
-
- : Modifikatorart:
-
-
-
-
- Art
- Beschreibung
-
-
-
-
- irc_in
- wird bei eingehenden IRC-Nachrichten aufgerufen
-
-
- irc_user
-
- wird bei jeder Benutzernachricht (oder Befehl)
- aufgerufen (bevor WeeChat die Nachricht parst)
-
-
-
- irc_out
-
- wird unmittelbar vor dem Abschicken einer ausgehenden
- Nachricht an den IRC-Server aufgerufen (auch bei
- Nachrichten, die WeeChat automatisch an den Server
- sendet)
-
-
-
-
-
-
-
-
-
- : Name der IRC-Nachricht (wird nur
- bei den Arten "irc_in" and "irc_out" benutzt)
- Um eine Liste der IRC-Nachrichten zu erhalten, lies bitte
- folgende Dokumente:RFCs
- 1459
- and
- 2812.
- Außerdem gibt es den Wert "*", der alle Nachrichten
- anspricht (ohne Filter).
-
-
-
-
- : aufgerufene Funktion
-
-
- Folgender Prototyp wird dafür benutzt:
-
- int my_function (t_weechat_plugin *plugin,
- int argc, char **argv,
- char *modifier_args, void *modifier_pointer)
-
-
-
- Argument argc hat den Wert 2, folgende Werte sind in dem
- argv-Array:
-
-
- argv[0] = Servername
-
-
- argv[1] = Nachricht
-
-
-
-
-
-
- : an die Funktion übergebene
- Werte
-
-
-
-
- : an die Funktion
- übergebener Zeiger
-
-
-
-
-
- Rückgabewert: Zeiger auf den neuen Nachrichtenmodifikator
-
-
- Anmerkung: Die Funktion muss die veränderte Zeichenkette oder NULL
- (wenn keine Änderungen erfolgten) zurückgeben.
- Wenn die Funktion eine leere Zeichenkette zurückgibt, wird die
- Nachricht komplett verworfen und nicht weiter von WeeChat
- verarbeitet. (Seien Sie vorsichtig mit dem Verwerfen von
- Nachrichten!) Die zurückgegebene Zeichenkette muss mit malloc()
- zugewiesen worden sein und wird von WeeChat nach Gebrauch
- automatisch mit free() wieder freigegeben.
-
-
- Beispiel:
-
-char *adder (t_weechat_plugin *plugin, int argc, char **argv,
- char *modifier_args, void *modifier_pointer)
-{
- char *string;
- string = malloc (strlen (argv[1]) + 16);
- strcpy (string, argv[1]);
- strcat (string, "test");
- return string;
-}
-...
-t_plugin_modifier *modifier;
-modifier = plugin->modifier_add (plugin, "irc_in", "privmsg",
- &adder, NULL, NULL);
-
-
-
-
-
- modifier_remove
-
-
- Prototyp:
-
- void modifier_remove (t_weechat_plugin *plugin,
- t_plugin_modifier *modifier)
-
-
-
- Entfernt einen Nachrichtenmodifikator.
-
-
- Arguments:
-
-
-
- : Zeiger auf Plugin-Struktur
-
-
-
-
- : zu entfernender Modifikator
-
-
-
-
-
- Rückgabewert: keiner
-
-
- Beispiel:
- plugin->modifier_remove (plugin, my_modifier);
-
-
-
-
- modifier_remove_all
-
-
- Prototyp:
-
- void modifier_remove_all (t_weechat_plugin *plugin)
-
-
-
- Entfernt alle Modifikatoren für ein Plugin.
-
-
- Argumente:
-
-
-
- : Zeiger auf Plugin-Struktur
-
-
-
-
-
- Rückgabewert: keiner
-
-
- Beispiel:
- plugin->modifier_remove_all (plugin);
-
-
-
-
- exec_command
-
-
- Prototyp:
-
- void exec_command (t_weechat_plugin
- *plugin, char *server, char *channel, char *command)
-
-
-
- Führe ein WeeChat-Kommando aus (oder sende eine Nachricht an
- einen Channel).
-
-
- Argumente:
-
-
-
- : Zeiger auf eine Plugin-Struktur
-
-
-
-
- : interner Name des Servers, auf den
- das Kommando angewendet werden soll (kann NULL sein)
-
-
-
-
- : Name des Channels, auf den das
- Kommando angewendet werden soll (kann NULL sein)
-
-
-
-
- : Kommando
-
-
-
-
-
- Rückgabewert: keiner
-
-
- Beispiel:
-
-plugin->exec_command (plugin, NULL, NULL, "/help nick");
-plugin->exec_command (plugin, "freenode", "#weechat", "hello");
-
-
-
-
-
- get_info
-
-
- Prototyp:
-
- char *get_info (t_weechat_plugin *plugin,
- char *info, char *server)
-
-
-
- Gib eine Information über WeeChat oder einen Channel zurück.
-
-
- Argumente:
-
-
-
- : Zeiger auf eine Plugin-Struktur
-
-
-
-
- : Name (Typ) der Information:
-
-
-
-
- Info
- Beschreibung
-
-
-
-
- version
- WeeChats Version
-
-
- nick
- Nickname
-
-
- channel
-
- Name des Channels (NULL bei einem Server oder
- Privatchat)
-
-
-
- server
- Name des Servers
-
-
- type
-
- Puffertyp: 0=standard, 1=DCC, 2=raw IRC data
-
-
-
- away
- Status des "away"-Flags
-
-
- inactivity
-
- Anzahl der Sekunden seit der letzten
- Tastenbetätigung
-
-
-
- input
-
- Inhalt der Kommandozeile im gegenwärtigen Fenster
-
-
-
- input_mask
-
- Inhalt der Farbmaske für die Kommandozeile
-
-
-
- input_pos
-
- Position des Cursors in der Kommandozeile
-
-
-
- weechat_dir
-
- WeeChat-Verzeichnis (Standard: ~/.weechat/)
-
-
-
- weechat_libdir
- WeeChat-Systemverzeichnis (Bibliotheken)
-
-
- weechat_sharedir
- WeeChat-Systemverzeichnis (gemeinsame Dateien)
-
-
-
-
-
-
-
-
- : interner Name des Servers um
- Informationen zu lesen (wenn benötigt)
-
-
-
-
-
- Rückgabewert: angeforderte Information oder NULL
-
-
- Hinweis: das Ergebnis muss nach Nutzung mit "free" wieder
- freigegeben werden.
-
-
- Beispiele:
-
-char *version = plugin->get_info (plugin, "version", NULL);
-char *nick = plugin->get_info (plugin, "nick", "freenode");
-char *inactivity = plugin->get_info (plugin, "inactivity", NULL);
-
-plugin->print (plugin, NULL, NULL,
- "WeeChat version %s, you are %s on freenode "
- "(inactive for %s seconds)",
- version, nick, inactivity);
-
-if (version)
- free (version);
-if (nick)
- free (nick);
-if (inactivity)
- free (inactivity);
-
-
-
-
-
- get_dcc_info
-
-
- Prototyp:
-
- t_plugin_info_dcc *get_dcc_info (t_weechat_plugin *plugin)
-
-
-
- Gib eine Liste der aktiven oder beendeten DCCs zurück.
-
-
- Argumente:
-
-
-
- : Zeiger auf eine Plugin-Struktur
-
-
-
-
-
- Rückgabewert: verkettete Liste von DCCs.
-
-
-
-
- Typ
- Feld
- Beschreibung
-
-
-
-
- char *
- server
- IRC Server
-
-
- char *
- channel
- IRC Channel
-
-
- int
- type
-
- DCC Typ:
- 0 = Chatanfrage empfangen,
- 1 = Chatanfrage gesendet,
- 2 = Datei empfangen,
- 3 = Datei gesendet
-
-
-
- int*
- status
-
- DCC Status:
- 0 = wartend,
- 1 = verbindend,
- 2 = aktiv,
- 3 = beendet,
- 4 = fehlgeschlagen,
- 5 = unterbrochen durch Anwender
-
-
-
- time_t
- start_time
- Datum/Zeit der Erzeugung der DCC
-
-
- time_t
- start_transfer
- Datum/Zeit des Beginns der Übertragung der DCC
-
-
- unsigned long
- addr
- IP-Adresse des Partners
-
-
- int
- port
- Port der DCC
-
-
- char *
- nick
- Nickname des Partners
-
-
- char *
- filename
- Dateiname
-
-
- char *
- local_filename
- lokaler Dateiname
-
-
- int
- filename_suffix
- Suffix wenn die Datei umbenannt wird
-
-
- unsigned long
- size
- Dateigrösse
-
-
- unsigned long
- pos
- Position in Datei
-
-
- unsigned long
- start_resume
- Startposition nach einer Unterbrechung
-
-
- unsigned long
- bytes_per_sec
-
- Übertragungsrate (Bytes/s) seit Beginn der Übertragung
-
-
-
- t_plugin_dcc_info *
- prev_dcc
-
- Zeiger auf voheriges DCC-Info
-
-
-
- t_plugin_dcc_info *
- next_dcc
-
- Zeiger auf nächstes DCC-Info
-
-
-
-
-
-
-
-
- Hinweis: Das Ergebnis muss nach der Benutzung mittels
- "free_dcc_info" wieder freigegeben werden.
-
-
- Beispiele:
-
-t_plugin_dcc_info *dcc_info = plugin->get_dcc_info (plugin);
-for (ptr_dcc = dcc_info; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
-{
- plugin->print_server (plugin, "DCC type=%d, with: %s",
- ptr_dcc->type, ptr_dcc->nick);
-}
-if (dcc_info)
- plugin->free_dcc_info (plugin, dcc_info);
-
-
-
-
-
- free_dcc_info
-
-
- Prototyp:
-
- void free_dcc_info (t_weechat_plugin *plugin,
- t_plugin_dcc_info *dcc_info)
-
-
-
- Gibt den Speicher einer Liste von DCC-Infos wieder frei.
-
-
- Argumente:
-
-
-
- : Zeiger auf eine Plugin-Struktur
-
-
-
-
- : Zeiger auf eine Liste mit
- DCC-Infos, die mit "get_dcc_info" angelegt wurde
-
-
-
-
-
- Rückgabewert: keiner.
-
-
- Beispiel:
- plugin->free_dcc_info (plugin, dcc_info);
-
-
-
-
- get_server_info
-
-
- Prototyp:
-
- t_plugin_server_info *get_server_info (t_weechat_plugin *plugin)
-
-
-
- Gibt die Liste von IRC-Servern zurück (verbunden oder nicht)
-
-
- Argumente:
-
-
-
- : Zeiger auf eine Plugin-Struktur
-
-
-
-
-
- Rückgabewert: Liste von IRC-Servern.
-
-
-
-
- Typ
- Feld
- Beschreibung
-
-
-
-
- char *
- name
- interner Servername
-
-
- int
- autoconnect
- 1 wenn Autoconnect gesetzt ist, 0 sonst
-
-
- int
- autoreconnect
-
- 1 wenn autoreconnect gesetzt ist,
- 0 sonst
-
-
-
- int
- autoreconnect_delay
- Wartezeit vor erneutem Verbindungsversuch
-
-
- int
- command_line
-
- 1 wenn der Servername auf der Kommandozeile angegeben
- wurde (ist somit temporär) 0 sonst
-
-
-
- char *
- address
- Serveradresse (Name oder IP)
-
-
- int
- port
- Port
-
-
- int
- ipv6
- IPv6-Verbindung
-
-
- int
- ssl
- SSL-Verbindung
-
-
- char *
- password
- Passwort
-
-
- char *
- nick1
- primärer Nickname
-
-
- char *
- nick2
- alternativer Nickname
-
-
- char *
- nick3
- zweiter, alternativer Nickname
-
-
- char *
- username
- Username
-
-
- char *
- real name
- tatsächlicher Name
-
-
- char *
- command
-
- Kommando, dass bei erfolgreicher Verbindung
- ausgeführt wurde
-
-
-
- int
- command_delay
- Verzögerung nach Ausführung des Kommandos
-
-
- char *
- autojoin
- Channels, die automatisch betreten werden sollen
-
-
- int
- autorejoin
-
- 1 wenn Channels wieder betreten werden sollen, nachdem
- man gekickt wurde 0 sonst
-
-
-
- char *
- notify_levels
- Benachrichtigungs-Level von Channels
-
-
- char *
- charset_decode_iso
- Zeichensatz zum Dekodieren von ISO
-
-
- char *
- charset_decode_utf
- Zeichensatz zum Dekodieren von UTF
-
-
- char *
- charset_encode
-
- Zeichensatz der Channels zum Kodieren von
- Nachrichten
-
-
-
- int
- is_connected
- 1 wenn verbunden mit einem Server, 0 otherwise
-
-
- int
- ssl_connected
- 1 wenn verbunden über SSL, 0 sonst
-
-
- char *
- nick
- gegenwärtiger Nickname
-
-
- int
- is_away
- 1 wenn away-flag gesetzt ist, 0 sonst
-
-
- time_t
- away_time
- Zeitspanne seit away-flag gesetzt ist
-
-
- int
- lag
- Lag (in Millisekunden)
-
-
- t_plugin_server_info *
- prev_server
- Zeiger auf vorherigen Knoten der Liste
-
-
- t_plugin_server_info *
- next_server
- Zeiger auf nächsten Knoten der Liste
-
-
-
-
-
-
- Hinweis: das Ergebnis muss nach der Benutzung mit
- "free_server_info" wieder freigegeben werden.
-
-
- Beispiel:
-
-t_plugin_server_info *server_info, *ptr_server_info;
-server_info = plugin->get_server_info (plugin);
-if (server_info)
-{
- for (ptr_server_info = server_info; ptr_server_info;
- ptr_server_info = ptr_server_info->next_server)
- {
- plugin->print (plugin, NULL, NULL,
- "server: %s, address: %s, port: %d %s",
- ptr_server_info->name,
- ptr_server_info->address,
- ptr_server_info->port,
- (ptr_server_info->is_connected) ? "(connected)" : "");
- }
- plugin->free_server_info (plugin, server_info);
-}
-
-
-
-
-
- free_server_info
-
-
- Prototyp:
-
- void free_server_info (t_weechat_plugin *plugin,
- t_plugin_server_info *server_info)
-
-
-
- Gib den Speicher einer Liste "server info" frei
-
-
- Argumente:
-
-
-
- : Zeiger auf eine Plugin-Struktur
-
-
-
-
- : Zeiger auf eine Server-Liste,
- der von der Funktion "get_server_info" zurückgegeben wurde.
-
-
-
-
-
- Rückgabewert: keiner.
-
-
- Beispiel:
- plugin->free_server_info (plugin, server_info);
-
-
-
-
- get_channel_info
-
-
- Prototyp:
-
- t_plugin_channel_info *get_channel_info (t_weechat_plugin *plugin,
- char *server)
-
-
-
- Gib eine Liste der Channels für einen Server zurück.
-
-
- Argumente:
-
-
-
- : Zeiger auf eine Plugin-Struktur
-
-
-
-
- : interner Name des Server
-
-
-
-
-
- Rückgabewert: verkettete Liste von Channels für einen Server.
-
-
-
-
- Typ
- Feld
- Beschreibung
-
-
-
-
- int
- type
-
- 0 für einen normalen Channel, 1 für einen Privaten
-
-
-
- char *
- name
- Name des Channels
-
-
- char *
- topic
- Topic des Channels
-
-
- char *
- modes
- Channelmodus (Flags)
-
-
- int
- limit
- Anzahl der erlaubten User
-
-
- char *
- key
- Schlüssel des Channels
-
-
- int
- nicks_count
- Anzahl der Nicknamen des Channels
-
-
- t_plugin_channel_info *
- prev_channel
- Zeiger auf vorherigem Knoten der Liste
-
-
- t_plugin_channel_info *
- next_channel
- Zeiger auf nächsten Knoten der Liste
-
-
-
-
-
-
- Hinweis: Das Ergebnis muss nach der Benutzung mit
- "free_channel_info" wieder freigegeben werden.
-
-
- Beispiel:
-
-t_plugin_channel_info *channel_info, *ptr_chan_info;
-channel_info = plugin->get_channel_info (plugin, "freenode");
-if (channel_info)
-{
- for (ptr_chan_info = channel_info; ptr_chan_info;
- ptr_chan_info = ptr_chan_info->next_channel)
- {
- plugin->print (plugin, NULL, NULL,
- " %s (type %d)",
- ptr_chan_info->name,
- ptr_chan_info->type);
- }
- plugin->free_channel_info (plugin, channel_info);
-}
-
-
-
-
-
- free_channel_info
-
-
- Prototyp:
-
- void free_channel_info (t_weechat_plugin *plugin,
- t_plugin_channel_info *channel_info)
-
-
-
- Gibt den Speicher einer Liste "channel info" wieder frei.
-
-
- Argumente:
-
-
-
- : Zeiger auf eine Plugin-Struktur
-
-
-
-
- : Zeiger auf eine Liste
- "channel info", der von "get_channel_info" zurückgegeben
- wurde
-
-
-
-
-
- Rückgabewert: keiner.
-
-
- Beispiel:
- plugin->free_channel_info (plugin, channel_info);
-
-
-
-
- get_nick_info
-
-
- Prototyp:
-
- t_plugin_nick_info *get_nick_info (t_weechat_plugin *plugin,
- char *server, char *channel)
-
-
-
- Gib eine Liste der Nicknamen für einen Channel zurück.
-
-
- Argumente:
-
-
-
- : Zeiger auf eine Plugin-Struktur
-
-
-
-
- : interner Name des Servers
-
-
-
-
- : Name des Channels
-
-
-
-
-
- Rückgabewert: verkettete Liste von Nicknamen eines Channels.
-
-
-
-
- Typ
- Feld
- Beschreibung
-
-
-
-
- char *
- nick
- Nickname
-
-
- char *
- host
- Hostname
-
-
- int
- Flags
-
- Flags, die für einen Nicknamen gesetzt sind:
- Zweierpotenzen "oder" Zwischenwerte
- (1 = channel owner,
- 2 = channel admin,
- 4 = op,
- 8 = halfop,
- 16 = voice,
- 32 = away)
-
-
-
- t_plugin_nick_info *
- prev_nick
- Zeiger auf vorherigen Knoten der Liste
-
-
- t_plugin_nick_info *
- next_nick
- Zeiger auf nächsten Knoten der Liste
-
-
-
-
-
-
- Hinweis: Das Ergebnis muss nach der Benutzung mit "free_nick_info" wieder freigegeben werden.
-
-
- Beispiel:
-
-t_plugin_nick_info *nick_info, *ptr_nick_info;
-nick_info = plugin->get_nick_info (plugin, "freenode", "#weechat");
-if (nick_info)
-{
- for (ptr_nick_info = nick_info; ptr_nick_info;
- ptr_nick_info = ptr_nick_info->next_nick)
- {
- plugin->print (plugin, NULL, NULL,
- " %s (flags: %d)",
- ptr_nick_info->nick,
- ptr_nick_info->flags);
- }
- plugin->free_nick_info (plugin, nick_info);
-}
-
-
-
-
-
- free_nick_info
-
-
- Prototyp:
-
- void free_nick_info (t_weechat_plugin *plugin,
- t_plugin_nick_info *nick_info)
-
-
-
- Gibt den Speicher einer Liste "nick info" frei.
-
-
- Argumente:
-
-
-
- : Zeiger auf eine Plugin-Struktur
-
-
-
-
- : Zeiger auf eine Liste
- "nick info", der von "get_nick_info" zurückgegeben wurde
-
-
-
-
-
- Rückgabewert: keiner.
-
-
- Beispiel:
- plugin->free_nick_info (plugin, nick_info);
-
-
-
-
- get_config
-
-
- Prototyp:
-
- char *get_config (t_weechat_plugin *plugin, char *option)
-
-
-
- Gibt den Wert einer Option der WeeChat-Konfiguration zurück.
-
-
- Argumente:
-
-
-
- : Zeiger auf eine Plugin-Struktur
-
-
-
-
- : Name der Option
-
-
-
-
-
- Rückgabewert: Wert der Option, oder NULL, wenn nichts gefunden wurde.
-
-
- Hinweis: Das Ergebnis muss nach der Benutzung mit "free" wieder
- freigegeben werden.
-
-
- Beispiel:
-
-char *value1 = plugin->get_config (plugin, "look_set_title");
-char *value2 = plugin->get_config (plugin, "freenode.server_autojoin");
-
-
-
-
-
- set_config
-
-
- Prototyp:
-
- int set_config (t_weechat_plugin *plugin,
- char *option, char *value)
-
-
-
- Setze den Wert einer Option der WeeChat-Konfiguration.
-
-
- Argumente:
-
-
-
- : Zeiger auf eine Plugin-Struktur
-
-
-
-
- : Name der Option
-
-
-
-
- : der neue Wert der Option
-
-
-
-
-
- Rückgabewert: 1 wenn der Wert der Option gesetzt werden konnte,
- 0 bei Auftreten eines Fehlers.
-
-
- Beispiel:
-
-plugin->set_config (plugin, "look_nicklist", "off");
-
-
-
-
-
- get_plugin_config
-
-
- Prototyp:
-
- char *get_plugin_config (t_weechat_plugin *plugin, char *option)
-
-
-
- Gibt den Wert einer Option eines Plugins zurück.
- Die Option wird aus "~/.weechat/plugins.rc"
- gelesen und sieht so aus: "plugin.option=value"
- (Hinweis: der Name des Plugins wird automatisch gesetzt).
-
-
-
- Argumente:
-
-
-
- : Zeiger auf eine Plugin-Struktur
-
-
-
-
- : Name der Option
-
-
-
-
-
- Rückgabewert: Wert der Option, NULL wenn nichts gefunden wurde.
-
-
- Hinweis: Das Ergebnis muss nach der Benutzung mit "free" wieder
- freigegeben werden.
-
-
- Beispiel:
-
-char *value = plugin->get_plugin_config (plugin, "my_var");
-
-
-
-
-
- set_plugin_config
-
-
- Prototyp:
-
- int set_plugin_config (t_weechat_plugin *plugin,
- char *option, char *value)
-
-
-
- Setzt den Wert einer Option eines Plugins.
- Die Option wird in die Datei
- "~/.weechat/plugins.rc" geschrieben
- und sieht so aus: "plugin.option=value"
- (Hinweis: der Name des Plugins wird automatisch gesetzt)
-
-
- Argumente:
-
-
-
- : Zeiger auf eine Plugin-Struktur
-
-
-
-
- : Name der Option, die gesetzt werden soll
-
-
-
-
- : Wert der zu setzenden Option
-
-
-
-
-
- Rückgabewert: 1 wenn die Option gesetzt werden konnte, 0 wenn ein
- Fehler aufgetreten ist.
-
-
- Beispiel:
-
-plugin->set_plugin_config (plugin, "my_var", "value");
-
-
-
-
-
- get_irc_color
-
-
- Prototype:
-
- int get_irc_color (t_weechat_plugin *plugin,
- char *color_name)
-
-
-
- Hole IRC-Farbindex mit dem Farbnamen.
-
-
- Argumente:
-
-
-
- : Zeiger auf die Pluginstruktur
-
-
-
-
- : Farbname
- Folgende Farben sind erlaubt:
-
-
-
-
- Farbname
- Wert
-
-
-
-
- white
- 0
-
-
- black
- 1
-
-
- blue
- 2
-
-
- green
- 3
-
-
- lightred
- 4
-
-
- red
- 5
-
-
- magenta
- 6
-
-
- brown
- 7
-
-
- yellow
- 8
-
-
- lightgreen
- 9
-
-
- cyan
- 10
-
-
- lightcyan
- 11
-
-
- lightblue
- 12
-
-
- lightmagenta
- 13
-
-
- gray
- 14
-
-
- lightgray
- 15
-
-
-
-
-
-
-
-
-
- Rückgabewert: IRC-Farbindex, -1 wenn die Farbe nicht gefunden wurde.
-
-
- Beispiel:
-
-int color_blue = plugin->get_irc_color (plugin, "blue"); /* return 2 */
-
-
-
-
-
-
-
- get_window_info
-
-
- Prototype:
-
- t_plugin_window_info *get_window_info (t_weechat_plugin *plugin)
-
-
-
- Gibt die Liste der WeeChat-Fenster zurück.
-
-
- Argumente:
-
-
-
- : Zeiger auf Pluginstruktur
-
-
-
-
-
- Rückgabewert: verkettete Liste der WeeChat-Fenster.
-
-
-
-
- Typ
- Feld
- Beschreibung
-
-
-
-
- int
- win_x
- horizontale Fensterposition
-
-
- int
- win_y
- vertikale Fensterposition
-
-
- int
- win_width
- Fensterbreite
-
-
- int
- win_height
- Fensterhöhe
-
-
- int
- win_width_pct
-
- Breite in % (im Vergleich zum übergeordneten Fenster)
-
-
-
- int
- win_height_pct
-
- Höhe % (im Vergleich zum übergeordneten Fenster)
-
-
-
- int
- num_buffer
- Anzahl der angezeigten Puffer
-
-
- t_plugin_window_info *
- prev_window
-
- Zeiger auf die Informationen des vorhergehenden Fensters
-
-
-
- t_plugin_window_info *
- next_window
-
- Zeiger auf die Informationen des nächsten Fensters
-
-
-
-
-
-
-
- Anmerkung: Das Ergebnis muss nach Benutzung durch einen Aufruf der
- "free_window_info"-Funktion gelöscht werden.
-
-
- Example:
-
-t_plugin_window_info *window_info, *ptr_window;
-
-window_info = plugin->get_window_info (plugin);
-if (window_info)
-{
- for (ptr_window = window_info; ptr_window; ptr_window = ptr_window->next_window)
- {
- plugin->print (plugin, NULL, NULL, "--- window info ---");
- plugin->print (plugin, NULL, NULL, "(%d,%d), size: %dx%d, %%size: %d%%x%d%%",
- ptr_window->win_x, ptr_window->win_y,
- ptr_window->win_width, ptr_window->win_height,
- ptr_window->win_width_pct, ptr_window->win_height_pct);
- plugin->print (plugin, NULL, NULL, "num_buffer: %d", ptr_window->num_buffer);
- }
- plugin->free_window_info (plugin, window_info);
-}
-else
- plugin->print (plugin, NULL, NULL, "no window info!");
-
-
-
-
-
- free_window_info
-
-
- Prototyp:
-
- void free_window_info (t_weechat_plugin *plugin,
- t_plugin_window_info *window_info)
-
-
-
- Gibt den Speicher wieder frei, der von der
- Fenster-Informationsliste belegt wird.
-
-
- Argumente:
-
-
-
- : Zeiger auf Pluginstruktur
-
-
-
-
- : Zeiger auf
- Fenster-Informationsliste, der von der
- "get_window_info"-Funktion zurückgegeben wurde
-
-
-
-
-
- Rückgabewert: keiner.
-
-
- Beispiel:
- plugin->free_window_info (plugin, window_info);
-
-
-
-
- get_buffer_info
-
-
- Prototyp:
-
- t_plugin_buffer_info *get_buffer_info (t_weechat_plugin *plugin)
-
-
-
- Gibt eine Liste der WeeChat-Puffer zurück.
-
-
- Argumente:
-
-
-
- : Zeiger auf Pluginstruktur
-
-
-
-
-
- Rückgabewert: verkettete Liste der WeeChat-Puffer.
-
-
-
-
- Typ
- Feld
- Beschreibung
-
-
-
-
- int
- type
- Puffertyp: 0=standard, 1=DCC, 2=raw IRC data
-
-
- int
- number
- Puffer-Nummer
-
-
- int
- num_displayed
- Anzahl der Fenster im Puffer
-
-
- char *
- server_name
- Servername für den Puffer (kann NULL sein)
-
-
- char *
- channel_name
- Channelname für den Puffer (kann NULL sein)
-
-
- int
- notify_level
- Benachrichtigungslevel für den Puffer
-
-
- char *
- log_filename
-
- Name der Logdatei (NULL bedeutet, dass nichts geloggt
- wird)
-
-
-
- t_plugin_buffer_info *
- prev_buffer
- Zeiger auf die vorhergehenden Pufferinformationen
-
-
- t_plugin_buffer_info *
- next_buffer
- Zeiger auf die nächsten Pufferinformationen
-
-
-
-
-
-
- Bemerkung: Das Ergebnis muss nach der Auswertung mit der
- "free_buffer_info"-Funktion wieder gelöscht werden.
-
-
- Beispiel:
-
-t_plugin_buffer_info *buffer_info, *ptr_buffer;
-
-buffer_info = plugin->get_buffer_info (plugin);
-if (buffer_info)
-{
- for (ptr_buffer = buffer_info; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
- {
- plugin->print (plugin, NULL, NULL, "--- buffer info ---");
- plugin->print (plugin, NULL, NULL, "type: %d", ptr_buffer->type);
- plugin->print (plugin, NULL, NULL, "number: %d", ptr_buffer->number);
- plugin->print (plugin, NULL, NULL, "num_displayed: %d", ptr_buffer->num_displayed);
- plugin->print (plugin, NULL, NULL, "server: %s", ptr_buffer->server_name);
- plugin->print (plugin, NULL, NULL, "channel: %s", ptr_buffer->channel_name);
- plugin->print (plugin, NULL, NULL, "notify level: %d", ptr_buffer->notify_level);
- plugin->print (plugin, NULL, NULL, "log filename: %s", ptr_buffer->log_filename);
- }
- plugin->free_buffer_info (plugin, buffer_info);
-}
-else
- plugin->print (plugin, NULL, NULL, "no buffer info!");
-
-
-
-
-
- free_buffer_info
-
-
- Prototyp:
-
- void free_buffer_info (t_weechat_plugin *plugin,
- t_plugin_buffer_info *buffer_info)
-
-
-
- Gibt den Speicher frei, der von der Puffer-Informationsliste
- belegt wird.
-
-
- Argumente:
-
-
-
- : Zeiger auf Pluginstruktur
-
-
-
-
- : pointer to buffer info list
- returned by "get_buffer_info" function
-
-
-
-
-
- Rückgabewert: keiner.
-
-
- Beispiel:
- plugin->free_buffer_info (plugin, buffer_info);
-
-
-
-
- get_buffer_data
-
-
- Prototype:
-
- t_plugin_buffer_data *get_buffer_info (t_weechat_plugin *plugin,
- char *server, char *channel)
-
-
-
- Gibt den Inhalt des Puffers zurück.
-
-
- Argumente:
-
-
-
- : Zeiger auf Pluginstruktur
-
-
-
-
- : interner Name des Servers
-
-
-
-
- : Channelname
-
-
-
-
-
- Rückgabewert: Pufferinhalt (verkettete Liste mit den Zeilen).
-
-
-
-
- Typ
- Feld
- Beschreibung
-
-
-
-
- time_t
- date
- Datum/Zeit
-
-
- char *
- nick
- Nick
-
-
- char *
- data
- Zeileninhalt (Farbcodes wurden entfernt)
-
-
- t_plugin_buffer_line *
- prev_line
- Zeiger auf die vorherige Zeile
-
-
- t_plugin_buffer_line *
- next_line
- Zeiger auf die nächste Zeile
-
-
-
-
-
-
- Bemerkung: Das Ergebnis muss nach der Auswertung mit der
- "free_buffer_data"-Funktion wieder gelöscht werden.
-
-
- Example:
-
-t_plugin_buffer_line *buffer_line, *ptr_line;
-char text_time[256];
-
-buffer_line = plugin->get_buffer_data (plugin);
-if (buffer_line)
-{
- for (ptr_line = buffer_line; ptr_line; ptr_line = ptr_line->next_line)
- {
- strftime (text_time, sizeof (text_time), "%x %X", localtime (&(ptr_line->date)));
- plugin->print (plugin, NULL, NULL, "date: %s, nick: %s, data: %s",
- text_time, ptr_line->nick, ptr_line->data);
- }
- plugin->free_buffer_data (plugin, buffer_line);
-}
-
-
-
-
-
- free_buffer_data
-
-
- Prototype:
-
- void free_buffer_data (t_weechat_plugin *plugin,
- t_plugin_buffer_line *buffer_line)
-
-
-
- Gibt den Speicher frei, der von den Pufferzeilen belegt wurde.
-
-
- Arguments:
-
-
-
- : Zeiger auf Pluginstruktur
-
-
-
-
- : Zeiger auf Pufferzeilen, der
- von der "get_buffer_data"-Funktion zurückgegeben wurde
-
-
-
-
-
- Rückgabewert: keiner.
-
-
- Beispiele:
- plugin->free_buffer_data (plugin, buffer_line);
-
-
-
-
-
--->
+
diff --git a/doc/de/dev/plugin_c_api.de.xml b/doc/de/dev/plugin_c_api.de.xml
new file mode 100644
index 000000000..89aeedec3
--- /dev/null
+++ b/doc/de/dev/plugin_c_api.de.xml
@@ -0,0 +1,3527 @@
+
+
+
+
+
+
+ Plugin C API
+
+
+ set_charset
+
+
+ Prototyp:
+
+ void set_charset (t_weechat_plugin *plugin, char *charset)
+
+
+
+ Legt neuen Zeichensatz für ein Plugin fest.
+
+
+ Argumente:
+
+
+
+ : Zeiger auf Plugin-Struktur
+
+
+
+
+ : neuer Zeichensatz, der benutzt
+ werden soll
+
+
+
+
+
+ Beispiel:
+ plugin->set_charset (plugin, "ISO-8859-1");
+
+
+
+
+ iconv_to_internal
+
+
+ Prototyp:
+
+ void iconv_to_internal (t_weechat_plugin *plugin, char *charset,
+ char *string)
+
+
+
+ Konvertiert eine Zeichenkette in das interne Format von WeeChat
+ (UTF-8).
+
+
+ Argumente:
+
+
+
+ : Zeiger auf Plugin-Struktur
+
+
+
+
+ : ursprünglicher Zeichensatz, von
+ dem konvertiert werden soll
+
+
+
+
+ : zu konvertierende Zeichenkette
+
+
+
+
+
+ Rückgabewert: konvertierte Zeichenkette
+
+
+ Anmerkung: der Speicher, der durch das Ergebnis belegt wird, muss
+ mit free() wieder freigegeben werden.
+
+
+ Beispiel:
+ char *str = plugin->iconv_to_internal (plugin, "ISO-8859-1", "iso string: é à");
+
+
+
+
+ iconv_from_internal
+
+
+ Prototyp:
+
+ void iconv_from_internal (t_weechat_plugin *plugin, char *charset,
+ char *string)
+
+
+
+ Konvertiert eine Zeichenkette von dem internen WeeChat-Zeichensatz
+ (UTF-8) in einen anderen.
+
+
+ Argumente:
+
+
+
+ : Zeiger auf Plugin-Struktur
+
+
+
+
+ : Ziel-Zeichensatz
+
+
+
+
+ : zu konvertierende Zeichenkette
+
+
+
+
+
+ Rückgabewert: konvertierte Zeichenkette
+
+
+ Anmerkung: der Speicher, der durch das Ergebnis belegt wird, muss
+ mit free() wieder freigegeben werden.
+
+
+ Beispiel:
+ char *str = plugin->iconv_from_internal (plugin, "ISO-8859-1", "utf-8 string: é à");
+
+
+
+
+ ascii_strcasecmp
+
+
+ Prototyp:
+
+ int ascii_strcasecmp (t_weechat_plugin *plugin,
+ char *string1, char *string2)
+
+
+
+ Vergleich von Zeichenketten unabhängig von Sprache und
+ Schreibweise (gross/klein).
+
+
+ Argumente:
+
+
+
+ : Zeiger auf Plugin-Struktur
+
+
+
+
+ : erste Zeichenkette des Vergleichs
+
+
+
+
+ : zweite Zeichenkette des Vergleichs
+
+
+
+
+
+ Rückgabewert: Unterschied zwischen den zwei Zeichenketten: kleiner
+ Null wenn
+ string1 < string2, Null wenn string1 == string2, grösser Null
+ wenn string1 > string2
+
+
+ Beispiel:
+ if (plugin->ascii_strcasecmp (plugin, "abc", "def") != 0) ...
+
+
+
+
+ ascii_strncasecmp
+
+
+ Prototyp:
+
+ int ascii_strncasecmp (t_weechat_plugin *plugin,
+ char *string1, char *string2, int max)
+
+
+
+ Vergleich von Zeichenketten unabhängig von Sprache und Schreibweise
+ (gross/klein) für höchstens "max" Zeichen.
+
+
+ Argumente:
+
+
+
+ : Zeiger auf Plugin-Struktur
+
+
+
+
+ : erste Zeichenkette des Vergleichs
+
+
+
+
+ : zweite Zeichenkette des Vergleichs
+
+
+
+
+ : maximale Zahl an Zeichen für den
+ Vergleich
+
+
+
+
+
+ Rückgabewert: Unterschied zwischen den zwei Zeichenketten: kleiner
+ Null wenn string1 < string2, Null wenn string1 == string2,
+ grösser Null wenn string1 > string2
+
+
+ Beispiel:
+ if (plugin->ascii_strncasecmp (plugin, "abc", "def", 2) != 0) ...
+
+
+
+
+ explode_string
+
+
+ Prototyp:
+
+ char **explode_string (t_weechat_plugin *plugin, char *string,
+ char *separators, int num_items_max, int *num_items)
+
+
+
+ Zerlege eine Zeichenkette entsprechend eines oder mehrerer
+ Trennzeichen(s).
+
+
+ Argumente:
+
+
+
+ : Zeiger auf eine Plugin-Struktur
+
+
+
+
+ : zu zerlegende Zeichenkette
+
+
+
+
+ : zu verwendende(s) Trennzeichen
+
+
+
+
+ : maximale Anzahl an zu
+ erzeugenden Teilen (0 = keine Grenze)
+
+
+
+
+ : Zeiger auf eine int-Variable,
+ die die Anzahl der erzeugten
+ Teile enthält
+
+
+
+
+
+ Rückgabewert: ein Array von Zeichenketten, NULL bei Fehlern.
+
+
+ Hinweis: Das zurückgegebene Array muss nach der Benutzung mittels
+ "free_exloded_string" explizit freigegeben werden.
+
+
+ Beispiel:
+
+char **argv;
+int argc;
+argv = plugin->explode_string (plugin, string, " ", 0, &argc);
+...
+if (argv != NULL)
+ plugin->free_exploded_string (plugin, argv);
+
+
+
+
+
+ free_exploded_string
+
+
+ Prototyp:
+
+ char **free_exploded_string (t_weechat_plugin *plugin,
+ char **string)
+
+
+
+ Gib ein Array frei, dass infolge der Zerlegung eines Strings
+ reserviert wurde.
+
+
+ Argumente:
+
+
+
+ : Zeiger auf eine Plugin-Struktur
+
+
+
+
+ : ein Array von Strings
+
+
+
+
+
+ Rückgabewert: keiner (?).
+
+
+ Beispiel:
+
+char *argv;
+int argc;
+argv = plugin->explode_string (plugin, string, " ", 0, &argc);
+...
+if (argv != NULL)
+ plugin->free_exploded_string (plugin, argv);
+
+
+
+
+
+ mkdir_home
+
+
+ Prototyp:
+
+ int mkdir_home (t_weechat_plugin *plugin, char *directory)
+
+
+
+ Erzeugt ein Verzeichnis im WeeChat-Verzeichnis.
+
+
+ Argumente:
+
+
+
+ : Zeiger auf Pluginstrukur
+
+
+
+
+ : Verzeichnis, das erzeugt werden
+ soll
+
+
+
+
+
+ Rückgabewert: 1 wenn das Verzeichnis erfolgreich erstellt wurde, 0
+ wenn ein Fehler aufgetreten ist.
+
+
+ Beispiel:
+
+if (!plugin->mkdir_home (plugin, "temp"))
+ plugin->print_server(plugin, "Konnte 'temp'-Verzeichnis im WeeChat-Verzeichnis nicht erstellen.");
+
+
+
+
+
+ exec_on_files
+
+
+ Prototyp:
+
+ void exec_on_files (t_weechat_plugin *plugin, char *repertoire,
+ int (*callback)(t_weechat_plugin *, char *))
+
+
+
+ Führe eine Funktion auf allen Dateien eines Verzeichnisses aus.
+
+
+ Argumente:
+
+
+
+ : Zeiger auf eine Plugin-Struktur
+
+
+
+
+ : Verzeichnis der zu verwendenden
+ Dateien
+
+
+
+
+ : die anzuwendende Funktion
+
+
+
+
+
+ Rückgabewert: keiner.
+
+
+ Beispiel:
+
+int callback (t_weechat_plugin *plugin, char *file)
+{
+ plugin->print_server (plugin, "file: %s", file);
+ return 1;
+}
+...
+plugin->exec_on_files (plugin, "/tmp", &callback);
+
+
+
+
+
+ print
+
+
+ Prototyp:
+
+ void print (t_weechat_plugin *plugin,
+ char *server, char *channel, char *message, ...)
+
+
+
+ Sende eine Nachricht an einen WeeChat-Puffer, bezeichnet durch
+ server und channel (beide können NULL sein, dann wird der aktuelle
+ Puffer verwendet).
+
+
+ Argumente:
+
+
+
+ : Zeiger auf Plugin-Struktur
+
+
+
+
+ : interner Name des Servers, zu
+ welchem der Puffer gehört, in dem die Nachricht angezeigt
+ werden soll (kann NULL sein)
+
+
+
+
+ : Name des Channels, in dem die
+ Nachricht angezeigt werden soll (kann NULL sein)
+
+
+
+
+ : Nachricht
+
+
+
+
+
+
+ To display colored text, there are following codes:
+
+
+
+
+ Code
+ Description
+
+
+
+
+ 0x02
+
+ bold text
+
+
+
+ 0x03 + "xx"
+
+ text color "xx"
+ (see for colors)
+
+
+
+ 0x03 + "xx,yy"
+
+ text color "xx"
+ and background "yy"
+ (see for colors)
+
+
+
+ 0x0F
+
+ disable color and attributes
+
+
+
+ 0x12
+
+ reverse video (revert text color with background)
+
+
+
+ 0x1F
+
+ underlined text
+
+
+
+
+
+ Note: the same code (without number for 0x03) may be used to stop
+ the attribute.
+
+
+ Rückgabewert: keiner.
+
+
+ Beispiele:
+
+plugin->print (plugin, NULL, NULL, "hello");
+plugin->print (plugin, NULL, "#weechat", "hello");
+plugin->print (plugin, "freenode", "#weechat", "hello");
+plugin->print (plugin, NULL, NULL,
+ "Test: \x02 Fett \x0F\x03%02d Blau \x03%02d Grün",
+ plugin->get_irc_color (plugin, "blue"),
+ plugin->get_irc_color (plugin, "green"));
+
+
+
+
+
+ print_server
+
+
+ Prototyp:
+
+ void print_server (t_weechat_plugin *plugin,
+ char *message, ...)
+
+
+
+ Zeige eine Nachricht im aktuellen Server-Puffer.
+
+
+ Argumente:
+
+
+
+ : Zeiger auf eine Plugin-Struktur
+
+
+
+
+ : Nachricht
+
+
+
+
+
+
+ To display colored text, see .
+
+
+ Rückgabewert: keiner.
+
+
+ Beispiel: plugin->print_server (plugin, "hello");
+
+
+
+
+ log
+
+
+ Prototyp:
+
+ void log (t_weechat_plugin *plugin,
+ char *server, char *channel, char *message, ...)
+
+
+
+ Schreibe eine Nachricht in die Log-Datei (für den entsprechenden
+ Server/Channel).
+
+
+ Argumente:
+
+
+
+ : Zeiger auf eine Plugin-Struktur
+
+
+
+
+ : interner Name des Servers, zu
+ welchem der Log-Puffer gehört (kann NULL sein)
+
+
+
+
+ : Name des Channels, zu welchem der
+ Log-Puffer gehört (kann NULL sein)
+
+
+
+
+ : Nachricht
+
+
+
+
+
+ Rückgabewert: keiner.
+
+
+ Beispiel:
+
+plugin->log (plugin, "freenode", "#weechat", "test");
+
+
+
+
+
+ msg_handler_add
+
+
+ Prototyp:
+
+ t_plugin_handler *msg_handler_add (t_weechat_plugin
+ *plugin, char *message, t_plugin_handler_func *function,
+ char *handler_args, void *handler_pointer)
+
+
+
+ Erzeuge einen IRC-Message-Handler, der aufgerufen wird, wenn
+ eine Nachricht empfangen wird.
+
+
+ Argumente:
+
+
+
+ : Zeiger auf eine Plugin-Struktur
+
+
+
+
+ : Name (Typ) der IRC-Nachricht ("*"
+ für alle Nachrichten).
+ Eine Liste der bekannten IRC-Nachrichten ist in den
+ RFCs
+ 1459
+ und
+ 2812
+ zu finden.
+ Weiterhin können sie einen speziellen Namen verwenden, der
+ mit "weechat_" beginnt, um spezielle Ereignisse zu
+ bearbeiten, wie in der folgenden Tabelle aufgeführt:
+
+
+
+
+ Name
+ Beschreibung
+
+
+
+
+ weechat_pv
+ private Nachricht empfangen
+
+
+ weechat_highlight
+
+ hervorgehobene Nachricht (in einem Channel oder privatem Chat)
+
+
+
+ weechat_ctcp
+
+ CTCP-Nachricht empfangen (VERSION, PING, ...)
+
+
+
+ weechat_dcc
+
+ DCC-Nachricht empfangen (Chat oder Datei)
+
+
+
+
+
+
+
+
+
+ : Funktion, die aufgerufen wird,
+ wenn eine Nachricht empfangen wurde
+
+
+ Sie verwendet den folgenden Prototyp:
+
+ int my_function (t_weechat_plugin *plugin,
+ int argc, char **argv,
+ char *handler_args, void *handler_pointer)
+
+
+
+ Argument argc ist auf 3 gesetzt, die folgenden Werte sind
+ im argv-Array:
+
+
+ argv[0] = Server Name
+
+
+ argv[1] = IRC Nachricht
+
+
+ argv[2] = Kommando Argumente
+
+
+
+
+
+
+ : Argumente, die beim Aufruf
+ an die Funktion übergeben werden
+
+
+
+
+ : pointer given to function
+ when called
+ : Zeiger, der an die Funktion
+ übergeben wird
+
+
+
+
+
+ Rückgabewert: Zeiger auf den neuen Handler
+
+
+ Hinweis: die Funktion, die aufgerufen wird wenn eine Nachricht
+ empfangen wurde, muss einen der folgenden Werte zurückgeben:
+
+
+
+ PLUGIN_RC_KO: Funktion ist fehlgschlagen
+
+
+
+
+ PLUGIN_RC_OK: Funktion war erfolgreich
+
+
+
+
+ PLUGIN_RC_OK_IGNORE_WEECHAT: Die Nachricht
+ wird nicht an WeeChat übergeben
+
+
+
+
+ PLUGIN_RC_OK_IGNORE_PLUGINS: Die Nachricht
+ wird nicht an andere Plugins weitergegeben
+
+
+
+
+ PLUGIN_RC_OK_IGNORE_ALL: Die Nachricht
+ wird weder an WeeChat noch an andere
+ Plugins weitergegeben
+
+
+
+
+ PLUGIN_RC_OK_WITH_HIGHLIGHT: Funktion
+ erfolgreich vervollständigt und eine Hervorhebung bei den
+ empfangenen Nachrichten eingebaut
+
+
+
+
+
+ Beispiel:
+
+int msg_kick (t_weechat_plugin *plugin, int argc, char **argv,
+ char *handler_args, void *handler_pointer)
+{
+ plugin->print (plugin, argv[0], NULL, "KICK received");
+ return PLUGIN_RC_OK;
+}
+...
+t_plugin_handler *msg_handler;
+msg_handler = plugin->msg_handler_add (plugin, "KICK",
+ &msg_kick, NULL, NULL);
+
+
+
+
+
+ cmd_handler_add
+
+
+ Prototyp:
+
+ t_plugin_handler *cmd_handler_add (t_weechat_plugin
+ *plugin, char *command, char *description, char *arguments,
+ char *arguments_description, char *completion_template,
+ t_plugin_handler_func *fonction, char *handler_args,
+ void *handler_pointer)
+
+
+
+ Erzeugt einen Handler für ein WeeChat-Kommando, der aufgerufen
+ wird, wenn der Anwender das Kommando ausführt (Beispiel: /command).
+
+
+ Argumente:
+
+
+
+ : Zeiger auf eine Plugin-Struktur
+
+
+
+
+ : Name des neuen Kommandos, der auch
+ Name eines bereits existierenden Kommandos sein kann (mit
+ Bedacht zu verwenden, das ersetzte Kommando ist nicht
+ verfügbar, bis das Plugin entfernt wurde)
+
+
+
+
+ : kurze Beschreibung des
+ Kommandos (angezeigt beim Ausführen von /help command)
+
+
+
+
+ : kurze Beschreibung der Argumente
+ des Kommandos (angezeigt beim Ausführen von /help command)
+
+
+
+
+ : lange Beschreibung
+ der Argumente des Kommandos (angezeigt beim Ausführen von
+ /help command)
+
+
+
+
+ : Vorlage für die
+ Vervollständigung; zum Beispiel bedeutet
+ "abc|%w def|%i", dass das erste Argument
+ "abc" oder ein WeeChat-Kommando sein kann und das zweite
+ Argument "def" oder ein IRC-Kommando. Eine leere
+ Zeichenkette bedeutet, dass WeeChat für jedes Argument
+ einen Nicknamen des gegenwärtigen Channels einsetzt, ein
+ NULL oder "-" schaltet die Vervollständigung für alle
+ Argumente ab.
+
+
+ Die folgenden Ersetzungen können verwendet werden:
+
+
+
+
+ Code
+ Beschreibung
+
+
+
+
+ %-
+ keine Vervollständigung für das Argument
+
+
+ %*
+
+
+ repeat last completion for all following arguments
+ (this code has to be at the end of completion
+ template, preceded by "|")
+
+
+
+ %a
+ Alias
+
+
+ %A
+
+ Aliase und Kommandos (WeeChat, IRC und Plugins)
+
+
+
+ %c
+ gegenwärtiger Channel
+
+
+ %C
+ alle channels (inklusive Queries)
+
+
+ %f
+ Dateiname
+
+
+ %h
+ Plugin Kommandos
+
+
+ %i
+ IRC Kommandos (senden)
+
+
+ %I
+ IRC Kommandos (empfangen)
+
+
+ %k
+ Grundfunktionen
+
+
+ %m
+ Nicknamen des gegenwärtigen Servers
+
+
+ %M
+
+ Nicks auf dem gegenwärtigen Server (in allen
+ offenen Channeln)
+
+
+
+ %n
+ Nicknamen des gegenwärtigen Channels
+
+
+ %N
+
+ Nicknamen und Hostnamen des gegenwärtigen
+ Channels
+
+
+
+ %o
+ Konfigurationseinstellungen
+
+
+ %O
+ Plugin Optionen
+
+
+ %p
+ Standard "part" Nachricht
+
+
+ %q
+ Standard "quit" Nachricht
+
+
+ %s
+ Name des gegenwärtigen Servers
+
+
+ %S
+ Namen aller definierten Server
+
+
+ %t
+ Topic des gegenwärtigen Channels
+
+
+ %v
+ Wert einer Konfigurationseinstellung
+
+
+ %V
+ Wert einer Plugin-Option
+
+
+ %w
+ WeeChat Kommandos
+
+
+
+
+
+
+
+
+ : Funktion, die aufgerufen wird,
+ wenn das Kommando ausgeführt wird
+
+
+ Sie verwendet den folgenden Prototypen:
+
+ int my_function (t_weechat_plugin *plugin,
+ int argc, char **argv,
+ char *handler_args, void *handler_pointer)
+
+
+
+ Das Argument argc ist auf 3 gesetzt, das Array argv enthält
+ die folgenden Werte:
+
+
+ argv[0] = Server Name
+
+
+ argv[1] = Kommando
+
+
+ argv[2] = Kommando-Argumente
+
+
+
+
+
+
+ : Argumente, die an die Funktion
+ übergeben werden
+
+
+
+
+ : Zeiger, der an die Funktion
+ übergeben wird
+
+
+
+
+
+ Rückgabewert: Zeiger auf den neuen Kommando-Handler.
+
+
+ Hinweis: die Funktion, die aufgerufen wird, wenn das Kommando
+ ausgeführt wird, muss einen der folgende Werte zurückgeben:
+
+
+
+ PLUGIN_RC_KO: Funktion ist fehlgeschlagen
+
+
+
+
+ PLUGIN_RC_OK: Funktion war erfolgreich
+
+
+
+
+
+ Beispiel:
+
+int cmd_test (t_weechat_plugin *plugin, int argc, char **argv,
+ char *handler_args, void *handler_pointer)
+{
+ plugin->print (plugin, argv[0], NULL,
+ "test command, nick: %s",
+ (argv[2]) ? argv[2] : "none");
+ return PLUGIN_RC_OK;
+}
+...
+t_plugin_handler *cmd_handler;
+cmd_handler = plugin->cmd_handler_add (plugin, "test", "Test command",
+ "[nick]", "nick: nick of channel",
+ "%n", &cmd_test, NULL, NULL);
+
+
+
+
+
+ timer_handler_add
+
+
+ Prototyp:
+
+ t_plugin_handler *timer_handler_add (t_weechat_plugin
+ *plugin, int interval, t_plugin_handler_func *function,
+ char *handler_args, void *handler_pointer)
+
+
+
+ Erzeuge einen zeitgesteuerten Handler, der periodisch
+ eine Funktion aufruft.
+
+
+ Argumente:
+
+
+
+ : Zeiger auf eine Plugin-Struktur
+
+
+
+
+ : Intervall (in Secunden) zwischen
+ zwei Aufrufen der Funktion
+
+
+
+
+ : Funktion, die aufgerufen wird
+
+
+ Sie verwendet den folgenden Prototypen:
+
+ int my_function (t_weechat_plugin *plugin,
+ int argc, char **argv,
+ char *handler_args, void *handler_pointer)
+
+
+
+ Das Argument argc ist auf 0 gesetzt und argv ist auf NULL
+ gesetzt.
+
+
+
+
+ : Argumente der aufgerufenen
+ Funktion
+
+
+
+
+ : Zeiger, der an die Funktion
+ übergeben wird
+
+
+
+
+
+ Rückgabewert: Zeiger auf den neuen timer-Handler.
+
+
+ Hinweis: die Funktion, die aufgerufen wird, muss einen der folgende
+ Werte zurückgeben:
+
+
+
+ PLUGIN_RC_KO: Funktion ist fehlgeschlagen
+
+
+
+
+ PLUGIN_RC_OK: Funktion war erfolgreich
+
+
+
+
+
+ Beispiel:
+
+int my_timer (t_weechat_plugin *plugin, int argc, char **argv,
+ char *handler_args, void *handler_pointer)
+{
+ plugin->print (plugin, NULL, NULL, "my timer");
+ return PLUGIN_RC_OK;
+}
+...
+t_plugin_handler *timer_handler;
+timer_handler = plugin->timer_handler_add (plugin, 60, &my_timer);
+
+
+
+
+
+ keyboard_handler_add
+
+
+ Prototyp:
+
+ t_plugin_handler *keyboard_handler_add (t_weechat_plugin
+ *plugin, t_plugin_handler_func *function,
+ char *handler_args, void *handler_pointer)
+
+
+
+ Erzeugt einen Keyboard-Handler, der nach dem Drücken einer Taste
+ aufgerufen wird.
+
+
+ Argumente:
+
+
+
+ : Zeiger auf eine Plugin-Struktur
+
+
+
+
+ : Die Funktion, die aufgerufen wird
+
+
+ Sie verwendet den folgenden Prototypen:
+
+ int my_function (t_weechat_plugin *plugin,
+ int argc, char **argv,
+ char *handler_args, void *handler_pointer)
+
+
+
+ Das Argument argc ist auf 3 gesetzt, argv enthält die
+ folgenden Werte:
+
+
+
+ argv[0] = Taste, die gedrückt wurde
+ (Name der internen Funktion oder '*' gefolgt von einem
+ Tastaturcode)
+
+
+
+
+ argv[1] = Kommandozeile vor dem Tastendruck
+
+
+
+
+ argv[2] = Kommandozeile nach dem Tastendruck
+
+
+
+
+
+
+
+ : Argumente, die bei Aufruf der
+ Funktion übergeben
+ werden
+
+
+
+
+ : Zeiger auf die Funktion,
+ der bei Aufruf übergeben
+ wird
+
+
+
+
+
+ Rückgabewert: Zeiger auf den Handler.
+
+
+ Hinweis: Die aufgerufene Funktion muss einen der folgenden Werte
+ zurückgeben:
+
+
+
+ PLUGIN_RC_KO: Funktion ist fehlgeschlagen
+
+
+
+
+ PLUGIN_RC_OK: Funktion war erfolgreich
+
+
+
+
+
+ Beispiel:
+
+int my_keyb (t_weechat_plugin *plugin, int argc, char **argv,
+ char *handler_args, void *handler_pointer)
+{
+ if (argc == 2)
+ {
+ plugin->print (plugin, NULL, NULL, "key pressed: %s", argv[0]);
+ if (argv[1] && (argv[1][0] == '1'))
+ plugin->print (plugin, NULL, NULL, "input text changed");
+ else
+ plugin->print (plugin, NULL, NULL, "input text not changed");
+ }
+ return PLUGIN_RC_OK;
+}
+...
+t_plugin_handler *keyb_handler;
+keyb_handler = plugin->keyboard_handler_add (plugin, &my_keyb);
+
+
+
+
+
+ event_handler_add
+
+
+ Prototyp:
+
+ t_plugin_handler *event_handler_add (t_weechat_plugin
+ *plugin, char *event, t_plugin_handler_func *function,
+ char *handler_args, void *handler_pointer)
+
+
+
+ Fügt einen Ereignishandler hinzu, der aufgerufen wird, wenn ein
+ Ereignis eintritt.
+
+
+ Argumente:
+
+
+
+ : Zeiger auf Plugin-Strukture
+
+
+
+
+ : Ereignis (siehe folgende Tabelle)
+
+
+
+
+ : aufgerufene Funktion
+
+
+ Es wird folgender Prototyp verwendet:
+
+ int my_function (t_weechat_plugin *plugin,
+ int argc, char **argv,
+ char *handler_args, void *handler_pointer)
+
+
+
+
+ Arguments depend on event (see table below).
+
+
+
+
+ : Argument, die an die aufgerufene
+ Funktion übergeben werden
+
+
+
+
+ : Pointer, der an die
+ aufgerufene Funktion übergeben werden
+
+
+
+
+
+
+ List of events:
+
+
+
+
+ Ereignis
+ Beschreibung
+ Arguments
+
+
+
+
+ buffer_open
+ ein Puffer wurde geöffnet
+
+ argc = 1, argv = { buffer number }
+
+
+
+ buffer_close
+ ein Puffer wurde geschlossen
+
+ argc = 1, argv = { buffer number }
+
+
+
+ buffer_move
+ a buffer was moved
+
+ argc = 2, argv = { new buffer number, old number }
+
+
+
+
+
+
+
+ Rückgabewert: Pointer auf den neuen Ereignishandler.
+
+
+ Anmerkung: die aufgerufene Function muss einen der folgenden Werte
+ zurückgeben:
+
+
+
+ PLUGIN_RC_KO: Funktion fehlgeschlagen
+
+
+
+
+ PLUGIN_RC_OK: Funktion erfolgreich beendet
+
+
+
+
+
+ Beispiel:
+
+int my_event (t_weechat_plugin *plugin, int argc, char **argv,
+ char *handler_args, void *handler_pointer)
+{
+ plugin->print (plugin, NULL, NULL, "my_event");
+ return PLUGIN_RC_OK;
+}
+...
+t_plugin_handler *event_handler;
+event_handler = plugin->event_handler_add (plugin, "buffer_open",
+ &my_event);
+
+
+
+
+
+ handler_remove
+
+
+ Prototyp:
+
+ void handler_remove (t_weechat_plugin *plugin,
+ t_plugin_handler *handler)
+
+
+
+ Entfernt einen Nachrichten- oder Kommando-Handler.
+
+
+ Argumente:
+
+
+
+ : Zeiger auf eine Plugin-Struktur
+
+
+
+
+ : Handler, der entfernt werden soll
+
+
+
+
+
+ Rückgabewert: keiner
+
+
+ Beispiel:
+ plugin->handler_remove (plugin, my_handler);
+
+
+
+
+ handler_remove_all
+
+
+ Prototyp:
+
+ void handler_remove_all (t_weechat_plugin *plugin)
+
+
+
+ Entfernt alle Handler eines Plugins.
+
+
+ Argumente:
+
+
+
+ : Zeiger auf eine Plugin-Struktur
+
+
+
+
+
+ Rückgabewert: keiner
+
+
+ Beispiel:
+ plugin->handler_remove_all (plugin);
+
+
+
+
+ modifier_add
+
+
+ Prototyp:
+
+ t_plugin_modifier *modifier_add (t_weechat_plugin *plugin,
+ char *type, char *message, t_plugin_modifier_func *function,
+ char *modifier_args, void *modifier_pointer)
+
+
+
+ Füge einen Nachrichtenmodifikator hinzu.
+
+
+ Argumente:
+
+
+
+ : Zeiger auf Plugin-Struktur
+
+
+
+
+ : Modifikatorart:
+
+
+
+
+ Art
+ Beschreibung
+
+
+
+
+ irc_in
+ wird bei eingehenden IRC-Nachrichten aufgerufen
+
+
+ irc_user
+
+ wird bei jeder Benutzernachricht (oder Befehl)
+ aufgerufen (bevor WeeChat die Nachricht parst)
+
+
+
+ irc_out
+
+ wird unmittelbar vor dem Abschicken einer ausgehenden
+ Nachricht an den IRC-Server aufgerufen (auch bei
+ Nachrichten, die WeeChat automatisch an den Server
+ sendet)
+
+
+
+
+
+
+
+
+
+ : Name der IRC-Nachricht (wird nur
+ bei den Arten "irc_in" and "irc_out" benutzt)
+ Um eine Liste der IRC-Nachrichten zu erhalten, lies bitte
+ folgende Dokumente:RFCs
+ 1459
+ and
+ 2812.
+ Außerdem gibt es den Wert "*", der alle Nachrichten
+ anspricht (ohne Filter).
+
+
+
+
+ : aufgerufene Funktion
+
+
+ Folgender Prototyp wird dafür benutzt:
+
+ int my_function (t_weechat_plugin *plugin,
+ int argc, char **argv,
+ char *modifier_args, void *modifier_pointer)
+
+
+
+ Argument argc hat den Wert 2, folgende Werte sind in dem
+ argv-Array:
+
+
+ argv[0] = Servername
+
+
+ argv[1] = Nachricht
+
+
+
+
+
+
+ : an die Funktion übergebene
+ Werte
+
+
+
+
+ : an die Funktion
+ übergebener Zeiger
+
+
+
+
+
+ Rückgabewert: Zeiger auf den neuen Nachrichtenmodifikator
+
+
+ Anmerkung: Die Funktion muss die veränderte Zeichenkette oder NULL
+ (wenn keine Änderungen erfolgten) zurückgeben.
+ Wenn die Funktion eine leere Zeichenkette zurückgibt, wird die
+ Nachricht komplett verworfen und nicht weiter von WeeChat
+ verarbeitet. (Seien Sie vorsichtig mit dem Verwerfen von
+ Nachrichten!) Die zurückgegebene Zeichenkette muss mit malloc()
+ zugewiesen worden sein und wird von WeeChat nach Gebrauch
+ automatisch mit free() wieder freigegeben.
+
+
+ Beispiel:
+
+char *adder (t_weechat_plugin *plugin, int argc, char **argv,
+ char *modifier_args, void *modifier_pointer)
+{
+ char *string;
+ string = malloc (strlen (argv[1]) + 16);
+ strcpy (string, argv[1]);
+ strcat (string, "test");
+ return string;
+}
+...
+t_plugin_modifier *modifier;
+modifier = plugin->modifier_add (plugin, "irc_in", "privmsg",
+ &adder, NULL, NULL);
+
+
+
+
+
+ modifier_remove
+
+
+ Prototyp:
+
+ void modifier_remove (t_weechat_plugin *plugin,
+ t_plugin_modifier *modifier)
+
+
+
+ Entfernt einen Nachrichtenmodifikator.
+
+
+ Arguments:
+
+
+
+ : Zeiger auf Plugin-Struktur
+
+
+
+
+ : zu entfernender Modifikator
+
+
+
+
+
+ Rückgabewert: keiner
+
+
+ Beispiel:
+ plugin->modifier_remove (plugin, my_modifier);
+
+
+
+
+ modifier_remove_all
+
+
+ Prototyp:
+
+ void modifier_remove_all (t_weechat_plugin *plugin)
+
+
+
+ Entfernt alle Modifikatoren für ein Plugin.
+
+
+ Argumente:
+
+
+
+ : Zeiger auf Plugin-Struktur
+
+
+
+
+
+ Rückgabewert: keiner
+
+
+ Beispiel:
+ plugin->modifier_remove_all (plugin);
+
+
+
+
+ exec_command
+
+
+ Prototyp:
+
+ void exec_command (t_weechat_plugin
+ *plugin, char *server, char *channel, char *command)
+
+
+
+ Führe ein WeeChat-Kommando aus (oder sende eine Nachricht an
+ einen Channel).
+
+
+ Argumente:
+
+
+
+ : Zeiger auf eine Plugin-Struktur
+
+
+
+
+ : interner Name des Servers, auf den
+ das Kommando angewendet werden soll (kann NULL sein)
+
+
+
+
+ : Name des Channels, auf den das
+ Kommando angewendet werden soll (kann NULL sein)
+
+
+
+
+ : Kommando
+
+
+
+
+
+ Rückgabewert: keiner
+
+
+ Beispiel:
+
+plugin->exec_command (plugin, NULL, NULL, "/help nick");
+plugin->exec_command (plugin, "freenode", "#weechat", "hello");
+
+
+
+
+
+ get_info
+
+
+ Prototyp:
+
+ char *get_info (t_weechat_plugin *plugin,
+ char *info, char *server)
+
+
+
+ Gib eine Information über WeeChat oder einen Channel zurück.
+
+
+ Argumente:
+
+
+
+ : Zeiger auf eine Plugin-Struktur
+
+
+
+
+ : Name (Typ) der Information:
+
+
+
+
+ Info
+ Beschreibung
+
+
+
+
+ version
+ WeeChats Version
+
+
+ nick
+ Nickname
+
+
+ channel
+
+ Name des Channels (NULL bei einem Server oder
+ Privatchat)
+
+
+
+ server
+ Name des Servers
+
+
+ type
+
+ Puffertyp: 0=standard, 1=DCC, 2=raw IRC data
+
+
+
+ away
+ Status des "away"-Flags
+
+
+ inactivity
+
+ Anzahl der Sekunden seit der letzten
+ Tastenbetätigung
+
+
+
+ input
+
+ Inhalt der Kommandozeile im gegenwärtigen Fenster
+
+
+
+ input_mask
+
+ Inhalt der Farbmaske für die Kommandozeile
+
+
+
+ input_pos
+
+ Position des Cursors in der Kommandozeile
+
+
+
+ weechat_dir
+
+ WeeChat-Verzeichnis (Standard: ~/.weechat/)
+
+
+
+ weechat_libdir
+ WeeChat-Systemverzeichnis (Bibliotheken)
+
+
+ weechat_sharedir
+ WeeChat-Systemverzeichnis (gemeinsame Dateien)
+
+
+
+
+
+
+
+
+ : interner Name des Servers um
+ Informationen zu lesen (wenn benötigt)
+
+
+
+
+
+ Rückgabewert: angeforderte Information oder NULL
+
+
+ Hinweis: das Ergebnis muss nach Nutzung mit "free" wieder
+ freigegeben werden.
+
+
+ Beispiele:
+
+char *version = plugin->get_info (plugin, "version", NULL);
+char *nick = plugin->get_info (plugin, "nick", "freenode");
+char *inactivity = plugin->get_info (plugin, "inactivity", NULL);
+
+plugin->print (plugin, NULL, NULL,
+ "WeeChat version %s, you are %s on freenode "
+ "(inactive for %s seconds)",
+ version, nick, inactivity);
+
+if (version)
+ free (version);
+if (nick)
+ free (nick);
+if (inactivity)
+ free (inactivity);
+
+
+
+
+
+ get_dcc_info
+
+
+ Prototyp:
+
+ t_plugin_info_dcc *get_dcc_info (t_weechat_plugin *plugin)
+
+
+
+ Gib eine Liste der aktiven oder beendeten DCCs zurück.
+
+
+ Argumente:
+
+
+
+ : Zeiger auf eine Plugin-Struktur
+
+
+
+
+
+ Rückgabewert: verkettete Liste von DCCs.
+
+
+
+
+ Typ
+ Feld
+ Beschreibung
+
+
+
+
+ char *
+ server
+ IRC Server
+
+
+ char *
+ channel
+ IRC Channel
+
+
+ int
+ type
+
+ DCC Typ:
+ 0 = Chatanfrage empfangen,
+ 1 = Chatanfrage gesendet,
+ 2 = Datei empfangen,
+ 3 = Datei gesendet
+
+
+
+ int*
+ status
+
+ DCC Status:
+ 0 = wartend,
+ 1 = verbindend,
+ 2 = aktiv,
+ 3 = beendet,
+ 4 = fehlgeschlagen,
+ 5 = unterbrochen durch Anwender
+
+
+
+ time_t
+ start_time
+ Datum/Zeit der Erzeugung der DCC
+
+
+ time_t
+ start_transfer
+ Datum/Zeit des Beginns der Übertragung der DCC
+
+
+ unsigned long
+ addr
+ IP-Adresse des Partners
+
+
+ int
+ port
+ Port der DCC
+
+
+ char *
+ nick
+ Nickname des Partners
+
+
+ char *
+ filename
+ Dateiname
+
+
+ char *
+ local_filename
+ lokaler Dateiname
+
+
+ int
+ filename_suffix
+ Suffix wenn die Datei umbenannt wird
+
+
+ unsigned long
+ size
+ Dateigrösse
+
+
+ unsigned long
+ pos
+ Position in Datei
+
+
+ unsigned long
+ start_resume
+ Startposition nach einer Unterbrechung
+
+
+ unsigned long
+ bytes_per_sec
+
+ Übertragungsrate (Bytes/s) seit Beginn der Übertragung
+
+
+
+ t_plugin_dcc_info *
+ prev_dcc
+
+ Zeiger auf voheriges DCC-Info
+
+
+
+ t_plugin_dcc_info *
+ next_dcc
+
+ Zeiger auf nächstes DCC-Info
+
+
+
+
+
+
+
+
+ Hinweis: Das Ergebnis muss nach der Benutzung mittels
+ "free_dcc_info" wieder freigegeben werden.
+
+
+ Beispiele:
+
+t_plugin_dcc_info *dcc_info = plugin->get_dcc_info (plugin);
+for (ptr_dcc = dcc_info; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
+{
+ plugin->print_server (plugin, "DCC type=%d, with: %s",
+ ptr_dcc->type, ptr_dcc->nick);
+}
+if (dcc_info)
+ plugin->free_dcc_info (plugin, dcc_info);
+
+
+
+
+
+ free_dcc_info
+
+
+ Prototyp:
+
+ void free_dcc_info (t_weechat_plugin *plugin,
+ t_plugin_dcc_info *dcc_info)
+
+
+
+ Gibt den Speicher einer Liste von DCC-Infos wieder frei.
+
+
+ Argumente:
+
+
+
+ : Zeiger auf eine Plugin-Struktur
+
+
+
+
+ : Zeiger auf eine Liste mit
+ DCC-Infos, die mit "get_dcc_info" angelegt wurde
+
+
+
+
+
+ Rückgabewert: keiner.
+
+
+ Beispiel:
+ plugin->free_dcc_info (plugin, dcc_info);
+
+
+
+
+ get_server_info
+
+
+ Prototyp:
+
+ t_plugin_server_info *get_server_info (t_weechat_plugin *plugin)
+
+
+
+ Gibt die Liste von IRC-Servern zurück (verbunden oder nicht)
+
+
+ Argumente:
+
+
+
+ : Zeiger auf eine Plugin-Struktur
+
+
+
+
+
+ Rückgabewert: Liste von IRC-Servern.
+
+
+
+
+ Typ
+ Feld
+ Beschreibung
+
+
+
+
+ char *
+ name
+ interner Servername
+
+
+ int
+ autoconnect
+ 1 wenn Autoconnect gesetzt ist, 0 sonst
+
+
+ int
+ autoreconnect
+
+ 1 wenn autoreconnect gesetzt ist,
+ 0 sonst
+
+
+
+ int
+ autoreconnect_delay
+ Wartezeit vor erneutem Verbindungsversuch
+
+
+ int
+ command_line
+
+ 1 wenn der Servername auf der Kommandozeile angegeben
+ wurde (ist somit temporär) 0 sonst
+
+
+
+ char *
+ address
+ Serveradresse (Name oder IP)
+
+
+ int
+ port
+ Port
+
+
+ int
+ ipv6
+ IPv6-Verbindung
+
+
+ int
+ ssl
+ SSL-Verbindung
+
+
+ char *
+ password
+ Passwort
+
+
+ char *
+ nick1
+ primärer Nickname
+
+
+ char *
+ nick2
+ alternativer Nickname
+
+
+ char *
+ nick3
+ zweiter, alternativer Nickname
+
+
+ char *
+ username
+ Username
+
+
+ char *
+ real name
+ tatsächlicher Name
+
+
+ char *
+ command
+
+ Kommando, dass bei erfolgreicher Verbindung
+ ausgeführt wurde
+
+
+
+ int
+ command_delay
+ Verzögerung nach Ausführung des Kommandos
+
+
+ char *
+ autojoin
+ Channels, die automatisch betreten werden sollen
+
+
+ int
+ autorejoin
+
+ 1 wenn Channels wieder betreten werden sollen, nachdem
+ man gekickt wurde 0 sonst
+
+
+
+ char *
+ notify_levels
+ Benachrichtigungs-Level von Channels
+
+
+ char *
+ charset_decode_iso
+ Zeichensatz zum Dekodieren von ISO
+
+
+ char *
+ charset_decode_utf
+ Zeichensatz zum Dekodieren von UTF
+
+
+ char *
+ charset_encode
+
+ Zeichensatz der Channels zum Kodieren von
+ Nachrichten
+
+
+
+ int
+ is_connected
+ 1 wenn verbunden mit einem Server, 0 otherwise
+
+
+ int
+ ssl_connected
+ 1 wenn verbunden über SSL, 0 sonst
+
+
+ char *
+ nick
+ gegenwärtiger Nickname
+
+
+ int
+ is_away
+ 1 wenn away-flag gesetzt ist, 0 sonst
+
+
+ time_t
+ away_time
+ Zeitspanne seit away-flag gesetzt ist
+
+
+ int
+ lag
+ Lag (in Millisekunden)
+
+
+ t_plugin_server_info *
+ prev_server
+ Zeiger auf vorherigen Knoten der Liste
+
+
+ t_plugin_server_info *
+ next_server
+ Zeiger auf nächsten Knoten der Liste
+
+
+
+
+
+
+ Hinweis: das Ergebnis muss nach der Benutzung mit
+ "free_server_info" wieder freigegeben werden.
+
+
+ Beispiel:
+
+t_plugin_server_info *server_info, *ptr_server_info;
+server_info = plugin->get_server_info (plugin);
+if (server_info)
+{
+ for (ptr_server_info = server_info; ptr_server_info;
+ ptr_server_info = ptr_server_info->next_server)
+ {
+ plugin->print (plugin, NULL, NULL,
+ "server: %s, address: %s, port: %d %s",
+ ptr_server_info->name,
+ ptr_server_info->address,
+ ptr_server_info->port,
+ (ptr_server_info->is_connected) ? "(connected)" : "");
+ }
+ plugin->free_server_info (plugin, server_info);
+}
+
+
+
+
+
+ free_server_info
+
+
+ Prototyp:
+
+ void free_server_info (t_weechat_plugin *plugin,
+ t_plugin_server_info *server_info)
+
+
+
+ Gib den Speicher einer Liste "server info" frei
+
+
+ Argumente:
+
+
+
+ : Zeiger auf eine Plugin-Struktur
+
+
+
+
+ : Zeiger auf eine Server-Liste,
+ der von der Funktion "get_server_info" zurückgegeben wurde.
+
+
+
+
+
+ Rückgabewert: keiner.
+
+
+ Beispiel:
+ plugin->free_server_info (plugin, server_info);
+
+
+
+
+ get_channel_info
+
+
+ Prototyp:
+
+ t_plugin_channel_info *get_channel_info (t_weechat_plugin *plugin,
+ char *server)
+
+
+
+ Gib eine Liste der Channels für einen Server zurück.
+
+
+ Argumente:
+
+
+
+ : Zeiger auf eine Plugin-Struktur
+
+
+
+
+ : interner Name des Server
+
+
+
+
+
+ Rückgabewert: verkettete Liste von Channels für einen Server.
+
+
+
+
+ Typ
+ Feld
+ Beschreibung
+
+
+
+
+ int
+ type
+
+ 0 für einen normalen Channel, 1 für einen Privaten
+
+
+
+ char *
+ name
+ Name des Channels
+
+
+ char *
+ topic
+ Topic des Channels
+
+
+ char *
+ modes
+ Channelmodus (Flags)
+
+
+ int
+ limit
+ Anzahl der erlaubten User
+
+
+ char *
+ key
+ Schlüssel des Channels
+
+
+ int
+ nicks_count
+ Anzahl der Nicknamen des Channels
+
+
+ t_plugin_channel_info *
+ prev_channel
+ Zeiger auf vorherigem Knoten der Liste
+
+
+ t_plugin_channel_info *
+ next_channel
+ Zeiger auf nächsten Knoten der Liste
+
+
+
+
+
+
+ Hinweis: Das Ergebnis muss nach der Benutzung mit
+ "free_channel_info" wieder freigegeben werden.
+
+
+ Beispiel:
+
+t_plugin_channel_info *channel_info, *ptr_chan_info;
+channel_info = plugin->get_channel_info (plugin, "freenode");
+if (channel_info)
+{
+ for (ptr_chan_info = channel_info; ptr_chan_info;
+ ptr_chan_info = ptr_chan_info->next_channel)
+ {
+ plugin->print (plugin, NULL, NULL,
+ " %s (type %d)",
+ ptr_chan_info->name,
+ ptr_chan_info->type);
+ }
+ plugin->free_channel_info (plugin, channel_info);
+}
+
+
+
+
+
+ free_channel_info
+
+
+ Prototyp:
+
+ void free_channel_info (t_weechat_plugin *plugin,
+ t_plugin_channel_info *channel_info)
+
+
+
+ Gibt den Speicher einer Liste "channel info" wieder frei.
+
+
+ Argumente:
+
+
+
+ : Zeiger auf eine Plugin-Struktur
+
+
+
+
+ : Zeiger auf eine Liste
+ "channel info", der von "get_channel_info" zurückgegeben
+ wurde
+
+
+
+
+
+ Rückgabewert: keiner.
+
+
+ Beispiel:
+ plugin->free_channel_info (plugin, channel_info);
+
+
+
+
+ get_nick_info
+
+
+ Prototyp:
+
+ t_plugin_nick_info *get_nick_info (t_weechat_plugin *plugin,
+ char *server, char *channel)
+
+
+
+ Gib eine Liste der Nicknamen für einen Channel zurück.
+
+
+ Argumente:
+
+
+
+ : Zeiger auf eine Plugin-Struktur
+
+
+
+
+ : interner Name des Servers
+
+
+
+
+ : Name des Channels
+
+
+
+
+
+ Rückgabewert: verkettete Liste von Nicknamen eines Channels.
+
+
+
+
+ Typ
+ Feld
+ Beschreibung
+
+
+
+
+ char *
+ nick
+ Nickname
+
+
+ char *
+ host
+ Hostname
+
+
+ int
+ Flags
+
+ Flags, die für einen Nicknamen gesetzt sind:
+ Zweierpotenzen "oder" Zwischenwerte
+ (1 = channel owner,
+ 2 = channel admin,
+ 4 = op,
+ 8 = halfop,
+ 16 = voice,
+ 32 = away)
+
+
+
+ t_plugin_nick_info *
+ prev_nick
+ Zeiger auf vorherigen Knoten der Liste
+
+
+ t_plugin_nick_info *
+ next_nick
+ Zeiger auf nächsten Knoten der Liste
+
+
+
+
+
+
+ Hinweis: Das Ergebnis muss nach der Benutzung mit "free_nick_info" wieder freigegeben werden.
+
+
+ Beispiel:
+
+t_plugin_nick_info *nick_info, *ptr_nick_info;
+nick_info = plugin->get_nick_info (plugin, "freenode", "#weechat");
+if (nick_info)
+{
+ for (ptr_nick_info = nick_info; ptr_nick_info;
+ ptr_nick_info = ptr_nick_info->next_nick)
+ {
+ plugin->print (plugin, NULL, NULL,
+ " %s (flags: %d)",
+ ptr_nick_info->nick,
+ ptr_nick_info->flags);
+ }
+ plugin->free_nick_info (plugin, nick_info);
+}
+
+
+
+
+
+ free_nick_info
+
+
+ Prototyp:
+
+ void free_nick_info (t_weechat_plugin *plugin,
+ t_plugin_nick_info *nick_info)
+
+
+
+ Gibt den Speicher einer Liste "nick info" frei.
+
+
+ Argumente:
+
+
+
+ : Zeiger auf eine Plugin-Struktur
+
+
+
+
+ : Zeiger auf eine Liste
+ "nick info", der von "get_nick_info" zurückgegeben wurde
+
+
+
+
+
+ Rückgabewert: keiner.
+
+
+ Beispiel:
+ plugin->free_nick_info (plugin, nick_info);
+
+
+
+
+ get_config
+
+
+ Prototyp:
+
+ char *get_config (t_weechat_plugin *plugin, char *option)
+
+
+
+ Gibt den Wert einer Option der WeeChat-Konfiguration zurück.
+
+
+ Argumente:
+
+
+
+ : Zeiger auf eine Plugin-Struktur
+
+
+
+
+ : Name der Option
+
+
+
+
+
+ Rückgabewert: Wert der Option, oder NULL, wenn nichts gefunden wurde.
+
+
+ Hinweis: Das Ergebnis muss nach der Benutzung mit "free" wieder
+ freigegeben werden.
+
+
+ Beispiel:
+
+char *value1 = plugin->get_config (plugin, "look_set_title");
+char *value2 = plugin->get_config (plugin, "freenode.server_autojoin");
+
+
+
+
+
+ set_config
+
+
+ Prototyp:
+
+ int set_config (t_weechat_plugin *plugin,
+ char *option, char *value)
+
+
+
+ Setze den Wert einer Option der WeeChat-Konfiguration.
+
+
+ Argumente:
+
+
+
+ : Zeiger auf eine Plugin-Struktur
+
+
+
+
+ : Name der Option
+
+
+
+
+ : der neue Wert der Option
+
+
+
+
+
+ Rückgabewert: 1 wenn der Wert der Option gesetzt werden konnte,
+ 0 bei Auftreten eines Fehlers.
+
+
+ Beispiel:
+
+plugin->set_config (plugin, "look_nicklist", "off");
+
+
+
+
+
+ get_plugin_config
+
+
+ Prototyp:
+
+ char *get_plugin_config (t_weechat_plugin *plugin, char *option)
+
+
+
+ Gibt den Wert einer Option eines Plugins zurück.
+ Die Option wird aus "~/.weechat/plugins.rc"
+ gelesen und sieht so aus: "plugin.option=value"
+ (Hinweis: der Name des Plugins wird automatisch gesetzt).
+
+
+
+ Argumente:
+
+
+
+ : Zeiger auf eine Plugin-Struktur
+
+
+
+
+ : Name der Option
+
+
+
+
+
+ Rückgabewert: Wert der Option, NULL wenn nichts gefunden wurde.
+
+
+ Hinweis: Das Ergebnis muss nach der Benutzung mit "free" wieder
+ freigegeben werden.
+
+
+ Beispiel:
+
+char *value = plugin->get_plugin_config (plugin, "my_var");
+
+
+
+
+
+ set_plugin_config
+
+
+ Prototyp:
+
+ int set_plugin_config (t_weechat_plugin *plugin,
+ char *option, char *value)
+
+
+
+ Setzt den Wert einer Option eines Plugins.
+ Die Option wird in die Datei
+ "~/.weechat/plugins.rc" geschrieben
+ und sieht so aus: "plugin.option=value"
+ (Hinweis: der Name des Plugins wird automatisch gesetzt)
+
+
+ Argumente:
+
+
+
+ : Zeiger auf eine Plugin-Struktur
+
+
+
+
+ : Name der Option, die gesetzt werden soll
+
+
+
+
+ : Wert der zu setzenden Option
+
+
+
+
+
+ Rückgabewert: 1 wenn die Option gesetzt werden konnte, 0 wenn ein
+ Fehler aufgetreten ist.
+
+
+ Beispiel:
+
+plugin->set_plugin_config (plugin, "my_var", "value");
+
+
+
+
+
+ get_irc_color
+
+
+ Prototype:
+
+ int get_irc_color (t_weechat_plugin *plugin,
+ char *color_name)
+
+
+
+ Hole IRC-Farbindex mit dem Farbnamen.
+
+
+ Argumente:
+
+
+
+ : Zeiger auf die Pluginstruktur
+
+
+
+
+ : Farbname
+ Folgende Farben sind erlaubt:
+
+
+
+
+ Farbname
+ Wert
+
+
+
+
+ white
+ 0
+
+
+ black
+ 1
+
+
+ blue
+ 2
+
+
+ green
+ 3
+
+
+ lightred
+ 4
+
+
+ red
+ 5
+
+
+ magenta
+ 6
+
+
+ brown
+ 7
+
+
+ yellow
+ 8
+
+
+ lightgreen
+ 9
+
+
+ cyan
+ 10
+
+
+ lightcyan
+ 11
+
+
+ lightblue
+ 12
+
+
+ lightmagenta
+ 13
+
+
+ gray
+ 14
+
+
+ lightgray
+ 15
+
+
+
+
+
+
+
+
+
+ Rückgabewert: IRC-Farbindex, -1 wenn die Farbe nicht gefunden wurde.
+
+
+ Beispiel:
+
+int color_blue = plugin->get_irc_color (plugin, "blue"); /* return 2 */
+
+
+
+
+
+
+
+ get_window_info
+
+
+ Prototype:
+
+ t_plugin_window_info *get_window_info (t_weechat_plugin *plugin)
+
+
+
+ Gibt die Liste der WeeChat-Fenster zurück.
+
+
+ Argumente:
+
+
+
+ : Zeiger auf Pluginstruktur
+
+
+
+
+
+ Rückgabewert: verkettete Liste der WeeChat-Fenster.
+
+
+
+
+ Typ
+ Feld
+ Beschreibung
+
+
+
+
+ int
+ win_x
+ horizontale Fensterposition
+
+
+ int
+ win_y
+ vertikale Fensterposition
+
+
+ int
+ win_width
+ Fensterbreite
+
+
+ int
+ win_height
+ Fensterhöhe
+
+
+ int
+ win_width_pct
+
+ Breite in % (im Vergleich zum übergeordneten Fenster)
+
+
+
+ int
+ win_height_pct
+
+ Höhe % (im Vergleich zum übergeordneten Fenster)
+
+
+
+ int
+ num_buffer
+ Anzahl der angezeigten Puffer
+
+
+ t_plugin_window_info *
+ prev_window
+
+ Zeiger auf die Informationen des vorhergehenden Fensters
+
+
+
+ t_plugin_window_info *
+ next_window
+
+ Zeiger auf die Informationen des nächsten Fensters
+
+
+
+
+
+
+
+ Anmerkung: Das Ergebnis muss nach Benutzung durch einen Aufruf der
+ "free_window_info"-Funktion gelöscht werden.
+
+
+ Example:
+
+t_plugin_window_info *window_info, *ptr_window;
+
+window_info = plugin->get_window_info (plugin);
+if (window_info)
+{
+ for (ptr_window = window_info; ptr_window; ptr_window = ptr_window->next_window)
+ {
+ plugin->print (plugin, NULL, NULL, "--- window info ---");
+ plugin->print (plugin, NULL, NULL, "(%d,%d), size: %dx%d, %%size: %d%%x%d%%",
+ ptr_window->win_x, ptr_window->win_y,
+ ptr_window->win_width, ptr_window->win_height,
+ ptr_window->win_width_pct, ptr_window->win_height_pct);
+ plugin->print (plugin, NULL, NULL, "num_buffer: %d", ptr_window->num_buffer);
+ }
+ plugin->free_window_info (plugin, window_info);
+}
+else
+ plugin->print (plugin, NULL, NULL, "no window info!");
+
+
+
+
+
+ free_window_info
+
+
+ Prototyp:
+
+ void free_window_info (t_weechat_plugin *plugin,
+ t_plugin_window_info *window_info)
+
+
+
+ Gibt den Speicher wieder frei, der von der
+ Fenster-Informationsliste belegt wird.
+
+
+ Argumente:
+
+
+
+ : Zeiger auf Pluginstruktur
+
+
+
+
+ : Zeiger auf
+ Fenster-Informationsliste, der von der
+ "get_window_info"-Funktion zurückgegeben wurde
+
+
+
+
+
+ Rückgabewert: keiner.
+
+
+ Beispiel:
+ plugin->free_window_info (plugin, window_info);
+
+
+
+
+ get_buffer_info
+
+
+ Prototyp:
+
+ t_plugin_buffer_info *get_buffer_info (t_weechat_plugin *plugin)
+
+
+
+ Gibt eine Liste der WeeChat-Puffer zurück.
+
+
+ Argumente:
+
+
+
+ : Zeiger auf Pluginstruktur
+
+
+
+
+
+ Rückgabewert: verkettete Liste der WeeChat-Puffer.
+
+
+
+
+ Typ
+ Feld
+ Beschreibung
+
+
+
+
+ int
+ type
+ Puffertyp: 0=standard, 1=DCC, 2=raw IRC data
+
+
+ int
+ number
+ Puffer-Nummer
+
+
+ int
+ num_displayed
+ Anzahl der Fenster im Puffer
+
+
+ char *
+ server_name
+ Servername für den Puffer (kann NULL sein)
+
+
+ char *
+ channel_name
+ Channelname für den Puffer (kann NULL sein)
+
+
+ int
+ notify_level
+ Benachrichtigungslevel für den Puffer
+
+
+ char *
+ log_filename
+
+ Name der Logdatei (NULL bedeutet, dass nichts geloggt
+ wird)
+
+
+
+ t_plugin_buffer_info *
+ prev_buffer
+ Zeiger auf die vorhergehenden Pufferinformationen
+
+
+ t_plugin_buffer_info *
+ next_buffer
+ Zeiger auf die nächsten Pufferinformationen
+
+
+
+
+
+
+ Bemerkung: Das Ergebnis muss nach der Auswertung mit der
+ "free_buffer_info"-Funktion wieder gelöscht werden.
+
+
+ Beispiel:
+
+t_plugin_buffer_info *buffer_info, *ptr_buffer;
+
+buffer_info = plugin->get_buffer_info (plugin);
+if (buffer_info)
+{
+ for (ptr_buffer = buffer_info; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
+ {
+ plugin->print (plugin, NULL, NULL, "--- buffer info ---");
+ plugin->print (plugin, NULL, NULL, "type: %d", ptr_buffer->type);
+ plugin->print (plugin, NULL, NULL, "number: %d", ptr_buffer->number);
+ plugin->print (plugin, NULL, NULL, "num_displayed: %d", ptr_buffer->num_displayed);
+ plugin->print (plugin, NULL, NULL, "server: %s", ptr_buffer->server_name);
+ plugin->print (plugin, NULL, NULL, "channel: %s", ptr_buffer->channel_name);
+ plugin->print (plugin, NULL, NULL, "notify level: %d", ptr_buffer->notify_level);
+ plugin->print (plugin, NULL, NULL, "log filename: %s", ptr_buffer->log_filename);
+ }
+ plugin->free_buffer_info (plugin, buffer_info);
+}
+else
+ plugin->print (plugin, NULL, NULL, "no buffer info!");
+
+
+
+
+
+ free_buffer_info
+
+
+ Prototyp:
+
+ void free_buffer_info (t_weechat_plugin *plugin,
+ t_plugin_buffer_info *buffer_info)
+
+
+
+ Gibt den Speicher frei, der von der Puffer-Informationsliste
+ belegt wird.
+
+
+ Argumente:
+
+
+
+ : Zeiger auf Pluginstruktur
+
+
+
+
+ : pointer to buffer info list
+ returned by "get_buffer_info" function
+
+
+
+
+
+ Rückgabewert: keiner.
+
+
+ Beispiel:
+ plugin->free_buffer_info (plugin, buffer_info);
+
+
+
+
+ get_buffer_data
+
+
+ Prototype:
+
+ t_plugin_buffer_data *get_buffer_info (t_weechat_plugin *plugin,
+ char *server, char *channel)
+
+
+
+ Gibt den Inhalt des Puffers zurück.
+
+
+ Argumente:
+
+
+
+ : Zeiger auf Pluginstruktur
+
+
+
+
+ : interner Name des Servers
+
+
+
+
+ : Channelname
+
+
+
+
+
+ Rückgabewert: Pufferinhalt (verkettete Liste mit den Zeilen).
+
+
+
+
+ Typ
+ Feld
+ Beschreibung
+
+
+
+
+ time_t
+ date
+ Datum/Zeit
+
+
+ char *
+ nick
+ Nick
+
+
+ char *
+ data
+ Zeileninhalt (Farbcodes wurden entfernt)
+
+
+ t_plugin_buffer_line *
+ prev_line
+ Zeiger auf die vorherige Zeile
+
+
+ t_plugin_buffer_line *
+ next_line
+ Zeiger auf die nächste Zeile
+
+
+
+
+
+
+ Bemerkung: Das Ergebnis muss nach der Auswertung mit der
+ "free_buffer_data"-Funktion wieder gelöscht werden.
+
+
+ Example:
+
+t_plugin_buffer_line *buffer_line, *ptr_line;
+char text_time[256];
+
+buffer_line = plugin->get_buffer_data (plugin);
+if (buffer_line)
+{
+ for (ptr_line = buffer_line; ptr_line; ptr_line = ptr_line->next_line)
+ {
+ strftime (text_time, sizeof (text_time), "%x %X", localtime (&(ptr_line->date)));
+ plugin->print (plugin, NULL, NULL, "date: %s, nick: %s, data: %s",
+ text_time, ptr_line->nick, ptr_line->data);
+ }
+ plugin->free_buffer_data (plugin, buffer_line);
+}
+
+
+
+
+
+ free_buffer_data
+
+
+ Prototype:
+
+ void free_buffer_data (t_weechat_plugin *plugin,
+ t_plugin_buffer_line *buffer_line)
+
+
+
+ Gibt den Speicher frei, der von den Pufferzeilen belegt wurde.
+
+
+ Arguments:
+
+
+
+ : Zeiger auf Pluginstruktur
+
+
+
+
+ : Zeiger auf Pufferzeilen, der
+ von der "get_buffer_data"-Funktion zurückgegeben wurde
+
+
+
+
+
+ Rückgabewert: keiner.
+
+
+ Beispiele:
+ plugin->free_buffer_data (plugin, buffer_line);
+
+
+
+
+
+-->
diff --git a/doc/de/dev/plugin_scripts.de.xml b/doc/de/dev/plugin_script_api.de.xml
similarity index 100%
rename from doc/de/dev/plugin_scripts.de.xml
rename to doc/de/dev/plugin_script_api.de.xml
diff --git a/doc/de/dev/plugins.de.xml b/doc/de/dev/plugins.de.xml
index 8ceb59370..90f4999cf 100644
--- a/doc/de/dev/plugins.de.xml
+++ b/doc/de/dev/plugins.de.xml
@@ -133,8 +133,6 @@ along with this program. If not, see .
-
-
Übersetzen eines Plugins
@@ -244,14 +242,4 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
- &plugin_irc.de.xml;
-
-
-
- &plugin_fifo.de.xml;
-
-
-
- &plugin_xfer.de.xml;
-
diff --git a/doc/de/dev/weechat_dev.de.xml b/doc/de/dev/weechat_dev.de.xml
index a2bbecf51..30a32925f 100644
--- a/doc/de/dev/weechat_dev.de.xml
+++ b/doc/de/dev/weechat_dev.de.xml
@@ -30,11 +30,12 @@ along with this program. If not, see .
%include_autogen.xml;
-
-
-
-
-
+
+
+
+
+
+
]>
@@ -100,7 +101,9 @@ along with this program. If not, see .
&intro.de.xml;
-
+ &plugins.de.xml;
+
+ &plugin_api.de.xml;
&authors.de.xml;
diff --git a/doc/en/Makefile.am b/doc/en/Makefile.am
index cafbfaf51..07e89ed38 100644
--- a/doc/en/Makefile.am
+++ b/doc/en/Makefile.am
@@ -48,29 +48,29 @@ BOOK_COMMON_INCLUDE = authors.$(LANGCODE).xml \
intro.$(LANGCODE).xml
BOOK_USER = weechat_user.$(LANGCODE)
-BOOK_USER_INCLUDE = user/install.$(LANGCODE).xml \
- user/usage.$(LANGCODE).xml \
- user/plugins.$(LANGCODE).xml \
- user/plugin_alias.$(LANGCODE).xml \
- user/plugin_aspell.$(LANGCODE).xml \
- user/plugin_charset.$(LANGCODE).xml \
- user/plugin_fifo.$(LANGCODE).xml \
- user/plugin_irc.$(LANGCODE).xml \
- user/plugin_logger.$(LANGCODE).xml \
- user/plugin_scripts.$(LANGCODE).xml \
+BOOK_USER_INCLUDE = user/install.$(LANGCODE).xml \
+ user/usage.$(LANGCODE).xml \
+ user/plugins.$(LANGCODE).xml \
+ user/plugin_alias.$(LANGCODE).xml \
+ user/plugin_aspell.$(LANGCODE).xml \
+ user/plugin_charset.$(LANGCODE).xml \
+ user/plugin_fifo.$(LANGCODE).xml \
+ user/plugin_irc.$(LANGCODE).xml \
+ user/plugin_logger.$(LANGCODE).xml \
+ user/plugin_scripts.$(LANGCODE).xml \
user/plugin_xfer.$(LANGCODE).xml
BOOK_DEV = weechat_dev.$(LANGCODE)
-BOOK_DEV_INCLUDE = dev/plugin_api.$(LANGCODE).xml \
- dev/plugin_scripts.$(LANGCODE).xml \
- dev/plugins.$(LANGCODE).xml \
- dev/weechat_dev.$(LANGCODE).xml
+BOOK_DEV_INCLUDE = dev/plugins.$(LANGCODE).xml \
+ dev/plugin_api.$(LANGCODE).xml \
+ dev/plugin_c_api.$(LANGCODE).xml \
+ dev/plugin_script_api.$(LANGCODE).xml
QUICKSTART = weechat_quickstart.$(LANGCODE).txt
-EXTRA_DIST = $(BOOK_AUTOGEN_INCLUDE) $(BOOK_COMMON_INCLUDE) \
- user/$(BOOK_USER).xml $(BOOK_USER_INCLUDE) \
- dev/$(BOOK_DEV).xml $(BOOK_DEV_INCLUDE) \
+EXTRA_DIST = $(BOOK_AUTOGEN_INCLUDE) $(BOOK_COMMON_INCLUDE) \
+ user/$(BOOK_USER).xml $(BOOK_USER_INCLUDE) \
+ dev/$(BOOK_DEV).xml $(BOOK_DEV_INCLUDE) \
$(QUICKSTART)
if DBLATEX_FOUND
diff --git a/doc/en/dev/plugin_api.en.xml b/doc/en/dev/plugin_api.en.xml
index 8d90cb480..3dd037d75 100644
--- a/doc/en/dev/plugin_api.en.xml
+++ b/doc/en/dev/plugin_api.en.xml
@@ -21,4708 +21,11 @@ along with this program. If not, see .
-->
-
+
Plugin API
-
+ &plugin_c_api.en.xml;
-
- Strings
-
-
- Many string functions below are already available thru standard C
- functions, but it's recommended to use functions in this API because
- they are ok with UTF-8 and locale.
-
-
-
- weechat_charset_set
-
-
- Prototype:
-
- void weechat_charset_set (const char *charset)
-
-
-
- Set new plugin charset.
-
-
- Arguments:
-
-
-
- : new charset to use
-
-
-
-
-
- Example:
- weechat_charset_set (plugin, "iso-8859-1");
-
-
-
-
- weechat_iconv_to_internal
-
-
- Prototype:
-
- void weechat_iconv_to_internal (const char *charset,
- const char *string)
-
-
-
- Convert string to WeeChat internal charset (UTF-8).
-
-
- Arguments:
-
-
-
- : charset to convert
-
-
-
-
- : string to convert
-
-
-
-
-
- Return value: converted string.
-
-
- Note: result has to be free by a call to "free" after use.
-
-
- Example:
- char *str = weechat_iconv_to_internal (plugin, "iso-8859-1", "iso string: é à");
-
-
-
-
- weechat_iconv_from_internal
-
-
- Prototype:
-
- void weechat_iconv_from_internal (const char *charset,
- const char *string)
-
-
-
- Convert string from internal WeeChat charset (UTF-8) to another.
-
-
- Arguments:
-
-
-
- : target charset
-
-
-
-
- : string to convert
-
-
-
-
-
- Return value: converted string.
-
-
- Note: result has to be free by a call to "free" after use.
-
-
- Example:
- char *str = weechat_iconv_from_internal ("iso-8859-1", "utf-8 string: é à");
-
-
-
-
- weechat_gettext
-
-
- Prototype:
-
- char *weechat_gettext (const char *string)
-
-
-
- Return translated string (depends on local language).
-
-
- Arguments:
-
-
-
- : string to translate
-
-
-
-
-
- Return value: translated string.
-
-
- Example:
- char *str = weechat_gettext ("hello !");
-
-
-
-
- weechat_ngettext
-
-
- Prototype:
-
- char *weechat_ngettext (const char *string, const char *plural,
- int count)
-
-
-
- Return translated string, using single or plural form, according to
- count.
-
-
- Arguments:
-
-
-
- : string to translate (single form)
-
-
-
-
- : string to translate (plural form)
-
-
-
-
- : used to choose between single and plural
- form
-
-
-
-
-
- Return value: translated string.
-
-
- Example:
- char *str = weechat_ngettext ("file", "files", num_files);
-
-
-
-
- weechat_strndup
-
-
- Prototype:
-
- char *weechat_strndup (const char *string, int length)
-
-
-
- Return duplicated string, with max "length" chars.
-
-
- Arguments:
-
-
-
- : string to duplicate
-
-
-
-
- : max chars to duplicate
-
-
-
-
-
- Return value: duplicated string.
-
-
- Note: result has to be free by a call to "free" after use.
-
-
- Example:
- char *str = weechat_strndup ("abcdef", 3); /* result: "abc" */
-
-
-
-
- weechat_string_tolower
-
-
- Prototype:
-
- char *weechat_string_tolower (const char *string)
-
-
-
- Convert UTF-8 string to lower case.
-
-
- Arguments:
-
-
-
- : string to convert
-
-
-
-
-
- Return value: none.
-
-
- Example:
- weechat_string_tolower ("AbCdEé"); /* result: "abcdeé" */
-
-
-
-
- weechat_string_toupper
-
-
- Prototype:
-
- char *weechat_string_toupper (const char *string)
-
-
-
- Convert UTF-8 string to upper case.
-
-
- Arguments:
-
-
-
- : string to convert
-
-
-
-
-
- Return value: none.
-
-
- Example:
- weechat_string_toupper ("AbCdEé"); /* result: "ABCDEé" */
-
-
-
-
- weechat_strcasecmp
-
-
- Prototype:
-
- int weechat_strcasecmp (const char *string1, const char *string2)
-
-
-
- Locale and case independent string comparison.
-
-
- Arguments:
-
-
-
- : first string for comparison
-
-
-
-
- : second string for comparison
-
-
-
-
-
- Return value: difference between two strings: negative if
- string1 < string2, zero if string1 == string2, positive if
- string1 > string2
-
-
- Example:
- int diff = weechat_strcasecmp ("aaa", "CCC"); /* == -2 */
-
-
-
-
- weechat_strncasecmp
-
-
- Prototype:
-
- int weechat_strncasecmp (const char *string1, const char *string2,
- int max)
-
-
-
- Locale and case independent string comparison, for "max" chars.
-
-
- Arguments:
-
-
-
- : first string for comparison
-
-
-
-
- : second string for comparison
-
-
-
-
- : max number of chars for comparison
-
-
-
-
-
- Return value: difference between two strings: negative if
- string1 < string2, zero if string1 == string2, positive if
- string1 > string2
-
-
- Example:
- int diff = weechat_strncasecmp ("aaa", "CCC", 2); /* == -2 */
-
-
-
-
- weechat_strcmp_ignore_chars
-
-
- Prototype:
-
- int weechat_strcmp_ignore_chars (const char *string1,
- const char *string2, const char *chars_ignored, int case_sensitive)
-
-
-
- Locale (and optionally case independent) string comparison, ignoring
- some chars.
-
-
- Arguments:
-
-
-
- : first string for comparison
-
-
-
-
- : second string for comparison
-
-
-
-
- : string with chars to ignore
-
-
-
-
- : 1 for case sensitive comparison,
- 0 otherwise
-
-
-
-
-
- Return value: difference between two strings: negative if
- string1 < string2, zero if string1 == string2, positive if
- string1 > string2
-
-
- Example:
- int diff = weechat_strcmp_ignore_chars ("a-b", "--a-e", "-", 1); /* == -3 */
-
-
-
-
- weechat_strcasestr
-
-
- Prototype:
-
- int weechat_strcasestr (const char *string, const char *search)
-
-
-
- Locale and case independent string search.
-
-
- Arguments:
-
-
-
- : string
-
-
-
-
- : string to search in "string"
-
-
-
-
-
- Return value: pointer to string found, or NULL if not found
-
-
- Example:
- char *pos = weechat_strcasestr ("aBcDeF", "de"); /* result: pointer to "DeF" */
-
-
-
-
- weechat_string_match
-
-
- Prototype:
-
- int weechat_string_match (const char *string, const char *mask,
- int case_sensitive)
-
-
-
- Check if a string matches a mask. Mask may begin or end with "*" (no
- other "*" are allowed inside mask).
-
-
- Arguments:
-
-
-
- : string
-
-
-
-
- : mask
-
-
-
-
- : 1 for case sensitive search,
- otherwise 0
-
-
-
-
-
- Return value: 1 if string matches mask, otherwise 0.
-
-
- Examples:
-
-int match1 = weechat_string_match ("abcdef", "abc*", 0); /* == 1 */
-int match2 = weechat_string_match ("abcdef", "*dd*", 0); /* == 0 */
-int match3 = weechat_string_match ("abcdef", "*def", 0); /* == 1 */
-
-
-
-
-
- weechat_string_replace
-
-
- Prototype:
-
- char *weechat_string_replace (const char *string, const char *search,
- const char *replace)
-
-
-
- Replace "search" string by new one in a string.
-
-
- Arguments:
-
-
-
- : string
-
-
-
-
- : string to replace
-
-
-
-
- : replacement for "search" string
-
-
-
-
-
- Return value: string with "search" replaced by "replace".
-
-
- Note: result has to be free by a call to "free" after use.
-
-
- Example:
- char *str = weechat_string_replace ("test", "s", "x"); /* result: "text" */
-
-
-
-
- weechat_string_remove_quotes
-
-
- Prototype:
-
- char *weechat_string_remove_quotes (const char *string,
- const char *quotes)
-
-
-
- Remove quotes at beginning/end of string (ignore spaces if there are
- before first quote or after last quote).
-
-
- Arguments:
-
-
-
- : string
-
-
-
-
- : string with list of quotes
-
-
-
-
-
- Return value: string without quotes at beginning/end.
-
-
- Note: result has to be free by a call to "free" after use.
-
-
- Example:
- char *str = weechat_string_remove_quotes (string, " 'abc' ", "'"); /* result: "abc" */
-
-
-
-
- weechat_string_strip
-
-
- Prototype:
-
- char *weechat_string_strip (const char *string, int left, int right,
- const char *chars)
-
-
-
- Strip chars at beginning and/or end of string.
-
-
- Arguments:
-
-
-
- : string
-
-
-
-
- : strip left chars if different from 0
-
-
-
-
- : strip right chars if different from 0
-
-
-
-
- : string with chars to strip
-
-
-
-
-
- Return value: stripped string.
-
-
- Note: result has to be free by a call to "free" after use.
-
-
- Example:
- char *str = weechat_strip (string, " ", 0, 1); /* remove spaces at end of string */
-
-
-
-
- weechat_string_has_highlight
-
-
- Prototype:
-
- char *weechat_string_has_highlight (const char *string,
- const char highlight_words)
-
-
-
- Check if a string has highlights, using list of highlight words.
-
-
- Arguments:
-
-
-
- : string
-
-
-
-
- : list of highlight words,
- separated by comma
-
-
-
-
-
- Return value: 1 if string has one or more highlights, 0 otherwise.
-
-
- Example:
- if (weechat_string_has_highlight (string, "word1,word2")) ...
-
-
-
-
- weechat_string_explode
-
-
- Prototype:
-
- char **weechat_string_explode (const char *string,
- const char *separators, int keep_eol, int num_items_max,
- int *num_items)
-
-
-
- Explode a string according to one or more delimiter(s).
-
-
- Arguments:
-
-
-
- : string to explode
-
-
-
-
- : delimiters used for explosion
-
-
-
-
- : if different from 0, then each argument
- will contain all string until end of line (see example below)
-
-
-
-
- : maximum number of items
- created (0 = no limit)
-
-
-
-
- : pointer to int which will
- contain number of items created
-
-
-
-
-
- Return value: array of strings, NULL if problem.
-
-
- Note: result has to be free by a call to "weechat_string_free_exploded"
- after use.
-
-
- Examples:
-
-char **argv;
-int argc;
-argv = weechat_string_explode ("abc de fghi", " ", 0, 0, &argc);
-/* result: argv[0] == "abc"
- argv[1] == "de"
- argv[2] == "fghi"
- argv[3] == NULL
- argc == 3
-*/
-weechat_string_free_exploded (argv);
+
-argv = weechat_string_explode ("abc de fghi", " ", 1, 0, &argc);
-/* result: argv[0] == "abc de fghi"
- argv[1] == "de fghi"
- argv[2] == "fghi"
- argv[3] == NULL
- argc == 3
-*/
-weechat_string_free_exploded (argv);
-
-
-
-
-
- weechat_string_free_exploded
-
-
- Prototype:
-
- void weechat_string_free_exploded (char **exploded_string)
-
-
-
- Free memory used by a string explosion.
-
-
- Arguments:
-
-
-
- : string exploded by
- "weechat_string_explode" function
-
-
-
-
-
- Return value: none.
-
-
- Example:
-
-char *argv;
-int argc;
-argv = weechat_string_explode (string, " ", 0, 0, &argc);
-...
-weechat_string_free_exploded (, argv);
-
-
-
-
-
- weechat_string_build_with_exploded
-
-
- Prototype:
-
- char **weechat_string_build_with_exploded (char **exploded_string,
- const char *separator)
-
-
-
- Build a string with exploded string.
-
-
- Arguments:
-
-
-
- : string exploded by
- "weechat_string_explode" function
-
-
-
-
- : string used to separate strings
-
-
-
-
-
- Return value: string built with exploded string.
-
-
- Note: result has to be free by a call to "free" after use.
-
-
- Example:
-
-char **argv;
-int argc;
-argv = weechat_string_explode ("abc def ghi", " ", 0, 0, &argc);
-char *string = weechat_string_build_with_exploded (argv, ";");
-/* string == "abc;def;ghi" */
-
-
-
-
-
- weechat_string_split_command
-
-
- Prototype:
-
- char **weechat_string_split_command (const char *command,
- char separator)
-
-
-
- Split a list of commands separated by 'separator' (which can be escaped
- by '\' in string).
-
-
- Arguments:
-
-
-
- : command to split
-
-
-
-
- : separator
-
-
-
-
-
- Return value: array of strings, NULL if problem.
-
-
- Note: result has to be free by a call to
- "weechat_string_free_splitted_command" after use.
-
-
- Example:
- char **argv = weechat_string_split_command ("/command1;/command2", ';');
-
-
-
-
- weechat_string_free_splitted_command
-
-
- Prototype:
-
- void weechat_string_free_splitted_command (char **splitted_command)
-
-
-
- Free memory used by a splitted command.
-
-
- Arguments:
-
-
-
- : command splitted by
- "weechat_string_split_commaand" function
-
-
-
-
-
- Return value: none.
-
-
- Example:
-
-char **argv = weechat_string_split_command ("/command1;/command2", ';');
-...
-weechat_string_free_splitted_command (argv);
-
-
-
-
-
-
-
-
-
- UTF-8
-
-
- Some UTF-8 string functions.
-
-
-
- weechat_utf8_has_8bits
-
-
- Prototype:
-
- int weechat_utf8_has_8bits (const char *string)
-
-
-
- Check if a string has 8-bits chars.
-
-
- Arguments:
-
-
-
- : string
-
-
-
-
-
- Return value: 1 if string has 8-buts chars, 0 if only 7-bits chars.
-
-
- Example:
- if (weechat_utf8_has_8bits (string)) ...
-
-
-
-
- weechat_utf8_is_valid
-
-
- Prototype:
-
- int weechat_utf8_is_valid (const char *string, char **error)
-
-
-
- Check if a string is UTF-8 valid.
-
-
- Arguments:
-
-
-
- : string
-
-
-
-
- : if not NULL, it is set with first non
- valid UTF-8 char in string, if any
-
-
-
-
-
- Return value: 1 if UTF-8 string is valid, 0 otherwise.
-
-
- Example:
-
-char *error;
-if (weechat_utf8_is_valid (string, &error)) ...
-
-
-
-
-
- weechat_utf8_normalize
-
-
- Prototype:
-
- void weechat_utf8_normalize (const char *string, char replacement)
-
-
-
- Normalize UTF-8 string: remove non UTF-8 chars and replace them by a
- char
-
-
- Arguments:
-
-
-
- : string
-
-
-
-
- : replacement char for non UTF-8 chars
-
-
-
-
-
- Return value: none.
-
-
- Example:
- weechat_utf8_normalize (string, '?');
-
-
-
-
- weechat_utf8_prev_char
-
-
- Prototype:
-
- char *weechat_utf8_prev_char (const char *string_start,
- const char *string)
-
-
-
- Return previous UTF-8 char in a string.
-
-
- Arguments:
-
-
-
- : start of string (function will not
- return a char before this pointer)
-
-
-
-
- : pointer to string (must be >=
- string_start)
-
-
-
-
-
- Return value: pointer to previous UTF-8 char, NULL if not found
- (start of string reached)
-
-
- Example:
- char *prev_char = weechat_utf8_prev_char (string, ptr_in_string);
-
-
-
-
- weechat_utf8_next_char
-
-
- Prototype:
-
- char *weechat_utf8_next_char (const char *string)
-
-
-
- Return next UTF-8 char in a string.
-
-
- Arguments:
-
-
-
- : string
-
-
-
-
-
- Return value: pointer to next UTF-8 char, NULL if not found
- (end of string reached)
-
-
- Example:
- char *next_char = weechat_utf8_next_char (string);
-
-
-
-
- weechat_utf8_char_size
-
-
- Prototype:
-
- int weechat_utf8_char_size (const char *string)
-
-
-
- Return UTF-8 char size (in bytes).
-
-
- Arguments:
-
-
-
- : string
-
-
-
-
-
- Return value: UTF-8 char size (in bytes).
-
-
- Example:
- int char_size = weechat_utf8_char_size ("être"); /* == 2 */
-
-
-
-
- weechat_utf8_strlen
-
-
- Prototype:
-
- int weechat_utf8_strlen (const char *string)
-
-
-
- Return UTF-8 string length (multi-byte char is considered as 1 char).
-
-
- Arguments:
-
-
-
- : string
-
-
-
-
-
- Return value: UTF-8 string length (number of real chars).
-
-
- Example:
- int length = weechat_utf8_strlen ("chêne"); /* == 5 */
-
-
-
-
- weechat_utf8_strnlen
-
-
- Prototype:
-
- int weechat_utf8_strnlen (const char *string, int bytes)
-
-
-
- Return UTF-8 string length (multi-byte char is considered as 1 char),
- for max bytes in string
-
-
- Arguments:
-
-
-
- : string
-
-
-
-
- : max bytes in string
-
-
-
-
-
- Return value: UTF-8 string length (number of real chars).
-
-
- Example:
- int length = weechat_utf8_strnlen ("chêne", 4); /* == 3 */
-
-
-
-
- weechat_utf8_strlen_screen
-
-
- Prototype:
-
- int weechat_utf8_strlen_screen (const char *string)
-
-
-
- Return number of chars needed on screen to display UTF-8 string.
-
-
- Arguments:
-
-
-
- : string
-
-
-
-
-
- Return value: number of chars needed on screen to display UTF-8 string.
-
-
- Example:
- int length_on_screen = weechat_utf8_strlen_screen ("东"); /* == 2 */
-
-
-
-
- weechat_utf8_charcasecmp
-
-
- Prototype:
-
- int weechat_utf8_charcasecmp (const char *string1,
- const char *string2)
-
-
-
- Compare two UTF-8 chars (case is ignored).
-
-
- Arguments:
-
-
-
- : first string for comparison
-
-
-
-
- : second string for comparison
-
-
-
-
-
- Return value: difference between first char of each string: negative if
- char1 < char2, zero if char1 == char2, positive if char1 > char2
-
-
- Example:
- if (weechat_utf8_charcasecmp (string1, string2) != 0) ...
-
-
-
-
- weechat_utf8_char_size_screen
-
-
- Prototype:
-
- int weechat_utf8_char_size_screen (const char *string)
-
-
-
- Return number of chars needed on screen to display UTF-8 char.
-
-
- Arguments:
-
-
-
- : string
-
-
-
-
-
- Return value: number of chars needed on screen to display UTF-8 char.
-
-
- Example:
- int length_on_screen = weechat_utf8_char_size_screen (string)
-
-
-
-
- weechat_utf8_add_offset
-
-
- Prototype:
-
- char *weechat_utf8_add_offset (const char *string, int offset)
-
-
-
- Move forward N chars in an UTF-8 string.
-
-
- Arguments:
-
-
-
- : string
-
-
-
-
- : number of chars
-
-
-
-
-
- Return value: pointer to string, N chars after (NULL if it's not
- reachable).
-
-
- Example:
- char *ptr = weechat_utf8_add_offset ("chêne", 3); /* points to "ne" */
-
-
-
-
- weechat_utf8_real_pos
-
-
- Prototype:
-
- char *weechat_utf8_real_pos (const char *string, int pos)
-
-
-
- Get real position in UTF-8 string.
-
-
- Arguments:
-
-
-
- : string
-
-
-
-
- : position in chars
-
-
-
-
-
- Return value: real position (in bytes) for "pos" chars in string.
-
-
- Example:
- int pos = weechat_utf8_real_pos ("chêne", 3); /* == 4 */
-
-
-
-
- weechat_utf8_pos
-
-
- Prototype:
-
- char *weechat_utf8_pos (const char *string, int real_pos)
-
-
-
- Get position in UTF-8 string.
-
-
- Arguments:
-
-
-
- : string
-
-
-
-
- : position in bytes
-
-
-
-
-
- Return value: position (in chars) for "real_pos" bytes in string.
-
-
- Example:
- int pos = weechat_utf8_real_pos ("chêne", 4); /* == 3 */
-
-
-
-
-
-
-
-
- Directories
-
-
- Some functions related to directories.
-
-
-
- weechat_mkdir_home
-
-
- Prototype:
-
- int weechat_mkdir_home (char *directory, int mode)
-
-
-
- Create a directory in WeeChat home.
-
-
- Arguments:
-
-
-
- : directory to create
-
-
-
-
- : mode for new directory
-
-
-
-
-
- Return value: 1 if directory was successfully created, 0 if an
- error occurred.
-
-
- Example:
- if (!weechat_mkdir_home ("temp")) ...
-
-
-
-
- weechat_mkdir
-
-
- Prototype:
-
- int weechat_mkdir (char *directory, int mode)
-
-
-
- Create a directory.
-
-
- Arguments:
-
-
-
- : directory to create
-
-
-
-
- : mode for new directory
-
-
-
-
-
- Return value: 1 if directory was successfully created, 0 if an
- error occurred.
-
-
- Example:
- if (!weechat_mkdir ("/tmp/mydir")) ...
-
-
-
-
- weechat_exec_on_files
-
-
- Prototype:
-
- void weechat_exec_on_files (const char *directory, void *data,
- int (*callback)(void *data, const char *filename))
-
-
-
- Find files in a directory and execute a callback on each file.
-
-
- Arguments:
-
-
-
- : directory for searching files
-
-
-
-
- : pointer given to callback when calling it
- found
-
-
-
-
- : function called for each file
- found
-
-
-
-
-
- Return value: none.
-
-
- Example:
-
-int callback (void *data, const char *filename)
-{
- /* ... */
- return 1;
-}
-...
-plugin->exec_on_files (plugin, "/tmp", &callback);
-
-
-
-
-
-
-
-
-
- Util
-
-
- Some useful functions.
-
-
-
- weechat_timeval_cmp
-
-
- Prototype:
-
- int weechat_timeval_cmp (struct timeval *tv1, struct timeval *tv2)
-
-
-
- Compare 2 timeval structures.
-
-
- Arguments:
-
-
-
- : first timeval structure
-
-
-
-
- : second timeval structure
-
-
-
-
-
- Return value: -1 if tv1 < char2, zero if tv1 == tv2, +1 if tv1 >
- tv2
-
-
- Example:
- if (weechat_timeval_cmp (&tv1, &tv2) > 0) ...
-
-
-
-
- weechat_timeval_diff
-
-
- Prototype:
-
- long weechat_timeval_diff (struct timeval *tv1, struct timeval *tv2)
-
-
-
- Return difference (in milliseconds) between 2 timeval structures.
-
-
- Arguments:
-
-
-
- : first timeval structure
-
-
-
-
- : second timeval structure
-
-
-
-
-
- Return value: difference in milliseconds.
-
-
- Example:
- long diff = weechat_timeval_diff (&tv1, &tv2);
-
-
-
-
- weechat_timeval_add
-
-
- Prototype:
-
- void weechat_timeval_add (struct timeval *tv, long interval)
-
-
-
- Add interval (in milliseconds) to a timeval structure.
-
-
- Arguments:
-
-
-
- : timeval structure
-
-
-
-
- : interval (in milliseconds)
-
-
-
-
-
- Return value: none.
-
-
- Example:
- weechat_timeval_add (&tv, 2000); /* add 2 seconds */
-
-
-
-
-
- To be continued...
-
-
-
-
+
diff --git a/doc/en/dev/plugin_c_api.en.xml b/doc/en/dev/plugin_c_api.en.xml
new file mode 100644
index 000000000..59402a34f
--- /dev/null
+++ b/doc/en/dev/plugin_c_api.en.xml
@@ -0,0 +1,7300 @@
+
+
+
+
+
+ C plugin API
+
+
+
+
+ Plugins
+
+
+ Functions to get infos about plugins.
+
+
+
+ weechat_plugin_get_name
+
+
+ Prototype:
+
+void weechat_plugin_get_name (struct t_weechat_plugin *plugin);
+
+
+
+ Get plugin name (return "core" for WeeChat - NULL pointer).
+
+
+ Arguments:
+
+
+
+ : plugin pointer
+
+
+
+
+
+ Example:
+ char *name = weechat_plugin_get_name (plugin);
+
+
+
+
+
+
+
+
+ Strings
+
+
+ Many string functions below are already available thru standard C
+ functions, but it's recommended to use functions in this API because
+ they are ok with UTF-8 and locale.
+
+
+
+ weechat_charset_set
+
+
+ Prototype:
+
+void weechat_charset_set (const char *charset);
+
+
+
+ Set new plugin charset.
+
+
+ Arguments:
+
+
+
+ : new charset to use
+
+
+
+
+
+ Example:
+ weechat_charset_set (plugin, "iso-8859-1");
+
+
+
+
+ weechat_iconv_to_internal
+
+
+ Prototype:
+
+void weechat_iconv_to_internal (const char *charset, const char *string);
+
+
+
+ Convert string to WeeChat internal charset (UTF-8).
+
+
+ Arguments:
+
+
+
+ : charset to convert
+
+
+
+
+ : string to convert
+
+
+
+
+
+ Return value: converted string.
+
+
+
+ Result has to be free by a call to "free" after use.
+
+
+
+ Example:
+ char *str = weechat_iconv_to_internal (plugin, "iso-8859-1", "iso string: é à");
+
+
+
+
+ weechat_iconv_from_internal
+
+
+ Prototype:
+
+void weechat_iconv_from_internal (const char *charset, const char *string);
+
+
+
+ Convert string from internal WeeChat charset (UTF-8) to another.
+
+
+ Arguments:
+
+
+
+ : target charset
+
+
+
+
+ : string to convert
+
+
+
+
+
+ Return value: converted string.
+
+
+
+ Result has to be free by a call to "free" after use.
+
+
+
+ Example:
+ char *str = weechat_iconv_from_internal ("iso-8859-1", "utf-8 string: é à");
+
+
+
+
+ weechat_gettext
+
+
+ Prototype:
+
+char *weechat_gettext (const char *string);
+
+
+
+ Return translated string (depends on local language).
+
+
+ Arguments:
+
+
+
+ : string to translate
+
+
+
+
+
+ Return value: translated string.
+
+
+ Example:
+ char *str = weechat_gettext ("hello !");
+
+
+
+
+ weechat_ngettext
+
+
+ Prototype:
+
+char *weechat_ngettext (const char *string, const char *plural, int count);
+
+
+
+ Return translated string, using single or plural form, according to
+ count.
+
+
+ Arguments:
+
+
+
+ : string to translate (single form)
+
+
+
+
+ : string to translate (plural form)
+
+
+
+
+ : used to choose between single and plural
+ form
+
+
+
+
+
+ Return value: translated string.
+
+
+ Example:
+ char *str = weechat_ngettext ("file", "files", num_files);
+
+
+
+
+ weechat_strndup
+
+
+ Prototype:
+
+char *weechat_strndup (const char *string, int length);
+
+
+
+ Return duplicated string, with max "length" chars.
+
+
+ Arguments:
+
+
+
+ : string to duplicate
+
+
+
+
+ : max chars to duplicate
+
+
+
+
+
+ Return value: duplicated string.
+
+
+
+ Result has to be free by a call to "free" after use.
+
+
+
+ Example:
+ char *str = weechat_strndup ("abcdef", 3); /* result: "abc" */
+
+
+
+
+ weechat_string_tolower
+
+
+ Prototype:
+
+char *weechat_string_tolower (const char *string);
+
+
+
+ Convert UTF-8 string to lower case.
+
+
+ Arguments:
+
+
+
+ : string to convert
+
+
+
+
+
+ Return value: none.
+
+
+ Example:
+ weechat_string_tolower ("AbCdEé"); /* result: "abcdeé" */
+
+
+
+
+ weechat_string_toupper
+
+
+ Prototype:
+
+char *weechat_string_toupper (const char *string);
+
+
+
+ Convert UTF-8 string to upper case.
+
+
+ Arguments:
+
+
+
+ : string to convert
+
+
+
+
+
+ Return value: none.
+
+
+ Example:
+ weechat_string_toupper ("AbCdEé"); /* result: "ABCDEé" */
+
+
+
+
+ weechat_strcasecmp
+
+
+ Prototype:
+
+int weechat_strcasecmp (const char *string1, const char *string2);
+
+
+
+ Locale and case independent string comparison.
+
+
+ Arguments:
+
+
+
+ : first string for comparison
+
+
+
+
+ : second string for comparison
+
+
+
+
+
+ Return value: difference between two strings: negative if
+ string1 < string2, zero if string1 == string2, positive if
+ string1 > string2
+
+
+ Example:
+ int diff = weechat_strcasecmp ("aaa", "CCC"); /* == -2 */
+
+
+
+
+ weechat_strncasecmp
+
+
+ Prototype:
+
+int weechat_strncasecmp (const char *string1, const char *string2, int max);
+
+
+
+ Locale and case independent string comparison, for "max" chars.
+
+
+ Arguments:
+
+
+
+ : first string for comparison
+
+
+
+
+ : second string for comparison
+
+
+
+
+ : max number of chars for comparison
+
+
+
+
+
+ Return value: difference between two strings: negative if
+ string1 < string2, zero if string1 == string2, positive if
+ string1 > string2
+
+
+ Example:
+ int diff = weechat_strncasecmp ("aaa", "CCC", 2); /* == -2 */
+
+
+
+
+ weechat_strcmp_ignore_chars
+
+
+ Prototype:
+
+int weechat_strcmp_ignore_chars (const char *string1, const char *string2,
+ const char *chars_ignored, int case_sensitive);
+
+
+
+ Locale (and optionally case independent) string comparison, ignoring
+ some chars.
+
+
+ Arguments:
+
+
+
+ : first string for comparison
+
+
+
+
+ : second string for comparison
+
+
+
+
+ : string with chars to ignore
+
+
+
+
+ : 1 for case sensitive comparison,
+ 0 otherwise
+
+
+
+
+
+ Return value: difference between two strings: negative if
+ string1 < string2, zero if string1 == string2, positive if
+ string1 > string2
+
+
+ Example:
+ int diff = weechat_strcmp_ignore_chars ("a-b", "--a-e", "-", 1); /* == -3 */
+
+
+
+
+ weechat_strcasestr
+
+
+ Prototype:
+
+int weechat_strcasestr (const char *string, const char *search);
+
+
+
+ Locale and case independent string search.
+
+
+ Arguments:
+
+
+
+ : string
+
+
+
+
+ : string to search in "string"
+
+
+
+
+
+ Return value: pointer to string found, or NULL if not found
+
+
+ Example:
+ char *pos = weechat_strcasestr ("aBcDeF", "de"); /* result: pointer to "DeF" */
+
+
+
+
+ weechat_string_match
+
+
+ Prototype:
+
+int weechat_string_match (const char *string, const char *mask,
+ int case_sensitive);
+
+
+
+ Check if a string matches a mask. Mask may begin or end with "*" (no
+ other "*" are allowed inside mask).
+
+
+ Arguments:
+
+
+
+ : string
+
+
+
+
+ : mask
+
+
+
+
+ : 1 for case sensitive search,
+ otherwise 0
+
+
+
+
+
+ Return value: 1 if string matches mask, otherwise 0.
+
+
+ Examples:
+
+int match1 = weechat_string_match ("abcdef", "abc*", 0); /* == 1 */
+int match2 = weechat_string_match ("abcdef", "*dd*", 0); /* == 0 */
+int match3 = weechat_string_match ("abcdef", "*def", 0); /* == 1 */
+
+
+
+
+
+ weechat_string_replace
+
+
+ Prototype:
+
+char *weechat_string_replace (const char *string, const char *search,
+ const char *replace);
+
+
+
+ Replace "search" string by new one in a string.
+
+
+ Arguments:
+
+
+
+ : string
+
+
+
+
+ : string to replace
+
+
+
+
+ : replacement for "search" string
+
+
+
+
+
+ Return value: string with "search" replaced by "replace".
+
+
+
+ Result has to be free by a call to "free" after use.
+
+
+
+ Example:
+ char *str = weechat_string_replace ("test", "s", "x"); /* result: "text" */
+
+
+
+
+ weechat_string_remove_quotes
+
+
+ Prototype:
+
+char *weechat_string_remove_quotes (const char *string, const char *quotes);
+
+
+
+ Remove quotes at beginning/end of string (ignore spaces if there are
+ before first quote or after last quote).
+
+
+ Arguments:
+
+
+
+ : string
+
+
+
+
+ : string with list of quotes
+
+
+
+
+
+ Return value: string without quotes at beginning/end.
+
+
+
+ Result has to be free by a call to "free" after use.
+
+
+
+ Example:
+ char *str = weechat_string_remove_quotes (string, " 'abc' ", "'"); /* result: "abc" */
+
+
+
+
+ weechat_string_strip
+
+
+ Prototype:
+
+char *weechat_string_strip (const char *string, int left, int right,
+ const char *chars);
+
+
+
+ Strip chars at beginning and/or end of string.
+
+
+ Arguments:
+
+
+
+ : string
+
+
+
+
+ : strip left chars if different from 0
+
+
+
+
+ : strip right chars if different from 0
+
+
+
+
+ : string with chars to strip
+
+
+
+
+
+ Return value: stripped string.
+
+
+
+ Result has to be free by a call to "free" after use.
+
+
+
+ Example:
+ char *str = weechat_strip (string, " ", 0, 1); /* remove spaces at end of string */
+
+
+
+
+ weechat_string_has_highlight
+
+
+ Prototype:
+
+char *weechat_string_has_highlight (const char *string,
+ const char highlight_words);
+
+
+
+ Check if a string has highlights, using list of highlight words.
+
+
+ Arguments:
+
+
+
+ : string
+
+
+
+
+ : list of highlight words,
+ separated by comma
+
+
+
+
+
+ Return value: 1 if string has one or more highlights, 0 otherwise.
+
+
+ Example:
+ if (weechat_string_has_highlight (string, "word1,word2")) ...
+
+
+
+
+ weechat_string_mask_to_regex
+
+
+ Prototype:
+
+char *weechat_string_mask_to_regex (const char *mask);
+
+
+
+ Return a regex, built with a mask, where only special char is "*".
+ All special chars for regex are escaped.
+
+
+ Arguments:
+
+
+
+ : mask
+
+
+
+
+
+ Return value: regex.
+
+
+ Example:
+ char *regex = weechat_string_mask_to_regex ("test*mask");
+
+
+
+
+ weechat_string_explode
+
+
+ Prototype:
+
+char **weechat_string_explode (const char *string,
+ const char *separators, int keep_eol,
+ int num_items_max, int *num_items);
+
+
+
+ Explode a string according to one or more delimiter(s).
+
+
+ Arguments:
+
+
+
+ : string to explode
+
+
+
+
+ : delimiters used for explosion
+
+
+
+
+ : if different from 0, then each
+ argument will contain all string until end of line (see example
+ below)
+
+
+
+
+ : maximum number of items
+ created (0 = no limit)
+
+
+
+
+ : pointer to int which will
+ contain number of items created
+
+
+
+
+
+ Return value: array of strings, NULL if problem.
+
+
+
+ Result has to be free by a call to "weechat_string_free_exploded"
+ after use.
+
+
+
+ Examples:
+
+char **argv;
+int argc;
+argv = weechat_string_explode ("abc de fghi", " ", 0, 0, &argc);
+/* result: argv[0] == "abc"
+ argv[1] == "de"
+ argv[2] == "fghi"
+ argv[3] == NULL
+ argc == 3
+*/
+weechat_string_free_exploded (argv);
+
+argv = weechat_string_explode ("abc de fghi", " ", 1, 0, &argc);
+/* result: argv[0] == "abc de fghi"
+ argv[1] == "de fghi"
+ argv[2] == "fghi"
+ argv[3] == NULL
+ argc == 3
+*/
+weechat_string_free_exploded (argv);
+
+
+
+
+
+ weechat_string_free_exploded
+
+
+ Prototype:
+
+void weechat_string_free_exploded (char **exploded_string);
+
+
+
+ Free memory used by a string explosion.
+
+
+ Arguments:
+
+
+
+ : string exploded by
+ "weechat_string_explode" function
+
+
+
+
+
+ Return value: none.
+
+
+ Example:
+
+char *argv;
+int argc;
+argv = weechat_string_explode (string, " ", 0, 0, &argc);
+...
+weechat_string_free_exploded (, argv);
+
+
+
+
+
+ weechat_string_build_with_exploded
+
+
+ Prototype:
+
+char **weechat_string_build_with_exploded (char **exploded_string,
+ const char *separator);
+
+
+
+ Build a string with exploded string.
+
+
+ Arguments:
+
+
+
+ : string exploded by
+ "weechat_string_explode" function
+
+
+
+
+ : string used to separate strings
+
+
+
+
+
+ Return value: string built with exploded string.
+
+
+
+ Result has to be free by a call to "free" after use.
+
+
+
+ Example:
+
+char **argv;
+int argc;
+argv = weechat_string_explode ("abc def ghi", " ", 0, 0, &argc);
+char *string = weechat_string_build_with_exploded (argv, ";");
+/* string == "abc;def;ghi" */
+
+
+
+
+
+ weechat_string_split_command
+
+
+ Prototype:
+
+char **weechat_string_split_command (const char *command, char separator);
+
+
+
+ Split a list of commands separated by 'separator' (which can be escaped
+ by '\' in string).
+
+
+ Arguments:
+
+
+
+ : command to split
+
+
+
+
+ : separator
+
+
+
+
+
+ Return value: array of strings, NULL if problem.
+
+
+
+ Result has to be free by a call to
+ "weechat_string_free_splitted_command" after use.
+
+
+
+ Example:
+ char **argv = weechat_string_split_command ("/command1;/command2", ';');
+
+
+
+
+ weechat_string_free_splitted_command
+
+
+ Prototype:
+
+void weechat_string_free_splitted_command (char **splitted_command);
+
+
+
+ Free memory used by a splitted command.
+
+
+ Arguments:
+
+
+
+ : command splitted by
+ "weechat_string_split_commaand" function
+
+
+
+
+
+ Return value: none.
+
+
+ Example:
+
+char **argv = weechat_string_split_command ("/command1;/command2", ';');
+...
+weechat_string_free_splitted_command (argv);
+
+
+
+
+
+
+
+
+
+ UTF-8
+
+
+ Some UTF-8 string functions.
+
+
+
+ weechat_utf8_has_8bits
+
+
+ Prototype:
+
+int weechat_utf8_has_8bits (const char *string);
+
+
+
+ Check if a string has 8-bits chars.
+
+
+ Arguments:
+
+
+
+ : string
+
+
+
+
+
+ Return value: 1 if string has 8-buts chars, 0 if only 7-bits chars.
+
+
+ Example:
+ if (weechat_utf8_has_8bits (string)) ...
+
+
+
+
+ weechat_utf8_is_valid
+
+
+ Prototype:
+
+int weechat_utf8_is_valid (const char *string, char **error);
+
+
+
+ Check if a string is UTF-8 valid.
+
+
+ Arguments:
+
+
+
+ : string
+
+
+
+
+ : if not NULL, it is set with first non
+ valid UTF-8 char in string, if any
+
+
+
+
+
+ Return value: 1 if UTF-8 string is valid, 0 otherwise.
+
+
+ Example:
+
+char *error;
+if (weechat_utf8_is_valid (string, &error)) ...
+
+
+
+
+
+ weechat_utf8_normalize
+
+
+ Prototype:
+
+void weechat_utf8_normalize (const char *string, char replacement);
+
+
+
+ Normalize UTF-8 string: remove non UTF-8 chars and replace them by a
+ char
+
+
+ Arguments:
+
+
+
+ : string
+
+
+
+
+ : replacement char for non UTF-8 chars
+
+
+
+
+
+ Return value: none.
+
+
+ Example:
+ weechat_utf8_normalize (string, '?');
+
+
+
+
+ weechat_utf8_prev_char
+
+
+ Prototype:
+
+char *weechat_utf8_prev_char (const char *string_start, const char *string);
+
+
+
+ Return previous UTF-8 char in a string.
+
+
+ Arguments:
+
+
+
+ : start of string (function will not
+ return a char before this pointer)
+
+
+
+
+ : pointer to string (must be >=
+ string_start)
+
+
+
+
+
+ Return value: pointer to previous UTF-8 char, NULL if not found
+ (start of string reached)
+
+
+ Example:
+ char *prev_char = weechat_utf8_prev_char (string, ptr_in_string);
+
+
+
+
+ weechat_utf8_next_char
+
+
+ Prototype:
+
+char *weechat_utf8_next_char (const char *string);
+
+
+
+ Return next UTF-8 char in a string.
+
+
+ Arguments:
+
+
+
+ : string
+
+
+
+
+
+ Return value: pointer to next UTF-8 char, NULL if not found
+ (end of string reached)
+
+
+ Example:
+ char *next_char = weechat_utf8_next_char (string);
+
+
+
+
+ weechat_utf8_char_size
+
+
+ Prototype:
+
+int weechat_utf8_char_size (const char *string);
+
+
+
+ Return UTF-8 char size (in bytes).
+
+
+ Arguments:
+
+
+
+ : string
+
+
+
+
+
+ Return value: UTF-8 char size (in bytes).
+
+
+ Example:
+ int char_size = weechat_utf8_char_size ("être"); /* == 2 */
+
+
+
+
+ weechat_utf8_strlen
+
+
+ Prototype:
+
+int weechat_utf8_strlen (const char *string);
+
+
+
+ Return UTF-8 string length (multi-byte char is considered as 1 char).
+
+
+ Arguments:
+
+
+
+ : string
+
+
+
+
+
+ Return value: UTF-8 string length (number of real chars).
+
+
+ Example:
+ int length = weechat_utf8_strlen ("chêne"); /* == 5 */
+
+
+
+
+ weechat_utf8_strnlen
+
+
+ Prototype:
+
+int weechat_utf8_strnlen (const char *string, int bytes);
+
+
+
+ Return UTF-8 string length (multi-byte char is considered as 1 char),
+ for max bytes in string
+
+
+ Arguments:
+
+
+
+ : string
+
+
+
+
+ : max bytes in string
+
+
+
+
+
+ Return value: UTF-8 string length (number of real chars).
+
+
+ Example:
+ int length = weechat_utf8_strnlen ("chêne", 4); /* == 3 */
+
+
+
+
+ weechat_utf8_strlen_screen
+
+
+ Prototype:
+
+int weechat_utf8_strlen_screen (const char *string);
+
+
+
+ Return number of chars needed on screen to display UTF-8 string.
+
+
+ Arguments:
+
+
+
+ : string
+
+
+
+
+
+ Return value: number of chars needed on screen to display UTF-8 string.
+
+
+ Example:
+ int length_on_screen = weechat_utf8_strlen_screen ("东"); /* == 2 */
+
+
+
+
+ weechat_utf8_charcasecmp
+
+
+ Prototype:
+
+int weechat_utf8_charcasecmp (const char *string1, const char *string2);
+
+
+
+ Compare two UTF-8 chars (case is ignored).
+
+
+ Arguments:
+
+
+
+ : first string for comparison
+
+
+
+
+ : second string for comparison
+
+
+
+
+
+ Return value: difference between first char of each string: negative if
+ char1 < char2, zero if char1 == char2, positive if char1 > char2
+
+
+ Example:
+ if (weechat_utf8_charcasecmp (string1, string2) != 0) ...
+
+
+
+
+ weechat_utf8_char_size_screen
+
+
+ Prototype:
+
+int weechat_utf8_char_size_screen (const char *string);
+
+
+
+ Return number of chars needed on screen to display UTF-8 char.
+
+
+ Arguments:
+
+
+
+ : string
+
+
+
+
+
+ Return value: number of chars needed on screen to display UTF-8 char.
+
+
+ Example:
+ int length_on_screen = weechat_utf8_char_size_screen (string)
+
+
+
+
+ weechat_utf8_add_offset
+
+
+ Prototype:
+
+char *weechat_utf8_add_offset (const char *string, int offset);
+
+
+
+ Move forward N chars in an UTF-8 string.
+
+
+ Arguments:
+
+
+
+ : string
+
+
+
+
+ : number of chars
+
+
+
+
+
+ Return value: pointer to string, N chars after (NULL if it's not
+ reachable).
+
+
+ Example:
+ char *ptr = weechat_utf8_add_offset ("chêne", 3); /* points to "ne" */
+
+
+
+
+ weechat_utf8_real_pos
+
+
+ Prototype:
+
+char *weechat_utf8_real_pos (const char *string, int pos);
+
+
+
+ Get real position in UTF-8 string.
+
+
+ Arguments:
+
+
+
+ : string
+
+
+
+
+ : position in chars
+
+
+
+
+
+ Return value: real position (in bytes) for "pos" chars in string.
+
+
+ Example:
+ int pos = weechat_utf8_real_pos ("chêne", 3); /* == 4 */
+
+
+
+
+ weechat_utf8_pos
+
+
+ Prototype:
+
+char *weechat_utf8_pos (const char *string, int real_pos);
+
+
+
+ Get position in UTF-8 string.
+
+
+ Arguments:
+
+
+
+ : string
+
+
+
+
+ : position in bytes
+
+
+
+
+
+ Return value: position (in chars) for "real_pos" bytes in string.
+
+
+ Example:
+ int pos = weechat_utf8_real_pos ("chêne", 4); /* == 3 */
+
+
+
+
+
+
+
+
+ Directories
+
+
+ Some functions related to directories.
+
+
+
+ weechat_mkdir_home
+
+
+ Prototype:
+
+int weechat_mkdir_home (char *directory, int mode);
+
+
+
+ Create a directory in WeeChat home.
+
+
+ Arguments:
+
+
+
+ : directory to create
+
+
+
+
+ : mode for new directory
+
+
+
+
+
+ Return value: 1 if directory was successfully created, 0 if an
+ error occurred.
+
+
+ Example:
+ if (!weechat_mkdir_home ("temp")) ...
+
+
+
+
+ weechat_mkdir
+
+
+ Prototype:
+
+int weechat_mkdir (char *directory, int mode);
+
+
+
+ Create a directory.
+
+
+ Arguments:
+
+
+
+ : directory to create
+
+
+
+
+ : mode for new directory
+
+
+
+
+
+ Return value: 1 if directory was successfully created, 0 if an
+ error occurred.
+
+
+ Example:
+ if (!weechat_mkdir ("/tmp/mydir")) ...
+
+
+
+
+ weechat_mkdir_parents
+
+
+ Prototype:
+
+int weechat_mkdir_parents (char *directory, int mode);
+
+
+
+ Create a directory and make parent directories as needed.
+
+
+ Arguments:
+
+
+
+ : directory to create
+
+
+
+
+ : mode for new directory (and parents)
+
+
+
+
+
+ Return value: 1 if directory was successfully created, 0 if an
+ error occurred.
+
+
+ Example:
+ if (!weechat_mkdir_parents ("/tmp/my/dir")) ...
+
+
+
+
+ weechat_exec_on_files
+
+
+ Prototype:
+
+void weechat_exec_on_files (const char *directory, void *data,
+ int (*callback)(void *data, const char *filename));
+
+
+
+ Find files in a directory and execute a callback on each file.
+
+
+ Arguments:
+
+
+
+ : directory for searching files
+
+
+
+
+ : pointer given to callback when calling it
+ found
+
+
+
+
+ : function called for each file
+ found
+
+
+
+
+
+ Return value: none.
+
+
+ Example:
+
+int callback (void *data, const char *filename)
+{
+ /* ... */
+ return 1;
+}
+...
+plugin->exec_on_files (plugin, "/tmp", &callback);
+
+
+
+
+
+
+
+
+
+ Util
+
+
+ Some useful functions.
+
+
+
+ weechat_timeval_cmp
+
+
+ Prototype:
+
+int weechat_timeval_cmp (struct timeval *tv1, struct timeval *tv2);
+
+
+
+ Compare 2 timeval structures.
+
+
+ Arguments:
+
+
+
+ : first timeval structure
+
+
+
+
+ : second timeval structure
+
+
+
+
+
+ Return value: -1 if tv1 < char2, zero if tv1 == tv2, +1 if tv1 >
+ tv2
+
+
+ Example:
+ if (weechat_timeval_cmp (&tv1, &tv2) > 0) ...
+
+
+
+
+ weechat_timeval_diff
+
+
+ Prototype:
+
+long weechat_timeval_diff (struct timeval *tv1, struct timeval *tv2);
+
+
+
+ Return difference (in milliseconds) between 2 timeval structures.
+
+
+ Arguments:
+
+
+
+ : first timeval structure
+
+
+
+
+ : second timeval structure
+
+
+
+
+
+ Return value: difference in milliseconds.
+
+
+ Example:
+ long diff = weechat_timeval_diff (&tv1, &tv2);
+
+
+
+
+ weechat_timeval_add
+
+
+ Prototype:
+
+void weechat_timeval_add (struct timeval *tv, long interval);
+
+
+
+ Add interval (in milliseconds) to a timeval structure.
+
+
+ Arguments:
+
+
+
+ : timeval structure
+
+
+
+
+ : interval (in milliseconds)
+
+
+
+
+
+ Return value: none.
+
+
+ Example:
+ weechat_timeval_add (&tv, 2000); /* add 2 seconds */
+
+
+
+
+
+
+
+
+ Sorted lists
+
+
+ Sorted list functions.
+
+
+
+ weechat_list_new
+
+
+ Prototype:
+
+struct t_weelist *weechat_list_new ();
+
+
+
+ Create a new list.
+
+
+ Return value: pointer to new list.
+
+
+ Example:
+ struct t_weelist *list = weechat_list_new ();
+
+
+
+
+ weechat_list_add
+
+
+ Prototype:
+
+struct t_weelist_item *weechat_list_add (struct t_weelist *weelist,
+ const char *data, const char *where);
+
+
+
+ Add an item in a list.
+
+
+ Arguments:
+
+
+
+ : list pointer
+
+
+
+
+ : data to insert in list
+
+
+
+
+ : position in list (constants are:
+ WEECHAT_LIST_POS_SORT, WEECHAT_LIST_POS_BEGINNING or
+ WEECHAT_LIST_POS_END)
+
+
+
+
+
+ Return value: pointer to new item.
+
+
+ Example:
+ weechat_list_add (list, "my data", WEECHAT_LIST_POS_SORT);
+
+
+
+
+ weechat_list_search
+
+
+ Prototype:
+
+struct t_weelist_item *weechat_list_search (struct t_weelist *weelist,
+ const char *data);
+
+
+
+ Search an item in a list.
+
+
+ Arguments:
+
+
+
+ : list pointer
+
+
+
+
+ : data to search in list
+
+
+
+
+
+ Return value: pointer to item found, NULL if item was not found.
+
+
+ Example:
+ struct t_weelist_item *item = weechat_list_search (list, "my data");
+
+
+
+
+ weechat_list_casesearch
+
+
+ Prototype:
+
+struct t_weelist_item *weechat_list_casesearch (struct t_weelist *weelist,
+ const char *data);
+
+
+
+ Search an item in a list (case sensitive search).
+
+
+ Arguments:
+
+
+
+ : list pointer
+
+
+
+
+ : data to search in list
+
+
+
+
+
+ Return value: pointer to item found, NULL if item was not found.
+
+
+ Example:
+ struct t_weelist_item *item = weechat_list_casesearch (list, "my data");
+
+
+
+
+ weechat_list_get
+
+
+ Prototype:
+
+struct t_weelist_item *weechat_list_get (struct t_weelist *weelist,
+ int position);
+
+
+
+ Get an item in a list by position.
+
+
+ Arguments:
+
+
+
+ : list pointer
+
+
+
+
+ : position in list (0 is first item)
+
+
+
+
+
+ Return value: pointer to item found, NULL if item position was not
+ found.
+
+
+ Example:
+ struct t_weelist_item *item = weechat_list_get (list, 0); /* first item */
+
+
+
+
+ weechat_list_set
+
+
+ Prototype:
+
+void weechat_list_set (struct t_weelist_item *item, const char *value);
+
+
+
+ Set new value for an item.
+
+
+ Arguments:
+
+
+
+ : item pointer
+
+
+
+
+ : new value for item
+
+
+
+
+
+ Example:
+ weechat_list_set (item, "new data");/
+
+
+
+
+ weechat_list_next
+
+
+ Prototype:
+
+struct t_weelist_item *weechat_list_next (struct t_weelist_item *item);
+
+
+
+ Get next item in list.
+
+
+ Arguments:
+
+
+
+ : item pointer
+
+
+
+
+
+ Return value: pointer to next item, NULL if pointer was last item in
+ list.
+
+
+ Example:
+ struct t_weelist_item *next_item = weechat_list_next_item (item);/
+
+
+
+
+ weechat_list_prev
+
+
+ Prototype:
+
+struct t_weelist_item *weechat_list_prev (struct t_weelist_item *item);
+
+
+
+ Get previous item in list.
+
+
+ Arguments:
+
+
+
+ : item pointer
+
+
+
+
+
+ Return value: pointer to previous item, NULL if pointer was first item
+ in list.
+
+
+ Example:
+ struct t_weelist_item *prev_item = weechat_list_prev_item (item);/
+
+
+
+
+ weechat_list_string
+
+
+ Prototype:
+
+char *weechat_list_string (struct t_weelist_item *item);
+
+
+
+ Get string value of an item.
+
+
+ Arguments:
+
+
+
+ : item pointer
+
+
+
+
+
+ Return value: string value of item.
+
+
+ Example:
+ char *value = weechat_list_string (item);/
+
+
+
+
+ weechat_list_size
+
+
+ Prototype:
+
+char *weechat_list_size (struct t_weelist *weelist);
+
+
+
+ Get size of list (number of items).
+
+
+ Arguments:
+
+
+
+ : list pointer
+
+
+
+
+
+ Return value: size of list (number of items), 0 if list is empty.
+
+
+ Example:
+ int size = weechat_list_size (list);/
+
+
+
+
+ weechat_list_remove
+
+
+ Prototype:
+
+void weechat_list_remove (struct t_weelist *weelist,
+ struct t_weelist_item *item);
+
+
+
+ Remove an item in a list.
+
+
+ Arguments:
+
+
+
+ : list pointer
+
+
+
+
+ : item pointer
+
+
+
+
+
+ Example:
+ weechat_list_remove (list, item);/
+
+
+
+
+ weechat_list_remove_all
+
+
+ Prototype:
+
+void weechat_list_remove_all (struct t_weelist *weelist);
+
+
+
+ Remove all items in a list.
+
+
+ Arguments:
+
+
+
+ : list pointer
+
+
+
+
+
+ Example:
+ weechat_list_remove_all (list);/
+
+
+
+
+ weechat_list_free
+
+
+ Prototype:
+
+void weechat_list_free (struct t_weelist *weelist);
+
+
+
+ Free a list.
+
+
+ Arguments:
+
+
+
+ : list pointer
+
+
+
+
+
+ Example:
+ weechat_list_free (list);/
+
+
+
+
+
+
+
+
+ Configuration files
+
+
+ Functions for configuration files.
+
+
+
+ weechat_config_new
+
+
+ Prototype:
+
+struct t_config_file *weechat_config_new (const char *name,
+ int (*callback_reload)(void *data,
+ struct t_config_file *config_file),
+ void *callback_reload_data);
+
+
+
+ Create a new configuration file.
+
+
+ Arguments:
+
+
+
+ : name of configuration file (without path
+ or extension)
+
+
+
+
+ : callback called when
+ configuration file is reloaded with /reload (optional, may be
+ NULL)
+
+
+
+
+ : pointer given to reload
+ callback when it is called by WeeChat
+ NULL)
+
+
+
+
+
+ Return value: pointer to new configuration file, NULL if an error
+ occured.
+
+
+
+ File is NOT created by this function. It will be created by call to
+ function (you
+ should do that only after adding some sections (with
+ ) and
+ options (with
+ ).
+
+
+
+ Example:
+
+int
+my_config_reload_cb (void *data, struct t_config_file *config_file)
+{
+ /* ... */
+
+ return WEECHAT_RC_OK;
+}
+
+struct t_config_file *config_file = weechat_config_new ("test", &my_config_reload_cb, NULL);
+
+
+
+
+
+ weechat_config_new_section
+
+
+ Prototype:
+
+struct t_config_section *weechat_config_new_section (struct t_config_file *config_file,
+ const char *name,
+ int user_can_add_options,
+ int user_can_delete_options,
+ int (*callback_read)(void *data,
+ struct t_config_file *config_file,
+ struct t_config_section *section,
+ const char *option_name,
+ const char *value),
+ void *callback_read_data,
+ int (*callback_write)(void *data,
+ struct t_config_file *config_file,
+ struct t_config_section *section, const char *option_name),
+ void *callback_write_data,
+ int (*callback_write_default)(void *data,
+ struct t_config_file *config_file,
+ const char *section_name);
+ void *callback_write_default_data,
+ int (*callback_create_option)(void *data,
+ struct t_config_file *config_file,
+ struct t_config_section *section,
+ const char *option_name,
+ const char *value),
+ void *callback_create_option_data,
+ int (*callback_delete_option)(void *data,
+ struct t_config_file *config_file,
+ struct t_config_section *section,
+ struct t_config_option *option),
+ void *callback_delete_option_data);
+
+
+
+ Create a new section in configuration file.
+
+
+ Arguments:
+
+
+
+ : configuration file pointer
+
+
+
+
+ : name of section
+
+
+
+
+ : 1 if user can add options
+ in section, or 0 if it is forbidden
+
+
+
+
+ : 1 if user can delete
+ options in section, or 0 if it is forbidden
+
+
+
+
+ : callback called when an option
+ in section is read from disk (should be NULL for most cases,
+ except if options in your section need custom function)
+
+
+
+
+ : pointer given to read
+ callback when it is called by WeeChat
+ NULL)
+
+
+
+
+ : callback called when section
+ is written in file (should be NULL for most cases, except if your
+ section needs to be written by a custom function)
+
+
+
+
+ : pointer given to write
+ callback when it is called by WeeChat
+ NULL)
+
+
+
+
+ : callback called when
+ default values for section must be written in file
+
+
+
+
+ : pointer given to
+ write_default callback when it is called by WeeChat
+ NULL)
+
+
+
+
+ : callback called when a
+ new option is created in section (NULL if section does not allow
+ new options to be created)
+
+
+
+
+ : pointer given to
+ create_option callback when it is called by WeeChat
+ NULL)
+
+
+
+
+ : callback called when an
+ option is deleted (NULL if section does not allow options to be
+ deleted)
+
+
+
+
+ : pointer given to
+ delete_option callback when it is called by WeeChat
+ NULL)
+
+
+
+
+
+ Return value: pointer to new section in configuration file, NULL if an
+ error occured.
+
+
+ Example:
+
+int
+my_section_read_cb (void *data, struct t_config_file *config_file,
+ struct t_config_section *section, const char *option_name,
+ const char *value)
+{
+ /* ... */
+
+ return WEECHAT_RC_OK;
+}
+
+int
+my_section_write_cb (void *data, struct t_config_file *config_file,
+ const char *section_name)
+{
+ /* ... */
+
+ return WEECHAT_RC_OK;
+}
+
+int
+my_section_write_default_cb (void *data, struct t_config_file *config_file,
+ const char *section_name)
+{
+ /* ... */
+
+ return WEECHAT_RC_OK;
+}
+
+int
+my_section_create_option_cb (void *data, struct t_config_file *config_file,
+ struct t_config_section *section,
+ const char *option_name, const char *value)
+{
+ /* ... */
+
+ return WEECHAT_RC_OK;
+}
+
+int
+my_section_delete_option_cb (void *data, struct t_config_file *config_file,
+ struct t_config_section *section,
+ struct t_config_option *option)
+{
+ /* ... */
+
+ return WEECHAT_RC_OK;
+}
+
+/* standard section, user can not add/delete options */
+struct t_config_section *new_section1 = weechat_config_new ("section1", 0, 0,
+ NULL, NULL, /* read callback */
+ NULL, NULL, /* write callback */
+ NULL, NULL, /* write default callback */
+ NULL, NULL, /* create option callback */
+ NULL, NULL); /* delete option callback */
+
+/* special section, user can add/delete options, and options need
+ callback to be read/written */
+struct t_config_section *new_section2 = weechat_config_new ("section2", 1, 1,
+ &my_section_read_cb, NULL,
+ &my_section_write_cb, NULL,
+ &my_section_write_default_cb, NULL,
+ &my_section_create_option_cb, NULL,
+ &my_section_delete_option_cb, NULL);
+
+
+
+
+
+ weechat_config_search_section
+
+
+ Prototype:
+
+struct t_config_section *weechat_config_search_section (struct t_config_file *config_file,
+ const char *section_name);
+
+
+
+ Search a section in a configuration file.
+
+
+ Arguments:
+
+
+
+ : configuration file pointer
+
+
+
+
+ : name of section to search
+
+
+
+
+
+ Return value: pointer to section found, NULL if section was not found.
+
+
+ Example:
+
+struct t_config_section *section = weechat_config_search_section (config_file, "section");
+
+
+
+
+
+ weechat_config_new_option
+
+
+ Prototype:
+
+struct t_config_option *weechat_config_new_option (struct t_config_file *config_file,
+ struct t_config_section *section,
+ const char *name,
+ const char *type,
+ const char *description,
+ const char *string_values,
+ int min,
+ int max,
+ const chat *default_value,
+ const char *value,
+ int (*callback_check_value)(void *data,
+ struct t_config_option *option,
+ const char *value),
+ void *callback_check_value_data,
+ int (*callback_change)(void *data,
+ struct t_config_option *option),
+ void *callback_change_data,
+ int (*callback_delete)(void *data,
+ struct t_config_option *option),
+ void *callback_delete_data);
+
+
+
+ Create a new option in a section of a configuration file.
+
+
+ Arguments:
+
+
+
+ : configuration file pointer
+
+
+
+
+ : section pointer
+
+
+
+
+ : name of option
+
+
+
+
+ : type of option, one of:
+
+
+ boolean
+
+
+ integer
+
+
+ string
+
+
+ color
+
+
+
+
+
+
+ : description of option
+
+
+
+
+ : values as string (separated by
+ "|"), used for type integer (optional)
+
+
+
+
+ : minimum value (for integer)
+ NULL)
+
+
+
+
+ : maximum value (for integer)
+
+
+
+
+ : default value for option (used
+ when option is reset)
+
+
+
+
+ : value for option
+
+
+
+
+ : callback called to check
+ new value for an option (optional)
+
+
+
+
+ : pointer given to
+ check_value callback when it is called by WeeChat
+ NULL)
+
+
+
+
+ : callback called when value of
+ option has changed (optional)
+
+
+
+
+ : pointer given to change
+ callback when it is called by WeeChat
+ NULL)
+
+
+
+
+ : callback called when option
+ will be deleted (optional)
+
+
+
+
+ : pointer given to delete
+ callback when it is called by WeeChat
+ NULL)
+
+
+
+
+
+ Return value: pointer to new option in section, NULL if an error
+ occured.
+
+
+ Example:
+
+/* boolean */
+struct t_config_option *option1 =
+ weechat_config_new_option (config_file, section,
+ "option1", "My option, type boolean"
+ NULL, /* string values */
+ 0, 0, /* min, max */
+ "on", /* default */
+ "on", /* value */
+ NULL, NULL, /* check callback */
+ NULL, NULL, /* change callback */
+ NULL, NULL); /* delete callback */
+
+/* integer */
+struct t_config_option *option2 =
+ weechat_config_new_option (config_file, section,
+ "option2", "My option, type integer"
+ NULL, /* string values */
+ 0, 100, /* min, max */
+ "15", /* default */
+ "15", /* value */
+ NULL, NULL, /* check callback */
+ NULL, NULL, /* change callback */
+ NULL, NULL); /* delete callback */
+
+/* integer (with string values) */
+struct t_config_option *option3 =
+ weechat_config_new_option (config_file, section,
+ "option3", "My option, type integer (with string values)"
+ "top|bottom|left|right", /* string values */
+ 0, 0, /* min, max */
+ "bottom", /* default */
+ "bottom", /* value */
+ NULL, NULL, /* check callback */
+ NULL, NULL, /* change callback */
+ NULL, NULL); /* delete callback */
+
+/* string */
+struct t_config_option *option4 =
+ weechat_config_new_option (config_file, section,
+ "option4", "My option, type string"
+ NULL, /* string values */
+ 0, 0, /* min, max */
+ "test", /* default */
+ "test", /* value */
+ NULL, NULL, /* check callback */
+ NULL, NULL, /* change callback */
+ NULL, NULL); /* delete callback */
+
+/* color */
+struct t_config_option *option5 =
+ weechat_config_new_option (config_file, section,
+ "option5", "My option, type color"
+ NULL, /* string values */
+ 0, 0, /* min, max */
+ "lightblue", /* default */
+ "lightblue", /* value */
+ NULL, NULL, /* check callback */
+ NULL, NULL, /* change callback */
+ NULL, NULL); /* delete callback */
+
+
+
+
+
+ weechat_config_search_option
+
+
+ Prototype:
+
+struct t_config_option *weechat_config_search_option (struct t_config_file *config_file,
+ struct t_config_section *section,
+ const char *option_name);
+
+
+
+ Search an option in a section of a configuration file.
+
+
+ Arguments:
+
+
+
+ : configuration file pointer
+
+
+
+
+ : section pointer
+
+
+
+
+ : name of option to search
+
+
+
+
+
+ Return value: pointer to option found, NULL if option was not found.
+
+
+ Example:
+
+struct t_config_option *option = weechat_config_search_option (config_file, section, "option");
+
+
+
+
+
+ weechat_config_search_with_string
+
+
+ Prototype:
+
+void weechat_config_search_with_string (const char *option_name,
+ struct t_config_file **config_file,
+ struct t_config_section **section,
+ struct t_config_option **option);
+
+
+
+ Search an option in in a configuration file with string.
+
+
+ Arguments:
+
+
+
+ : full option name (format:
+ "file.section.option")
+
+
+
+
+ : pointer to a configuration file
+ pointer, will be set to configuration file of option, if found
+
+
+
+
+ : pointer to a section pointer, will be
+ set to section of option, if found
+
+
+
+
+ : pointer to an option pointer, will be
+ set to option pointer, if found
+
+
+
+
+
+ Example:
+
+struct t_config_file *ptr_config_file;
+struct t_config_section *ptr_section;
+struct t_config_option *ptr_option;
+
+weechat_config_search_with_string ("file.section.option",
+ &ptr_config_file, &ptr_section, &ptr_option);
+if (ptr_option)
+{
+ /* option found */
+ /* ... */
+}
+else
+{
+ /* option not found */
+ /* ... */
+}
+
+
+
+
+
+ weechat_config_string_to_boolean
+
+
+ Prototype:
+
+int weechat_config_string_to_boolean (const char *text);
+
+
+
+ Check if a text is "true" or "false".
+
+
+ Arguments:
+
+
+
+ : text to analyze
+
+
+
+
+
+ Return value: 1 if text is "true" ("on", "yes", "y", "true", "t", "1"),
+ or 0 if text is "false" ("off", "no", "n", "false", "f", "0").
+
+
+ Example:
+
+if (weechat_config_string_to_boolean ("on"))
+{
+ /* true */
+ /* ... */
+}
+else
+{
+ /* false */
+ /* never executed! */
+}
+
+
+
+
+
+ weechat_config_option_reset
+
+
+ Prototype:
+
+int weechat_config_option_reset (struct t_config_option *option,
+ int run_callback);
+
+
+
+ Reset an option to its default value.
+
+
+ Arguments:
+
+
+
+ : option pointer
+
+
+
+
+ : 1 for calling change callback if
+ option is changed, 0 otherwise
+
+
+
+
+
+ Return value: WEECHAT_CONFIG_OPTION_SET_OK_CHANGED if option value has
+ been reset, WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE if value was not
+ changed, WEECHAT_CONFIG_OPTION_SET_ERROR if an error occured.
+
+
+ Example:
+
+switch (weechat_config_option_reset (option, 1))
+{
+ case WEECHAT_CONFIG_OPTION_SET_OK_CHANGED:
+ /* .... */
+ break;
+ case WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE:
+ /* .... */
+ break;
+ case WEECHAT_CONFIG_OPTION_SET_ERROR:
+ /* .... */
+ break;
+}
+
+
+
+
+
+ weechat_config_option_set
+
+
+ Prototype:
+
+int weechat_config_option_set (struct t_config_option *option,
+ const char *value, int run_callback);
+
+
+
+ Set new value for an option.
+
+
+ Arguments:
+
+
+
+ : option pointer
+
+
+
+
+ : new value for option
+
+
+
+
+ : 1 for calling change callback if
+ option is changed, 0 otherwise
+
+
+
+
+
+ Return value: WEECHAT_CONFIG_OPTION_SET_OK_CHANGED if option value has
+ been reset, WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE if value was not
+ changed, WEECHAT_CONFIG_OPTION_SET_ERROR if an error occured.
+
+
+ Example:
+
+switch (weechat_config_option_set (option, "new_value", 1))
+{
+ case WEECHAT_CONFIG_OPTION_SET_OK_CHANGED:
+ /* .... */
+ break;
+ case WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE:
+ /* .... */
+ break;
+ case WEECHAT_CONFIG_OPTION_SET_ERROR:
+ /* .... */
+ break;
+}
+
+
+
+
+
+ weechat_config_option_unset
+
+
+ Prototype:
+
+int weechat_config_option_unset (struct t_config_option *option);
+
+
+
+ Unset/reset option.
+
+
+ Arguments:
+
+
+
+ : option pointer
+
+
+
+
+
+ Return value: WEECHAT_CONFIG_OPTION_UNSET_OK_NO_RESET if option value
+ has not been reset, WEECHAT_CONFIG_OPTION_UNSET_OK_RESET if option
+ value has been reset, WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED if option
+ has been removed, WEECHAT_CONFIG_OPTION_UNSET_ERROR if an error
+ occured.
+
+
+ Example:
+
+switch (weechat_config_option_unset (option))
+{
+ case WEECHAT_CONFIG_OPTION_UNSET_OK_NO_RESET:
+ /* .... */
+ break;
+ case WEECHAT_CONFIG_OPTION_UNSET_OK_RESET:
+ /* .... */
+ break;
+ case WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED:
+ /* .... */
+ break;
+ case WEECHAT_CONFIG_OPTION_UNSET_ERROR:
+ /* .... */
+ break;
+}
+
+
+
+
+
+ weechat_config_option_rename
+
+
+ Prototype:
+
+void weechat_config_option_rename (struct t_config_option *option,
+ const char *new_name);
+
+
+
+ Rename an option.
+
+
+ Arguments:
+
+
+
+ : option pointer
+
+
+
+
+ : new name for option
+
+
+
+
+
+ Example:
+
+weechat_config_option_rename (option, "new_name");
+
+
+
+
+
+ weechat_config_option_get_pointer
+
+
+ Prototype:
+
+void *weechat_config_option_get_pointer (struct t_config_option *option,
+ const char *property);
+
+
+
+ Get a pointer on an option property.
+
+
+ Arguments:
+
+
+
+ : option pointer
+
+
+
+
+ : property name:
+
+
+
+
+ Property
+ Type
+ Description
+
+
+
+
+ config_file
+ struct t_config_file *
+ configuration file pointer
+
+
+ section
+ struct t_config_section *
+ section pointer
+
+
+ name
+ char *
+ option name
+
+
+ type
+ int
+ option type
+
+
+ description
+ char *
+ option description
+
+
+ string_values
+ char **
+ string values
+
+
+ min
+ int
+ minimum value
+
+
+ max
+ int
+ maximum value
+
+
+ default_value
+ (depends on type)
+ default value
+
+
+ value
+ (depends on type)
+ current value
+
+
+ prev_option
+ struct t_config_option *
+ previous option pointer
+
+
+ next_option
+ struct t_config_option *
+ next option pointer
+
+
+
+
+
+
+
+
+
+ Example:
+
+char *description = weechat_config_option_get_pointer (option, "description");
+
+
+
+
+
+ weechat_config_boolean
+
+
+ Prototype:
+
+int weechat_config_boolean (struct t_config_option *option);
+
+
+
+ Get boolean value of option.
+
+
+ Arguments:
+
+
+
+ : option pointer
+
+
+
+
+
+ Return value: boolean value of option (0 or 1).
+
+
+ Example:
+
+if (weechat_config_boolean (option))
+{
+ /* true */
+}
+else
+{
+ /* false */
+}
+
+
+
+
+
+ weechat_config_integer
+
+
+ Prototype:
+
+int weechat_config_integer (struct t_config_option *option);
+
+
+
+ Get integer value of option.
+
+
+ Arguments:
+
+
+
+ : option pointer
+
+
+
+
+
+ Return value: integer value of option.
+
+
+ Example:
+ int value = weechat_config_boolean (option);
+
+
+
+
+ weechat_config_string
+
+
+ Prototype:
+
+char *weechat_config_string (struct t_config_option *option);
+
+
+
+ Get string value of option.
+
+
+ Arguments:
+
+
+
+ : option pointer
+
+
+
+
+
+ Return value: string value of option.
+
+
+ Example:
+ char *value = weechat_config_string (option);
+
+
+
+
+ weechat_config_string
+
+
+ Prototype:
+
+char *weechat_config_color (struct t_config_option *option);
+
+
+
+ Get color value of option.
+
+
+ Arguments:
+
+
+
+ : option pointer
+
+
+
+
+
+ Return value: color value of option (string with name of color).
+
+
+ Example:
+ char *color = weechat_config_color (option);
+
+
+
+
+ weechat_config_write_line
+
+
+ Prototype:
+
+void weechat_config_write_line (struct t_config_file *config_file,
+ const char *option_name,
+ const char *value, ...);
+
+
+
+ Write a line in a configuration file (this function should be called
+ only in "write" or "write_default" callbacks for a section).
+
+
+ Arguments:
+
+
+
+ : configuration file pointer
+
+
+
+
+ : option name
+
+
+
+
+ : value
+
+
+
+
+
+ Example:
+
+int
+my_section_write_cb (void *data, struct t_config_file *config_file,
+ const char *section_name)
+{
+ weechat_config_write_line (config_file, "option", "%s;%d",
+ "value", 123);
+
+ return WEECHAT_RC_OK;
+}
+
+
+
+
+
+ weechat_config_write
+
+
+ Prototype:
+
+int weechat_config_write (struct t_config_file *config_file);
+
+
+
+ Write configuration file to disk.
+
+
+ Arguments:
+
+
+
+ : configuration file pointer
+
+
+
+
+
+ Return value: WEECHAT_CONFIG_WRITE_OK if configuration was written,
+ WEECHAT_CONFIG_WRITE_ERROR if an error occured,
+ WEECHAT_CONFIG_WRITE_MEMORY_ERROR if there was not enough memory.
+
+
+ Example:
+
+switch (weechat_config_write (config_file))
+{
+ case WEECHAT_CONFIG_WRITE_OK:
+ /* ... */
+ break;
+ case WEECHAT_CONFIG_WRITE_ERROR:
+ /* ... */
+ break;
+ case WEECHAT_CONFIG_WRITE_MEMORY_ERROR:
+ /* ... */
+ break;
+}
+
+
+
+
+
+ weechat_config_read
+
+
+ Prototype:
+
+int weechat_config_read (struct t_config_file *config_file);
+
+
+
+ Read configuration file from disk.
+
+
+ Arguments:
+
+
+
+ : configuration file pointer
+
+
+
+
+
+ Return value: WEECHAT_CONFIG_READ_OK if configuration was loaded,
+ WEECHAT_CONFIG_READ_MEMORY_ERROR if there was not enough memory,
+ WEECHAT_CONFIG_READ_FILE_NOT_FOUND if file was not found.
+
+
+ Example:
+
+switch (weechat_config_read (config_file))
+{
+ case WEECHAT_CONFIG_READ_OK:
+ /* ... */
+ break;
+ case WEECHAT_CONFIG_READ_MEMORY_ERROR:
+ /* ... */
+ break;
+ case WEECHAT_CONFIG_READ_FILE_NOT_FOUND:
+ /* ... */
+ break;
+}
+
+
+
+
+
+ weechat_config_reload
+
+
+ Prototype:
+
+int weechat_config_reload (struct t_config_file *config_file);
+
+
+
+ Reload configuration file from disk.
+
+
+ Arguments:
+
+
+
+ : configuration file pointer
+
+
+
+
+
+ Return value: WEECHAT_CONFIG_READ_OK if configuration was reloaded,
+ WEECHAT_CONFIG_READ_MEMORY_ERROR if there was not enough memory,
+ WEECHAT_CONFIG_READ_FILE_NOT_FOUND if file was not found.
+
+
+ Example:
+
+switch (weechat_config_reload (config_file))
+{
+ case WEECHAT_CONFIG_READ_OK:
+ /* ... */
+ break;
+ case WEECHAT_CONFIG_READ_MEMORY_ERROR:
+ /* ... */
+ break;
+ case WEECHAT_CONFIG_READ_FILE_NOT_FOUND:
+ /* ... */
+ break;
+}
+
+
+
+
+
+ weechat_config_option_free
+
+
+ Prototype:
+
+void weechat_config_option_free (struct t_config_option *option);
+
+
+
+ Free an option.
+
+
+ Arguments:
+
+
+
+ : option pointer
+
+
+
+
+
+ Example:
+ weechat_config_option_free (option);
+
+
+
+
+ weechat_config_section_free_options
+
+
+ Prototype:
+
+void weechat_config_section_free_options (struct t_config_section *section);
+
+
+
+ Free all options in a section.
+
+
+ Arguments:
+
+
+
+ : section pointer
+
+
+
+
+
+ Example:
+ weechat_config_section_free_options (section);
+
+
+
+
+ weechat_config_section_free
+
+
+ Prototype:
+
+void weechat_config_section_free (struct t_config_section *section);
+
+
+
+ Free a section.
+
+
+ Arguments:
+
+
+
+ : section pointer
+
+
+
+
+
+ Example:
+ weechat_config_section_free (section);
+
+
+
+
+ weechat_config_free
+
+
+ Prototype:
+
+void weechat_config_free (struct t_config_file *config_file);
+
+
+
+ Free a configuration file.
+
+
+ Arguments:
+
+
+
+ : configuration file pointer
+
+
+
+
+
+ Example:
+ weechat_config_free (config_file);
+
+
+
+
+ weechat_config_get
+
+
+ Prototype:
+
+struct t_config_option *weechat_config_get (const char *option_name);
+
+
+
+ Search an option in in a configuration file with string.
+
+
+ Arguments:
+
+
+
+ : full option name (format:
+ "file.section.option")
+
+
+
+
+
+ Return value: pointer to option found, NULL if option was not found.
+
+
+ Example:
+
+struct t_config_option *option = weechat_config_get ("weechat.look.item_time_format");
+
+
+
+
+
+ weechat_config_get_plugin
+
+
+ Prototype:
+
+char *weechat_config_get_plugin (const char *option_name);
+
+
+
+ Search an option in plugins configuration file (plugins.conf), by
+ adding prefix with current plugin name.
+
+
+ Arguments:
+
+
+
+ : option name, WeeChat will add
+ prefix "plugins.var.xxxx." (where xxxx is current plugin name).
+
+
+
+
+
+ Return value: pointer to option found, NULL if option was not found.
+
+
+ Example:
+
+/* if current plugin is "test", then look for value of option
+ "plugins.var.test.option" in plugins.conf file */
+char *value = weechat_config_get_plugin ("option");
+
+
+
+
+
+ weechat_config_set_plugin
+
+
+ Prototype:
+
+int weechat_config_set_plugin (const char *option_name, const char *value);
+
+
+
+ Set value for option in in plugins configuration file (plugins.conf).
+
+
+ Arguments:
+
+
+
+ : option name, WeeChat will add
+ prefix "plugins.var.xxxx." (where xxxx is current plugin name).
+
+
+
+
+
+ Return value: 1 if ok, 0 if an error occured.
+
+
+ Example:
+
+weechat_config_set_plugin ("option", "test_value");
+
+
+
+
+
+
+
+
+
+ Display
+
+
+ Functions to display text in buffers.
+
+
+
+ weechat_prefix
+
+
+ Prototype:
+
+char *weechat_prefix (const char *prefix);
+
+
+
+ Get a prefix.
+
+
+ Arguments:
+
+
+
+ : name of prefix:
+
+
+
+
+ Prefix
+ Default value
+ Description
+
+
+
+
+ error
+ =!=
+ error message
+
+
+ network
+ --
+ message from network
+
+
+ action
+ *
+ self action
+
+
+ join
+ -->
+ someone joins current chat
+
+
+ quit
+ <--
+ someone leaves current chat
+
+
+
+
+
+
+
+
+
+ Return value: prefix value, empty string if prefix is not found
+ (not NULL).
+
+
+ Example:
+
+weechat_printf (NULL, "%sThis is an error...",
+ weechat_prefix ("error"));
+
+
+
+
+
+ weechat_color
+
+
+ Prototype:
+
+char *weechat_color (const char *color_name);
+
+
+
+ Get a string color code for display.
+
+
+ Arguments:
+
+
+
+ : name of color: may be a WeeChat
+ color name (from weechat.color.xxx), or a color with optional
+ background (separated by comma).
+
+
+
+
+
+ Return value: string with color code, or a "reset color" code if color
+ is not found.
+
+
+ Example:
+
+weechat_printf (NULL, "Color: %sblue %schat default %sred on green",
+ weechat_color ("blue"),
+ weechat_color ("chat"),
+ weechat_color ("red,green"));
+
+
+
+
+
+ weechat_printf
+
+
+ Prototype:
+
+void weechat_printf (struct t_gui_buffer *buffer, const char *message, ...);
+
+
+
+ Display a message on a buffer.
+
+
+ Arguments:
+
+
+
+ : buffer pointer, if NULL, message is
+ displayed on WeeChat buffer.
+
+
+
+
+ : message to display
+
+
+
+
+
+ Example:
+
+weechat_printf (NULL, "Hello on WeeChat buffer");
+weechat_printf (buffer, "Hello on this buffer");
+
+
+
+
+
+ weechat_printf_date
+
+
+ Prototype:
+
+void weechat_printf_date (struct t_gui_buffer *buffer, time_t date,
+ const char *message, ...);
+
+
+
+ Display a message on a buffer, using a custom date.
+
+
+ Arguments:
+
+
+
+ : buffer pointer, if NULL, message is
+ displayed on WeeChat buffer.
+
+
+
+
+ : date for message
+
+
+
+
+ : message to display
+
+
+
+
+
+ Example:
+
+weechat_printf (NULL, time (NULL) - 120, "Hello, 2 minutes ago");
+
+
+
+
+
+
+
+
+
+ weechat_printf_y
+
+
+ Prototype:
+
+void weechat_printf_y (struct t_gui_buffer *buffer, int y,
+ const char *message, ...);
+
+
+
+ Display a message on a line of a buffer with free content (see
+ ).
+
+
+ Arguments:
+
+
+
+ : buffer pointer, if NULL, message is
+ displayed on WeeChat buffer.
+
+
+
+
+ : line number (0 for first line)
+
+
+
+
+ : message to display
+
+
+
+
+
+ Example:
+
+weechat_printf_y (buffer, 2, "My message on third line");
+
+
+
+
+
+
+
+
+
+ Buffers
+
+
+ Functions to create/query/close buffers.
+
+
+
+ Missing doc!
+
+
+
+
+
+
+
+ Nicklist
+
+
+ Functions for buffer nicklist.
+
+
+
+ Missing doc!
+
+
+
+
+
+
+
+ Bars
+
+
+ Functions for bars.
+
+
+
+ Missing doc!
+
+
+
+
+
+
+
+ Commands
+
+
+ Functions for executing WeeChat commands.
+
+
+
+ Missing doc!
+
+
+
+
+
+
+
+ Network
+
+
+ Network functions.
+
+
+
+ Missing doc!
+
+
+
+
+
+
+
+ Infos
+
+
+ Functions to get infos.
+
+
+
+ Missing doc!
+
+
+
+
+
+
+
+ Infolists
+
+
+ Functions for infolists.
+
+
+
+ Missing doc!
+
+
+
+
+
+
+
+ Upgrade
+
+
+ Functions for WeeChat upgrading.
+
+
+
+ Missing doc!
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/doc/en/dev/plugin_scripts.en.xml b/doc/en/dev/plugin_script_api.en.xml
similarity index 99%
rename from doc/en/dev/plugin_scripts.en.xml
rename to doc/en/dev/plugin_script_api.en.xml
index a4aa2ea7a..a1b13e537 100644
--- a/doc/en/dev/plugin_scripts.en.xml
+++ b/doc/en/dev/plugin_script_api.en.xml
@@ -21,8 +21,10 @@ along with this program. If not, see .
-->
-
- Scripts plugins
+
+ Script plugin API
+
+
+
diff --git a/doc/en/dev/plugins.en.xml b/doc/en/dev/plugins.en.xml
index fd2e2f7db..6b8456114 100644
--- a/doc/en/dev/plugins.en.xml
+++ b/doc/en/dev/plugins.en.xml
@@ -129,8 +129,6 @@ along with this program. If not, see .
- &plugin_api.en.xml;
-
Compile plugin
@@ -237,14 +235,4 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
- &plugin_irc.en.xml;
-
-
-
- &plugin_fifo.en.xml;
-
-
-
- &plugin_xfer.en.xml;
-
diff --git a/doc/en/dev/weechat_dev.en.xml b/doc/en/dev/weechat_dev.en.xml
index e21d3cf0e..c7c361fcb 100644
--- a/doc/en/dev/weechat_dev.en.xml
+++ b/doc/en/dev/weechat_dev.en.xml
@@ -30,11 +30,12 @@ along with this program. If not, see .
%include_autogen.xml;
-
-
-
-
-
+
+
+
+
+
+
]>
@@ -94,7 +95,9 @@ along with this program. If not, see .
&intro.en.xml;
-
+ &plugins.en.xml;
+
+ &plugin_api.en.xml;
&authors.en.xml;
diff --git a/doc/fr/Makefile.am b/doc/fr/Makefile.am
index 24fd0f01f..951b6ec47 100644
--- a/doc/fr/Makefile.am
+++ b/doc/fr/Makefile.am
@@ -48,29 +48,29 @@ BOOK_COMMON_INCLUDE = authors.$(LANGCODE).xml \
intro.$(LANGCODE).xml
BOOK_USER = weechat_user.$(LANGCODE)
-BOOK_USER_INCLUDE = user/install.$(LANGCODE).xml \
- user/usage.$(LANGCODE).xml \
- user/plugins.$(LANGCODE).xml \
- user/plugin_alias.$(LANGCODE).xml \
- user/plugin_aspell.$(LANGCODE).xml \
- user/plugin_charset.$(LANGCODE).xml \
- user/plugin_fifo.$(LANGCODE).xml \
- user/plugin_irc.$(LANGCODE).xml \
- user/plugin_logger.$(LANGCODE).xml \
- user/plugin_scripts.$(LANGCODE).xml \
+BOOK_USER_INCLUDE = user/install.$(LANGCODE).xml \
+ user/usage.$(LANGCODE).xml \
+ user/plugins.$(LANGCODE).xml \
+ user/plugin_alias.$(LANGCODE).xml \
+ user/plugin_aspell.$(LANGCODE).xml \
+ user/plugin_charset.$(LANGCODE).xml \
+ user/plugin_fifo.$(LANGCODE).xml \
+ user/plugin_irc.$(LANGCODE).xml \
+ user/plugin_logger.$(LANGCODE).xml \
+ user/plugin_scripts.$(LANGCODE).xml \
user/plugin_xfer.$(LANGCODE).xml
BOOK_DEV = weechat_dev.$(LANGCODE)
-BOOK_DEV_INCLUDE = dev/plugin_api.$(LANGCODE).xml \
- dev/plugin_scripts.$(LANGCODE).xml \
- dev/plugins.$(LANGCODE).xml \
- dev/weechat_dev.$(LANGCODE).xml
+BOOK_DEV_INCLUDE = dev/plugins.$(LANGCODE).xml \
+ dev/plugin_api.$(LANGCODE).xml \
+ dev/plugin_c_api.$(LANGCODE).xml \
+ dev/plugin_script_api.$(LANGCODE).xml
QUICKSTART = weechat_quickstart.$(LANGCODE).txt
-EXTRA_DIST = $(BOOK_AUTOGEN_INCLUDE) $(BOOK_COMMON_INCLUDE) \
- user/$(BOOK_USER).xml $(BOOK_USER_INCLUDE) \
- dev/$(BOOK_DEV).xml $(BOOK_DEV_INCLUDE) \
+EXTRA_DIST = $(BOOK_AUTOGEN_INCLUDE) $(BOOK_COMMON_INCLUDE) \
+ user/$(BOOK_USER).xml $(BOOK_USER_INCLUDE) \
+ dev/$(BOOK_DEV).xml $(BOOK_DEV_INCLUDE) \
$(QUICKSTART)
if DBLATEX_FOUND
diff --git a/doc/fr/dev/plugin_api.fr.xml b/doc/fr/dev/plugin_api.fr.xml
index 99e363984..fc8db0311 100644
--- a/doc/fr/dev/plugin_api.fr.xml
+++ b/doc/fr/dev/plugin_api.fr.xml
@@ -21,3541 +21,11 @@ along with this program. If not, see .
-->
-
+
API extension
-
- set_charset
-
-
- Prototype :
-
- void set_charset (t_weechat_plugin *plugin, char *charset)
-
-
-
- Change le jeu de caractères de l'extension.
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : nouveau jeu de caractères à
- utiliser
-
-
-
-
-
- Exemple :
- plugin->set_charset (plugin, "ISO-8859-1");
-
-
+ &plugin_c_api.fr.xml;
-
- iconv_to_internal
-
-
- Prototype :
-
- void iconv_to_internal (t_weechat_plugin *plugin, char *charset,
- char *string)
-
-
-
- Convertit une chaîne de caractères vers le jeu de caractères
- interne WeeChat (UTF-8).
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : le jeu de caractères de départ
-
-
-
-
- : la chaîne à convertir
-
-
-
-
-
- Valeur renvoyée : la chaîne convertie.
-
-
- Note : le résultat doit être libéré par un appel à la fonction
- "free" après utilisation.
-
-
- Exemple :
- char *str = plugin->iconv_to_internal (plugin, "ISO-8859-1", "chaine iso: é à");
-
-
+
-
- iconv_from_internal
-
-
- Prototype :
-
- void iconv_from_internal (t_weechat_plugin *plugin, char *charset,
- char *string)
-
-
-
- Convertit une chaîne de caractères depuis le jeu de caractères
- interne WeeChat (UTF-8) vers un autre.
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : le jeu de caractères voulu
-
-
-
-
- : la chaîne à convertir
-
-
-
-
-
- Valeur renvoyée : la chaîne convertie.
-
-
- Note : le résultat doit être libéré par un appel à la fonction
- "free" après utilisation.
-
-
- Exemple :
- char *str = plugin->iconv_from_internal (plugin, "ISO-8859-1", "chaine utf-8: é à");
-
-
-
-
- ascii_strcasecmp
-
-
- Prototype :
-
- int ascii_strcasecmp (t_weechat_plugin *plugin,
- char *chaine1, char *chaine2)
-
-
-
- Effectue une comparaison entre deux chaînes, sans tenir compte des
- majuscules/minuscules ni de la locale.
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : la première chaîne à comparer
-
-
-
-
- : la deuxième chaîne à comparer
-
-
-
-
-
- Valeur renvoyée : la différence entre les deux chaînes : négatif
- si chaine1 < chaine2, zéro si chaine1 == chaine2, positif si
- chaine1 > chaine2
-
-
- Exemple :
- if (plugin->ascii_strcasecmp (plugin, "abc", "def") != 0) ...
-
-
-
-
- ascii_strncasecmp
-
-
- Prototype :
-
- int ascii_strncasecmp (t_weechat_plugin *plugin,
- char *chaine1, char *chaine2, int max)
-
-
-
- Effectue une comparaison entre deux chaînes, sans tenir compte des
- majuscules/minuscules ni de la locale, en comparant au plus "max"
- caractères.
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : la première chaîne à comparer
-
-
-
-
- : la deuxième chaîne à comparer
-
-
-
-
- : nombre de caractères max à comparer
-
-
-
-
-
- Valeur renvoyée : la différence entre les deux chaînes : négatif
- si chaine1 < chaine2, zéro si chaine1 == chaine 2, positif si
- chaine1 > chaine2
-
-
- Exemple :
- if (plugin->ascii_strncasecmp (plugin, "abc", "def", 2) != 0) ...
-
-
-
-
- explode_string
-
-
- Prototype :
-
- char **explode_string (t_weechat_plugin *plugin, char *chaine,
- char *separateurs, int num_items_max, int *num_items)
-
-
-
- Explose une chaîne en plusieurs selon un/des délimiteur(s).
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : la chaîne à exploser
-
-
-
-
- : les délimiteurs utilisés
- pour exploser la chaîne
-
-
-
-
- : nombre maximum de
- sous-chaînes créées (0 = pas de limite)
-
-
-
-
- : pointeur vers un entier qui
- contiendra le nombre de sous-chaînes créées en retour
-
-
-
-
-
- Valeur renvoyée : un tableau de chaînes, ou NULL si un problème
- a été rencontré.
-
-
- Note : le résultat doit être libéré par un appel à la fonction
- "free_exploded_string" après utilisation.
-
-
- Exemple :
-
-char **argv;
-int argc;
-argv = plugin->explode_string (plugin, chaine, " ", 0, &argc);
-...
-if (argv != NULL)
- plugin->free_exploded_string (plugin, argv);
-
-
-
-
-
- free_exploded_string
-
-
- Prototype :
-
- char **free_exploded_string (t_weechat_plugin *plugin,
- char **chaine)
-
-
-
- Libère la mémoire utilisée pour une explosion de chaîne.
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : la chaîne explosée par la fonction
- "explode_string"
-
-
-
-
-
- Valeur renvoyée : aucune.
-
-
- Exemple :
-
-char *argv;
-int argc;
-argv = plugin->explode_string (plugin, chaine, " ", 0, &argc);
-...
-if (argv != NULL)
- plugin->free_exploded_string (plugin, argv);
-
-
-
-
-
- mkdir_home
-
-
- Prototype :
-
- int mkdir_home (t_weechat_plugin *plugin, char *repertoire)
-
-
-
- Créé un répertoire dans le répertoire de base de WeeChat.
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : répertoire à créer
-
-
-
-
-
- Valeur renvoyée : 1 si le répertoire a été créé avec succès,
- 0 si une erreur s'est produite.
-
-
- Example:
-
-if (!plugin->mkdir_home (plugin, "temp"))
- plugin->print_server(plugin, "Impossible de créer le répertoire 'temp' dans la base WeeChat.");
-
-
-
-
-
- exec_on_files
-
-
- Prototype :
-
- void exec_on_files (t_weechat_plugin *plugin, char *repertoire,
- int (*callback)(t_weechat_plugin *, char *))
-
-
-
- Exécute une fonction sur tous les fichiers d'un répertoire.
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : le répertoire où les fichiers
- sont recherchés
-
-
-
-
- : une fonction appelée pour chaque
- fichier trouvé
-
-
-
-
-
- Valeur renvoyée : aucune.
-
-
- Exemple :
-
-int callback (t_weechat_plugin *plugin, char *fichier)
-{
- plugin->print_server (plugin, "fichier: %s", fichier);
- return 1;
-}
-...
-plugin->exec_on_files (plugin, "/tmp", &callback);
-
-
-
-
-
- print
-
-
- Prototype :
-
- void print (t_weechat_plugin *plugin,
- char *serveur, char *canal, char *message, ...)
-
-
-
- Affiche un message sur un tampon WeeChat, identifié par le serveur
- et le canal (tous deux pouvant être NULL pour le tampon courant).
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : nom interne du serveur pour
- trouver le tampon dans lequel afficher (peut être NULL)
-
-
-
-
- : nom du canal pour trouver le
- tampon dans lequel afficher (peut être NULL)
-
-
-
-
- : message à afficher
-
-
-
-
-
- Pour afficher du texte en couleur, il faut utiliser les codes
- suivants :
-
-
-
-
- Code
- Description
-
-
-
-
- 0x02
-
- texte gras
-
-
-
- 0x03 + "xx"
-
- couleur du texte "xx"
- (voir pour les
- couleurs)
-
-
-
- 0x03 + "xx,yy"
-
- couleur du texte "xx"
- et du fond "yy"
- (voir pour les
- couleurs)
-
-
-
- 0x0F
-
- désactiver la couleur et tous les attributs
-
-
-
- 0x12
-
- vidéo inverse (inversion de la couleur d'écriture et du
- fond)
-
-
-
- 0x1F
-
- texte souligné
-
-
-
-
-
- NB: le même code (sans le numéro pour 0x03) peut être utilisé pour
- stopper l'attribut défini.
-
-
- Valeur renvoyée : aucune.
-
-
- Exemples :
-
-plugin->print (plugin, NULL, NULL, "hello");
-plugin->print (plugin, NULL, "#weechat", "hello");
-plugin->print (plugin, "freenode", "#weechat", "hello");
-plugin->print (plugin, "freenode", "#weechat", "hello");
-plugin->print (plugin, NULL, NULL,
- "test: \x02 gras \x0F\x03%02d bleu \x03%02d vert",
- plugin->get_irc_color (plugin, "blue"),
- plugin->get_irc_color (plugin, "green"));
-
-
-
-
-
- print_server
-
-
- Prototype :
-
- void print_server (t_weechat_plugin *plugin,
- char *message, ...)
-
-
-
- Affiche un message sur le tampon du serveur courant.
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : message à afficher
-
-
-
-
-
- Pour afficher du texte en couleur, voir
- .
-
-
- Valeur renvoyée : aucune.
-
-
- Exemple : plugin->print_server (plugin, "hello");
-
-
-
-
- log
-
-
- Prototype :
-
- void log (t_weechat_plugin *plugin,
- char *serveur, char *canal, char *message, ...)
-
-
-
- Ecrit un message dans le fichier de log pour un serveur ou un
- canal.
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : nom interne du serveur pour
- trouver le log du tampon (peut être NULL)
-
-
-
-
- : nom du canal pour trouver le
- tampon le log du tampon (peut être NULL)
-
-
-
-
- : message
-
-
-
-
-
- Valeur renvoyée : aucune.
-
-
- Exemple :
-
-plugin->log (plugin, "freenode", "#weechat", "test");
-
-
-
-
-
- msg_handler_add
-
-
- Prototype :
-
- t_plugin_handler *msg_handler_add (t_weechat_plugin
- *plugin, char *message, t_plugin_handler_func *fonction,
- char *handler_args, void *handler_pointer)
-
-
-
- Ajoute un gestionnaire de messages IRC, appelé dès qu'un message
- IRC est reçu.
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : nom du message IRC pour lequel la
- fonction est appelée ("*" pour tous les messages).
- Pour connaître la liste des messages IRC disponibles, merci
- de consulter les RFCs
- 1459
- et
- 2812.
- De plus, vous pouvez utiliser un nom spécial, préfixé par
- "weechat_" pour capturer des évènements spéciaux, comme
- décrit dans le tableau ci-dessous :
-
-
-
-
- Nom
- Description
-
-
-
-
- weechat_pv
- message privé reçu
-
-
- weechat_highlight
-
- message avec highlight (sur un canal ou en privé)
-
-
-
- weechat_ctcp
-
- message CTCP reçu (VERSION, PING, etc...)
-
-
-
- weechat_dcc
-
- message DCC reçu (discussion ou fichier)
-
-
-
-
-
-
-
-
-
- : fonction appelée lorsque le
- message est reçu
-
-
- Elle a le prototype suivant :
-
- int ma_fonction (t_weechat_plugin *plugin,
- int argc, char **argv,
- char *handler_args, void *handler_pointer)
-
-
-
- Le paramètre argc vaut 3 et les arguments suivants sont
- passés dans le tableau argv :
-
-
- argv[0] = nom du serveur
-
-
- argv[1] = message IRC
-
-
- argv[2] = arguments de la commande
-
-
-
-
-
-
- : paramètres passés à la
- fonction appelée
-
-
-
-
- : pointeur passé à la
- fonction appelée
-
-
-
-
-
- Valeur renvoyée : le pointeur vers le nouveau gestionnaire de
- messages.
-
-
- Note : la fonction appelée lorsque le message est reçu doit
- renvoyer une des valeurs suivantes :
-
-
-
- PLUGIN_RC_KO : la fonction a échoué
-
-
-
-
- PLUGIN_RC_OK : la fonction a réussi
-
-
-
-
- PLUGIN_RC_OK_IGNORE_WEECHAT : le message
- ne sera pas transmis à WeeChat
-
-
-
-
- PLUGIN_RC_OK_IGNORE_PLUGINS : le message
- ne sera pas transmis à d'autres extensions
-
-
-
-
- PLUGIN_RC_OK_IGNORE_ALL : le message
- ne sera ni transmis à WeeChat ni à d'autres extensions
-
-
-
-
- PLUGIN_RC_OK_WITH_HIGHLIGHT : la fonction
- a réussi et provoque un "highlight" sur le message reçu
-
-
-
-
-
- Exemple :
-
-int msg_kick (t_weechat_plugin *plugin, int argc, char **argv,
- char *handler_args, void *handler_pointer)
-{
- plugin->print (plugin, argv[0], NULL, "KICK reçu");
- return PLUGIN_RC_OK;
-}
-...
-t_plugin_handler *msg_handler;
-msg_handler = plugin->msg_handler_add (plugin, "KICK",
- &msg_kick, NULL, NULL);
-
-
-
-
-
- cmd_handler_add
-
-
- Prototype :
-
- t_plugin_handler *cmd_handler_add (t_weechat_plugin
- *plugin, char *commande, char *description, char *arguments,
- char *arguments_description, char *modele_completion,
- t_plugin_handler_func *fonction, char *handler_args,
- void *handler_pointer)
-
-
-
- Ajoute un gestionnaire de commande WeeChat, appelé dès que
- l'utilisateur utilise la commande (par exemple /commande).
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : nom de la nouvelle commande,
- qui peut être une commande déjà existante (attention la
- commande remplacée ne sera plus disponible jusqu'à ce que
- l'extension soit déchargée)
-
-
-
-
- : brève description de la
- commande (affichée par /help commande)
-
-
-
-
- : brève description des
- paramètres de la commande (affichée par /help commande)
-
-
-
-
- : longue description
- des paramètres de la commande (affichée par /help commande)
-
-
-
-
- : modèle pour la
- complétion sous la forme "abc|%w def|%i"
- qui signifie "abc" ou une commande WeeChat pour le premier
- paramètre, et "def" ou une commande IRC pour le deuxième.
- Une chaîne vide indique à WeeChat de compléter tout
- paramètre avec un pseudo du canal courant, une valeur NULL
- ou égale à "-" désactive toute complétion pour tous les
- paramètres de la commande.
-
-
- Les codes suivants peuvent être utilisés :
-
-
-
-
- Code
- Description
-
-
-
-
- %-
- aucune complétion pour le paramètre
-
-
- %*
-
- répétition de la dernière complétion pour tous
- les paramètres suivants (ce code doit être à la
- fin du modèle de complétion, précédé d'un "|")
-
-
-
- %a
- alias
-
-
- %A
-
- alias et commandes (WeeChat, IRC et extensions)
-
-
-
- %c
- canal courant
-
-
- %C
- tous les canaux (y compris les privés)
-
-
- %f
- nom de fichier
-
-
- %h
- commandes définies par des extensions
-
-
- %i
- commandes IRC (envoyées)
-
-
- %I
- commandes IRC (reçues)
-
-
- %k
- fonctions associées aux touches
-
-
- %m
- pseudo sur le serveur courant
-
-
- %M
-
- pseudos sur le serveur courant
- (tous les canaux ouverts)
-
-
-
- %n
- pseudos du canal courant
-
-
- %N
-
- pseudos et noms de machines du canal
- courant
-
-
-
- %o
- options de configuration
-
-
- %O
- options des extensions
-
-
- %p
- message de "part" par défaut
-
-
- %q
- message de "quit" par défaut
-
-
- %s
- nom du serveur courant
-
-
- %S
- tous les serveurs
-
-
- %t
- titre du canal courant
-
-
- %v
- valeur d'une option de configuration
-
-
- %V
- valeur d'une option d'extension
-
-
- %w
- commandes WeeChat
-
-
-
-
-
-
-
-
- : fonction appelée lorsque la
- commande est exécutée.
-
-
- Elle a le prototype suivant :
-
- int ma_fonction (t_weechat_plugin *plugin,
- int argc, char **argv,
- char *handler_args, void *handler_pointer)
-
-
-
- Le paramètre argc vaut 3 et les arguments suivants sont
- passés dans le tableau argv :
-
-
- argv[0] = nom du serveur
-
-
- argv[1] = commande
-
-
- argv[2] = arguments de la commande
-
-
-
-
-
-
- : paramètres passés à la
- fonction appelée
-
-
-
-
- : pointeur passé à la
- fonction appelée
-
-
-
-
-
- Valeur renvoyée : le pointeur vers le nouveau gestionnaire de
- commande.
-
-
- Note : la fonction appelée lorsque la commande est exécutée doit
- renvoyer une des valeurs suivantes :
-
-
-
- PLUGIN_RC_KO : la fonction a échoué
-
-
-
-
- PLUGIN_RC_OK : la fonction a réussi
-
-
-
-
-
- Exemple :
-
-int cmd_test (t_weechat_plugin *plugin, int argc, char **argv,
- char *handler_args, void *handler_pointer)
-{
- plugin->print (plugin, argv[0], NULL,
- "commande test, pseudo: %s",
- (argv[2]) ? argv[2] : "aucun");
- return PLUGIN_RC_OK;
-}
-...
-t_plugin_handler *cmd_handler;
-cmd_handler = plugin->cmd_handler_add (plugin, "test", "Commande test",
- "[pesudo]", "pseudo: un pseudo du canal",
- "%n", &cmd_test, NULL, NULL);
-
-
-
-
-
- timer_handler_add
-
-
- Prototype :
-
- t_plugin_handler *timer_handler_add (t_weechat_plugin
- *plugin, int intervalle, t_plugin_handler_func *fonction,
- char *handler_args, void *handler_pointer)
-
-
-
- Ajoute un gestionnaire de temps, qui appelle périodiquement une
- fonction.
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : intervalle (en secondes)
- entre deux appels de la fonction.
-
-
-
-
- : fonction appelée
-
-
- Elle a le prototype suivant :
-
- int ma_fonction (t_weechat_plugin *plugin,
- int argc, char **argv,
- char *handler_args, void *handler_pointer)
-
-
-
- Le paramètre argc vaut 0 et argv vaut NULL.
-
-
-
-
- : paramètres passés à la
- fonction appelée
-
-
-
-
- : pointeur passé à la
- fonction appelée
-
-
-
-
-
- Valeur renvoyée : le pointeur vers le nouveau gestionnaire de
- temps.
-
-
- Note : la fonction appelée doit renvoyer une des valeurs
- suivantes :
-
-
-
- PLUGIN_RC_KO : la fonction a échoué
-
-
-
-
- PLUGIN_RC_OK : la fonction a réussi
-
-
-
-
-
- Exemple :
-
-int mon_timer (t_weechat_plugin *plugin, int argc, char **argv,
- char *handler_args, void *handler_pointer)
-{
- plugin->print (plugin, NULL, NULL, "mon timer");
- return PLUGIN_RC_OK;
-}
-...
-t_plugin_handler *timer_handler;
-timer_handler = plugin->timer_handler_add (plugin, 60, &mon_timer);
-
-
-
-
-
- keyboard_handler_add
-
-
- Prototype :
-
- t_plugin_handler *keyboard_handler_add (t_weechat_plugin
- *plugin, t_plugin_handler_func *fonction,
- char *handler_args, void *handler_pointer)
-
-
-
- Ajoute un gestionnaire de clavier, appelé dès qu'une touche est
- pressée.
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : fonction appelée
-
-
- Elle a le prototype suivant :
-
- int ma_fonction (t_weechat_plugin *plugin,
- int argc, char **argv,
- char *handler_args, void *handler_pointer)
-
-
-
- Le paramètre argc vaut 3 et les arguments suivants sont
- passés dans le tableau argv :
-
-
-
- argv[0] = touche appuyée (nom d'une fonction interne
- ou bien '*' suivi du code d'une touche)
-
-
-
-
- argv[1] = la ligne de commande avant l'action de la
- touche
-
-
-
-
- argv[2] = la ligne de commande après l'action de la
- touche
-
-
-
-
-
-
-
- : paramètres passés à la
- fonction appelée
-
-
-
-
- : pointeur passé à la
- fonction appelée
-
-
-
-
-
- Valeur renvoyée : le pointeur vers le nouveau gestionnaire de
- clavier.
-
-
- Note : la fonction appelée doit renvoyer une des valeurs
- suivantes :
-
-
-
- PLUGIN_RC_KO : la fonction a échoué
-
-
-
-
- PLUGIN_RC_OK : la fonction a réussi
-
-
-
-
-
- Exemple :
-
-int mon_keyb (t_weechat_plugin *plugin, int argc, char **argv,
- char *handler_args, void *handler_pointer)
-{
- if (argc == 2)
- {
- plugin->print (plugin, NULL, NULL, "touche appuyée: %s", argv[0]);
- if (argv[1] && (argv[1][0] == '1'))
- plugin->print (plugin, NULL, NULL, "le texte d'entrée a changé");
- else
- plugin->print (plugin, NULL, NULL, "le texte d'entrée n'a pas changé");
- }
- return PLUGIN_RC_OK;
-}
-...
-t_plugin_handler *keyb_handler;
-keyb_handler = plugin->keyboard_handler_add (plugin, &mon_keyb);
-
-
-
-
-
- event_handler_add
-
-
- Prototype :
-
- t_plugin_handler *event_handler_add (t_weechat_plugin
- *plugin, char *evenement, t_plugin_handler_func *fonction,
- char *handler_args, void *handler_pointer)
-
-
-
- Ajoute un gestionnaire d'évènement, appelé dès qu'un évènement se
- produit.
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : évènement (voir le tableau
- ci-dessous)
-
-
-
-
- : fonction appelée
-
-
- Elle a le prototype suivant :
-
- int ma_fonction (t_weechat_plugin *plugin,
- int argc, char **argv,
- char *handler_args, void *handler_pointer)
-
-
-
- Les paramètres passés à la fonction dépendent de l'évènement
- (voir le tableau ci-dessous).
-
-
-
-
- : paramètres passés à la
- fonction appelée
-
-
-
-
- : pointeur passé à la
- fonction appelée
-
-
-
-
-
- Liste des évènements :
-
-
-
-
- Evènement
- Description
- Paramètres
-
-
-
-
- buffer_open
- un tampon a été ouvert
-
- argc = 1, argv = { numéro de tampon }
-
-
-
- buffer_close
- un tampon a été fermé
-
- argc = 1, argv = { numéro de tampon }
-
-
-
- buffer_move
- un tampon a été déplacé
-
- argc = 2, argv = { nouveau numéro de tampon, ancien
- numéro }
-
-
-
-
-
-
-
- Valeur renvoyée : le pointeur vers le nouveau gestionnaire
- d'évènement.
-
-
- Note : la fonction appelée doit renvoyer une des valeurs
- suivantes :
-
-
-
- PLUGIN_RC_KO : la fonction a échoué
-
-
-
-
- PLUGIN_RC_OK : la fonction a réussi
-
-
-
-
-
- Exemple :
-
-int mon_evenement (t_weechat_plugin *plugin, int argc, char **argv,
- char *handler_args, void *handler_pointer)
-{
- plugin->print (plugin, NULL, NULL, "mon_evenement");
- return PLUGIN_RC_OK;
-}
-...
-t_plugin_handler *event_handler;
-event_handler = plugin->event_handler_add (plugin, "buffer_open",
- &mon_evenement);
-
-
-
-
-
- handler_remove
-
-
- Prototype :
-
- void handler_remove (t_weechat_plugin *plugin,
- t_plugin_handler *handler)
-
-
-
- Supprime un gestionnaire de commande ou message.
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : le gestionnaire à supprimer
-
-
-
-
-
- Valeur renvoyée : aucune.
-
-
- Exemple :
- plugin->handler_remove (plugin, mon_handler);
-
-
-
-
- handler_remove_all
-
-
- Prototype :
-
- void handler_remove_all (t_weechat_plugin *plugin)
-
-
-
- Supprime tous les gestionnaires d'une extension.
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
-
- Valeur renvoyée : aucune.
-
-
- Exemple :
- plugin->handler_remove_all (plugin);
-
-
-
-
- modifier_add
-
-
- Prototype :
-
- t_plugin_modifier *modifier_add (t_weechat_plugin *plugin,
- char *type, char *message, t_plugin_modifier_func *fonction,
- char *modifier_args, void *modifier_pointer)
-
-
-
- Ajoute un modifieur de message.
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : type de modifieur :
-
-
-
-
- Type
- Description
-
-
-
-
- irc_in
- appelé pour chaque message IRC reçu
-
-
- irc_user
-
- appelé pour chaque message (ou commande) envoyé par
- l'utilisateur (avant traitement et affichage par
- WeeChat)
-
-
-
- irc_out
-
- appelé pour chaque message sortant juste avant
- envoi au serveur IRC (y compris pour les messages
- envoyés automatiquement et de manière transparente
- par WeeChat)
-
-
-
-
-
-
-
-
-
- : nom du message IRC pour lequel la
- fonction est appelée (utilisé uniquement pour les types
- "irc_in" et "irc_out").
- Pour connaître la liste des messages IRC disponibles, merci
- de consulter les RFCs
- 1459
- et
- 2812.
- La valeur spéciale "*" signifie tous les messages (pas de
- filtre).
-
-
-
-
- : fonction appelée
-
-
- Elle a le prototype suivant :
-
- char *ma_fonction (t_weechat_plugin *plugin,
- int argc, char **argv,
- char *modifier_args, void *modifier_pointer)
-
-
-
- Le paramètre argc vaut 2 et les arguments suivants sont
- passés dans le tableau argv :
-
-
- argv[0] = nom du serveur
-
-
- argv[1] = message
-
-
-
-
-
-
- : paramètres passés à la
- fonction appelée
-
-
-
-
- : pointeur passé à la
- fonction appelée
-
-
-
-
-
- Valeur renvoyée : le pointeur vers le nouveau modifieur de message.
-
-
- Note : la fonction doit retourner une chaîne modifiée, ou NULL si
- elle ne souhaite pas modifier le message.
- Si elle retourne une chaine vide, alors le message est supprimé et
- ne sera pas traité du tout par WeeChat (soyez prudent en supprimant
- des messages !).
- La chaîne renvoyée doit avoir été allouée par malloc() et sera
- libérée (par appel à free()) automatiquement par WeeChat après
- utilisation.
-
-
- Exemple :
-
-char *adder (t_weechat_plugin *plugin, int argc, char **argv,
- char *modifier_args, void *modifier_pointer)
-{
- char *string;
- string = malloc (strlen (argv[1]) + 16);
- strcpy (string, argv[1]);
- strcat (string, "test");
- return string;
-}
-...
-t_plugin_modifier *modifier;
-modifier = plugin->modifier_add (plugin, "irc_in", "privmsg",
- &adder, NULL, NULL);
-
-
-
-
-
- modifier_remove
-
-
- Prototype :
-
- void modifier_remove (t_weechat_plugin *plugin,
- t_plugin_modifier *modifier)
-
-
-
- Supprime un modifieur de message.
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : le modifieur à supprimer
-
-
-
-
-
- Valeur renvoyée : aucune.
-
-
- Exemple :
- plugin->modifier_remove (plugin, mon_modifier);
-
-
-
-
- modifier_remove_all
-
-
- Prototype :
-
- void modifier_remove_all (t_weechat_plugin *plugin)
-
-
-
- Supprime tous les modifieurs d'une extension.
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
-
- Valeur renvoyée : aucune.
-
-
- Exemple :
- plugin->modifier_remove_all (plugin);
-
-
-
-
- exec_command
-
-
- Prototype :
-
- void exec_command (t_weechat_plugin
- *plugin, char *serveur, char *canal, char *commande)
-
-
-
- Execute une commande WeeChat ou envoie un message à un canal.
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : nom interne du serveur où
- exécuter la commande (peut être NULL)
-
-
-
-
- : nom du canal où exécuter la
- commande (peut être NULL)
-
-
-
-
- : la commande à exécuter
-
-
-
-
-
- Valeur renvoyée : aucune.
-
-
- Exemples :
-
-plugin->exec_command (plugin, NULL, NULL, "/help nick");
-plugin->exec_command (plugin, "freenode", "#weechat", "bonjour");
-
-
-
-
-
- get_info
-
-
- Prototype :
-
- char *get_info (t_weechat_plugin *plugin,
- char *info, char *serveur)
-
-
-
- Renvoie une information sur WeeChat ou un canal.
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : nom de l'info à obtenir :
-
-
-
-
- Info
- Description
-
-
-
-
- version
- version de WeeChat
-
-
- nick
- pesudo
-
-
- channel
-
- nom du canal (NULL pour un serveur ou un privé)
-
-
-
- server
- nom du serveur
-
-
- type
-
- type de tampon: 0=standard, 1=DCC,
- 2=données IRC brutes
-
-
-
- away
- drapeau "away"
-
-
- inactivity
-
- nombre de secondes écoulées depuis que la dernière
- touche a été appuyée
-
-
-
- input
-
- contenu de la ligne de commande de la fenêtre
- courante
-
-
-
- input_mask
-
- contenu du masque de couleur de la ligne de
- commande
-
-
-
- input_pos
-
- position du curseur dans la ligne de commande
-
-
-
- weechat_dir
-
- répertoire de base de WeeChat
- (par défaut: ~/.weechat/)
-
-
-
- weechat_libdir
- répertoire "lib" système de WeeChat
-
-
- weechat_sharedir
- répertoire "share" système de WeeChat
-
-
-
-
-
-
-
-
- : nom interne du serveur où
- récupérer l'information (si nécessaire)
-
-
-
-
-
- Valeur renvoyée : l'information recherchée, NULL si non trouvée.
-
-
- Note : le résultat doit être libéré par un appel à la fonction
- "free" après utilisation.
-
-
- Exemples :
-
-char *version = plugin->get_info (plugin, "version", NULL);
-char *nick = plugin->get_info (plugin, "nick", "freenode");
-char *inactivity = plugin->get_info (plugin, "inactivity", NULL);
-
-plugin->print (plugin, NULL, NULL,
- "WeeChat version %s, vous êtes %s sur freenode "
- "(inactif depuis %s secondes)",
- version, nick, inactivity);
-
-if (version)
- free (version);
-if (nick)
- free (nick);
-if (inactivity)
- free (inactivity);
-
-
-
-
-
- get_dcc_info
-
-
- Prototype :
-
- t_plugin_info_dcc *get_dcc_info (t_weechat_plugin *plugin)
-
-
-
- Renvoie la liste des DCC en cours ou terminés.
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
-
- Valeur renvoyée : la liste chaînée des DCC.
-
-
-
-
- Type
- Champ
- Description
-
-
-
-
- char *
- server
- le serveur IRC
-
-
- char *
- channel
- le canal IRC
-
-
- int
- type
-
- le type de DCC :
- 0 = discussion reçue,
- 1 = discussion envoyée,
- 2 = fichier reçu,
- 3 = fichier envoyé
-
-
-
- int
- status
-
- le statut du DCC :
- 0 = en attente,
- 1 = en cours de connexion,
- 2 = actif,
- 3 = terminé,
- 4 = échoué,
- 5 = interrompu par l'utilisateur
-
-
-
- time_t
- start_time
- la date et heure de création du DCC
-
-
- time_t
- start_transfer
- la date et heure de démarrage du transfert
-
-
- unsigned long
- addr
- adresse IP de l'utilisateur distant
-
-
- int
- port
- port utilisé pour le DCC
-
-
- char *
- nick
- pseudo de l'utilisateur distant
-
-
- char *
- filename
- nom de fichier
-
-
- char *
- local_filename
- nom de fichier local
-
-
- int
- filename_suffix
- suffixe si renommage de fichier
-
-
- unsigned long
- size
- taille du fichier
-
-
- unsigned long
- pos
- position actuelle dans le fichier
-
-
- unsigned long
- start_resume
- position de démarrage après une interruption
-
-
- unsigned long
- bytes_per_sec
-
- nombre d'octets transmis par seconde depuis le début
- du transfert
-
-
-
- t_plugin_dcc_info *
- prev_dcc
-
- pointeur vers l'info DCC précédente
-
-
-
- t_plugin_dcc_info *
- next_dcc
-
- pointeur vers l'info DCC suivante
-
-
-
-
-
-
-
- Note : le résultat doit être libéré par un appel à la fonction
- "free_dcc_info" après utilisation.
-
-
- Exemples :
-
-t_plugin_dcc_info *dcc_info = plugin->get_dcc_info (plugin);
-for (ptr_dcc = dcc_info; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
-{
- plugin->print_server (plugin, "DCC type=%d, avec: %s",
- ptr_dcc->type, ptr_dcc->nick);
-}
-if (dcc_info)
- plugin->free_dcc_info (plugin, dcc_info);
-
-
-
-
-
- free_dcc_info
-
-
- Prototype :
-
- void free_dcc_info (t_weechat_plugin *plugin,
- t_plugin_dcc_info *dcc_info)
-
-
-
- Libère la mémoire utilisée par une liste de DCC.
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : pointeur vers la liste DCC
- renvoyée par la fonction "get_dcc_info"
-
-
-
-
-
- Valeur renvoyée : aucune.
-
-
- Exemple :
- plugin->free_dcc_info (plugin, dcc_info);
-
-
-
-
- get_server_info
-
-
- Prototype :
-
- t_plugin_server_info *get_server_info (t_weechat_plugin *plugin)
-
-
-
- Renvoie la liste des serveurs IRC (connectés ou non).
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
-
- Valeur retournée : la liste chaînée des serveurs IRC.
-
-
-
-
- Type
- Champ
- Description
-
-
-
-
- char *
- name
- nom interne du serveur
-
-
- int
- autoconnect
- 1 si auto-connexion au démarrage, 0 sinon
-
-
- int
- autoreconnect
-
- 1 si auto-reconnexion quand déconnecté,
- 0 sinon
-
-
-
- int
- autoreconnect_delay
- délai avant de tenter une reconnexion
-
-
- int
- command_line
-
- 1 si le serveur vient de la ligne de commande
- (donc temporaire), 0 sinon
-
-
-
- char *
- address
- adresse du serveur (nom ou IP)
-
-
- int
- port
- port
-
-
- int
- ipv6
- connexion IPv6
-
-
- int
- ssl
- connexion SSL
-
-
- char *
- password
- mot de passe pour le serveur
-
-
- char *
- nick1
- premier pseudo
-
-
- char *
- nick2
- pseudo alternatif
-
-
- char *
- nick3
- second pseudo alternatif
-
-
- char *
- username
- nom d'utilisateur
-
-
- char *
- real name
- nom réel
-
-
- char *
- command
- commande exécutée une fois connecté
-
-
- int
- command_delay
- délai après exécution de la commande
-
-
- char *
- autojoin
- canaux joints automatiquement
-
-
- int
- autorejoin
-
- 1 si les canaux sont rejoints après un "kick",
- 0 sinon
-
-
-
- char *
- notify_levels
- niveaux de notification des canaux
-
-
- char *
- charset_decode_iso
-
- jeux de caractères de décodage ISO pour les canaux
-
-
-
- char *
- charset_decode_utf
-
- jeux de caractères de décodage UTF pour les canaux
-
-
-
- char *
- charset_encode
-
- jeux de caractères d'encodage pour les canaux
-
-
-
- int
- is_connected
- 1 si connecté au serveur, 0 sinon
-
-
- int
- ssl_connected
- 1 si connecté via SSL, 0 sinon
-
-
- char *
- nick
- pseudo courant
-
-
- int
- is_away
- 1 si absent, 0 sinon
-
-
- time_t
- away_time
-
- date/heure à laquelle l'utilisateur a été marqué absent
-
-
-
- int
- lag
- lag (en millisecondes)
-
-
- t_plugin_server_info *
- prev_server
- pointeur vers les infos du serveur précédent
-
-
- t_plugin_server_info *
- next_server
- pointeur vers les infos du serveur suivant
-
-
-
-
-
-
- Note : le résultat doit être libéré par un appel à la fonction
- "free_server_info" après utilisation.
-
-
- Exemple :
-
-t_plugin_server_info *server_info, *ptr_server_info;
-server_info = plugin->get_server_info (plugin);
-if (server_info)
-{
- for (ptr_server_info = server_info; ptr_server_info;
- ptr_server_info = ptr_server_info->next_server)
- {
- plugin->print (plugin, NULL, NULL,
- "serveur: %s, addresse: %s, port: %d %s",
- ptr_server_info->name,
- ptr_server_info->address,
- ptr_server_info->port,
- (ptr_server_info->is_connected) ? "(connecté)" : "");
- }
- plugin->free_server_info (plugin, server_info);
-}
-
-
-
-
-
- free_server_info
-
-
- Prototype :
-
- void free_server_info (t_weechat_plugin *plugin,
- t_plugin_server_info *server_info)
-
-
-
- Libère la mémoire utilisée par une liste de serveurs.
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : pointeur vers la liste de
- serveurs retournée par la fonction "get_server_info"
-
-
-
-
-
- Valeur renvoyée : aucune.
-
-
- Exemple :
- plugin->free_server_info (plugin, server_info);
-
-
-
-
- get_channel_info
-
-
- Prototype :
-
- t_plugin_channel_info *get_channel_info (t_weechat_plugin *plugin,
- char *serveur)
-
-
-
- Renvoie la liste des canaux IRC pour un serveur.
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : nom interne du serveur
-
-
-
-
-
- Valeur renvoyée : la liste chaînée des canaux IRC du serveur.
-
-
-
-
- Type
- Field
- Description
-
-
-
-
- int
- type
- 0 pour un canal, 1 pour un privé
-
-
- char *
- name
- nom du canal
-
-
- char *
- topic
- titre du canal
-
-
- char *
- modes
- modes du canal
-
-
- int
- limit
- limite d'utilisateurs
-
-
- char *
- key
- clé du canal
-
-
- int
- nicks_count
- nombre de pseudos présents sur le canal
-
-
- t_plugin_channel_info *
- prev_channel
- pointeur vers les infos du canal précédent
-
-
- t_plugin_channel_info *
- next_channel
- pointeur vers les infos du canal suivant
-
-
-
-
-
-
- Note : le résultat doit être libéré par un appel à la fonction
- "free_channel_info" après utilisation.
-
-
- Exemple :
-
-t_plugin_channel_info *channel_info, *ptr_chan_info;
-channel_info = plugin->get_channel_info (plugin, "freenode");
-if (channel_info)
-{
- for (ptr_chan_info = channel_info; ptr_chan_info;
- ptr_chan_info = ptr_chan_info->next_channel)
- {
- plugin->print (plugin, NULL, NULL,
- " %s (type %d)",
- ptr_chan_info->name,
- ptr_chan_info->type);
- }
- plugin->free_channel_info (plugin, channel_info);
-}
-
-
-
-
-
- free_channel_info
-
-
- Prototype :
-
- void free_channel_info (t_weechat_plugin *plugin,
- t_plugin_channel_info *channel_info)
-
-
-
- Libère la mémoire utilisée par une liste de canaux.
-
-
- Arguments:
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : pointeur vers la liste de
- canaux retournée par la fonction "get_channel_info"
-
-
-
-
-
- Valeur renvoyée : aucune.
-
-
- Exemple :
- plugin->free_channel_info (plugin, channel_info);
-
-
-
-
- get_nick_info
-
-
- Prototype :
-
- t_plugin_nick_info *get_nick_info (t_weechat_plugin *plugin,
- char *serveur, char *canal)
-
-
-
- Renvoie la liste des pseudos pour un canal.
-
-
- Arguments:
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : nom interne du serveur
-
-
-
-
- : nom du canal
-
-
-
-
-
- Valeur renvoyée : la liste chaînée des pseudos présents
- sur le canal.
-
-
-
-
- Type
- Champ
- Description
-
-
-
-
- char *
- nick
- pseudo
-
-
- char *
- host
- nom de machine
-
-
- int
- flags
-
- propriétés du pseudo, "ou" binaire entre plusieurs
- valeurs (1 =propriétaire du canal, 2 = administrateur
- du canal, 4 = op, 8 = demi-op, 16 = voix, 32 = absent)
-
-
-
- t_plugin_nick_info *
- prev_nick
- pointeur vers les infos du pseudo précédent
-
-
- t_plugin_nick_info *
- next_nick
- pointeur vers les infos du pseudo précédent
-
-
-
-
-
-
- Note : le résultat doit être libéré par un appel à la fonction
- "free_nick_info" après utilisation.
-
-
- Exemple :
-
-t_plugin_nick_info *nick_info, *ptr_nick_info;
-nick_info = plugin->get_nick_info (plugin, "freenode", "#weechat");
-if (nick_info)
-{
- for (ptr_nick_info = nick_info; ptr_nick_info;
- ptr_nick_info = ptr_nick_info->next_nick)
- {
- plugin->print (plugin, NULL, NULL,
- " %s (flags: %d)",
- ptr_nick_info->nick,
- ptr_nick_info->flags);
- }
- plugin->free_nick_info (plugin, nick_info);
-}
-
-
-
-
-
- free_nick_info
-
-
- Prototype :
-
- void free_nick_info (t_weechat_plugin *plugin,
- t_plugin_nick_info *nick_info)
-
-
-
- Libère la mémoire utilisée par une liste de pseudos.
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : pointeur vers la liste de
- pseudos retournée par la fonction "get_nick_info"
-
-
-
-
-
- Valeur renvoyée : aucune.
-
-
- Exemple :
- plugin->free_nick_info (plugin, nick_info);
-
-
-
-
- get_config
-
-
- Prototype :
-
- char *get_config (t_weechat_plugin *plugin, char *option)
-
-
-
- Renvoie la valeur d'une option de configuration WeeChat.
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : nom de l'option à lire
-
-
-
-
-
- Valeur renvoyée : la valeur de l'option, NULL si non trouvée.
-
-
- Note : le résultat doit être libéré par un appel à la fonction
- "free" après utilisation.
-
-
- Exemples :
-
-char *value1 = plugin->get_config (plugin, "look_set_title");
-char *value2 = plugin->get_config (plugin, "freenode.server_autojoin");
-
-
-
-
-
- set_config
-
-
- Prototype :
-
- int set_config (t_weechat_plugin *plugin,
- char *option, char *valeur)
-
-
-
- Modifie la valeur d'une option de configuration WeeChat.
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : nom de l'option à mettre à jour
-
-
-
-
- : nouvelle valeur pour l'option
-
-
-
-
-
- Valeur renvoyée : 1 si l'option a été modifiée avec succès, 0 si
- une erreur s'est produite.
-
-
- Exemple :
-
-plugin->set_config (plugin, "look_nicklist", "off");
-
-
-
-
-
- get_plugin_config
-
-
- Prototype :
-
- char *get_plugin_config (t_weechat_plugin *plugin, char *option)
-
-
-
- Renvoie la valeur d'une option de l'extension.
- L'option est lue depuis le fichier
- "~/.weechat/plugins.rc" et est
- sous cette forme : "extension.option=valeur"
- (NB : le nom de l'extension est ajouté automatiquement).
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : nom de l'option à lire
-
-
-
-
-
- Valeur renvoyée : la valeur de l'option, NULL si non trouvée.
-
-
- Note : le résultat doit être libéré par un appel à la fonction
- "free" après utilisation.
-
-
- Exemple :
-
-char *value = plugin->get_plugin_config (plugin, "ma_variable");
-
-
-
-
-
- set_plugin_config
-
-
- Prototype :
-
- int set_plugin_config (t_weechat_plugin *plugin,
- char *option, char *valeur)
-
-
-
- Modifie la valeur d'une option de l'extension.
- L'option est écrite dans le fichier
- "~/.weechat/plugins.rc" et est
- sous cette forme : "extension.option=valeur"
- (NB : le nom de l'extension est ajouté automatiquement).
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : nom de l'option à mettre à jour
-
-
-
-
- : nouvelle valeur pour l'option
-
-
-
-
-
- Valeur renvoyée : 1 si l'option a été modifiée avec succès, 0 si
- une erreur s'est produite.
-
-
- Exemple :
-
-plugin->set_plugin_config (plugin, "ma_variable", "valeur");
-
-
-
-
-
- get_irc_color
-
-
- Prototype :
-
- int get_irc_color (t_weechat_plugin *plugin,
- char *nom_couleur)
-
-
-
- Renvoie le numéro d'une couleur IRC avec son nom.
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : nom de la couleur
- Les couleure autorisées sont :
-
-
-
-
- Nom couleur
- Valeur
-
-
-
-
- white
- 0
-
-
- black
- 1
-
-
- blue
- 2
-
-
- green
- 3
-
-
- lightred
- 4
-
-
- red
- 5
-
-
- magenta
- 6
-
-
- brown
- 7
-
-
- yellow
- 8
-
-
- lightgreen
- 9
-
-
- cyan
- 10
-
-
- lightcyan
- 11
-
-
- lightblue
- 12
-
-
- lightmagenta
- 13
-
-
- gray
- 14
-
-
- lightgray
- 15
-
-
-
-
-
-
-
-
-
- Valeur renvoyée : numéro de la couleur IRC, -1 si la couleur
- n'est pas trouvée.
-
-
- Exemple :
-
-int color_blue = plugin->get_irc_color (plugin, "blue"); /* retourne 2 */
-
-
-
-
-
-
-
- get_window_info
-
-
- Prototype :
-
- t_plugin_window_info *get_window_info (t_weechat_plugin *plugin)
-
-
-
- Retourne la liste des fenêtres WeeChat.
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
-
- Valeur renvoyée : liste chaînée des fenêtres WeeChat.
-
-
-
-
- Type
- Champ
- Description
-
-
-
-
- int
- win_x
- position horizontale de la fenêtre
-
-
- int
- win_y
- position verticale de la fenêtre
-
-
- int
- win_width
- largeur de la fenêtre
-
-
- int
- win_height
- hauteur de la fenêtre
-
-
- int
- win_width_pct
- largeur en % (comparé à la fenêtre parent)
-
-
- int
- win_height_pct
- hauteur en % (comparé à la fenêtre parent)
-
-
- int
- num_buffer
- numéro du tampon affiché
-
-
- t_plugin_window_info *
- prev_window
- pointeur vers les infos de la fenêtre précédente
-
-
- t_plugin_window_info *
- next_window
- pointeur vers les infos de la fenêtre suivante
-
-
-
-
-
-
- Note : le résultat doit être libéré par un appel à la fonction
- "free_window_info" après utilisation.
-
-
- Exemple :
-
-t_plugin_window_info *window_info, *ptr_window;
-
-window_info = plugin->get_window_info (plugin);
-if (window_info)
-{
- for (ptr_window = window_info; ptr_window; ptr_window = ptr_window->next_window)
- {
- plugin->print (plugin, NULL, NULL, "--- info fenêtre ---");
- plugin->print (plugin, NULL, NULL, "(%d,%d), size: %dx%d, %%size: %d%%x%d%%",
- ptr_window->win_x, ptr_window->win_y,
- ptr_window->win_width, ptr_window->win_height,
- ptr_window->win_width_pct, ptr_window->win_height_pct);
- plugin->print (plugin, NULL, NULL, "num_buffer: %d", ptr_window->num_buffer);
- }
- plugin->free_window_info (plugin, window_info);
-}
-else
- plugin->print (plugin, NULL, NULL, "pas d'info fenêtre !");
-
-
-
-
-
- free_window_info
-
-
- Prototype :
-
- void free_window_info (t_weechat_plugin *plugin,
- t_plugin_window_info *window_info)
-
-
-
- Libère la mémoire utilisée par une liste de fenêtres.
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : pointeur vers la liste des
- infos fenêtres retournée par la fonction "get_window_info"
-
-
-
-
-
- Valeur renvoyée : aucune.
-
-
- Exemple :
- plugin->free_window_info (plugin, window_info);
-
-
-
-
- get_buffer_info
-
-
- Prototype :
-
- t_plugin_buffer_info *get_buffer_info (t_weechat_plugin *plugin)
-
-
-
- Retourne la liste des tampons WeeChat.
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
-
- Valeur renvoyée : liste chaînée des tampons WeeChat.
-
-
-
-
- Type
- Champ
- Description
-
-
-
-
- int
- type
-
- type de tampon: 0=standard, 1=DCC,
- 2=données IRC brutes
-
-
-
- int
- number
- numéro de tampon
-
-
- int
- num_displayed
- nombre de fenêtres affichant ce tampon
-
-
- char *
- server_name
- nom du serveur pour le tampon (peut être NULL)
-
-
- char *
- channel_name
- nom du canal pout le tampon (peut être NULL)
-
-
- int
- notify_level
- niveau de notification du tampon
-
-
- char *
- log_filename
-
- nom du fichier de log (NULL signifie qu'il n'y a
- pas de log)
-
-
-
- t_plugin_buffer_info *
- prev_buffer
- pointeur vers les infos du tampon précédent
-
-
- t_plugin_buffer_info *
- next_buffer
- pointeur vers les infos du tampon suivant
-
-
-
-
-
-
- Note : le résultat doit être libéré par un appel à la fonction
- "free_buffer_info" après utilisation.
-
-
- Exemple :
-
-t_plugin_buffer_info *buffer_info, *ptr_buffer;
-
-buffer_info = plugin->get_buffer_info (plugin);
-if (buffer_info)
-{
- for (ptr_buffer = buffer_info; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
- {
- plugin->print (plugin, NULL, NULL, "--- info tampon ---");
- plugin->print (plugin, NULL, NULL, "type: %d", ptr_buffer->type);
- plugin->print (plugin, NULL, NULL, "number: %d", ptr_buffer->number);
- plugin->print (plugin, NULL, NULL, "num_displayed: %d", ptr_buffer->num_displayed);
- plugin->print (plugin, NULL, NULL, "server: %s", ptr_buffer->server_name);
- plugin->print (plugin, NULL, NULL, "channel: %s", ptr_buffer->channel_name);
- plugin->print (plugin, NULL, NULL, "notify level: %d", ptr_buffer->notify_level);
- plugin->print (plugin, NULL, NULL, "log filename: %s", ptr_buffer->log_filename);
- }
- plugin->free_buffer_info (plugin, buffer_info);
-}
-else
- plugin->print (plugin, NULL, NULL, "pas d'info tampon !");
-
-
-
-
-
- free_buffer_info
-
-
- Prototype:
-
- void free_buffer_info (t_weechat_plugin *plugin,
- t_plugin_buffer_info *buffer_info)
-
-
-
- Libère la mémoire utilisée par une liste de tampons.
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : pointeur vers la liste des
- infos tampons retournée par la fonction "get_buffer_info"
-
-
-
-
-
- Valeur renvoyée : aucune.
-
-
- Exemple :
- plugin->free_buffer_info (plugin, buffer_info);
-
-
-
-
- get_buffer_data
-
-
- Prototype:
-
- t_plugin_buffer_data *get_buffer_info (t_weechat_plugin *plugin,
- char *serveur, char *canal)
-
-
-
- Renvoie le contenu du tampon.
-
-
- Paramètres :
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : nom interne du serveur
-
-
-
-
- : nom du canal
-
-
-
-
-
- Valeur renvoyée : contenu du tampon (liste chaînée de lignes).
-
-
-
-
- Type
- Champ
- Description
-
-
-
-
- time_t
- date
- date et heure
-
-
- char *
- nick
- pseudo
-
-
- char *
- data
-
- contenu de la ligne (les codes couleur sont
- retirés)
-
-
-
- t_plugin_buffer_line *
- prev_line
- pointeur vers la ligne précédente
-
-
- t_plugin_buffer_line *
- next_line
- pointeur vers la ligne suivante
-
-
-
-
-
-
- Note : le résultat doit être libéré par un appel à la fonction
- "free_buffer_data" après utilisation.
-
-
- Exemple :
-
-t_plugin_buffer_line *buffer_line, *ptr_line;
-char text_time[256];
-
-buffer_line = plugin->get_buffer_data (plugin);
-if (buffer_line)
-{
- for (ptr_line = buffer_line; ptr_line; ptr_line = ptr_line->next_line)
- {
- strftime (text_time, sizeof (text_time), "%x %X", localtime (&(ptr_line->date)));
- plugin->print (plugin, NULL, NULL, "date: %s, pseudo: %s, données: %s",
- text_time, ptr_line->nick, ptr_line->data);
- }
- plugin->free_buffer_data (plugin, buffer_line);
-}
-
-
-
-
-
- free_buffer_data
-
-
- Prototype:
-
- void free_buffer_data (t_weechat_plugin *plugin,
- t_plugin_buffer_line *buffer_line)
-
-
-
- Libère la mémoire utilisée par les lignes d'un tampon.
-
-
- Arguments:
-
-
-
- : pointeur vers la structure
- de l'extension
-
-
-
-
- : pointeur vers la liste des
- lignes du tampon retournée par la fonction "get_buffer_data"
-
-
-
-
-
- Valeur renvoyée : aucune.
-
-
- Exemple :
- plugin->free_buffer_data (plugin, buffer_line);
-
-
-
-
+
diff --git a/doc/fr/dev/plugin_c_api.fr.xml b/doc/fr/dev/plugin_c_api.fr.xml
new file mode 100644
index 000000000..601eeffa1
--- /dev/null
+++ b/doc/fr/dev/plugin_c_api.fr.xml
@@ -0,0 +1,3561 @@
+
+
+
+
+
+ API extension en C
+
+
+ set_charset
+
+
+ Prototype :
+
+ void set_charset (t_weechat_plugin *plugin, char *charset)
+
+
+
+ Change le jeu de caractères de l'extension.
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : nouveau jeu de caractères à
+ utiliser
+
+
+
+
+
+ Exemple :
+ plugin->set_charset (plugin, "ISO-8859-1");
+
+
+
+
+ iconv_to_internal
+
+
+ Prototype :
+
+ void iconv_to_internal (t_weechat_plugin *plugin, char *charset,
+ char *string)
+
+
+
+ Convertit une chaîne de caractères vers le jeu de caractères
+ interne WeeChat (UTF-8).
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : le jeu de caractères de départ
+
+
+
+
+ : la chaîne à convertir
+
+
+
+
+
+ Valeur renvoyée : la chaîne convertie.
+
+
+ Note : le résultat doit être libéré par un appel à la fonction
+ "free" après utilisation.
+
+
+ Exemple :
+ char *str = plugin->iconv_to_internal (plugin, "ISO-8859-1", "chaine iso: é à");
+
+
+
+
+ iconv_from_internal
+
+
+ Prototype :
+
+ void iconv_from_internal (t_weechat_plugin *plugin, char *charset,
+ char *string)
+
+
+
+ Convertit une chaîne de caractères depuis le jeu de caractères
+ interne WeeChat (UTF-8) vers un autre.
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : le jeu de caractères voulu
+
+
+
+
+ : la chaîne à convertir
+
+
+
+
+
+ Valeur renvoyée : la chaîne convertie.
+
+
+ Note : le résultat doit être libéré par un appel à la fonction
+ "free" après utilisation.
+
+
+ Exemple :
+ char *str = plugin->iconv_from_internal (plugin, "ISO-8859-1", "chaine utf-8: é à");
+
+
+
+
+ ascii_strcasecmp
+
+
+ Prototype :
+
+ int ascii_strcasecmp (t_weechat_plugin *plugin,
+ char *chaine1, char *chaine2)
+
+
+
+ Effectue une comparaison entre deux chaînes, sans tenir compte des
+ majuscules/minuscules ni de la locale.
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : la première chaîne à comparer
+
+
+
+
+ : la deuxième chaîne à comparer
+
+
+
+
+
+ Valeur renvoyée : la différence entre les deux chaînes : négatif
+ si chaine1 < chaine2, zéro si chaine1 == chaine2, positif si
+ chaine1 > chaine2
+
+
+ Exemple :
+ if (plugin->ascii_strcasecmp (plugin, "abc", "def") != 0) ...
+
+
+
+
+ ascii_strncasecmp
+
+
+ Prototype :
+
+ int ascii_strncasecmp (t_weechat_plugin *plugin,
+ char *chaine1, char *chaine2, int max)
+
+
+
+ Effectue une comparaison entre deux chaînes, sans tenir compte des
+ majuscules/minuscules ni de la locale, en comparant au plus "max"
+ caractères.
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : la première chaîne à comparer
+
+
+
+
+ : la deuxième chaîne à comparer
+
+
+
+
+ : nombre de caractères max à comparer
+
+
+
+
+
+ Valeur renvoyée : la différence entre les deux chaînes : négatif
+ si chaine1 < chaine2, zéro si chaine1 == chaine 2, positif si
+ chaine1 > chaine2
+
+
+ Exemple :
+ if (plugin->ascii_strncasecmp (plugin, "abc", "def", 2) != 0) ...
+
+
+
+
+ explode_string
+
+
+ Prototype :
+
+ char **explode_string (t_weechat_plugin *plugin, char *chaine,
+ char *separateurs, int num_items_max, int *num_items)
+
+
+
+ Explose une chaîne en plusieurs selon un/des délimiteur(s).
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : la chaîne à exploser
+
+
+
+
+ : les délimiteurs utilisés
+ pour exploser la chaîne
+
+
+
+
+ : nombre maximum de
+ sous-chaînes créées (0 = pas de limite)
+
+
+
+
+ : pointeur vers un entier qui
+ contiendra le nombre de sous-chaînes créées en retour
+
+
+
+
+
+ Valeur renvoyée : un tableau de chaînes, ou NULL si un problème
+ a été rencontré.
+
+
+ Note : le résultat doit être libéré par un appel à la fonction
+ "free_exploded_string" après utilisation.
+
+
+ Exemple :
+
+char **argv;
+int argc;
+argv = plugin->explode_string (plugin, chaine, " ", 0, &argc);
+...
+if (argv != NULL)
+ plugin->free_exploded_string (plugin, argv);
+
+
+
+
+
+ free_exploded_string
+
+
+ Prototype :
+
+ char **free_exploded_string (t_weechat_plugin *plugin,
+ char **chaine)
+
+
+
+ Libère la mémoire utilisée pour une explosion de chaîne.
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : la chaîne explosée par la fonction
+ "explode_string"
+
+
+
+
+
+ Valeur renvoyée : aucune.
+
+
+ Exemple :
+
+char *argv;
+int argc;
+argv = plugin->explode_string (plugin, chaine, " ", 0, &argc);
+...
+if (argv != NULL)
+ plugin->free_exploded_string (plugin, argv);
+
+
+
+
+
+ mkdir_home
+
+
+ Prototype :
+
+ int mkdir_home (t_weechat_plugin *plugin, char *repertoire)
+
+
+
+ Créé un répertoire dans le répertoire de base de WeeChat.
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : répertoire à créer
+
+
+
+
+
+ Valeur renvoyée : 1 si le répertoire a été créé avec succès,
+ 0 si une erreur s'est produite.
+
+
+ Example:
+
+if (!plugin->mkdir_home (plugin, "temp"))
+ plugin->print_server(plugin, "Impossible de créer le répertoire 'temp' dans la base WeeChat.");
+
+
+
+
+
+ exec_on_files
+
+
+ Prototype :
+
+ void exec_on_files (t_weechat_plugin *plugin, char *repertoire,
+ int (*callback)(t_weechat_plugin *, char *))
+
+
+
+ Exécute une fonction sur tous les fichiers d'un répertoire.
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : le répertoire où les fichiers
+ sont recherchés
+
+
+
+
+ : une fonction appelée pour chaque
+ fichier trouvé
+
+
+
+
+
+ Valeur renvoyée : aucune.
+
+
+ Exemple :
+
+int callback (t_weechat_plugin *plugin, char *fichier)
+{
+ plugin->print_server (plugin, "fichier: %s", fichier);
+ return 1;
+}
+...
+plugin->exec_on_files (plugin, "/tmp", &callback);
+
+
+
+
+
+ print
+
+
+ Prototype :
+
+ void print (t_weechat_plugin *plugin,
+ char *serveur, char *canal, char *message, ...)
+
+
+
+ Affiche un message sur un tampon WeeChat, identifié par le serveur
+ et le canal (tous deux pouvant être NULL pour le tampon courant).
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : nom interne du serveur pour
+ trouver le tampon dans lequel afficher (peut être NULL)
+
+
+
+
+ : nom du canal pour trouver le
+ tampon dans lequel afficher (peut être NULL)
+
+
+
+
+ : message à afficher
+
+
+
+
+
+ Pour afficher du texte en couleur, il faut utiliser les codes
+ suivants :
+
+
+
+
+ Code
+ Description
+
+
+
+
+ 0x02
+
+ texte gras
+
+
+
+ 0x03 + "xx"
+
+ couleur du texte "xx"
+ (voir pour les
+ couleurs)
+
+
+
+ 0x03 + "xx,yy"
+
+ couleur du texte "xx"
+ et du fond "yy"
+ (voir pour les
+ couleurs)
+
+
+
+ 0x0F
+
+ désactiver la couleur et tous les attributs
+
+
+
+ 0x12
+
+ vidéo inverse (inversion de la couleur d'écriture et du
+ fond)
+
+
+
+ 0x1F
+
+ texte souligné
+
+
+
+
+
+ NB: le même code (sans le numéro pour 0x03) peut être utilisé pour
+ stopper l'attribut défini.
+
+
+ Valeur renvoyée : aucune.
+
+
+ Exemples :
+
+plugin->print (plugin, NULL, NULL, "hello");
+plugin->print (plugin, NULL, "#weechat", "hello");
+plugin->print (plugin, "freenode", "#weechat", "hello");
+plugin->print (plugin, "freenode", "#weechat", "hello");
+plugin->print (plugin, NULL, NULL,
+ "test: \x02 gras \x0F\x03%02d bleu \x03%02d vert",
+ plugin->get_irc_color (plugin, "blue"),
+ plugin->get_irc_color (plugin, "green"));
+
+
+
+
+
+ print_server
+
+
+ Prototype :
+
+ void print_server (t_weechat_plugin *plugin,
+ char *message, ...)
+
+
+
+ Affiche un message sur le tampon du serveur courant.
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : message à afficher
+
+
+
+
+
+ Pour afficher du texte en couleur, voir
+ .
+
+
+ Valeur renvoyée : aucune.
+
+
+ Exemple : plugin->print_server (plugin, "hello");
+
+
+
+
+ log
+
+
+ Prototype :
+
+ void log (t_weechat_plugin *plugin,
+ char *serveur, char *canal, char *message, ...)
+
+
+
+ Ecrit un message dans le fichier de log pour un serveur ou un
+ canal.
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : nom interne du serveur pour
+ trouver le log du tampon (peut être NULL)
+
+
+
+
+ : nom du canal pour trouver le
+ tampon le log du tampon (peut être NULL)
+
+
+
+
+ : message
+
+
+
+
+
+ Valeur renvoyée : aucune.
+
+
+ Exemple :
+
+plugin->log (plugin, "freenode", "#weechat", "test");
+
+
+
+
+
+ msg_handler_add
+
+
+ Prototype :
+
+ t_plugin_handler *msg_handler_add (t_weechat_plugin
+ *plugin, char *message, t_plugin_handler_func *fonction,
+ char *handler_args, void *handler_pointer)
+
+
+
+ Ajoute un gestionnaire de messages IRC, appelé dès qu'un message
+ IRC est reçu.
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : nom du message IRC pour lequel la
+ fonction est appelée ("*" pour tous les messages).
+ Pour connaître la liste des messages IRC disponibles, merci
+ de consulter les RFCs
+ 1459
+ et
+ 2812.
+ De plus, vous pouvez utiliser un nom spécial, préfixé par
+ "weechat_" pour capturer des évènements spéciaux, comme
+ décrit dans le tableau ci-dessous :
+
+
+
+
+ Nom
+ Description
+
+
+
+
+ weechat_pv
+ message privé reçu
+
+
+ weechat_highlight
+
+ message avec highlight (sur un canal ou en privé)
+
+
+
+ weechat_ctcp
+
+ message CTCP reçu (VERSION, PING, etc...)
+
+
+
+ weechat_dcc
+
+ message DCC reçu (discussion ou fichier)
+
+
+
+
+
+
+
+
+
+ : fonction appelée lorsque le
+ message est reçu
+
+
+ Elle a le prototype suivant :
+
+ int ma_fonction (t_weechat_plugin *plugin,
+ int argc, char **argv,
+ char *handler_args, void *handler_pointer)
+
+
+
+ Le paramètre argc vaut 3 et les arguments suivants sont
+ passés dans le tableau argv :
+
+
+ argv[0] = nom du serveur
+
+
+ argv[1] = message IRC
+
+
+ argv[2] = arguments de la commande
+
+
+
+
+
+
+ : paramètres passés à la
+ fonction appelée
+
+
+
+
+ : pointeur passé à la
+ fonction appelée
+
+
+
+
+
+ Valeur renvoyée : le pointeur vers le nouveau gestionnaire de
+ messages.
+
+
+ Note : la fonction appelée lorsque le message est reçu doit
+ renvoyer une des valeurs suivantes :
+
+
+
+ PLUGIN_RC_KO : la fonction a échoué
+
+
+
+
+ PLUGIN_RC_OK : la fonction a réussi
+
+
+
+
+ PLUGIN_RC_OK_IGNORE_WEECHAT : le message
+ ne sera pas transmis à WeeChat
+
+
+
+
+ PLUGIN_RC_OK_IGNORE_PLUGINS : le message
+ ne sera pas transmis à d'autres extensions
+
+
+
+
+ PLUGIN_RC_OK_IGNORE_ALL : le message
+ ne sera ni transmis à WeeChat ni à d'autres extensions
+
+
+
+
+ PLUGIN_RC_OK_WITH_HIGHLIGHT : la fonction
+ a réussi et provoque un "highlight" sur le message reçu
+
+
+
+
+
+ Exemple :
+
+int msg_kick (t_weechat_plugin *plugin, int argc, char **argv,
+ char *handler_args, void *handler_pointer)
+{
+ plugin->print (plugin, argv[0], NULL, "KICK reçu");
+ return PLUGIN_RC_OK;
+}
+...
+t_plugin_handler *msg_handler;
+msg_handler = plugin->msg_handler_add (plugin, "KICK",
+ &msg_kick, NULL, NULL);
+
+
+
+
+
+ cmd_handler_add
+
+
+ Prototype :
+
+ t_plugin_handler *cmd_handler_add (t_weechat_plugin
+ *plugin, char *commande, char *description, char *arguments,
+ char *arguments_description, char *modele_completion,
+ t_plugin_handler_func *fonction, char *handler_args,
+ void *handler_pointer)
+
+
+
+ Ajoute un gestionnaire de commande WeeChat, appelé dès que
+ l'utilisateur utilise la commande (par exemple /commande).
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : nom de la nouvelle commande,
+ qui peut être une commande déjà existante (attention la
+ commande remplacée ne sera plus disponible jusqu'à ce que
+ l'extension soit déchargée)
+
+
+
+
+ : brève description de la
+ commande (affichée par /help commande)
+
+
+
+
+ : brève description des
+ paramètres de la commande (affichée par /help commande)
+
+
+
+
+ : longue description
+ des paramètres de la commande (affichée par /help commande)
+
+
+
+
+ : modèle pour la
+ complétion sous la forme "abc|%w def|%i"
+ qui signifie "abc" ou une commande WeeChat pour le premier
+ paramètre, et "def" ou une commande IRC pour le deuxième.
+ Une chaîne vide indique à WeeChat de compléter tout
+ paramètre avec un pseudo du canal courant, une valeur NULL
+ ou égale à "-" désactive toute complétion pour tous les
+ paramètres de la commande.
+
+
+ Les codes suivants peuvent être utilisés :
+
+
+
+
+ Code
+ Description
+
+
+
+
+ %-
+ aucune complétion pour le paramètre
+
+
+ %*
+
+ répétition de la dernière complétion pour tous
+ les paramètres suivants (ce code doit être à la
+ fin du modèle de complétion, précédé d'un "|")
+
+
+
+ %a
+ alias
+
+
+ %A
+
+ alias et commandes (WeeChat, IRC et extensions)
+
+
+
+ %c
+ canal courant
+
+
+ %C
+ tous les canaux (y compris les privés)
+
+
+ %f
+ nom de fichier
+
+
+ %h
+ commandes définies par des extensions
+
+
+ %i
+ commandes IRC (envoyées)
+
+
+ %I
+ commandes IRC (reçues)
+
+
+ %k
+ fonctions associées aux touches
+
+
+ %m
+ pseudo sur le serveur courant
+
+
+ %M
+
+ pseudos sur le serveur courant
+ (tous les canaux ouverts)
+
+
+
+ %n
+ pseudos du canal courant
+
+
+ %N
+
+ pseudos et noms de machines du canal
+ courant
+
+
+
+ %o
+ options de configuration
+
+
+ %O
+ options des extensions
+
+
+ %p
+ message de "part" par défaut
+
+
+ %q
+ message de "quit" par défaut
+
+
+ %s
+ nom du serveur courant
+
+
+ %S
+ tous les serveurs
+
+
+ %t
+ titre du canal courant
+
+
+ %v
+ valeur d'une option de configuration
+
+
+ %V
+ valeur d'une option d'extension
+
+
+ %w
+ commandes WeeChat
+
+
+
+
+
+
+
+
+ : fonction appelée lorsque la
+ commande est exécutée.
+
+
+ Elle a le prototype suivant :
+
+ int ma_fonction (t_weechat_plugin *plugin,
+ int argc, char **argv,
+ char *handler_args, void *handler_pointer)
+
+
+
+ Le paramètre argc vaut 3 et les arguments suivants sont
+ passés dans le tableau argv :
+
+
+ argv[0] = nom du serveur
+
+
+ argv[1] = commande
+
+
+ argv[2] = arguments de la commande
+
+
+
+
+
+
+ : paramètres passés à la
+ fonction appelée
+
+
+
+
+ : pointeur passé à la
+ fonction appelée
+
+
+
+
+
+ Valeur renvoyée : le pointeur vers le nouveau gestionnaire de
+ commande.
+
+
+ Note : la fonction appelée lorsque la commande est exécutée doit
+ renvoyer une des valeurs suivantes :
+
+
+
+ PLUGIN_RC_KO : la fonction a échoué
+
+
+
+
+ PLUGIN_RC_OK : la fonction a réussi
+
+
+
+
+
+ Exemple :
+
+int cmd_test (t_weechat_plugin *plugin, int argc, char **argv,
+ char *handler_args, void *handler_pointer)
+{
+ plugin->print (plugin, argv[0], NULL,
+ "commande test, pseudo: %s",
+ (argv[2]) ? argv[2] : "aucun");
+ return PLUGIN_RC_OK;
+}
+...
+t_plugin_handler *cmd_handler;
+cmd_handler = plugin->cmd_handler_add (plugin, "test", "Commande test",
+ "[pesudo]", "pseudo: un pseudo du canal",
+ "%n", &cmd_test, NULL, NULL);
+
+
+
+
+
+ timer_handler_add
+
+
+ Prototype :
+
+ t_plugin_handler *timer_handler_add (t_weechat_plugin
+ *plugin, int intervalle, t_plugin_handler_func *fonction,
+ char *handler_args, void *handler_pointer)
+
+
+
+ Ajoute un gestionnaire de temps, qui appelle périodiquement une
+ fonction.
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : intervalle (en secondes)
+ entre deux appels de la fonction.
+
+
+
+
+ : fonction appelée
+
+
+ Elle a le prototype suivant :
+
+ int ma_fonction (t_weechat_plugin *plugin,
+ int argc, char **argv,
+ char *handler_args, void *handler_pointer)
+
+
+
+ Le paramètre argc vaut 0 et argv vaut NULL.
+
+
+
+
+ : paramètres passés à la
+ fonction appelée
+
+
+
+
+ : pointeur passé à la
+ fonction appelée
+
+
+
+
+
+ Valeur renvoyée : le pointeur vers le nouveau gestionnaire de
+ temps.
+
+
+ Note : la fonction appelée doit renvoyer une des valeurs
+ suivantes :
+
+
+
+ PLUGIN_RC_KO : la fonction a échoué
+
+
+
+
+ PLUGIN_RC_OK : la fonction a réussi
+
+
+
+
+
+ Exemple :
+
+int mon_timer (t_weechat_plugin *plugin, int argc, char **argv,
+ char *handler_args, void *handler_pointer)
+{
+ plugin->print (plugin, NULL, NULL, "mon timer");
+ return PLUGIN_RC_OK;
+}
+...
+t_plugin_handler *timer_handler;
+timer_handler = plugin->timer_handler_add (plugin, 60, &mon_timer);
+
+
+
+
+
+ keyboard_handler_add
+
+
+ Prototype :
+
+ t_plugin_handler *keyboard_handler_add (t_weechat_plugin
+ *plugin, t_plugin_handler_func *fonction,
+ char *handler_args, void *handler_pointer)
+
+
+
+ Ajoute un gestionnaire de clavier, appelé dès qu'une touche est
+ pressée.
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : fonction appelée
+
+
+ Elle a le prototype suivant :
+
+ int ma_fonction (t_weechat_plugin *plugin,
+ int argc, char **argv,
+ char *handler_args, void *handler_pointer)
+
+
+
+ Le paramètre argc vaut 3 et les arguments suivants sont
+ passés dans le tableau argv :
+
+
+
+ argv[0] = touche appuyée (nom d'une fonction interne
+ ou bien '*' suivi du code d'une touche)
+
+
+
+
+ argv[1] = la ligne de commande avant l'action de la
+ touche
+
+
+
+
+ argv[2] = la ligne de commande après l'action de la
+ touche
+
+
+
+
+
+
+
+ : paramètres passés à la
+ fonction appelée
+
+
+
+
+ : pointeur passé à la
+ fonction appelée
+
+
+
+
+
+ Valeur renvoyée : le pointeur vers le nouveau gestionnaire de
+ clavier.
+
+
+ Note : la fonction appelée doit renvoyer une des valeurs
+ suivantes :
+
+
+
+ PLUGIN_RC_KO : la fonction a échoué
+
+
+
+
+ PLUGIN_RC_OK : la fonction a réussi
+
+
+
+
+
+ Exemple :
+
+int mon_keyb (t_weechat_plugin *plugin, int argc, char **argv,
+ char *handler_args, void *handler_pointer)
+{
+ if (argc == 2)
+ {
+ plugin->print (plugin, NULL, NULL, "touche appuyée: %s", argv[0]);
+ if (argv[1] && (argv[1][0] == '1'))
+ plugin->print (plugin, NULL, NULL, "le texte d'entrée a changé");
+ else
+ plugin->print (plugin, NULL, NULL, "le texte d'entrée n'a pas changé");
+ }
+ return PLUGIN_RC_OK;
+}
+...
+t_plugin_handler *keyb_handler;
+keyb_handler = plugin->keyboard_handler_add (plugin, &mon_keyb);
+
+
+
+
+
+ event_handler_add
+
+
+ Prototype :
+
+ t_plugin_handler *event_handler_add (t_weechat_plugin
+ *plugin, char *evenement, t_plugin_handler_func *fonction,
+ char *handler_args, void *handler_pointer)
+
+
+
+ Ajoute un gestionnaire d'évènement, appelé dès qu'un évènement se
+ produit.
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : évènement (voir le tableau
+ ci-dessous)
+
+
+
+
+ : fonction appelée
+
+
+ Elle a le prototype suivant :
+
+ int ma_fonction (t_weechat_plugin *plugin,
+ int argc, char **argv,
+ char *handler_args, void *handler_pointer)
+
+
+
+ Les paramètres passés à la fonction dépendent de l'évènement
+ (voir le tableau ci-dessous).
+
+
+
+
+ : paramètres passés à la
+ fonction appelée
+
+
+
+
+ : pointeur passé à la
+ fonction appelée
+
+
+
+
+
+ Liste des évènements :
+
+
+
+
+ Evènement
+ Description
+ Paramètres
+
+
+
+
+ buffer_open
+ un tampon a été ouvert
+
+ argc = 1, argv = { numéro de tampon }
+
+
+
+ buffer_close
+ un tampon a été fermé
+
+ argc = 1, argv = { numéro de tampon }
+
+
+
+ buffer_move
+ un tampon a été déplacé
+
+ argc = 2, argv = { nouveau numéro de tampon, ancien
+ numéro }
+
+
+
+
+
+
+
+ Valeur renvoyée : le pointeur vers le nouveau gestionnaire
+ d'évènement.
+
+
+ Note : la fonction appelée doit renvoyer une des valeurs
+ suivantes :
+
+
+
+ PLUGIN_RC_KO : la fonction a échoué
+
+
+
+
+ PLUGIN_RC_OK : la fonction a réussi
+
+
+
+
+
+ Exemple :
+
+int mon_evenement (t_weechat_plugin *plugin, int argc, char **argv,
+ char *handler_args, void *handler_pointer)
+{
+ plugin->print (plugin, NULL, NULL, "mon_evenement");
+ return PLUGIN_RC_OK;
+}
+...
+t_plugin_handler *event_handler;
+event_handler = plugin->event_handler_add (plugin, "buffer_open",
+ &mon_evenement);
+
+
+
+
+
+ handler_remove
+
+
+ Prototype :
+
+ void handler_remove (t_weechat_plugin *plugin,
+ t_plugin_handler *handler)
+
+
+
+ Supprime un gestionnaire de commande ou message.
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : le gestionnaire à supprimer
+
+
+
+
+
+ Valeur renvoyée : aucune.
+
+
+ Exemple :
+ plugin->handler_remove (plugin, mon_handler);
+
+
+
+
+ handler_remove_all
+
+
+ Prototype :
+
+ void handler_remove_all (t_weechat_plugin *plugin)
+
+
+
+ Supprime tous les gestionnaires d'une extension.
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+
+ Valeur renvoyée : aucune.
+
+
+ Exemple :
+ plugin->handler_remove_all (plugin);
+
+
+
+
+ modifier_add
+
+
+ Prototype :
+
+ t_plugin_modifier *modifier_add (t_weechat_plugin *plugin,
+ char *type, char *message, t_plugin_modifier_func *fonction,
+ char *modifier_args, void *modifier_pointer)
+
+
+
+ Ajoute un modifieur de message.
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : type de modifieur :
+
+
+
+
+ Type
+ Description
+
+
+
+
+ irc_in
+ appelé pour chaque message IRC reçu
+
+
+ irc_user
+
+ appelé pour chaque message (ou commande) envoyé par
+ l'utilisateur (avant traitement et affichage par
+ WeeChat)
+
+
+
+ irc_out
+
+ appelé pour chaque message sortant juste avant
+ envoi au serveur IRC (y compris pour les messages
+ envoyés automatiquement et de manière transparente
+ par WeeChat)
+
+
+
+
+
+
+
+
+
+ : nom du message IRC pour lequel la
+ fonction est appelée (utilisé uniquement pour les types
+ "irc_in" et "irc_out").
+ Pour connaître la liste des messages IRC disponibles, merci
+ de consulter les RFCs
+ 1459
+ et
+ 2812.
+ La valeur spéciale "*" signifie tous les messages (pas de
+ filtre).
+
+
+
+
+ : fonction appelée
+
+
+ Elle a le prototype suivant :
+
+ char *ma_fonction (t_weechat_plugin *plugin,
+ int argc, char **argv,
+ char *modifier_args, void *modifier_pointer)
+
+
+
+ Le paramètre argc vaut 2 et les arguments suivants sont
+ passés dans le tableau argv :
+
+
+ argv[0] = nom du serveur
+
+
+ argv[1] = message
+
+
+
+
+
+
+ : paramètres passés à la
+ fonction appelée
+
+
+
+
+ : pointeur passé à la
+ fonction appelée
+
+
+
+
+
+ Valeur renvoyée : le pointeur vers le nouveau modifieur de message.
+
+
+ Note : la fonction doit retourner une chaîne modifiée, ou NULL si
+ elle ne souhaite pas modifier le message.
+ Si elle retourne une chaine vide, alors le message est supprimé et
+ ne sera pas traité du tout par WeeChat (soyez prudent en supprimant
+ des messages !).
+ La chaîne renvoyée doit avoir été allouée par malloc() et sera
+ libérée (par appel à free()) automatiquement par WeeChat après
+ utilisation.
+
+
+ Exemple :
+
+char *adder (t_weechat_plugin *plugin, int argc, char **argv,
+ char *modifier_args, void *modifier_pointer)
+{
+ char *string;
+ string = malloc (strlen (argv[1]) + 16);
+ strcpy (string, argv[1]);
+ strcat (string, "test");
+ return string;
+}
+...
+t_plugin_modifier *modifier;
+modifier = plugin->modifier_add (plugin, "irc_in", "privmsg",
+ &adder, NULL, NULL);
+
+
+
+
+
+ modifier_remove
+
+
+ Prototype :
+
+ void modifier_remove (t_weechat_plugin *plugin,
+ t_plugin_modifier *modifier)
+
+
+
+ Supprime un modifieur de message.
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : le modifieur à supprimer
+
+
+
+
+
+ Valeur renvoyée : aucune.
+
+
+ Exemple :
+ plugin->modifier_remove (plugin, mon_modifier);
+
+
+
+
+ modifier_remove_all
+
+
+ Prototype :
+
+ void modifier_remove_all (t_weechat_plugin *plugin)
+
+
+
+ Supprime tous les modifieurs d'une extension.
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+
+ Valeur renvoyée : aucune.
+
+
+ Exemple :
+ plugin->modifier_remove_all (plugin);
+
+
+
+
+ exec_command
+
+
+ Prototype :
+
+ void exec_command (t_weechat_plugin
+ *plugin, char *serveur, char *canal, char *commande)
+
+
+
+ Execute une commande WeeChat ou envoie un message à un canal.
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : nom interne du serveur où
+ exécuter la commande (peut être NULL)
+
+
+
+
+ : nom du canal où exécuter la
+ commande (peut être NULL)
+
+
+
+
+ : la commande à exécuter
+
+
+
+
+
+ Valeur renvoyée : aucune.
+
+
+ Exemples :
+
+plugin->exec_command (plugin, NULL, NULL, "/help nick");
+plugin->exec_command (plugin, "freenode", "#weechat", "bonjour");
+
+
+
+
+
+ get_info
+
+
+ Prototype :
+
+ char *get_info (t_weechat_plugin *plugin,
+ char *info, char *serveur)
+
+
+
+ Renvoie une information sur WeeChat ou un canal.
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : nom de l'info à obtenir :
+
+
+
+
+ Info
+ Description
+
+
+
+
+ version
+ version de WeeChat
+
+
+ nick
+ pesudo
+
+
+ channel
+
+ nom du canal (NULL pour un serveur ou un privé)
+
+
+
+ server
+ nom du serveur
+
+
+ type
+
+ type de tampon: 0=standard, 1=DCC,
+ 2=données IRC brutes
+
+
+
+ away
+ drapeau "away"
+
+
+ inactivity
+
+ nombre de secondes écoulées depuis que la dernière
+ touche a été appuyée
+
+
+
+ input
+
+ contenu de la ligne de commande de la fenêtre
+ courante
+
+
+
+ input_mask
+
+ contenu du masque de couleur de la ligne de
+ commande
+
+
+
+ input_pos
+
+ position du curseur dans la ligne de commande
+
+
+
+ weechat_dir
+
+ répertoire de base de WeeChat
+ (par défaut: ~/.weechat/)
+
+
+
+ weechat_libdir
+ répertoire "lib" système de WeeChat
+
+
+ weechat_sharedir
+ répertoire "share" système de WeeChat
+
+
+
+
+
+
+
+
+ : nom interne du serveur où
+ récupérer l'information (si nécessaire)
+
+
+
+
+
+ Valeur renvoyée : l'information recherchée, NULL si non trouvée.
+
+
+ Note : le résultat doit être libéré par un appel à la fonction
+ "free" après utilisation.
+
+
+ Exemples :
+
+char *version = plugin->get_info (plugin, "version", NULL);
+char *nick = plugin->get_info (plugin, "nick", "freenode");
+char *inactivity = plugin->get_info (plugin, "inactivity", NULL);
+
+plugin->print (plugin, NULL, NULL,
+ "WeeChat version %s, vous êtes %s sur freenode "
+ "(inactif depuis %s secondes)",
+ version, nick, inactivity);
+
+if (version)
+ free (version);
+if (nick)
+ free (nick);
+if (inactivity)
+ free (inactivity);
+
+
+
+
+
+ get_dcc_info
+
+
+ Prototype :
+
+ t_plugin_info_dcc *get_dcc_info (t_weechat_plugin *plugin)
+
+
+
+ Renvoie la liste des DCC en cours ou terminés.
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+
+ Valeur renvoyée : la liste chaînée des DCC.
+
+
+
+
+ Type
+ Champ
+ Description
+
+
+
+
+ char *
+ server
+ le serveur IRC
+
+
+ char *
+ channel
+ le canal IRC
+
+
+ int
+ type
+
+ le type de DCC :
+ 0 = discussion reçue,
+ 1 = discussion envoyée,
+ 2 = fichier reçu,
+ 3 = fichier envoyé
+
+
+
+ int
+ status
+
+ le statut du DCC :
+ 0 = en attente,
+ 1 = en cours de connexion,
+ 2 = actif,
+ 3 = terminé,
+ 4 = échoué,
+ 5 = interrompu par l'utilisateur
+
+
+
+ time_t
+ start_time
+ la date et heure de création du DCC
+
+
+ time_t
+ start_transfer
+ la date et heure de démarrage du transfert
+
+
+ unsigned long
+ addr
+ adresse IP de l'utilisateur distant
+
+
+ int
+ port
+ port utilisé pour le DCC
+
+
+ char *
+ nick
+ pseudo de l'utilisateur distant
+
+
+ char *
+ filename
+ nom de fichier
+
+
+ char *
+ local_filename
+ nom de fichier local
+
+
+ int
+ filename_suffix
+ suffixe si renommage de fichier
+
+
+ unsigned long
+ size
+ taille du fichier
+
+
+ unsigned long
+ pos
+ position actuelle dans le fichier
+
+
+ unsigned long
+ start_resume
+ position de démarrage après une interruption
+
+
+ unsigned long
+ bytes_per_sec
+
+ nombre d'octets transmis par seconde depuis le début
+ du transfert
+
+
+
+ t_plugin_dcc_info *
+ prev_dcc
+
+ pointeur vers l'info DCC précédente
+
+
+
+ t_plugin_dcc_info *
+ next_dcc
+
+ pointeur vers l'info DCC suivante
+
+
+
+
+
+
+
+ Note : le résultat doit être libéré par un appel à la fonction
+ "free_dcc_info" après utilisation.
+
+
+ Exemples :
+
+t_plugin_dcc_info *dcc_info = plugin->get_dcc_info (plugin);
+for (ptr_dcc = dcc_info; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
+{
+ plugin->print_server (plugin, "DCC type=%d, avec: %s",
+ ptr_dcc->type, ptr_dcc->nick);
+}
+if (dcc_info)
+ plugin->free_dcc_info (plugin, dcc_info);
+
+
+
+
+
+ free_dcc_info
+
+
+ Prototype :
+
+ void free_dcc_info (t_weechat_plugin *plugin,
+ t_plugin_dcc_info *dcc_info)
+
+
+
+ Libère la mémoire utilisée par une liste de DCC.
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : pointeur vers la liste DCC
+ renvoyée par la fonction "get_dcc_info"
+
+
+
+
+
+ Valeur renvoyée : aucune.
+
+
+ Exemple :
+ plugin->free_dcc_info (plugin, dcc_info);
+
+
+
+
+ get_server_info
+
+
+ Prototype :
+
+ t_plugin_server_info *get_server_info (t_weechat_plugin *plugin)
+
+
+
+ Renvoie la liste des serveurs IRC (connectés ou non).
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+
+ Valeur retournée : la liste chaînée des serveurs IRC.
+
+
+
+
+ Type
+ Champ
+ Description
+
+
+
+
+ char *
+ name
+ nom interne du serveur
+
+
+ int
+ autoconnect
+ 1 si auto-connexion au démarrage, 0 sinon
+
+
+ int
+ autoreconnect
+
+ 1 si auto-reconnexion quand déconnecté,
+ 0 sinon
+
+
+
+ int
+ autoreconnect_delay
+ délai avant de tenter une reconnexion
+
+
+ int
+ command_line
+
+ 1 si le serveur vient de la ligne de commande
+ (donc temporaire), 0 sinon
+
+
+
+ char *
+ address
+ adresse du serveur (nom ou IP)
+
+
+ int
+ port
+ port
+
+
+ int
+ ipv6
+ connexion IPv6
+
+
+ int
+ ssl
+ connexion SSL
+
+
+ char *
+ password
+ mot de passe pour le serveur
+
+
+ char *
+ nick1
+ premier pseudo
+
+
+ char *
+ nick2
+ pseudo alternatif
+
+
+ char *
+ nick3
+ second pseudo alternatif
+
+
+ char *
+ username
+ nom d'utilisateur
+
+
+ char *
+ real name
+ nom réel
+
+
+ char *
+ command
+ commande exécutée une fois connecté
+
+
+ int
+ command_delay
+ délai après exécution de la commande
+
+
+ char *
+ autojoin
+ canaux joints automatiquement
+
+
+ int
+ autorejoin
+
+ 1 si les canaux sont rejoints après un "kick",
+ 0 sinon
+
+
+
+ char *
+ notify_levels
+ niveaux de notification des canaux
+
+
+ char *
+ charset_decode_iso
+
+ jeux de caractères de décodage ISO pour les canaux
+
+
+
+ char *
+ charset_decode_utf
+
+ jeux de caractères de décodage UTF pour les canaux
+
+
+
+ char *
+ charset_encode
+
+ jeux de caractères d'encodage pour les canaux
+
+
+
+ int
+ is_connected
+ 1 si connecté au serveur, 0 sinon
+
+
+ int
+ ssl_connected
+ 1 si connecté via SSL, 0 sinon
+
+
+ char *
+ nick
+ pseudo courant
+
+
+ int
+ is_away
+ 1 si absent, 0 sinon
+
+
+ time_t
+ away_time
+
+ date/heure à laquelle l'utilisateur a été marqué absent
+
+
+
+ int
+ lag
+ lag (en millisecondes)
+
+
+ t_plugin_server_info *
+ prev_server
+ pointeur vers les infos du serveur précédent
+
+
+ t_plugin_server_info *
+ next_server
+ pointeur vers les infos du serveur suivant
+
+
+
+
+
+
+ Note : le résultat doit être libéré par un appel à la fonction
+ "free_server_info" après utilisation.
+
+
+ Exemple :
+
+t_plugin_server_info *server_info, *ptr_server_info;
+server_info = plugin->get_server_info (plugin);
+if (server_info)
+{
+ for (ptr_server_info = server_info; ptr_server_info;
+ ptr_server_info = ptr_server_info->next_server)
+ {
+ plugin->print (plugin, NULL, NULL,
+ "serveur: %s, addresse: %s, port: %d %s",
+ ptr_server_info->name,
+ ptr_server_info->address,
+ ptr_server_info->port,
+ (ptr_server_info->is_connected) ? "(connecté)" : "");
+ }
+ plugin->free_server_info (plugin, server_info);
+}
+
+
+
+
+
+ free_server_info
+
+
+ Prototype :
+
+ void free_server_info (t_weechat_plugin *plugin,
+ t_plugin_server_info *server_info)
+
+
+
+ Libère la mémoire utilisée par une liste de serveurs.
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : pointeur vers la liste de
+ serveurs retournée par la fonction "get_server_info"
+
+
+
+
+
+ Valeur renvoyée : aucune.
+
+
+ Exemple :
+ plugin->free_server_info (plugin, server_info);
+
+
+
+
+ get_channel_info
+
+
+ Prototype :
+
+ t_plugin_channel_info *get_channel_info (t_weechat_plugin *plugin,
+ char *serveur)
+
+
+
+ Renvoie la liste des canaux IRC pour un serveur.
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : nom interne du serveur
+
+
+
+
+
+ Valeur renvoyée : la liste chaînée des canaux IRC du serveur.
+
+
+
+
+ Type
+ Field
+ Description
+
+
+
+
+ int
+ type
+ 0 pour un canal, 1 pour un privé
+
+
+ char *
+ name
+ nom du canal
+
+
+ char *
+ topic
+ titre du canal
+
+
+ char *
+ modes
+ modes du canal
+
+
+ int
+ limit
+ limite d'utilisateurs
+
+
+ char *
+ key
+ clé du canal
+
+
+ int
+ nicks_count
+ nombre de pseudos présents sur le canal
+
+
+ t_plugin_channel_info *
+ prev_channel
+ pointeur vers les infos du canal précédent
+
+
+ t_plugin_channel_info *
+ next_channel
+ pointeur vers les infos du canal suivant
+
+
+
+
+
+
+ Note : le résultat doit être libéré par un appel à la fonction
+ "free_channel_info" après utilisation.
+
+
+ Exemple :
+
+t_plugin_channel_info *channel_info, *ptr_chan_info;
+channel_info = plugin->get_channel_info (plugin, "freenode");
+if (channel_info)
+{
+ for (ptr_chan_info = channel_info; ptr_chan_info;
+ ptr_chan_info = ptr_chan_info->next_channel)
+ {
+ plugin->print (plugin, NULL, NULL,
+ " %s (type %d)",
+ ptr_chan_info->name,
+ ptr_chan_info->type);
+ }
+ plugin->free_channel_info (plugin, channel_info);
+}
+
+
+
+
+
+ free_channel_info
+
+
+ Prototype :
+
+ void free_channel_info (t_weechat_plugin *plugin,
+ t_plugin_channel_info *channel_info)
+
+
+
+ Libère la mémoire utilisée par une liste de canaux.
+
+
+ Arguments:
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : pointeur vers la liste de
+ canaux retournée par la fonction "get_channel_info"
+
+
+
+
+
+ Valeur renvoyée : aucune.
+
+
+ Exemple :
+ plugin->free_channel_info (plugin, channel_info);
+
+
+
+
+ get_nick_info
+
+
+ Prototype :
+
+ t_plugin_nick_info *get_nick_info (t_weechat_plugin *plugin,
+ char *serveur, char *canal)
+
+
+
+ Renvoie la liste des pseudos pour un canal.
+
+
+ Arguments:
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : nom interne du serveur
+
+
+
+
+ : nom du canal
+
+
+
+
+
+ Valeur renvoyée : la liste chaînée des pseudos présents
+ sur le canal.
+
+
+
+
+ Type
+ Champ
+ Description
+
+
+
+
+ char *
+ nick
+ pseudo
+
+
+ char *
+ host
+ nom de machine
+
+
+ int
+ flags
+
+ propriétés du pseudo, "ou" binaire entre plusieurs
+ valeurs (1 =propriétaire du canal, 2 = administrateur
+ du canal, 4 = op, 8 = demi-op, 16 = voix, 32 = absent)
+
+
+
+ t_plugin_nick_info *
+ prev_nick
+ pointeur vers les infos du pseudo précédent
+
+
+ t_plugin_nick_info *
+ next_nick
+ pointeur vers les infos du pseudo précédent
+
+
+
+
+
+
+ Note : le résultat doit être libéré par un appel à la fonction
+ "free_nick_info" après utilisation.
+
+
+ Exemple :
+
+t_plugin_nick_info *nick_info, *ptr_nick_info;
+nick_info = plugin->get_nick_info (plugin, "freenode", "#weechat");
+if (nick_info)
+{
+ for (ptr_nick_info = nick_info; ptr_nick_info;
+ ptr_nick_info = ptr_nick_info->next_nick)
+ {
+ plugin->print (plugin, NULL, NULL,
+ " %s (flags: %d)",
+ ptr_nick_info->nick,
+ ptr_nick_info->flags);
+ }
+ plugin->free_nick_info (plugin, nick_info);
+}
+
+
+
+
+
+ free_nick_info
+
+
+ Prototype :
+
+ void free_nick_info (t_weechat_plugin *plugin,
+ t_plugin_nick_info *nick_info)
+
+
+
+ Libère la mémoire utilisée par une liste de pseudos.
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : pointeur vers la liste de
+ pseudos retournée par la fonction "get_nick_info"
+
+
+
+
+
+ Valeur renvoyée : aucune.
+
+
+ Exemple :
+ plugin->free_nick_info (plugin, nick_info);
+
+
+
+
+ get_config
+
+
+ Prototype :
+
+ char *get_config (t_weechat_plugin *plugin, char *option)
+
+
+
+ Renvoie la valeur d'une option de configuration WeeChat.
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : nom de l'option à lire
+
+
+
+
+
+ Valeur renvoyée : la valeur de l'option, NULL si non trouvée.
+
+
+ Note : le résultat doit être libéré par un appel à la fonction
+ "free" après utilisation.
+
+
+ Exemples :
+
+char *value1 = plugin->get_config (plugin, "look_set_title");
+char *value2 = plugin->get_config (plugin, "freenode.server_autojoin");
+
+
+
+
+
+ set_config
+
+
+ Prototype :
+
+ int set_config (t_weechat_plugin *plugin,
+ char *option, char *valeur)
+
+
+
+ Modifie la valeur d'une option de configuration WeeChat.
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : nom de l'option à mettre à jour
+
+
+
+
+ : nouvelle valeur pour l'option
+
+
+
+
+
+ Valeur renvoyée : 1 si l'option a été modifiée avec succès, 0 si
+ une erreur s'est produite.
+
+
+ Exemple :
+
+plugin->set_config (plugin, "look_nicklist", "off");
+
+
+
+
+
+ get_plugin_config
+
+
+ Prototype :
+
+ char *get_plugin_config (t_weechat_plugin *plugin, char *option)
+
+
+
+ Renvoie la valeur d'une option de l'extension.
+ L'option est lue depuis le fichier
+ "~/.weechat/plugins.rc" et est
+ sous cette forme : "extension.option=valeur"
+ (NB : le nom de l'extension est ajouté automatiquement).
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : nom de l'option à lire
+
+
+
+
+
+ Valeur renvoyée : la valeur de l'option, NULL si non trouvée.
+
+
+ Note : le résultat doit être libéré par un appel à la fonction
+ "free" après utilisation.
+
+
+ Exemple :
+
+char *value = plugin->get_plugin_config (plugin, "ma_variable");
+
+
+
+
+
+ set_plugin_config
+
+
+ Prototype :
+
+ int set_plugin_config (t_weechat_plugin *plugin,
+ char *option, char *valeur)
+
+
+
+ Modifie la valeur d'une option de l'extension.
+ L'option est écrite dans le fichier
+ "~/.weechat/plugins.rc" et est
+ sous cette forme : "extension.option=valeur"
+ (NB : le nom de l'extension est ajouté automatiquement).
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : nom de l'option à mettre à jour
+
+
+
+
+ : nouvelle valeur pour l'option
+
+
+
+
+
+ Valeur renvoyée : 1 si l'option a été modifiée avec succès, 0 si
+ une erreur s'est produite.
+
+
+ Exemple :
+
+plugin->set_plugin_config (plugin, "ma_variable", "valeur");
+
+
+
+
+
+ get_irc_color
+
+
+ Prototype :
+
+ int get_irc_color (t_weechat_plugin *plugin,
+ char *nom_couleur)
+
+
+
+ Renvoie le numéro d'une couleur IRC avec son nom.
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : nom de la couleur
+ Les couleure autorisées sont :
+
+
+
+
+ Nom couleur
+ Valeur
+
+
+
+
+ white
+ 0
+
+
+ black
+ 1
+
+
+ blue
+ 2
+
+
+ green
+ 3
+
+
+ lightred
+ 4
+
+
+ red
+ 5
+
+
+ magenta
+ 6
+
+
+ brown
+ 7
+
+
+ yellow
+ 8
+
+
+ lightgreen
+ 9
+
+
+ cyan
+ 10
+
+
+ lightcyan
+ 11
+
+
+ lightblue
+ 12
+
+
+ lightmagenta
+ 13
+
+
+ gray
+ 14
+
+
+ lightgray
+ 15
+
+
+
+
+
+
+
+
+
+ Valeur renvoyée : numéro de la couleur IRC, -1 si la couleur
+ n'est pas trouvée.
+
+
+ Exemple :
+
+int color_blue = plugin->get_irc_color (plugin, "blue"); /* retourne 2 */
+
+
+
+
+
+
+
+ get_window_info
+
+
+ Prototype :
+
+ t_plugin_window_info *get_window_info (t_weechat_plugin *plugin)
+
+
+
+ Retourne la liste des fenêtres WeeChat.
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+
+ Valeur renvoyée : liste chaînée des fenêtres WeeChat.
+
+
+
+
+ Type
+ Champ
+ Description
+
+
+
+
+ int
+ win_x
+ position horizontale de la fenêtre
+
+
+ int
+ win_y
+ position verticale de la fenêtre
+
+
+ int
+ win_width
+ largeur de la fenêtre
+
+
+ int
+ win_height
+ hauteur de la fenêtre
+
+
+ int
+ win_width_pct
+ largeur en % (comparé à la fenêtre parent)
+
+
+ int
+ win_height_pct
+ hauteur en % (comparé à la fenêtre parent)
+
+
+ int
+ num_buffer
+ numéro du tampon affiché
+
+
+ t_plugin_window_info *
+ prev_window
+ pointeur vers les infos de la fenêtre précédente
+
+
+ t_plugin_window_info *
+ next_window
+ pointeur vers les infos de la fenêtre suivante
+
+
+
+
+
+
+ Note : le résultat doit être libéré par un appel à la fonction
+ "free_window_info" après utilisation.
+
+
+ Exemple :
+
+t_plugin_window_info *window_info, *ptr_window;
+
+window_info = plugin->get_window_info (plugin);
+if (window_info)
+{
+ for (ptr_window = window_info; ptr_window; ptr_window = ptr_window->next_window)
+ {
+ plugin->print (plugin, NULL, NULL, "--- info fenêtre ---");
+ plugin->print (plugin, NULL, NULL, "(%d,%d), size: %dx%d, %%size: %d%%x%d%%",
+ ptr_window->win_x, ptr_window->win_y,
+ ptr_window->win_width, ptr_window->win_height,
+ ptr_window->win_width_pct, ptr_window->win_height_pct);
+ plugin->print (plugin, NULL, NULL, "num_buffer: %d", ptr_window->num_buffer);
+ }
+ plugin->free_window_info (plugin, window_info);
+}
+else
+ plugin->print (plugin, NULL, NULL, "pas d'info fenêtre !");
+
+
+
+
+
+ free_window_info
+
+
+ Prototype :
+
+ void free_window_info (t_weechat_plugin *plugin,
+ t_plugin_window_info *window_info)
+
+
+
+ Libère la mémoire utilisée par une liste de fenêtres.
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : pointeur vers la liste des
+ infos fenêtres retournée par la fonction "get_window_info"
+
+
+
+
+
+ Valeur renvoyée : aucune.
+
+
+ Exemple :
+ plugin->free_window_info (plugin, window_info);
+
+
+
+
+ get_buffer_info
+
+
+ Prototype :
+
+ t_plugin_buffer_info *get_buffer_info (t_weechat_plugin *plugin)
+
+
+
+ Retourne la liste des tampons WeeChat.
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+
+ Valeur renvoyée : liste chaînée des tampons WeeChat.
+
+
+
+
+ Type
+ Champ
+ Description
+
+
+
+
+ int
+ type
+
+ type de tampon: 0=standard, 1=DCC,
+ 2=données IRC brutes
+
+
+
+ int
+ number
+ numéro de tampon
+
+
+ int
+ num_displayed
+ nombre de fenêtres affichant ce tampon
+
+
+ char *
+ server_name
+ nom du serveur pour le tampon (peut être NULL)
+
+
+ char *
+ channel_name
+ nom du canal pout le tampon (peut être NULL)
+
+
+ int
+ notify_level
+ niveau de notification du tampon
+
+
+ char *
+ log_filename
+
+ nom du fichier de log (NULL signifie qu'il n'y a
+ pas de log)
+
+
+
+ t_plugin_buffer_info *
+ prev_buffer
+ pointeur vers les infos du tampon précédent
+
+
+ t_plugin_buffer_info *
+ next_buffer
+ pointeur vers les infos du tampon suivant
+
+
+
+
+
+
+ Note : le résultat doit être libéré par un appel à la fonction
+ "free_buffer_info" après utilisation.
+
+
+ Exemple :
+
+t_plugin_buffer_info *buffer_info, *ptr_buffer;
+
+buffer_info = plugin->get_buffer_info (plugin);
+if (buffer_info)
+{
+ for (ptr_buffer = buffer_info; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
+ {
+ plugin->print (plugin, NULL, NULL, "--- info tampon ---");
+ plugin->print (plugin, NULL, NULL, "type: %d", ptr_buffer->type);
+ plugin->print (plugin, NULL, NULL, "number: %d", ptr_buffer->number);
+ plugin->print (plugin, NULL, NULL, "num_displayed: %d", ptr_buffer->num_displayed);
+ plugin->print (plugin, NULL, NULL, "server: %s", ptr_buffer->server_name);
+ plugin->print (plugin, NULL, NULL, "channel: %s", ptr_buffer->channel_name);
+ plugin->print (plugin, NULL, NULL, "notify level: %d", ptr_buffer->notify_level);
+ plugin->print (plugin, NULL, NULL, "log filename: %s", ptr_buffer->log_filename);
+ }
+ plugin->free_buffer_info (plugin, buffer_info);
+}
+else
+ plugin->print (plugin, NULL, NULL, "pas d'info tampon !");
+
+
+
+
+
+ free_buffer_info
+
+
+ Prototype:
+
+ void free_buffer_info (t_weechat_plugin *plugin,
+ t_plugin_buffer_info *buffer_info)
+
+
+
+ Libère la mémoire utilisée par une liste de tampons.
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : pointeur vers la liste des
+ infos tampons retournée par la fonction "get_buffer_info"
+
+
+
+
+
+ Valeur renvoyée : aucune.
+
+
+ Exemple :
+ plugin->free_buffer_info (plugin, buffer_info);
+
+
+
+
+ get_buffer_data
+
+
+ Prototype:
+
+ t_plugin_buffer_data *get_buffer_info (t_weechat_plugin *plugin,
+ char *serveur, char *canal)
+
+
+
+ Renvoie le contenu du tampon.
+
+
+ Paramètres :
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : nom interne du serveur
+
+
+
+
+ : nom du canal
+
+
+
+
+
+ Valeur renvoyée : contenu du tampon (liste chaînée de lignes).
+
+
+
+
+ Type
+ Champ
+ Description
+
+
+
+
+ time_t
+ date
+ date et heure
+
+
+ char *
+ nick
+ pseudo
+
+
+ char *
+ data
+
+ contenu de la ligne (les codes couleur sont
+ retirés)
+
+
+
+ t_plugin_buffer_line *
+ prev_line
+ pointeur vers la ligne précédente
+
+
+ t_plugin_buffer_line *
+ next_line
+ pointeur vers la ligne suivante
+
+
+
+
+
+
+ Note : le résultat doit être libéré par un appel à la fonction
+ "free_buffer_data" après utilisation.
+
+
+ Exemple :
+
+t_plugin_buffer_line *buffer_line, *ptr_line;
+char text_time[256];
+
+buffer_line = plugin->get_buffer_data (plugin);
+if (buffer_line)
+{
+ for (ptr_line = buffer_line; ptr_line; ptr_line = ptr_line->next_line)
+ {
+ strftime (text_time, sizeof (text_time), "%x %X", localtime (&(ptr_line->date)));
+ plugin->print (plugin, NULL, NULL, "date: %s, pseudo: %s, données: %s",
+ text_time, ptr_line->nick, ptr_line->data);
+ }
+ plugin->free_buffer_data (plugin, buffer_line);
+}
+
+
+
+
+
+ free_buffer_data
+
+
+ Prototype:
+
+ void free_buffer_data (t_weechat_plugin *plugin,
+ t_plugin_buffer_line *buffer_line)
+
+
+
+ Libère la mémoire utilisée par les lignes d'un tampon.
+
+
+ Arguments:
+
+
+
+ : pointeur vers la structure
+ de l'extension
+
+
+
+
+ : pointeur vers la liste des
+ lignes du tampon retournée par la fonction "get_buffer_data"
+
+
+
+
+
+ Valeur renvoyée : aucune.
+
+
+ Exemple :
+ plugin->free_buffer_data (plugin, buffer_line);
+
+
+
+
diff --git a/doc/fr/dev/plugin_scripts.fr.xml b/doc/fr/dev/plugin_script_api.fr.xml
similarity index 100%
rename from doc/fr/dev/plugin_scripts.fr.xml
rename to doc/fr/dev/plugin_script_api.fr.xml
diff --git a/doc/fr/dev/plugins.fr.xml b/doc/fr/dev/plugins.fr.xml
index 024bfcf69..5407fb4d0 100644
--- a/doc/fr/dev/plugins.fr.xml
+++ b/doc/fr/dev/plugins.fr.xml
@@ -132,8 +132,6 @@ along with this program. If not, see .
-
-
Compiler l'extension
@@ -243,14 +241,4 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
- &plugin_irc.fr.xml;
-
-
-
- &plugin_fifo.fr.xml;
-
-
-
- &plugin_xfer.fr.xml;
-
diff --git a/doc/fr/dev/weechat_dev.fr.xml b/doc/fr/dev/weechat_dev.fr.xml
index 71df8d88e..4ebcbfcc4 100644
--- a/doc/fr/dev/weechat_dev.fr.xml
+++ b/doc/fr/dev/weechat_dev.fr.xml
@@ -30,11 +30,12 @@ along with this program. If not, see .
%include_autogen.xml;
-
-
-
-
-
+
+
+
+
+
+
]>
@@ -95,7 +96,9 @@ along with this program. If not, see .
&intro.fr.xml;
-
+ &plugins.fr.xml;
+
+ &plugin_api.fr.xml;
&authors.fr.xml;
diff --git a/doc/weechat-doc.css b/doc/weechat-doc.css
index da1ab6844..846f6dd6d 100644
--- a/doc/weechat-doc.css
+++ b/doc/weechat-doc.css
@@ -79,6 +79,20 @@ a:hover {
font-size: 11px;
}
+.note {
+ border: dashed 1px #CCCCCC;
+ background-color: #FFFFFF;
+ margin: 0;
+ padding: 6px 6px 0 6px;
+}
+
+.note h3 {
+ border: none;
+ background-color: #FFFFFF;
+ margin: 0;
+ padding: 0;
+}
+
.programlisting {
font-size: 11px;
}
diff --git a/doc/weechat-html-one.xsl.in b/doc/weechat-html-one.xsl.in
index ad13bd2e8..da2884725 100644
--- a/doc/weechat-html-one.xsl.in
+++ b/doc/weechat-html-one.xsl.in
@@ -9,7 +9,7 @@
-
+
weechat-doc.css
diff --git a/doc/weechat-html.xsl.in b/doc/weechat-html.xsl.in
index f0b7bef71..855807a37 100644
--- a/doc/weechat-html.xsl.in
+++ b/doc/weechat-html.xsl.in
@@ -9,7 +9,7 @@
-
+
weechat-doc.css
diff --git a/src/core/wee-config-file.c b/src/core/wee-config-file.c
index e18a22440..e478e8114 100644
--- a/src/core/wee-config-file.c
+++ b/src/core/wee-config-file.c
@@ -804,14 +804,10 @@ config_file_string_to_boolean (const char *text)
/*
* config_file_option_reset: set default value for an option
- * return one of these values:
- * WEECHAT_CONFIG_OPTION_SET_OK_CHANGED
- * WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE
- * WEECHAT_CONFIG_OPTION_SET_ERROR
- *
- * 2 if ok (value changed)
- * 1 if ok (value is the same)
- * 0 if failed
+ * return one of these values:
+ * WEECHAT_CONFIG_OPTION_SET_OK_CHANGED
+ * WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE
+ * WEECHAT_CONFIG_OPTION_SET_ERROR
*/
int
@@ -1447,16 +1443,13 @@ config_file_option_string (struct t_config_option *option)
* config_file_option_color: return color value of an option
*/
-int
+char *
config_file_option_color (struct t_config_option *option)
{
if (!option)
- return 0;
-
- if (option->type == CONFIG_OPTION_TYPE_COLOR)
- return CONFIG_COLOR(option);
- else
- return 0;
+ return NULL;
+
+ return gui_color_get_name (CONFIG_COLOR(option));
}
/*
diff --git a/src/core/wee-config-file.h b/src/core/wee-config-file.h
index ba1c647e5..f8376a669 100644
--- a/src/core/wee-config-file.h
+++ b/src/core/wee-config-file.h
@@ -229,7 +229,7 @@ extern int config_file_option_unset_with_string (const char *option_name);
extern int config_file_option_boolean (struct t_config_option *option);
extern int config_file_option_integer (struct t_config_option *option);
extern char *config_file_option_string (struct t_config_option *option);
-extern int config_file_option_color (struct t_config_option *option);
+extern char *config_file_option_color (struct t_config_option *option);
extern void config_file_write_line (struct t_config_file *config_file,
const char *option_name, const char *value, ...);
diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c
index 1c5767727..ce608643a 100644
--- a/src/plugins/scripts/lua/weechat-lua-api.c
+++ b/src/plugins/scripts/lua/weechat-lua-api.c
@@ -1886,7 +1886,8 @@ static int
weechat_lua_api_config_color (lua_State *L)
{
const char *option;
- int n, value;
+ char *result;
+ int n;
/* make C compiler happy */
(void) L;
@@ -1909,9 +1910,9 @@ weechat_lua_api_config_color (lua_State *L)
option = lua_tostring (lua_current_interpreter, -1);
- value = weechat_config_color (script_str2ptr (option));
+ result = weechat_config_color (script_str2ptr (option));
- LUA_RETURN_INT(value);
+ LUA_RETURN_STRING(result);
}
/*
diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c
index 68cdcf6a6..3c5fc77cb 100644
--- a/src/plugins/scripts/perl/weechat-perl-api.c
+++ b/src/plugins/scripts/perl/weechat-perl-api.c
@@ -1583,7 +1583,7 @@ static XS (XS_weechat_api_config_string)
static XS (XS_weechat_api_config_color)
{
- int value;
+ char *result;
dXSARGS;
/* make C compiler happy */
@@ -1601,9 +1601,9 @@ static XS (XS_weechat_api_config_color)
PERL_RETURN_INT(0);
}
- value = weechat_config_color (script_str2ptr (SvPV (ST (0), PL_na))); /* option */
+ result = weechat_config_color (script_str2ptr (SvPV (ST (0), PL_na))); /* option */
- PERL_RETURN_INT(value);
+ PERL_RETURN_STRING(result);
}
/*
diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c
index 4b60ea0d7..ee989cf6e 100644
--- a/src/plugins/scripts/python/weechat-python-api.c
+++ b/src/plugins/scripts/python/weechat-python-api.c
@@ -1672,8 +1672,7 @@ weechat_python_api_config_string (PyObject *self, PyObject *args)
static PyObject *
weechat_python_api_config_color (PyObject *self, PyObject *args)
{
- char *option;
- int value;
+ char *option, *result;
/* make C compiler happy */
(void) self;
@@ -1692,9 +1691,9 @@ weechat_python_api_config_color (PyObject *self, PyObject *args)
PYTHON_RETURN_INT(0);
}
- value = weechat_config_color (script_str2ptr (option));
+ result = weechat_config_color (script_str2ptr (option));
- PYTHON_RETURN_INT(value);
+ PYTHON_RETURN_STRING(result);
}
/*
diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c
index 7758467ef..55cc44a6e 100644
--- a/src/plugins/scripts/ruby/weechat-ruby-api.c
+++ b/src/plugins/scripts/ruby/weechat-ruby-api.c
@@ -1924,8 +1924,7 @@ weechat_ruby_api_config_string (VALUE class, VALUE option)
static VALUE
weechat_ruby_api_config_color (VALUE class, VALUE option)
{
- char *c_option;
- int value;
+ char *c_option, *result;
/* make C compiler happy */
(void) class;
@@ -1948,9 +1947,9 @@ weechat_ruby_api_config_color (VALUE class, VALUE option)
c_option = STR2CSTR (option);
- value = weechat_config_color (script_str2ptr (c_option));
+ result = weechat_config_color (script_str2ptr (c_option));
- RUBY_RETURN_INT(value);
+ RUBY_RETURN_STRING(result);
}
/*
diff --git a/src/plugins/scripts/tcl/weechat-tcl-api.c b/src/plugins/scripts/tcl/weechat-tcl-api.c
index 1eae1ae3e..7c0f4da6c 100644
--- a/src/plugins/scripts/tcl/weechat-tcl-api.c
+++ b/src/plugins/scripts/tcl/weechat-tcl-api.c
@@ -1855,7 +1855,8 @@ weechat_tcl_api_config_color (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *objp;
- int result, i;
+ char *result;
+ int i;
/* make C compiler happy */
(void) clientData;
@@ -1874,7 +1875,7 @@ weechat_tcl_api_config_color (ClientData clientData, Tcl_Interp *interp,
result = weechat_config_color (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */
- TCL_RETURN_INT(result);
+ TCL_RETURN_STRING(result);
}
/*
diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h
index 9dafd4427..9a1f8c481 100644
--- a/src/plugins/weechat-plugin.h
+++ b/src/plugins/weechat-plugin.h
@@ -184,7 +184,7 @@ struct t_weechat_plugin
long (*timeval_diff) (struct timeval *tv1, struct timeval *tv2);
void (*timeval_add) (struct timeval *tv, long interval);
- /* sorted list */
+ /* sorted lists */
struct t_weelist *(*list_new) ();
struct t_weelist_item *(*list_add) (struct t_weelist *weelist,
const char *data,
@@ -244,10 +244,12 @@ struct t_weechat_plugin
const char *section_name);
struct t_config_option *(*config_new_option) (struct t_config_file *config_file,
struct t_config_section *section,
- const char *name, const char *type,
+ const char *name,
+ const char *type,
const char *description,
const char *string_values,
- int min, int max,
+ int min,
+ int max,
const char *default_value,
const char *value,
int (*callback_check_value)(void *data,
@@ -286,7 +288,7 @@ struct t_weechat_plugin
int (*config_boolean) (struct t_config_option *option);
int (*config_integer) (struct t_config_option *option);
char *(*config_string) (struct t_config_option *option);
- int (*config_color) (struct t_config_option *option);
+ char *(*config_color) (struct t_config_option *option);
void (*config_write_line) (struct t_config_file *config_file,
const char *option_name,
const char *value, ...);
@@ -826,8 +828,6 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
#define weechat_printf(__buffer, __message, __argz...) \
weechat_plugin->printf_date_tags(__buffer, 0, NULL, __message, \
##__argz)
-#define weechat_printf_y(__buffer, __y, __message, __argz...) \
- weechat_plugin->printf_y(__buffer, __y, __message, ##__argz)
#define weechat_printf_date(__buffer, __date, __message, __argz...) \
weechat_plugin->printf_date_tags(__buffer, __date, NULL, \
__message, ##__argz)
@@ -838,6 +838,8 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
__argz...) \
weechat_plugin->printf_date_tags(__buffer, __date, __tags, \
__message, ##__argz)
+#define weechat_printf_y(__buffer, __y, __message, __argz...) \
+ weechat_plugin->printf_y(__buffer, __y, __message, ##__argz)
#define weechat_log_printf(__message, __argz...) \
weechat_plugin->log_printf(__message, ##__argz)