mirror of
https://github.com/weechat/weechat.git
synced 2026-06-15 15:44:47 +02:00
Compare commits
78 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e0c6451b91 | |||
| 29e879326d | |||
| e995453b9a | |||
| bad4bd0bef | |||
| 0872e77872 | |||
| 41b7aa0f93 | |||
| a4bf839a30 | |||
| 1ff61b1745 | |||
| 2d5e1474e3 | |||
| 57477f9da9 | |||
| 64bcd25692 | |||
| cd3f62d37e | |||
| 17989f8d71 | |||
| b498062fde | |||
| 2096354ea8 | |||
| 1daa5061a9 | |||
| 926932a20f | |||
| 6323e55ab4 | |||
| 0b6a91837c | |||
| c988f0c473 | |||
| 7f0e0b5eea | |||
| 25bfda26e9 | |||
| a584ef4261 | |||
| 00935961e8 | |||
| e12a2c985c | |||
| 9a81c27e7d | |||
| 0f0f7511d2 | |||
| aa149dcfbc | |||
| 4d64128ef2 | |||
| 7d5ea81f93 | |||
| 063744ef7d | |||
| cfd2f57dd1 | |||
| 8d60035951 | |||
| ff2fdc14b7 | |||
| 8c6fa998f8 | |||
| 600fe4deb3 | |||
| 7b9ef6b56e | |||
| 00dd81761f | |||
| 85db677423 | |||
| 70ebdc9808 | |||
| f8e31fa38f | |||
| 018b440004 | |||
| f1fdc469c4 | |||
| 47db86b66a | |||
| 2ca6c6a3f1 | |||
| 158d2c9934 | |||
| 7758f02992 | |||
| fef85af5cc | |||
| 3fb1affd95 | |||
| f5731322da | |||
| 1dc994e5f6 | |||
| 429167f032 | |||
| aba6e1257d | |||
| 6d01968259 | |||
| fddd0416b9 | |||
| 8e436c58cd | |||
| 4713f94602 | |||
| ef43b3e013 | |||
| 0e113ded09 | |||
| cd75488d0d | |||
| dc80d87b0e | |||
| 0213633fb8 | |||
| fa833455ae | |||
| 749fae7a75 | |||
| e99915e427 | |||
| 22d0d47d2d | |||
| 0af26a3fb5 | |||
| 6dacffe946 | |||
| 3409d9a7e7 | |||
| c14e090638 | |||
| 1b348cf8ad | |||
| 66161f5249 | |||
| a1bbfb0129 | |||
| 428127cb71 | |||
| 029e539aba | |||
| 53acc07eb1 | |||
| bbe2f9093c | |||
| 09efc5333f |
@@ -1,9 +1,52 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2007-01-06
|
||||
ChangeLog - 2007-03-29
|
||||
|
||||
|
||||
Version 0.2.4 (2007-03-29):
|
||||
* fixed color bug with IRC messages displayed by plugins (bug #19442)
|
||||
* fixed topic charset, now using channel charset if defined (bug #19386)
|
||||
* renamed log file for DCC chat (now <server>.dcc.<nick>.weechatlog)
|
||||
* fixed crash when closing a pv if a DCC chat is open on same nick
|
||||
(bug #19147)
|
||||
* fixed bug with channel topic after reconnection (not erased) (bug #19384)
|
||||
* added current buffer in hotlist when scrolling up in buffer (task #6664)
|
||||
* fixed bug with explode_string / free_exploded_string when max_items > 0
|
||||
* added new key (ctrl-R) for interactive and incremental search in buffer
|
||||
history (task #6628)
|
||||
* fixed /topic completion when no topic set on current channel (bug #19322)
|
||||
* improved password hiding, code cleanup (bug #19229)
|
||||
* added new return code in plugin API to force highlight (for message
|
||||
handlers only)
|
||||
* fixed bug with server buffer when "look_one_server_buffer" is ON and
|
||||
server buffer is moved to any number > 1 (bug #19219)
|
||||
* fixed /help command: displays plugin help for redefined commands
|
||||
(bug #19166)
|
||||
* prefix '/' disabled in commands (patch #5769)
|
||||
* fixed completion of redefined commands removed by plugins (bug #19176)
|
||||
* fixed memory leaks in perl and python plugins (bug #19163)
|
||||
* added "call" option to /key command, added new key function "insert" to
|
||||
insert text on command line (task #6468)
|
||||
* fixed permissions on "dcc" and "logs" directories (bug #18978)
|
||||
* added event handler to plugin API
|
||||
* added scots quickstart guide
|
||||
* added numeric argument for /clear command (buffer number) (patch #5372)
|
||||
* fixed crash when /away command is issued with no server connection
|
||||
(bug #18839)
|
||||
* fixed crash when closing a buffer opened on many windows
|
||||
* fixed freeze with SSL server when disconnecting after connection loss
|
||||
(bug #18735)
|
||||
|
||||
Version 0.2.3 (2007-01-10):
|
||||
* fixed display bugs with nicklist at top/bottom when look_nicklist_separator
|
||||
is OFF (bug #18737)
|
||||
* fixed iconv problem, causing truncated words when using iso locale
|
||||
* fixed topic scroll when topic has multi-bytes chars
|
||||
* fixed compilation problem with iconv under FreeBSD
|
||||
* fixed bugs with charset: now decodes/encodes nicks and channels in IRC
|
||||
messages (bug #18716)
|
||||
|
||||
Version 0.2.2 (2007-01-06):
|
||||
* fixed bug with status bar (missing refresh) when closing a buffer
|
||||
* fixed bug with use of first buffer for a channel if not connected
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
WeeChat FAQ, 2007-01-06
|
||||
WeeChat FAQ, 2007-03-29
|
||||
=======================
|
||||
|
||||
Intended audience:
|
||||
@@ -87,10 +87,16 @@ A: A window is used when you split screen vertically or horizontally.
|
||||
================================================================================
|
||||
Q: I don't see some chars with accents, what can I do?
|
||||
|
||||
A: You have to setup charset used for decoding (ISO and UTF), encoding, and
|
||||
internal WeeChat charset.
|
||||
Internal charset should be empty value, except if WeeChat failed to
|
||||
detect your locale.
|
||||
A: For versions < 0.2.3, please upgrade to last stable version.
|
||||
For versions >= 0.2.3 :
|
||||
- check that weechat-curses is linked to libncursesw (warning: needed
|
||||
on most distributions but not all) :
|
||||
ldd /path/to/weechat-curses
|
||||
- check charset line (on server buffer), you should see ISO-XXXXXX or
|
||||
UTF-8 for terminal charset. If you see ANSI_X3.4-1968 or other values,
|
||||
probably your locale is wrong.
|
||||
- setup global decode value, for example:
|
||||
/setp charset.global.decode = ISO-8859-15
|
||||
|
||||
|
||||
2.5
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
WeeChat FAQ, 2007-01-06
|
||||
WeeChat FAQ, 2007-03-29
|
||||
=======================
|
||||
|
||||
Public concerné :
|
||||
@@ -94,10 +94,17 @@ R: Une fen
|
||||
================================================================================
|
||||
Q: Je ne vois pas bien certains accents dans WeeChat, que faire ?
|
||||
|
||||
R: Il faut configurer le charset utilisé pour le décodage (ISO et UTF),
|
||||
l'encodage ainsi que le charset interne à WeeChat.
|
||||
Le charset interne à WeeChat doit être une valeur vide, sauf si WeeChat
|
||||
n'arrive pas à déterminer votre locale.
|
||||
R: Pour les versions < 0.2.3, merci d'installer la dernière version stable.
|
||||
Pour les versions >= 0.2.3 :
|
||||
- vérifiez que weechat-curses est lié avec libncursesw (attention:
|
||||
nécessaire sur beaucoup de distributions, mais pas toutes) :
|
||||
ldd /chemin/vers/weechat-curses
|
||||
- vérifiez la ligne charset (sur le tampon serveur), vous devriez voir
|
||||
ISO-XXXXXX ou UTF-8 pour le charset du terminal. Si vous voyez
|
||||
ANSI_X3.4-1968 ou d'autres valeurs, votre locale est probablement
|
||||
erronée.
|
||||
- affectez la valeur pour le décodage global, par exemple :
|
||||
/setp charset.global.decode = ISO-8859-15
|
||||
|
||||
|
||||
2.5
|
||||
|
||||
@@ -1,6 +1,17 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
* FlashCode, 2007-03-29
|
||||
|
||||
WeeChat 0.2.4 released.
|
||||
|
||||
* FlashCode, 2007-01-10
|
||||
|
||||
WeeChat 0.2.3 released.
|
||||
|
||||
This version fixes several major bugs of version 0.2.2.
|
||||
All users of version 0.2.2 should upgrade to this version.
|
||||
|
||||
* FlashCode, 2007-01-06
|
||||
|
||||
WeeChat 0.2.2 released.
|
||||
|
||||
+3
-2
@@ -19,10 +19,10 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.56)
|
||||
AC_INIT(WeeChat, 0.2.2, flashcode@flashtux.org)
|
||||
AC_INIT(WeeChat, 0.2.4, flashcode@flashtux.org)
|
||||
AC_CONFIG_SRCDIR([src/common/weechat.c])
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_INIT_AUTOMAKE([weechat], [0.2.2])
|
||||
AM_INIT_AUTOMAKE([weechat], [0.2.4])
|
||||
|
||||
# Checks for programs
|
||||
AC_PROG_CC
|
||||
@@ -795,6 +795,7 @@ AC_OUTPUT([Makefile
|
||||
doc/ru/Makefile
|
||||
doc/pl/Makefile
|
||||
doc/cs/Makefile
|
||||
doc/sco/Makefile
|
||||
src/Makefile
|
||||
src/common/Makefile
|
||||
src/irc/Makefile
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
SUBDIRS = . en fr de ru pl cs
|
||||
SUBDIRS = . en fr de ru pl cs sco
|
||||
|
||||
man_MANS = weechat-curses.1
|
||||
|
||||
|
||||
+2
-2
@@ -304,7 +304,7 @@
|
||||
<entry>Farbe</entry>
|
||||
<entry>Curses- oder Gtk-Farben</entry>
|
||||
<entry>'lightmagenta'</entry>
|
||||
<entry>Color for '+' when scrolling topic</entry>
|
||||
<entry>Farbe des '+' beim Scrolling des Topics</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>col_title_bg</option></entry>
|
||||
@@ -906,7 +906,7 @@
|
||||
<entry>Ganzzahl</entry>
|
||||
<entry>zwischen 0 und 5</entry>
|
||||
<entry>2</entry>
|
||||
<entry>Anti-flood: # seconds between two user messages (0 = no anti-flood)</entry>
|
||||
<entry>Anti-flood: # Sekunden zwischen zwei Benutzernachrichten (0 = kein anti-flood)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>irc_fifo_pipe</option></entry>
|
||||
|
||||
@@ -119,11 +119,11 @@
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>scroll_topic_left</literal></entry>
|
||||
<entry>scroll left topic</entry>
|
||||
<entry>Topic nach links scrollen</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>scroll_topic_right</literal></entry>
|
||||
<entry>scroll right topic</entry>
|
||||
<entry>Topic nach rechts scrollen</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>nick_beginning</literal></entry>
|
||||
@@ -197,3 +197,11 @@
|
||||
<entry><literal>grab_key</literal></entry>
|
||||
<entry>Tastencode ermitteln und einfügen</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>insert</literal></entry>
|
||||
<entry>füge eine Zeichenkette in der Befehlszeile ein</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>search_text</literal></entry>
|
||||
<entry>suche Text im Pufferverlauf</entry>
|
||||
</row>
|
||||
|
||||
+308
-7
@@ -36,7 +36,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
<bookinfo>
|
||||
|
||||
<title>WeeChat 0.2.2 - User guide</title>
|
||||
<title>WeeChat 0.2.4 - User guide</title>
|
||||
<subtitle>Schneller, leichter und erweiterbarer IRC Client</subtitle>
|
||||
|
||||
<author>
|
||||
@@ -48,7 +48,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
&date.xml;
|
||||
|
||||
<copyright>
|
||||
<year>2006</year>
|
||||
<year>2007</year>
|
||||
<holder>Sébastien Helleu</holder>
|
||||
</copyright>
|
||||
|
||||
@@ -512,6 +512,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Fenster neu aufbauen
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Strg + R</entry>
|
||||
<entry>
|
||||
Suche nach Text im Pufferverlauf
|
||||
(zwei Mal: suche nach dem genauen Text)
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Strg + T</entry>
|
||||
<entry>
|
||||
@@ -565,12 +572,14 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
<entry>Eingabe / Strg + J / Strg + M</entry>
|
||||
<entry>
|
||||
Führe ein Kommando aus oder sende eine Nachricht
|
||||
(im Suchmodus: Suche anhalten)
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Hoch / Runter</entry>
|
||||
<entry>
|
||||
Rufe das letzte Kommando/die letzte Nachricht wieder auf
|
||||
(im Suchmodus: suche rückwärts/vorwärts)
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
@@ -705,7 +714,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
<row>
|
||||
<entry>Alt + J dann Alt + X</entry>
|
||||
<entry>
|
||||
Schalte in den ersten Channel des nächsten Puffers
|
||||
Schalte in den ersten Channel des nächsten Servers
|
||||
(oder in den Server-Puffer wenn keine Channel offen ist)
|
||||
</entry>
|
||||
</row>
|
||||
@@ -2047,6 +2056,13 @@ plugin->log (plugin, "freenode", "#weechat", "test");
|
||||
Plugins weitergegeben
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>PLUGIN_RC_OK_WITH_HIGHLIGHT</literal>: Funktion
|
||||
erfolgreich vervollständigt und eine Hervorhebung bei den
|
||||
empfangenen Nachrichten eingebaut
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
@@ -2511,6 +2527,119 @@ keyb_handler = plugin->keyboard_handler_add (plugin, &my_keyb);
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secAPI_event_handler_add">
|
||||
<title>event_handler_add</title>
|
||||
|
||||
<para>
|
||||
Prototyp:
|
||||
<command>
|
||||
t_plugin_handler *event_handler_add (t_weechat_plugin
|
||||
*plugin, char *event, t_plugin_handler_func *function,
|
||||
char *handler_args, void *handler_pointer)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Fügt einen Ereignishandler hinzu, der aufgerufen wird, wenn ein Ereignis eintritt.
|
||||
</para>
|
||||
<para>
|
||||
Argumente:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>plugin</option>: Zeiger auf Plugin-Strukture
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>event</option> : Ereignis, siehe folgende Tabelle:
|
||||
<informaltable colsep="0" frame="none">
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Ereignis</entry>
|
||||
<entry>Beschreibung</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><literal>buffer_open</literal></entry>
|
||||
<entry>ein Puffer wurde geöffnet</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>buffer_close</literal></entry>
|
||||
<entry>ein Puffer wurde geschlossen</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>function</option>: aufgerufene Funktion
|
||||
</para>
|
||||
<para>
|
||||
Es wird folgender Prototyp verwendet:
|
||||
<command>
|
||||
int my_function (t_weechat_plugin *plugin,
|
||||
int argc, char **argv,
|
||||
char *handler_args, void *handler_pointer)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Argument argc wird auf 1 gesetzt, argv[0] ist die Nummer des Puffers, der
|
||||
geöffnet oder geschlossen wird.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>handler_args</option>: Argument, die an die aufgerufene
|
||||
Funktion übergeben werden
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>handler_pointer</option>: Pointer, der an die aufgerufene
|
||||
Funktion übergeben werden
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Rückgabewert: Pointer auf den neuen Ereignishandler.
|
||||
</para>
|
||||
<para>
|
||||
Anmerkung: die aufgerufene Function muss einen der folgenden Werte zurückgeben:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>PLUGIN_RC_KO</literal>: Funktion fehlgeschlagen
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>PLUGIN_RC_OK</literal>: Funktion erfolgreich beendet
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Beispiel:
|
||||
<screen>
|
||||
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);
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secAPI_handler_remove">
|
||||
<title>handler_remove</title>
|
||||
|
||||
@@ -2887,6 +3016,12 @@ plugin->exec_command (plugin, "freenode", "#weechat", "hello");
|
||||
<entry><literal>server</literal></entry>
|
||||
<entry>Name des Servers</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>type</literal></entry>
|
||||
<entry>
|
||||
Puffertyp: 0=standard, 1=DCC, 2=raw IRC data
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>away</literal></entry>
|
||||
<entry>Status des "away"-Flags</entry>
|
||||
@@ -4270,7 +4405,7 @@ else
|
||||
<row>
|
||||
<entry>int</entry>
|
||||
<entry><literal>type</literal></entry>
|
||||
<entry>Puffertyp: 0=standard, 1=dcc, 2=raw IRC data</entry>
|
||||
<entry>Puffertyp: 0=standard, 1=DCC, 2=raw IRC data</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>int</entry>
|
||||
@@ -5321,6 +5456,13 @@ end
|
||||
an WeeChat noch an andere Plugins übergeben
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>PLUGIN_RC_OK_WITH_HIGHLIGHT</literal>: Funktion
|
||||
erfolgreich vervollständigt und eine Hervorhebung bei den
|
||||
empfangenen Nachrichten eingebaut
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</section>
|
||||
@@ -5630,7 +5772,7 @@ def my_keyboard(key, input_before, input_after):
|
||||
|
||||
# ruby
|
||||
Weechat.add_keyboard_handler("my_keyboard")
|
||||
def my_keyboard(server, input_before, input_after)
|
||||
def my_keyboard(key, input_before, input_after)
|
||||
Weechat.print("keyboard handler: key = '#{key}', " \
|
||||
"input before = '#{input_before}' " \
|
||||
"after = '#{input_after}'")
|
||||
@@ -5639,7 +5781,7 @@ end
|
||||
|
||||
-- lua
|
||||
weechat.add_keyboard_handler("my_keyboard")
|
||||
function my_keyboard(server, input_before, input_after)
|
||||
function my_keyboard(key, input_before, input_after)
|
||||
weechat.print("keyboard handler: key = '"..key..
|
||||
"', input before = '"..input_before..
|
||||
"' after = '"..input_after.."'")
|
||||
@@ -5664,6 +5806,104 @@ end
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secScript_add_event_handler">
|
||||
<title>add_event_handler</title>
|
||||
|
||||
<para>
|
||||
Perl-Prototyp:
|
||||
<command>
|
||||
weechat::add_event_handler(event, function);
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Python-Prototyp:
|
||||
<command>
|
||||
weechat.add_event_handler(event, function)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Ruby-Prototyp:
|
||||
<command>
|
||||
Weechat.add_event_handler(event, function)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Lua-Prototyp:
|
||||
<command>
|
||||
weechat.add_event_handler(event, function)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Fügt einen Ereignis-Handler hinzu, der beim Auftreten eines Ereignisses aufgerufen wird.
|
||||
</para>
|
||||
<para>
|
||||
Argumente:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>event</option> : Ereignis
|
||||
(see <xref linkend="secAPI_event_handler_add" />)
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>function</option>: aufgerufene Funktion
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Rückgabewerte: 1 bei Erfolg, 0 bei aufgetretenen Fehlern
|
||||
</para>
|
||||
<para>
|
||||
Beispiele:
|
||||
<screen>
|
||||
# perl
|
||||
weechat::add_event_handler("buffer_open", "my_event");
|
||||
sub my_event
|
||||
{
|
||||
weechat::print("buffer open");
|
||||
return weechat::PLUGIN_RC_OK;
|
||||
}
|
||||
|
||||
# python
|
||||
weechat.add_event_handler("buffer_open", "my_event")
|
||||
def my_event():
|
||||
weechat.prnt("buffer open")
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
# ruby
|
||||
Weechat.add_event_handler("buffer_open", "my_event")
|
||||
def my_event()
|
||||
Weechat.print("buffer open")
|
||||
return Weechat::PLUGIN_RC_OK
|
||||
end
|
||||
|
||||
-- lua
|
||||
weechat.add_event_handler("buffer_open", "my_event")
|
||||
function my_event()
|
||||
weechat.print("buffer open")
|
||||
return weechat.PLUGIN_RC_OK()
|
||||
end
|
||||
</screen>
|
||||
</para>
|
||||
<para>
|
||||
Bemerkung: aufgerufene Funktion muss einen der folgenden Werte zurückgeben:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>PLUGIN_RC_KO</literal>: Funktion fehlgeschlagen
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>PLUGIN_RC_OK</literal>: Funktion erfolgreich beendet
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secScript_remove_handler">
|
||||
<title>remove_handler</title>
|
||||
|
||||
@@ -5832,7 +6072,7 @@ weechat.remove_timer_handler("my_timer")
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Rückgabewert: 1 bei Erfolg, 0 wenn ein Fehler aufgetreten ist.
|
||||
Rückgabewerte: 1 bei Erfolg, 0 wenn ein Fehler aufgetreten ist.
|
||||
</para>
|
||||
<para>
|
||||
Beispiele:
|
||||
@@ -5852,6 +6092,67 @@ weechat.remove_keyboard_handler("my_keyboard")
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secScrip_remove_event_handler">
|
||||
<title>remove_event_handler</title>
|
||||
|
||||
<para>
|
||||
Perl-Prototyp:
|
||||
<command>
|
||||
weechat::remove_event_handler(function);
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Python-Prototyp:
|
||||
<command>
|
||||
weechat.remove_event_handler(function)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Ruby-Prototyp:
|
||||
<command>
|
||||
Weechat.remove_event_handler(function)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Lua-Prototyp:
|
||||
<command>
|
||||
weechat.remove_event_handler(function)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Entfernt einen Ereignis-Handler.
|
||||
</para>
|
||||
<para>
|
||||
Argumente:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>function</option>: Funktion
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Rückgabewerte: 1 bei Erfolg, 0 wenn ein Fehler aufgetreten ist.
|
||||
</para>
|
||||
<para>
|
||||
Beispiele:
|
||||
<screen>
|
||||
# perl
|
||||
weechat::remove_event_handler("my_event");
|
||||
|
||||
# python
|
||||
weechat.remove_event_handler("my_event")
|
||||
|
||||
# ruby
|
||||
Weechat.remove_event_handler("my_event")
|
||||
|
||||
-- lua
|
||||
weechat.remove_event_handler("my_event")
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secScript_add_modifier">
|
||||
<title>add_modifier</title>
|
||||
|
||||
|
||||
@@ -15,7 +15,8 @@ Argumente: Argumente f
|
||||
|
||||
</programlisting>
|
||||
<command>wird durch alle Argumente ersetzt.</command>
|
||||
<programlisting>
|
||||
<programlisting>Die Variablen $nick, $channel and $server werden durch den aktuellen Nick/Channel oder Server ersetzt.
|
||||
|
||||
</programlisting>
|
||||
<command>buffer [Aktion [Argumente] | Nummer | [[Server] [Channel]]]</command>
|
||||
<programlisting>
|
||||
@@ -40,11 +41,12 @@ Befehl: auszuf
|
||||
|
||||
|
||||
</programlisting>
|
||||
<command>clear [-all]</command>
|
||||
<command>clear [-all | Nummer]</command>
|
||||
<programlisting>
|
||||
Fenster leeren
|
||||
|
||||
-all: alle Fenster leeren
|
||||
-all: lösche alle Puffer
|
||||
Nummer: lösche den Puffer mit der angegebenen Nummer
|
||||
|
||||
</programlisting>
|
||||
<command>connect [Servername]</command>
|
||||
@@ -108,13 +110,14 @@ Bei jedem Argument steht '*' f
|
||||
Ohne Argumente listet /ignore alle definierten /ignore-Regeln auf.
|
||||
|
||||
</programlisting>
|
||||
<command>key [Taste [Funktion/Befehl]] [unbind Taste] [functions] [reset -yes]</command>
|
||||
<command>key [Taste [Funktion/Befehl]] [unbind Taste] [functions] [call Funktion ["Argumente"]] [reset -yes] </command>
|
||||
<programlisting>
|
||||
belegen/freigeben von Tasten
|
||||
|
||||
Taste: diese Taste mit einer internen Funktion oder einem Befehl, beginnend mit "/", belegen
|
||||
Taste: diese Taste anzeigen oder mit einer internen Funktion oder einem Befehl, beginnend mit "/", belegen
|
||||
unbind: Tastenbelegung aufheben
|
||||
functions: interne Funktionen für Tastenbelegungen auflisten
|
||||
call: rufe eine Funktion über ihren Namen auf (mit optionalen Argumenten)
|
||||
reset: Standardbelegung wiederherstellen und entferne ALLE eigenen Belegungen (Vorsicht!)
|
||||
|
||||
</programlisting>
|
||||
|
||||
@@ -197,3 +197,11 @@
|
||||
<entry><literal>grab_key</literal></entry>
|
||||
<entry>grab a key</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>insert</literal></entry>
|
||||
<entry>insert a string in command line</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>search_text</literal></entry>
|
||||
<entry>search text in buffer history</entry>
|
||||
</row>
|
||||
|
||||
+310
-7
@@ -36,7 +36,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
<bookinfo>
|
||||
|
||||
<title>WeeChat 0.2.2 - User guide</title>
|
||||
<title>WeeChat 0.2.4 - User guide</title>
|
||||
<subtitle>Fast, light and extensible IRC client</subtitle>
|
||||
|
||||
<author>
|
||||
@@ -48,7 +48,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
&date.xml;
|
||||
|
||||
<copyright>
|
||||
<year>2006</year>
|
||||
<year>2007</year>
|
||||
<holder>Sébastien Helleu</holder>
|
||||
</copyright>
|
||||
|
||||
@@ -508,6 +508,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Redraw whole window
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Ctrl + R</entry>
|
||||
<entry>
|
||||
Search for text in buffer history
|
||||
(two times: search exact text)
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Ctrl + T</entry>
|
||||
<entry>
|
||||
@@ -561,12 +568,14 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
<entry>Enter / Ctrl + J / Ctrl + M</entry>
|
||||
<entry>
|
||||
Execute command or send message
|
||||
(in search mode: stop search)
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Up arrow / Down arrow</entry>
|
||||
<entry>
|
||||
Call again last commands/messages
|
||||
Call again last commands/messages (in search mode: search
|
||||
up/down)
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
@@ -701,7 +710,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
<row>
|
||||
<entry>Alt + J then Alt + X</entry>
|
||||
<entry>
|
||||
Switch to first channel of next buffer
|
||||
Switch to first channel of next server
|
||||
(or server buffer if no channel is opened)
|
||||
</entry>
|
||||
</row>
|
||||
@@ -2060,6 +2069,13 @@ plugin->log (plugin, "freenode", "#weechat", "test");
|
||||
will not be sent to WeeChat neither other plugins
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>PLUGIN_RC_OK_WITH_HIGHLIGHT</literal>: function
|
||||
successfully completed and make "highlight" on received
|
||||
message
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
@@ -2538,6 +2554,120 @@ keyb_handler = plugin->keyboard_handler_add (plugin, &my_keyb);
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secAPI_event_handler_add">
|
||||
<title>event_handler_add</title>
|
||||
|
||||
<para>
|
||||
Prototype:
|
||||
<command>
|
||||
t_plugin_handler *event_handler_add (t_weechat_plugin
|
||||
*plugin, char *event, t_plugin_handler_func *function,
|
||||
char *handler_args, void *handler_pointer)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Add an event handler, called when an event happens.
|
||||
</para>
|
||||
<para>
|
||||
Arguments:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>plugin</option>: pointer to plugin structure
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>event</option> : event, see table below:
|
||||
<informaltable colsep="0" frame="none">
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Event</entry>
|
||||
<entry>Description</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><literal>buffer_open</literal></entry>
|
||||
<entry>a buffer was open</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>buffer_close</literal></entry>
|
||||
<entry>a buffer was closed</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>function</option>: function called
|
||||
</para>
|
||||
<para>
|
||||
It uses following prototype:
|
||||
<command>
|
||||
int my_function (t_weechat_plugin *plugin,
|
||||
int argc, char **argv,
|
||||
char *handler_args, void *handler_pointer)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Argument argc is set to 1, argv[0] is number of buffer
|
||||
open/closed.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>handler_args</option>: arguments given to function
|
||||
when called
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>handler_pointer</option>: pointer given to function
|
||||
when called
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Return value: pointer to new event handler.
|
||||
</para>
|
||||
<para>
|
||||
Note: function called has to return one of following values:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>PLUGIN_RC_KO</literal>: function failed
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>PLUGIN_RC_OK</literal>: function successfully
|
||||
completed
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Example:
|
||||
<screen>
|
||||
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);
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secAPI_handler_remove">
|
||||
<title>handler_remove</title>
|
||||
|
||||
@@ -2917,6 +3047,12 @@ plugin->exec_command (plugin, "freenode", "#weechat", "hello");
|
||||
<entry><literal>server</literal></entry>
|
||||
<entry>name of server</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>type</literal></entry>
|
||||
<entry>
|
||||
buffer type: 0=standard, 1=DCC, 2=raw IRC data
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>away</literal></entry>
|
||||
<entry>"away" flag</entry>
|
||||
@@ -4305,7 +4441,7 @@ else
|
||||
<row>
|
||||
<entry>int</entry>
|
||||
<entry><literal>type</literal></entry>
|
||||
<entry>buffer type: 0=standard, 1=dcc, 2=raw IRC data</entry>
|
||||
<entry>buffer type: 0=standard, 1=DCC, 2=raw IRC data</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>int</entry>
|
||||
@@ -5364,6 +5500,13 @@ end
|
||||
will not be sent to WeeChat neither other plugins
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>PLUGIN_RC_OK_WITH_HIGHLIGHT</literal>: function
|
||||
successfully completed and make "highlight" on received
|
||||
message
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</section>
|
||||
@@ -5668,7 +5811,7 @@ def my_keyboard(key, input_before, input_after):
|
||||
|
||||
# ruby
|
||||
Weechat.add_keyboard_handler("my_keyboard")
|
||||
def my_keyboard(server, input_before, input_after)
|
||||
def my_keyboard(key, input_before, input_after)
|
||||
Weechat.print("keyboard handler: key = '#{key}', " \
|
||||
"input before = '#{input_before}' " \
|
||||
"after = '#{input_after}'")
|
||||
@@ -5677,7 +5820,7 @@ end
|
||||
|
||||
-- lua
|
||||
weechat.add_keyboard_handler("my_keyboard")
|
||||
function my_keyboard(server, input_before, input_after)
|
||||
function my_keyboard(key, input_before, input_after)
|
||||
weechat.print("keyboard handler: key = '"..key..
|
||||
"', input before = '"..input_before..
|
||||
"' after = '"..input_after.."'")
|
||||
@@ -5703,6 +5846,105 @@ end
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secScript_add_event_handler">
|
||||
<title>add_event_handler</title>
|
||||
|
||||
<para>
|
||||
Perl prototype:
|
||||
<command>
|
||||
weechat::add_event_handler(event, function);
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Python prototype:
|
||||
<command>
|
||||
weechat.add_event_handler(event, function)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Ruby prototype:
|
||||
<command>
|
||||
Weechat.add_event_handler(event, function)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Lua prototype:
|
||||
<command>
|
||||
weechat.add_event_handler(event, function)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Add an event handler, called when an event happens.
|
||||
</para>
|
||||
<para>
|
||||
Arguments:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>event</option> : event
|
||||
(see <xref linkend="secAPI_event_handler_add" />)
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>function</option>: function called
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Return value: 1 if success, 0 if an error occurred.
|
||||
</para>
|
||||
<para>
|
||||
Examples:
|
||||
<screen>
|
||||
# perl
|
||||
weechat::add_event_handler("buffer_open", "my_event");
|
||||
sub my_event
|
||||
{
|
||||
weechat::print("buffer open");
|
||||
return weechat::PLUGIN_RC_OK;
|
||||
}
|
||||
|
||||
# python
|
||||
weechat.add_event_handler("buffer_open", "my_event")
|
||||
def my_event():
|
||||
weechat.prnt("buffer open")
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
# ruby
|
||||
Weechat.add_event_handler("buffer_open", "my_event")
|
||||
def my_event()
|
||||
Weechat.print("buffer open")
|
||||
return Weechat::PLUGIN_RC_OK
|
||||
end
|
||||
|
||||
-- lua
|
||||
weechat.add_event_handler("buffer_open", "my_event")
|
||||
function my_event()
|
||||
weechat.print("buffer open")
|
||||
return weechat.PLUGIN_RC_OK()
|
||||
end
|
||||
</screen>
|
||||
</para>
|
||||
<para>
|
||||
Note: function called has to return one of following values:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>PLUGIN_RC_KO</literal>: function failed
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>PLUGIN_RC_OK</literal>: function successfully
|
||||
completed
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secScript_remove_handler">
|
||||
<title>remove_handler</title>
|
||||
|
||||
@@ -5891,6 +6133,67 @@ weechat.remove_keyboard_handler("my_keyboard")
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secScrip_remove_event_handler">
|
||||
<title>remove_event_handler</title>
|
||||
|
||||
<para>
|
||||
Perl prototype:
|
||||
<command>
|
||||
weechat::remove_event_handler(function);
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Python prototype:
|
||||
<command>
|
||||
weechat.remove_event_handler(function)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Ruby prototype:
|
||||
<command>
|
||||
Weechat.remove_event_handler(function)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Lua prototype:
|
||||
<command>
|
||||
weechat.remove_event_handler(function)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Remove an event handler.
|
||||
</para>
|
||||
<para>
|
||||
Arguments:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>function</option>: function
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Return value: 1 if success, 0 if an error occurred.
|
||||
</para>
|
||||
<para>
|
||||
Examples:
|
||||
<screen>
|
||||
# perl
|
||||
weechat::remove_event_handler("my_event");
|
||||
|
||||
# python
|
||||
weechat.remove_event_handler("my_event")
|
||||
|
||||
# ruby
|
||||
Weechat.remove_event_handler("my_event")
|
||||
|
||||
-- lua
|
||||
weechat.remove_event_handler("my_event")
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secScript_add_modifier">
|
||||
<title>add_modifier</title>
|
||||
|
||||
|
||||
@@ -11,11 +11,12 @@ create an alias for a command
|
||||
|
||||
alias_name: name of alias
|
||||
command: command name (WeeChat or IRC command, many commands can be separated by semicolons)
|
||||
arguments: arguments for command
|
||||
arguments: arguments for command
|
||||
|
||||
</programlisting>
|
||||
<command>is replaced by all arguments.</command>
|
||||
<programlisting>
|
||||
<programlisting>Variables $nick, $channel and $server are replaced by current nick/channel/server.
|
||||
|
||||
</programlisting>
|
||||
<command>buffer [action [args] | number | [[server] [channel]]]</command>
|
||||
<programlisting>
|
||||
@@ -40,11 +41,12 @@ command: command to execute (a '/' is automatically added if not found at beginn
|
||||
|
||||
|
||||
</programlisting>
|
||||
<command>clear [-all]</command>
|
||||
<command>clear [-all | number]</command>
|
||||
<programlisting>
|
||||
clear window(s)
|
||||
|
||||
-all: clear all windows
|
||||
-all: clear all buffers
|
||||
number: clear buffer by number
|
||||
|
||||
</programlisting>
|
||||
<command>connect [servername]</command>
|
||||
@@ -107,13 +109,14 @@ For each argument, '*' means all.
|
||||
Without argument, /ignore command lists all defined ignore.
|
||||
|
||||
</programlisting>
|
||||
<command>key [key [function/command]] [unbind key] [functions] [reset -yes]</command>
|
||||
<command>key [key [function/command]] [unbind key] [functions] [call function ["args"]] [reset -yes]</command>
|
||||
<programlisting>
|
||||
bind/unbind keys
|
||||
|
||||
key: display or bind this key to an internal function or a command (beginning by "/")
|
||||
unbind: unbind a key
|
||||
functions: list internal functions for key bindings
|
||||
call: call a function by name (with optional arguments)
|
||||
reset: restore bindings to the default values and delete ALL personal bindings (use carefully!)
|
||||
|
||||
</programlisting>
|
||||
|
||||
@@ -197,3 +197,11 @@
|
||||
<entry><literal>grab_key</literal></entry>
|
||||
<entry>capturer une touche</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>insert</literal></entry>
|
||||
<entry>insérer une chaîne dans la ligne de commande</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>search_text</literal></entry>
|
||||
<entry>recherche de texte dans l'historique du tampon</entry>
|
||||
</row>
|
||||
|
||||
+315
-6
@@ -36,7 +36,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
<bookinfo>
|
||||
|
||||
<title>WeeChat 0.2.2 - Guide utilisateur</title>
|
||||
<title>WeeChat 0.2.4 - Guide utilisateur</title>
|
||||
<subtitle>Client IRC rapide, léger et extensible</subtitle>
|
||||
|
||||
<author>
|
||||
@@ -48,7 +48,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
&date.xml;
|
||||
|
||||
<copyright>
|
||||
<year>2006</year>
|
||||
<year>2007</year>
|
||||
<holder>Sébastien Helleu</holder>
|
||||
</copyright>
|
||||
|
||||
@@ -517,6 +517,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Réafficher toute la fenêtre
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Ctrl + R</entry>
|
||||
<entry>
|
||||
Chercher du texte dans l'historique du tampon
|
||||
(deux appuis successifs pour rechercher du texte exact)
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Ctrl + T</entry>
|
||||
<entry>
|
||||
@@ -571,12 +578,14 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
<entry>Entrée / Ctrl + J / Ctrl + M</entry>
|
||||
<entry>
|
||||
Exécuter la commande ou envoyer le message
|
||||
(en mode recherche: arrêter la recherche)
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Flèche haut / flèche bas</entry>
|
||||
<entry>
|
||||
Rappeler les dernières commandes ou messages
|
||||
(en mode recherche: chercher en haut/bas)
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
@@ -2105,6 +2114,12 @@ plugin->log (plugin, "freenode", "#weechat", "test");
|
||||
ne sera ni transmis à WeeChat ni à d'autres extensions
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>PLUGIN_RC_OK_WITH_HIGHLIGHT</literal> : la fonction
|
||||
a réussi et provoque un "highlight" sur le message reçu
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
@@ -2596,7 +2611,125 @@ keyb_handler = plugin->keyboard_handler_add (plugin, &mon_keyb);
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
|
||||
<section id="secAPI_event_handler_add">
|
||||
<title>event_handler_add</title>
|
||||
|
||||
<para>
|
||||
Prototype :
|
||||
<command>
|
||||
t_plugin_handler *event_handler_add (t_weechat_plugin
|
||||
*plugin, char *evenement, t_plugin_handler_func *fonction,
|
||||
char *handler_args, void *handler_pointer)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Ajoute un gestionnaire d'évènement, appelé dès qu'un évènement se
|
||||
produit.
|
||||
</para>
|
||||
<para>
|
||||
Paramètres :
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>plugin</option> : pointeur vers la structure
|
||||
de l'extension
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>évènement</option> : évènement, voir le tableau
|
||||
ci-dessous :
|
||||
<informaltable colsep="0" frame="none">
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Evènement</entry>
|
||||
<entry>Description</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><literal>buffer_open</literal></entry>
|
||||
<entry>un tampon a été ouvert</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>buffer_close</literal></entry>
|
||||
<entry>un tampon a été fermé</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>fonction</option> : fonction appelée
|
||||
</para>
|
||||
<para>
|
||||
Elle a le prototype suivant :
|
||||
<command>
|
||||
int ma_fonction (t_weechat_plugin *plugin,
|
||||
int argc, char **argv,
|
||||
char *handler_args, void *handler_pointer)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Le paramètre argc vaut 1 et argv[0] contient le numéro
|
||||
du tampon ouvert ou fermé.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>handler_args</option> : paramètres passés à la
|
||||
fonction appelée
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>handler_pointer</option> : pointeur passé à la
|
||||
fonction appelée
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Valeur renvoyée : le pointeur vers le nouveau gestionnaire
|
||||
d'évènement.
|
||||
</para>
|
||||
<para>
|
||||
Note : la fonction appelée doit renvoyer une des valeurs
|
||||
suivantes :
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>PLUGIN_RC_KO</literal> : la fonction a échoué
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>PLUGIN_RC_OK</literal> : la fonction a réussi
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Exemple :
|
||||
<screen>
|
||||
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);
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secAPI_handler_remove">
|
||||
<title>handler_remove</title>
|
||||
|
||||
@@ -2987,6 +3120,13 @@ plugin->exec_command (plugin, "freenode", "#weechat", "bonjour");
|
||||
<entry><literal>server</literal></entry>
|
||||
<entry>nom du serveur</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>type</literal></entry>
|
||||
<entry>
|
||||
type de tampon: 0=standard, 1=DCC,
|
||||
2=données IRC brutes
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>away</literal></entry>
|
||||
<entry>drapeau "away"</entry>
|
||||
@@ -4408,7 +4548,7 @@ else
|
||||
<entry>int</entry>
|
||||
<entry><literal>type</literal></entry>
|
||||
<entry>
|
||||
type de tampon: 0=standard, 1=dcc,
|
||||
type de tampon: 0=standard, 1=DCC,
|
||||
2=données IRC brutes
|
||||
</entry>
|
||||
</row>
|
||||
@@ -5487,6 +5627,12 @@ end
|
||||
ne sera ni transmis à WeeChat ni à d'autres extensions
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>PLUGIN_RC_OK_WITH_HIGHLIGHT</literal> : la fonction
|
||||
a réussi et provoque un "highlight" sur le message reçu
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</section>
|
||||
@@ -5793,7 +5939,7 @@ def mon_clavier(key, input_before, input_after):
|
||||
|
||||
# ruby
|
||||
Weechat.add_keyboard_handler("mon_clavier")
|
||||
def mon_clavier(server, input_before, input_after)
|
||||
def mon_clavier(key, input_before, input_after)
|
||||
Weechat.print("gestionnaire clavier: touche = '#{key}', " \
|
||||
"entrée avant = '#{input_before}' " \
|
||||
"après = '#{input_after}'")
|
||||
@@ -5802,7 +5948,7 @@ end
|
||||
|
||||
-- lua
|
||||
weechat.add_keyboard_handler("mon_clavier")
|
||||
function mon_clavier(server, input_before, input_after)
|
||||
function mon_clavier(key, input_before, input_after)
|
||||
weechat.print("gestionnaire clavier: touche = '"..key..
|
||||
"', entrée avant = '"..input_before..
|
||||
"' après = '"..input_after.."'")
|
||||
@@ -5828,6 +5974,108 @@ end
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secScript_add_event_handler">
|
||||
<title>add_event_handler</title>
|
||||
|
||||
<para>
|
||||
Prototype Perl :
|
||||
<command>
|
||||
weechat::add_event_handler(évènement, fonction);
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Prototype Python :
|
||||
<command>
|
||||
weechat.add_event_handler(évènement, fonction)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Prototype Ruby :
|
||||
<command>
|
||||
Weechat.add_event_handler(évènement, fonction)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Prototype Lua :
|
||||
<command>
|
||||
weechat.add_event_handler(évènement, fonction)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Ajoute un gestionnaire d'évènement, appelé dès qu'un évènement se
|
||||
produit.
|
||||
</para>
|
||||
<para>
|
||||
Paramètres :
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>évènement</option> : évènement
|
||||
(voir <xref linkend="secAPI_event_handler_add" />)
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>fonction</option> : fonction appelée
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite.
|
||||
</para>
|
||||
<para>
|
||||
Exemples :
|
||||
<screen>
|
||||
# perl
|
||||
weechat::add_event_handler("buffer_open", "mon_evenement");
|
||||
sub mon_evenement
|
||||
{
|
||||
weechat::print("buffer open");
|
||||
return weechat::PLUGIN_RC_OK;
|
||||
}
|
||||
|
||||
# python
|
||||
weechat.add_event_handler("buffer_open", "mon_evenement")
|
||||
def mon_evenement():
|
||||
weechat.prnt("buffer open")
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
# ruby
|
||||
Weechat.add_event_handler("buffer_open", "mon_evenement")
|
||||
def mon_evenement()
|
||||
Weechat.print("buffer open")
|
||||
return Weechat::PLUGIN_RC_OK
|
||||
end
|
||||
|
||||
-- lua
|
||||
weechat.add_event_handler("buffer_open", "mon_evenement")
|
||||
function mon_evenement()
|
||||
weechat.print("buffer open")
|
||||
return weechat.PLUGIN_RC_OK()
|
||||
end
|
||||
</screen>
|
||||
</para>
|
||||
<para>
|
||||
Note : la fonction appelée doit renvoyer une des valeurs
|
||||
suivantes :
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>PLUGIN_RC_KO</literal> : la fonction a échoué
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>PLUGIN_RC_OK</literal> : la fonction a réussi
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secScript_remove_handler">
|
||||
<title>remove_handler</title>
|
||||
|
||||
@@ -6016,6 +6264,67 @@ weechat.remove_keyboard_handler("mon_clavier")
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secScript_remove_event_handler">
|
||||
<title>remove_event_handler</title>
|
||||
|
||||
<para>
|
||||
Prototype Perl :
|
||||
<command>
|
||||
weechat::remove_event_handler(fonction);
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Prototype Python :
|
||||
<command>
|
||||
weechat.remove_event_handler(fonction)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Prototype Ruby :
|
||||
<command>
|
||||
Weechat.remove_event_handler(fonction)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Prototype Lua :
|
||||
<command>
|
||||
weechat.remove_event_handler(fonction)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Supprime un gestionnaire d'évènement.
|
||||
</para>
|
||||
<para>
|
||||
Paramètres :
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>fonction</option> : fonction
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite.
|
||||
</para>
|
||||
<para>
|
||||
Exemples :
|
||||
<screen>
|
||||
# perl
|
||||
weechat::remove_event_handler("mon_evenement");
|
||||
|
||||
# python
|
||||
weechat.remove_event_handler("mon_evenement")
|
||||
|
||||
# ruby
|
||||
Weechat.remove_event_handler("mon_evenement")
|
||||
|
||||
-- lua
|
||||
weechat.remove_event_handler("mon_evenement")
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secScript_add_modifier">
|
||||
<title>add_modifier</title>
|
||||
|
||||
|
||||
@@ -15,7 +15,8 @@ param
|
||||
|
||||
</programlisting>
|
||||
<command>est remplacé par tous les paramètres.</command>
|
||||
<programlisting>
|
||||
<programlisting>Les variables $nick, $channel et $server sont remplacées par le pseudo/canal/serveur courant.
|
||||
|
||||
</programlisting>
|
||||
<command>buffer [action [args] | nombre | [[serveur] [canal]]]</command>
|
||||
<programlisting>
|
||||
@@ -40,11 +41,12 @@ commande: commande
|
||||
|
||||
|
||||
</programlisting>
|
||||
<command>clear [-all]</command>
|
||||
<command>clear [-all | nombre]</command>
|
||||
<programlisting>
|
||||
effacer la/les fenêtre(s)
|
||||
|
||||
-all: effacer toutes les fenêtres
|
||||
-all: effacer tous les tampons
|
||||
nombre: effacer un tampon par son numéro
|
||||
|
||||
</programlisting>
|
||||
<command>connect [nom_serveur]</command>
|
||||
@@ -107,13 +109,14 @@ Pour chaque param
|
||||
Sans paramètres, la commande /ignore liste les ignore définis.
|
||||
|
||||
</programlisting>
|
||||
<command>key [touche [fonction/commande]] [unbind touche] [functions] [reset -yes]</command>
|
||||
<command>key [touche [fonction/commande]] [unbind touche] [functions] [call fonction ["params"]] [reset -yes]</command>
|
||||
<programlisting>
|
||||
associer/libérer des touches
|
||||
|
||||
touche: voir ou associer cette touche à une fonction interne ou une commande (commençant par "/")
|
||||
unbind: supprimer l'association à une touche
|
||||
functions: lister la liste des fonctions internes pour les associations de touches
|
||||
call: appeler une foonction par son nom (avec paramètres optionnels)
|
||||
reset: restaure les touches aux valeurs par défaut et supprime TOUTES les touches personnelles (utiliser avec précaution !)
|
||||
|
||||
</programlisting>
|
||||
|
||||
@@ -53,11 +53,11 @@ Guide de d
|
||||
Vous pouvez voir les options du serveur et les valeurs avec /set quakenet
|
||||
Pour modifier une option, utilisez /set quakenet.server_option = valeur
|
||||
|
||||
5. Se connecter au serveur et rejoindre les canaux :
|
||||
5. Se connecter au serveur et rejoindre les canaux
|
||||
|
||||
/connect quakenet
|
||||
|
||||
6. Rejoindre/quittre les canaux
|
||||
6. Rejoindre/quitter les canaux
|
||||
|
||||
Joindre un canal :
|
||||
/join #channel
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
LANGCODE = sco
|
||||
QUICKSTART = weechat_quickstart.$(LANGCODE).txt
|
||||
|
||||
EXTRA_DIST = $(QUICKSTART)
|
||||
|
||||
docdir = $(datadir)/doc/$(PACKAGE)
|
||||
|
||||
# install docs
|
||||
|
||||
install-data-hook:
|
||||
$(INSTALL_DATA) $(QUICKSTART) $(DESTDIR)$(docdir)/
|
||||
@@ -0,0 +1,108 @@
|
||||
WeeChat quik stairt guide (Scots version)
|
||||
=========================
|
||||
|
||||
1. Launch weechat
|
||||
|
||||
Accordin tae choosed GUI, ye hav tae launch:
|
||||
- weechat-curses fer Curses GUI
|
||||
- weechat-gtk fer Gtk GUI (under development)
|
||||
- weechat-qt fer Qt GUI (no developed)
|
||||
- weechat-wxwidgets fer WxWidgets GUI (no developed yit)
|
||||
|
||||
2. Online help / options
|
||||
|
||||
WeeChat hus help fer awl commands, jus issu /help
|
||||
Tae get help on a command, issu /help command
|
||||
|
||||
Tae set options, use eh /set option = value
|
||||
Ye can use /set option wi partial name (displ't awl options
|
||||
contain leters), or wi ownly a full option nam wi'oot value
|
||||
(tae see long help fer option).
|
||||
|
||||
Pure Important: settings are saved when WeeChat ends (or wi eh "/save"
|
||||
command). Gonnae NO(!) edit eh setup file whyle WeeChat is running, cause WeeChat
|
||||
may write eh file at 'ne time, and its nae possible tae reload it.
|
||||
Tae chainge any settins, use "/set" command, WeeChat immediately uses new
|
||||
settings.
|
||||
|
||||
3. Create a server
|
||||
|
||||
Fer example irc.quakenet.org, port 6667:
|
||||
/server quakenet irc.quakenet.org 6667
|
||||
(/help server fer ful command help)
|
||||
|
||||
4. Set custom server options
|
||||
|
||||
Nicks:
|
||||
/set quakenet.server_nick1 = "manick"
|
||||
/set quakenet.server_nick2 = "manick2"
|
||||
/set quakenet.server_nick3 = "manick3"
|
||||
|
||||
Username/realname:
|
||||
/set quakenet.server_username = "Ma username"
|
||||
/set quakenet.server_realname = "Ma real name"
|
||||
|
||||
Auto-connect tae server:
|
||||
/set quakenet.server_autoconnect = on
|
||||
|
||||
Auto-join fer sum channels:
|
||||
/set quakenet.server_autojoin = "#chan1,#chan2"
|
||||
|
||||
Other options:
|
||||
Ye can see servers options and values wi /set quakenet
|
||||
Tae set an option, use eh /set quakenet.server_option = value
|
||||
|
||||
5. Connect tae server n auto-join channels:
|
||||
|
||||
/connect quakenet
|
||||
|
||||
6. Join/part channels
|
||||
|
||||
Join a channel:
|
||||
/join #channel
|
||||
Part a channel:
|
||||
/part [quit message]
|
||||
Part a channel n close buffer:
|
||||
/close [quit message]
|
||||
(/close is an alias on /buffer close)
|
||||
|
||||
7. Buffer/window management
|
||||
|
||||
Ye can manage buffers wi "/buffer" command and windows
|
||||
with "/window" command.
|
||||
Fer example, tae split verticaly screen intae a wee windea (1/3 width),
|
||||
n a big yin (2/3), use command:
|
||||
/window splitv 33
|
||||
|
||||
8. Key bindings
|
||||
|
||||
According tae yer keyboard and/or ya needs, ye can rebind 'ne key
|
||||
wi "/key" command.
|
||||
A useful key is meta-k (alt-k) tae find key codes.
|
||||
|
||||
Fer example, tae bind meta-y (alt-y) tae command "/buffer close":
|
||||
/key (press meta-k) (press meta-y) /buffer close
|
||||
|
||||
Ye wull huv a command line like:
|
||||
/key meta-y /buffer close
|
||||
|
||||
9. Plugins/scripts
|
||||
|
||||
On som distros lyke Debian, plugins are available via a separate package
|
||||
(like weechat-plugins).
|
||||
Plugins are automatically loadet when found.
|
||||
Many plugins/scripts are available fer WeeChat, please luk at:
|
||||
http://weechat.flashtux.org/plugins.php
|
||||
Please luk at WeeChat documentation tae load/unload plugins or scripts.
|
||||
|
||||
10. Mer documentation
|
||||
|
||||
Yae can noo use WeeChat and read FAQ/documentation fer any oths questins:
|
||||
http://weechat.flashtux.org/faq.php
|
||||
http://weechat.flashtux.org/doc.php
|
||||
|
||||
Enjoy WeeChat!
|
||||
|
||||
--
|
||||
(c) 2006-05-31, written by FlashCode <flashcode@flashtux.org>, Translate't by AndrewB <andrewb@tuxhacker.org>
|
||||
This document is part of WeeChat and is distributed under GPL licence.
|
||||
@@ -1,4 +1,4 @@
|
||||
.TH WEECHAT 1 "January 2007" "FlashCode"
|
||||
.TH WEECHAT 1 "March 2007" "FlashCode"
|
||||
|
||||
.SH NAME
|
||||
weechat-curses \- Wee Enhanced Environment for Chat (Curses version)
|
||||
|
||||
+446
-398
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,72 @@
|
||||
# perl
|
||||
# Logs URLs to a p5-DBI-MySQL database.
|
||||
# This script is BSD licensed.
|
||||
# Hacked together by Karlis "Hagabard" Loen in Feb 2007
|
||||
# hagabard AT gmail DOT com
|
||||
# Table format: (ircurls is default table name in script)
|
||||
#+-----------+---------------+------+-----+---------+-------+
|
||||
#| Field | Type | Null | Key | Default | Extra |
|
||||
#+-----------+---------------+------+-----+---------+-------+
|
||||
#| timestamp | timestamp(14) | YES | | NULL | |
|
||||
#| hostmask | text(255) | YES | | NULL | |
|
||||
#| target | text(255) | YES | | NULL | |
|
||||
#| url | text(255) | YES | | NULL | |
|
||||
#+-----------+---------------+------+-----+---------+-------+
|
||||
# In the future I hope to get around to adding stuff like:
|
||||
#+-----------+---------------+------+-----+---------+-------+
|
||||
#| httptitle | text(255) | YES | | NULL | |
|
||||
#| httpdinfo | text(255) | YES | | NULL | |
|
||||
#| tinyurl | text(255) | YES | | NULL | |
|
||||
#+-----------+---------------+------+-----+---------+-------+
|
||||
# Test other DBI types, maybe /setp perl.logurlsql.dbtype="Pg" works?
|
||||
|
||||
# Tested with p5-DBI-Mysql, others untested
|
||||
use DBI;
|
||||
|
||||
weechat::register("logurlsql", "0.2", "", "WeeChat p5-DBI script to log URLs to a SQL Database.");
|
||||
|
||||
weechat::add_message_handler("*", "cmd_logurl");
|
||||
|
||||
# Setup Database connection, now with /setp for your configuration pleasure
|
||||
weechat::set_plugin_config("dbtype", "mysql") if (weechat::get_plugin_config("dbtype") eq "");
|
||||
weechat::set_plugin_config("dbhost", "localhost") if (weechat::get_plugin_config("dbhost") eq "");
|
||||
weechat::set_plugin_config("dbname", "weechat") if (weechat::get_plugin_config("dbname") eq "");
|
||||
weechat::set_plugin_config("dbtable", "ircurls") if (weechat::get_plugin_config("dbtable") eq "");
|
||||
weechat::set_plugin_config("dbuser", "irc") if (weechat::get_plugin_config("dbuser") eq "");
|
||||
weechat::set_plugin_config("dbpass", "forever") if (weechat::get_plugin_config("dbpass") eq "");
|
||||
|
||||
# Regexps
|
||||
sub URL_SCHEME_REGEX() { '(http|ftp|https|news|irc)' }
|
||||
sub URL_GUESS_REGEX() { '(www|ftp)' }
|
||||
sub URL_BASE_REGEX() { '[a-z0-9_\-+\\/:?%.&!~;,=\#<]' }
|
||||
|
||||
# This sub borrowed from the BSD licensed urlplot.pl irssi script by bwolf.
|
||||
sub scan_url {
|
||||
my $rawtext = shift;
|
||||
return $1 if $rawtext =~ m|(@{[ URL_SCHEME_REGEX ]}://@{[ URL_BASE_REGEX ]}+)|io;
|
||||
# The URL misses a scheme, try to be smart
|
||||
if ($rawtext =~ m|@{[ URL_GUESS_REGEX ]}\.@{[ URL_BASE_REGEX ]}+|io) {
|
||||
my $preserve = $&;
|
||||
return "http://$preserve" if $1 =~ /^www/;
|
||||
return "ftp://$preserve" if $1 =~ /^ftp/;
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub cmd_logurl {
|
||||
($null, $target, $data) = split ":",$_[1],3;
|
||||
($hostmask, $null, $target) = split " ", $target;
|
||||
if (defined($url = scan_url($data))) {
|
||||
#weechat::print("hostmask=$hostmask, target=$target, url=$url");
|
||||
db_insert($hostmask, $target, $url);
|
||||
}
|
||||
return weechat::PLUGIN_RC_OK;
|
||||
}
|
||||
|
||||
sub db_insert {
|
||||
my ($hostmask, $target, $url)=@_;
|
||||
my $dbh = DBI->connect( "DBI:". weechat::get_plugin_config(dbtype) .":". weechat::get_plugin_config(dbname) .":". weechat::get_plugin_config(dbhost), weechat::get_plugin_config(dbuser), weechat::get_plugin_config(dbpass));
|
||||
my $sql="insert into ". weechat::get_plugin_config(dbtable) ." (timestamp, hostmask, target, url) values (NOW()".",". $dbh->quote($hostmask) ."," . $dbh->quote($target) ."," . $dbh->quote($url) .")";
|
||||
my $sth = $dbh->do($sql);
|
||||
$dbh->disconnect();
|
||||
}
|
||||
@@ -0,0 +1,241 @@
|
||||
#
|
||||
# Copyright (c) 2007 by FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
#
|
||||
# Display old topics for a channel.
|
||||
#
|
||||
# History:
|
||||
# 2007-03-29, FlashCode <flashcode@flashtux.org>:
|
||||
# initial release
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
||||
my $version = "0.1";
|
||||
|
||||
my $plugin_help_options = "Plugins options (set with /setp):\n"
|
||||
." - perl.oldtopic.log_server: if on, displays all topic changes on server buffer\n"
|
||||
." - perl.oldtopic.max_topics: number of topics to keep for each channel "
|
||||
."(0 = do not keep any topics)";
|
||||
|
||||
# default values in setup file (~/.weechat/plugins.rc)
|
||||
my $default_log_server = "off";
|
||||
my $default_max_topics = "10";
|
||||
|
||||
# init script
|
||||
weechat::register("oldtopic", $version, "", "Display old topics for a channel");
|
||||
weechat::set_plugin_config("log_server", $default_log_server) if (weechat::get_plugin_config("log_server") eq "");
|
||||
weechat::set_plugin_config("max_topics", $default_max_topics) if (weechat::get_plugin_config("max_topics") eq "");
|
||||
|
||||
# message and command handlers
|
||||
weechat::add_message_handler("topic", "topic_msg");
|
||||
weechat::add_message_handler("332", "topic_332_msg");
|
||||
weechat::add_message_handler("333", "topic_333_msg");
|
||||
weechat::add_command_handler ("lasttopic", "lasttopic_cmd",
|
||||
"Display last topic for a channel (topic before current one)",
|
||||
"[channel]",
|
||||
"channel: channel name (default: current channel)\n\n"
|
||||
.$plugin_help_options,
|
||||
"%C");
|
||||
weechat::add_command_handler ("oldtopic", "oldtopic_cmd",
|
||||
"Display old topics for a channel",
|
||||
"[channel]",
|
||||
"channel: channel name (default: current channel)\n\n"
|
||||
.$plugin_help_options,
|
||||
"%C");
|
||||
|
||||
my %oldtopic;
|
||||
undef %oldtopic;
|
||||
|
||||
my %msg_332_topic;
|
||||
undef %msg_332_topic;
|
||||
|
||||
sub get_config
|
||||
{
|
||||
my $conf_log_server = weechat::get_plugin_config("log_server");
|
||||
$conf_log_server = $default_log_server if ($conf_log_server eq "");
|
||||
|
||||
my $conf_max = weechat::get_plugin_config("max_topics");
|
||||
$conf_max = $default_max_topics if ($conf_max eq "");
|
||||
$conf_max = 0 if ($conf_max < 0);
|
||||
|
||||
return ($conf_log_server, $conf_max);
|
||||
}
|
||||
|
||||
sub add_topic
|
||||
{
|
||||
my ($server, $channel, $nick, $topic, $topicdate, $conf_max) =
|
||||
($_[0], $_[1], $_[2], $_[3], $_[4], $_[5]);
|
||||
|
||||
my $time = $topicdate;
|
||||
$time = time() if ($time eq "");
|
||||
|
||||
$oldtopic{$server}{$channel}{$time}{"nick"} = $nick;
|
||||
$oldtopic{$server}{$channel}{$time}{"topic"} = $topic;
|
||||
my $numchan = scalar(keys(%{$oldtopic{$server}{$channel}}));
|
||||
if ($numchan > $conf_max)
|
||||
{
|
||||
my $diff = $numchan - $conf_max;
|
||||
my $count = 0;
|
||||
foreach my $date (sort keys %{$oldtopic{$server}{$channel}})
|
||||
{
|
||||
delete($oldtopic{$server}{$channel}{$date});
|
||||
$count++;
|
||||
last if ($count >= $diff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# received when someone changes topic on a channel
|
||||
sub topic_msg
|
||||
{
|
||||
my $server = $_[0];
|
||||
my ($conf_log_server, $conf_max) = get_config();
|
||||
|
||||
if ($_[1] =~ /(.*) TOPIC (.*)/)
|
||||
{
|
||||
my $nick = $1;
|
||||
my $args = $2;
|
||||
my $nick = $1 if ($nick =~ /:?([^!]+)(!?.*)/);
|
||||
if ($args =~ /([\#\&\+\!][^ ]*) (.*)/)
|
||||
{
|
||||
my $channel = $1;
|
||||
my $topic = $2;
|
||||
$topic = $1 if ($topic =~ /:(.*)/);
|
||||
|
||||
if ($conf_log_server eq "on")
|
||||
{
|
||||
weechat::print("Topic on $channel changed by ${nick} to: \"${topic}\x0F\"",
|
||||
"", $server);
|
||||
}
|
||||
|
||||
if ($conf_max > 0)
|
||||
{
|
||||
add_topic($server, $channel, $nick, $topic, "", $conf_max);
|
||||
}
|
||||
else
|
||||
{
|
||||
delete($oldtopic{$server}{$channel});
|
||||
}
|
||||
}
|
||||
}
|
||||
return weechat::PLUGIN_RC_OK;
|
||||
}
|
||||
|
||||
# topic for a channel (when joining channel)
|
||||
sub topic_332_msg
|
||||
{
|
||||
my $server = $_[0];
|
||||
|
||||
if ($_[1] =~ /(.*) 332 (.*)/)
|
||||
{
|
||||
my $args = $2;
|
||||
if ($args =~ /([\#\&\+\!][^ ]*) (.*)/)
|
||||
{
|
||||
my $channel = $1;
|
||||
my $topic = $2;
|
||||
$topic = $1 if ($topic =~ /:(.*)/);
|
||||
$msg_332_topic{$server}{$channel} = $topic;
|
||||
}
|
||||
}
|
||||
return weechat::PLUGIN_RC_OK;
|
||||
}
|
||||
|
||||
# nick/date for topic (when joining channel, received after 332)
|
||||
sub topic_333_msg
|
||||
{
|
||||
my $server = $_[0];
|
||||
|
||||
if ($_[1] =~ /.* 333 .* ([\#\&\+\!][^ ]*) (.*) ([0-9]+)/)
|
||||
{
|
||||
my $channel = $1;
|
||||
my $nick = $2;
|
||||
my $date = $3;
|
||||
my ($conf_log_server, $conf_max) = get_config();
|
||||
add_topic($server, $channel, $nick,
|
||||
$msg_332_topic{$server}{$channel},
|
||||
$date, $conf_max);
|
||||
}
|
||||
return weechat::PLUGIN_RC_OK;
|
||||
}
|
||||
|
||||
sub lasttopic_cmd
|
||||
{
|
||||
my $server = weechat::get_info("server");
|
||||
my $channel = weechat::get_info("channel");
|
||||
$channel = $_[1] if ($_[1] ne "");
|
||||
|
||||
if ($channel ne "")
|
||||
{
|
||||
my ($conf_log_server, $conf_max) = get_config();
|
||||
|
||||
delete($oldtopic{$server}{$channel}) if ($conf_max == 0);
|
||||
|
||||
my $count = 0;
|
||||
my $found = 0;
|
||||
foreach my $date (sort { $b <=> $a } keys %{$oldtopic{$server}{$channel}})
|
||||
{
|
||||
$count++;
|
||||
if ($count > 1)
|
||||
{
|
||||
$found = 1;
|
||||
weechat::print("Last topic for ${server}/${channel}: on ".localtime($date)." by ".
|
||||
$oldtopic{$server}{$channel}{$date}{"nick"}.": \"".
|
||||
$oldtopic{$server}{$channel}{$date}{"topic"}."\x0F\"");
|
||||
last;
|
||||
}
|
||||
}
|
||||
weechat::print("Last topic not found for channel ${server}/${channel}.") if ($found == 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
weechat::print("Error: this buffer is not a channel.");
|
||||
}
|
||||
|
||||
return weechat::PLUGIN_RC_OK;
|
||||
}
|
||||
|
||||
sub oldtopic_cmd
|
||||
{
|
||||
my $server = weechat::get_info("server");
|
||||
my $channel = weechat::get_info("channel");
|
||||
$channel = $_[1] if ($_[1] ne "");
|
||||
|
||||
if ($channel ne "")
|
||||
{
|
||||
my ($conf_log_server, $conf_max) = get_config();
|
||||
|
||||
delete($oldtopic{$server}{$channel}) if ($conf_max == 0);
|
||||
|
||||
my $found = 0;
|
||||
foreach my $date (sort keys %{$oldtopic{$server}{$channel}})
|
||||
{
|
||||
$found = 1;
|
||||
weechat::print("Topic for ${server}/${channel} on ".localtime($date)." by ".
|
||||
$oldtopic{$server}{$channel}{$date}{"nick"}.": \"".
|
||||
$oldtopic{$server}{$channel}{$date}{"topic"}."\x0F\"");
|
||||
}
|
||||
weechat::print("No old topic for channel ${server}/${channel}.") if ($found == 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
weechat::print("Error: this buffer is not a channel.");
|
||||
}
|
||||
|
||||
return weechat::PLUGIN_RC_OK;
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
# xmms perl script for weechat #
|
||||
# #
|
||||
# Displays some useless xmms-infopipe values #
|
||||
# (c) 2006 by Cédric Chalier <llinkz@gmail.com> #
|
||||
# (c) 2006 by Cédric Chalier <ounaid AT gmail DOT com> #
|
||||
# #
|
||||
# This program is free software; you can redistribute it and/or #
|
||||
# modify it under the terms of the GNU General Public License #
|
||||
|
||||
@@ -0,0 +1,231 @@
|
||||
#
|
||||
# Copyright (c) 2006 by Eric Gach <eric.gach@gmail.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
import weechat
|
||||
import os
|
||||
import subprocess
|
||||
import traceback
|
||||
|
||||
__desc__ = 'Amarok control and now playing script for Weechat.'
|
||||
__version__ = '1.0.2'
|
||||
__author__ = 'Eric Gach <eric.gach@gmail.com>'
|
||||
# With changes by Leonid Evdokimov (weechat at darkk dot net another dot ru):
|
||||
# http://darkk.net.ru/weechat/amarok.py
|
||||
# v 1.0.1 - added %year%
|
||||
# v 1.0.2 - fixed bug with dead zombie-childs
|
||||
# fixed bug when loading second instance of the script
|
||||
# added better default for dcop_user setting
|
||||
|
||||
dcop = {}
|
||||
debug = {}
|
||||
infobar = {}
|
||||
output = {}
|
||||
ssh = {}
|
||||
|
||||
class amarokException(Exception):
|
||||
pass
|
||||
|
||||
def amarokCommand(server, args):
|
||||
try:
|
||||
args = args.split(' ')
|
||||
if args[0] == 'infobar':
|
||||
if infobar['enabled']:
|
||||
infobar['enabled'] = False
|
||||
weechat.set_plugin_config('infobar_enabled', '0')
|
||||
weechat.remove_timer_handler('amarokInfobarUpdate')
|
||||
weechat.remove_infobar(0)
|
||||
weechat.prnt('Infobar disabled')
|
||||
else:
|
||||
infobar['enabled'] = True
|
||||
weechat.set_plugin_config('infobar_enabled', '1')
|
||||
amarokInfobarUpdate()
|
||||
weechat.add_timer_handler(infobar['update'], 'amarokInfobarUpdate')
|
||||
weechat.prnt('Infobar enabled')
|
||||
return weechat.PLUGIN_RC_OK
|
||||
elif args[0] == 'next':
|
||||
__executeCommand('next')
|
||||
weechat.prnt('Amarok: Playing next song.')
|
||||
return weechat.PLUGIN_RC_OK
|
||||
elif args[0] == 'np':
|
||||
return amarokNowPlaying(server)
|
||||
elif args[0] == 'pause':
|
||||
__executeCommand('pause')
|
||||
weechat.prnt('Amarok: Song paused.')
|
||||
return weechat.PLUGIN_RC_OK
|
||||
elif args[0] == 'play':
|
||||
__executeCommand('play')
|
||||
weechat.prnt('Amarok: Started playing.')
|
||||
return weechat.PLUGIN_RC_OK
|
||||
elif args[0] == 'prev':
|
||||
__executeCommand('prev')
|
||||
weechat.prnt('Amarok: Playing previous song.')
|
||||
return weechat.PLUGIN_RC_OK
|
||||
elif args[0] == 'stop':
|
||||
__executeCommand('stop')
|
||||
weechat.prnt('Amarok: Stop playing.')
|
||||
return weechat.PLUGIN_RC_OK
|
||||
elif args[0] == '':
|
||||
return amarokDisplayHelp(server)
|
||||
else:
|
||||
weechat.prnt('Amarok: Unknown command %s' % (args[0]), '', server)
|
||||
return weechat.PLUGIN_RC_OK
|
||||
except amarokException, ex:
|
||||
return weechat.PLUGIN_RC_KO
|
||||
except:
|
||||
file = open(debug['file'], 'w')
|
||||
traceback.print_exc(None, file)
|
||||
weechat.prnt('Unknown Exception encountered. Stack dumped to %s' % (debug['file']), '', server)
|
||||
return weechat.PLUGIN_RC_KO
|
||||
|
||||
def amarokDisplayHelp(server):
|
||||
weechat.prnt('%s - Version: %s' % (__desc__, __version__), '', server)
|
||||
weechat.prnt('Author: %s' % (__author__), '', server)
|
||||
weechat.prnt('', '', server)
|
||||
weechat.prnt('Commands Available', '', server)
|
||||
weechat.prnt(' /amarok next - Move to the next song in the playlist.', '', server)
|
||||
weechat.prnt(' /amarok np - Display currently playing song.', '', server)
|
||||
weechat.prnt(' /amarok play - Start playing music.', '', server)
|
||||
weechat.prnt(' /amarok pause - Toggle between pause/playing.', '', server)
|
||||
weechat.prnt(' /amarok prev - Move to the previous song in the playlist.', '', server)
|
||||
weechat.prnt(' /amarok stop - Stop playing music.', '', server)
|
||||
weechat.prnt(' /amarok infobar - Toggle the infobar display.', '', server)
|
||||
weechat.prnt('', '', server)
|
||||
weechat.prnt('Formatting', '', server)
|
||||
weechat.prnt(' %artist% - Replaced with the song artist.', '', server)
|
||||
weechat.prnt(' %title% - Replaced with the song title.', '', server)
|
||||
weechat.prnt(' %album% - Replaced with the song album.', '', server)
|
||||
weechat.prnt(' %year% - Replaced with the song year tag.', '', server)
|
||||
weechat.prnt(' %cTime% - Replaced with how long the song has been playing.', '', server)
|
||||
weechat.prnt(' %tTime% - Replaced with the length of the song.', '', server)
|
||||
weechat.prnt(' %bitrate% - Replaced with the bitrate of the song.', '', server)
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
def amarokInfobarUpdate():
|
||||
__loadSettings()
|
||||
if infobar['enabled'] == False:
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
isPlaying = __executeCommands((__dcopCommand('isPlaying'),))
|
||||
if isPlaying.strip() == 'false':
|
||||
weechat.print_infobar(infobar['update'], 'Amarok is not currently playing')
|
||||
return weechat.PLUGIN_RC_OK
|
||||
else:
|
||||
song = __getSongInfo()
|
||||
format = __formatNP(infobar['format'], song)
|
||||
weechat.print_infobar(infobar['update'], format)
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
|
||||
def amarokNowPlaying(server):
|
||||
__loadSettings()
|
||||
isPlaying = __executeCommands((__dcopCommand('isPlaying'),))
|
||||
if isPlaying.strip() == 'false':
|
||||
weechat.prnt('Amarok is not playing.', '', server)
|
||||
return weechat.PLUGIN_RC_KO
|
||||
else:
|
||||
song = __getSongInfo()
|
||||
format = __formatNP(output['format'], song)
|
||||
weechat.command(format)
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
def amarokUnload():
|
||||
"""Unload the plugin from weechat"""
|
||||
if infobar['enabled']:
|
||||
weechat.remove_infobar(0)
|
||||
weechat.remove_timer_handler('amarokInfobarUpdate')
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
def __formatNP(template, song):
|
||||
np = template.replace('%artist%', song['artist'])
|
||||
np = np.replace('%title%', song['title'])
|
||||
np = np.replace('%album%', song['album'])
|
||||
np = np.replace('%cTime%', song['cTime'])
|
||||
np = np.replace('%tTime%', song['tTime'])
|
||||
np = np.replace('%bitrate%', song['bitrate'])
|
||||
np = np.replace('%year%', song['year'])
|
||||
return np
|
||||
|
||||
def __dcopCommand(cmd):
|
||||
if dcop['user'] == ':':
|
||||
return 'dcop amarok player %s' % (cmd)
|
||||
else:
|
||||
return 'dcop --user %s amarok player %s' % (dcop['user'], cmd)
|
||||
|
||||
def __executeCommands(cmds):
|
||||
from subprocess import PIPE
|
||||
cmds = " && ".join(cmds)
|
||||
if ssh['enabled']:
|
||||
cmds = 'ssh -p %d %s@%s "%s"' % (ssh['port'], ssh['user'], ssh['host'], cmds)
|
||||
proc = subprocess.Popen(cmds, shell = True, stderr = PIPE, stdout = PIPE, close_fds = True)
|
||||
error = proc.stderr.read()
|
||||
if error != '':
|
||||
weechat.prnt(error)
|
||||
output = proc.stdout.read()
|
||||
proc.wait()
|
||||
return output
|
||||
|
||||
def __getSongInfo():
|
||||
"""Get the song information from amarok"""
|
||||
song = {}
|
||||
songs = __executeCommands(
|
||||
(
|
||||
__dcopCommand('artist'),
|
||||
__dcopCommand('title'),
|
||||
__dcopCommand('album'),
|
||||
__dcopCommand('currentTime'),
|
||||
__dcopCommand('totalTime'),
|
||||
__dcopCommand('bitrate'),
|
||||
__dcopCommand('year')
|
||||
)
|
||||
)
|
||||
|
||||
song['artist'], song['title'], song['album'], song['cTime'], song['tTime'], song['bitrate'], song['year'], empty = songs.split("\n")
|
||||
return song
|
||||
|
||||
def __loadSettings():
|
||||
dcop['user'] = __loadSetting('dcop_user', ':')
|
||||
debug['file'] = os.path.expanduser(__loadSetting('debug_file', '~/amarok_debug.txt'))
|
||||
infobar['enabled'] = __loadSetting('infobar_enabled', '0', 'bool')
|
||||
infobar['format'] = __loadSetting('infobar_format', 'Now Playing: %title% by %artist%')
|
||||
infobar['update'] = __loadSetting('infobar_update', '10', 'int')
|
||||
output['format'] = __loadSetting('output_format', '/me is listening to %C04%title%%C by %C03%artist%%C from %C12%album%%C [%cTime% of %tTime% @ %bitrate%kbps]')
|
||||
ssh['enabled'] = __loadSetting('ssh_enabled', '0', 'bool')
|
||||
ssh['host'] = __loadSetting('ssh_host', 'localhost')
|
||||
ssh['port'] = __loadSetting('ssh_port', '22', 'int')
|
||||
ssh['user'] = __loadSetting('ssh_user', 'user')
|
||||
|
||||
def __loadSetting(setting, default=None, type=None):
|
||||
value = weechat.get_plugin_config(setting)
|
||||
if value == '' and default != None:
|
||||
weechat.set_plugin_config(setting, default)
|
||||
value = default
|
||||
|
||||
if type == 'int' or type == 'bool':
|
||||
value = int(value)
|
||||
if type == 'bool':
|
||||
value = bool(value)
|
||||
|
||||
return value
|
||||
|
||||
if weechat.register('amarok', __version__, 'amarokUnload', __desc__):
|
||||
__loadSettings()
|
||||
if infobar['enabled']:
|
||||
amarokInfobarUpdate()
|
||||
weechat.add_timer_handler(infobar['update'], 'amarokInfobarUpdate')
|
||||
weechat.add_command_handler('amarok', 'amarokCommand', 'Manage amarok or display now playing information.', 'next|np|play|pause|prev|stop|infobar')
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
"""
|
||||
This script shows buffer list in infobar. Nothing more.
|
||||
It's inspired by `awl.pl` irssi script, but is less advanced. :)
|
||||
|
||||
The script is in the public domain.
|
||||
Leonid Evdokimov (weechat at darkk dot net dot ru)
|
||||
http://darkk.net.ru/weechat/awl.py
|
||||
"""
|
||||
|
||||
#######################################################################
|
||||
|
||||
import weechat
|
||||
|
||||
version = "0.1"
|
||||
# how often to refresh infobar
|
||||
timer_interval = 1
|
||||
|
||||
def cleanup():
|
||||
weechat.remove_infobar(-1)
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
def update_channels():
|
||||
the_string = [];
|
||||
buffers = weechat.get_buffer_info()
|
||||
if buffers != None:
|
||||
for index, buffer in buffers.iteritems():
|
||||
#**** info for buffer no 8 ****
|
||||
# > log_filename, notify_level, server, num_displayed, type, channel
|
||||
if len(buffer['channel']):
|
||||
name = buffer['channel']
|
||||
elif len(buffer['server']):
|
||||
name = "[" + buffer['server'] + "]"
|
||||
else:
|
||||
name = "?"
|
||||
the_string.append("%i:%s" % (index, name))
|
||||
the_string = " ".join(the_string)
|
||||
weechat.remove_infobar(-1)
|
||||
weechat.print_infobar(0, the_string);
|
||||
|
||||
def on_timer():
|
||||
update_channels()
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
if weechat.register("awl", version, "cleanup", "bufferlist in infobar"):
|
||||
#message handlers are called __before__ buflist is changed, so we don't use them
|
||||
weechat.add_timer_handler(timer_interval, "on_timer")
|
||||
update_channels()
|
||||
+601
-118
@@ -1,21 +1,35 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
Catapult by Stalwart <stlwrt@gmail.com>
|
||||
Licensed under GNU GPL 2
|
||||
"""
|
||||
|
||||
# Catapult v0.2 - less ordinary abuse generator
|
||||
# Copyright (C) 2007 Pavel Shevchuk <stlwrt@gmail.com>
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
import weechat
|
||||
import random
|
||||
|
||||
weechat.register("Catapult", "0.1", "", "Less ordinary abuse generator")
|
||||
weechat.register("Catapult", "0.2", "", "Less ordinary abuse generator.")
|
||||
weechat.add_command_handler("slap", "slapper", "Creative slapper", "<target>", "", "%n")
|
||||
weechat.add_command_handler("fortune", "fortune", "Fortune cookies!")
|
||||
weechat.add_command_handler("winjoke", "winjoke", "Windoze jokes")
|
||||
weechat.add_command_handler("linjoke", "linjoke", "Linux jokes")
|
||||
weechat.add_command_handler("give", "giver", "Creative giver", "<target>", "", "%n")
|
||||
weechat.add_command_handler("hate", "hater", "Creative hater", "<target>", "", "%n")
|
||||
weechat.add_command_handler("love", "lover", "Creative lover", "<target>", "", "%n")
|
||||
weechat.add_command_handler("dance", "dancer", "Creative dancer", "<target>", "", "%n")
|
||||
weechat.add_command_handler("excuse", "excuser", "BOFH excuses")
|
||||
weechat.add_command_handler("fortune", "fortune", "Fortune cookies!")
|
||||
weechat.add_command_handler("winjoke", "winjoke", "Windoze jokes")
|
||||
weechat.add_command_handler("linjoke", "linjoke", "Linux jokes")
|
||||
|
||||
# slapper
|
||||
def slapper(server, args):
|
||||
@@ -114,7 +128,9 @@ def slapper(server, args):
|
||||
"the Win2k Buglist",
|
||||
"a widescreen TV (it can damage your brain!)",
|
||||
"a chain saw",
|
||||
"a huge tree"
|
||||
"a huge tree",
|
||||
"a 50'' CRT monitor",
|
||||
"a warehouse (Quadratisch. Praktisch. Gut.)"
|
||||
]
|
||||
if args <> "":
|
||||
weechat.command("/me slaps %s with %s." % (args, random.choice(objects)))
|
||||
@@ -123,9 +139,579 @@ def slapper(server, args):
|
||||
weechat.prnt("You must specify target")
|
||||
return weechat.PLUGIN_RC_KO
|
||||
|
||||
# giver
|
||||
def giver(server, args):
|
||||
objects = [
|
||||
"a binary four",
|
||||
"a nice cup of SHUT THE FUCK UP",
|
||||
"an asskick",
|
||||
"a sign: 'Please kill yourself'",
|
||||
"a sign: 'Please go home now'",
|
||||
"an unlocked Grenade *tick tick BOOM*",
|
||||
"a gun - do it for mankind!"
|
||||
|
||||
]
|
||||
if args <> "":
|
||||
weechat.command("/me gives %s %s." % (args, random.choice(objects)))
|
||||
return weechat.PLUGIN_RC_OK
|
||||
else:
|
||||
weechat.prnt("You must specify target")
|
||||
return weechat.PLUGIN_RC_KO
|
||||
|
||||
# hater
|
||||
def hater(server, args):
|
||||
objects = [
|
||||
"so much, that he spits hellfire",
|
||||
"so much, that he want's to shoot someone",
|
||||
"SOOOO MUUUUCH!!!"
|
||||
|
||||
]
|
||||
if args <> "":
|
||||
weechat.command("/me hates %s %s." % (args, random.choice(objects)))
|
||||
return weechat.PLUGIN_RC_OK
|
||||
else:
|
||||
weechat.prnt("You must specify target")
|
||||
return weechat.PLUGIN_RC_KO
|
||||
|
||||
# lover
|
||||
def lover(server, args):
|
||||
actions = [
|
||||
"a *mwah*",
|
||||
"a wet kiss",
|
||||
"a tight and long hug",
|
||||
"an ass-squeeze",
|
||||
"a tight hug",
|
||||
"a wet kiss",
|
||||
"a nice, tight hug",
|
||||
"a kiss on the cheek",
|
||||
"a wet, french kiss",
|
||||
"a kiss",
|
||||
"a hug",
|
||||
"sex",
|
||||
"sweet romance",
|
||||
"some groping",
|
||||
"bed actions",
|
||||
"oral sex",
|
||||
"a porn-tape",
|
||||
"anal love",
|
||||
]
|
||||
if args <> "":
|
||||
weechat.command("/me cheers %s with %s.." % (args, random.choice(actions)))
|
||||
return weechat.PLUGIN_RC_OK
|
||||
else:
|
||||
weechat.prnt("You must specify target")
|
||||
return weechat.PLUGIN_RC_KO
|
||||
|
||||
# dancer
|
||||
def dancer(server, args):
|
||||
objects = [
|
||||
"used condoms",
|
||||
"condoms",
|
||||
"used tampons",
|
||||
"tampons",
|
||||
"roses",
|
||||
"rosebuds",
|
||||
"rice",
|
||||
"uncooked rice",
|
||||
"bananas",
|
||||
"little pieces of paper with the text *YAY!* on",
|
||||
"little pieces of paper with the text *w00t!* on",
|
||||
"little pieces of paper with the text *WOOHOO!* on",
|
||||
"little pieces of paper with the text *Kiss my cheek!* on",
|
||||
"coconuts with faces on",
|
||||
"little pieces of paper with the text *LOVE ROCKS!* on",
|
||||
"little pieces of paper with the text *LETS HAVE SEX!* on",
|
||||
"little pieces of paper with the text *GOD BLESS AMERICA!* on",
|
||||
"balloons with faces on",
|
||||
"balloons",
|
||||
"chocolate cakes",
|
||||
"english teachers",
|
||||
"pr0n magazines",
|
||||
"vietnamese kids",
|
||||
"snowballs",
|
||||
"rocks",
|
||||
"Michael Jackson (naked)",
|
||||
"unlocked Grenades *BOOM*",
|
||||
"Nine Inch Nails",
|
||||
"Bodyparts (bloody, wet & sexy)",
|
||||
]
|
||||
if args <> "":
|
||||
weechat.command("/me dances around %s throwing %s.." % (args, random.choice(objects)))
|
||||
return weechat.PLUGIN_RC_OK
|
||||
else:
|
||||
weechat.prnt("You must specify target")
|
||||
return weechat.PLUGIN_RC_KO
|
||||
|
||||
# BOFH excuser
|
||||
def excuser(server, args):
|
||||
excuses = [
|
||||
"clock speed",
|
||||
"solar flares",
|
||||
"electromagnetic radiation from satellite debris",
|
||||
"static from nylon underwear",
|
||||
"static from plastic slide rules",
|
||||
"global warming",
|
||||
"poor power conditioning",
|
||||
"static buildup",
|
||||
"doppler effect",
|
||||
"hardware stress fractures",
|
||||
"magnetic interference from money/credit cards",
|
||||
"dry joints on cable plug",
|
||||
"we're waiting for [the phone company] to fix that line",
|
||||
"sounds like a Windows problem, try calling Microsoft support",
|
||||
"temporary routing anomaly",
|
||||
"somebody was calculating pi on the server",
|
||||
"fat electrons in the lines",
|
||||
"excess surge protection",
|
||||
"floating point processor overflow",
|
||||
"divide-by-zero error",
|
||||
"POSIX compliance problem",
|
||||
"monitor resolution too high",
|
||||
"improperly oriented keyboard",
|
||||
"network packets travelling uphill (use a carrier pigeon)",
|
||||
"Decreasing electron flux",
|
||||
"first Saturday after first full moon in Winter",
|
||||
"radiosity depletion",
|
||||
"CPU radiator broken",
|
||||
"It works the way the Wang did, what's the problem",
|
||||
"positron router malfunction",
|
||||
"cellular telephone interference",
|
||||
"techtonic stress",
|
||||
"piezo-electric interference",
|
||||
"(l)user error",
|
||||
"working as designed",
|
||||
"dynamic software linking table corrupted",
|
||||
"heavy gravity fluctuation, move computer to floor rapidly",
|
||||
"secretary plugged hairdryer into UPS",
|
||||
"terrorist activities",
|
||||
"not enough memory, go get system upgrade",
|
||||
"interrupt configuration error",
|
||||
"spaghetti cable cause packet failure",
|
||||
"boss forgot system password",
|
||||
"bank holiday - system operating credits not recharged",
|
||||
"virus attack, luser responsible",
|
||||
"waste water tank overflowed onto computer",
|
||||
"Complete Transient Lockout",
|
||||
"bad ether in the cables",
|
||||
"Bogon emissions",
|
||||
"Change in Earth's rotational speed",
|
||||
"Cosmic ray particles crashed through the hard disk platter",
|
||||
"Smell from unhygienic janitorial staff wrecked the tape heads",
|
||||
"Little hamster in running wheel had coronary; waiting for replacement to be Fedexed from Wyoming",
|
||||
"Evil dogs hypnotised the night shift",
|
||||
"Plumber mistook routing panel for decorative wall fixture",
|
||||
"Electricians made popcorn in the power supply",
|
||||
"Groundskeepers stole the root password",
|
||||
"high pressure system failure",
|
||||
"failed trials, system needs redesigned",
|
||||
"system has been recalled",
|
||||
"not approved by the FCC",
|
||||
"need to wrap system in aluminum foil to fix problem",
|
||||
"not properly grounded, please bury computer",
|
||||
"CPU needs recalibration",
|
||||
"system needs to be rebooted",
|
||||
"bit bucket overflow",
|
||||
"descramble code needed from software company",
|
||||
"only available on a need to know basis",
|
||||
"knot in cables caused data stream to become twisted and kinked",
|
||||
"nesting roaches shorted out the ether cable",
|
||||
"The file system is full of it",
|
||||
"Satan did it",
|
||||
"Daemons did it",
|
||||
"You're out of memory",
|
||||
"There isn't any problem",
|
||||
"Unoptimized hard drive",
|
||||
"Typo in the code",
|
||||
"Yes, yes, its called a design limitation",
|
||||
"Look, buddy: Windows 3.1 IS A General Protection Fault.",
|
||||
"That's a great computer you have there; have you considered how it would work as a BSD machine?",
|
||||
"Please excuse me, I have to circuit an AC line through my head to get this database working.",
|
||||
"Yeah, yo mama dresses you funny and you need a mouse to delete files.",
|
||||
"Support staff hung over, send aspirin and come back LATER.",
|
||||
"Someone is standing on the ethernet cable, causing a kink in the cable",
|
||||
"Windows 95 undocumented \"feature\"",
|
||||
"Runt packets",
|
||||
"Password is too complex to decrypt",
|
||||
"Boss' kid fucked up the machine",
|
||||
"Electromagnetic energy loss",
|
||||
"Budget cuts",
|
||||
"Mouse chewed through power cable",
|
||||
"Stale file handle (next time use Tupperware(tm)!)",
|
||||
"Feature not yet implemented",
|
||||
"Internet outage",
|
||||
"Pentium FDIV bug",
|
||||
"Vendor no longer supports the product",
|
||||
"Small animal kamikaze attack on power supplies",
|
||||
"The vendor put the bug there.",
|
||||
"SIMM crosstalk.",
|
||||
"IRQ dropout",
|
||||
"Collapsed Backbone",
|
||||
"Power company testing new voltage spike (creation) equipment",
|
||||
"operators on strike due to broken coffee machine",
|
||||
"backup tape overwritten with copy of system manager's favourite CD",
|
||||
"UPS interrupted the server's power",
|
||||
"The electrician didn't know what the yellow cable was so he yanked the ethernet out.",
|
||||
"The keyboard isn't plugged in",
|
||||
"The air conditioning water supply pipe ruptured over the machine room",
|
||||
"The electricity substation in the car park blew up.",
|
||||
"The rolling stones concert down the road caused a brown out",
|
||||
"The salesman drove over the CPU board.",
|
||||
"The monitor is plugged into the serial port",
|
||||
"Root nameservers are out of sync",
|
||||
"electro-magnetic pulses from French above ground nuke testing.",
|
||||
"your keyboard's space bar is generating spurious keycodes.",
|
||||
"the real ttys became pseudo ttys and vice-versa.",
|
||||
"the printer thinks its a router.",
|
||||
"the router thinks its a printer.",
|
||||
"evil hackers from Serbia.",
|
||||
"we just switched to FDDI.",
|
||||
"halon system went off and killed the operators.",
|
||||
"because Bill Gates is a Jehovah's witness and so nothing can work on St. Swithin's day.",
|
||||
"user to computer ratio too high.",
|
||||
"user to computer ration too low.",
|
||||
"we just switched to Sprint.",
|
||||
"it has Intel Inside",
|
||||
"Sticky bits on disk.",
|
||||
"Power Company having EMP problems with their reactor",
|
||||
"The ring needs another token",
|
||||
"new management",
|
||||
"telnet: Unable to connect to remote host: Connection refused",
|
||||
"SCSI Chain overterminated",
|
||||
"It's not plugged in.",
|
||||
"because of network lag due to too many people playing deathmatch",
|
||||
"You put the disk in upside down.",
|
||||
"Daemons loose in system.",
|
||||
"User was distributing pornography on server; system seized by FBI.",
|
||||
"BNC (brain not connected)",
|
||||
"UBNC (user brain not connected)",
|
||||
"LBNC (luser brain not connected)",
|
||||
"disks spinning backwards - toggle the hemisphere jumper.",
|
||||
"new guy cross-connected phone lines with ac power bus.",
|
||||
"had to use hammer to free stuck disk drive heads.",
|
||||
"Too few computrons available.",
|
||||
"Flat tire on station wagon with tapes. (\"Never underestimate the bandwidth of a station wagon full of tapes hurling down the highway\" Andrew S. Tannenbaum) ",
|
||||
"Communications satellite used by the military for star wars.",
|
||||
"Party-bug in the Aloha protocol.",
|
||||
"Insert coin for new game",
|
||||
"Dew on the telephone lines.",
|
||||
"Arcserve crashed the server again.",
|
||||
"Some one needed the powerstrip, so they pulled the switch plug.",
|
||||
"My pony-tail hit the on/off switch on the power strip.",
|
||||
"Big to little endian conversion error",
|
||||
"You can tune a file system, but you can't tune a fish (from most tunefs man pages)",
|
||||
"Dumb terminal",
|
||||
"Zombie processes haunting the computer",
|
||||
"Incorrect time synchronization",
|
||||
"Defunct processes",
|
||||
"Stubborn processes",
|
||||
"non-redundant fan failure ",
|
||||
"monitor VLF leakage",
|
||||
"bugs in the RAID",
|
||||
"no \"any\" key on keyboard",
|
||||
"root rot",
|
||||
"Backbone Scoliosis",
|
||||
"/pub/lunch",
|
||||
"excessive collisions & not enough packet ambulances",
|
||||
"le0: no carrier: transceiver cable problem?",
|
||||
"broadcast packets on wrong frequency",
|
||||
"popper unable to process jumbo kernel",
|
||||
"NOTICE: alloc: /dev/null: filesystem full",
|
||||
"pseudo-user on a pseudo-terminal",
|
||||
"Recursive traversal of loopback mount points",
|
||||
"Backbone adjustment",
|
||||
"OS swapped to disk",
|
||||
"vapors from evaporating sticky-note adhesives",
|
||||
"sticktion",
|
||||
"short leg on process table",
|
||||
"multicasts on broken packets",
|
||||
"ether leak",
|
||||
"Atilla the Hub",
|
||||
"endothermal recalibration",
|
||||
"filesystem not big enough for Jumbo Kernel Patch",
|
||||
"loop found in loop in redundant loopback",
|
||||
"system consumed all the paper for paging",
|
||||
"permission denied",
|
||||
"Reformatting Page. Wait...",
|
||||
"..disk or the processor is on fire.",
|
||||
"SCSI's too wide.",
|
||||
"Proprietary Information.",
|
||||
"Just type 'mv * /dev/null'.",
|
||||
"runaway cat on system.",
|
||||
"Did you pay the new Support Fee?",
|
||||
"We only support a 1200 bps connection.",
|
||||
"We only support a 28000 bps connection.",
|
||||
"Me no internet, only janitor, me just wax floors.",
|
||||
"I'm sorry a pentium won't do, you need an SGI to connect with us.",
|
||||
"Post-it Note Sludge leaked into the monitor.",
|
||||
"the curls in your keyboard cord are losing electricity.",
|
||||
"The monitor needs another box of pixels.",
|
||||
"RPC_PMAP_FAILURE",
|
||||
"kernel panic: write-only-memory (/dev/wom0) capacity exceeded.",
|
||||
"Write-only-memory subsystem too slow for this machine. Contact your local dealer.",
|
||||
"Just pick up the phone and give modem connect sounds. \"Well you said we should get more lines so we don't have voice lines.\"",
|
||||
"Quantum dynamics are affecting the transistors",
|
||||
"Police are examining all internet packets in the search for a narco-net-trafficker",
|
||||
"We are currently trying a new concept of using a live mouse. Unfortunately, one has yet to survive being hooked up to the computer.....please bear with us.",
|
||||
"Your mail is being routed through Germany ... and they're censoring us.",
|
||||
"Only people with names beginning with 'A' are getting mail this week (a la Microsoft)",
|
||||
"We didn't pay the Internet bill and it's been cut off.",
|
||||
"Lightning strikes.",
|
||||
"Of course it doesn't work. We've performed a software upgrade.",
|
||||
"Change your language to Finnish.",
|
||||
"Fluorescent lights are generating negative ions. If turning them off doesn't work, take them out and put tin foil on the ends.",
|
||||
"High nuclear activity in your area.",
|
||||
"What office are you in? Oh, that one. Did you know that your building was built over the universities first nuclear research site? And wow, aren't you the lucky one, your office is right over where the core is buried!",
|
||||
"The MGs ran out of gas.",
|
||||
"The UPS doesn't have a battery backup.",
|
||||
"Recursivity. Call back if it happens again.",
|
||||
"Someone thought The Big Red Button was a light switch.",
|
||||
"The mainframe needs to rest. It's getting old, you know.",
|
||||
"I'm not sure. Try calling the Internet's head office -- it's in the book.",
|
||||
"The lines are all busy (busied out, that is -- why let them in to begin with?).",
|
||||
"Jan 9 16:41:27 huber su: 'su root' succeeded for .... on /dev/pts/1",
|
||||
"It's those computer people in X {city of world}. They keep stuffing things up.",
|
||||
"A star wars satellite accidently blew up the WAN.",
|
||||
"Fatal error right in front of screen",
|
||||
"That function is not currently supported, but Bill Gates assures us it will be featured in the next upgrade.",
|
||||
"wrong polarity of neutron flow",
|
||||
"Lusers learning curve appears to be fractal",
|
||||
"We had to turn off that service to comply with the CDA Bill.",
|
||||
"Ionization from the air-conditioning",
|
||||
"TCP/IP UDP alarm threshold is set too low.",
|
||||
"Someone is broadcasting pygmy packets and the router doesn't know how to deal with them.",
|
||||
"The new frame relay network hasn't bedded down the software loop transmitter yet. ",
|
||||
"Fanout dropping voltage too much, try cutting some of those little traces",
|
||||
"Plate voltage too low on demodulator tube",
|
||||
"You did wha... oh _dear_....",
|
||||
"CPU needs bearings repacked",
|
||||
"Too many little pins on CPU confusing it, bend back and forth until 10-20% are neatly removed. Do _not_ leave metal bits visible!",
|
||||
"_Rosin_ core solder? But...",
|
||||
"Software uses US measurements, but the OS is in metric...",
|
||||
"The computer fleetly, mouse and all.",
|
||||
"Your cat tried to eat the mouse.",
|
||||
"The Borg tried to assimilate your system. Resistance is futile.",
|
||||
"It must have been the lightning storm we had (yesterday) (last week) (last month)",
|
||||
"Due to Federal Budget problems we have been forced to cut back on the number of users able to access the system at one time. (namely none allowed....)",
|
||||
"Too much radiation coming from the soil.",
|
||||
"Unfortunately we have run out of bits/bytes/whatever. Don't worry, the next supply will be coming next week.",
|
||||
"Program load too heavy for processor to lift.",
|
||||
"Processes running slowly due to weak power supply",
|
||||
"Our ISP is having {switching,routing,SMDS,frame relay} problems",
|
||||
"We've run out of licenses",
|
||||
"Interference from lunar radiation",
|
||||
"Standing room only on the bus.",
|
||||
"You need to install an RTFM interface.",
|
||||
"That would be because the software doesn't work.",
|
||||
"That's easy to fix, but I can't be bothered.",
|
||||
"Someone's tie is caught in the printer, and if anything else gets printed, he'll be in it too.",
|
||||
"We're upgrading /dev/null",
|
||||
"The Usenet news is out of date",
|
||||
"Our POP server was kidnapped by a weasel.",
|
||||
"It's stuck in the Web.",
|
||||
"Your modem doesn't speak English.",
|
||||
"The mouse escaped.",
|
||||
"All of the packets are empty.",
|
||||
"The UPS is on strike.",
|
||||
"Neutrino overload on the nameserver",
|
||||
"Melting hard drives",
|
||||
"Someone has messed up the kernel pointers",
|
||||
"The kernel license has expired",
|
||||
"Netscape has crashed",
|
||||
"The cord jumped over and hit the power switch.",
|
||||
"It was OK before you touched it.",
|
||||
"Bit rot",
|
||||
"U.S. Postal Service",
|
||||
"Your Flux Capacitor has gone bad.",
|
||||
"The Dilithium Crystals need to be rotated.",
|
||||
"The static electricity routing is acting up...",
|
||||
"Traceroute says that there is a routing problem in the backbone. It's not our problem.",
|
||||
"The co-locator cannot verify the frame-relay gateway to the ISDN server.",
|
||||
"High altitude condensation from U.S.A.F prototype aircraft has contaminated the primary subnet mask. Turn off your computer for 9 days to avoid damaging it.",
|
||||
"Lawn mower blade in your fan need sharpening",
|
||||
"Electrons on a bender",
|
||||
"Telecommunications is upgrading. ",
|
||||
"Telecommunications is downgrading.",
|
||||
"Telecommunications is downshifting.",
|
||||
"Hard drive sleeping. Let it wake up on it's own...",
|
||||
"Interference between the keyboard and the chair.",
|
||||
"The CPU has shifted, and become decentralized.",
|
||||
"Due to the CDA, we no longer have a root account.",
|
||||
"We ran out of dial tone and we're and waiting for the phone company to deliver another bottle.",
|
||||
"You must've hit the wrong any key.",
|
||||
"PCMCIA slave driver",
|
||||
"The Token fell out of the ring. Call us when you find it.",
|
||||
"The hardware bus needs a new token.",
|
||||
"Too many interrupts",
|
||||
"Not enough interrupts",
|
||||
"The data on your hard drive is out of balance.",
|
||||
"Digital Manipulator exceeding velocity parameters",
|
||||
"appears to be a Slow/Narrow SCSI-0 Interface problem",
|
||||
"microelectronic Riemannian curved-space fault in write-only file system",
|
||||
"fractal radiation jamming the backbone",
|
||||
"routing problems on the neural net",
|
||||
"IRQ-problems with the Un-Interruptible-Power-Supply",
|
||||
"CPU-angle has to be adjusted because of vibrations coming from the nearby road",
|
||||
"emissions from GSM-phones",
|
||||
"CD-ROM server needs recalibration",
|
||||
"firewall needs cooling",
|
||||
"asynchronous inode failure",
|
||||
"transient bus protocol violation",
|
||||
"incompatible bit-registration operators",
|
||||
"your process is not ISO 9000 compliant",
|
||||
"You need to upgrade your VESA local bus to a MasterCard local bus.",
|
||||
"The recent proliferation of Nuclear Testing",
|
||||
"Elves on strike. (Why do they call EMAG Elf Magic)",
|
||||
"Internet exceeded Luser level, please wait until a luser logs off before attempting to log back on.",
|
||||
"Your EMAIL is now being delivered by the USPS.",
|
||||
"Your computer hasn't been returning all the bits it gets from the Internet.",
|
||||
"You've been infected by the Telescoping Hubble virus.",
|
||||
"Scheduled global CPU outage",
|
||||
"Your Pentium has a heating problem - try cooling it with ice cold water.(Do not turn off your computer, you do not want to cool down the Pentium Chip while he isn't working, do you?)",
|
||||
"Your processor has processed too many instructions. Turn it off immediately, do not type any commands!!",
|
||||
"Your packets were eaten by the terminator",
|
||||
"Your processor does not develop enough heat.",
|
||||
"We need a licensed electrician to replace the light bulbs in the computer room.",
|
||||
"The POP server is out of Coke",
|
||||
"Fiber optics caused gas main leak",
|
||||
"Server depressed, needs Prozac",
|
||||
"quantum decoherence",
|
||||
"those damn raccoons!",
|
||||
"suboptimal routing experience",
|
||||
"A plumber is needed, the network drain is clogged",
|
||||
"50% of the manual is in .pdf readme files",
|
||||
"the AA battery in the wallclock sends magnetic interference",
|
||||
"the xy axis in the trackball is coordinated with the summer solstice",
|
||||
"the butane lighter causes the pincushioning",
|
||||
"old inkjet cartridges emanate barium-based fumes",
|
||||
"manager in the cable duct",
|
||||
"We'll fix that in the next (upgrade, update, patch release, service pack).",
|
||||
"HTTPD Error 666 : BOFH was here",
|
||||
"HTTPD Error 4004 : very old Intel cpu - insufficient processing power",
|
||||
"The ATM board has run out of 10 pound notes. We are having a whip round to refill it, care to contribute ?",
|
||||
"Network failure - call NBC",
|
||||
"Having to manually track the satellite.",
|
||||
"Your/our computer(s) had suffered a memory leak, and we are waiting for them to be topped up.",
|
||||
"The rubber band broke",
|
||||
"We're on Token Ring, and it looks like the token got loose.",
|
||||
"Stray Alpha Particles from memory packaging caused Hard Memory Error on Server.",
|
||||
"paradigm shift...without a clutch",
|
||||
"PEBKAC (Problem Exists Between Keyboard And Chair)",
|
||||
"The cables are not the same length.",
|
||||
"Second-system effect.",
|
||||
"Chewing gum on /dev/sd3c",
|
||||
"Boredom in the Kernel.",
|
||||
"the daemons! the daemons! the terrible daemons!",
|
||||
"I'd love to help you -- it's just that the Boss won't let me near the computer. ",
|
||||
"struck by the Good Times virus",
|
||||
"YOU HAVE AN I/O ERROR -> Incompetent Operator error",
|
||||
"Your parity check is overdrawn and you're out of cache.",
|
||||
"Communist revolutionaries taking over the server room and demanding all the computers in the building or they shoot the sysadmin. Poor misguided fools.",
|
||||
"Plasma conduit breach",
|
||||
"Out of cards on drive D:",
|
||||
"Sand fleas eating the Internet cables",
|
||||
"parallel processors running perpendicular today",
|
||||
"ATM cell has no roaming feature turned on, notebooks can't connect",
|
||||
"Webmasters kidnapped by evil cult.",
|
||||
"Failure to adjust for daylight savings time.",
|
||||
"Virus transmitted from computer to sysadmins.",
|
||||
"Virus due to computers having unsafe sex.",
|
||||
"Incorrectly configured static routes on the corerouters.",
|
||||
"Forced to support NT servers; sysadmins quit.",
|
||||
"Suspicious pointer corrupted virtual machine",
|
||||
"It's the InterNIC's fault.",
|
||||
"Root name servers corrupted.",
|
||||
"Budget cuts forced us to sell all the power cords for the servers.",
|
||||
"Someone hooked the twisted pair wires into the answering machine.",
|
||||
"Operators killed by year 2000 bug bite.",
|
||||
"We've picked COBOL as the language of choice.",
|
||||
"Operators killed when huge stack of backup tapes fell over.",
|
||||
"Robotic tape changer mistook operator's tie for a backup tape.",
|
||||
"Someone was smoking in the computer room and set off the halon systems.",
|
||||
"Your processor has taken a ride to Heaven's Gate on the UFO behind Hale-Bopp's comet.",
|
||||
"it's an ID-10-T error",
|
||||
"Dyslexics retyping hosts file on servers",
|
||||
"The Internet is being scanned for viruses.",
|
||||
"Your computer's union contract is set to expire at midnight.",
|
||||
"Bad user karma.",
|
||||
"/dev/clue was linked to /dev/null",
|
||||
"Increased sunspot activity.",
|
||||
"We already sent around a notice about that.",
|
||||
"It's union rules. There's nothing we can do about it. Sorry.",
|
||||
"Interference from the Van Allen Belt.",
|
||||
"Jupiter is aligned with Mars.",
|
||||
"Redundant ACLs. ",
|
||||
"Mail server hit by UniSpammer.",
|
||||
"T-1's congested due to porn traffic to the news server.",
|
||||
"Data for intranet got routed through the extranet and landed on the internet.",
|
||||
"We are a 100% Microsoft Shop.",
|
||||
"We are Microsoft. What you are experiencing is not a problem; it is an undocumented feature.",
|
||||
"Sales staff sold a product we don't offer.",
|
||||
"Secretary sent chain letter to all 5000 employees.",
|
||||
"Sysadmin didn't hear pager go off due to loud music from bar-room speakers.",
|
||||
"Sysadmin accidentally destroyed pager with a large hammer.",
|
||||
"Sysadmins unavailable because they are in a meeting talking about why they are unavailable so much.",
|
||||
"Bad cafeteria food landed all the sysadmins in the hospital.",
|
||||
"Route flapping at the NAP.",
|
||||
"Computers under water due to SYN flooding.",
|
||||
"The vulcan-death-grip ping has been applied.",
|
||||
"Electrical conduits in machine room are melting.",
|
||||
"Traffic jam on the Information Superhighway.",
|
||||
"Radial Telemetry Infiltration",
|
||||
"Cow-tippers tipped a cow onto the server.",
|
||||
"tachyon emissions overloading the system",
|
||||
"Maintenance window broken",
|
||||
"We're out of slots on the server",
|
||||
"Computer room being moved. Our systems are down for the weekend.",
|
||||
"Sysadmins busy fighting SPAM.",
|
||||
"Repeated reboots of the system failed to solve problem",
|
||||
"Feature was not beta tested",
|
||||
"Domain controller not responding",
|
||||
"Someone else stole your IP address, call the Internet detectives!",
|
||||
"It's not RFC-822 compliant.",
|
||||
"operation failed because: there is no message for this error (#1014)",
|
||||
"stop bit received",
|
||||
"internet is needed to catch the etherbunny",
|
||||
"network down, IP packets delivered via UPS",
|
||||
"Firmware update in the coffee machine",
|
||||
"Temporal anomaly",
|
||||
"Mouse has out-of-cheese-error",
|
||||
"Borg implants are failing",
|
||||
"Borg nanites have infested the server",
|
||||
"error: one bad user found in front of screen",
|
||||
"Please state the nature of the technical emergency",
|
||||
"Internet shut down due to maintenance",
|
||||
"Daemon escaped from pentagram",
|
||||
"crop circles in the corn shell",
|
||||
"sticky bit has come loose",
|
||||
"Hot Java has gone cold",
|
||||
"Cache miss - please take better aim next time",
|
||||
"Hash table has woodworm",
|
||||
"Trojan horse ran out of hay",
|
||||
"Zombie processes detected, machine is haunted.",
|
||||
"overflow error in /dev/null",
|
||||
"Browser's cookie is corrupted -- someone's been nibbling on it.",
|
||||
"Mailer-daemon is busy burning your message in hell.",
|
||||
"According to Microsoft, it's by design",
|
||||
"vi needs to be upgraded to vii",
|
||||
"greenpeace free'd the mallocs",
|
||||
"Terrorists crashed an airplane into the server room, have to remove /bin/laden. (rm -rf /bin/laden)",
|
||||
"astropneumatic oscillations in the water-cooling",
|
||||
"Somebody ran the operating system through a spelling checker.",
|
||||
"Rhythmic variations in the voltage reaching the power supply.",
|
||||
"Keyboard Actuator Failure. Order and Replace.",
|
||||
"Packet held up at customs.",
|
||||
"Propagation delay.",
|
||||
"High line impedance.",
|
||||
"Someone set us up the bomb.",
|
||||
"Power surges on the Underground."
|
||||
]
|
||||
weechat.command(random.choice(excuses))
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
|
||||
# fortune cookies
|
||||
def fortune(server, args):
|
||||
objects = [
|
||||
fortunes = [
|
||||
"There are three kinds of people: men, women, and unix.",
|
||||
"BOFH Excuse #118: the router thinks its a printer.",
|
||||
"CHUBBY CHECKER just had a CHICKEN SANDWICH in downtown DULUTH!",
|
||||
@@ -242,12 +828,12 @@ def fortune(server, args):
|
||||
"Tact, n.: The unsaid part of what you're thinking.",
|
||||
"Shit Happens."
|
||||
]
|
||||
weechat.command(("Wanda the Fish says: %s") % random.choice(objects))
|
||||
weechat.command(("Wanda the Fish says: %s") % random.choice(fortunes))
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
# winjoke
|
||||
def winjoke(server, args):
|
||||
objects = [
|
||||
winjokes = [
|
||||
"Windows NT, from the people who invented EDLIN!",
|
||||
"Windows: Microsoft's tax on computer illiterates.",
|
||||
"The nice thing about Windows is - It does not just crash, it displays a dialog box and lets you press 'OK' first.",
|
||||
@@ -291,12 +877,12 @@ def winjoke(server, args):
|
||||
"Microsoft Zen - Become one with the blue screen.",
|
||||
"The next hot technology from Microsoft will be object-oriented assembly."
|
||||
]
|
||||
weechat.command(("Wanda the Fish says: %s") % random.choice(objects))
|
||||
weechat.command(("Wanda the Fish says: %s") % random.choice(winjokes))
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
# linjoke
|
||||
def linjoke(server, args):
|
||||
objects = [
|
||||
linjokes = [
|
||||
"Got Linux?",
|
||||
"Microsoft gives you Windows... Linux gives you the whole house.",
|
||||
"Linux, DOS, Windows NT -- The Good, the Bad, and the Ugly",
|
||||
@@ -322,108 +908,5 @@ def linjoke(server, args):
|
||||
"Oh My God! They Killed init! You Bastards!",
|
||||
"Unix: Where /sbin/init is still Job 1."
|
||||
]
|
||||
weechat.command(("Wanda the Fish says: %s") % random.choice(objects))
|
||||
weechat.command(("Wanda the Fish says: %s") % random.choice(linjokes))
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
# giver
|
||||
def giver(server, args):
|
||||
objects = [
|
||||
"a binary four",
|
||||
"a nice cup of SHUT THE FUCK UP",
|
||||
"an asskick",
|
||||
"a sign: 'Please kill yourself'",
|
||||
"a sign: 'Please go home now'",
|
||||
"an unlocked Grenade *tick tick BOOM*",
|
||||
"a gun - do it for mankind!"
|
||||
|
||||
]
|
||||
if args <> "":
|
||||
weechat.command("/me gives %s %s." % (args, random.choice(objects)))
|
||||
return weechat.PLUGIN_RC_OK
|
||||
else:
|
||||
weechat.prnt("You must specify target")
|
||||
return weechat.PLUGIN_RC_KO
|
||||
|
||||
# hater
|
||||
def hater(server, args):
|
||||
objects = [
|
||||
"so much, that he spits hellfire",
|
||||
"so much, that he want's to shoot someone",
|
||||
"SOOOO MUUUUCH!!!"
|
||||
|
||||
]
|
||||
if args <> "":
|
||||
weechat.command("/me hates %s %s." % (args, random.choice(objects)))
|
||||
return weechat.PLUGIN_RC_OK
|
||||
else:
|
||||
weechat.prnt("You must specify target")
|
||||
return weechat.PLUGIN_RC_KO
|
||||
|
||||
# lover
|
||||
def lover(server, args):
|
||||
actions = [
|
||||
"a *mwah*",
|
||||
"a wet kiss",
|
||||
"a tight and long hug",
|
||||
"an ass-squeeze",
|
||||
"a tight hug",
|
||||
"a wet kiss",
|
||||
"a nice, tight hug",
|
||||
"a kiss on the cheek",
|
||||
"a wet, french kiss",
|
||||
"a kiss",
|
||||
"a hug",
|
||||
"sex",
|
||||
"sweet romance",
|
||||
"some groping",
|
||||
"bed actions",
|
||||
"oral sex",
|
||||
"a porn-tape",
|
||||
"anal love",
|
||||
]
|
||||
if args <> "":
|
||||
weechat.command("/me cheers %s with %s.." % (args, random.choice(actions)))
|
||||
return weechat.PLUGIN_RC_OK
|
||||
else:
|
||||
weechat.prnt("You must specify target")
|
||||
return weechat.PLUGIN_RC_KO
|
||||
|
||||
# dancer
|
||||
def dancer(server, args):
|
||||
objects = [
|
||||
"used condoms",
|
||||
"condoms",
|
||||
"used tampons",
|
||||
"tampons",
|
||||
"roses",
|
||||
"rosebuds",
|
||||
"rice",
|
||||
"uncooked rice",
|
||||
"bananas",
|
||||
"little pieces of paper with the text *YAY!* on",
|
||||
"little pieces of paper with the text *w00t!* on",
|
||||
"little pieces of paper with the text *WOOHOO!* on",
|
||||
"little pieces of paper with the text *Kiss my cheek!* on",
|
||||
"coconuts with faces on",
|
||||
"little pieces of paper with the text *LOVE ROCKS!* on",
|
||||
"little pieces of paper with the text *LETS HAVE SEX!* on",
|
||||
"little pieces of paper with the text *GOD BLESS AMERICA!* on",
|
||||
"balloons with faces on",
|
||||
"balloons",
|
||||
"chocolate cakes",
|
||||
"english teachers",
|
||||
"pr0n magazines",
|
||||
"vietnamese kids",
|
||||
"snowballs",
|
||||
"rocks",
|
||||
"Michael Jackson (naked)",
|
||||
"unlocked Grenades *BOOM*",
|
||||
"Nine Inch Nails",
|
||||
"Bodyparts (bloody, wet & sexy)",
|
||||
]
|
||||
if args <> "":
|
||||
weechat.command("/me dances around %s throwing %s.." % (args, random.choice(objects)))
|
||||
return weechat.PLUGIN_RC_OK
|
||||
else:
|
||||
weechat.prnt("You must specify target")
|
||||
return weechat.PLUGIN_RC_KO
|
||||
|
||||
+20
-7
@@ -15,9 +15,10 @@
|
||||
|
||||
Hope you enjoy it :-)
|
||||
-- Henning aka asmanian
|
||||
-- Leonid Evdokimov (weechat at darkk dot net one more dot ru)
|
||||
"""
|
||||
|
||||
version = "0.8"
|
||||
version = "0.9"
|
||||
history = """
|
||||
0.1 initial
|
||||
0.2
|
||||
@@ -35,6 +36,8 @@ history = """
|
||||
- added multi-server support
|
||||
0.8
|
||||
- fixed on_msg (occasionally caused a minor fault)
|
||||
0.9
|
||||
- added dump_to_servchan and dump_to_current setting
|
||||
"""
|
||||
|
||||
short_syntax = """[REQUEST ANSWER]"""
|
||||
@@ -65,13 +68,20 @@ syntax = """ Examples:
|
||||
import weechat as wc
|
||||
import re
|
||||
|
||||
wc.register("ctcp", version, "", "Customize CTCP replies")
|
||||
wc.add_command_handler("set_ctcp", "set", "", short_syntax, syntax)
|
||||
wc.add_message_handler("privmsg", "on_msg")
|
||||
if wc.register("ctcp", version, "", "Customize CTCP replies"):
|
||||
wc.add_command_handler("set_ctcp", "set", "", short_syntax, syntax)
|
||||
wc.add_message_handler("privmsg", "on_msg")
|
||||
|
||||
if not wc.get_plugin_config("requests"):
|
||||
wc.set_plugin_config("requests", " ".join(["VERSION", "USERINFO", "FINGER", "TIME", "PING"]))
|
||||
if not wc.get_plugin_config("requests"):
|
||||
wc.set_plugin_config("requests", " ".join(["VERSION", "USERINFO", "FINGER", "TIME", "PING"]))
|
||||
|
||||
for key, default in {'dump_to_servchan': 'OFF', 'dump_to_current': 'ON'}.iteritems():
|
||||
value = wc.get_plugin_config(key)
|
||||
if not value in ['ON', 'OFF']:
|
||||
if value:
|
||||
wc.prnt("[ctcp]: invalid %s value, resetting to %s" % (key, default))
|
||||
wc.set_plugin_config(key, default)
|
||||
|
||||
def get_answers():
|
||||
# Strangely, get_plugin_config sometimes returns
|
||||
# the integer 0
|
||||
@@ -125,7 +135,10 @@ def on_msg(server, args):
|
||||
l, r = match.span()
|
||||
ans = ans[:l+1] + info.get(match.group(1), "$" + match.group(1)) + ans[r:]
|
||||
|
||||
wc.prnt("CTCP %s received from %s (on %s)" % (req, source, server))
|
||||
if wc.get_plugin_config("dump_to_servchan") == 'ON':
|
||||
wc.prnt("CTCP %s received from %s (on %s)" % (req, source, server), server)
|
||||
if wc.get_plugin_config("dump_to_current") == 'ON':
|
||||
wc.prnt("CTCP %s received from %s (on %s)" % (req, source, server))
|
||||
wc.command("/quote NOTICE %s :\x01%s %s\x01" % (
|
||||
source, req, ans), "", server)
|
||||
return wc.PLUGIN_RC_OK_IGNORE_ALL
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
"""
|
||||
:Author: Tim Schumacher <tim AT we-are-teh-b DOT org>
|
||||
|
||||
:What it does:
|
||||
This script informs the active window of your last
|
||||
submitted song at last.fm
|
||||
|
||||
:Usage:
|
||||
/np - Displays your last submitted song.
|
||||
|
||||
:Configuration Variables:
|
||||
============= ==========================================
|
||||
Variable name Meaning
|
||||
============= ==========================================
|
||||
lastfmuser Your username at last.fm
|
||||
|
||||
Released under GPL licence.
|
||||
"""
|
||||
#!/usr/bin/python
|
||||
|
||||
todo = """
|
||||
- Realy check if a song was recent.
|
||||
- Define 'recent' through a userdefinedvar
|
||||
- Add more help
|
||||
|
||||
"""
|
||||
|
||||
import urllib
|
||||
import weechat as wc
|
||||
|
||||
wc.register("lastfmnp", "0.2.1", "", "now playing for last.fm")
|
||||
|
||||
def getLastSong(server, args):
|
||||
"""
|
||||
Provides your last submitted song in last.fm to the actual context
|
||||
"""
|
||||
user = wc.get_plugin_config("lastfmuser")
|
||||
url = "http://ws.audioscrobbler.com/1.0/user/" + user + "/recenttracks.txt"
|
||||
url_handle = urllib.urlopen(url)
|
||||
lines = url_handle.readlines()
|
||||
song = lines[0].split(",")[1].replace("\n","");
|
||||
if song == '':
|
||||
song = 'nothing :-)';
|
||||
wc.command("np: " + song)
|
||||
return 0
|
||||
|
||||
|
||||
wc.add_command_handler("np", "getLastSong")
|
||||
|
||||
default = {
|
||||
"lastfmuser": "timds235"
|
||||
}
|
||||
|
||||
for k, v in default.items():
|
||||
if not wc.get_plugin_config(k):
|
||||
wc.set_plugin_config(k, v)
|
||||
@@ -0,0 +1,36 @@
|
||||
# mp3blaster nowplaying script by Stalwart <stlwrt@gmail.com>
|
||||
# written for Caleb
|
||||
# released under GNU GPL v2 or newer
|
||||
|
||||
import weechat
|
||||
from os.path import expandvars, expanduser
|
||||
|
||||
def mp3blasternp(server, args):
|
||||
try:
|
||||
statusfile = open(expandvars(expanduser(weechat.get_plugin_config('statusfile'))), 'rU')
|
||||
info = statusfile.readlines()
|
||||
statusfile.close()
|
||||
artist = title = path = ''
|
||||
for line in info:
|
||||
if (line.split()[0] == 'artist'):
|
||||
artist = line.strip(' \n')[7:]
|
||||
elif (line.split()[0] == 'title'):
|
||||
title = line.strip(' \n')[6:]
|
||||
elif (line.split()[0] == 'path'):
|
||||
path = line.strip(' \n')[5:]
|
||||
if (title):
|
||||
if (artist):
|
||||
weechat.command('/me np: '+artist+' - '+title)
|
||||
else:
|
||||
weechat.command('/me np: '+title)
|
||||
else:
|
||||
weechat.command('/me np: '+path)
|
||||
except:
|
||||
if (weechat.get_plugin_config('statusfile') == ''):
|
||||
weechat.set_plugin_config('statusfile', '~/.mp3blasterstatus')
|
||||
weechat.prnt('mp3blaster status file not found. Set proper using /setp python.mp3blaster.statusfile = /path/to/file')
|
||||
|
||||
return 0
|
||||
|
||||
weechat.register ('mp3blaster', '1.0', '', 'Posts track now played by mp3blaster')
|
||||
weechat.add_command_handler ('np', 'mp3blasternp')
|
||||
@@ -0,0 +1,289 @@
|
||||
"""
|
||||
Response: Simple autoresponse script for WeeChat
|
||||
Author: Christian Taylor <cht@chello.at>
|
||||
License: GPL version 2 or later
|
||||
"""
|
||||
|
||||
version = "0.1"
|
||||
|
||||
helptext = """ /response list
|
||||
Displays a list of your current responses.
|
||||
|
||||
/response toggle <number>
|
||||
Activates or deactivates response with the specified number.
|
||||
|
||||
/response delete <number>
|
||||
Deletes response with the specified number.
|
||||
|
||||
/response add "<message-regexp>" "<command>"
|
||||
Adds a response that executes <command> when it encounters a message matching
|
||||
the specified regular expression in any channel.
|
||||
<command> can be an actual command to be executed (for instance "/nick xyz")
|
||||
or a simple text (for instance "xyz") which is then posted to the channel.
|
||||
The following sequences are replaced in <command>:
|
||||
\\nick => nickname of the user that triggered the response
|
||||
\\mask => hostmask of the user that triggered the response
|
||||
\\channel => name of the channel in which the response was triggered
|
||||
\\<number> => matches of the message regular expression subgroups, \\0 for whole match
|
||||
$<number> => whitespace-separated word number <number> of the whole triggering message
|
||||
(starts with 0; negative numbers count from the last word)
|
||||
|
||||
/response add "<hostmask-regexp>" "<channel-regexp>" "<message-regexp>" "<command>"
|
||||
Same as above, but only triggers if hostmask and channel match the given additional regexps.
|
||||
Blank regexps ("") will trigger for any hostmask and/or channel.
|
||||
|
||||
Examples:
|
||||
/response add "^!whoami" "/msg \\channel You are \\nick (\\mask) in \\channel!"
|
||||
/response add "^!make (.*)" "/msg \\channel No rule for \\1. Stop."
|
||||
/response add "somebody@somehost" "" "^!op" "/op \\nick"
|
||||
"""
|
||||
|
||||
import weechat, sys, re, pickle
|
||||
|
||||
weechat.register("Response", version, "", "Execute commands on specific triggers")
|
||||
|
||||
weechat.add_message_handler("privmsg", "triggercheck")
|
||||
weechat.add_command_handler("response", "triggercontrol", " Allows you to view, add and delete responses:", "<operation>", helptext, "add|delete|list|toggle")
|
||||
|
||||
debug = 0
|
||||
|
||||
t_enabled = 0
|
||||
t_nick = 1
|
||||
t_channel = 2
|
||||
t_trigger = 3
|
||||
t_reaction = 4
|
||||
t_outstream = 5
|
||||
|
||||
def triggercheck(server, args):
|
||||
null, context, message = args.split(":", 2)
|
||||
mask, null, channel = context.strip().split(" ", 2)
|
||||
nick, whois = mask.split("!", 1)
|
||||
|
||||
if debug: tell("Server: " + server + " | Mask: " + mask + " | Channel: " + channel + " | Message: " + message, server)
|
||||
|
||||
for trigger in triggerlist:
|
||||
if trigger[t_enabled]:
|
||||
if trigger[t_channel]:
|
||||
channelmatch = re.compile(trigger[t_channel]).search(channel)
|
||||
else:
|
||||
channelmatch = True
|
||||
|
||||
if channelmatch and trigger[t_nick]:
|
||||
nickmatch = re.compile(trigger[t_nick]).search(whois)
|
||||
else:
|
||||
nickmatch = True
|
||||
|
||||
if channelmatch and nickmatch and trigger[t_trigger]:
|
||||
messagematch = re.compile(trigger[t_trigger]).search(message)
|
||||
else:
|
||||
messagematch = False
|
||||
|
||||
if channelmatch and nickmatch and messagematch:
|
||||
reaction = trigger[t_reaction]
|
||||
reaction = reaction.replace("\\nick", nick)
|
||||
reaction = reaction.replace("\\{nick}", nick)
|
||||
reaction = reaction.replace("\\mask", whois)
|
||||
reaction = reaction.replace("\\{mask}", whois)
|
||||
reaction = reaction.replace("\\channel", channel)
|
||||
reaction = reaction.replace("\\{channel}", channel)
|
||||
|
||||
messagewords = message.split()
|
||||
|
||||
wordstring = re.compile("\\${?(-?\\d+)}?").search(reaction)
|
||||
replacecount = 0
|
||||
while wordstring and replacecount < 256:
|
||||
replacecount += 1
|
||||
try:
|
||||
reaction = reaction.replace(wordstring.group(0), messagewords[int(wordstring.group(1))])
|
||||
except IndexError:
|
||||
reaction = reaction.replace(wordstring.group(0), "")
|
||||
wordstring = re.compile("\\${?(-?\\d+)}?").search(reaction)
|
||||
|
||||
subgroupstring = re.compile("\\\\{?(\\d+)}?").search(reaction)
|
||||
replacecount = 0
|
||||
while subgroupstring and replacecount < 256:
|
||||
replacecount += 1
|
||||
try:
|
||||
reaction = reaction.replace(subgroupstring.group(0), messagematch.group(int(subgroupstring.group(1))))
|
||||
except (IndexError, TypeError):
|
||||
reaction = reaction.replace(subgroupstring.group(0), "")
|
||||
subgroupstring = re.compile("\\\\{?(\\d+)}?").search(reaction)
|
||||
|
||||
if trigger[t_outstream] == 1: weechat.command(reaction, channel, server)
|
||||
if trigger[t_outstream] == 2: weechat.prnt(reaction, channel, server)
|
||||
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
def tell(text, server):
|
||||
return weechat.prnt(str(text), "[" + str(server) + "]", server)
|
||||
|
||||
def triggercontrol(server, args):
|
||||
try:
|
||||
if args.startswith("list"): return listdisplay(server, args)
|
||||
if args.startswith("toggle"): return activetoggle(server, args)
|
||||
if args.startswith("delete"): return deletetrigger(server, args)
|
||||
if args.startswith("add"): return addtrigger(server, args)
|
||||
if args.startswith("ostoggle"): return outstreamtoggle(server, args)
|
||||
if args.startswith("debug"): return debugtoggle(server, args)
|
||||
|
||||
tell("Unknown operation. Supported operations are add / delete / list / toggle.", server)
|
||||
except ValueError:
|
||||
tell("Error: Incorrect syntax (malformed number).", server)
|
||||
except:
|
||||
(e_type, e_value, e_trace) = sys.exc_info()
|
||||
tell("Error: %s: %s" % (str(e_type).replace("exceptions.", ""), e_value), server)
|
||||
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
def savetriggers(varname):
|
||||
savestring = pickle.dumps(triggerlist)
|
||||
savestring = savestring.replace("\n", "\\$$$")
|
||||
return weechat.set_plugin_config(varname, savestring)
|
||||
|
||||
def loadtriggers(varname):
|
||||
try:
|
||||
oldtriggers = weechat.get_plugin_config(varname)
|
||||
if oldtriggers:
|
||||
oldtriggers = oldtriggers.replace("\\$$$", "\n")
|
||||
newtriggerlist = pickle.loads(oldtriggers)
|
||||
return newtriggerlist
|
||||
else:
|
||||
return oldtriggers
|
||||
except:
|
||||
return False
|
||||
|
||||
def triggerstring(i, trigger):
|
||||
if trigger:
|
||||
cl = str(i+1) + " "
|
||||
if i < 9: cl += " "
|
||||
|
||||
if trigger[t_enabled]:
|
||||
cl += "[X] "
|
||||
else:
|
||||
cl += "[ ] "
|
||||
|
||||
if trigger[t_nick]:
|
||||
cl += "\"" + str(trigger[t_nick]) + "\" in "
|
||||
else:
|
||||
cl += "(everyone) in "
|
||||
|
||||
if trigger[t_channel]:
|
||||
cl += "\"" + str(trigger[t_channel]) + "\": "
|
||||
else:
|
||||
cl += "(all channels): "
|
||||
|
||||
cl += "\"" + str(trigger[t_trigger]) + "\" => "
|
||||
|
||||
cl += "\"" + str(trigger[t_reaction]) + "\""
|
||||
|
||||
#if trigger[t_outstream] == 1: cl += " <public output>"
|
||||
if trigger[t_outstream] == 2: cl += " <private output>"
|
||||
|
||||
return cl
|
||||
else:
|
||||
return "No response number " + str(i+1)
|
||||
|
||||
def listdisplay(server, args):
|
||||
if triggerlist:
|
||||
tell(" --- Responses ---", server)
|
||||
for i, trigger in enumerate(triggerlist):
|
||||
tell(triggerstring(i, trigger), server)
|
||||
else:
|
||||
tell("No responses in the list.", server)
|
||||
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
def activetoggle(server, args):
|
||||
triggernum = int(args.replace("toggle ", ""))
|
||||
if 1 <= triggernum < len(triggerlist) +1:
|
||||
if triggerlist[triggernum-1][t_enabled]:
|
||||
triggerlist[triggernum-1][t_enabled] = 0
|
||||
tell("Deactivated response number " + str(triggernum), server)
|
||||
else:
|
||||
triggerlist[triggernum-1][t_enabled] = 1
|
||||
tell("Activated response number " + str(triggernum), server)
|
||||
savetriggers("responses")
|
||||
else:
|
||||
tell("There is no response number " + str(triggernum), server)
|
||||
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
def outstreamtoggle(server, args):
|
||||
triggernum = int(args.replace("ostoggle ", ""))
|
||||
if 1 <= triggernum < len(triggerlist) +1:
|
||||
if triggerlist[triggernum-1][t_outstream] == 1:
|
||||
triggerlist[triggernum-1][t_outstream] = 2
|
||||
tell("Set response number " + str(triggernum) + " to private output", server)
|
||||
else:
|
||||
triggerlist[triggernum-1][t_outstream] = 1
|
||||
tell("Set response number " + str(triggernum) + " to public output", server)
|
||||
savetriggers("responses")
|
||||
else:
|
||||
tell("There is no response number " + str(triggernum), server)
|
||||
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
def deletetrigger(server, args):
|
||||
triggernum = int(args.replace("delete ", ""))
|
||||
if 1 <= triggernum < len(triggerlist) +1:
|
||||
del triggerlist[triggernum-1]
|
||||
tell("Deleted response number " + str(triggernum), server)
|
||||
if triggerlist:
|
||||
listdisplay(server, args)
|
||||
savetriggers("responses")
|
||||
else:
|
||||
tell("There is no response number " + str(triggernum), server)
|
||||
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
def addtrigger(server, args):
|
||||
newtriggerargs = args.replace("add ", "")
|
||||
if newtriggerargs.startswith('"') and newtriggerargs.endswith('"'):
|
||||
newtriggerargs = newtriggerargs[1:-1]
|
||||
newtrigger = newtriggerargs.split('" "')
|
||||
elif newtriggerargs.startswith("'") and newtriggerargs.endswith("'"):
|
||||
newtriggerargs = newtriggerargs[1:-1]
|
||||
newtrigger = newtriggerargs.split("' '")
|
||||
else:
|
||||
tell ("Error: Incorrectly formatted input.", server)
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
if len(newtrigger) == 2:
|
||||
triggerlist.append([1, "", "", 1])
|
||||
triggerlist[-1][3:3] = newtrigger
|
||||
tell(triggerstring(len(triggerlist)-1, triggerlist[-1]), server)
|
||||
elif len(newtrigger) == 3:
|
||||
triggerlist.append([1, "", 1])
|
||||
triggerlist[-1][2:2] = newtrigger
|
||||
tell(triggerstring(len(triggerlist)-1, triggerlist[-1]), server)
|
||||
elif len(newtrigger) == 4:
|
||||
triggerlist.append([1, 1])
|
||||
triggerlist[-1][1:1] = newtrigger
|
||||
tell(triggerstring(len(triggerlist)-1, triggerlist[-1]), server)
|
||||
else:
|
||||
tell("Error: Incorrectly formatted input.", server)
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
savetriggers("responses")
|
||||
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
def debugtoggle(server, args):
|
||||
global debug
|
||||
if debug:
|
||||
debug = 0
|
||||
tell("Debugging output deactivated", server)
|
||||
else:
|
||||
debug = 1
|
||||
tell("Debugging output activated", server)
|
||||
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
|
||||
triggerlist = []
|
||||
newtriggerlist = loadtriggers("responses")
|
||||
if newtriggerlist:
|
||||
triggerlist = newtriggerlist
|
||||
weechat.prnt("Response: Loaded " + str(len(triggerlist)) + " responses, " + str(len([1 for x in triggerlist if x[t_enabled]])) + " are active.")
|
||||
else:
|
||||
weechat.prnt("Response: No previously saved responses. Type '/help response' for usage information.")
|
||||
@@ -0,0 +1,40 @@
|
||||
#Author: Pablo Escobar <pablo__escobar AT tlen DOT pl>
|
||||
#What it does: This script shows the currently played song in mpd
|
||||
#Usage: /weempd - Displays the songname
|
||||
#Released under GNU GPL v2 or newer
|
||||
|
||||
#/usr/bin/python
|
||||
#coding: utf-8
|
||||
|
||||
import weechat
|
||||
import re
|
||||
import codecs
|
||||
from os import popen
|
||||
|
||||
weechat.register ('weempd', '0.01', '', """mpd-weechat current song script (usage: /weempd)""")
|
||||
weechat.add_command_handler ('weempd', 'show_it_to_them')
|
||||
|
||||
default = {
|
||||
"msg_head": "is playing",
|
||||
"msg_tail": "with mpd",
|
||||
"spacer": "★",
|
||||
"colour_title": "C12",
|
||||
"colour_spacer": "C08",
|
||||
}
|
||||
|
||||
for k, v in default.items():
|
||||
if not weechat.get_plugin_config(k):
|
||||
weechat.set_plugin_config(k, v)
|
||||
|
||||
def show_it_to_them(server, args):
|
||||
spacer = weechat.get_plugin_config("spacer")
|
||||
msg_tail = weechat.get_plugin_config("msg_tail")
|
||||
msg_head = weechat.get_plugin_config("msg_head")
|
||||
colour_title = weechat.get_plugin_config("colour_title")
|
||||
colour_spacer = weechat.get_plugin_config("colour_spacer")
|
||||
tempinfo = popen('mpc').readline().rstrip()
|
||||
all = '/me ' + msg_head + ' %' + colour_spacer + spacer + ' %' + colour_title + tempinfo + ' %' + colour_spacer + spacer + " %C00" + msg_tail
|
||||
weechat.command(all)
|
||||
return 0
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
#Author: Pablo Escobar <pablo__escobar AT tlen DOT pl>
|
||||
#What it does: This script shows the currently played song in exaile
|
||||
#Usage: /weexaile - Displays the songname
|
||||
#Released under GNU GPL v2 or newer
|
||||
|
||||
#/usr/bin/python
|
||||
#coding: utf-8
|
||||
|
||||
import weechat
|
||||
import re
|
||||
import codecs
|
||||
from os import popen
|
||||
|
||||
weechat.register ('exaile', '0.01', '', """exaile-weechat current song script (usage: /weexaile)""")
|
||||
weechat.add_command_handler ('weexaile', 'show_it_to_them')
|
||||
|
||||
default = {
|
||||
"msg_head": "is playing",
|
||||
"msg_tail": "with exaile",
|
||||
"spacer": "★",
|
||||
"colour_artist": "C03",
|
||||
"colour_title": "C02",
|
||||
"colour_lenght": "C05",
|
||||
"colour_spacer": "C08",
|
||||
}
|
||||
|
||||
for k, v in default.items():
|
||||
if not weechat.get_plugin_config(k):
|
||||
weechat.set_plugin_config(k, v)
|
||||
|
||||
def show_it_to_them(server, args):
|
||||
spacer = weechat.get_plugin_config("spacer")
|
||||
msg_tail = weechat.get_plugin_config("msg_tail")
|
||||
msg_head = weechat.get_plugin_config("msg_head")
|
||||
colour_artist = weechat.get_plugin_config("colour_artist")
|
||||
colour_title = weechat.get_plugin_config("colour_title")
|
||||
colour_lenght = weechat.get_plugin_config("colour_lenght")
|
||||
colour_spacer = weechat.get_plugin_config("colour_spacer")
|
||||
exaile_running = popen ('exaile --get-title')
|
||||
exaile_running_text = exaile_running.readline().rstrip()
|
||||
if exaile_running_text != "No running Exaile instance found.":
|
||||
song_name = popen ('exaile --get-title')
|
||||
song_name_text = song_name.readline().rstrip()
|
||||
song_artist = popen ('exaile --get-artist')
|
||||
song_artist_text = song_artist.readline().rstrip()
|
||||
song_length = popen ('exaile --get-length')
|
||||
song_length_text = song_length.readline().rstrip()
|
||||
song_current = popen ('exaile --current-position')
|
||||
song_current_text = str(round(float(song_current.readline().rstrip()),2))
|
||||
all = '/me ' + msg_head + ' %' + colour_title + song_name_text + ' %' + colour_spacer + spacer + ' %' + colour_artist + song_artist_text + ' %' + colour_spacer + spacer + ' %' + colour_lenght + song_length_text + " (" + song_current_text + "%)" + " %C00" + msg_tail
|
||||
weechat.command(all)
|
||||
return 0
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
# Rbox plugin (Rhythmnox control and now playing plugin.)
|
||||
# Version 0.2
|
||||
# Released under GNU GPL v2
|
||||
# Metallines <metallines@gmail.com>
|
||||
# /rbox-help for help
|
||||
|
||||
def weechat_init
|
||||
Weechat.register("rbox", "0.2", "", "Rhythmbox control and now playing plugin.")
|
||||
Weechat.add_command_handler("rbox-print", "rbox_print")
|
||||
Weechat.add_command_handler("rbox-play", "rbox_play")
|
||||
Weechat.add_command_handler("rbox-pause", "rbox_pause")
|
||||
Weechat.add_command_handler("rbox-previous", "rbox_previous")
|
||||
Weechat.add_command_handler("rbox-next", "rbox_next")
|
||||
Weechat.add_command_handler("rbox-help", "rbox_help")
|
||||
return Weechat::PLUGIN_RC_OK
|
||||
end
|
||||
|
||||
def rbox_print(server, args)
|
||||
if `ps -C rhythmbox` =~ /rhythmbox/
|
||||
artiste = `rhythmbox-client --print-playing-format %ta`.chomp
|
||||
titre = `rhythmbox-client --print-playing-format %tt`.chomp
|
||||
album = `rhythmbox-client --print-playing-format %at`.chomp
|
||||
|
||||
couleur_artiste = "C05"
|
||||
couleur_titre = "C10"
|
||||
couleur_album = "C03"
|
||||
couleur_entre = "C14"
|
||||
|
||||
Weechat.command("/me écoute" + " %" + couleur_titre + titre + " %" + couleur_entre + "par" + " %" + couleur_artiste + artiste + " %" + couleur_entre + "de l'album" + " %" + couleur_album + album)
|
||||
else
|
||||
Weechat.print("Rhythmbox isn't running.")
|
||||
end
|
||||
return Weechat::PLUGIN_RC_OK
|
||||
end
|
||||
|
||||
def rbox_play(server, args)
|
||||
if `ps -C rhythmbox` =~ /rhythmbox/
|
||||
`rhythmbox-client --play`
|
||||
Weechat.print("Start playback.")
|
||||
else
|
||||
Weechat.print("Rhythmbox isn't running.")
|
||||
end
|
||||
return Weechat::PLUGIN_RC_OK
|
||||
end
|
||||
|
||||
def rbox_pause(server, args)
|
||||
if `ps -C rhythmbox` =~ /rhythmbox/
|
||||
`rhythmbox-client --pause`
|
||||
Weechat.print("Pause playback.")
|
||||
else
|
||||
Weechat.print("Rhythmbox isn't running.")
|
||||
end
|
||||
return Weechat::PLUGIN_RC_OK
|
||||
end
|
||||
|
||||
def rbox_previous(server, args)
|
||||
if `ps -C rhythmbox` =~ /rhythmbox/
|
||||
`rhythmbox-client --previous`
|
||||
Weechat.print("Skip to the previous track.")
|
||||
else
|
||||
Weechat.print("Rhythmbox isn't running.")
|
||||
end
|
||||
return Weechat::PLUGIN_RC_OK
|
||||
end
|
||||
|
||||
def rbox_next(server, args)
|
||||
if `ps -C rhythmbox` =~ /rhythmbox/
|
||||
`rhythmbox-client --next`
|
||||
Weechat.print("Skip to the next track.")
|
||||
else
|
||||
Weechat.print("Rhythmbox isn't running.")
|
||||
end
|
||||
return Weechat::PLUGIN_RC_OK
|
||||
end
|
||||
|
||||
def rbox_help(server, args)
|
||||
Weechat.print("/rbox-play -> Start playback")
|
||||
Weechat.print("/rbox-pause -> Pause playback")
|
||||
Weechat.print("/rbox-previous -> Skip to previous track")
|
||||
Weechat.print("/rbox-next -> Skip to next track")
|
||||
Weechat.print("/rbox-print -> Print which song rhythmbox is playing in current channel")
|
||||
Weechat.print("/robix-help -> Display this help")
|
||||
return Weechat::PLUGIN_RC_OK
|
||||
end
|
||||
@@ -136,7 +136,7 @@ weechat_backtrace_addr2line (int number, void *address, char *symbol)
|
||||
number, function_name);
|
||||
pclose (output);
|
||||
#else
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) number;
|
||||
(void) address;
|
||||
(void) symbol;
|
||||
|
||||
+236
-98
@@ -54,9 +54,11 @@ t_weechat_command weechat_commands[] =
|
||||
N_("alias_name: name of alias\n"
|
||||
" command: command name (WeeChat or IRC command, many commands "
|
||||
"can be separated by semicolons)\n"
|
||||
"arguments: arguments for command\n\n"
|
||||
" arguments: arguments for command\n\n"
|
||||
"Note: in command, special variables $1, $2,..,$9 are replaced by "
|
||||
"arguments given by user, and $* is replaced by all arguments."),
|
||||
"arguments given by user, and $* is replaced by all arguments.\n"
|
||||
"Variables $nick, $channel and $server are replaced by current "
|
||||
"nick/channel/server."),
|
||||
"%- %A", 0, MAX_ARGS, 1, NULL, weechat_cmd_alias },
|
||||
{ "buffer", N_("manage buffers"),
|
||||
N_("[action [args] | number | [[server] [channel]]]"),
|
||||
@@ -75,8 +77,9 @@ t_weechat_command weechat_commands[] =
|
||||
N_("command: command to execute (a '/' is automatically added if not found at beginning of command)\n"),
|
||||
"%w|%i", 0, MAX_ARGS, 1, NULL, weechat_cmd_builtin },
|
||||
{ "clear", N_("clear window(s)"),
|
||||
N_("[-all]"),
|
||||
N_("-all: clear all windows"),
|
||||
N_("[-all | number]"),
|
||||
N_(" -all: clear all buffers\n"
|
||||
"number: clear buffer by number"),
|
||||
"-all", 0, 1, 0, weechat_cmd_clear, NULL },
|
||||
{ "connect", N_("connect to a server"),
|
||||
N_("[servername]"),
|
||||
@@ -118,14 +121,15 @@ t_weechat_command weechat_commands[] =
|
||||
"*|%n *|action|ctcp|dcc|pv|%I *|%c *|%s",
|
||||
0, 4, 0, weechat_cmd_ignore, NULL },
|
||||
{ "key", N_("bind/unbind keys"),
|
||||
N_("[key [function/command]] [unbind key] [functions] [reset -yes]"),
|
||||
N_("[key [function/command]] [unbind key] [functions] [call function [\"args\"]] [reset -yes]"),
|
||||
N_(" key: display or bind this key to an internal function or a command "
|
||||
"(beginning by \"/\")\n"
|
||||
" unbind: unbind a key\n"
|
||||
"functions: list internal functions for key bindings\n"
|
||||
" call: call a function by name (with optional arguments)\n"
|
||||
" reset: restore bindings to the default values and delete ALL "
|
||||
"personal bindings (use carefully!)"),
|
||||
"unbind|functions|reset %k", 0, MAX_ARGS, 0, NULL, weechat_cmd_key },
|
||||
"unbind|functions|call|reset %k", 0, MAX_ARGS, 0, NULL, weechat_cmd_key },
|
||||
/* { "panel", N_("manage panels"),
|
||||
N_("[list | add type position size | resize # size | close # | move #1 #2]"),
|
||||
N_(" list: list open panels (no parameter implies this list)\n"
|
||||
@@ -273,6 +277,45 @@ command_index_free ()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* command_used_by_weechat: return 1 if command is used by weechat
|
||||
* (weechat command, IRC command or alias)
|
||||
*/
|
||||
|
||||
int
|
||||
command_used_by_weechat (char *command)
|
||||
{
|
||||
t_weechat_alias *ptr_alias;
|
||||
int i;
|
||||
|
||||
/* look for alias */
|
||||
for (ptr_alias = weechat_alias; ptr_alias;
|
||||
ptr_alias = ptr_alias->next_alias)
|
||||
{
|
||||
if (ascii_strcasecmp (ptr_alias->alias_name, command) == 0)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* look for WeeChat command */
|
||||
for (i = 0; weechat_commands[i].command_name; i++)
|
||||
{
|
||||
if (ascii_strcasecmp (weechat_commands[i].command_name, command) == 0)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* look for IRC command */
|
||||
for (i = 0; irc_commands[i].command_name; i++)
|
||||
{
|
||||
if ((ascii_strcasecmp (irc_commands[i].command_name, command) == 0) &&
|
||||
((irc_commands[i].cmd_function_args) ||
|
||||
(irc_commands[i].cmd_function_1arg)))
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* no command/alias found */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* exec_weechat_command: executes a command (WeeChat internal or IRC)
|
||||
* if only_builtin == 1, then try only WeeChat/IRC commands
|
||||
@@ -741,6 +784,25 @@ user_message (t_irc_server *server, t_gui_buffer *buffer, char *text)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* is_command: return 1 if line is a command, 0 otherwise
|
||||
*/
|
||||
|
||||
int
|
||||
is_command (char *line)
|
||||
{
|
||||
char *pos_slash, *pos_space;
|
||||
|
||||
if (strncmp (line, "/*", 2) == 0)
|
||||
return 0;
|
||||
|
||||
pos_slash = strchr (line + 1, '/');
|
||||
pos_space = strchr (line + 1, ' ');
|
||||
|
||||
return (line[0] == '/')
|
||||
&& (!pos_slash || (pos_space && pos_slash > pos_space));
|
||||
}
|
||||
|
||||
/*
|
||||
* user_command: interprets user command (if beginning with '/')
|
||||
* any other text is sent to the server, if connected
|
||||
@@ -785,7 +847,7 @@ user_command (t_irc_server *server, t_irc_channel *channel, char *command, int o
|
||||
|
||||
irc_find_context (server, channel, NULL, &buffer);
|
||||
|
||||
if ((ptr_cmd[0] == '/') && (ptr_cmd[1] != '/'))
|
||||
if (is_command (ptr_cmd))
|
||||
{
|
||||
/* WeeChat internal command (or IRC command) */
|
||||
(void) exec_weechat_command (server, channel, ptr_cmd, only_builtin);
|
||||
@@ -855,7 +917,7 @@ weechat_cmd_alias (t_irc_server *server, t_irc_channel *channel,
|
||||
char *pos;
|
||||
t_weechat_alias *ptr_alias;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) server;
|
||||
(void) channel;
|
||||
|
||||
@@ -1155,12 +1217,11 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel,
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_channel = channel_search_any (SERVER(buffer),
|
||||
CHANNEL(buffer)->name);
|
||||
if (ptr_channel)
|
||||
channel_free (SERVER(buffer),
|
||||
ptr_channel);
|
||||
ptr_channel = CHANNEL(buffer);
|
||||
ptr_server = SERVER(buffer);
|
||||
gui_buffer_free (buffer, 1);
|
||||
if (ptr_channel)
|
||||
channel_free (ptr_server, ptr_channel);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1405,8 +1466,8 @@ weechat_cmd_clear (t_irc_server *server, t_irc_channel *channel,
|
||||
int argc, char **argv)
|
||||
{
|
||||
t_gui_buffer *buffer;
|
||||
|
||||
irc_find_context (server, channel, NULL, &buffer);
|
||||
char *error;
|
||||
long number;
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
@@ -1414,15 +1475,37 @@ weechat_cmd_clear (t_irc_server *server, t_irc_channel *channel,
|
||||
gui_buffer_clear_all ();
|
||||
else
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s unknown option for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "clear");
|
||||
return -1;
|
||||
error = NULL;
|
||||
number = strtol (argv[0], &error, 10);
|
||||
if ((error) && (error[0] == '\0'))
|
||||
{
|
||||
buffer = gui_buffer_search_by_number (number);
|
||||
if (!buffer)
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s buffer not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "clear");
|
||||
return -1;
|
||||
}
|
||||
gui_buffer_clear (buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s unknown option for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "clear");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_find_context (server, channel, NULL, &buffer);
|
||||
gui_buffer_clear (buffer);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1618,7 +1701,7 @@ weechat_cmd_debug (t_irc_server *server, t_irc_channel *channel,
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) server;
|
||||
(void) channel;
|
||||
|
||||
@@ -1725,7 +1808,7 @@ weechat_cmd_help (t_irc_server *server, t_irc_channel *channel,
|
||||
t_plugin_handler *ptr_handler;
|
||||
#endif
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) server;
|
||||
(void) channel;
|
||||
|
||||
@@ -1781,6 +1864,41 @@ weechat_cmd_help (t_irc_server *server, t_irc_channel *channel,
|
||||
#endif
|
||||
break;
|
||||
case 1:
|
||||
#ifdef PLUGINS
|
||||
for (ptr_plugin = weechat_plugins; ptr_plugin;
|
||||
ptr_plugin = ptr_plugin->next_plugin)
|
||||
{
|
||||
for (ptr_handler = ptr_plugin->handlers;
|
||||
ptr_handler; ptr_handler = ptr_handler->next_handler)
|
||||
{
|
||||
if ((ptr_handler->type == PLUGIN_HANDLER_COMMAND)
|
||||
&& (ascii_strcasecmp (ptr_handler->command, argv[0]) == 0))
|
||||
{
|
||||
gui_printf (NULL, "\n");
|
||||
gui_printf (NULL, "[p]");
|
||||
gui_printf (NULL, " %s/%s",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
ptr_handler->command);
|
||||
if (ptr_handler->arguments &&
|
||||
ptr_handler->arguments[0])
|
||||
gui_printf (NULL, " %s%s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
ptr_handler->arguments);
|
||||
else
|
||||
gui_printf (NULL, "\n");
|
||||
if (ptr_handler->description &&
|
||||
ptr_handler->description[0])
|
||||
gui_printf (NULL, "\n%s\n",
|
||||
ptr_handler->description);
|
||||
if (ptr_handler->arguments_description &&
|
||||
ptr_handler->arguments_description[0])
|
||||
gui_printf (NULL, "\n%s\n",
|
||||
ptr_handler->arguments_description);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
for (i = 0; weechat_commands[i].command_name; i++)
|
||||
{
|
||||
if (ascii_strcasecmp (weechat_commands[i].command_name, argv[0]) == 0)
|
||||
@@ -1836,41 +1954,6 @@ weechat_cmd_help (t_irc_server *server, t_irc_channel *channel,
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#ifdef PLUGINS
|
||||
for (ptr_plugin = weechat_plugins; ptr_plugin;
|
||||
ptr_plugin = ptr_plugin->next_plugin)
|
||||
{
|
||||
for (ptr_handler = ptr_plugin->handlers;
|
||||
ptr_handler; ptr_handler = ptr_handler->next_handler)
|
||||
{
|
||||
if ((ptr_handler->type == PLUGIN_HANDLER_COMMAND)
|
||||
&& (ascii_strcasecmp (ptr_handler->command, argv[0]) == 0))
|
||||
{
|
||||
gui_printf (NULL, "\n");
|
||||
gui_printf (NULL, "[p]");
|
||||
gui_printf (NULL, " %s/%s",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
ptr_handler->command);
|
||||
if (ptr_handler->arguments &&
|
||||
ptr_handler->arguments[0])
|
||||
gui_printf (NULL, " %s%s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
ptr_handler->arguments);
|
||||
else
|
||||
gui_printf (NULL, "\n");
|
||||
if (ptr_handler->description &&
|
||||
ptr_handler->description[0])
|
||||
gui_printf (NULL, "\n%s\n",
|
||||
ptr_handler->description);
|
||||
if (ptr_handler->arguments_description &&
|
||||
ptr_handler->arguments_description[0])
|
||||
gui_printf (NULL, "\n%s\n",
|
||||
ptr_handler->arguments_description);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("No help available, \"%s\" is an unknown command\n"),
|
||||
@@ -2048,11 +2131,14 @@ weechat_cmd_key_display (t_gui_key *key, int new_key)
|
||||
}
|
||||
else
|
||||
gui_printf (NULL, " %20s", (expanded_name) ? expanded_name : key->key);
|
||||
gui_printf (NULL, "%s => %s%s\n",
|
||||
gui_printf (NULL, "%s => %s%s%s%s%s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
(key->function) ?
|
||||
gui_keyboard_function_search_by_ptr (key->function) : key->command);
|
||||
gui_keyboard_function_search_by_ptr (key->function) : key->command,
|
||||
(key->args) ? " \"" : "",
|
||||
(key->args) ? key->args : "",
|
||||
(key->args) ? "\"" : "");
|
||||
if (expanded_name)
|
||||
free (expanded_name);
|
||||
}
|
||||
@@ -2065,13 +2151,14 @@ int
|
||||
weechat_cmd_key (t_irc_server *server, t_irc_channel *channel,
|
||||
char *arguments)
|
||||
{
|
||||
char *pos, *internal_code;
|
||||
int i;
|
||||
t_gui_window *window;
|
||||
t_gui_buffer *buffer;
|
||||
char *pos, *pos_args, *args_tmp, *internal_code;
|
||||
int i, length;
|
||||
t_gui_key *ptr_key;
|
||||
void (*ptr_function)(t_gui_window *, char *);
|
||||
|
||||
/* make gcc happy */
|
||||
(void) server;
|
||||
(void) channel;
|
||||
irc_find_context (server, channel, &window, &buffer);
|
||||
|
||||
if (arguments)
|
||||
{
|
||||
@@ -2120,6 +2207,50 @@ weechat_cmd_key (t_irc_server *server, t_irc_channel *channel,
|
||||
i++;
|
||||
}
|
||||
}
|
||||
else if (ascii_strncasecmp (arguments, "call ", 5) == 0)
|
||||
{
|
||||
arguments += 5;
|
||||
while (arguments[0] == ' ')
|
||||
arguments++;
|
||||
pos = strchr (arguments, ' ');
|
||||
if (pos)
|
||||
pos[0] = '\0';
|
||||
ptr_function = gui_keyboard_function_search_by_name (arguments);
|
||||
if (pos)
|
||||
pos[0] = ' ';
|
||||
if (ptr_function)
|
||||
{
|
||||
pos_args = pos;
|
||||
args_tmp = NULL;
|
||||
if (pos_args)
|
||||
{
|
||||
pos_args++;
|
||||
while (pos_args[0] == ' ')
|
||||
pos_args++;
|
||||
if (pos_args[0] == '"')
|
||||
{
|
||||
length = strlen (pos_args);
|
||||
if ((length > 1) && (pos_args[length - 1] == '"'))
|
||||
args_tmp = strndup (pos_args + 1, length - 2);
|
||||
else
|
||||
args_tmp = strdup (pos_args);
|
||||
}
|
||||
else
|
||||
args_tmp = strdup (pos_args);
|
||||
}
|
||||
(void)(*ptr_function)(window, args_tmp);
|
||||
if (args_tmp)
|
||||
free (args_tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s unknown key function \"%s\"\n"),
|
||||
WEECHAT_ERROR, arguments);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if (ascii_strncasecmp (arguments, "reset", 5) == 0)
|
||||
{
|
||||
arguments += 5;
|
||||
@@ -2136,7 +2267,7 @@ weechat_cmd_key (t_irc_server *server, t_irc_channel *channel,
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s \"-yes\" argument is required for keys reset (securuty reason)\n"),
|
||||
_("%s \"-yes\" argument is required for keys reset (security reason)\n"),
|
||||
WEECHAT_ERROR);
|
||||
return -1;
|
||||
}
|
||||
@@ -2237,7 +2368,7 @@ weechat_cmd_panel (t_irc_server *server, t_irc_channel *channel,
|
||||
{
|
||||
t_gui_panel *ptr_panel;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) server;
|
||||
(void) channel;
|
||||
|
||||
@@ -2388,6 +2519,23 @@ weechat_cmd_plugin_list (char *name, int full)
|
||||
else
|
||||
gui_printf (NULL, _(" %d defined\n"),
|
||||
handler_found);
|
||||
|
||||
/* event handlers */
|
||||
irc_display_prefix (NULL, NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, _(" event handlers:\n"));
|
||||
handler_found = 0;
|
||||
for (ptr_handler = ptr_plugin->handlers;
|
||||
ptr_handler; ptr_handler = ptr_handler->next_handler)
|
||||
{
|
||||
if (ptr_handler->type == PLUGIN_HANDLER_EVENT)
|
||||
handler_found++;
|
||||
}
|
||||
irc_display_prefix (NULL, NULL, PREFIX_PLUGIN);
|
||||
if (!handler_found)
|
||||
gui_printf (NULL, _(" (no event handler)\n"));
|
||||
else
|
||||
gui_printf (NULL, _(" %d defined\n"),
|
||||
handler_found);
|
||||
|
||||
/* modifiers */
|
||||
irc_display_prefix (NULL, NULL, PREFIX_PLUGIN);
|
||||
@@ -2416,7 +2564,7 @@ weechat_cmd_plugin_list (char *name, int full)
|
||||
gui_printf (NULL, _(" (no plugin)\n"));
|
||||
}
|
||||
#else
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) name;
|
||||
(void) full;
|
||||
#endif
|
||||
@@ -2431,7 +2579,7 @@ weechat_cmd_plugin (t_irc_server *server, t_irc_channel *channel,
|
||||
int argc, char **argv)
|
||||
{
|
||||
#ifdef PLUGINS
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) server;
|
||||
(void) channel;
|
||||
|
||||
@@ -2486,7 +2634,7 @@ weechat_cmd_plugin (t_irc_server *server, t_irc_channel *channel,
|
||||
_("Command \"%s\" is not available, WeeChat was built "
|
||||
"without plugins support.\n"),
|
||||
"plugin");
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) server;
|
||||
(void) channel;
|
||||
(void) argc;
|
||||
@@ -2504,7 +2652,7 @@ int
|
||||
weechat_cmd_save (t_irc_server *server, t_irc_channel *channel,
|
||||
int argc, char **argv)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) server;
|
||||
(void) channel;
|
||||
|
||||
@@ -2822,7 +2970,7 @@ weechat_cmd_server (t_irc_server *server, t_irc_channel *channel,
|
||||
void
|
||||
weechat_cmd_set_display_option (t_config_option *option, char *prefix, void *value)
|
||||
{
|
||||
char *color_name, *pos_nickserv, *pos_pwd, *value2;
|
||||
char *color_name, *value2;
|
||||
|
||||
gui_printf (NULL, " %s%s%s%s = ",
|
||||
(prefix) ? prefix : "",
|
||||
@@ -2863,32 +3011,22 @@ weechat_cmd_set_display_option (t_config_option *option, char *prefix, void *val
|
||||
if (*((char **)value))
|
||||
{
|
||||
value2 = strdup (*((char **)value));
|
||||
pos_nickserv = NULL;
|
||||
pos_pwd = NULL;
|
||||
pos_nickserv = strstr (value2, "nickserv");
|
||||
if (pos_nickserv)
|
||||
if (value2)
|
||||
{
|
||||
pos_pwd = strstr (value2, "identify ");
|
||||
if (!pos_pwd)
|
||||
pos_pwd = strstr (value2, "register ");
|
||||
}
|
||||
if (cfg_log_hide_nickserv_pwd && pos_nickserv && pos_pwd)
|
||||
{
|
||||
pos_pwd += 9;
|
||||
while (pos_pwd[0])
|
||||
if (cfg_log_hide_nickserv_pwd)
|
||||
{
|
||||
pos_pwd[0] = '*';
|
||||
pos_pwd++;
|
||||
irc_hide_password (value2, 1);
|
||||
if (strcmp (*((char **)value), value2) != 0)
|
||||
gui_printf (NULL, _("%s(password hidden) "),
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
}
|
||||
gui_printf (NULL, _("%s(password hidden) "),
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
gui_printf (NULL, "%s\"%s%s%s\"",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_HOST),
|
||||
value2,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK));
|
||||
free (value2);
|
||||
}
|
||||
gui_printf (NULL, "%s\"%s%s%s\"",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_HOST),
|
||||
value2,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK));
|
||||
free (value2);
|
||||
}
|
||||
else
|
||||
gui_printf (NULL, "%s\"\"",
|
||||
@@ -2914,7 +3052,7 @@ weechat_cmd_set (t_irc_server *server, t_irc_channel *channel,
|
||||
void *ptr_option_value;
|
||||
int last_section, last_option, number_found;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) server;
|
||||
(void) channel;
|
||||
|
||||
@@ -3232,7 +3370,7 @@ weechat_cmd_setp (t_irc_server *server, t_irc_channel *channel,
|
||||
t_plugin_option *ptr_option;
|
||||
int number_found;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) server;
|
||||
(void) channel;
|
||||
|
||||
@@ -3369,7 +3507,7 @@ weechat_cmd_setp (t_irc_server *server, t_irc_channel *channel,
|
||||
}
|
||||
}
|
||||
#else
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) server;
|
||||
(void) channel;
|
||||
(void) arguments;
|
||||
@@ -3395,7 +3533,7 @@ weechat_cmd_unalias (t_irc_server *server, t_irc_channel *channel,
|
||||
t_weelist *ptr_weelist;
|
||||
t_weechat_alias *ptr_alias;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) server;
|
||||
(void) channel;
|
||||
|
||||
@@ -3504,7 +3642,7 @@ weechat_cmd_upgrade (t_irc_server *server, t_irc_channel *channel,
|
||||
char *filename;
|
||||
char *exec_args[7] = { NULL, "-a", "--dir", NULL, "--session", NULL, NULL };
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) server;
|
||||
(void) channel;
|
||||
(void) argc;
|
||||
|
||||
@@ -53,6 +53,7 @@ extern t_weelist *last_index_command;
|
||||
|
||||
extern void command_index_build ();
|
||||
extern void command_index_free ();
|
||||
extern int command_used_by_weechat (char *);
|
||||
extern char **split_multi_command (char *, char);
|
||||
extern void free_multi_command (char **);
|
||||
extern int exec_weechat_command (t_irc_server *, t_irc_channel *, char *, int);
|
||||
|
||||
@@ -396,7 +396,7 @@ completion_list_add_plugin_cmd (t_completion *completion)
|
||||
}
|
||||
}
|
||||
#else
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) completion;
|
||||
#endif
|
||||
}
|
||||
@@ -586,7 +586,7 @@ completion_list_add_plugin_option (t_completion *completion)
|
||||
completion_list_add (completion, ptr_option->name);
|
||||
}
|
||||
#else
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) completion;
|
||||
#endif
|
||||
}
|
||||
@@ -618,7 +618,7 @@ completion_list_add_plugin (t_completion *completion)
|
||||
completion_list_add (completion, ptr_plugin->name);
|
||||
}
|
||||
#else
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) completion;
|
||||
#endif
|
||||
}
|
||||
@@ -671,11 +671,9 @@ completion_list_add_topic (t_completion *completion)
|
||||
{
|
||||
char *string;
|
||||
|
||||
if (!completion->server || !completion->channel
|
||||
|| !((t_irc_channel *)(completion->channel))->topic
|
||||
|| !((t_irc_channel *)(completion->channel))->topic[0])
|
||||
completion_stop (completion);
|
||||
else
|
||||
if (completion->server && completion->channel
|
||||
&& ((t_irc_channel *)(completion->channel))->topic
|
||||
&& ((t_irc_channel *)(completion->channel))->topic[0])
|
||||
{
|
||||
if (cfg_irc_colors_send)
|
||||
string = (char *)gui_color_decode_for_user_entry ((unsigned char *)((t_irc_channel *)(completion->channel))->topic);
|
||||
@@ -776,7 +774,7 @@ completion_list_add_plugin_option_value (t_completion *completion)
|
||||
pos[0] = ' ';
|
||||
}
|
||||
#else
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) completion;
|
||||
#endif
|
||||
}
|
||||
|
||||
+3
-28
@@ -31,6 +31,7 @@
|
||||
#include "history.h"
|
||||
#include "util.h"
|
||||
#include "weeconfig.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
@@ -40,32 +41,6 @@ t_history *history_global_ptr = NULL;
|
||||
int num_history_global = 0;
|
||||
|
||||
|
||||
/*
|
||||
* history_hide_password: hide a nickserv password
|
||||
*/
|
||||
|
||||
void
|
||||
history_hide_password (char *string)
|
||||
{
|
||||
char *pos_pwd;
|
||||
|
||||
if (strstr (string, "nickserv "))
|
||||
{
|
||||
pos_pwd = strstr (string, "identify ");
|
||||
if (!pos_pwd)
|
||||
pos_pwd = strstr (string, "register ");
|
||||
if (pos_pwd)
|
||||
{
|
||||
pos_pwd += 9;
|
||||
while (pos_pwd[0])
|
||||
{
|
||||
pos_pwd[0] = '*';
|
||||
pos_pwd++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* history_buffer_add: add a text/command to buffer's history
|
||||
*/
|
||||
@@ -87,7 +62,7 @@ history_buffer_add (void *buffer, char *string)
|
||||
{
|
||||
new_history->text = strdup (string);
|
||||
if (cfg_log_hide_nickserv_pwd)
|
||||
history_hide_password (new_history->text);
|
||||
irc_hide_password (new_history->text, 1);
|
||||
|
||||
if (((t_gui_buffer *)(buffer))->history)
|
||||
((t_gui_buffer *)(buffer))->history->prev_history = new_history;
|
||||
@@ -137,7 +112,7 @@ history_global_add (char *string)
|
||||
{
|
||||
new_history->text = strdup (string);
|
||||
if (cfg_log_hide_nickserv_pwd)
|
||||
history_hide_password (new_history->text);
|
||||
irc_hide_password (new_history->text, 1);
|
||||
|
||||
if (history_global)
|
||||
history_global->prev_history = new_history;
|
||||
|
||||
@@ -86,7 +86,7 @@ hotlist_add (int priority, t_irc_server *server, t_gui_buffer *buffer,
|
||||
|
||||
/* do not highlight current buffer */
|
||||
if ((buffer == gui_current_window->buffer)
|
||||
&& (!allow_current_buffer))
|
||||
&& (!allow_current_buffer) && (!gui_buffer_is_scrolled (buffer)))
|
||||
return;
|
||||
|
||||
if ((pos_hotlist = hotlist_search (buffer)))
|
||||
|
||||
@@ -373,7 +373,7 @@ session_save_line (FILE *file, t_gui_line *line)
|
||||
rc = rc && (session_write_int (file, SESSION_LINE_WITH_MESSAGE, line->line_with_message));
|
||||
rc = rc && (session_write_int (file, SESSION_LINE_WITH_HIGHLIGHT, line->line_with_highlight));
|
||||
rc = rc && (session_write_str (file, SESSION_LINE_DATA, line->data));
|
||||
rc = rc && (session_write_int (file, SESSION_LINE_OFS_AFTER_DATE, line->ofs_start_message));
|
||||
rc = rc && (session_write_int (file, SESSION_LINE_OFS_AFTER_DATE, line->ofs_after_date));
|
||||
rc = rc && (session_write_int (file, SESSION_LINE_OFS_START_MESSAGE, line->ofs_start_message));
|
||||
rc = rc && (session_write_str (file, SESSION_LINE_NICK, line->nick));
|
||||
rc = rc && (session_write_buf (file, SESSION_LINE_DATE, &(line->date), sizeof (time_t)));
|
||||
|
||||
+52
-41
@@ -194,16 +194,14 @@ ascii_strcasestr (char *string, char *search)
|
||||
*/
|
||||
|
||||
char *
|
||||
weechat_iconv (char *from_code, char *to_code, char *string)
|
||||
weechat_iconv (int from_utf8, char *from_code, char *to_code, char *string)
|
||||
{
|
||||
char *outbuf;
|
||||
|
||||
#ifdef HAVE_ICONV
|
||||
iconv_t cd;
|
||||
char *inbuf;
|
||||
char *inbuf, *ptr_inbuf, *ptr_outbuf, *next_char;
|
||||
int done;
|
||||
ICONV_CONST char *ptr_inbuf;
|
||||
char *ptr_outbuf;
|
||||
size_t err, inbytesleft, outbytesleft;
|
||||
|
||||
if (from_code && from_code[0] && to_code && to_code[0]
|
||||
@@ -223,7 +221,7 @@ weechat_iconv (char *from_code, char *to_code, char *string)
|
||||
done = 0;
|
||||
while (!done)
|
||||
{
|
||||
err = iconv (cd, &ptr_inbuf, &inbytesleft,
|
||||
err = iconv (cd, (ICONV_CONST char **)(&ptr_inbuf), &inbytesleft,
|
||||
&ptr_outbuf, &outbytesleft);
|
||||
if (err == (size_t)(-1))
|
||||
{
|
||||
@@ -236,7 +234,28 @@ weechat_iconv (char *from_code, char *to_code, char *string)
|
||||
done = 1;
|
||||
break;
|
||||
case EILSEQ:
|
||||
ptr_inbuf[0] = '?';
|
||||
if (from_utf8)
|
||||
{
|
||||
next_char = utf8_next_char (ptr_inbuf);
|
||||
if (next_char)
|
||||
{
|
||||
inbytesleft -= next_char - ptr_inbuf;
|
||||
ptr_inbuf = next_char;
|
||||
}
|
||||
else
|
||||
{
|
||||
inbytesleft--;
|
||||
ptr_inbuf++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_inbuf++;
|
||||
inbytesleft--;
|
||||
}
|
||||
ptr_outbuf[0] = '?';
|
||||
ptr_outbuf++;
|
||||
outbytesleft--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -251,7 +270,7 @@ weechat_iconv (char *from_code, char *to_code, char *string)
|
||||
else
|
||||
outbuf = strdup (string);
|
||||
#else
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) from_code;
|
||||
(void) to_code;
|
||||
outbuf = strdup (string);
|
||||
@@ -282,7 +301,8 @@ weechat_iconv_to_internal (char *charset, char *string)
|
||||
if (utf8_is_valid (input, NULL))
|
||||
return input;
|
||||
|
||||
output = weechat_iconv ((charset && charset[0]) ?
|
||||
output = weechat_iconv (0,
|
||||
(charset && charset[0]) ?
|
||||
charset : local_charset,
|
||||
WEECHAT_INTERNAL_CHARSET,
|
||||
input);
|
||||
@@ -313,7 +333,8 @@ weechat_iconv_from_internal (char *charset, char *string)
|
||||
if (input)
|
||||
{
|
||||
utf8_normalize (input, '?');
|
||||
output = weechat_iconv (WEECHAT_INTERNAL_CHARSET,
|
||||
output = weechat_iconv (1,
|
||||
WEECHAT_INTERNAL_CHARSET,
|
||||
(charset && charset[0]) ?
|
||||
charset : local_charset,
|
||||
input);
|
||||
@@ -434,33 +455,30 @@ explode_string (char *string, char *separators, int num_items_max,
|
||||
|
||||
if (num_items != NULL)
|
||||
*num_items = 0;
|
||||
|
||||
n_items = num_items_max;
|
||||
|
||||
|
||||
if (!string || !string[0])
|
||||
return NULL;
|
||||
|
||||
if (num_items_max == 0)
|
||||
|
||||
/* calculate number of items */
|
||||
ptr = string;
|
||||
i = 1;
|
||||
while ((ptr = strpbrk (ptr, separators)))
|
||||
{
|
||||
/* calculate number of items */
|
||||
ptr = string;
|
||||
i = 1;
|
||||
while ((ptr = strpbrk (ptr, separators)))
|
||||
{
|
||||
while (strchr (separators, ptr[0]) != NULL)
|
||||
ptr++;
|
||||
i++;
|
||||
}
|
||||
n_items = i;
|
||||
while (strchr (separators, ptr[0]) != NULL)
|
||||
ptr++;
|
||||
i++;
|
||||
}
|
||||
n_items = i;
|
||||
|
||||
if ((num_items_max != 0) && (n_items > num_items_max))
|
||||
n_items = num_items_max;
|
||||
|
||||
array =
|
||||
(char **) malloc ((num_items_max ? n_items : n_items + 1) *
|
||||
sizeof (char *));
|
||||
|
||||
(char **) malloc ((n_items + 1) * sizeof (char *));
|
||||
|
||||
ptr1 = string;
|
||||
ptr2 = string;
|
||||
|
||||
|
||||
for (i = 0; i < n_items; i++)
|
||||
{
|
||||
while (strchr (separators, ptr1[0]) != NULL)
|
||||
@@ -469,7 +487,7 @@ explode_string (char *string, char *separators, int num_items_max,
|
||||
if ((ptr2 = strchr (ptr1, '\r')) == NULL)
|
||||
if ((ptr2 = strchr (ptr1, '\n')) == NULL)
|
||||
ptr2 = strchr (ptr1, '\0');
|
||||
|
||||
|
||||
if ((ptr1 == NULL) || (ptr2 == NULL))
|
||||
{
|
||||
array[i] = NULL;
|
||||
@@ -490,18 +508,11 @@ explode_string (char *string, char *separators, int num_items_max,
|
||||
}
|
||||
}
|
||||
}
|
||||
if (num_items_max == 0)
|
||||
{
|
||||
array[i] = NULL;
|
||||
if (num_items != NULL)
|
||||
*num_items = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (num_items != NULL)
|
||||
*num_items = num_items_max;
|
||||
}
|
||||
|
||||
|
||||
array[i] = NULL;
|
||||
if (num_items != NULL)
|
||||
*num_items = i;
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
|
||||
+8
-19
@@ -445,7 +445,7 @@ weechat_parse_args (int argc, char *argv[])
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_create_dir (char *directory)
|
||||
weechat_create_dir (char *directory, int permissions)
|
||||
{
|
||||
if (mkdir (directory, 0755) < 0)
|
||||
{
|
||||
@@ -456,7 +456,10 @@ weechat_create_dir (char *directory)
|
||||
WEECHAT_ERROR, directory);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
if ((permissions != 0) && (strcmp (directory, getenv ("HOME")) != 0))
|
||||
chmod (directory, permissions);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -505,7 +508,7 @@ weechat_create_home_dirs ()
|
||||
}
|
||||
|
||||
/* create home directory; error is fatal */
|
||||
if (!weechat_create_dir (weechat_home))
|
||||
if (!weechat_create_dir (weechat_home, 0))
|
||||
{
|
||||
weechat_iconv_fprintf (stderr, _("%s unable to create \"%s\" directory\n"),
|
||||
WEECHAT_ERROR, weechat_home);
|
||||
@@ -525,14 +528,7 @@ weechat_create_config_dirs ()
|
||||
/* create logs directory" */
|
||||
dir1 = weechat_strreplace (cfg_log_path, "~", getenv ("HOME"));
|
||||
dir2 = weechat_strreplace (dir1, "%h", weechat_home);
|
||||
if (weechat_create_dir (dir2))
|
||||
{
|
||||
if (strcmp (dir2, getenv ("HOME")) != 0)
|
||||
chmod (dir2, 0700);
|
||||
}
|
||||
else
|
||||
weechat_iconv_fprintf (stderr, _("%s unable to create \"%s\" directory\n"),
|
||||
WEECHAT_WARNING, dir2);
|
||||
(void) weechat_create_dir (dir2, 0700);
|
||||
if (dir1)
|
||||
free (dir1);
|
||||
if (dir2)
|
||||
@@ -541,14 +537,7 @@ weechat_create_config_dirs ()
|
||||
/* create DCC download directory */
|
||||
dir1 = weechat_strreplace (cfg_dcc_download_path, "~", getenv ("HOME"));
|
||||
dir2 = weechat_strreplace (dir1, "%h", weechat_home);
|
||||
if (weechat_create_dir (dir2))
|
||||
{
|
||||
if (strcmp (dir2, getenv ("HOME")) != 0)
|
||||
chmod (dir2, 0700);
|
||||
}
|
||||
else
|
||||
weechat_iconv_fprintf (stderr, _("%s unable to create \"%s\" directory\n"),
|
||||
WEECHAT_WARNING, dir2);
|
||||
(void) weechat_create_dir (dir2, 0700);
|
||||
if (dir1)
|
||||
free (dir1);
|
||||
if (dir2)
|
||||
@@ -865,5 +854,5 @@ main (int argc, char *argv[])
|
||||
gui_main_end (); /* shut down WeeChat GUI */
|
||||
weechat_shutdown (EXIT_SUCCESS, 0); /* quit WeeChat (oh no, why?) */
|
||||
|
||||
return EXIT_SUCCESS; /* make gcc happy (never executed) */
|
||||
return EXIT_SUCCESS; /* make C compiler happy */
|
||||
}
|
||||
|
||||
@@ -2225,9 +2225,11 @@ config_create_default ()
|
||||
{
|
||||
function_name = gui_keyboard_function_search_by_ptr (ptr_key->function);
|
||||
if (function_name)
|
||||
weechat_iconv_fprintf (file, "%s = \"%s\"\n",
|
||||
weechat_iconv_fprintf (file, "%s = \"%s%s%s\"\n",
|
||||
(expanded_name) ? expanded_name : ptr_key->key,
|
||||
function_name);
|
||||
function_name,
|
||||
(ptr_key->args) ? " " : "",
|
||||
(ptr_key->args) ? ptr_key->args : "");
|
||||
}
|
||||
else
|
||||
weechat_iconv_fprintf (file, "%s = \"%s\"\n",
|
||||
@@ -2441,9 +2443,11 @@ config_write (char *config_name)
|
||||
{
|
||||
function_name = gui_keyboard_function_search_by_ptr (ptr_key->function);
|
||||
if (function_name)
|
||||
weechat_iconv_fprintf (file, "%s = \"%s\"\n",
|
||||
weechat_iconv_fprintf (file, "%s = \"%s%s%s\"\n",
|
||||
(expanded_name) ? expanded_name : ptr_key->key,
|
||||
function_name);
|
||||
function_name,
|
||||
(ptr_key->args) ? " " : "",
|
||||
(ptr_key->args) ? ptr_key->args : "");
|
||||
}
|
||||
else
|
||||
weechat_iconv_fprintf (file, "%s = \"%s\"\n",
|
||||
|
||||
@@ -169,7 +169,6 @@ gui_chat_draw_title (t_gui_buffer *buffer, int erase)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
char format[32], *buf, *buf2, *ptr_topic;
|
||||
int length, width;
|
||||
|
||||
if (!gui_ok)
|
||||
return;
|
||||
@@ -189,17 +188,15 @@ gui_chat_draw_title (t_gui_buffer *buffer, int erase)
|
||||
if (CHANNEL(buffer)->topic)
|
||||
{
|
||||
buf = (char *)gui_color_decode ((unsigned char *)(CHANNEL(buffer)->topic), 0);
|
||||
buf2 = weechat_iconv_from_internal (NULL,
|
||||
(buf) ? buf : CHANNEL(buffer)->topic);
|
||||
ptr_topic = (buf2) ? buf2 : CHANNEL(buffer)->topic;
|
||||
length = utf8_strlen (ptr_topic);
|
||||
if (ptr_win->win_title_start >= length)
|
||||
ptr_topic = utf8_add_offset ((buf) ? buf : CHANNEL(buffer)->topic,
|
||||
ptr_win->win_title_start);
|
||||
if (!ptr_topic || !ptr_topic[0])
|
||||
{
|
||||
ptr_win->win_title_start = 0;
|
||||
width = (ptr_win->win_title_start == 0) ?
|
||||
ptr_win->win_width : ptr_win->win_width - 2;
|
||||
ptr_topic += ptr_win->win_title_start;
|
||||
|
||||
snprintf (format, 32, "%%-%ds", width);
|
||||
ptr_topic = (buf) ? buf : CHANNEL(buffer)->topic;
|
||||
}
|
||||
buf2 = weechat_iconv_from_internal (NULL,
|
||||
ptr_topic);
|
||||
|
||||
if (ptr_win->win_title_start > 0)
|
||||
{
|
||||
@@ -208,11 +205,10 @@ gui_chat_draw_title (t_gui_buffer *buffer, int erase)
|
||||
wprintw (GUI_CURSES(ptr_win)->win_title, "%s", "++");
|
||||
}
|
||||
|
||||
if (utf8_strlen (ptr_topic) > ptr_win->win_width)
|
||||
if (utf8_width_screen (ptr_topic) > ptr_win->win_width)
|
||||
{
|
||||
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_title, COLOR_WIN_TITLE);
|
||||
wprintw (GUI_CURSES(ptr_win)->win_title,
|
||||
format, ptr_topic);
|
||||
wprintw (GUI_CURSES(ptr_win)->win_title, "%s", (buf2) ? buf2 : ptr_topic);
|
||||
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_title,
|
||||
COLOR_WIN_TITLE_MORE);
|
||||
mvwprintw (GUI_CURSES(ptr_win)->win_title, 0, ptr_win->win_width - 2,
|
||||
@@ -221,7 +217,7 @@ gui_chat_draw_title (t_gui_buffer *buffer, int erase)
|
||||
else
|
||||
{
|
||||
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_title, COLOR_WIN_TITLE);
|
||||
wprintw (GUI_CURSES(ptr_win)->win_title, format, ptr_topic);
|
||||
wprintw (GUI_CURSES(ptr_win)->win_title, "%s", (buf2) ? buf2 : ptr_topic);
|
||||
}
|
||||
if (buf)
|
||||
free (buf);
|
||||
@@ -816,14 +812,30 @@ gui_chat_display_line (t_gui_window *window, t_gui_line *line, int count,
|
||||
}
|
||||
else
|
||||
{
|
||||
/* display read marker if needed */
|
||||
if (cfg_look_read_marker && cfg_look_read_marker[0] &&
|
||||
window->buffer->last_read_line &&
|
||||
(window->buffer->last_read_line == line->prev_line))
|
||||
if (cfg_look_read_marker && cfg_look_read_marker[0])
|
||||
{
|
||||
gui_chat_set_weechat_color (window, COLOR_WIN_CHAT_READ_MARKER);
|
||||
mvwprintw (GUI_CURSES(window)->win_chat, read_marker_y, read_marker_x,
|
||||
"%c", cfg_look_read_marker[0]);
|
||||
/* display marker if line is matching user search */
|
||||
if (window->buffer->text_search != TEXT_SEARCH_DISABLED)
|
||||
{
|
||||
if (gui_buffer_line_search (line, window->buffer->input_buffer,
|
||||
window->buffer->text_search_exact))
|
||||
{
|
||||
gui_chat_set_weechat_color (window, COLOR_WIN_CHAT_READ_MARKER);
|
||||
mvwprintw (GUI_CURSES(window)->win_chat, read_marker_y, read_marker_x,
|
||||
"%c", cfg_look_read_marker[0]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* display read marker if needed */
|
||||
if (window->buffer->last_read_line &&
|
||||
(window->buffer->last_read_line == line->prev_line))
|
||||
{
|
||||
gui_chat_set_weechat_color (window, COLOR_WIN_CHAT_READ_MARKER);
|
||||
mvwprintw (GUI_CURSES(window)->win_chat, read_marker_y, read_marker_x,
|
||||
"%c", cfg_look_read_marker[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1153,11 +1165,7 @@ gui_chat_draw (t_gui_buffer *buffer, int erase)
|
||||
if (!ptr_line && ptr_win->scroll)
|
||||
{
|
||||
if (count == gui_chat_display_line (ptr_win, ptr_win->buffer->last_line, 0, 1))
|
||||
{
|
||||
ptr_win->scroll = 0;
|
||||
ptr_win->start_line = NULL;
|
||||
ptr_win->start_line_pos = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ptr_win->scroll && (ptr_win->start_line == ptr_win->buffer->lines))
|
||||
|
||||
@@ -46,7 +46,7 @@ gui_infobar_draw_time (t_gui_buffer *buffer)
|
||||
time_t time_seconds;
|
||||
struct tm *local_time;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) buffer;
|
||||
|
||||
if (!gui_ok)
|
||||
@@ -84,7 +84,7 @@ gui_infobar_draw (t_gui_buffer *buffer, int erase)
|
||||
struct tm *local_time;
|
||||
char text_time[1024 + 1], *buf;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) buffer;
|
||||
|
||||
if (!gui_ok)
|
||||
|
||||
@@ -78,6 +78,14 @@ gui_input_get_prompt_length (t_gui_window *window, char *nick)
|
||||
char *pos, saved_char;
|
||||
int char_size, length;
|
||||
|
||||
if (window->buffer->text_search != TEXT_SEARCH_DISABLED)
|
||||
{
|
||||
if (window->buffer->text_search_exact)
|
||||
return utf8_width_screen (_("Text search (exact): "));
|
||||
else
|
||||
return utf8_width_screen (_("Text search: "));
|
||||
}
|
||||
|
||||
length = 0;
|
||||
pos = cfg_look_input_format;
|
||||
while (pos && pos[0])
|
||||
@@ -90,11 +98,11 @@ gui_input_get_prompt_length (t_gui_window *window, char *nick)
|
||||
{
|
||||
case 'c':
|
||||
if (CHANNEL(window->buffer))
|
||||
length += utf8_strlen (CHANNEL(window->buffer)->name);
|
||||
length += utf8_width_screen (CHANNEL(window->buffer)->name);
|
||||
else
|
||||
{
|
||||
if (SERVER(window->buffer))
|
||||
length += utf8_strlen (SERVER(window->buffer)->name);
|
||||
length += utf8_width_screen (SERVER(window->buffer)->name);
|
||||
}
|
||||
pos++;
|
||||
break;
|
||||
@@ -108,7 +116,7 @@ gui_input_get_prompt_length (t_gui_window *window, char *nick)
|
||||
pos++;
|
||||
break;
|
||||
case 'n':
|
||||
length += utf8_strlen (nick);
|
||||
length += utf8_width_screen (nick);
|
||||
pos++;
|
||||
break;
|
||||
default:
|
||||
@@ -148,10 +156,21 @@ gui_input_get_prompt_length (t_gui_window *window, char *nick)
|
||||
void
|
||||
gui_input_draw_prompt (t_gui_window *window, char *nick)
|
||||
{
|
||||
char *pos, saved_char;
|
||||
char *pos, saved_char, *buf;
|
||||
int char_size;
|
||||
|
||||
wmove (GUI_CURSES(window)->win_input, 0, 0);
|
||||
|
||||
if (window->buffer->text_search != TEXT_SEARCH_DISABLED)
|
||||
{
|
||||
gui_window_set_weechat_color (GUI_CURSES(window)->win_input,
|
||||
COLOR_WIN_INPUT);
|
||||
wprintw (GUI_CURSES(window)->win_input, "%s",
|
||||
(window->buffer->text_search_exact) ?
|
||||
_("Text search (exact): ") : _("Text search: "));
|
||||
return;
|
||||
}
|
||||
|
||||
pos = cfg_look_input_format;
|
||||
while (pos && pos[0])
|
||||
{
|
||||
@@ -166,8 +185,12 @@ gui_input_draw_prompt (t_gui_window *window, char *nick)
|
||||
{
|
||||
gui_window_set_weechat_color (GUI_CURSES(window)->win_input,
|
||||
COLOR_WIN_INPUT_CHANNEL);
|
||||
buf = weechat_iconv_from_internal (NULL,
|
||||
CHANNEL(window->buffer)->name);
|
||||
wprintw (GUI_CURSES(window)->win_input, "%s",
|
||||
CHANNEL(window->buffer)->name);
|
||||
(buf) ? buf : CHANNEL(window->buffer)->name);
|
||||
if (buf)
|
||||
free (buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -175,8 +198,12 @@ gui_input_draw_prompt (t_gui_window *window, char *nick)
|
||||
{
|
||||
gui_window_set_weechat_color (GUI_CURSES(window)->win_input,
|
||||
COLOR_WIN_INPUT_SERVER);
|
||||
buf = weechat_iconv_from_internal (NULL,
|
||||
SERVER(window->buffer)->name);
|
||||
wprintw (GUI_CURSES(window)->win_input, "%s",
|
||||
SERVER(window->buffer)->name);
|
||||
(buf) ? buf : SERVER(window->buffer)->name);
|
||||
if (buf)
|
||||
free (buf);
|
||||
}
|
||||
}
|
||||
pos++;
|
||||
@@ -198,7 +225,10 @@ gui_input_draw_prompt (t_gui_window *window, char *nick)
|
||||
case 'n':
|
||||
gui_window_set_weechat_color (GUI_CURSES(window)->win_input,
|
||||
COLOR_WIN_INPUT_NICK);
|
||||
wprintw (GUI_CURSES(window)->win_input, "%s", nick);
|
||||
buf = weechat_iconv_from_internal (NULL, nick);
|
||||
wprintw (GUI_CURSES(window)->win_input, "%s", (buf) ? buf : nick);
|
||||
if (buf)
|
||||
free (buf);
|
||||
pos++;
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -33,10 +33,6 @@
|
||||
#include "../../common/util.h"
|
||||
#include "gui-curses.h"
|
||||
|
||||
#ifdef PLUGINS
|
||||
#include "../../plugins/plugins.h"
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* gui_keyboard_default_bindings: create default key bindings
|
||||
@@ -53,8 +49,8 @@ gui_keyboard_default_bindings ()
|
||||
gui_keyboard_bind ( /* RC */ "ctrl-J", "return");
|
||||
gui_keyboard_bind ( /* tab */ "ctrl-I", "tab");
|
||||
gui_keyboard_bind ( /* s-tab */ "meta2-Z", "tab_previous");
|
||||
gui_keyboard_bind ( /* basckp */ "ctrl-H", "backspace");
|
||||
gui_keyboard_bind ( /* basckp */ "ctrl-?", "backspace");
|
||||
gui_keyboard_bind ( /* basckpace */ "ctrl-H", "backspace");
|
||||
gui_keyboard_bind ( /* basckpace */ "ctrl-?", "backspace");
|
||||
gui_keyboard_bind ( /* del */ "meta2-3~", "delete");
|
||||
gui_keyboard_bind ( /* ^K */ "ctrl-K", "delete_end_line");
|
||||
gui_keyboard_bind ( /* ^U */ "ctrl-U", "delete_beginning_line");
|
||||
@@ -109,6 +105,7 @@ gui_keyboard_default_bindings ()
|
||||
gui_keyboard_bind ( /* m-r */ "meta-r", "delete_line");
|
||||
gui_keyboard_bind ( /* m-s */ "meta-s", "switch_server");
|
||||
gui_keyboard_bind ( /* m-u */ "meta-u", "scroll_unread");
|
||||
gui_keyboard_bind ( /* ^R */ "ctrl-R", "search_text");
|
||||
|
||||
/* keys bound with commands */
|
||||
gui_keyboard_bind ( /* m-left */ "meta-meta2-D", "/buffer -1");
|
||||
@@ -149,12 +146,7 @@ void
|
||||
gui_keyboard_grab_end ()
|
||||
{
|
||||
char *expanded_key;
|
||||
char *buffer_before_key;
|
||||
#ifdef PLUGINS
|
||||
char *expanded_key2;
|
||||
int length;
|
||||
#endif
|
||||
|
||||
|
||||
/* get expanded name (for example: ^U => ctrl-u) */
|
||||
expanded_key = gui_keyboard_get_expanded_name (gui_key_buffer);
|
||||
|
||||
@@ -162,27 +154,9 @@ gui_keyboard_grab_end ()
|
||||
{
|
||||
if (gui_current_window->buffer->has_input)
|
||||
{
|
||||
buffer_before_key =
|
||||
(gui_current_window->buffer->input_buffer) ?
|
||||
strdup (gui_current_window->buffer->input_buffer) : strdup ("");
|
||||
gui_insert_string_input (gui_current_window, expanded_key, -1);
|
||||
gui_current_window->buffer->input_buffer_pos += utf8_strlen (expanded_key);
|
||||
gui_input_draw (gui_current_window->buffer, 1);
|
||||
gui_current_window->buffer->completion.position = -1;
|
||||
#ifdef PLUGINS
|
||||
length = strlen (expanded_key) + 1 + 1;
|
||||
expanded_key2 = (char *) malloc (length);
|
||||
if (expanded_key2)
|
||||
{
|
||||
snprintf (expanded_key2, length, "*%s", expanded_key);
|
||||
(void) plugin_keyboard_handler_exec (expanded_key2,
|
||||
buffer_before_key,
|
||||
gui_current_window->buffer->input_buffer);
|
||||
free (expanded_key2);
|
||||
}
|
||||
#endif
|
||||
if (buffer_before_key)
|
||||
free (buffer_before_key);
|
||||
gui_input_draw (gui_current_window->buffer, 0);
|
||||
}
|
||||
free (expanded_key);
|
||||
}
|
||||
@@ -201,11 +175,7 @@ void
|
||||
gui_keyboard_read ()
|
||||
{
|
||||
int key, i, insert_ok;
|
||||
char key_str[32], *key_utf;
|
||||
char *buffer_before_key;
|
||||
#ifdef PLUGINS
|
||||
char key_str2[33];
|
||||
#endif
|
||||
char key_str[32], *key_utf, *input_old;
|
||||
|
||||
i = 0;
|
||||
/* do not loop too much here (for example when big paste was made),
|
||||
@@ -303,6 +273,12 @@ gui_keyboard_read ()
|
||||
|
||||
/*gui_printf (gui_current_window->buffer, "gui_input_read: key = %s (%d)\n", key_str, key);*/
|
||||
|
||||
if (gui_current_window->buffer->text_search != TEXT_SEARCH_DISABLED)
|
||||
input_old = (gui_current_window->buffer->input_buffer) ?
|
||||
strdup (gui_current_window->buffer->input_buffer) : strdup ("");
|
||||
else
|
||||
input_old = NULL;
|
||||
|
||||
if ((gui_keyboard_pressed (key_str) != 0) && (insert_ok))
|
||||
{
|
||||
if (strcmp (key_str, "^^") == 0)
|
||||
@@ -311,21 +287,9 @@ gui_keyboard_read ()
|
||||
switch (gui_current_window->buffer->type)
|
||||
{
|
||||
case BUFFER_TYPE_STANDARD:
|
||||
buffer_before_key =
|
||||
(gui_current_window->buffer->input_buffer) ?
|
||||
strdup (gui_current_window->buffer->input_buffer) : strdup ("");
|
||||
gui_insert_string_input (gui_current_window, key_str, -1);
|
||||
gui_current_window->buffer->input_buffer_pos += utf8_strlen (key_str);
|
||||
gui_input_draw (gui_current_window->buffer, 0);
|
||||
gui_current_window->buffer->completion.position = -1;
|
||||
#ifdef PLUGINS
|
||||
snprintf (key_str2, sizeof (key_str2), "*%s", key_str);
|
||||
(void) plugin_keyboard_handler_exec (key_str2,
|
||||
buffer_before_key,
|
||||
gui_current_window->buffer->input_buffer);
|
||||
#endif
|
||||
if (buffer_before_key)
|
||||
free (buffer_before_key);
|
||||
gui_input_draw (gui_current_window->buffer, 0);
|
||||
break;
|
||||
case BUFFER_TYPE_DCC:
|
||||
gui_exec_action_dcc (gui_current_window, key_str);
|
||||
@@ -335,6 +299,16 @@ gui_keyboard_read ()
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* incremental text search in buffer */
|
||||
if ((gui_current_window->buffer->text_search != TEXT_SEARCH_DISABLED)
|
||||
&& ((input_old == NULL) || (gui_current_window->buffer->input_buffer == NULL)
|
||||
|| (strcmp (input_old, gui_current_window->buffer->input_buffer) != 0)))
|
||||
gui_buffer_search_restart (gui_current_window);
|
||||
|
||||
if (input_old)
|
||||
free (input_old);
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,12 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "../../common/weechat.h"
|
||||
#include "../gui.h"
|
||||
#include "../../common/utf8.h"
|
||||
#include "../../common/util.h"
|
||||
#include "../../common/weeconfig.h"
|
||||
#include "../../irc/irc.h"
|
||||
#include "gui-curses.h"
|
||||
@@ -39,8 +43,8 @@ void
|
||||
gui_nicklist_draw (t_gui_buffer *buffer, int erase, int calculate_size)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
int i, j, x, y, x2, column, max_length, nicks_displayed;
|
||||
char format[32], format_empty[32];
|
||||
int i, j, k, x, y, x2, max_y, column, max_length, max_chars, nicks_displayed;
|
||||
char format_empty[32], *buf, *ptr_buf, *ptr_next, saved_char;
|
||||
t_irc_nick *ptr_nick;
|
||||
|
||||
if (!gui_ok || !BUFFER_HAS_NICKLIST(buffer))
|
||||
@@ -81,15 +85,14 @@ gui_nicklist_draw (t_gui_buffer *buffer, int erase, int calculate_size)
|
||||
|
||||
if ((cfg_look_nicklist_position == CFG_LOOK_NICKLIST_TOP) ||
|
||||
(cfg_look_nicklist_position == CFG_LOOK_NICKLIST_BOTTOM))
|
||||
snprintf (format, 32, "%%.%ds", max_length);
|
||||
max_chars = max_length;
|
||||
else
|
||||
snprintf (format, 32, "%%.%ds",
|
||||
((cfg_look_nicklist_min_size > 0)
|
||||
&& (max_length < cfg_look_nicklist_min_size)) ?
|
||||
cfg_look_nicklist_min_size :
|
||||
(((cfg_look_nicklist_max_size > 0)
|
||||
&& (max_length > cfg_look_nicklist_max_size)) ?
|
||||
cfg_look_nicklist_max_size : max_length));
|
||||
max_chars = ((cfg_look_nicklist_min_size > 0)
|
||||
&& (max_length < cfg_look_nicklist_min_size)) ?
|
||||
cfg_look_nicklist_min_size :
|
||||
(((cfg_look_nicklist_max_size > 0)
|
||||
&& (max_length > cfg_look_nicklist_max_size)) ?
|
||||
cfg_look_nicklist_max_size : max_length);
|
||||
|
||||
if (cfg_look_nicklist_separator && has_colors ())
|
||||
{
|
||||
@@ -122,6 +125,20 @@ gui_nicklist_draw (t_gui_buffer *buffer, int erase, int calculate_size)
|
||||
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_nick, COLOR_WIN_NICK);
|
||||
x = 0;
|
||||
y = (cfg_look_nicklist_separator && (cfg_look_nicklist_position == CFG_LOOK_NICKLIST_BOTTOM)) ? 1 : 0;
|
||||
max_y = 0;
|
||||
switch (cfg_look_nicklist_position)
|
||||
{
|
||||
case CFG_LOOK_NICKLIST_LEFT:
|
||||
case CFG_LOOK_NICKLIST_RIGHT:
|
||||
max_y = 0;
|
||||
break;
|
||||
case CFG_LOOK_NICKLIST_TOP:
|
||||
max_y = ptr_win->win_nick_height - cfg_look_nicklist_separator;
|
||||
break;
|
||||
case CFG_LOOK_NICKLIST_BOTTOM:
|
||||
max_y = ptr_win->win_nick_height;
|
||||
break;
|
||||
}
|
||||
column = 0;
|
||||
|
||||
if ((cfg_look_nicklist_position == CFG_LOOK_NICKLIST_TOP) ||
|
||||
@@ -203,7 +220,30 @@ gui_nicklist_draw (t_gui_buffer *buffer, int erase, int calculate_size)
|
||||
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_nick,
|
||||
((cfg_irc_away_check > 0) && (ptr_nick->flags & NICK_AWAY)) ?
|
||||
COLOR_WIN_NICK_AWAY : COLOR_WIN_NICK);
|
||||
mvwprintw (GUI_CURSES(ptr_win)->win_nick, y, x, format, ptr_nick->nick);
|
||||
wmove (GUI_CURSES(ptr_win)->win_nick, y, x);
|
||||
ptr_buf = ptr_nick->nick;
|
||||
saved_char = '\0';
|
||||
for (k = 0; k < max_chars; k++)
|
||||
{
|
||||
if (ptr_buf && ptr_buf[0])
|
||||
{
|
||||
ptr_next = utf8_next_char (ptr_buf);
|
||||
if (ptr_next)
|
||||
{
|
||||
saved_char = ptr_next[0];
|
||||
ptr_next[0] = '\0';
|
||||
}
|
||||
buf = weechat_iconv_from_internal (NULL, ptr_buf);
|
||||
wprintw (GUI_CURSES(ptr_win)->win_nick, "%s", (buf) ? buf : "?");
|
||||
if (buf)
|
||||
free (buf);
|
||||
if (ptr_next)
|
||||
ptr_next[0] = saved_char;
|
||||
ptr_buf = ptr_next;
|
||||
}
|
||||
else
|
||||
wprintw (GUI_CURSES(ptr_win)->win_nick, " ");
|
||||
}
|
||||
|
||||
ptr_nick = ptr_nick->next_nick;
|
||||
|
||||
@@ -214,9 +254,7 @@ gui_nicklist_draw (t_gui_buffer *buffer, int erase, int calculate_size)
|
||||
if ((cfg_look_nicklist_position == CFG_LOOK_NICKLIST_TOP) ||
|
||||
(cfg_look_nicklist_position == CFG_LOOK_NICKLIST_BOTTOM))
|
||||
{
|
||||
if (y - ((cfg_look_nicklist_separator
|
||||
&& (cfg_look_nicklist_position == CFG_LOOK_NICKLIST_BOTTOM)) ? 1 : 0)
|
||||
>= ptr_win->win_nick_height - 1)
|
||||
if (y >= max_y)
|
||||
{
|
||||
column += max_length + 2;
|
||||
y = (cfg_look_nicklist_separator && (cfg_look_nicklist_position == CFG_LOOK_NICKLIST_BOTTOM)) ?
|
||||
|
||||
@@ -48,7 +48,7 @@ gui_status_draw (t_gui_buffer *buffer, int erase)
|
||||
int x, server_pos, server_total;
|
||||
int display_name, names_count;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) buffer;
|
||||
|
||||
if (!gui_ok)
|
||||
@@ -110,8 +110,18 @@ gui_status_draw (t_gui_buffer *buffer, int erase)
|
||||
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status,
|
||||
COLOR_WIN_STATUS_CHANNEL);
|
||||
if (SERVER(ptr_win->buffer)->is_connected)
|
||||
wprintw (GUI_CURSES(ptr_win)->win_status, "[%s] ",
|
||||
SERVER(ptr_win->buffer)->name);
|
||||
{
|
||||
if ((ptr_win->buffer->all_servers) && (SERVER(ptr_win->buffer)->is_away))
|
||||
{
|
||||
wprintw (GUI_CURSES(ptr_win)->win_status, "[%s",
|
||||
SERVER(ptr_win->buffer)->name);
|
||||
wprintw (GUI_CURSES(ptr_win)->win_status, _("(away)"));
|
||||
wprintw (GUI_CURSES(ptr_win)->win_status, "] ");
|
||||
}
|
||||
else
|
||||
wprintw (GUI_CURSES(ptr_win)->win_status, "[%s] ",
|
||||
SERVER(ptr_win->buffer)->name);
|
||||
}
|
||||
else
|
||||
wprintw (GUI_CURSES(ptr_win)->win_status, "(%s) ",
|
||||
SERVER(ptr_win->buffer)->name);
|
||||
|
||||
@@ -533,7 +533,12 @@ gui_window_page_up (t_gui_window *window)
|
||||
(-1) * (window->win_chat_height - 1) :
|
||||
(-1) * ((window->win_chat_height - 1) * 2));
|
||||
gui_chat_draw (window->buffer, 0);
|
||||
gui_status_draw (window->buffer, 0);
|
||||
if (!window->scroll)
|
||||
{
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
}
|
||||
gui_status_draw (window->buffer, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -569,7 +574,13 @@ gui_window_page_down (t_gui_window *window)
|
||||
}
|
||||
|
||||
gui_chat_draw (window->buffer, 0);
|
||||
gui_status_draw (window->buffer, 0);
|
||||
if (!window->scroll)
|
||||
{
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
hotlist_remove_buffer (window->buffer);
|
||||
}
|
||||
gui_status_draw (window->buffer, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -591,7 +602,12 @@ gui_window_scroll_up (t_gui_window *window)
|
||||
(-1) * cfg_look_scroll_amount :
|
||||
(-1) * ( (window->win_chat_height - 1) + cfg_look_scroll_amount));
|
||||
gui_chat_draw (window->buffer, 0);
|
||||
gui_status_draw (window->buffer, 0);
|
||||
if (!window->scroll)
|
||||
{
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
}
|
||||
gui_status_draw (window->buffer, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -628,7 +644,13 @@ gui_window_scroll_down (t_gui_window *window)
|
||||
}
|
||||
|
||||
gui_chat_draw (window->buffer, 0);
|
||||
gui_status_draw (window->buffer, 0);
|
||||
if (!window->scroll)
|
||||
{
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
hotlist_remove_buffer (window->buffer);
|
||||
}
|
||||
gui_status_draw (window->buffer, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -647,7 +669,12 @@ gui_window_scroll_top (t_gui_window *window)
|
||||
window->start_line = window->buffer->lines;
|
||||
window->start_line_pos = 0;
|
||||
gui_chat_draw (window->buffer, 0);
|
||||
gui_status_draw (window->buffer, 0);
|
||||
if (!window->scroll)
|
||||
{
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
}
|
||||
gui_status_draw (window->buffer, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -666,7 +693,13 @@ gui_window_scroll_bottom (t_gui_window *window)
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
gui_chat_draw (window->buffer, 0);
|
||||
gui_status_draw (window->buffer, 0);
|
||||
if (!window->scroll)
|
||||
{
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
hotlist_remove_buffer (window->buffer);
|
||||
}
|
||||
gui_status_draw (window->buffer, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ gui_infobar_draw_time (t_gui_buffer *buffer)
|
||||
time_t time_seconds;
|
||||
struct tm *local_time;*/
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) buffer;
|
||||
|
||||
if (!gui_ok)
|
||||
@@ -67,7 +67,7 @@ gui_infobar_draw (t_gui_buffer *buffer, int erase)
|
||||
struct tm *local_time;
|
||||
char text_time[1024 + 1];*/
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) buffer;
|
||||
|
||||
if (!gui_ok)
|
||||
|
||||
@@ -47,7 +47,7 @@ gui_status_draw (t_gui_buffer *buffer, int erase)
|
||||
int i, first_mode, x, server_pos, server_total;
|
||||
int display_name, names_count;*/
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) buffer;
|
||||
|
||||
if (!gui_ok)
|
||||
|
||||
+425
-199
File diff suppressed because it is too large
Load Diff
+241
-18
@@ -44,6 +44,10 @@
|
||||
#include "../common/util.h"
|
||||
#include "../irc/irc.h"
|
||||
|
||||
#ifdef PLUGINS
|
||||
#include "../plugins/plugins.h"
|
||||
#endif
|
||||
|
||||
|
||||
t_gui_buffer *gui_buffers = NULL; /* pointer to first buffer */
|
||||
t_gui_buffer *last_gui_buffer = NULL; /* pointer to last buffer */
|
||||
@@ -82,12 +86,15 @@ gui_buffer_new (t_gui_window *window, void *server, void *channel, int type,
|
||||
int switch_to_buffer)
|
||||
{
|
||||
t_gui_buffer *new_buffer, *ptr_buffer;
|
||||
#ifdef PLUGINS
|
||||
char buffer_str[16];
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
weechat_log_printf ("Creating new buffer\n");
|
||||
#endif
|
||||
|
||||
/* use first buffer if no server was assigned to this buffer */
|
||||
/* use first buffer if no server is assigned to this buffer */
|
||||
if ((type == BUFFER_TYPE_STANDARD) && gui_buffers
|
||||
&& (!SERVER(gui_buffers)) && (!channel))
|
||||
{
|
||||
@@ -104,19 +111,20 @@ gui_buffer_new (t_gui_window *window, void *server, void *channel, int type,
|
||||
gui_buffers->completion.server = server;
|
||||
return gui_buffers;
|
||||
}
|
||||
|
||||
|
||||
/* use "all servers" buffer if found */
|
||||
if (cfg_look_one_server_buffer && (type == BUFFER_TYPE_STANDARD) &&
|
||||
gui_buffers && server && !channel)
|
||||
{
|
||||
ptr_buffer = gui_buffer_servers_search ();
|
||||
if (ptr_buffer)
|
||||
{
|
||||
((t_irc_server *)(server))->buffer = gui_buffers;
|
||||
gui_buffers->server = server;
|
||||
((t_irc_server *)(server))->buffer = ptr_buffer;
|
||||
ptr_buffer->server = server;
|
||||
if (switch_to_buffer)
|
||||
gui_window_switch_to_buffer (window, gui_buffers);
|
||||
gui_window_redraw_buffer (gui_buffers);
|
||||
return gui_buffers;
|
||||
gui_window_switch_to_buffer (window, ptr_buffer);
|
||||
gui_window_redraw_buffer (ptr_buffer);
|
||||
return ptr_buffer;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,6 +207,11 @@ gui_buffer_new (t_gui_window *window, void *server, void *channel, int type,
|
||||
new_buffer->ptr_history = NULL;
|
||||
new_buffer->num_history = 0;
|
||||
|
||||
/* text search */
|
||||
new_buffer->text_search = TEXT_SEARCH_DISABLED;
|
||||
new_buffer->text_search_exact = 0;
|
||||
new_buffer->text_search_input = NULL;
|
||||
|
||||
/* add buffer to buffers queue */
|
||||
new_buffer->prev_buffer = last_gui_buffer;
|
||||
if (gui_buffers)
|
||||
@@ -226,6 +239,11 @@ gui_buffer_new (t_gui_window *window, void *server, void *channel, int type,
|
||||
|
||||
/* redraw buffer */
|
||||
gui_window_redraw_buffer (new_buffer);
|
||||
|
||||
#ifdef PLUGINS
|
||||
snprintf (buffer_str, sizeof (buffer_str) - 1, "%d", new_buffer->number);
|
||||
(void) plugin_event_handler_exec ("buffer_open", buffer_str);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
@@ -348,6 +366,41 @@ gui_buffer_find_window (t_gui_buffer *buffer)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_is_scrolled: return 1 if all windows displaying buffer are scrolled
|
||||
* (user doesn't see end of buffer)
|
||||
* return 0 if at least one window is NOT scrolled
|
||||
*/
|
||||
|
||||
int
|
||||
gui_buffer_is_scrolled (t_gui_buffer *buffer)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
int buffer_found;
|
||||
|
||||
if (!buffer)
|
||||
return 0;
|
||||
|
||||
buffer_found = 0;
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
if (ptr_win->buffer == buffer)
|
||||
{
|
||||
buffer_found = 1;
|
||||
/* buffer found and not scrolled, exit immediately */
|
||||
if (!ptr_win->scroll)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* buffer found, and all windows were scrolled */
|
||||
if (buffer_found)
|
||||
return 1;
|
||||
|
||||
/* buffer not found */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_get_dcc: get pointer to DCC buffer (DCC buffer created if not existing)
|
||||
*/
|
||||
@@ -378,6 +431,12 @@ gui_buffer_clear (t_gui_buffer *buffer)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
t_gui_line *ptr_line;
|
||||
|
||||
if (!buffer)
|
||||
return;
|
||||
|
||||
if (buffer->type == BUFFER_TYPE_DCC)
|
||||
return;
|
||||
|
||||
/* remove buffer from hotlist */
|
||||
hotlist_remove_buffer (buffer);
|
||||
@@ -463,9 +522,27 @@ gui_buffer_free (t_gui_buffer *buffer, int switch_to_another)
|
||||
t_gui_line *ptr_line;
|
||||
t_irc_server *ptr_server;
|
||||
int create_new;
|
||||
#ifdef PLUGINS
|
||||
char buffer_str[16];
|
||||
#endif
|
||||
|
||||
#ifdef PLUGINS
|
||||
snprintf (buffer_str, sizeof (buffer_str) - 1, "%d", buffer->number);
|
||||
(void) plugin_event_handler_exec ("buffer_close", buffer_str);
|
||||
#endif
|
||||
|
||||
create_new = (buffer->server || buffer->channel);
|
||||
|
||||
if (switch_to_another)
|
||||
{
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
if ((buffer == ptr_win->buffer) &&
|
||||
((buffer->next_buffer) || (buffer->prev_buffer)))
|
||||
gui_buffer_switch_previous (ptr_win);
|
||||
}
|
||||
}
|
||||
|
||||
hotlist_remove_buffer (buffer);
|
||||
if (hotlist_initial_buffer == buffer)
|
||||
hotlist_initial_buffer = NULL;
|
||||
@@ -486,16 +563,6 @@ gui_buffer_free (t_gui_buffer *buffer, int switch_to_another)
|
||||
ptr_server->saved_buffer = NULL;
|
||||
}
|
||||
|
||||
if (switch_to_another)
|
||||
{
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
if ((buffer == ptr_win->buffer) &&
|
||||
((buffer->next_buffer) || (buffer->prev_buffer)))
|
||||
gui_buffer_switch_previous (ptr_win);
|
||||
}
|
||||
}
|
||||
|
||||
/* decrease buffer number for all next buffers */
|
||||
for (ptr_buffer = buffer->next_buffer; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
@@ -523,6 +590,9 @@ gui_buffer_free (t_gui_buffer *buffer, int switch_to_another)
|
||||
|
||||
history_buffer_free (buffer);
|
||||
|
||||
if (buffer->text_search_input)
|
||||
free (buffer->text_search_input);
|
||||
|
||||
/* remove buffer from buffers list */
|
||||
if (buffer->prev_buffer)
|
||||
buffer->prev_buffer->next_buffer = buffer->next_buffer;
|
||||
@@ -546,7 +616,8 @@ gui_buffer_free (t_gui_buffer *buffer, int switch_to_another)
|
||||
(void) gui_buffer_new (gui_windows, NULL, NULL,
|
||||
BUFFER_TYPE_STANDARD, 1);
|
||||
|
||||
gui_status_draw (gui_current_window->buffer, 1);
|
||||
if (gui_windows && gui_current_window && gui_current_window->buffer)
|
||||
gui_status_draw (gui_current_window->buffer, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -602,6 +673,31 @@ gui_buffer_line_new (t_gui_buffer *buffer, time_t date)
|
||||
return new_line;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_line_search: search for text in a line
|
||||
*/
|
||||
|
||||
int
|
||||
gui_buffer_line_search (t_gui_line *line, char *text, int case_sensitive)
|
||||
{
|
||||
char *data;
|
||||
int rc;
|
||||
|
||||
if (!text || !text[0])
|
||||
return 0;
|
||||
|
||||
rc = 0;
|
||||
data = (char *)gui_color_decode ((unsigned char *)line->data, 0);
|
||||
if (data)
|
||||
{
|
||||
if ((case_sensitive && (strstr (data, text)))
|
||||
|| (!case_sensitive && (ascii_strcasestr (data, text))))
|
||||
rc = 1;
|
||||
free (data);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_merge_servers: merge server buffers in one buffer
|
||||
*/
|
||||
@@ -917,6 +1013,129 @@ gui_buffer_move_to_number (t_gui_buffer *buffer, int number)
|
||||
gui_window_redraw_buffer (buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_search_text: search text in a buffer
|
||||
*/
|
||||
|
||||
int
|
||||
gui_buffer_search_text (t_gui_window *window)
|
||||
{
|
||||
t_gui_line *ptr_line;
|
||||
|
||||
if (window->buffer->text_search == TEXT_SEARCH_BACKWARD)
|
||||
{
|
||||
if (window->buffer->lines
|
||||
&& window->buffer->input_buffer && window->buffer->input_buffer[0])
|
||||
{
|
||||
ptr_line = (window->start_line) ?
|
||||
window->start_line->prev_line : window->buffer->last_line;
|
||||
while (ptr_line)
|
||||
{
|
||||
if (gui_buffer_line_search (ptr_line, window->buffer->input_buffer,
|
||||
window->buffer->text_search_exact))
|
||||
{
|
||||
window->start_line = ptr_line;
|
||||
window->start_line_pos = 0;
|
||||
window->first_line_displayed =
|
||||
(window->start_line == window->buffer->lines);
|
||||
gui_chat_draw (window->buffer, 1);
|
||||
gui_status_draw (window->buffer, 1);
|
||||
return 1;
|
||||
}
|
||||
ptr_line = ptr_line->prev_line;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (window->buffer->text_search == TEXT_SEARCH_FORWARD)
|
||||
{
|
||||
if (window->buffer->lines
|
||||
&& window->buffer->input_buffer && window->buffer->input_buffer[0])
|
||||
{
|
||||
ptr_line = (window->start_line) ?
|
||||
window->start_line->next_line : window->buffer->lines->next_line;
|
||||
while (ptr_line)
|
||||
{
|
||||
if (gui_buffer_line_search (ptr_line, window->buffer->input_buffer,
|
||||
window->buffer->text_search_exact))
|
||||
{
|
||||
window->start_line = ptr_line;
|
||||
window->start_line_pos = 0;
|
||||
window->first_line_displayed =
|
||||
(window->start_line == window->buffer->lines);
|
||||
gui_chat_draw (window->buffer, 1);
|
||||
gui_status_draw (window->buffer, 1);
|
||||
return 1;
|
||||
}
|
||||
ptr_line = ptr_line->next_line;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_search_start: start search in a buffer
|
||||
*/
|
||||
|
||||
void
|
||||
gui_buffer_search_start (t_gui_window *window)
|
||||
{
|
||||
window->buffer->text_search = TEXT_SEARCH_BACKWARD;
|
||||
window->buffer->text_search_exact = 0;
|
||||
if (window->buffer->text_search_input)
|
||||
{
|
||||
free (window->buffer->text_search_input);
|
||||
window->buffer->text_search_input = NULL;
|
||||
}
|
||||
if (window->buffer->input_buffer && window->buffer->input_buffer[0])
|
||||
window->buffer->text_search_input =
|
||||
strdup (window->buffer->input_buffer);
|
||||
gui_action_delete_line (window, NULL);
|
||||
gui_status_draw (window->buffer, 1);
|
||||
gui_input_draw (window->buffer, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_search_restart: restart search (after input changes or exact
|
||||
* flag (un)set)
|
||||
*/
|
||||
|
||||
void
|
||||
gui_buffer_search_restart (t_gui_window *window)
|
||||
{
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
window->buffer->text_search = TEXT_SEARCH_BACKWARD;
|
||||
if (!gui_buffer_search_text (window))
|
||||
{
|
||||
gui_chat_draw (window->buffer, 1);
|
||||
gui_status_draw (window->buffer, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_search_stop: stop search in a buffer
|
||||
*/
|
||||
|
||||
void
|
||||
gui_buffer_search_stop (t_gui_window *window)
|
||||
{
|
||||
window->buffer->text_search = TEXT_SEARCH_DISABLED;
|
||||
window->buffer->text_search = 0;
|
||||
gui_action_delete_line (window, NULL);
|
||||
if (window->buffer->text_search_input)
|
||||
{
|
||||
gui_insert_string_input (window, window->buffer->text_search_input, -1);
|
||||
free (window->buffer->text_search_input);
|
||||
window->buffer->text_search_input = NULL;
|
||||
}
|
||||
window->start_line = NULL;
|
||||
window->start_line_pos = 0;
|
||||
gui_chat_draw (window->buffer, 0);
|
||||
gui_status_draw (window->buffer, 1);
|
||||
gui_input_draw (window->buffer, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_print_log: print buffer infos in log (usually for crash dump)
|
||||
*/
|
||||
@@ -954,6 +1173,10 @@ gui_buffer_print_log (t_gui_buffer *buffer)
|
||||
weechat_log_printf (" history. . . . . . . . : 0x%X\n", buffer->history);
|
||||
weechat_log_printf (" last_history . . . . . : 0x%X\n", buffer->last_history);
|
||||
weechat_log_printf (" ptr_history. . . . . . : 0x%X\n", buffer->ptr_history);
|
||||
weechat_log_printf (" num_history. . . . . . : %d\n", buffer->num_history);
|
||||
weechat_log_printf (" text_search. . . . . . : %d\n", buffer->text_search);
|
||||
weechat_log_printf (" text_search_exact. . . : %d\n", buffer->text_search_exact);
|
||||
weechat_log_printf (" text_search_input. . . : '%s'\n", buffer->text_search_input);
|
||||
weechat_log_printf (" prev_buffer. . . . . . : 0x%X\n", buffer->prev_buffer);
|
||||
weechat_log_printf (" next_buffer. . . . . . : 0x%X\n", buffer->next_buffer);
|
||||
weechat_log_printf ("\n");
|
||||
|
||||
@@ -51,6 +51,10 @@
|
||||
#define NOTIFY_LEVEL_MAX 3
|
||||
#define NOTIFY_LEVEL_DEFAULT NOTIFY_LEVEL_MAX
|
||||
|
||||
#define TEXT_SEARCH_DISABLED 0
|
||||
#define TEXT_SEARCH_BACKWARD 1
|
||||
#define TEXT_SEARCH_FORWARD 2
|
||||
|
||||
/* buffer structures */
|
||||
|
||||
typedef struct t_gui_line t_gui_line;
|
||||
@@ -122,6 +126,11 @@ struct t_gui_buffer
|
||||
t_history *ptr_history; /* current command in history */
|
||||
int num_history; /* number of commands in history */
|
||||
|
||||
/* text search */
|
||||
int text_search; /* text search type */
|
||||
int text_search_exact; /* exact search (case sensitive) ? */
|
||||
char *text_search_input; /* input saved before text search */
|
||||
|
||||
/* link to previous/next buffer */
|
||||
t_gui_buffer *prev_buffer; /* link to previous buffer */
|
||||
t_gui_buffer *next_buffer; /* link to next buffer */
|
||||
|
||||
+39
-5
@@ -44,6 +44,10 @@
|
||||
#include "../common/util.h"
|
||||
#include "../irc/irc.h"
|
||||
|
||||
#ifdef PLUGINS
|
||||
#include "../plugins/plugins.h"
|
||||
#endif
|
||||
|
||||
|
||||
int gui_init_ok = 0; /* = 1 if GUI is initialized */
|
||||
int gui_ok = 0; /* = 1 if GUI is ok */
|
||||
@@ -174,7 +178,8 @@ gui_add_to_line (t_gui_buffer *buffer, int type, time_t date, char *nick, char *
|
||||
gui_chat_draw_line (buffer, buffer->last_line);
|
||||
gui_chat_draw (buffer, 0);
|
||||
}
|
||||
if (gui_add_hotlist && (buffer->num_displayed == 0))
|
||||
if (gui_add_hotlist
|
||||
&& ((buffer->num_displayed == 0) || (gui_buffer_is_scrolled (buffer))))
|
||||
{
|
||||
if (3 - buffer->last_line->line_with_message -
|
||||
buffer->last_line->line_with_highlight <=
|
||||
@@ -603,9 +608,10 @@ gui_input_complete (t_gui_window *window)
|
||||
window->buffer->input_buffer_pos)] != ' ')
|
||||
gui_insert_string_input (window, " ",
|
||||
window->buffer->input_buffer_pos);
|
||||
else
|
||||
window->buffer->input_buffer_pos++;
|
||||
if (window->buffer->completion.position >= 0)
|
||||
window->buffer->completion.position++;
|
||||
window->buffer->input_buffer_pos++;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -619,16 +625,18 @@ gui_input_complete (t_gui_window *window)
|
||||
cfg_look_nick_completor, strlen (cfg_look_nick_completor)) != 0)
|
||||
gui_insert_string_input (window, cfg_look_nick_completor,
|
||||
window->buffer->input_buffer_pos);
|
||||
else
|
||||
window->buffer->input_buffer_pos += utf8_strlen (cfg_look_nick_completor);
|
||||
if (window->buffer->completion.position >= 0)
|
||||
window->buffer->completion.position += strlen (cfg_look_nick_completor);
|
||||
window->buffer->input_buffer_pos += utf8_strlen (cfg_look_nick_completor);
|
||||
if (window->buffer->input_buffer[utf8_real_pos (window->buffer->input_buffer,
|
||||
window->buffer->input_buffer_pos)] != ' ')
|
||||
gui_insert_string_input (window, " ",
|
||||
window->buffer->input_buffer_pos);
|
||||
else
|
||||
window->buffer->input_buffer_pos++;
|
||||
if (window->buffer->completion.position >= 0)
|
||||
window->buffer->completion.position++;
|
||||
window->buffer->input_buffer_pos++;
|
||||
}
|
||||
}
|
||||
gui_input_draw (window->buffer, 0);
|
||||
@@ -795,10 +803,19 @@ int
|
||||
gui_insert_string_input (t_gui_window *window, char *string, int pos)
|
||||
{
|
||||
int i, pos_start, size, length;
|
||||
char *ptr_start;
|
||||
char *ptr_start, *string2;
|
||||
#ifdef PLUGINS
|
||||
char *buffer_before_insert;
|
||||
#endif
|
||||
|
||||
if (window->buffer->has_input)
|
||||
{
|
||||
#ifdef PLUGINS
|
||||
buffer_before_insert =
|
||||
(window->buffer->input_buffer) ?
|
||||
strdup (window->buffer->input_buffer) : strdup ("");
|
||||
#endif
|
||||
|
||||
if (pos == -1)
|
||||
pos = window->buffer->input_buffer_pos;
|
||||
|
||||
@@ -828,6 +845,23 @@ gui_insert_string_input (t_gui_window *window, char *string, int pos)
|
||||
{
|
||||
window->buffer->input_buffer_color_mask[pos_start + i] = ' ';
|
||||
}
|
||||
|
||||
window->buffer->input_buffer_pos += length;
|
||||
|
||||
#ifdef PLUGINS
|
||||
string2 = (char *) malloc (size + 2);
|
||||
if (string2)
|
||||
{
|
||||
snprintf (string2, size + 2, "*%s", string);
|
||||
(void) plugin_keyboard_handler_exec (string2,
|
||||
buffer_before_insert,
|
||||
window->buffer->input_buffer);
|
||||
free (string2);
|
||||
}
|
||||
if (buffer_before_insert)
|
||||
free (buffer_before_insert);
|
||||
#endif
|
||||
|
||||
return length;
|
||||
}
|
||||
return 0;
|
||||
|
||||
+49
-11
@@ -143,6 +143,10 @@ t_gui_key_function gui_key_functions[] =
|
||||
N_("refresh screen") },
|
||||
{ "grab_key", gui_action_grab_key,
|
||||
N_("grab a key") },
|
||||
{ "insert", gui_action_insert_string,
|
||||
N_("insert a string in command line") },
|
||||
{ "search_text", gui_action_search_text,
|
||||
N_("search text in buffer history") },
|
||||
{ NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -322,10 +326,11 @@ gui_keyboard_insert_sorted (t_gui_key *key)
|
||||
*/
|
||||
|
||||
t_gui_key *
|
||||
gui_keyboard_new (char *key, char *command, void *function)
|
||||
gui_keyboard_new (char *key, char *command, t_gui_key_func *function, char *args)
|
||||
{
|
||||
t_gui_key *new_key;
|
||||
char *internal_code;
|
||||
int length;
|
||||
|
||||
if ((new_key = (t_gui_key *) malloc (sizeof (t_gui_key))))
|
||||
{
|
||||
@@ -335,6 +340,21 @@ gui_keyboard_new (char *key, char *command, void *function)
|
||||
free (internal_code);
|
||||
new_key->command = (command) ? strdup (command) : NULL;
|
||||
new_key->function = function;
|
||||
if (args)
|
||||
{
|
||||
if (args[0] == '"')
|
||||
{
|
||||
length = strlen (args);
|
||||
if ((length > 1) && (args[length - 1] == '"'))
|
||||
new_key->args = strndup (args + 1, length - 2);
|
||||
else
|
||||
new_key->args = strdup (args);
|
||||
}
|
||||
else
|
||||
new_key->args = strdup (args);
|
||||
}
|
||||
else
|
||||
new_key->args = NULL;
|
||||
gui_keyboard_insert_sorted (new_key);
|
||||
}
|
||||
else
|
||||
@@ -403,7 +423,7 @@ gui_keyboard_search_part (char *key)
|
||||
* gui_keyboard_function_search_by_name: search a function by name
|
||||
*/
|
||||
|
||||
void *
|
||||
t_gui_key_func *
|
||||
gui_keyboard_function_search_by_name (char *name)
|
||||
{
|
||||
int i;
|
||||
@@ -425,7 +445,7 @@ gui_keyboard_function_search_by_name (char *name)
|
||||
*/
|
||||
|
||||
char *
|
||||
gui_keyboard_function_search_by_ptr (void *function)
|
||||
gui_keyboard_function_search_by_ptr (t_gui_key_func *function)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -448,8 +468,9 @@ gui_keyboard_function_search_by_ptr (void *function)
|
||||
t_gui_key *
|
||||
gui_keyboard_bind (char *key, char *command)
|
||||
{
|
||||
t_gui_key_function *ptr_function;
|
||||
t_gui_key_func *ptr_function;
|
||||
t_gui_key *new_key;
|
||||
char *ptr_args;
|
||||
|
||||
if (!key || !command)
|
||||
{
|
||||
@@ -459,9 +480,20 @@ gui_keyboard_bind (char *key, char *command)
|
||||
}
|
||||
|
||||
ptr_function = NULL;
|
||||
ptr_args = NULL;
|
||||
if (command[0] != '/')
|
||||
{
|
||||
ptr_args = strchr (command, ' ');
|
||||
if (ptr_args)
|
||||
ptr_args[0] = '\0';
|
||||
ptr_function = gui_keyboard_function_search_by_name (command);
|
||||
if (ptr_args)
|
||||
{
|
||||
ptr_args[0] = ' ';
|
||||
ptr_args++;
|
||||
while (ptr_args[0] == ' ')
|
||||
ptr_args++;
|
||||
}
|
||||
if (!ptr_function)
|
||||
{
|
||||
weechat_log_printf (_("%s unable to bind key \"%s\" (invalid function name: \"%s\")\n"),
|
||||
@@ -474,7 +506,8 @@ gui_keyboard_bind (char *key, char *command)
|
||||
|
||||
new_key = gui_keyboard_new (key,
|
||||
(ptr_function) ? NULL : command,
|
||||
ptr_function);
|
||||
ptr_function,
|
||||
ptr_args);
|
||||
if (!new_key)
|
||||
{
|
||||
weechat_log_printf (_("%s not enough memory for key binding\n"),
|
||||
@@ -547,13 +580,16 @@ gui_keyboard_pressed (char *key_str)
|
||||
CHANNEL(gui_current_window->buffer),
|
||||
ptr_key->command, 0);
|
||||
else
|
||||
(void)(ptr_key->function)(gui_current_window);
|
||||
(void)(ptr_key->function)(gui_current_window, ptr_key->args);
|
||||
#ifdef PLUGINS
|
||||
(void) plugin_keyboard_handler_exec (
|
||||
(ptr_key->command) ?
|
||||
ptr_key->command : gui_keyboard_function_search_by_ptr (ptr_key->function),
|
||||
buffer_before_key,
|
||||
gui_current_window->buffer->input_buffer);
|
||||
if (gui_current_window->buffer->text_search == TEXT_SEARCH_DISABLED)
|
||||
{
|
||||
(void) plugin_keyboard_handler_exec (
|
||||
(ptr_key->command) ?
|
||||
ptr_key->command : gui_keyboard_function_search_by_ptr (ptr_key->function),
|
||||
buffer_before_key,
|
||||
gui_current_window->buffer->input_buffer);
|
||||
}
|
||||
#endif
|
||||
if (buffer_before_key)
|
||||
free (buffer_before_key);
|
||||
@@ -580,6 +616,8 @@ gui_keyboard_free (t_gui_key *key)
|
||||
free (key->key);
|
||||
if (key->command)
|
||||
free (key->command);
|
||||
if (key->args)
|
||||
free (key->args);
|
||||
|
||||
/* remove key from keys list */
|
||||
if (key->prev_key)
|
||||
|
||||
@@ -26,14 +26,16 @@
|
||||
|
||||
/* key structures */
|
||||
|
||||
typedef void (t_gui_key_func)(t_gui_window *, char *);
|
||||
|
||||
typedef struct t_gui_key t_gui_key;
|
||||
|
||||
struct t_gui_key
|
||||
{
|
||||
char *key; /* key combo (ex: a, ^W, ^W^C, meta-a) */
|
||||
char *command; /* associated command (may be NULL) */
|
||||
void (*function)(t_gui_window *);
|
||||
/* associated function (if cmd is NULL) */
|
||||
t_gui_key_func *function; /* associated function (if cmd is NULL) */
|
||||
char *args; /* args for function (if cmd is NULL) */
|
||||
t_gui_key *prev_key; /* link to previous key */
|
||||
t_gui_key *next_key; /* link to next key */
|
||||
};
|
||||
@@ -43,7 +45,7 @@ typedef struct t_gui_key_function t_gui_key_function;
|
||||
struct t_gui_key_function
|
||||
{
|
||||
char *function_name; /* name of function */
|
||||
void (*function)(); /* associated function */
|
||||
t_gui_key_func *function; /* associated function */
|
||||
char *description; /* description of function */
|
||||
};
|
||||
|
||||
|
||||
+6
-1
@@ -120,7 +120,7 @@ gui_log_start (t_gui_buffer *buffer)
|
||||
free (log_path2);
|
||||
return;
|
||||
}
|
||||
length = strlen (log_path2) + 64;
|
||||
length = strlen (log_path2) + 128;
|
||||
if (SERVER(buffer))
|
||||
length += strlen (SERVER(buffer)->name);
|
||||
if (CHANNEL(buffer))
|
||||
@@ -150,6 +150,11 @@ gui_log_start (t_gui_buffer *buffer)
|
||||
strcat (buffer->log_filename, SERVER(buffer)->name);
|
||||
strcat (buffer->log_filename, ".");
|
||||
}
|
||||
if (CHANNEL(buffer)
|
||||
&& (CHANNEL(buffer)->type == CHANNEL_TYPE_DCC_CHAT))
|
||||
{
|
||||
strcat (buffer->log_filename, "dcc.");
|
||||
}
|
||||
if (CHANNEL(buffer))
|
||||
{
|
||||
strcat (buffer->log_filename, CHANNEL(buffer)->name);
|
||||
|
||||
@@ -294,6 +294,9 @@ gui_window_free (t_gui_window *window)
|
||||
gui_windows = window->next_window;
|
||||
if (last_gui_window == window)
|
||||
last_gui_window = window->prev_window;
|
||||
|
||||
if (gui_current_window == window)
|
||||
gui_current_window = gui_windows;
|
||||
|
||||
free (window);
|
||||
}
|
||||
|
||||
+58
-50
@@ -85,11 +85,13 @@ extern t_gui_buffer *gui_buffer_new (t_gui_window *, void *, void *, int, int);
|
||||
extern t_gui_buffer *gui_buffer_search (char *, char *);
|
||||
extern t_gui_buffer *gui_buffer_search_by_number (int);
|
||||
extern t_gui_window *gui_buffer_find_window (t_gui_buffer *);
|
||||
extern int gui_buffer_is_scrolled (t_gui_buffer *);
|
||||
extern t_gui_buffer *gui_buffer_get_dcc (t_gui_window *);
|
||||
extern void gui_buffer_clear (t_gui_buffer *);
|
||||
extern void gui_buffer_clear_all ();
|
||||
extern void gui_buffer_free (t_gui_buffer *, int);
|
||||
extern t_gui_line *gui_buffer_line_new (t_gui_buffer *, time_t);
|
||||
extern int gui_buffer_line_search (t_gui_line *, char *, int);
|
||||
extern void gui_buffer_merge_servers (t_gui_window *);
|
||||
extern void gui_buffer_split_server (t_gui_window *);
|
||||
extern void gui_buffer_switch_previous (t_gui_window *);
|
||||
@@ -98,6 +100,10 @@ extern void gui_buffer_switch_dcc (t_gui_window *);
|
||||
extern void gui_buffer_switch_raw_data (t_gui_window *);
|
||||
extern t_gui_buffer *gui_buffer_switch_by_number (t_gui_window *, int);
|
||||
extern void gui_buffer_move_to_number (t_gui_buffer *, int);
|
||||
extern void gui_buffer_search_start (t_gui_window *);
|
||||
extern void gui_buffer_search_restart (t_gui_window *);
|
||||
extern void gui_buffer_search_stop (t_gui_window *);
|
||||
extern int gui_buffer_search_text (t_gui_window *);
|
||||
extern void gui_buffer_print_log (t_gui_buffer *);
|
||||
|
||||
/* panel */
|
||||
@@ -108,54 +114,56 @@ extern void gui_panel_print_log ();
|
||||
|
||||
/* action */
|
||||
extern void gui_action_clipboard_copy (char *, int);
|
||||
extern void gui_action_clipboard_paste (t_gui_window *);
|
||||
extern void gui_action_return (t_gui_window *);
|
||||
extern void gui_action_tab (t_gui_window *);
|
||||
extern void gui_action_tab_previous (t_gui_window *);
|
||||
extern void gui_action_backspace (t_gui_window *);
|
||||
extern void gui_action_delete (t_gui_window *);
|
||||
extern void gui_action_delete_previous_word (t_gui_window *);
|
||||
extern void gui_action_delete_next_word (t_gui_window *);
|
||||
extern void gui_action_delete_begin_of_line (t_gui_window *);
|
||||
extern void gui_action_delete_end_of_line (t_gui_window *);
|
||||
extern void gui_action_delete_line (t_gui_window *);
|
||||
extern void gui_action_transpose_chars (t_gui_window *);
|
||||
extern void gui_action_home (t_gui_window *);
|
||||
extern void gui_action_end (t_gui_window *);
|
||||
extern void gui_action_left (t_gui_window *);
|
||||
extern void gui_action_previous_word (t_gui_window *);
|
||||
extern void gui_action_right (t_gui_window *);
|
||||
extern void gui_action_next_word (t_gui_window *);
|
||||
extern void gui_action_up (t_gui_window *);
|
||||
extern void gui_action_up_global (t_gui_window *);
|
||||
extern void gui_action_down (t_gui_window *);
|
||||
extern void gui_action_down_global (t_gui_window *);
|
||||
extern void gui_action_page_up (t_gui_window *);
|
||||
extern void gui_action_page_down (t_gui_window *);
|
||||
extern void gui_action_scroll_up (t_gui_window *);
|
||||
extern void gui_action_scroll_down (t_gui_window *);
|
||||
extern void gui_action_scroll_top (t_gui_window *);
|
||||
extern void gui_action_scroll_bottom (t_gui_window *);
|
||||
extern void gui_action_scroll_topic_left (t_gui_window *);
|
||||
extern void gui_action_scroll_topic_right (t_gui_window *);
|
||||
extern void gui_action_nick_beginning (t_gui_window *);
|
||||
extern void gui_action_nick_end (t_gui_window *);
|
||||
extern void gui_action_nick_page_up (t_gui_window *);
|
||||
extern void gui_action_nick_page_down (t_gui_window *);
|
||||
extern void gui_action_jump_smart (t_gui_window *);
|
||||
extern void gui_action_jump_dcc (t_gui_window *);
|
||||
extern void gui_action_jump_raw_data (t_gui_window *);
|
||||
extern void gui_action_jump_last_buffer (t_gui_window *);
|
||||
extern void gui_action_jump_server (t_gui_window *);
|
||||
extern void gui_action_jump_next_server (t_gui_window *);
|
||||
extern void gui_action_switch_server (t_gui_window *);
|
||||
extern void gui_action_scroll_previous_highlight (t_gui_window *);
|
||||
extern void gui_action_scroll_next_highlight (t_gui_window *);
|
||||
extern void gui_action_scroll_unread (t_gui_window *);
|
||||
extern void gui_action_hotlist_clear (t_gui_window *);
|
||||
extern void gui_action_infobar_clear (t_gui_window *);
|
||||
extern void gui_action_refresh_screen ();
|
||||
extern void gui_action_grab_key (t_gui_window *);
|
||||
extern void gui_action_clipboard_paste (t_gui_window *, char *);
|
||||
extern void gui_action_return (t_gui_window *, char *);
|
||||
extern void gui_action_tab (t_gui_window *, char *);
|
||||
extern void gui_action_tab_previous (t_gui_window *, char *);
|
||||
extern void gui_action_backspace (t_gui_window *, char *);
|
||||
extern void gui_action_delete (t_gui_window *, char *);
|
||||
extern void gui_action_delete_previous_word (t_gui_window *, char *);
|
||||
extern void gui_action_delete_next_word (t_gui_window *, char *);
|
||||
extern void gui_action_delete_begin_of_line (t_gui_window *, char *);
|
||||
extern void gui_action_delete_end_of_line (t_gui_window *, char *);
|
||||
extern void gui_action_delete_line (t_gui_window *, char *);
|
||||
extern void gui_action_transpose_chars (t_gui_window *, char *);
|
||||
extern void gui_action_home (t_gui_window *, char *);
|
||||
extern void gui_action_end (t_gui_window *, char *);
|
||||
extern void gui_action_left (t_gui_window *, char *);
|
||||
extern void gui_action_previous_word (t_gui_window *, char *);
|
||||
extern void gui_action_right (t_gui_window *, char *);
|
||||
extern void gui_action_next_word (t_gui_window *, char *);
|
||||
extern void gui_action_up (t_gui_window *, char *);
|
||||
extern void gui_action_up_global (t_gui_window *, char *);
|
||||
extern void gui_action_down (t_gui_window *, char *);
|
||||
extern void gui_action_down_global (t_gui_window *, char *);
|
||||
extern void gui_action_page_up (t_gui_window *, char *);
|
||||
extern void gui_action_page_down (t_gui_window *, char *);
|
||||
extern void gui_action_scroll_up (t_gui_window *, char *);
|
||||
extern void gui_action_scroll_down (t_gui_window *, char *);
|
||||
extern void gui_action_scroll_top (t_gui_window *, char *);
|
||||
extern void gui_action_scroll_bottom (t_gui_window *, char *);
|
||||
extern void gui_action_scroll_topic_left (t_gui_window *, char *);
|
||||
extern void gui_action_scroll_topic_right (t_gui_window *, char *);
|
||||
extern void gui_action_nick_beginning (t_gui_window *, char *);
|
||||
extern void gui_action_nick_end (t_gui_window *, char *);
|
||||
extern void gui_action_nick_page_up (t_gui_window *, char *);
|
||||
extern void gui_action_nick_page_down (t_gui_window *, char *);
|
||||
extern void gui_action_jump_smart (t_gui_window *, char *);
|
||||
extern void gui_action_jump_dcc (t_gui_window *, char *);
|
||||
extern void gui_action_jump_raw_data (t_gui_window *, char *);
|
||||
extern void gui_action_jump_last_buffer (t_gui_window *, char *);
|
||||
extern void gui_action_jump_server (t_gui_window *, char *);
|
||||
extern void gui_action_jump_next_server (t_gui_window *, char *);
|
||||
extern void gui_action_switch_server (t_gui_window *, char *);
|
||||
extern void gui_action_scroll_previous_highlight (t_gui_window *, char *);
|
||||
extern void gui_action_scroll_next_highlight (t_gui_window *, char *);
|
||||
extern void gui_action_scroll_unread (t_gui_window *, char *);
|
||||
extern void gui_action_hotlist_clear (t_gui_window *, char *);
|
||||
extern void gui_action_infobar_clear (t_gui_window *, char *);
|
||||
extern void gui_action_refresh_screen (t_gui_window *, char *);
|
||||
extern void gui_action_grab_key (t_gui_window *, char *);
|
||||
extern void gui_action_insert_string (t_gui_window *, char *);
|
||||
extern void gui_action_search_text (t_gui_window *, char *);
|
||||
|
||||
/* key */
|
||||
extern void gui_keyboard_init ();
|
||||
@@ -163,8 +171,8 @@ extern void gui_keyboard_init_grab ();
|
||||
extern char *gui_keyboard_get_internal_code (char *);
|
||||
extern char *gui_keyboard_get_expanded_name (char *);
|
||||
extern t_gui_key *gui_keyboard_search (char *);
|
||||
extern void *gui_keyboard_function_search_by_name (char *);
|
||||
extern char *gui_keyboard_function_search_by_ptr (void *);
|
||||
extern t_gui_key_func *gui_keyboard_function_search_by_name (char *);
|
||||
extern char *gui_keyboard_function_search_by_ptr (t_gui_key_func *);
|
||||
extern t_gui_key *gui_keyboard_bind (char *, char *);
|
||||
extern int gui_keyboard_unbind (char *);
|
||||
extern int gui_keyboard_pressed (char *);
|
||||
|
||||
@@ -258,7 +258,7 @@ t_irc_command irc_commands[] =
|
||||
N_("[channel] [topic]"),
|
||||
N_("channel: channel name\ntopic: new topic for channel "
|
||||
"(if topic is \"-delete\" then topic is deleted)"),
|
||||
"%t|-delete", 0, MAX_ARGS, 1, 1, NULL, irc_cmd_send_topic, irc_cmd_recv_topic },
|
||||
"%t|-delete %-", 0, MAX_ARGS, 1, 1, NULL, irc_cmd_send_topic, irc_cmd_recv_topic },
|
||||
{ "trace", N_("find the route to specific server"),
|
||||
N_("[target]"),
|
||||
N_("target: server"),
|
||||
|
||||
+20
-4
@@ -31,6 +31,7 @@
|
||||
|
||||
#include "../common/weechat.h"
|
||||
#include "irc.h"
|
||||
#include "../common/utf8.h"
|
||||
#include "../common/weeconfig.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
@@ -159,7 +160,7 @@ irc_display_nick (t_gui_buffer *buffer, t_irc_nick *nick, char *nickname,
|
||||
ptr_nickname = strdup ((nick) ? nick->nick : nickname);
|
||||
if (!ptr_nickname)
|
||||
return;
|
||||
nickname_length = strlen (ptr_nickname);
|
||||
nickname_length = utf8_width_screen (ptr_nickname);
|
||||
external_nick = (!nick && !BUFFER_IS_PRIVATE(buffer));
|
||||
disable_prefix_suffix = ((cfg_look_align_nick != CFG_LOOK_ALIGN_NICK_NONE)
|
||||
&& ((int)strlen (cfg_look_nick_prefix) +
|
||||
@@ -371,6 +372,8 @@ irc_display_mode (t_irc_server *server, t_gui_buffer *buffer,
|
||||
void
|
||||
irc_display_server (t_irc_server *server)
|
||||
{
|
||||
char *string;
|
||||
|
||||
gui_printf (NULL, "\n");
|
||||
gui_printf (NULL, _("%sServer: %s%s %s[%s%s%s]\n"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
@@ -416,9 +419,22 @@ irc_display_server (t_irc_server *server)
|
||||
server->realname);
|
||||
gui_printf (NULL, " server_hostname . . . . . : %s\n",
|
||||
(server->hostname) ? server->hostname : "");
|
||||
gui_printf (NULL, " server_command . . . . . . : %s\n",
|
||||
(server->command && server->command[0]) ?
|
||||
server->command : "");
|
||||
if (server->command && server->command[0])
|
||||
string = strdup (server->command);
|
||||
else
|
||||
string = NULL;
|
||||
if (string)
|
||||
{
|
||||
if (cfg_log_hide_nickserv_pwd)
|
||||
irc_hide_password (string, 1);
|
||||
gui_printf (NULL, " server_command . . . . . . : %s\n",
|
||||
string);
|
||||
free (string);
|
||||
}
|
||||
else
|
||||
gui_printf (NULL, " server_command . . . . . . : %s\n",
|
||||
(server->command && server->command[0]) ?
|
||||
server->command : "");
|
||||
gui_printf (NULL, " server_command_delay . . . : %d %s\n",
|
||||
server->command_delay,
|
||||
_("seconds"));
|
||||
|
||||
+2
-1
@@ -31,6 +31,7 @@
|
||||
#include "../common/weechat.h"
|
||||
#include "irc.h"
|
||||
#include "../common/log.h"
|
||||
#include "../common/utf8.h"
|
||||
#include "../common/util.h"
|
||||
#include "../common/weeconfig.h"
|
||||
|
||||
@@ -387,7 +388,7 @@ nick_get_max_length (t_irc_channel *channel)
|
||||
max_length = 0;
|
||||
for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
length = strlen (ptr_nick->nick);
|
||||
length = utf8_width_screen (ptr_nick->nick);
|
||||
if (length > max_length)
|
||||
max_length = length;
|
||||
}
|
||||
|
||||
+69
-48
@@ -50,7 +50,7 @@
|
||||
|
||||
|
||||
char *irc_last_command_received = NULL;
|
||||
int command_ignored;
|
||||
int command_ignored, command_force_highlight;
|
||||
|
||||
|
||||
/*
|
||||
@@ -105,6 +105,10 @@ irc_is_highlight (char *message, char *nick)
|
||||
/* empty message ? */
|
||||
if (!message || !message[0])
|
||||
return 0;
|
||||
|
||||
/* highlight asked by a plugin */
|
||||
if (command_force_highlight)
|
||||
return 1;
|
||||
|
||||
/* highlight by nickname */
|
||||
match = strstr (message, nick);
|
||||
@@ -272,6 +276,7 @@ irc_recv_command (t_irc_server *server, char *entire_line,
|
||||
cmd_name,
|
||||
NULL,
|
||||
server->name);
|
||||
command_force_highlight = 0;
|
||||
#ifdef PLUGINS
|
||||
return_code = plugin_msg_handler_exec (server->name,
|
||||
cmd_name,
|
||||
@@ -280,6 +285,12 @@ irc_recv_command (t_irc_server *server, char *entire_line,
|
||||
so we ignore this message in standard handler */
|
||||
if (return_code & PLUGIN_RC_OK_IGNORE_WEECHAT)
|
||||
command_ignored = 1;
|
||||
/* plugin asked for highlight ? */
|
||||
if (return_code & PLUGIN_RC_OK_WITH_HIGHLIGHT)
|
||||
{
|
||||
command_force_highlight = 1;
|
||||
gui_printf (NULL, "highlight!!!\n");
|
||||
}
|
||||
#endif
|
||||
pos = (dup_host) ? strchr (dup_host, '!') : NULL;
|
||||
if (pos)
|
||||
@@ -323,7 +334,7 @@ irc_cmd_recv_error (t_irc_server *server, char *host, char *nick, char *argument
|
||||
t_gui_buffer *ptr_buffer;
|
||||
t_irc_channel *ptr_channel;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) server;
|
||||
(void) host;
|
||||
(void) nick;
|
||||
@@ -414,7 +425,8 @@ irc_cmd_recv_invite (t_irc_server *server, char *host, char *nick, char *argumen
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
nick);
|
||||
if (gui_add_hotlist && (server->buffer->num_displayed == 0))
|
||||
if (gui_add_hotlist
|
||||
&& ((server->buffer->num_displayed == 0) || (gui_buffer_is_scrolled (server->buffer))))
|
||||
{
|
||||
hotlist_add (HOTLIST_HIGHLIGHT, server, server->buffer, 0);
|
||||
gui_status_draw (gui_current_window->buffer, 1);
|
||||
@@ -479,10 +491,18 @@ irc_cmd_recv_join (t_irc_server *server, char *host, char *nick, char *arguments
|
||||
arguments);
|
||||
}
|
||||
|
||||
/* display channel creation date if joining new channel */
|
||||
/* remove topic and display channel creation date if joining new channel */
|
||||
if (!ptr_channel->nicks)
|
||||
{
|
||||
if (ptr_channel->topic)
|
||||
{
|
||||
free (ptr_channel->topic);
|
||||
ptr_channel->topic = NULL;
|
||||
gui_chat_draw_title (ptr_channel->buffer, 1);
|
||||
}
|
||||
ptr_channel->display_creation_date = 1;
|
||||
|
||||
}
|
||||
|
||||
/* add nick in channel */
|
||||
ptr_nick = nick_new (server, ptr_channel, nick, 0, 0, 0, 0, 0);
|
||||
if (ptr_nick)
|
||||
@@ -1031,7 +1051,8 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *nick, char *argumen
|
||||
(ascii_strcasecmp (nick, "chanserv") != 0) &&
|
||||
(ascii_strcasecmp (nick, "memoserv") != 0))
|
||||
{
|
||||
if (gui_add_hotlist && (server->buffer->num_displayed == 0))
|
||||
if (gui_add_hotlist
|
||||
&& ((server->buffer->num_displayed == 0) || (gui_buffer_is_scrolled (server->buffer))))
|
||||
{
|
||||
hotlist_add (HOTLIST_PRIVATE, server, server->buffer, 0);
|
||||
gui_status_draw (gui_current_window->buffer, 1);
|
||||
@@ -1176,7 +1197,7 @@ irc_cmd_recv_ping (t_irc_server *server, char *host, char *nick, char *arguments
|
||||
{
|
||||
char *pos;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) host;
|
||||
(void) nick;
|
||||
pos = strrchr (arguments, ' ');
|
||||
@@ -1196,7 +1217,7 @@ irc_cmd_recv_pong (t_irc_server *server, char *host, char *nick, char *arguments
|
||||
struct timeval tv;
|
||||
int old_lag;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) host;
|
||||
(void) nick;
|
||||
(void) arguments;
|
||||
@@ -2130,7 +2151,7 @@ irc_cmd_recv_server_mode_reason (t_irc_server *server, char *host,
|
||||
{
|
||||
char *ptr_msg;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) host;
|
||||
(void) nick;
|
||||
|
||||
@@ -2170,7 +2191,7 @@ irc_cmd_recv_server_mode_reason (t_irc_server *server, char *host,
|
||||
int
|
||||
irc_cmd_recv_server_msg (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) host;
|
||||
(void) nick;
|
||||
|
||||
@@ -2204,7 +2225,7 @@ irc_cmd_recv_server_reply (t_irc_server *server, char *host, char *nick, char *a
|
||||
char *pos, *pos2;
|
||||
int first;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) server;
|
||||
(void) host;
|
||||
(void) nick;
|
||||
@@ -2454,7 +2475,7 @@ irc_cmd_recv_221 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
{
|
||||
char *pos_mode;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) server;
|
||||
(void) host;
|
||||
(void) nick;
|
||||
@@ -2504,7 +2525,7 @@ irc_cmd_recv_301 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
t_irc_channel *ptr_channel;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) server;
|
||||
(void) host;
|
||||
(void) nick;
|
||||
@@ -2562,7 +2583,7 @@ irc_cmd_recv_302 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
{
|
||||
char *pos_host, *ptr_next;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) host;
|
||||
(void) nick;
|
||||
|
||||
@@ -2620,7 +2641,7 @@ irc_cmd_recv_303 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
{
|
||||
char *ptr_next;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) host;
|
||||
(void) nick;
|
||||
|
||||
@@ -2668,7 +2689,7 @@ irc_cmd_recv_305 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
{
|
||||
t_gui_window *ptr_window;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) host;
|
||||
(void) nick;
|
||||
|
||||
@@ -2705,7 +2726,7 @@ irc_cmd_recv_306 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
{
|
||||
t_gui_window *ptr_window;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) host;
|
||||
(void) nick;
|
||||
|
||||
@@ -2745,7 +2766,7 @@ irc_cmd_recv_whois_nick_msg (t_irc_server *server, char *host, char *nick, char
|
||||
{
|
||||
char *pos_nick, *pos_msg;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) host;
|
||||
(void) nick;
|
||||
|
||||
@@ -2789,7 +2810,7 @@ irc_cmd_recv_310 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
{
|
||||
char *pos_nick;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) host;
|
||||
(void) nick;
|
||||
|
||||
@@ -2822,7 +2843,7 @@ irc_cmd_recv_311 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
{
|
||||
char *pos_nick, *pos_user, *pos_host, *pos_realname;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) host;
|
||||
(void) nick;
|
||||
|
||||
@@ -2891,7 +2912,7 @@ irc_cmd_recv_312 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
{
|
||||
char *pos_nick, *pos_server, *pos_serverinfo;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) host;
|
||||
(void) nick;
|
||||
|
||||
@@ -2948,7 +2969,7 @@ irc_cmd_recv_314 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
{
|
||||
char *pos_nick, *pos_user, *pos_host, *pos_realname;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) host;
|
||||
(void) nick;
|
||||
|
||||
@@ -3021,7 +3042,7 @@ irc_cmd_recv_315 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
char *pos;
|
||||
t_irc_channel *ptr_channel;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) host;
|
||||
(void) nick;
|
||||
|
||||
@@ -3076,7 +3097,7 @@ irc_cmd_recv_317 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
int idle_time, day, hour, min, sec;
|
||||
time_t datetime;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) host;
|
||||
(void) nick;
|
||||
|
||||
@@ -3161,7 +3182,7 @@ irc_cmd_recv_319 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
{
|
||||
char *pos_nick, *pos_channel, *pos;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) host;
|
||||
(void) nick;
|
||||
|
||||
@@ -3242,7 +3263,7 @@ irc_cmd_recv_321 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
{
|
||||
char *pos;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) host;
|
||||
(void) nick;
|
||||
|
||||
@@ -3274,7 +3295,7 @@ irc_cmd_recv_322 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
{
|
||||
char *pos;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) host;
|
||||
(void) nick;
|
||||
|
||||
@@ -3316,7 +3337,7 @@ irc_cmd_recv_323 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
{
|
||||
char *pos;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) host;
|
||||
(void) nick;
|
||||
|
||||
@@ -3349,7 +3370,7 @@ irc_cmd_recv_324 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
char *pos_channel, *pos_modes, *pos;
|
||||
t_irc_channel *ptr_channel;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) host;
|
||||
(void) nick;
|
||||
|
||||
@@ -3417,7 +3438,7 @@ irc_cmd_recv_329 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
t_irc_channel *ptr_channel;
|
||||
time_t datetime;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) host;
|
||||
(void) nick;
|
||||
|
||||
@@ -3485,7 +3506,7 @@ irc_cmd_recv_331 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
char *pos_channel, *pos;
|
||||
t_irc_channel *ptr_channel;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) server;
|
||||
(void) nick;
|
||||
|
||||
@@ -3545,7 +3566,7 @@ irc_cmd_recv_332 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
t_irc_channel *ptr_channel;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) host;
|
||||
(void) nick;
|
||||
|
||||
@@ -3611,7 +3632,7 @@ irc_cmd_recv_333 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
t_gui_buffer *ptr_buffer;
|
||||
time_t datetime;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) host;
|
||||
(void) nick;
|
||||
|
||||
@@ -3690,7 +3711,7 @@ irc_cmd_recv_338 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
{
|
||||
char *pos_nick, *pos_host, *pos_message;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) host;
|
||||
(void) nick;
|
||||
|
||||
@@ -3746,7 +3767,7 @@ irc_cmd_recv_341 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
{
|
||||
char *pos_nick, *pos_channel;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) host;
|
||||
(void) nick;
|
||||
|
||||
@@ -3810,7 +3831,7 @@ irc_cmd_recv_344 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
{
|
||||
char *pos_channel, *pos_host;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) host;
|
||||
(void) nick;
|
||||
|
||||
@@ -3851,7 +3872,7 @@ irc_cmd_recv_345 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
{
|
||||
char *pos;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) host;
|
||||
(void) nick;
|
||||
|
||||
@@ -3901,7 +3922,7 @@ irc_cmd_recv_348 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
t_gui_buffer *buffer;
|
||||
time_t datetime;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) nick;
|
||||
|
||||
/* look for channel */
|
||||
@@ -4016,7 +4037,7 @@ irc_cmd_recv_349 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
t_irc_channel *ptr_channel;
|
||||
t_gui_buffer *buffer;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) nick;
|
||||
|
||||
pos_channel = strchr (arguments, ' ');
|
||||
@@ -4077,7 +4098,7 @@ irc_cmd_recv_351 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
{
|
||||
char *pos, *pos2;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) server;
|
||||
(void) host;
|
||||
(void) nick;
|
||||
@@ -4122,7 +4143,7 @@ irc_cmd_recv_352 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
t_irc_channel *ptr_channel;
|
||||
t_irc_nick *ptr_nick;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) nick;
|
||||
|
||||
pos_channel = strchr (arguments, ' ');
|
||||
@@ -4247,7 +4268,7 @@ irc_cmd_recv_353 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
t_irc_channel *ptr_channel;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) host;
|
||||
(void) nick;
|
||||
|
||||
@@ -4421,7 +4442,7 @@ irc_cmd_recv_366 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
t_irc_nick *ptr_nick;
|
||||
int num_nicks, num_op, num_halfop, num_voice, num_normal;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) nick;
|
||||
|
||||
pos = strchr (arguments, ' ');
|
||||
@@ -4530,7 +4551,7 @@ irc_cmd_recv_367 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
t_gui_buffer *buffer;
|
||||
time_t datetime;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) nick;
|
||||
|
||||
/* look for channel */
|
||||
@@ -4652,7 +4673,7 @@ irc_cmd_recv_368 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
t_irc_channel *ptr_channel;
|
||||
t_gui_buffer *buffer;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) nick;
|
||||
|
||||
pos_channel = strchr (arguments, ' ');
|
||||
@@ -4713,7 +4734,7 @@ irc_cmd_recv_378 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
{
|
||||
char *pos, *pos2;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) host;
|
||||
(void) nick;
|
||||
|
||||
@@ -4830,7 +4851,7 @@ irc_cmd_recv_438 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
{
|
||||
char *pos, *pos2;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) server;
|
||||
(void) host;
|
||||
(void) nick;
|
||||
@@ -4869,7 +4890,7 @@ irc_cmd_recv_671 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
{
|
||||
char *pos_nick, *pos_message;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) host;
|
||||
(void) nick;
|
||||
|
||||
|
||||
+93
-54
@@ -44,6 +44,58 @@
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
/*
|
||||
* irc_hide_password: hide IRC password(s) in a string
|
||||
*/
|
||||
|
||||
void
|
||||
irc_hide_password (char *string, int look_for_nickserv)
|
||||
{
|
||||
char *pos_nickserv, *pos, *pos_pwd;
|
||||
|
||||
pos = string;
|
||||
while (1)
|
||||
{
|
||||
if (look_for_nickserv)
|
||||
{
|
||||
pos_nickserv = strstr (pos, "nickserv ");
|
||||
if (!pos_nickserv)
|
||||
return;
|
||||
pos = pos_nickserv + 9;
|
||||
while (pos[0] == ' ')
|
||||
pos++;
|
||||
if ((strncmp (pos, "identify ", 9) == 0)
|
||||
|| (strncmp (pos, "register ", 9) == 0))
|
||||
pos_pwd = pos + 9;
|
||||
else
|
||||
pos_pwd = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
pos_pwd = strstr (pos, "identify ");
|
||||
if (!pos_pwd)
|
||||
pos_pwd = strstr (pos, "register ");
|
||||
if (!pos_pwd)
|
||||
return;
|
||||
pos_pwd += 9;
|
||||
}
|
||||
|
||||
if (pos_pwd)
|
||||
{
|
||||
while (pos_pwd[0] == ' ')
|
||||
pos_pwd++;
|
||||
|
||||
while (pos_pwd[0] && (pos_pwd[0] != ';') && (pos_pwd[0] != ' ')
|
||||
&& (pos_pwd[0] != '"'))
|
||||
{
|
||||
pos_pwd[0] = '*';
|
||||
pos_pwd++;
|
||||
}
|
||||
pos = pos_pwd;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_login: login to irc server
|
||||
*/
|
||||
@@ -83,7 +135,7 @@ int
|
||||
irc_cmd_send_admin (t_irc_server *server, t_irc_channel *channel,
|
||||
char *arguments)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
|
||||
if (arguments)
|
||||
@@ -148,7 +200,7 @@ irc_cmd_send_ame (t_irc_server *server, t_irc_channel *channel,
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) server;
|
||||
(void) channel;
|
||||
|
||||
@@ -183,7 +235,7 @@ irc_cmd_send_amsg (t_irc_server *server, t_irc_channel *channel,
|
||||
t_irc_nick *ptr_nick;
|
||||
char *string;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) server;
|
||||
(void) channel;
|
||||
|
||||
@@ -328,7 +380,7 @@ irc_cmd_send_away (t_irc_server *server, t_irc_channel *channel,
|
||||
|
||||
irc_find_context (server, channel, NULL, &buffer);
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
|
||||
gui_add_hotlist = 0;
|
||||
@@ -349,7 +401,7 @@ irc_cmd_send_away (t_irc_server *server, t_irc_channel *channel,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (server->is_connected)
|
||||
if (server && server->is_connected)
|
||||
irc_send_away (server, arguments);
|
||||
else
|
||||
{
|
||||
@@ -459,7 +511,7 @@ irc_cmd_send_ctcp (t_irc_server *server, t_irc_channel *channel,
|
||||
char *pos_type, *pos_args, *pos;
|
||||
struct timeval tv;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
|
||||
pos_type = strchr (arguments, ' ');
|
||||
@@ -733,7 +785,7 @@ int
|
||||
irc_cmd_send_die (t_irc_server *server, t_irc_channel *channel,
|
||||
char *arguments)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
(void) arguments;
|
||||
|
||||
@@ -782,7 +834,7 @@ int
|
||||
irc_cmd_send_info (t_irc_server *server, t_irc_channel *channel,
|
||||
char *arguments)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
|
||||
if (arguments)
|
||||
@@ -830,7 +882,7 @@ int
|
||||
irc_cmd_send_ison (t_irc_server *server, t_irc_channel *channel,
|
||||
char *arguments)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
|
||||
server_sendf (server, "ISON %s", arguments);
|
||||
@@ -845,7 +897,7 @@ int
|
||||
irc_cmd_send_join (t_irc_server *server, t_irc_channel *channel,
|
||||
char *arguments)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
|
||||
if (string_is_channel (arguments))
|
||||
@@ -988,7 +1040,7 @@ irc_cmd_send_kill (t_irc_server *server, t_irc_channel *channel,
|
||||
{
|
||||
char *pos;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
|
||||
pos = strchr (arguments, ' ');
|
||||
@@ -1014,7 +1066,7 @@ int
|
||||
irc_cmd_send_links (t_irc_server *server, t_irc_channel *channel,
|
||||
char *arguments)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
|
||||
if (arguments)
|
||||
@@ -1034,7 +1086,7 @@ irc_cmd_send_list (t_irc_server *server, t_irc_channel *channel,
|
||||
{
|
||||
char buffer[512];
|
||||
int ret;
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
|
||||
if (server->cmd_list_regexp)
|
||||
@@ -1080,7 +1132,7 @@ int
|
||||
irc_cmd_send_lusers (t_irc_server *server, t_irc_channel *channel,
|
||||
char *arguments)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
|
||||
if (arguments)
|
||||
@@ -1122,7 +1174,7 @@ int
|
||||
irc_cmd_send_mode (t_irc_server *server, t_irc_channel *channel,
|
||||
char *arguments)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
|
||||
server_sendf (server, "MODE %s", arguments);
|
||||
@@ -1168,7 +1220,7 @@ int
|
||||
irc_cmd_send_motd (t_irc_server *server, t_irc_channel *channel,
|
||||
char *arguments)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
|
||||
if (arguments)
|
||||
@@ -1189,7 +1241,7 @@ irc_cmd_send_msg (t_irc_server *server, t_irc_channel *channel,
|
||||
t_gui_window *window;
|
||||
t_gui_buffer *buffer;
|
||||
char *pos, *pos_comma;
|
||||
char *msg_pwd_hidden, *pos_pwd;
|
||||
char *msg_pwd_hidden;
|
||||
t_irc_channel *ptr_channel;
|
||||
t_irc_nick *ptr_nick;
|
||||
char *string;
|
||||
@@ -1274,20 +1326,7 @@ irc_cmd_send_msg (t_irc_server *server, t_irc_channel *channel,
|
||||
{
|
||||
msg_pwd_hidden = strdup (pos);
|
||||
if (cfg_log_hide_nickserv_pwd)
|
||||
{
|
||||
pos_pwd = strstr (msg_pwd_hidden, "identify ");
|
||||
if (!pos_pwd)
|
||||
pos_pwd = strstr (msg_pwd_hidden, "register ");
|
||||
if (pos_pwd)
|
||||
{
|
||||
pos_pwd += 9;
|
||||
while (pos_pwd[0])
|
||||
{
|
||||
pos_pwd[0] = '*';
|
||||
pos_pwd++;
|
||||
}
|
||||
}
|
||||
}
|
||||
irc_hide_password (msg_pwd_hidden, 0);
|
||||
irc_display_prefix (server, server->buffer, PREFIX_SERVER);
|
||||
gui_printf_type (server->buffer, MSG_TYPE_NICK,
|
||||
"%s-%s%s%s- ",
|
||||
@@ -1415,7 +1454,7 @@ irc_cmd_send_nick (t_irc_server *server, t_irc_channel *channel,
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
|
||||
if (!server)
|
||||
@@ -1453,7 +1492,7 @@ irc_cmd_send_notice (t_irc_server *server, t_irc_channel *channel,
|
||||
{
|
||||
char *pos, *string;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
|
||||
pos = strchr (arguments, ' ');
|
||||
@@ -1528,7 +1567,7 @@ int
|
||||
irc_cmd_send_oper (t_irc_server *server, t_irc_channel *channel,
|
||||
char *arguments)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
|
||||
server_sendf (server, "OPER %s", arguments);
|
||||
@@ -1626,7 +1665,7 @@ int
|
||||
irc_cmd_send_ping (t_irc_server *server, t_irc_channel *channel,
|
||||
char *arguments)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
|
||||
server_sendf (server, "PING %s", arguments);
|
||||
@@ -1641,7 +1680,7 @@ int
|
||||
irc_cmd_send_pong (t_irc_server *server, t_irc_channel *channel,
|
||||
char *arguments)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
|
||||
server_sendf (server, "PONG %s", arguments);
|
||||
@@ -1760,7 +1799,7 @@ irc_cmd_send_quit (t_irc_server *server, t_irc_channel *channel,
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) server;
|
||||
(void) channel;
|
||||
|
||||
@@ -1781,7 +1820,7 @@ int
|
||||
irc_cmd_send_quote (t_irc_server *server, t_irc_channel *channel,
|
||||
char *arguments)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
|
||||
server_sendf (server, "%s", arguments);
|
||||
@@ -1796,7 +1835,7 @@ int
|
||||
irc_cmd_send_rehash (t_irc_server *server, t_irc_channel *channel,
|
||||
char *arguments)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
(void) arguments;
|
||||
|
||||
@@ -1812,7 +1851,7 @@ int
|
||||
irc_cmd_send_restart (t_irc_server *server, t_irc_channel *channel,
|
||||
char *arguments)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
(void) arguments;
|
||||
|
||||
@@ -1828,7 +1867,7 @@ int
|
||||
irc_cmd_send_service (t_irc_server *server, t_irc_channel *channel,
|
||||
char *arguments)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
|
||||
server_sendf (server, "SERVICE %s", arguments);
|
||||
@@ -1843,7 +1882,7 @@ int
|
||||
irc_cmd_send_servlist (t_irc_server *server, t_irc_channel *channel,
|
||||
char *arguments)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
|
||||
if (arguments)
|
||||
@@ -1863,7 +1902,7 @@ irc_cmd_send_squery (t_irc_server *server, t_irc_channel *channel,
|
||||
{
|
||||
char *pos;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
|
||||
pos = strchr (arguments, ' ');
|
||||
@@ -1891,7 +1930,7 @@ int
|
||||
irc_cmd_send_squit (t_irc_server *server, t_irc_channel *channel,
|
||||
char *arguments)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
|
||||
server_sendf (server, "SQUIT %s", arguments);
|
||||
@@ -1906,7 +1945,7 @@ int
|
||||
irc_cmd_send_stats (t_irc_server *server, t_irc_channel *channel,
|
||||
char *arguments)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
|
||||
if (arguments)
|
||||
@@ -1925,7 +1964,7 @@ int
|
||||
irc_cmd_send_summon (t_irc_server *server, t_irc_channel *channel,
|
||||
char *arguments)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
|
||||
server_sendf (server, "SUMMON %s", arguments);
|
||||
@@ -1940,7 +1979,7 @@ int
|
||||
irc_cmd_send_time (t_irc_server *server, t_irc_channel *channel,
|
||||
char *arguments)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
|
||||
if (arguments)
|
||||
@@ -2020,7 +2059,7 @@ int
|
||||
irc_cmd_send_trace (t_irc_server *server, t_irc_channel *channel,
|
||||
char *arguments)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
|
||||
if (arguments)
|
||||
@@ -2115,7 +2154,7 @@ int
|
||||
irc_cmd_send_userhost (t_irc_server *server, t_irc_channel *channel,
|
||||
char *arguments)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
|
||||
server_sendf (server, "USERHOST %s", arguments);
|
||||
@@ -2130,7 +2169,7 @@ int
|
||||
irc_cmd_send_users (t_irc_server *server, t_irc_channel *channel,
|
||||
char *arguments)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
|
||||
if (arguments)
|
||||
@@ -2215,7 +2254,7 @@ int
|
||||
irc_cmd_send_wallops (t_irc_server *server, t_irc_channel *channel,
|
||||
char *arguments)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
|
||||
server_sendf (server, "WALLOPS :%s", arguments);
|
||||
@@ -2230,7 +2269,7 @@ int
|
||||
irc_cmd_send_who (t_irc_server *server, t_irc_channel *channel,
|
||||
char *arguments)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
|
||||
if (arguments)
|
||||
@@ -2248,7 +2287,7 @@ int
|
||||
irc_cmd_send_whois (t_irc_server *server, t_irc_channel *channel,
|
||||
char *arguments)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
|
||||
server_sendf (server, "WHOIS %s", arguments);
|
||||
@@ -2263,7 +2302,7 @@ int
|
||||
irc_cmd_send_whowas (t_irc_server *server, t_irc_channel *channel,
|
||||
char *arguments)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) channel;
|
||||
|
||||
server_sendf (server, "WHOWAS %s", arguments);
|
||||
|
||||
@@ -1092,7 +1092,7 @@ server_close_connection (t_irc_server *server)
|
||||
{
|
||||
#ifdef HAVE_GNUTLS
|
||||
if (server->ssl_connected)
|
||||
gnutls_bye (server->gnutls_sess, GNUTLS_SHUT_RDWR);
|
||||
gnutls_bye (server->gnutls_sess, GNUTLS_SHUT_WR);
|
||||
#endif
|
||||
close (server->sock);
|
||||
server->sock = -1;
|
||||
|
||||
@@ -472,6 +472,7 @@ extern void irc_display_server (t_irc_server *ptr_server);
|
||||
/* IRC commands issued by user (irc-send.c) */
|
||||
|
||||
extern void irc_login (t_irc_server *);
|
||||
extern void irc_hide_password (char *, int);
|
||||
extern int irc_cmd_send_admin (t_irc_server *, t_irc_channel *, char *);
|
||||
extern int irc_cmd_send_ame (t_irc_server *, t_irc_channel *, char *);
|
||||
extern int irc_cmd_send_amsg (t_irc_server *, t_irc_channel *, char *);
|
||||
|
||||
@@ -996,7 +996,7 @@ weechat_aspell_speller_command (t_weechat_plugin *p,
|
||||
char **args;
|
||||
int c, r;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) p;
|
||||
(void) handler_args;
|
||||
(void) handler_pointer;
|
||||
@@ -1227,7 +1227,7 @@ weechat_aspell_keyb_check (t_weechat_plugin *p, int argc, char **argv,
|
||||
char *input, *ptr_input, *pos_space, *clword;
|
||||
int count, offset;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) p;
|
||||
(void) handler_args;
|
||||
(void) handler_pointer;
|
||||
@@ -1381,7 +1381,7 @@ void weechat_plugin_end (t_weechat_plugin *p)
|
||||
aspell_speller_t *s, *t;
|
||||
aspell_config_t *c, *d;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) p;
|
||||
|
||||
weechat_aspell_options_save ();
|
||||
|
||||
@@ -29,8 +29,6 @@
|
||||
#include "weechat-charset.h"
|
||||
|
||||
|
||||
char *weechat_charset_excluded_cmd[] = { "ping", "pong", NULL };
|
||||
|
||||
char *weechat_charset_terminal = NULL;
|
||||
char *weechat_charset_internal = NULL;
|
||||
|
||||
@@ -185,28 +183,6 @@ weechat_charset_set_config (t_weechat_plugin *plugin,
|
||||
plugin->set_plugin_config (plugin, option, value);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_charset_command_allowed: return 1 if command can be decoded/encoded
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_charset_command_allowed (char *command)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!command)
|
||||
return 0;
|
||||
|
||||
for (i = 0; weechat_charset_excluded_cmd[i]; i++)
|
||||
{
|
||||
if (strcasecmp (weechat_charset_excluded_cmd[i], command) == 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* command can be decoded/recoded */
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_charset_parse_irc_msg: return nick, command, channel and position
|
||||
* of arguments in IRC message
|
||||
@@ -216,15 +192,19 @@ void
|
||||
weechat_charset_parse_irc_msg (char *message, char **nick, char **command,
|
||||
char **channel, char **pos_args)
|
||||
{
|
||||
char *pos, *pos2, *pos3;
|
||||
char *pos, *pos2, *pos3, *pos4, *pos_tmp;
|
||||
|
||||
*nick = NULL;
|
||||
*command = NULL;
|
||||
*channel = NULL;
|
||||
*pos_args = NULL;
|
||||
|
||||
if (message[0] == ':')
|
||||
{
|
||||
pos = message + 1;
|
||||
pos_tmp = strchr (pos, ' ');
|
||||
if (pos_tmp)
|
||||
pos_tmp[0] = '\0';
|
||||
pos2 = strchr (pos, '!');
|
||||
if (pos2)
|
||||
*nick = weechat_charset_strndup (pos, pos2 - pos);
|
||||
@@ -234,6 +214,8 @@ weechat_charset_parse_irc_msg (char *message, char **nick, char **command,
|
||||
if (pos2)
|
||||
*nick = weechat_charset_strndup (pos, pos2 - pos);
|
||||
}
|
||||
if (pos_tmp)
|
||||
pos_tmp[0] = ' ';
|
||||
pos = strchr (message, ' ');
|
||||
if (!pos)
|
||||
pos = message;
|
||||
@@ -276,6 +258,21 @@ weechat_charset_parse_irc_msg (char *message, char **nick, char **command,
|
||||
else
|
||||
*nick = strdup (pos2);
|
||||
}
|
||||
if (pos3)
|
||||
{
|
||||
pos3++;
|
||||
while (pos3[0] == ' ')
|
||||
pos3++;
|
||||
if ((pos3[0] == '#') || (pos3[0] == '&')
|
||||
|| (pos3[0] == '+') || (pos3[0] == '!'))
|
||||
{
|
||||
pos4 = strchr (pos3, ' ');
|
||||
if (pos4)
|
||||
*channel = weechat_charset_strndup (pos3, pos4 - pos3);
|
||||
else
|
||||
*channel = strdup (pos3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -292,10 +289,9 @@ weechat_charset_irc_in (t_weechat_plugin *plugin, int argc, char **argv,
|
||||
char *handler_args, void *handler_pointer)
|
||||
{
|
||||
char *nick, *command, *channel, *charset, *ptr_args;
|
||||
char *decoded, *output;
|
||||
int length;
|
||||
char *output;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) argc;
|
||||
(void) handler_args;
|
||||
(void) handler_pointer;
|
||||
@@ -303,33 +299,20 @@ weechat_charset_irc_in (t_weechat_plugin *plugin, int argc, char **argv,
|
||||
output = NULL;
|
||||
|
||||
weechat_charset_parse_irc_msg (argv[1], &nick, &command, &channel, &ptr_args);
|
||||
|
||||
if (weechat_charset_command_allowed (command))
|
||||
|
||||
charset = weechat_charset_get_config (plugin,
|
||||
"decode", argv[0],
|
||||
(channel) ? channel : nick);
|
||||
|
||||
if (weechat_charset_debug)
|
||||
plugin->print(plugin, NULL, NULL,
|
||||
"Charset IN: srv='%s', nick='%s', chan='%s', "
|
||||
"msg='%s', ptr_args='%s' => charset: %s",
|
||||
argv[0], nick, channel, argv[1], ptr_args, charset);
|
||||
|
||||
if (charset)
|
||||
{
|
||||
charset = weechat_charset_get_config (plugin,
|
||||
"decode", argv[0],
|
||||
(channel) ? channel : nick);
|
||||
|
||||
if (weechat_charset_debug)
|
||||
plugin->print(plugin, NULL, NULL,
|
||||
"Charset IN: srv='%s', nick='%s', chan='%s', "
|
||||
"msg='%s', ptr_args='%s' => charset: %s",
|
||||
argv[0], nick, channel, argv[1], ptr_args, charset);
|
||||
|
||||
if (ptr_args && charset)
|
||||
{
|
||||
decoded = plugin->iconv_to_internal (plugin, charset, ptr_args);
|
||||
if (decoded)
|
||||
{
|
||||
length = strlen (decoded) + (ptr_args - argv[1]) + 1;
|
||||
output = (char *)malloc (length + 1);
|
||||
strncpy (output, argv[1], ptr_args - argv[1]);
|
||||
output[ptr_args - argv[1]] = '\0';
|
||||
strcat (output, decoded);
|
||||
free (decoded);
|
||||
}
|
||||
}
|
||||
|
||||
output = plugin->iconv_to_internal (plugin, charset, argv[1]);
|
||||
if (charset)
|
||||
free (charset);
|
||||
}
|
||||
@@ -354,10 +337,9 @@ weechat_charset_irc_out (t_weechat_plugin *plugin, int argc, char **argv,
|
||||
char *handler_args, void *handler_pointer)
|
||||
{
|
||||
char *nick, *command, *channel, *charset, *ptr_args;
|
||||
char *encoded, *output;
|
||||
int length;
|
||||
char *output;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) argc;
|
||||
(void) handler_args;
|
||||
(void) handler_pointer;
|
||||
@@ -365,33 +347,20 @@ weechat_charset_irc_out (t_weechat_plugin *plugin, int argc, char **argv,
|
||||
output = NULL;
|
||||
|
||||
weechat_charset_parse_irc_msg (argv[1], &nick, &command, &channel, &ptr_args);
|
||||
|
||||
charset = weechat_charset_get_config (plugin,
|
||||
"encode", argv[0],
|
||||
(channel) ? channel : nick);
|
||||
|
||||
if (weechat_charset_debug)
|
||||
plugin->print(plugin, NULL, NULL,
|
||||
"Charset OUT: srv='%s', nick='%s', chan='%s', "
|
||||
"msg='%s', ptr_args='%s' => charset: %s",
|
||||
argv[0], nick, channel, argv[1], ptr_args, charset);
|
||||
|
||||
if (weechat_charset_command_allowed (command))
|
||||
if (charset)
|
||||
{
|
||||
charset = weechat_charset_get_config (plugin,
|
||||
"encode", argv[0],
|
||||
(channel) ? channel : nick);
|
||||
|
||||
if (weechat_charset_debug)
|
||||
plugin->print(plugin, NULL, NULL,
|
||||
"Charset OUT: srv='%s', nick='%s', chan='%s', "
|
||||
"msg='%s', ptr_args='%s' => charset: %s",
|
||||
argv[0], nick, channel, argv[1], ptr_args, charset);
|
||||
|
||||
if (ptr_args && charset)
|
||||
{
|
||||
encoded = plugin->iconv_from_internal (plugin, charset, ptr_args);
|
||||
if (encoded)
|
||||
{
|
||||
length = strlen (encoded) + (ptr_args - argv[1]) + 1;
|
||||
output = (char *)malloc (length + 1);
|
||||
strncpy (output, argv[1], ptr_args - argv[1]);
|
||||
output[ptr_args - argv[1]] = '\0';
|
||||
strcat (output, encoded);
|
||||
free (encoded);
|
||||
}
|
||||
}
|
||||
|
||||
output = plugin->iconv_from_internal (plugin, charset, argv[1]);
|
||||
if (charset)
|
||||
free (charset);
|
||||
}
|
||||
@@ -503,7 +472,7 @@ weechat_charset_cmd (t_weechat_plugin *plugin,
|
||||
if (cmd_argc < 3)
|
||||
return PLUGIN_RC_KO;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) handler_args;
|
||||
(void) handler_pointer;
|
||||
|
||||
@@ -655,7 +624,7 @@ weechat_plugin_init (t_weechat_plugin *plugin)
|
||||
void
|
||||
weechat_plugin_end (t_weechat_plugin *plugin)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) plugin;
|
||||
|
||||
if (weechat_charset_terminal)
|
||||
|
||||
@@ -52,7 +52,7 @@ int
|
||||
weechat_ascii_strcasecmp (t_weechat_plugin *plugin,
|
||||
char *string1, char *string2)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) plugin;
|
||||
|
||||
return ascii_strcasecmp (string1, string2);
|
||||
@@ -67,7 +67,7 @@ int
|
||||
weechat_ascii_strncasecmp (t_weechat_plugin *plugin,
|
||||
char *string1, char *string2, int max)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) plugin;
|
||||
|
||||
return ascii_strncasecmp (string1, string2, max);
|
||||
@@ -82,7 +82,7 @@ weechat_explode_string (t_weechat_plugin *plugin, char *string,
|
||||
char *separators, int num_items_max,
|
||||
int *num_items)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) plugin;
|
||||
|
||||
if (!plugin || !string || !separators || !num_items)
|
||||
@@ -98,7 +98,7 @@ weechat_explode_string (t_weechat_plugin *plugin, char *string,
|
||||
void
|
||||
weechat_free_exploded_string (t_weechat_plugin *plugin, char **exploded_string)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) plugin;
|
||||
|
||||
free_exploded_string (exploded_string);
|
||||
@@ -114,7 +114,7 @@ weechat_plugin_mkdir_home (t_weechat_plugin *plugin, char *directory)
|
||||
char *dir_name;
|
||||
int dir_length;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) plugin;
|
||||
|
||||
if (!directory)
|
||||
@@ -166,7 +166,7 @@ weechat_plugin_print (t_weechat_plugin *plugin,
|
||||
t_gui_buffer *ptr_buffer;
|
||||
va_list argptr;
|
||||
static char buf[8192];
|
||||
char *buf2;
|
||||
char *buf2, *buf3;
|
||||
|
||||
if (!plugin || !message)
|
||||
return;
|
||||
@@ -177,10 +177,14 @@ weechat_plugin_print (t_weechat_plugin *plugin,
|
||||
va_end (argptr);
|
||||
|
||||
buf2 = weechat_iconv_to_internal (plugin->charset, buf);
|
||||
buf3 = (char *)gui_color_decode ((unsigned char *)((buf2) ? buf2 : buf),
|
||||
cfg_irc_colors_receive);
|
||||
irc_display_prefix (NULL, ptr_buffer, PREFIX_PLUGIN);
|
||||
gui_printf (ptr_buffer, "%s\n", (buf2) ? buf2 : buf);
|
||||
gui_printf (ptr_buffer, "%s\n", (buf3) ? buf3 : ((buf2) ? buf2 : buf));
|
||||
if (buf2)
|
||||
free (buf2);
|
||||
if (buf3)
|
||||
free (buf3);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -192,7 +196,7 @@ weechat_plugin_print_server (t_weechat_plugin *plugin, char *message, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
static char buf[8192];
|
||||
char *buf2;
|
||||
char *buf2, *buf3;
|
||||
|
||||
if (!plugin || !message)
|
||||
return;
|
||||
@@ -202,10 +206,14 @@ weechat_plugin_print_server (t_weechat_plugin *plugin, char *message, ...)
|
||||
va_end (argptr);
|
||||
|
||||
buf2 = weechat_iconv_to_internal (plugin->charset, buf);
|
||||
buf3 = (char *)gui_color_decode ((unsigned char *)((buf2) ? buf2 : buf),
|
||||
cfg_irc_colors_receive);
|
||||
irc_display_prefix (NULL, NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, "%s\n", (buf2) ? buf2 : buf);
|
||||
gui_printf (NULL, "%s\n", (buf3) ? buf3 : ((buf2) ? buf2 : buf));
|
||||
if (buf2)
|
||||
free (buf2);
|
||||
if (buf3)
|
||||
free (buf3);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -356,6 +364,22 @@ weechat_plugin_keyboard_handler_add (t_weechat_plugin *plugin,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_event_handler_add: add an event handler
|
||||
*/
|
||||
|
||||
t_plugin_handler *
|
||||
weechat_plugin_event_handler_add (t_weechat_plugin *plugin, char *event,
|
||||
t_plugin_handler_func *handler_func,
|
||||
char *handler_args, void *handler_pointer)
|
||||
{
|
||||
if (plugin && event && handler_func)
|
||||
return plugin_event_handler_add (plugin, event, handler_func,
|
||||
handler_args, handler_pointer);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_handler_remove: remove a WeeChat handler
|
||||
*/
|
||||
@@ -571,6 +595,15 @@ weechat_plugin_get_info (t_weechat_plugin *plugin, char *info, char *server)
|
||||
if (ptr_server && ptr_server->is_connected && ptr_server->name)
|
||||
return strdup (ptr_server->name);
|
||||
}
|
||||
else if (ascii_strcasecmp (info, "type") == 0)
|
||||
{
|
||||
return_str = (char *) malloc (32);
|
||||
if (!return_str)
|
||||
return NULL;
|
||||
snprintf (return_str, 32, "%d",
|
||||
gui_current_window->buffer->type);
|
||||
return return_str;
|
||||
}
|
||||
else if (ascii_strcasecmp (info, "away") == 0)
|
||||
{
|
||||
if (ptr_server && ptr_server->is_connected && ptr_server->is_away)
|
||||
@@ -728,7 +761,7 @@ weechat_plugin_get_config (t_weechat_plugin *plugin, char *option)
|
||||
char option_name[256];
|
||||
void *ptr_option_value;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) plugin;
|
||||
|
||||
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
|
||||
@@ -785,7 +818,7 @@ weechat_plugin_set_config (t_weechat_plugin *plugin, char *option, char *value)
|
||||
t_irc_server *ptr_server;
|
||||
t_config_option *ptr_option;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) plugin;
|
||||
|
||||
if (!option || !value)
|
||||
@@ -970,6 +1003,8 @@ weechat_plugin_free_server_info (t_weechat_plugin *plugin, t_plugin_server_info
|
||||
free (server_info->notify_levels);
|
||||
if (server_info->nick)
|
||||
free (server_info->nick);
|
||||
if (server_info->nick_modes)
|
||||
free (server_info->nick_modes);
|
||||
new_server_info = server_info->next_server;
|
||||
free (server_info);
|
||||
server_info = new_server_info;
|
||||
|
||||
+113
-7
@@ -221,6 +221,7 @@ plugin_msg_handler_add (t_weechat_plugin *plugin, char *irc_command,
|
||||
new_handler->completion_template = NULL;
|
||||
new_handler->interval = 0;
|
||||
new_handler->remaining = 0;
|
||||
new_handler->event = NULL;
|
||||
new_handler->handler = handler_func;
|
||||
new_handler->handler_args = (handler_args) ? strdup (handler_args) : NULL;
|
||||
new_handler->handler_pointer = handler_pointer;
|
||||
@@ -304,6 +305,7 @@ plugin_cmd_handler_add (t_weechat_plugin *plugin, char *command,
|
||||
new_handler->completion_template = (completion_template) ? strdup (completion_template) : strdup ("");
|
||||
new_handler->interval = 0;
|
||||
new_handler->remaining = 0;
|
||||
new_handler->event = NULL;
|
||||
new_handler->handler = handler_func;
|
||||
new_handler->handler_args = (handler_args) ? strdup (handler_args) : NULL;
|
||||
new_handler->handler_pointer = handler_pointer;
|
||||
@@ -364,6 +366,7 @@ plugin_timer_handler_add (t_weechat_plugin *plugin, int interval,
|
||||
new_handler->completion_template = NULL;
|
||||
new_handler->interval = interval;
|
||||
new_handler->remaining = interval;
|
||||
new_handler->event = NULL;
|
||||
new_handler->handler = handler_func;
|
||||
new_handler->handler_args = (handler_args) ? strdup (handler_args) : NULL;
|
||||
new_handler->handler_pointer = handler_pointer;
|
||||
@@ -390,14 +393,13 @@ plugin_timer_handler_add (t_weechat_plugin *plugin, int interval,
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_keyboard_handler_add: add a timer handler
|
||||
* plugin_keyboard_handler_add: add a keyboard handler
|
||||
* arguments:
|
||||
* 1. the plugin pointer
|
||||
* 2. the interval between two calls
|
||||
* 3. the handler function
|
||||
* 4. handler args: a string given to
|
||||
* 2. the handler function
|
||||
* 3. handler args: a string given to
|
||||
* handler when called (used by scripts)
|
||||
* 5. handler pointer: a pointer given to
|
||||
* 4. handler pointer: a pointer given to
|
||||
* handler when called (used by scripts)
|
||||
*/
|
||||
|
||||
@@ -420,6 +422,7 @@ plugin_keyboard_handler_add (t_weechat_plugin *plugin,
|
||||
new_handler->completion_template = NULL;
|
||||
new_handler->interval = 0;
|
||||
new_handler->remaining = 0;
|
||||
new_handler->event = NULL;
|
||||
new_handler->handler = handler_func;
|
||||
new_handler->handler_args = (handler_args) ? strdup (handler_args) : NULL;
|
||||
new_handler->handler_pointer = handler_pointer;
|
||||
@@ -445,6 +448,63 @@ plugin_keyboard_handler_add (t_weechat_plugin *plugin,
|
||||
return new_handler;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_event_handler_add: add an event handler
|
||||
* arguments:
|
||||
* 1. the plugin pointer
|
||||
* 2. the event to catch
|
||||
* 3. the handler function
|
||||
* 4. handler args: a string given to
|
||||
* handler when called (used by scripts)
|
||||
* 5. handler pointer: a pointer given to
|
||||
* handler when called (used by scripts)
|
||||
*/
|
||||
|
||||
t_plugin_handler *
|
||||
plugin_event_handler_add (t_weechat_plugin *plugin, char *event,
|
||||
t_plugin_handler_func *handler_func,
|
||||
char *handler_args, void *handler_pointer)
|
||||
{
|
||||
t_plugin_handler *new_handler;
|
||||
|
||||
new_handler = (t_plugin_handler *)malloc (sizeof (t_plugin_handler));
|
||||
if (new_handler)
|
||||
{
|
||||
new_handler->type = PLUGIN_HANDLER_EVENT;
|
||||
new_handler->irc_command = NULL;
|
||||
new_handler->command = NULL;
|
||||
new_handler->description = NULL;
|
||||
new_handler->arguments = NULL;
|
||||
new_handler->arguments_description = NULL;
|
||||
new_handler->completion_template = NULL;
|
||||
new_handler->interval = 0;
|
||||
new_handler->remaining = 0;
|
||||
new_handler->event = strdup (event);
|
||||
new_handler->handler = handler_func;
|
||||
new_handler->handler_args = (handler_args) ? strdup (handler_args) : NULL;
|
||||
new_handler->handler_pointer = handler_pointer;
|
||||
new_handler->running = 0;
|
||||
|
||||
/* add new handler to list */
|
||||
new_handler->prev_handler = plugin->last_handler;
|
||||
new_handler->next_handler = NULL;
|
||||
if (plugin->handlers)
|
||||
(plugin->last_handler)->next_handler = new_handler;
|
||||
else
|
||||
plugin->handlers = new_handler;
|
||||
plugin->last_handler = new_handler;
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s plugin %s: unable to add event handler (not enough memory)\n"),
|
||||
WEECHAT_ERROR, plugin->name);
|
||||
return NULL;
|
||||
}
|
||||
return new_handler;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_msg_handler_exec: execute a message handler
|
||||
* return: code for informing WeeChat whether message
|
||||
@@ -491,6 +551,8 @@ plugin_msg_handler_exec (char *server, char *irc_command, char *irc_message)
|
||||
final_return_code = PLUGIN_RC_OK_IGNORE_WEECHAT;
|
||||
if (return_code & PLUGIN_RC_OK_IGNORE_PLUGINS)
|
||||
return final_return_code;
|
||||
if (return_code & PLUGIN_RC_OK_WITH_HIGHLIGHT)
|
||||
final_return_code = PLUGIN_RC_OK_WITH_HIGHLIGHT;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -627,6 +689,46 @@ plugin_keyboard_handler_exec (char *key, char *input_before, char *input_after)
|
||||
return final_return_code;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_event_handler_exec: execute an event handler
|
||||
* return: PLUGIN_RC_OK if all ok
|
||||
* PLUGIN_RC_KO if at least one handler failed
|
||||
*/
|
||||
|
||||
int
|
||||
plugin_event_handler_exec (char *event, char *data)
|
||||
{
|
||||
t_weechat_plugin *ptr_plugin;
|
||||
t_plugin_handler *ptr_handler;
|
||||
int return_code, final_return_code;
|
||||
char *argv[1] = { NULL };
|
||||
|
||||
argv[0] = data;
|
||||
|
||||
final_return_code = PLUGIN_RC_OK;
|
||||
|
||||
for (ptr_plugin = weechat_plugins; ptr_plugin;
|
||||
ptr_plugin = ptr_plugin->next_plugin)
|
||||
{
|
||||
for (ptr_handler = ptr_plugin->handlers;
|
||||
ptr_handler; ptr_handler = ptr_handler->next_handler)
|
||||
{
|
||||
if ((ptr_handler->type == PLUGIN_HANDLER_EVENT)
|
||||
&& (ascii_strcasecmp (ptr_handler->event, event) == 0))
|
||||
{
|
||||
return_code = ((int) (ptr_handler->handler) (ptr_plugin,
|
||||
1, argv,
|
||||
ptr_handler->handler_args,
|
||||
ptr_handler->handler_pointer));
|
||||
if (return_code == PLUGIN_RC_KO)
|
||||
final_return_code = PLUGIN_RC_KO;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return final_return_code;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_handler_remove: remove a handler for a plugin
|
||||
*/
|
||||
@@ -652,7 +754,8 @@ plugin_handler_remove (t_weechat_plugin *plugin,
|
||||
(handler->next_handler)->prev_handler = handler->prev_handler;
|
||||
|
||||
/* remove command from WeeChat command list, if command handler */
|
||||
if (handler->type == PLUGIN_HANDLER_COMMAND)
|
||||
if ((handler->type == PLUGIN_HANDLER_COMMAND)
|
||||
&& (!command_used_by_weechat (handler->command)))
|
||||
weelist_remove (&index_commands, &last_index_command,
|
||||
weelist_search (index_commands, handler->command));
|
||||
|
||||
@@ -667,6 +770,8 @@ plugin_handler_remove (t_weechat_plugin *plugin,
|
||||
free (handler->arguments);
|
||||
if (handler->arguments_description)
|
||||
free (handler->arguments_description);
|
||||
if (handler->event)
|
||||
free (handler->event);
|
||||
if (handler->handler_args)
|
||||
free (handler->handler_args);
|
||||
|
||||
@@ -1055,6 +1160,7 @@ plugin_load (char *filename)
|
||||
new_plugin->cmd_handler_add = &weechat_plugin_cmd_handler_add;
|
||||
new_plugin->timer_handler_add = &weechat_plugin_timer_handler_add;
|
||||
new_plugin->keyboard_handler_add = &weechat_plugin_keyboard_handler_add;
|
||||
new_plugin->event_handler_add = &weechat_plugin_event_handler_add;
|
||||
new_plugin->handler_remove = &weechat_plugin_handler_remove;
|
||||
new_plugin->handler_remove_all = &weechat_plugin_handler_remove_all;
|
||||
new_plugin->modifier_add = &weechat_plugin_modifier_add;
|
||||
@@ -1155,7 +1261,7 @@ plugin_auto_load_file (t_weechat_plugin *plugin, char *filename)
|
||||
{
|
||||
char *pos;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) plugin;
|
||||
|
||||
if (cfg_plugins_extension && cfg_plugins_extension[0])
|
||||
|
||||
@@ -61,10 +61,14 @@ extern t_plugin_handler *plugin_timer_handler_add (t_weechat_plugin *, int,
|
||||
extern t_plugin_handler *plugin_keyboard_handler_add (t_weechat_plugin *,
|
||||
t_plugin_handler_func *,
|
||||
char *, void *);
|
||||
extern t_plugin_handler *plugin_event_handler_add (t_weechat_plugin *, char *,
|
||||
t_plugin_handler_func *,
|
||||
char *, void *);
|
||||
extern int plugin_msg_handler_exec (char *, char *, char *);
|
||||
extern int plugin_cmd_handler_exec (char *, char *, char *);
|
||||
extern int plugin_timer_handler_exec ();
|
||||
extern int plugin_keyboard_handler_exec (char *, char *, char *);
|
||||
extern int plugin_event_handler_exec (char *, char *);
|
||||
extern void plugin_handler_remove (t_weechat_plugin *,
|
||||
t_plugin_handler *);
|
||||
extern void plugin_handler_remove_all (t_weechat_plugin *);
|
||||
|
||||
@@ -151,7 +151,7 @@ weechat_lua_timer_handler (t_weechat_plugin *plugin,
|
||||
int argc, char **argv,
|
||||
char *handler_args, void *handler_pointer)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
int *r;
|
||||
@@ -200,6 +200,36 @@ weechat_lua_keyboard_handler (t_weechat_plugin *plugin,
|
||||
return PLUGIN_RC_KO;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_lua_event_handler: general event handler for Lua
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_lua_event_handler (t_weechat_plugin *plugin,
|
||||
int argc, char **argv,
|
||||
char *handler_args, void *handler_pointer)
|
||||
{
|
||||
int *r;
|
||||
int ret;
|
||||
|
||||
if (argc >= 1)
|
||||
{
|
||||
r = (int *) weechat_lua_exec (plugin, (t_plugin_script *)handler_pointer,
|
||||
SCRIPT_EXEC_INT,
|
||||
handler_args, argv[0], NULL, NULL);
|
||||
if (r == NULL)
|
||||
ret = PLUGIN_RC_KO;
|
||||
else
|
||||
{
|
||||
ret = *r;
|
||||
free (r);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
return PLUGIN_RC_KO;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_lua_modifier: general modifier for Lua
|
||||
*/
|
||||
@@ -227,7 +257,7 @@ weechat_lua_register (lua_State *L)
|
||||
const char *name, *version, *shutdown_func, *description, *charset;
|
||||
int n;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
lua_current_script = NULL;
|
||||
@@ -310,12 +340,12 @@ weechat_lua_register (lua_State *L)
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_set_charset (lua_State *L)
|
||||
weechat_lua_set_charset (lua_State *L)
|
||||
{
|
||||
const char *charset;
|
||||
int n;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
@@ -355,12 +385,12 @@ weechat_lua_set_charset (lua_State *L)
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_print (lua_State *L)
|
||||
weechat_lua_print (lua_State *L)
|
||||
{
|
||||
const char *message, *channel_name, *server_name;
|
||||
int n;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
@@ -414,12 +444,12 @@ weechat_lua_print (lua_State *L)
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_print_server (lua_State *L)
|
||||
weechat_lua_print_server (lua_State *L)
|
||||
{
|
||||
const char *message;
|
||||
int n;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
@@ -457,12 +487,12 @@ weechat_lua_print_server (lua_State *L)
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_print_infobar (lua_State *L)
|
||||
weechat_lua_print_infobar (lua_State *L)
|
||||
{
|
||||
const char *message;
|
||||
int delay, n;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
@@ -502,11 +532,11 @@ weechat_lua_print_infobar (lua_State *L)
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_remove_infobar (lua_State *L)
|
||||
weechat_lua_remove_infobar (lua_State *L)
|
||||
{
|
||||
int n, how_many;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
@@ -536,12 +566,12 @@ weechat_lua_remove_infobar (lua_State *L)
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_log (lua_State *L)
|
||||
weechat_lua_log (lua_State *L)
|
||||
{
|
||||
const char *message, *channel_name, *server_name;
|
||||
int n;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
@@ -595,12 +625,12 @@ weechat_lua_log (lua_State *L)
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_command (lua_State *L)
|
||||
weechat_lua_command (lua_State *L)
|
||||
{
|
||||
const char *command, *channel_name, *server_name;
|
||||
int n;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
@@ -654,12 +684,12 @@ weechat_lua_command (lua_State *L)
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_add_message_handler (lua_State *L)
|
||||
weechat_lua_add_message_handler (lua_State *L)
|
||||
{
|
||||
const char *irc_command, *function;
|
||||
int n;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
@@ -706,13 +736,13 @@ weechat_lua_add_message_handler (lua_State *L)
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_add_command_handler (lua_State *L)
|
||||
weechat_lua_add_command_handler (lua_State *L)
|
||||
{
|
||||
const char *command, *function, *description, *arguments, *arguments_description;
|
||||
const char *completion_template;
|
||||
int n;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
@@ -778,13 +808,13 @@ weechat_lua_add_command_handler (lua_State *L)
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_add_timer_handler (lua_State *L)
|
||||
weechat_lua_add_timer_handler (lua_State *L)
|
||||
{
|
||||
int interval;
|
||||
const char *function;
|
||||
int n;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
@@ -831,12 +861,12 @@ weechat_lua_add_timer_handler (lua_State *L)
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_add_keyboard_handler (lua_State *L)
|
||||
weechat_lua_add_keyboard_handler (lua_State *L)
|
||||
{
|
||||
const char *function;
|
||||
int n;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
@@ -876,6 +906,58 @@ weechat_lua_add_keyboard_handler (lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_lua_add_event_handler: add handler for events
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_add_event_handler (lua_State *L)
|
||||
{
|
||||
const char *event, *function;
|
||||
int n;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
{
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: unable to add event handler, "
|
||||
"script not initialized");
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
event = NULL;
|
||||
function = NULL;
|
||||
|
||||
n = lua_gettop (lua_current_interpreter);
|
||||
|
||||
if (n != 2)
|
||||
{
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"add_event_handler\" function");
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
event = lua_tostring (lua_current_interpreter, -2);
|
||||
function = lua_tostring (lua_current_interpreter, -1);
|
||||
|
||||
if (!lua_plugin->event_handler_add (lua_plugin, (char *) event,
|
||||
weechat_lua_event_handler,
|
||||
(char *) function,
|
||||
(void *)lua_current_script))
|
||||
{
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
lua_pushnumber (lua_current_interpreter, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_lua_remove_handler: remove a command/message handler
|
||||
*/
|
||||
@@ -886,7 +968,7 @@ weechat_lua_remove_handler (lua_State *L)
|
||||
const char *command, *function;
|
||||
int n;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
@@ -932,7 +1014,7 @@ weechat_lua_remove_timer_handler (lua_State *L)
|
||||
const char *function;
|
||||
int n;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
@@ -976,7 +1058,7 @@ weechat_lua_remove_keyboard_handler (lua_State *L)
|
||||
const char *function;
|
||||
int n;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
@@ -1010,6 +1092,50 @@ weechat_lua_remove_keyboard_handler (lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_lua_remove_event_handler: remove an event handler
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_remove_event_handler (lua_State *L)
|
||||
{
|
||||
const char *function;
|
||||
int n;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
{
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: unable to remove event handler, "
|
||||
"script not initialized");
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
function = NULL;
|
||||
|
||||
n = lua_gettop (lua_current_interpreter);
|
||||
|
||||
if (n != 1)
|
||||
{
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"remove_event_handler\" function");
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
function = lua_tostring (lua_current_interpreter, -1);
|
||||
|
||||
weechat_script_remove_event_handler (lua_plugin, lua_current_script,
|
||||
(char *) function);
|
||||
|
||||
lua_pushnumber (lua_current_interpreter, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_lua_add_modifier: add a modifier
|
||||
*/
|
||||
@@ -1020,7 +1146,7 @@ weechat_lua_add_modifier (lua_State *L)
|
||||
const char *type, *command, *function;
|
||||
int n;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
@@ -1074,7 +1200,7 @@ weechat_lua_remove_modifier (lua_State *L)
|
||||
const char *type, *command, *function;
|
||||
int n;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
@@ -1118,13 +1244,13 @@ weechat_lua_remove_modifier (lua_State *L)
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_get_info (lua_State *L)
|
||||
weechat_lua_get_info (lua_State *L)
|
||||
{
|
||||
const char *arg, *server_name;
|
||||
char *info;
|
||||
int n;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
@@ -1172,7 +1298,7 @@ weechat_lua_get_info (lua_State *L)
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_get_dcc_info (lua_State *L)
|
||||
weechat_lua_get_dcc_info (lua_State *L)
|
||||
{
|
||||
t_plugin_dcc_info *dcc_info, *ptr_dcc;
|
||||
char timebuffer1[64];
|
||||
@@ -1180,7 +1306,7 @@ weechat_lua_get_dcc_info (lua_State *L)
|
||||
struct in_addr in;
|
||||
int i;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
@@ -1289,13 +1415,13 @@ weechat_lua_get_dcc_info (lua_State *L)
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_get_config (lua_State *L)
|
||||
weechat_lua_get_config (lua_State *L)
|
||||
{
|
||||
const char *option;
|
||||
char *return_value;
|
||||
int n;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
@@ -1336,12 +1462,12 @@ weechat_lua_get_config (lua_State *L)
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_set_config (lua_State *L)
|
||||
weechat_lua_set_config (lua_State *L)
|
||||
{
|
||||
const char *option, *value;
|
||||
int n;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
@@ -1383,13 +1509,13 @@ weechat_lua_set_config (lua_State *L)
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_get_plugin_config (lua_State *L)
|
||||
weechat_lua_get_plugin_config (lua_State *L)
|
||||
{
|
||||
const char *option;
|
||||
char *return_value;
|
||||
int n;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
@@ -1432,12 +1558,12 @@ weechat_lua_get_plugin_config (lua_State *L)
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_set_plugin_config (lua_State *L)
|
||||
weechat_lua_set_plugin_config (lua_State *L)
|
||||
{
|
||||
const char *option, *value;
|
||||
int n;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
@@ -1481,12 +1607,12 @@ weechat_lua_set_plugin_config (lua_State *L)
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_get_server_info (lua_State *L)
|
||||
weechat_lua_get_server_info (lua_State *L)
|
||||
{
|
||||
t_plugin_server_info *server_info, *ptr_server;
|
||||
char timebuffer[64];
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
@@ -1627,13 +1753,13 @@ weechat_lua_get_server_info (lua_State *L)
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_get_channel_info (lua_State *L)
|
||||
weechat_lua_get_channel_info (lua_State *L)
|
||||
{
|
||||
t_plugin_channel_info *channel_info, *ptr_channel;
|
||||
const char *server;
|
||||
int n;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
@@ -1711,13 +1837,13 @@ weechat_lua_get_channel_info (lua_State *L)
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_get_nick_info (lua_State *L)
|
||||
weechat_lua_get_nick_info (lua_State *L)
|
||||
{
|
||||
t_plugin_nick_info *nick_info, *ptr_nick;
|
||||
const char *server, *channel;
|
||||
int n;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
@@ -1788,7 +1914,7 @@ weechat_lua_get_irc_color (lua_State *L)
|
||||
const char *color;
|
||||
int n;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
@@ -1825,12 +1951,12 @@ weechat_lua_get_irc_color (lua_State *L)
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_get_window_info (lua_State *L)
|
||||
weechat_lua_get_window_info (lua_State *L)
|
||||
{
|
||||
t_plugin_window_info *window_info, *ptr_window;
|
||||
int i;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
@@ -1897,11 +2023,11 @@ weechat_lua_get_window_info (lua_State *L)
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_get_buffer_info (lua_State *L)
|
||||
weechat_lua_get_buffer_info (lua_State *L)
|
||||
{
|
||||
t_plugin_buffer_info *buffer_info, *ptr_buffer;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
@@ -1929,7 +2055,7 @@ weechat_lua_get_buffer_info (lua_State *L)
|
||||
lua_pushstring (lua_current_interpreter, "type");
|
||||
lua_pushnumber (lua_current_interpreter, ptr_buffer->type);
|
||||
lua_rawset (lua_current_interpreter, -3);
|
||||
|
||||
|
||||
lua_pushstring (lua_current_interpreter, "num_displayed");
|
||||
lua_pushnumber (lua_current_interpreter, ptr_buffer->num_displayed);
|
||||
lua_rawset (lua_current_interpreter, -3);
|
||||
@@ -1966,14 +2092,14 @@ weechat_lua_get_buffer_info (lua_State *L)
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_get_buffer_data (lua_State *L)
|
||||
weechat_lua_get_buffer_data (lua_State *L)
|
||||
{
|
||||
t_plugin_buffer_line *buffer_data, *ptr_data;
|
||||
const char *server, *channel;
|
||||
char timebuffer[64];
|
||||
int i, n;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
@@ -1989,26 +2115,18 @@ weechat_lua_get_buffer_data (lua_State *L)
|
||||
channel = NULL;
|
||||
|
||||
n = lua_gettop (lua_current_interpreter);
|
||||
|
||||
switch (n)
|
||||
if (n != 2)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
server = lua_tostring (lua_current_interpreter, -1);
|
||||
break;
|
||||
case 2:
|
||||
server = lua_tostring (lua_current_interpreter, -2);
|
||||
channel = lua_tostring (lua_current_interpreter, -1);
|
||||
break;
|
||||
default:
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
"Lua error: wrong parameters for "
|
||||
"\"get_buffer_data\" function");
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
server = lua_tostring (lua_current_interpreter, -2);
|
||||
channel = lua_tostring (lua_current_interpreter, -1);
|
||||
|
||||
buffer_data = lua_plugin->get_buffer_data (lua_plugin, (char *) server, (char *) channel);
|
||||
if (!buffer_data)
|
||||
{
|
||||
@@ -2053,9 +2171,9 @@ weechat_lua_get_buffer_data (lua_State *L)
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_constant_plugin_rc_ok (lua_State *L)
|
||||
weechat_lua_constant_plugin_rc_ok (lua_State *L)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
lua_pushnumber (lua_current_interpreter, PLUGIN_RC_OK);
|
||||
@@ -2063,9 +2181,9 @@ weechat_lua_constant_plugin_rc_ok (lua_State *L)
|
||||
}
|
||||
|
||||
static int
|
||||
weechat_lua_constant_plugin_rc_ko (lua_State *L)
|
||||
weechat_lua_constant_plugin_rc_ko (lua_State *L)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
lua_pushnumber (lua_current_interpreter, PLUGIN_RC_KO);
|
||||
@@ -2073,9 +2191,9 @@ weechat_lua_constant_plugin_rc_ko (lua_State *L)
|
||||
}
|
||||
|
||||
static int
|
||||
weechat_lua_constant_plugin_rc_ok_ignore_weechat (lua_State *L)
|
||||
weechat_lua_constant_plugin_rc_ok_ignore_weechat (lua_State *L)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
lua_pushnumber (lua_current_interpreter, PLUGIN_RC_OK_IGNORE_WEECHAT);
|
||||
@@ -2083,9 +2201,9 @@ weechat_lua_constant_plugin_rc_ok_ignore_weechat (lua_State *L)
|
||||
}
|
||||
|
||||
static int
|
||||
weechat_lua_constant_plugin_rc_ok_ignore_plugins (lua_State *L)
|
||||
weechat_lua_constant_plugin_rc_ok_ignore_plugins (lua_State *L)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
lua_pushnumber (lua_current_interpreter, PLUGIN_RC_OK_IGNORE_PLUGINS);
|
||||
@@ -2093,15 +2211,25 @@ weechat_lua_constant_plugin_rc_ok_ignore_plugins (lua_State *L)
|
||||
}
|
||||
|
||||
static int
|
||||
weechat_lua_constant_plugin_rc_ok_ignore_all (lua_State *L)
|
||||
weechat_lua_constant_plugin_rc_ok_ignore_all (lua_State *L)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
lua_pushnumber (lua_current_interpreter, PLUGIN_RC_OK_IGNORE_ALL);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
weechat_lua_constant_plugin_rc_ok_with_highlight (lua_State *L)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
lua_pushnumber (lua_current_interpreter, PLUGIN_RC_OK_WITH_HIGHLIGHT);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Lua subroutines
|
||||
*/
|
||||
@@ -2120,9 +2248,11 @@ const struct luaL_reg weechat_lua_funcs[] = {
|
||||
{ "add_command_handler", weechat_lua_add_command_handler },
|
||||
{ "add_timer_handler", weechat_lua_add_timer_handler },
|
||||
{ "add_keyboard_handler", weechat_lua_add_keyboard_handler },
|
||||
{ "add_event_handler", weechat_lua_add_event_handler },
|
||||
{ "remove_handler", weechat_lua_remove_handler },
|
||||
{ "remove_timer_handler", weechat_lua_remove_timer_handler },
|
||||
{ "remove_keyboard_handler", weechat_lua_remove_keyboard_handler },
|
||||
{ "remove_event_handler", weechat_lua_remove_event_handler },
|
||||
{ "add_modifier", weechat_lua_add_modifier },
|
||||
{ "remove_modifier", weechat_lua_remove_modifier },
|
||||
{ "get_info", weechat_lua_get_info },
|
||||
@@ -2144,6 +2274,7 @@ const struct luaL_reg weechat_lua_funcs[] = {
|
||||
{ "PLUGIN_RC_OK_IGNORE_WEECHAT", weechat_lua_constant_plugin_rc_ok_ignore_weechat },
|
||||
{ "PLUGIN_RC_OK_IGNORE_PLUGINS", weechat_lua_constant_plugin_rc_ok_ignore_plugins },
|
||||
{ "PLUGIN_RC_OK_IGNORE_ALL", weechat_lua_constant_plugin_rc_ok_ignore_all },
|
||||
{ "PLUGIN_RC_OK_WITH_HIGHLIGHT", weechat_lua_constant_plugin_rc_ok_with_highlight },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -2203,7 +2334,7 @@ weechat_lua_load (t_weechat_plugin *plugin, char *filename)
|
||||
plugin->print_server (plugin,
|
||||
"Lua warning: unable to redirect stdout and stderr");
|
||||
|
||||
lua_current_script_filename = strdup (filename);
|
||||
lua_current_script_filename = filename;
|
||||
|
||||
if (luaL_loadfile (lua_current_interpreter, filename) != 0)
|
||||
{
|
||||
@@ -2213,7 +2344,6 @@ weechat_lua_load (t_weechat_plugin *plugin, char *filename)
|
||||
plugin->print_server (plugin,
|
||||
"Lua error: %s",
|
||||
lua_tostring (lua_current_interpreter, -1));
|
||||
free (lua_current_script_filename);
|
||||
lua_close (lua_current_interpreter);
|
||||
fclose (fp);
|
||||
return 0;
|
||||
@@ -2227,7 +2357,6 @@ weechat_lua_load (t_weechat_plugin *plugin, char *filename)
|
||||
plugin->print_server (plugin,
|
||||
"Lua error: %s",
|
||||
lua_tostring (lua_current_interpreter, -1));
|
||||
free (lua_current_script_filename);
|
||||
lua_close (lua_current_interpreter);
|
||||
fclose (fp);
|
||||
/* if script was registered, removing from list */
|
||||
@@ -2235,9 +2364,7 @@ weechat_lua_load (t_weechat_plugin *plugin, char *filename)
|
||||
weechat_script_remove (plugin, &lua_scripts, lua_current_script);
|
||||
return 0;
|
||||
}
|
||||
|
||||
fclose (fp);
|
||||
free (lua_current_script_filename);
|
||||
|
||||
if (lua_current_script == NULL)
|
||||
{
|
||||
@@ -2336,7 +2463,7 @@ weechat_lua_cmd (t_weechat_plugin *plugin,
|
||||
t_plugin_handler *ptr_handler;
|
||||
t_plugin_modifier *ptr_modifier;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) handler_args;
|
||||
(void) handler_pointer;
|
||||
|
||||
@@ -2447,6 +2574,25 @@ weechat_lua_cmd (t_weechat_plugin *plugin,
|
||||
if (!handler_found)
|
||||
plugin->print_server (plugin, " (none)");
|
||||
|
||||
/* list Lua event handlers */
|
||||
plugin->print_server (plugin, "");
|
||||
plugin->print_server (plugin, "Lua event handlers:");
|
||||
handler_found = 0;
|
||||
for (ptr_handler = plugin->handlers;
|
||||
ptr_handler; ptr_handler = ptr_handler->next_handler)
|
||||
{
|
||||
if ((ptr_handler->type == PLUGIN_HANDLER_EVENT)
|
||||
&& (ptr_handler->handler_args))
|
||||
{
|
||||
handler_found = 1;
|
||||
plugin->print_server (plugin, " %s => Lua(%s)",
|
||||
ptr_handler->event,
|
||||
ptr_handler->handler_args);
|
||||
}
|
||||
}
|
||||
if (!handler_found)
|
||||
plugin->print_server (plugin, " (none)");
|
||||
|
||||
/* list Lua modifiers */
|
||||
plugin->print_server (plugin, "");
|
||||
plugin->print_server (plugin, "Lua modifiers:");
|
||||
|
||||
@@ -145,7 +145,9 @@ weechat_perl_exec (t_weechat_plugin *plugin,
|
||||
SAVETMPS;
|
||||
PUSHMARK(sp);
|
||||
|
||||
perl_current_script = script;
|
||||
/* are we loading the script file ? */
|
||||
if (strcmp (function, "weechat_perl_load_eval_file") != 0)
|
||||
perl_current_script = script;
|
||||
|
||||
if (arg1)
|
||||
{
|
||||
@@ -224,7 +226,7 @@ weechat_perl_exec (t_weechat_plugin *plugin,
|
||||
if (ret_value == NULL && mem_err == 1)
|
||||
{
|
||||
plugin->print_server (plugin,
|
||||
"Python error: unable to alloc memory in function \"%s\"",
|
||||
"Perl error: unable to alloc memory in function \"%s\"",
|
||||
function);
|
||||
return NULL;
|
||||
}
|
||||
@@ -273,7 +275,7 @@ weechat_perl_timer_handler (t_weechat_plugin *plugin,
|
||||
{
|
||||
int *r, ret;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
|
||||
@@ -320,6 +322,35 @@ weechat_perl_keyboard_handler (t_weechat_plugin *plugin,
|
||||
return PLUGIN_RC_KO;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_perl_event_handler: general event handler for Perl
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_perl_event_handler (t_weechat_plugin *plugin,
|
||||
int argc, char **argv,
|
||||
char *handler_args, void *handler_pointer)
|
||||
{
|
||||
int *r, ret;
|
||||
|
||||
if (argc >= 1)
|
||||
{
|
||||
r = (int *) weechat_perl_exec (plugin, (t_plugin_script *)handler_pointer,
|
||||
SCRIPT_EXEC_INT,
|
||||
handler_args, argv[0], NULL, NULL);
|
||||
if (r == NULL)
|
||||
ret = PLUGIN_RC_KO;
|
||||
else
|
||||
{
|
||||
ret = *r;
|
||||
free (r);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
return PLUGIN_RC_KO;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_perl_modifier: general modifier for Perl
|
||||
*/
|
||||
@@ -346,7 +377,7 @@ static XS (XS_weechat_register)
|
||||
char *name, *version, *shutdown_func, *description, *charset;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) items;
|
||||
(void) cv;
|
||||
|
||||
@@ -407,7 +438,7 @@ static XS (XS_weechat_set_charset)
|
||||
{
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
@@ -442,7 +473,7 @@ static XS (XS_weechat_print)
|
||||
char *message, *channel_name, *server_name;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
@@ -489,7 +520,7 @@ static XS (XS_weechat_print_server)
|
||||
char *message;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
@@ -524,7 +555,7 @@ static XS (XS_weechat_print_infobar)
|
||||
{
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
@@ -558,7 +589,7 @@ static XS (XS_weechat_remove_infobar)
|
||||
{
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
@@ -584,7 +615,7 @@ static XS (XS_weechat_log)
|
||||
char *message, *channel_name, *server_name;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
@@ -631,7 +662,7 @@ static XS (XS_weechat_command)
|
||||
char *channel_name, *server_name;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
@@ -676,7 +707,7 @@ static XS (XS_weechat_add_message_handler)
|
||||
char *irc_command, *function;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
@@ -716,7 +747,7 @@ static XS (XS_weechat_add_command_handler)
|
||||
char *completion_template;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
@@ -766,7 +797,7 @@ static XS (XS_weechat_add_timer_handler)
|
||||
char *function;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
@@ -805,7 +836,7 @@ static XS (XS_weechat_add_keyboard_handler)
|
||||
char *function;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
@@ -835,6 +866,45 @@ static XS (XS_weechat_add_keyboard_handler)
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat::add_event_handler: add an event handler
|
||||
*/
|
||||
|
||||
static XS (XS_weechat_add_event_handler)
|
||||
{
|
||||
char *event, *function;
|
||||
dXSARGS;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
{
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: unable to add event handler, "
|
||||
"script not initialized");
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
if (items < 2)
|
||||
{
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
"\"add_event_handler\" function");
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
event = SvPV (ST (0), PL_na);
|
||||
function = SvPV (ST (1), PL_na);
|
||||
|
||||
if (perl_plugin->event_handler_add (perl_plugin, event,
|
||||
weechat_perl_event_handler, function,
|
||||
(void *)perl_current_script))
|
||||
XSRETURN_YES;
|
||||
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat::remove_handler: remove a message/command handler
|
||||
*/
|
||||
@@ -844,7 +914,7 @@ static XS (XS_weechat_remove_handler)
|
||||
char *command, *function;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
@@ -881,7 +951,7 @@ static XS (XS_weechat_remove_timer_handler)
|
||||
char *function;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
@@ -917,7 +987,7 @@ static XS (XS_weechat_remove_keyboard_handler)
|
||||
char *function;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
@@ -944,6 +1014,42 @@ static XS (XS_weechat_remove_keyboard_handler)
|
||||
XSRETURN_YES;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat::remove_event_handler: remove an event handler
|
||||
*/
|
||||
|
||||
static XS (XS_weechat_remove_event_handler)
|
||||
{
|
||||
char *function;
|
||||
dXSARGS;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
{
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: unable to remove event handler, "
|
||||
"script not initialized");
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
if (items < 1)
|
||||
{
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
"\"remove_event_handler\" function");
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
function = SvPV (ST (0), PL_na);
|
||||
|
||||
weechat_script_remove_event_handler (perl_plugin, perl_current_script,
|
||||
function);
|
||||
|
||||
XSRETURN_YES;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat::add_modifier: add a modifier
|
||||
*/
|
||||
@@ -953,7 +1059,7 @@ static XS (XS_weechat_add_modifier)
|
||||
char *type, *command, *function;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
@@ -993,7 +1099,7 @@ static XS (XS_weechat_remove_modifier)
|
||||
char *type, *command, *function;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
@@ -1031,7 +1137,7 @@ static XS (XS_weechat_get_info)
|
||||
char *arg, *info, *server_name;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
@@ -1083,7 +1189,7 @@ static XS (XS_weechat_get_dcc_info)
|
||||
HV *dcc_hash_member;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
(void) items;
|
||||
|
||||
@@ -1144,7 +1250,7 @@ static XS (XS_weechat_get_config)
|
||||
char *option, *return_value;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
@@ -1190,7 +1296,7 @@ static XS (XS_weechat_set_config)
|
||||
char *option, *value;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
@@ -1230,7 +1336,7 @@ static XS (XS_weechat_get_plugin_config)
|
||||
char *option, *return_value;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
@@ -1278,7 +1384,7 @@ static XS (XS_weechat_set_plugin_config)
|
||||
char *option, *value;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
@@ -1322,7 +1428,7 @@ static XS (XS_weechat_get_server_info)
|
||||
HV *server_hash, *server_hash_member;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
(void) items;
|
||||
|
||||
@@ -1353,7 +1459,7 @@ static XS (XS_weechat_get_server_info)
|
||||
localtime(&ptr_server->away_time));
|
||||
|
||||
server_hash_member = (HV *) sv_2mortal((SV *) newHV());
|
||||
|
||||
|
||||
hv_store (server_hash_member, "autoconnect", 11, newSViv (ptr_server->autoconnect), 0);
|
||||
hv_store (server_hash_member, "autoreconnect", 13, newSViv (ptr_server->autoreconnect), 0);
|
||||
hv_store (server_hash_member, "autoreconnect_delay", 19, newSViv (ptr_server->autoreconnect_delay), 0);
|
||||
@@ -1379,12 +1485,14 @@ static XS (XS_weechat_get_server_info)
|
||||
hv_store (server_hash_member, "nick_modes", 10, newSVpv (ptr_server->nick_modes, 0), 0);
|
||||
hv_store (server_hash_member, "away_time", 9, newSVpv (timebuffer, 0), 0);
|
||||
hv_store (server_hash_member, "lag", 3, newSViv (ptr_server->lag), 0);
|
||||
|
||||
|
||||
hv_store (server_hash, ptr_server->name, strlen(ptr_server->name), newRV_inc((SV *) server_hash_member), 0);
|
||||
}
|
||||
}
|
||||
perl_plugin->free_server_info (perl_plugin, server_info);
|
||||
|
||||
ST (0) = newRV_inc((SV *) server_hash);
|
||||
if (SvREFCNT(ST(0))) sv_2mortal(ST(0));
|
||||
|
||||
XSRETURN (1);
|
||||
}
|
||||
|
||||
@@ -1399,7 +1507,7 @@ static XS (XS_weechat_get_channel_info)
|
||||
HV *channel_hash, *channel_hash_member;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
@@ -1451,6 +1559,8 @@ static XS (XS_weechat_get_channel_info)
|
||||
perl_plugin->free_channel_info (perl_plugin, channel_info);
|
||||
|
||||
ST (0) = newRV_inc((SV *) channel_hash);
|
||||
if (SvREFCNT(ST(0))) sv_2mortal(ST(0));
|
||||
|
||||
XSRETURN (1);
|
||||
}
|
||||
|
||||
@@ -1465,7 +1575,7 @@ static XS (XS_weechat_get_nick_info)
|
||||
HV *nick_hash;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
@@ -1515,6 +1625,8 @@ static XS (XS_weechat_get_nick_info)
|
||||
perl_plugin->free_nick_info (perl_plugin, nick_info);
|
||||
|
||||
ST (0) = newRV_inc((SV *) nick_hash);
|
||||
if (SvREFCNT(ST(0))) sv_2mortal(ST(0));
|
||||
|
||||
XSRETURN (1);
|
||||
}
|
||||
|
||||
@@ -1527,7 +1639,7 @@ static XS (XS_weechat_input_color)
|
||||
int color, start, length;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
@@ -1565,7 +1677,7 @@ static XS (XS_weechat_get_irc_color)
|
||||
char *color;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
@@ -1608,7 +1720,7 @@ static XS (XS_weechat_get_window_info)
|
||||
HV *window_hash_member;
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
(void) items;
|
||||
|
||||
@@ -1656,7 +1768,7 @@ static XS (XS_weechat_get_buffer_info)
|
||||
char conv[8];
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
(void) items;
|
||||
|
||||
@@ -1684,7 +1796,7 @@ static XS (XS_weechat_get_buffer_info)
|
||||
for (ptr_buffer = buffer_info; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
buffer_hash_member = (HV *) sv_2mortal((SV *) newHV());
|
||||
|
||||
|
||||
hv_store (buffer_hash_member, "type", 4, newSViv (ptr_buffer->type), 0);
|
||||
hv_store (buffer_hash_member, "num_displayed", 13, newSViv (ptr_buffer->num_displayed), 0);
|
||||
hv_store (buffer_hash_member, "server", 6,
|
||||
@@ -1694,13 +1806,14 @@ static XS (XS_weechat_get_buffer_info)
|
||||
hv_store (buffer_hash_member, "notify_level", 12, newSViv (ptr_buffer->notify_level), 0);
|
||||
hv_store (buffer_hash_member, "log_filename", 12,
|
||||
newSVpv (ptr_buffer->log_filename == NULL ? "" : ptr_buffer->log_filename, 0), 0);
|
||||
|
||||
snprintf(conv, sizeof(conv), "%d", ptr_buffer->number);
|
||||
hv_store (buffer_hash, conv, strlen(conv), newRV_inc((SV *) buffer_hash_member), 0);
|
||||
hv_store (buffer_hash, conv, strlen(conv), newRV_inc((SV *) buffer_hash_member), 0);
|
||||
}
|
||||
perl_plugin->free_buffer_info (perl_plugin, buffer_info);
|
||||
|
||||
ST (0) = newRV_inc((SV *) buffer_hash);
|
||||
if (SvREFCNT(ST(0))) sv_2mortal(ST(0));
|
||||
|
||||
XSRETURN (1);
|
||||
}
|
||||
|
||||
@@ -1718,7 +1831,7 @@ static XS (XS_weechat_get_buffer_data)
|
||||
|
||||
dXSARGS;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
(void) items;
|
||||
|
||||
@@ -1730,7 +1843,7 @@ static XS (XS_weechat_get_buffer_data)
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
if (items > 2)
|
||||
if (items != 2)
|
||||
{
|
||||
perl_plugin->print_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
@@ -1798,9 +1911,11 @@ weechat_perl_xs_init (pTHX)
|
||||
newXS ("weechat::add_command_handler", XS_weechat_add_command_handler, "weechat");
|
||||
newXS ("weechat::add_timer_handler", XS_weechat_add_timer_handler, "weechat");
|
||||
newXS ("weechat::add_keyboard_handler", XS_weechat_add_keyboard_handler, "weechat");
|
||||
newXS ("weechat::add_event_handler", XS_weechat_add_event_handler, "weechat");
|
||||
newXS ("weechat::remove_handler", XS_weechat_remove_handler, "weechat");
|
||||
newXS ("weechat::remove_timer_handler", XS_weechat_remove_timer_handler, "weechat");
|
||||
newXS ("weechat::remove_keyboard_handler", XS_weechat_remove_keyboard_handler, "weechat");
|
||||
newXS ("weechat::remove_event_handler", XS_weechat_remove_event_handler, "weechat");
|
||||
newXS ("weechat::add_modifier", XS_weechat_add_modifier, "weechat");
|
||||
newXS ("weechat::remove_modifier", XS_weechat_remove_modifier, "weechat");
|
||||
newXS ("weechat::get_info", XS_weechat_get_info, "weechat");
|
||||
@@ -1825,6 +1940,7 @@ weechat_perl_xs_init (pTHX)
|
||||
newCONSTSUB (stash, "weechat::PLUGIN_RC_OK_IGNORE_WEECHAT", newSViv (PLUGIN_RC_OK_IGNORE_WEECHAT));
|
||||
newCONSTSUB (stash, "weechat::PLUGIN_RC_OK_IGNORE_PLUGINS", newSViv (PLUGIN_RC_OK_IGNORE_PLUGINS));
|
||||
newCONSTSUB (stash, "weechat::PLUGIN_RC_OK_IGNORE_ALL", newSViv (PLUGIN_RC_OK_IGNORE_ALL));
|
||||
newCONSTSUB (stash, "weechat::PLUGIN_RC_OK_WITH_HIGHLIGHT", newSViv (PLUGIN_RC_OK_WITH_HIGHLIGHT));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1874,7 +1990,7 @@ weechat_perl_load (t_weechat_plugin *plugin, char *filename)
|
||||
return 0;
|
||||
}
|
||||
|
||||
perl_current_script_filename = strdup (filename);
|
||||
perl_current_script_filename = filename;
|
||||
|
||||
PERL_SET_CONTEXT (perl_current_interpreter);
|
||||
perl_construct (perl_current_interpreter);
|
||||
@@ -1885,9 +2001,6 @@ weechat_perl_load (t_weechat_plugin *plugin, char *filename)
|
||||
eval = weechat_perl_exec (plugin, &tempscript,
|
||||
SCRIPT_EXEC_INT,
|
||||
"weechat_perl_load_eval_file", filename, "", "");
|
||||
|
||||
free (perl_current_script_filename);
|
||||
|
||||
#endif
|
||||
if (eval == NULL)
|
||||
{
|
||||
@@ -2056,7 +2169,7 @@ weechat_perl_cmd (t_weechat_plugin *plugin,
|
||||
if (cmd_argc < 3)
|
||||
return PLUGIN_RC_KO;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) handler_args;
|
||||
(void) handler_pointer;
|
||||
|
||||
@@ -2164,9 +2277,28 @@ weechat_perl_cmd (t_weechat_plugin *plugin,
|
||||
if (!handler_found)
|
||||
plugin->print_server (plugin, " (none)");
|
||||
|
||||
/* list Perl event handlers */
|
||||
plugin->print_server (plugin, "");
|
||||
plugin->print_server (plugin, "Perl event handlers:");
|
||||
handler_found = 0;
|
||||
for (ptr_handler = plugin->handlers;
|
||||
ptr_handler; ptr_handler = ptr_handler->next_handler)
|
||||
{
|
||||
if ((ptr_handler->type == PLUGIN_HANDLER_EVENT)
|
||||
&& (ptr_handler->handler_args))
|
||||
{
|
||||
handler_found = 1;
|
||||
plugin->print_server (plugin, " %s => Perl(%s)",
|
||||
ptr_handler->event,
|
||||
ptr_handler->handler_args);
|
||||
}
|
||||
}
|
||||
if (!handler_found)
|
||||
plugin->print_server (plugin, " (none)");
|
||||
|
||||
/* List Perl modifiers */
|
||||
plugin->print_server (plugin, "");
|
||||
plugin->print_server (plugin, "Python modifiers:");
|
||||
plugin->print_server (plugin, "Perl modifiers:");
|
||||
modifier_found = 0;
|
||||
for (ptr_modifier = plugin->modifiers;
|
||||
ptr_modifier; ptr_modifier = ptr_modifier->next_modifier)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -118,7 +118,7 @@ weechat_ruby_exec (t_weechat_plugin *plugin,
|
||||
VALUE rc, err;
|
||||
int ruby_error, *ret_i;
|
||||
void *ret_value;
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) plugin;
|
||||
|
||||
ruby_current_script = script;
|
||||
@@ -232,7 +232,7 @@ weechat_ruby_timer_handler (t_weechat_plugin *plugin,
|
||||
int argc, char **argv,
|
||||
char *handler_args, void *handler_pointer)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
int *r;
|
||||
@@ -281,6 +281,36 @@ weechat_ruby_keyboard_handler (t_weechat_plugin *plugin,
|
||||
return PLUGIN_RC_KO;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_event_handler: general event handler for Ruby
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_ruby_event_handler (t_weechat_plugin *plugin,
|
||||
int argc, char **argv,
|
||||
char *handler_args, void *handler_pointer)
|
||||
{
|
||||
int *r;
|
||||
int ret;
|
||||
|
||||
if (argc >= 1)
|
||||
{
|
||||
r = (int *) weechat_ruby_exec (plugin, (t_plugin_script *)handler_pointer,
|
||||
SCRIPT_EXEC_INT,
|
||||
handler_args, argv[0], NULL, NULL);
|
||||
if (r == NULL)
|
||||
ret = PLUGIN_RC_KO;
|
||||
else
|
||||
{
|
||||
ret = *r;
|
||||
free (r);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
return PLUGIN_RC_KO;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_modifier: general modifier for Ruby
|
||||
*/
|
||||
@@ -308,7 +338,7 @@ weechat_ruby_register (int argc, VALUE *argv, VALUE class)
|
||||
VALUE name, version, shutdown_func, description, charset;
|
||||
char *c_name, *c_version, *c_shutdown_func, *c_description, *c_charset;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
ruby_current_script = NULL;
|
||||
@@ -390,7 +420,7 @@ weechat_ruby_set_charset (VALUE class, VALUE charset)
|
||||
{
|
||||
char *c_charset;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
@@ -432,7 +462,7 @@ weechat_ruby_print (int argc, VALUE *argv, VALUE class)
|
||||
VALUE message, channel_name, server_name;
|
||||
char *c_message, *c_channel_name, *c_server_name;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
@@ -491,7 +521,7 @@ weechat_ruby_print_server (VALUE class, VALUE message)
|
||||
{
|
||||
char *c_message;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
@@ -530,7 +560,7 @@ weechat_ruby_print_infobar (VALUE class, VALUE delay, VALUE message)
|
||||
int c_delay;
|
||||
char *c_message;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
@@ -573,7 +603,7 @@ weechat_ruby_remove_infobar (int argc, VALUE *argv, VALUE class)
|
||||
VALUE how_many;
|
||||
int c_how_many;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
@@ -611,7 +641,7 @@ weechat_ruby_log (int argc, VALUE *argv, VALUE class)
|
||||
VALUE message, channel_name, server_name;
|
||||
char *c_message, *c_channel_name, *c_server_name;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
@@ -671,7 +701,7 @@ weechat_ruby_command (int argc, VALUE *argv, VALUE class)
|
||||
VALUE command, channel_name, server_name;
|
||||
char *c_command, *c_channel_name, *c_server_name;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
@@ -730,7 +760,7 @@ weechat_ruby_add_message_handler (VALUE class, VALUE message, VALUE function)
|
||||
{
|
||||
char *c_message, *c_function;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
@@ -779,7 +809,7 @@ weechat_ruby_add_command_handler (int argc, VALUE *argv, VALUE class)
|
||||
char *c_command, *c_function, *c_description, *c_arguments, *c_arguments_description;
|
||||
char *c_completion_template;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
@@ -867,7 +897,7 @@ weechat_ruby_add_timer_handler (VALUE class, VALUE interval, VALUE function)
|
||||
int c_interval;
|
||||
char *c_function;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
@@ -913,7 +943,7 @@ weechat_ruby_add_keyboard_handler (VALUE class, VALUE function)
|
||||
{
|
||||
char *c_function;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
@@ -947,6 +977,52 @@ weechat_ruby_add_keyboard_handler (VALUE class, VALUE function)
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_add_event_handler: add a handler for events
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_add_event_handler (VALUE class, VALUE event, VALUE function)
|
||||
{
|
||||
char *c_event, *c_function;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: unable to add event handler, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
c_event = NULL;
|
||||
c_function = NULL;
|
||||
|
||||
if (NIL_P (event) || NIL_P (function))
|
||||
{
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"add_event_handler\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
Check_Type (event, T_STRING);
|
||||
Check_Type (function, T_STRING);
|
||||
|
||||
c_event = STR2CSTR (event);
|
||||
c_function = STR2CSTR (function);
|
||||
|
||||
if (ruby_plugin->event_handler_add (ruby_plugin, c_event,
|
||||
weechat_ruby_event_handler,
|
||||
c_function,
|
||||
(void *)ruby_current_script))
|
||||
return INT2FIX (1);
|
||||
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_remove_handler: remove a handler
|
||||
*/
|
||||
@@ -956,7 +1032,7 @@ weechat_ruby_remove_handler (VALUE class, VALUE command, VALUE function)
|
||||
{
|
||||
char *c_command, *c_function;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
@@ -999,7 +1075,7 @@ weechat_ruby_remove_timer_handler (VALUE class, VALUE function)
|
||||
{
|
||||
char *c_function;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
@@ -1039,7 +1115,7 @@ weechat_ruby_remove_keyboard_handler (VALUE class, VALUE function)
|
||||
{
|
||||
char *c_function;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
@@ -1070,6 +1146,46 @@ weechat_ruby_remove_keyboard_handler (VALUE class, VALUE function)
|
||||
return INT2FIX (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_remove_event_handler: remove an event handler
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_remove_event_handler (VALUE class, VALUE function)
|
||||
{
|
||||
char *c_function;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: unable to remove event handler, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
c_function = NULL;
|
||||
|
||||
if (NIL_P (function))
|
||||
{
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"remove_event_handler\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
Check_Type (function, T_STRING);
|
||||
|
||||
c_function = STR2CSTR (function);
|
||||
|
||||
weechat_script_remove_event_handler (ruby_plugin, ruby_current_script,
|
||||
c_function);
|
||||
|
||||
return INT2FIX (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_add_modifier: add a modifier
|
||||
*/
|
||||
@@ -1079,7 +1195,7 @@ weechat_ruby_add_modifier (VALUE class, VALUE type, VALUE message, VALUE functio
|
||||
{
|
||||
char *c_type, *c_message, *c_function;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
@@ -1128,7 +1244,7 @@ weechat_ruby_remove_modifier (VALUE class, VALUE type, VALUE command, VALUE func
|
||||
{
|
||||
char *c_type, *c_command, *c_function;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
@@ -1175,7 +1291,7 @@ weechat_ruby_get_info (int argc, VALUE *argv, VALUE class)
|
||||
char *c_arg, *c_server_name, *info;
|
||||
VALUE arg, server_name, return_value;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
@@ -1238,7 +1354,7 @@ weechat_ruby_get_dcc_info (VALUE class)
|
||||
char timebuffer2[64];
|
||||
struct in_addr in;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
@@ -1322,7 +1438,7 @@ weechat_ruby_get_config (VALUE class, VALUE option)
|
||||
char *c_option, *return_value;
|
||||
VALUE ruby_return_value;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
@@ -1370,7 +1486,7 @@ weechat_ruby_set_config (VALUE class, VALUE option, VALUE value)
|
||||
{
|
||||
char *c_option, *c_value;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
@@ -1417,7 +1533,7 @@ weechat_ruby_get_plugin_config (VALUE class, VALUE option)
|
||||
char *c_option, *return_value;
|
||||
VALUE ruby_return_value;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
@@ -1467,7 +1583,7 @@ weechat_ruby_set_plugin_config (VALUE class, VALUE option, VALUE value)
|
||||
{
|
||||
char *c_option, *c_value;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
@@ -1517,7 +1633,7 @@ weechat_ruby_get_server_info (VALUE class)
|
||||
VALUE server_hash, server_hash_member;
|
||||
char timebuffer[64];
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
@@ -1616,7 +1732,7 @@ weechat_ruby_get_channel_info (VALUE class, VALUE server)
|
||||
VALUE channel_hash, channel_hash_member;
|
||||
char *c_server;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
@@ -1689,7 +1805,7 @@ weechat_ruby_get_nick_info (VALUE class, VALUE server, VALUE channel)
|
||||
VALUE nick_hash, nick_hash_member;
|
||||
char *c_server, *c_channel;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
@@ -1757,7 +1873,7 @@ weechat_ruby_get_irc_color (VALUE class, VALUE color)
|
||||
{
|
||||
char *c_color;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
@@ -1795,7 +1911,7 @@ weechat_ruby_get_window_info (VALUE class)
|
||||
t_plugin_window_info *window_info, *ptr_window;
|
||||
VALUE window_list, window_list_member;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
@@ -1855,7 +1971,7 @@ weechat_ruby_get_buffer_info (VALUE class)
|
||||
t_plugin_buffer_info *buffer_info, *ptr_buffer;
|
||||
VALUE buffer_hash, buffer_hash_member;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
@@ -1907,15 +2023,14 @@ weechat_ruby_get_buffer_info (VALUE class)
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_get_buffer_data (int argc, VALUE *argv, VALUE class)
|
||||
weechat_ruby_get_buffer_data (VALUE class, VALUE server, VALUE channel)
|
||||
{
|
||||
t_plugin_buffer_line *buffer_data, *ptr_data;
|
||||
VALUE data_list, data_list_member;
|
||||
VALUE server, channel;
|
||||
char *c_server, *c_channel;
|
||||
char timebuffer[64];
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
@@ -1926,24 +2041,25 @@ weechat_ruby_get_buffer_data (int argc, VALUE *argv, VALUE class)
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
server = Qnil;
|
||||
channel = Qnil;
|
||||
c_server = NULL;
|
||||
c_channel = NULL;
|
||||
|
||||
rb_scan_args (argc, argv, "02", &server, &channel);
|
||||
|
||||
if (!NIL_P (server))
|
||||
if (NIL_P (server) || NIL_P (channel))
|
||||
{
|
||||
Check_Type (server, T_STRING);
|
||||
c_server = STR2CSTR (server);
|
||||
ruby_plugin->print_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"get_buffer_data\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
if (!NIL_P (channel))
|
||||
{
|
||||
Check_Type (channel, T_STRING);
|
||||
c_channel = STR2CSTR (channel);
|
||||
}
|
||||
Check_Type (server, T_STRING);
|
||||
Check_Type (channel, T_STRING);
|
||||
|
||||
c_server = STR2CSTR (server);
|
||||
c_channel = STR2CSTR (channel);
|
||||
|
||||
if (!c_server || !c_channel)
|
||||
return INT2FIX (0);
|
||||
|
||||
data_list = rb_ary_new();
|
||||
if (NIL_P (data_list))
|
||||
@@ -1986,7 +2102,8 @@ static VALUE
|
||||
weechat_ruby_output(VALUE self, VALUE str)
|
||||
{
|
||||
char *msg, *p, *m;
|
||||
/* make gcc happy */
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) self;
|
||||
|
||||
msg = strdup(STR2CSTR(str));
|
||||
@@ -2027,7 +2144,7 @@ weechat_ruby_output(VALUE self, VALUE str)
|
||||
static VALUE
|
||||
weechat_ruby_output_flush(VALUE self)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) self;
|
||||
|
||||
return Qnil;
|
||||
@@ -2062,13 +2179,11 @@ weechat_ruby_load (t_weechat_plugin *plugin, char *filename)
|
||||
|
||||
curModule = rb_define_module(modname);
|
||||
|
||||
ruby_current_script_filename = strdup (filename);
|
||||
ruby_current_script_filename = filename;
|
||||
|
||||
ruby_retcode = rb_protect_funcall (curModule, rb_intern("load_eval_file"),
|
||||
&ruby_error, 1, rb_str_new2(filename));
|
||||
|
||||
free (ruby_current_script_filename);
|
||||
|
||||
if (ruby_retcode == Qnil) {
|
||||
err = rb_inspect(rb_gv_get("$!"));
|
||||
ruby_plugin->print_server (ruby_plugin, "Ruby error: \"%s\"", STR2CSTR(err));
|
||||
@@ -2225,7 +2340,7 @@ weechat_ruby_cmd (t_weechat_plugin *plugin,
|
||||
t_plugin_handler *ptr_handler;
|
||||
t_plugin_modifier *ptr_modifier;
|
||||
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) handler_args;
|
||||
(void) handler_pointer;
|
||||
|
||||
@@ -2336,6 +2451,25 @@ weechat_ruby_cmd (t_weechat_plugin *plugin,
|
||||
if (!handler_found)
|
||||
plugin->print_server (plugin, " (none)");
|
||||
|
||||
/* list Ruby event handlers */
|
||||
plugin->print_server (plugin, "");
|
||||
plugin->print_server (plugin, "Ruby event handlers:");
|
||||
handler_found = 0;
|
||||
for (ptr_handler = plugin->handlers;
|
||||
ptr_handler; ptr_handler = ptr_handler->next_handler)
|
||||
{
|
||||
if ((ptr_handler->type == PLUGIN_HANDLER_EVENT)
|
||||
&& (ptr_handler->handler_args))
|
||||
{
|
||||
handler_found = 1;
|
||||
plugin->print_server (plugin, " %s => Ruby(%s)",
|
||||
ptr_handler->event,
|
||||
ptr_handler->handler_args);
|
||||
}
|
||||
}
|
||||
if (!handler_found)
|
||||
plugin->print_server (plugin, " (none)");
|
||||
|
||||
/* list Ruby modifiers */
|
||||
plugin->print_server (plugin, "");
|
||||
plugin->print_server (plugin, "Ruby modifiers:");
|
||||
@@ -2473,7 +2607,8 @@ weechat_plugin_init (t_weechat_plugin *plugin)
|
||||
rb_define_const(ruby_mWeechat, "PLUGIN_RC_KO", INT2NUM(PLUGIN_RC_KO));
|
||||
rb_define_const(ruby_mWeechat, "PLUGIN_RC_OK_IGNORE_WEECHAT", INT2NUM(PLUGIN_RC_OK_IGNORE_WEECHAT));
|
||||
rb_define_const(ruby_mWeechat, "PLUGIN_RC_OK_IGNORE_PLUGINS", INT2NUM(PLUGIN_RC_OK_IGNORE_PLUGINS));
|
||||
rb_define_const(ruby_mWeechat, "PLUGIN_RC_OK_IGNORE_ALL", INT2NUM(PLUGIN_RC_OK_IGNORE_ALL));
|
||||
rb_define_const(ruby_mWeechat, "PLUGIN_RC_OK_IGNORE_ALL", INT2NUM(PLUGIN_RC_OK_IGNORE_ALL));
|
||||
rb_define_const(ruby_mWeechat, "PLUGIN_RC_OK_WITH_HIGHLIGHT", INT2NUM(PLUGIN_RC_OK_WITH_HIGHLIGHT));
|
||||
rb_define_module_function (ruby_mWeechat, "register", weechat_ruby_register, -1);
|
||||
rb_define_module_function (ruby_mWeechat, "set_charset", weechat_ruby_set_charset, 1);
|
||||
rb_define_module_function (ruby_mWeechat, "print", weechat_ruby_print, -1);
|
||||
@@ -2486,9 +2621,11 @@ weechat_plugin_init (t_weechat_plugin *plugin)
|
||||
rb_define_module_function (ruby_mWeechat, "add_command_handler", weechat_ruby_add_command_handler, -1);
|
||||
rb_define_module_function (ruby_mWeechat, "add_timer_handler", weechat_ruby_add_timer_handler, 2);
|
||||
rb_define_module_function (ruby_mWeechat, "add_keyboard_handler", weechat_ruby_add_keyboard_handler, 1);
|
||||
rb_define_module_function (ruby_mWeechat, "add_event_handler", weechat_ruby_add_event_handler, 2);
|
||||
rb_define_module_function (ruby_mWeechat, "remove_handler", weechat_ruby_remove_handler, 2);
|
||||
rb_define_module_function (ruby_mWeechat, "remove_timer_handler", weechat_ruby_remove_timer_handler, 1);
|
||||
rb_define_module_function (ruby_mWeechat, "remove_keyboard_handler", weechat_ruby_remove_keyboard_handler, 1);
|
||||
rb_define_module_function (ruby_mWeechat, "remove_event_handler", weechat_ruby_remove_event_handler, 1);
|
||||
rb_define_module_function (ruby_mWeechat, "add_modifier", weechat_ruby_add_modifier, 3);
|
||||
rb_define_module_function (ruby_mWeechat, "remove_modifier", weechat_ruby_remove_modifier, 3);
|
||||
rb_define_module_function (ruby_mWeechat, "get_info", weechat_ruby_get_info, -1);
|
||||
@@ -2503,7 +2640,7 @@ weechat_plugin_init (t_weechat_plugin *plugin)
|
||||
rb_define_module_function (ruby_mWeechat, "get_irc_color", weechat_ruby_get_irc_color, 1);
|
||||
rb_define_module_function (ruby_mWeechat, "get_window_info", weechat_ruby_get_window_info, 0);
|
||||
rb_define_module_function (ruby_mWeechat, "get_buffer_info", weechat_ruby_get_buffer_info, 0);
|
||||
rb_define_module_function (ruby_mWeechat, "get_buffer_data", weechat_ruby_get_buffer_data, -1);
|
||||
rb_define_module_function (ruby_mWeechat, "get_buffer_data", weechat_ruby_get_buffer_data, 2);
|
||||
|
||||
/* redirect stdin and stdout */
|
||||
ruby_mWeechatOutputs = rb_define_module("WeechatOutputs");
|
||||
|
||||
@@ -516,6 +516,34 @@ weechat_script_remove_keyboard_handler (t_weechat_plugin *plugin,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_script_remove_event_handler: remove an event handler for a script
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_script_remove_event_handler (t_weechat_plugin *plugin,
|
||||
t_plugin_script *script,
|
||||
char *function)
|
||||
{
|
||||
t_plugin_handler *ptr_handler, *next_handler;
|
||||
|
||||
/* search and remove timer handlers */
|
||||
ptr_handler = plugin->handlers;
|
||||
while (ptr_handler)
|
||||
{
|
||||
if ((ptr_handler->type == PLUGIN_HANDLER_EVENT)
|
||||
&& ((t_plugin_script *)ptr_handler->handler_pointer == script)
|
||||
&& (plugin->ascii_strcasecmp (plugin, ptr_handler->handler_args, function) == 0))
|
||||
{
|
||||
next_handler = ptr_handler->next_handler;
|
||||
plugin->handler_remove (plugin, ptr_handler);
|
||||
ptr_handler = next_handler;
|
||||
}
|
||||
else
|
||||
ptr_handler = ptr_handler->next_handler;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_script_remove_modifier: remove a modifier
|
||||
* arg1=type, arg2=command, arg3=function
|
||||
@@ -625,7 +653,7 @@ weechat_script_set_charset (t_weechat_plugin *plugin,
|
||||
t_plugin_script *script,
|
||||
char *charset)
|
||||
{
|
||||
/* make gcc happy */
|
||||
/* make C compiler happy */
|
||||
(void) plugin;
|
||||
|
||||
if (script->charset)
|
||||
|
||||
@@ -79,6 +79,9 @@ extern void weechat_script_remove_timer_handler (t_weechat_plugin *,
|
||||
extern void weechat_script_remove_keyboard_handler (t_weechat_plugin *,
|
||||
t_plugin_script *,
|
||||
char *);
|
||||
extern void weechat_script_remove_event_handler (t_weechat_plugin *,
|
||||
t_plugin_script *,
|
||||
char *);
|
||||
extern void weechat_script_remove_modifier (t_weechat_plugin *,
|
||||
t_plugin_script *,
|
||||
char *, char *, char *);
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
#define PLUGIN_RC_OK_IGNORE_ALL (PLUGIN_RC_OK_IGNORE_WEECHAT \
|
||||
| PLUGIN_RC_OK_IGNORE_PLUGINS)
|
||||
/* ignore WeeChat and other plugins */
|
||||
#define PLUGIN_RC_OK_WITH_HIGHLIGHT 4 /* ok and ask for highlight */
|
||||
/* (for message handler only) */
|
||||
|
||||
#define WEECHAT_IRC_COLOR_WHITE 0
|
||||
#define WEECHAT_IRC_COLOR_BLACK 1
|
||||
@@ -191,7 +193,8 @@ enum t_plugin_handler_type
|
||||
PLUGIN_HANDLER_MESSAGE = 0, /* IRC message handler */
|
||||
PLUGIN_HANDLER_COMMAND, /* command handler */
|
||||
PLUGIN_HANDLER_TIMER, /* timer handler */
|
||||
PLUGIN_HANDLER_KEYBOARD /* keyboard handler */
|
||||
PLUGIN_HANDLER_KEYBOARD, /* keyboard handler */
|
||||
PLUGIN_HANDLER_EVENT /* event handler */
|
||||
};
|
||||
|
||||
typedef struct t_plugin_handler t_plugin_handler;
|
||||
@@ -213,6 +216,9 @@ struct t_plugin_handler
|
||||
/* data for timer handler */
|
||||
int interval; /* interval between two calls to fct */
|
||||
int remaining; /* seconds remaining before next call */
|
||||
|
||||
/* data for event handler */
|
||||
char *event; /* event to catch */
|
||||
|
||||
/* data common to all handlers */
|
||||
t_plugin_handler_func *handler; /* pointer to handler */
|
||||
@@ -323,6 +329,9 @@ struct t_weechat_plugin
|
||||
t_plugin_handler *(*keyboard_handler_add) (t_weechat_plugin *,
|
||||
t_plugin_handler_func *,
|
||||
char *, void *);
|
||||
t_plugin_handler *(*event_handler_add) (t_weechat_plugin *, char *,
|
||||
t_plugin_handler_func *,
|
||||
char *, void *);
|
||||
void (*handler_remove) (t_weechat_plugin *, t_plugin_handler *);
|
||||
void (*handler_remove_all) (t_weechat_plugin *);
|
||||
|
||||
@@ -400,6 +409,9 @@ extern t_plugin_handler *weechat_plugin_timer_handler_add (t_weechat_plugin *, i
|
||||
extern t_plugin_handler *weechat_plugin_keyboard_handler_add (t_weechat_plugin *,
|
||||
t_plugin_handler_func *,
|
||||
char *, void *);
|
||||
extern t_plugin_handler *weechat_plugin_event_handler_add (t_weechat_plugin *, char *,
|
||||
t_plugin_handler_func *,
|
||||
char *, void *);
|
||||
extern void weechat_plugin_handler_remove (t_weechat_plugin *, t_plugin_handler *);
|
||||
extern void weechat_plugin_handler_remove_all (t_weechat_plugin *);
|
||||
|
||||
|
||||
+5
-1
@@ -18,7 +18,7 @@
|
||||
#
|
||||
|
||||
%define name weechat
|
||||
%define version 0.2.2
|
||||
%define version 0.2.4
|
||||
%define release 1
|
||||
|
||||
Name: %{name}
|
||||
@@ -68,6 +68,10 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_docdir}/%{name}/weechat_quickstart*
|
||||
|
||||
%changelog
|
||||
* Thu Mar 29 2007 FlashCode <flashcode@flashtux.org> 0.2.4-1
|
||||
- Released version 0.2.4
|
||||
* Wed Jan 10 2007 FlashCode <flashcode@flashtux.org> 0.2.3-1
|
||||
- Released version 0.2.3
|
||||
* Sat Jan 06 2007 FlashCode <flashcode@flashtux.org> 0.2.2-1
|
||||
- Released version 0.2.2
|
||||
* Sun Oct 01 2006 FlashCode <flashcode@flashtux.org> 0.2.1-1
|
||||
|
||||
+44
-1
@@ -1,9 +1,52 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2007-01-06
|
||||
ChangeLog - 2007-03-29
|
||||
|
||||
|
||||
Version 0.2.4 (2007-03-29):
|
||||
* fixed color bug with IRC messages displayed by plugins (bug #19442)
|
||||
* fixed topic charset, now using channel charset if defined (bug #19386)
|
||||
* renamed log file for DCC chat (now <server>.dcc.<nick>.weechatlog)
|
||||
* fixed crash when closing a pv if a DCC chat is open on same nick
|
||||
(bug #19147)
|
||||
* fixed bug with channel topic after reconnection (not erased) (bug #19384)
|
||||
* added current buffer in hotlist when scrolling up in buffer (task #6664)
|
||||
* fixed bug with explode_string / free_exploded_string when max_items > 0
|
||||
* added new key (ctrl-R) for interactive and incremental search in buffer
|
||||
history (task #6628)
|
||||
* fixed /topic completion when no topic set on current channel (bug #19322)
|
||||
* improved password hiding, code cleanup (bug #19229)
|
||||
* added new return code in plugin API to force highlight (for message
|
||||
handlers only)
|
||||
* fixed bug with server buffer when "look_one_server_buffer" is ON and
|
||||
server buffer is moved to any number > 1 (bug #19219)
|
||||
* fixed /help command: displays plugin help for redefined commands
|
||||
(bug #19166)
|
||||
* prefix '/' disabled in commands (patch #5769)
|
||||
* fixed completion of redefined commands removed by plugins (bug #19176)
|
||||
* fixed memory leaks in perl and python plugins (bug #19163)
|
||||
* added "call" option to /key command, added new key function "insert" to
|
||||
insert text on command line (task #6468)
|
||||
* fixed permissions on "dcc" and "logs" directories (bug #18978)
|
||||
* added event handler to plugin API
|
||||
* added scots quickstart guide
|
||||
* added numeric argument for /clear command (buffer number) (patch #5372)
|
||||
* fixed crash when /away command is issued with no server connection
|
||||
(bug #18839)
|
||||
* fixed crash when closing a buffer opened on many windows
|
||||
* fixed freeze with SSL server when disconnecting after connection loss
|
||||
(bug #18735)
|
||||
|
||||
Version 0.2.3 (2007-01-10):
|
||||
* fixed display bugs with nicklist at top/bottom when look_nicklist_separator
|
||||
is OFF (bug #18737)
|
||||
* fixed iconv problem, causing truncated words when using iso locale
|
||||
* fixed topic scroll when topic has multi-bytes chars
|
||||
* fixed compilation problem with iconv under FreeBSD
|
||||
* fixed bugs with charset: now decodes/encodes nicks and channels in IRC
|
||||
messages (bug #18716)
|
||||
|
||||
Version 0.2.2 (2007-01-06):
|
||||
* fixed bug with status bar (missing refresh) when closing a buffer
|
||||
* fixed bug with use of first buffer for a channel if not connected
|
||||
|
||||
+11
-5
@@ -1,4 +1,4 @@
|
||||
WeeChat FAQ, 2007-01-06
|
||||
WeeChat FAQ, 2007-03-29
|
||||
=======================
|
||||
|
||||
Intended audience:
|
||||
@@ -87,10 +87,16 @@ A: A window is used when you split screen vertically or horizontally.
|
||||
================================================================================
|
||||
Q: I don't see some chars with accents, what can I do?
|
||||
|
||||
A: You have to setup charset used for decoding (ISO and UTF), encoding, and
|
||||
internal WeeChat charset.
|
||||
Internal charset should be empty value, except if WeeChat failed to
|
||||
detect your locale.
|
||||
A: For versions < 0.2.3, please upgrade to last stable version.
|
||||
For versions >= 0.2.3 :
|
||||
- check that weechat-curses is linked to libncursesw (warning: needed
|
||||
on most distributions but not all) :
|
||||
ldd /path/to/weechat-curses
|
||||
- check charset line (on server buffer), you should see ISO-XXXXXX or
|
||||
UTF-8 for terminal charset. If you see ANSI_X3.4-1968 or other values,
|
||||
probably your locale is wrong.
|
||||
- setup global decode value, for example:
|
||||
/setp charset.global.decode = ISO-8859-15
|
||||
|
||||
|
||||
2.5
|
||||
|
||||
+12
-5
@@ -1,4 +1,4 @@
|
||||
WeeChat FAQ, 2007-01-06
|
||||
WeeChat FAQ, 2007-03-29
|
||||
=======================
|
||||
|
||||
Public concerné :
|
||||
@@ -94,10 +94,17 @@ R: Une fen
|
||||
================================================================================
|
||||
Q: Je ne vois pas bien certains accents dans WeeChat, que faire ?
|
||||
|
||||
R: Il faut configurer le charset utilisé pour le décodage (ISO et UTF),
|
||||
l'encodage ainsi que le charset interne à WeeChat.
|
||||
Le charset interne à WeeChat doit être une valeur vide, sauf si WeeChat
|
||||
n'arrive pas à déterminer votre locale.
|
||||
R: Pour les versions < 0.2.3, merci d'installer la dernière version stable.
|
||||
Pour les versions >= 0.2.3 :
|
||||
- vérifiez que weechat-curses est lié avec libncursesw (attention:
|
||||
nécessaire sur beaucoup de distributions, mais pas toutes) :
|
||||
ldd /chemin/vers/weechat-curses
|
||||
- vérifiez la ligne charset (sur le tampon serveur), vous devriez voir
|
||||
ISO-XXXXXX ou UTF-8 pour le charset du terminal. Si vous voyez
|
||||
ANSI_X3.4-1968 ou d'autres valeurs, votre locale est probablement
|
||||
erronée.
|
||||
- affectez la valeur pour le décodage global, par exemple :
|
||||
/setp charset.global.decode = ISO-8859-15
|
||||
|
||||
|
||||
2.5
|
||||
|
||||
@@ -1,6 +1,17 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
* FlashCode, 2007-03-29
|
||||
|
||||
WeeChat 0.2.4 released.
|
||||
|
||||
* FlashCode, 2007-01-10
|
||||
|
||||
WeeChat 0.2.3 released.
|
||||
|
||||
This version fixes several major bugs of version 0.2.2.
|
||||
All users of version 0.2.2 should upgrade to this version.
|
||||
|
||||
* FlashCode, 2007-01-06
|
||||
|
||||
WeeChat 0.2.2 released.
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.56)
|
||||
AC_INIT(WeeChat, 0.2.2, flashcode@flashtux.org)
|
||||
AC_INIT(WeeChat, 0.2.4, flashcode@flashtux.org)
|
||||
AC_CONFIG_SRCDIR([src/common/weechat.c])
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_INIT_AUTOMAKE([weechat], [0.2.2])
|
||||
AM_INIT_AUTOMAKE([weechat], [0.2.4])
|
||||
|
||||
# Checks for programs
|
||||
AC_PROG_CC
|
||||
@@ -795,6 +795,7 @@ AC_OUTPUT([Makefile
|
||||
doc/ru/Makefile
|
||||
doc/pl/Makefile
|
||||
doc/cs/Makefile
|
||||
doc/sco/Makefile
|
||||
src/Makefile
|
||||
src/common/Makefile
|
||||
src/irc/Makefile
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
SUBDIRS = . en fr de ru pl cs
|
||||
SUBDIRS = . en fr de ru pl cs sco
|
||||
|
||||
man_MANS = weechat-curses.1
|
||||
|
||||
|
||||
@@ -304,7 +304,7 @@
|
||||
<entry>Farbe</entry>
|
||||
<entry>Curses- oder Gtk-Farben</entry>
|
||||
<entry>'lightmagenta'</entry>
|
||||
<entry>Color for '+' when scrolling topic</entry>
|
||||
<entry>Farbe des '+' beim Scrolling des Topics</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>col_title_bg</option></entry>
|
||||
@@ -906,7 +906,7 @@
|
||||
<entry>Ganzzahl</entry>
|
||||
<entry>zwischen 0 und 5</entry>
|
||||
<entry>2</entry>
|
||||
<entry>Anti-flood: # seconds between two user messages (0 = no anti-flood)</entry>
|
||||
<entry>Anti-flood: # Sekunden zwischen zwei Benutzernachrichten (0 = kein anti-flood)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>irc_fifo_pipe</option></entry>
|
||||
|
||||
@@ -119,11 +119,11 @@
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>scroll_topic_left</literal></entry>
|
||||
<entry>scroll left topic</entry>
|
||||
<entry>Topic nach links scrollen</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>scroll_topic_right</literal></entry>
|
||||
<entry>scroll right topic</entry>
|
||||
<entry>Topic nach rechts scrollen</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>nick_beginning</literal></entry>
|
||||
@@ -197,3 +197,11 @@
|
||||
<entry><literal>grab_key</literal></entry>
|
||||
<entry>Tastencode ermitteln und einfügen</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>insert</literal></entry>
|
||||
<entry>füge eine Zeichenkette in der Befehlszeile ein</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>search_text</literal></entry>
|
||||
<entry>suche Text im Pufferverlauf</entry>
|
||||
</row>
|
||||
|
||||
@@ -36,7 +36,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
<bookinfo>
|
||||
|
||||
<title>WeeChat 0.2.2 - User guide</title>
|
||||
<title>WeeChat 0.2.4 - User guide</title>
|
||||
<subtitle>Schneller, leichter und erweiterbarer IRC Client</subtitle>
|
||||
|
||||
<author>
|
||||
@@ -48,7 +48,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
&date.xml;
|
||||
|
||||
<copyright>
|
||||
<year>2006</year>
|
||||
<year>2007</year>
|
||||
<holder>Sébastien Helleu</holder>
|
||||
</copyright>
|
||||
|
||||
@@ -512,6 +512,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Fenster neu aufbauen
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Strg + R</entry>
|
||||
<entry>
|
||||
Suche nach Text im Pufferverlauf
|
||||
(zwei Mal: suche nach dem genauen Text)
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Strg + T</entry>
|
||||
<entry>
|
||||
@@ -565,12 +572,14 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
<entry>Eingabe / Strg + J / Strg + M</entry>
|
||||
<entry>
|
||||
Führe ein Kommando aus oder sende eine Nachricht
|
||||
(im Suchmodus: Suche anhalten)
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Hoch / Runter</entry>
|
||||
<entry>
|
||||
Rufe das letzte Kommando/die letzte Nachricht wieder auf
|
||||
(im Suchmodus: suche rückwärts/vorwärts)
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
@@ -705,7 +714,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
<row>
|
||||
<entry>Alt + J dann Alt + X</entry>
|
||||
<entry>
|
||||
Schalte in den ersten Channel des nächsten Puffers
|
||||
Schalte in den ersten Channel des nächsten Servers
|
||||
(oder in den Server-Puffer wenn keine Channel offen ist)
|
||||
</entry>
|
||||
</row>
|
||||
@@ -2047,6 +2056,13 @@ plugin->log (plugin, "freenode", "#weechat", "test");
|
||||
Plugins weitergegeben
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>PLUGIN_RC_OK_WITH_HIGHLIGHT</literal>: Funktion
|
||||
erfolgreich vervollständigt und eine Hervorhebung bei den
|
||||
empfangenen Nachrichten eingebaut
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
@@ -2511,6 +2527,119 @@ keyb_handler = plugin->keyboard_handler_add (plugin, &my_keyb);
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secAPI_event_handler_add">
|
||||
<title>event_handler_add</title>
|
||||
|
||||
<para>
|
||||
Prototyp:
|
||||
<command>
|
||||
t_plugin_handler *event_handler_add (t_weechat_plugin
|
||||
*plugin, char *event, t_plugin_handler_func *function,
|
||||
char *handler_args, void *handler_pointer)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Fügt einen Ereignishandler hinzu, der aufgerufen wird, wenn ein Ereignis eintritt.
|
||||
</para>
|
||||
<para>
|
||||
Argumente:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>plugin</option>: Zeiger auf Plugin-Strukture
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>event</option> : Ereignis, siehe folgende Tabelle:
|
||||
<informaltable colsep="0" frame="none">
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Ereignis</entry>
|
||||
<entry>Beschreibung</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><literal>buffer_open</literal></entry>
|
||||
<entry>ein Puffer wurde geöffnet</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>buffer_close</literal></entry>
|
||||
<entry>ein Puffer wurde geschlossen</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>function</option>: aufgerufene Funktion
|
||||
</para>
|
||||
<para>
|
||||
Es wird folgender Prototyp verwendet:
|
||||
<command>
|
||||
int my_function (t_weechat_plugin *plugin,
|
||||
int argc, char **argv,
|
||||
char *handler_args, void *handler_pointer)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Argument argc wird auf 1 gesetzt, argv[0] ist die Nummer des Puffers, der
|
||||
geöffnet oder geschlossen wird.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>handler_args</option>: Argument, die an die aufgerufene
|
||||
Funktion übergeben werden
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>handler_pointer</option>: Pointer, der an die aufgerufene
|
||||
Funktion übergeben werden
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Rückgabewert: Pointer auf den neuen Ereignishandler.
|
||||
</para>
|
||||
<para>
|
||||
Anmerkung: die aufgerufene Function muss einen der folgenden Werte zurückgeben:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>PLUGIN_RC_KO</literal>: Funktion fehlgeschlagen
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>PLUGIN_RC_OK</literal>: Funktion erfolgreich beendet
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Beispiel:
|
||||
<screen>
|
||||
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);
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secAPI_handler_remove">
|
||||
<title>handler_remove</title>
|
||||
|
||||
@@ -2887,6 +3016,12 @@ plugin->exec_command (plugin, "freenode", "#weechat", "hello");
|
||||
<entry><literal>server</literal></entry>
|
||||
<entry>Name des Servers</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>type</literal></entry>
|
||||
<entry>
|
||||
Puffertyp: 0=standard, 1=DCC, 2=raw IRC data
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>away</literal></entry>
|
||||
<entry>Status des "away"-Flags</entry>
|
||||
@@ -4270,7 +4405,7 @@ else
|
||||
<row>
|
||||
<entry>int</entry>
|
||||
<entry><literal>type</literal></entry>
|
||||
<entry>Puffertyp: 0=standard, 1=dcc, 2=raw IRC data</entry>
|
||||
<entry>Puffertyp: 0=standard, 1=DCC, 2=raw IRC data</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>int</entry>
|
||||
@@ -5321,6 +5456,13 @@ end
|
||||
an WeeChat noch an andere Plugins übergeben
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>PLUGIN_RC_OK_WITH_HIGHLIGHT</literal>: Funktion
|
||||
erfolgreich vervollständigt und eine Hervorhebung bei den
|
||||
empfangenen Nachrichten eingebaut
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</section>
|
||||
@@ -5630,7 +5772,7 @@ def my_keyboard(key, input_before, input_after):
|
||||
|
||||
# ruby
|
||||
Weechat.add_keyboard_handler("my_keyboard")
|
||||
def my_keyboard(server, input_before, input_after)
|
||||
def my_keyboard(key, input_before, input_after)
|
||||
Weechat.print("keyboard handler: key = '#{key}', " \
|
||||
"input before = '#{input_before}' " \
|
||||
"after = '#{input_after}'")
|
||||
@@ -5639,7 +5781,7 @@ end
|
||||
|
||||
-- lua
|
||||
weechat.add_keyboard_handler("my_keyboard")
|
||||
function my_keyboard(server, input_before, input_after)
|
||||
function my_keyboard(key, input_before, input_after)
|
||||
weechat.print("keyboard handler: key = '"..key..
|
||||
"', input before = '"..input_before..
|
||||
"' after = '"..input_after.."'")
|
||||
@@ -5664,6 +5806,104 @@ end
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secScript_add_event_handler">
|
||||
<title>add_event_handler</title>
|
||||
|
||||
<para>
|
||||
Perl-Prototyp:
|
||||
<command>
|
||||
weechat::add_event_handler(event, function);
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Python-Prototyp:
|
||||
<command>
|
||||
weechat.add_event_handler(event, function)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Ruby-Prototyp:
|
||||
<command>
|
||||
Weechat.add_event_handler(event, function)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Lua-Prototyp:
|
||||
<command>
|
||||
weechat.add_event_handler(event, function)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Fügt einen Ereignis-Handler hinzu, der beim Auftreten eines Ereignisses aufgerufen wird.
|
||||
</para>
|
||||
<para>
|
||||
Argumente:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>event</option> : Ereignis
|
||||
(see <xref linkend="secAPI_event_handler_add" />)
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>function</option>: aufgerufene Funktion
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Rückgabewerte: 1 bei Erfolg, 0 bei aufgetretenen Fehlern
|
||||
</para>
|
||||
<para>
|
||||
Beispiele:
|
||||
<screen>
|
||||
# perl
|
||||
weechat::add_event_handler("buffer_open", "my_event");
|
||||
sub my_event
|
||||
{
|
||||
weechat::print("buffer open");
|
||||
return weechat::PLUGIN_RC_OK;
|
||||
}
|
||||
|
||||
# python
|
||||
weechat.add_event_handler("buffer_open", "my_event")
|
||||
def my_event():
|
||||
weechat.prnt("buffer open")
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
# ruby
|
||||
Weechat.add_event_handler("buffer_open", "my_event")
|
||||
def my_event()
|
||||
Weechat.print("buffer open")
|
||||
return Weechat::PLUGIN_RC_OK
|
||||
end
|
||||
|
||||
-- lua
|
||||
weechat.add_event_handler("buffer_open", "my_event")
|
||||
function my_event()
|
||||
weechat.print("buffer open")
|
||||
return weechat.PLUGIN_RC_OK()
|
||||
end
|
||||
</screen>
|
||||
</para>
|
||||
<para>
|
||||
Bemerkung: aufgerufene Funktion muss einen der folgenden Werte zurückgeben:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>PLUGIN_RC_KO</literal>: Funktion fehlgeschlagen
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>PLUGIN_RC_OK</literal>: Funktion erfolgreich beendet
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secScript_remove_handler">
|
||||
<title>remove_handler</title>
|
||||
|
||||
@@ -5832,7 +6072,7 @@ weechat.remove_timer_handler("my_timer")
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Rückgabewert: 1 bei Erfolg, 0 wenn ein Fehler aufgetreten ist.
|
||||
Rückgabewerte: 1 bei Erfolg, 0 wenn ein Fehler aufgetreten ist.
|
||||
</para>
|
||||
<para>
|
||||
Beispiele:
|
||||
@@ -5852,6 +6092,67 @@ weechat.remove_keyboard_handler("my_keyboard")
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secScrip_remove_event_handler">
|
||||
<title>remove_event_handler</title>
|
||||
|
||||
<para>
|
||||
Perl-Prototyp:
|
||||
<command>
|
||||
weechat::remove_event_handler(function);
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Python-Prototyp:
|
||||
<command>
|
||||
weechat.remove_event_handler(function)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Ruby-Prototyp:
|
||||
<command>
|
||||
Weechat.remove_event_handler(function)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Lua-Prototyp:
|
||||
<command>
|
||||
weechat.remove_event_handler(function)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Entfernt einen Ereignis-Handler.
|
||||
</para>
|
||||
<para>
|
||||
Argumente:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>function</option>: Funktion
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Rückgabewerte: 1 bei Erfolg, 0 wenn ein Fehler aufgetreten ist.
|
||||
</para>
|
||||
<para>
|
||||
Beispiele:
|
||||
<screen>
|
||||
# perl
|
||||
weechat::remove_event_handler("my_event");
|
||||
|
||||
# python
|
||||
weechat.remove_event_handler("my_event")
|
||||
|
||||
# ruby
|
||||
Weechat.remove_event_handler("my_event")
|
||||
|
||||
-- lua
|
||||
weechat.remove_event_handler("my_event")
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secScript_add_modifier">
|
||||
<title>add_modifier</title>
|
||||
|
||||
|
||||
@@ -15,7 +15,8 @@ Argumente: Argumente f
|
||||
|
||||
</programlisting>
|
||||
<command>wird durch alle Argumente ersetzt.</command>
|
||||
<programlisting>
|
||||
<programlisting>Die Variablen $nick, $channel and $server werden durch den aktuellen Nick/Channel oder Server ersetzt.
|
||||
|
||||
</programlisting>
|
||||
<command>buffer [Aktion [Argumente] | Nummer | [[Server] [Channel]]]</command>
|
||||
<programlisting>
|
||||
@@ -40,11 +41,12 @@ Befehl: auszuf
|
||||
|
||||
|
||||
</programlisting>
|
||||
<command>clear [-all]</command>
|
||||
<command>clear [-all | Nummer]</command>
|
||||
<programlisting>
|
||||
Fenster leeren
|
||||
|
||||
-all: alle Fenster leeren
|
||||
-all: lösche alle Puffer
|
||||
Nummer: lösche den Puffer mit der angegebenen Nummer
|
||||
|
||||
</programlisting>
|
||||
<command>connect [Servername]</command>
|
||||
@@ -108,13 +110,14 @@ Bei jedem Argument steht '*' f
|
||||
Ohne Argumente listet /ignore alle definierten /ignore-Regeln auf.
|
||||
|
||||
</programlisting>
|
||||
<command>key [Taste [Funktion/Befehl]] [unbind Taste] [functions] [reset -yes]</command>
|
||||
<command>key [Taste [Funktion/Befehl]] [unbind Taste] [functions] [call Funktion ["Argumente"]] [reset -yes] </command>
|
||||
<programlisting>
|
||||
belegen/freigeben von Tasten
|
||||
|
||||
Taste: diese Taste mit einer internen Funktion oder einem Befehl, beginnend mit "/", belegen
|
||||
Taste: diese Taste anzeigen oder mit einer internen Funktion oder einem Befehl, beginnend mit "/", belegen
|
||||
unbind: Tastenbelegung aufheben
|
||||
functions: interne Funktionen für Tastenbelegungen auflisten
|
||||
call: rufe eine Funktion über ihren Namen auf (mit optionalen Argumenten)
|
||||
reset: Standardbelegung wiederherstellen und entferne ALLE eigenen Belegungen (Vorsicht!)
|
||||
|
||||
</programlisting>
|
||||
|
||||
@@ -197,3 +197,11 @@
|
||||
<entry><literal>grab_key</literal></entry>
|
||||
<entry>grab a key</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>insert</literal></entry>
|
||||
<entry>insert a string in command line</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>search_text</literal></entry>
|
||||
<entry>search text in buffer history</entry>
|
||||
</row>
|
||||
|
||||
@@ -36,7 +36,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
<bookinfo>
|
||||
|
||||
<title>WeeChat 0.2.2 - User guide</title>
|
||||
<title>WeeChat 0.2.4 - User guide</title>
|
||||
<subtitle>Fast, light and extensible IRC client</subtitle>
|
||||
|
||||
<author>
|
||||
@@ -48,7 +48,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
&date.xml;
|
||||
|
||||
<copyright>
|
||||
<year>2006</year>
|
||||
<year>2007</year>
|
||||
<holder>Sébastien Helleu</holder>
|
||||
</copyright>
|
||||
|
||||
@@ -508,6 +508,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Redraw whole window
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Ctrl + R</entry>
|
||||
<entry>
|
||||
Search for text in buffer history
|
||||
(two times: search exact text)
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Ctrl + T</entry>
|
||||
<entry>
|
||||
@@ -561,12 +568,14 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
<entry>Enter / Ctrl + J / Ctrl + M</entry>
|
||||
<entry>
|
||||
Execute command or send message
|
||||
(in search mode: stop search)
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Up arrow / Down arrow</entry>
|
||||
<entry>
|
||||
Call again last commands/messages
|
||||
Call again last commands/messages (in search mode: search
|
||||
up/down)
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
@@ -701,7 +710,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
<row>
|
||||
<entry>Alt + J then Alt + X</entry>
|
||||
<entry>
|
||||
Switch to first channel of next buffer
|
||||
Switch to first channel of next server
|
||||
(or server buffer if no channel is opened)
|
||||
</entry>
|
||||
</row>
|
||||
@@ -2060,6 +2069,13 @@ plugin->log (plugin, "freenode", "#weechat", "test");
|
||||
will not be sent to WeeChat neither other plugins
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>PLUGIN_RC_OK_WITH_HIGHLIGHT</literal>: function
|
||||
successfully completed and make "highlight" on received
|
||||
message
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
@@ -2538,6 +2554,120 @@ keyb_handler = plugin->keyboard_handler_add (plugin, &my_keyb);
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secAPI_event_handler_add">
|
||||
<title>event_handler_add</title>
|
||||
|
||||
<para>
|
||||
Prototype:
|
||||
<command>
|
||||
t_plugin_handler *event_handler_add (t_weechat_plugin
|
||||
*plugin, char *event, t_plugin_handler_func *function,
|
||||
char *handler_args, void *handler_pointer)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Add an event handler, called when an event happens.
|
||||
</para>
|
||||
<para>
|
||||
Arguments:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>plugin</option>: pointer to plugin structure
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>event</option> : event, see table below:
|
||||
<informaltable colsep="0" frame="none">
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Event</entry>
|
||||
<entry>Description</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><literal>buffer_open</literal></entry>
|
||||
<entry>a buffer was open</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>buffer_close</literal></entry>
|
||||
<entry>a buffer was closed</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>function</option>: function called
|
||||
</para>
|
||||
<para>
|
||||
It uses following prototype:
|
||||
<command>
|
||||
int my_function (t_weechat_plugin *plugin,
|
||||
int argc, char **argv,
|
||||
char *handler_args, void *handler_pointer)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Argument argc is set to 1, argv[0] is number of buffer
|
||||
open/closed.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>handler_args</option>: arguments given to function
|
||||
when called
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>handler_pointer</option>: pointer given to function
|
||||
when called
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Return value: pointer to new event handler.
|
||||
</para>
|
||||
<para>
|
||||
Note: function called has to return one of following values:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>PLUGIN_RC_KO</literal>: function failed
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>PLUGIN_RC_OK</literal>: function successfully
|
||||
completed
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Example:
|
||||
<screen>
|
||||
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);
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secAPI_handler_remove">
|
||||
<title>handler_remove</title>
|
||||
|
||||
@@ -2917,6 +3047,12 @@ plugin->exec_command (plugin, "freenode", "#weechat", "hello");
|
||||
<entry><literal>server</literal></entry>
|
||||
<entry>name of server</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>type</literal></entry>
|
||||
<entry>
|
||||
buffer type: 0=standard, 1=DCC, 2=raw IRC data
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>away</literal></entry>
|
||||
<entry>"away" flag</entry>
|
||||
@@ -4305,7 +4441,7 @@ else
|
||||
<row>
|
||||
<entry>int</entry>
|
||||
<entry><literal>type</literal></entry>
|
||||
<entry>buffer type: 0=standard, 1=dcc, 2=raw IRC data</entry>
|
||||
<entry>buffer type: 0=standard, 1=DCC, 2=raw IRC data</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>int</entry>
|
||||
@@ -5364,6 +5500,13 @@ end
|
||||
will not be sent to WeeChat neither other plugins
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>PLUGIN_RC_OK_WITH_HIGHLIGHT</literal>: function
|
||||
successfully completed and make "highlight" on received
|
||||
message
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</section>
|
||||
@@ -5668,7 +5811,7 @@ def my_keyboard(key, input_before, input_after):
|
||||
|
||||
# ruby
|
||||
Weechat.add_keyboard_handler("my_keyboard")
|
||||
def my_keyboard(server, input_before, input_after)
|
||||
def my_keyboard(key, input_before, input_after)
|
||||
Weechat.print("keyboard handler: key = '#{key}', " \
|
||||
"input before = '#{input_before}' " \
|
||||
"after = '#{input_after}'")
|
||||
@@ -5677,7 +5820,7 @@ end
|
||||
|
||||
-- lua
|
||||
weechat.add_keyboard_handler("my_keyboard")
|
||||
function my_keyboard(server, input_before, input_after)
|
||||
function my_keyboard(key, input_before, input_after)
|
||||
weechat.print("keyboard handler: key = '"..key..
|
||||
"', input before = '"..input_before..
|
||||
"' after = '"..input_after.."'")
|
||||
@@ -5703,6 +5846,105 @@ end
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secScript_add_event_handler">
|
||||
<title>add_event_handler</title>
|
||||
|
||||
<para>
|
||||
Perl prototype:
|
||||
<command>
|
||||
weechat::add_event_handler(event, function);
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Python prototype:
|
||||
<command>
|
||||
weechat.add_event_handler(event, function)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Ruby prototype:
|
||||
<command>
|
||||
Weechat.add_event_handler(event, function)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Lua prototype:
|
||||
<command>
|
||||
weechat.add_event_handler(event, function)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Add an event handler, called when an event happens.
|
||||
</para>
|
||||
<para>
|
||||
Arguments:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>event</option> : event
|
||||
(see <xref linkend="secAPI_event_handler_add" />)
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>function</option>: function called
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Return value: 1 if success, 0 if an error occurred.
|
||||
</para>
|
||||
<para>
|
||||
Examples:
|
||||
<screen>
|
||||
# perl
|
||||
weechat::add_event_handler("buffer_open", "my_event");
|
||||
sub my_event
|
||||
{
|
||||
weechat::print("buffer open");
|
||||
return weechat::PLUGIN_RC_OK;
|
||||
}
|
||||
|
||||
# python
|
||||
weechat.add_event_handler("buffer_open", "my_event")
|
||||
def my_event():
|
||||
weechat.prnt("buffer open")
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
# ruby
|
||||
Weechat.add_event_handler("buffer_open", "my_event")
|
||||
def my_event()
|
||||
Weechat.print("buffer open")
|
||||
return Weechat::PLUGIN_RC_OK
|
||||
end
|
||||
|
||||
-- lua
|
||||
weechat.add_event_handler("buffer_open", "my_event")
|
||||
function my_event()
|
||||
weechat.print("buffer open")
|
||||
return weechat.PLUGIN_RC_OK()
|
||||
end
|
||||
</screen>
|
||||
</para>
|
||||
<para>
|
||||
Note: function called has to return one of following values:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>PLUGIN_RC_KO</literal>: function failed
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>PLUGIN_RC_OK</literal>: function successfully
|
||||
completed
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secScript_remove_handler">
|
||||
<title>remove_handler</title>
|
||||
|
||||
@@ -5891,6 +6133,67 @@ weechat.remove_keyboard_handler("my_keyboard")
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secScrip_remove_event_handler">
|
||||
<title>remove_event_handler</title>
|
||||
|
||||
<para>
|
||||
Perl prototype:
|
||||
<command>
|
||||
weechat::remove_event_handler(function);
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Python prototype:
|
||||
<command>
|
||||
weechat.remove_event_handler(function)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Ruby prototype:
|
||||
<command>
|
||||
Weechat.remove_event_handler(function)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Lua prototype:
|
||||
<command>
|
||||
weechat.remove_event_handler(function)
|
||||
</command>
|
||||
</para>
|
||||
<para>
|
||||
Remove an event handler.
|
||||
</para>
|
||||
<para>
|
||||
Arguments:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>function</option>: function
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Return value: 1 if success, 0 if an error occurred.
|
||||
</para>
|
||||
<para>
|
||||
Examples:
|
||||
<screen>
|
||||
# perl
|
||||
weechat::remove_event_handler("my_event");
|
||||
|
||||
# python
|
||||
weechat.remove_event_handler("my_event")
|
||||
|
||||
# ruby
|
||||
Weechat.remove_event_handler("my_event")
|
||||
|
||||
-- lua
|
||||
weechat.remove_event_handler("my_event")
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secScript_add_modifier">
|
||||
<title>add_modifier</title>
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user