mirror of
https://github.com/weechat/weechat.git
synced 2026-06-16 16:14:46 +02:00
Compare commits
44 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 047d941f46 | |||
| cf4a22b156 | |||
| 40bfb43e0f | |||
| edcc676ecf | |||
| 6f1683172f | |||
| 80a76f65f6 | |||
| 9f035d8f91 | |||
| 33ff438086 | |||
| 1759b1f004 | |||
| 29dd888e6f | |||
| 63416bb801 | |||
| a33efdd755 | |||
| 28f7902667 | |||
| 0493cb89eb | |||
| cb95bfc846 | |||
| f325b5a71f | |||
| 6450867535 | |||
| bd4d543d50 | |||
| 50b371da7e | |||
| 5479a3d10a | |||
| 7c51a79460 | |||
| 09b73be53a | |||
| 3eb2b1dc0f | |||
| 11acdddda3 | |||
| ba5349d9cb | |||
| ce72bdb9f0 | |||
| cb334b6de3 | |||
| 9905ee774b | |||
| 56ebcb53eb | |||
| 85cd863819 | |||
| 46205116c2 | |||
| 311ac060ce | |||
| bb021e567a | |||
| 00fbd7ad56 | |||
| 77e3fb3c83 | |||
| 1f801ff079 | |||
| 0d2afafbd0 | |||
| 74ee068457 | |||
| 8f623f6747 | |||
| ef1c7734bf | |||
| f4ccd51f74 | |||
| 2ad953097f | |||
| f680066f16 | |||
| 857a1b9139 |
@@ -118,8 +118,8 @@ country code serves to distinguish the dialects.
|
||||
language and `CC' denoting the country, is the one use on systems based
|
||||
on GNU libc. On other systems, some variations of this scheme are
|
||||
used, such as `LL' or `LL_CC.ENCODING'. You can get the list of
|
||||
locales supported by your system for your country by running the command
|
||||
`locale -a | grep '^LL''.
|
||||
locales supported by your system for your language by running the
|
||||
command `locale -a | grep '^LL''.
|
||||
|
||||
Not all programs have translations for all languages. By default, an
|
||||
English message is shown in place of a nonexistent translation. If you
|
||||
@@ -179,7 +179,7 @@ programming skill, here.
|
||||
======================
|
||||
|
||||
Languages are not equally supported in all packages. The following
|
||||
matrix shows the current state of internationalization, as of June
|
||||
matrix shows the current state of internationalization, as of July
|
||||
2006. The matrix shows, in regard of each package, for which languages
|
||||
PO files have been submitted to translation coordination, with a
|
||||
translation percentage of at least 50%.
|
||||
@@ -199,7 +199,7 @@ translation percentage of at least 50%.
|
||||
bibshelf | [] |
|
||||
binutils | [] |
|
||||
bison | [] [] |
|
||||
bison-runtime | |
|
||||
bison-runtime | [] |
|
||||
bluez-pin | [] [] [] [] [] |
|
||||
cflow | [] |
|
||||
clisp | [] [] |
|
||||
@@ -225,8 +225,8 @@ translation percentage of at least 50%.
|
||||
gbiff | [] |
|
||||
gcal | [] |
|
||||
gcc | [] |
|
||||
gettext-examples | [] [] [] [] |
|
||||
gettext-runtime | [] [] [] [] |
|
||||
gettext-examples | [] [] [] [] [] |
|
||||
gettext-runtime | [] [] [] [] [] |
|
||||
gettext-tools | [] [] |
|
||||
gimp-print | [] [] [] [] |
|
||||
gip | [] |
|
||||
@@ -303,7 +303,7 @@ translation percentage of at least 50%.
|
||||
libgphoto2 | [] [] |
|
||||
libgphoto2_port | [] [] |
|
||||
libgsasl | |
|
||||
libiconv | |
|
||||
libiconv | [] [] |
|
||||
libidn | [] [] |
|
||||
lifelines | [] () |
|
||||
lilypond | [] |
|
||||
@@ -342,7 +342,7 @@ translation percentage of at least 50%.
|
||||
sp | [] |
|
||||
stardict | [] |
|
||||
system-tools-ba... | [] [] [] [] [] [] [] [] [] |
|
||||
tar | |
|
||||
tar | [] |
|
||||
texinfo | [] [] [] |
|
||||
textutils | [] [] [] |
|
||||
tin | () () |
|
||||
@@ -360,7 +360,7 @@ translation percentage of at least 50%.
|
||||
xpad | [] [] |
|
||||
+----------------------------------------------------+
|
||||
af am ar az be bg bs ca cs cy da de el en en_GB eo
|
||||
11 0 1 2 8 20 1 42 43 2 62 97 18 1 16 13
|
||||
11 0 1 2 8 21 1 42 43 2 62 99 18 1 16 16
|
||||
|
||||
es et eu fa fi fr ga gl gu he hi hr hu id is it
|
||||
+--------------------------------------------------+
|
||||
@@ -478,10 +478,10 @@ translation percentage of at least 50%.
|
||||
libextractor | [] |
|
||||
libgpewidget | [] [] [] [] [] |
|
||||
libgpg-error | |
|
||||
libgphoto2 | [] [] |
|
||||
libgphoto2 | [] [] [] |
|
||||
libgphoto2_port | [] [] |
|
||||
libgsasl | [] [] |
|
||||
libiconv | |
|
||||
libiconv | [] |
|
||||
libidn | [] [] |
|
||||
lifelines | () |
|
||||
lilypond | [] |
|
||||
@@ -496,7 +496,7 @@ translation percentage of at least 50%.
|
||||
nano | [] () [] [] [] [] |
|
||||
nano_1_0 | [] [] [] [] [] |
|
||||
opcodes | [] [] [] [] |
|
||||
parted | [] [] [] |
|
||||
parted | [] [] [] [] |
|
||||
pilot-qof | |
|
||||
psmisc | [] [] [] |
|
||||
pwdutils | |
|
||||
@@ -520,11 +520,11 @@ translation percentage of at least 50%.
|
||||
sp | [] |
|
||||
stardict | [] |
|
||||
system-tools-ba... | [] [] [] [] [] [] [] [] |
|
||||
tar | [] [] [] [] [] |
|
||||
tar | [] [] [] [] [] [] |
|
||||
texinfo | [] [] |
|
||||
textutils | [] [] [] [] [] |
|
||||
tin | [] () |
|
||||
tp-robot | [] [] [] |
|
||||
tp-robot | [] [] [] [] |
|
||||
tuxpaint | [] [] |
|
||||
unicode-han-tra... | |
|
||||
unicode-transla... | [] [] |
|
||||
@@ -538,7 +538,7 @@ translation percentage of at least 50%.
|
||||
xpad | [] [] [] |
|
||||
+--------------------------------------------------+
|
||||
es et eu fa fi fr ga gl gu he hi hr hu id is it
|
||||
89 21 16 2 41 118 59 14 1 8 1 6 60 30 0 52
|
||||
89 21 16 2 41 119 61 14 1 8 1 6 61 30 0 53
|
||||
|
||||
ja ko ku ky lg lt lv mk mn ms mt nb ne nl nn no
|
||||
+--------------------------------------------------+
|
||||
@@ -640,14 +640,14 @@ translation percentage of at least 50%.
|
||||
iso_3166_2 | [] |
|
||||
iso_3166_3 | [] |
|
||||
iso_4217 | [] [] [] |
|
||||
iso_639 | [] [] [] |
|
||||
iso_639 | [] [] |
|
||||
jpilot | () () () |
|
||||
jtag | |
|
||||
jwhois | [] |
|
||||
kbd | [] |
|
||||
keytouch | [] |
|
||||
keytouch-editor | |
|
||||
keytouch-keyboa... | [] |
|
||||
keytouch-keyboa... | |
|
||||
latrine | [] |
|
||||
ld | |
|
||||
leafpad | [] [] |
|
||||
@@ -716,7 +716,7 @@ translation percentage of at least 50%.
|
||||
xpad | [] [] [] |
|
||||
+--------------------------------------------------+
|
||||
ja ko ku ky lg lt lv mk mn ms mt nb ne nl nn no
|
||||
40 24 2 1 1 3 1 2 3 21 0 15 1 102 6 3
|
||||
40 24 2 1 1 3 1 2 3 21 0 15 1 101 5 3
|
||||
|
||||
nso or pa pl pt pt_BR rm ro ru rw sk sl sq sr sv ta
|
||||
+------------------------------------------------------+
|
||||
@@ -758,7 +758,7 @@ translation percentage of at least 50%.
|
||||
gawk | [] [] [] [] |
|
||||
gbiff | [] |
|
||||
gcal | [] |
|
||||
gcc | |
|
||||
gcc | [] |
|
||||
gettext-examples | [] [] [] [] [] [] [] [] |
|
||||
gettext-runtime | [] [] [] [] [] [] [] [] |
|
||||
gettext-tools | [] [] [] [] [] [] [] |
|
||||
@@ -835,7 +835,7 @@ translation percentage of at least 50%.
|
||||
libgpewidget | [] [] [] [] [] [] [] |
|
||||
libgpg-error | [] [] |
|
||||
libgphoto2 | [] |
|
||||
libgphoto2_port | [] [] |
|
||||
libgphoto2_port | [] [] [] |
|
||||
libgsasl | [] [] [] [] |
|
||||
libiconv | |
|
||||
libidn | [] [] () |
|
||||
@@ -894,7 +894,7 @@ translation percentage of at least 50%.
|
||||
xpad | [] [] [] |
|
||||
+------------------------------------------------------+
|
||||
nso or pa pl pt pt_BR rm ro ru rw sk sl sq sr sv ta
|
||||
0 2 3 58 31 53 5 76 72 5 42 48 12 51 128 2
|
||||
0 2 3 58 31 53 5 76 72 5 42 48 12 51 130 2
|
||||
|
||||
tg th tk tr uk ven vi wa xh zh_CN zh_HK zh_TW zu
|
||||
+---------------------------------------------------+
|
||||
@@ -911,7 +911,7 @@ translation percentage of at least 50%.
|
||||
bibshelf | [] | 7
|
||||
binutils | [] [] [] | 9
|
||||
bison | [] [] [] | 19
|
||||
bison-runtime | [] [] [] | 15
|
||||
bison-runtime | [] [] [] | 16
|
||||
bluez-pin | [] [] [] [] [] [] | 28
|
||||
cflow | [] [] | 4
|
||||
clisp | | 6
|
||||
@@ -936,9 +936,9 @@ translation percentage of at least 50%.
|
||||
gawk | [] [] | 15
|
||||
gbiff | [] | 5
|
||||
gcal | [] | 5
|
||||
gcc | [] [] [] | 5
|
||||
gettext-examples | [] [] [] [] [] | 24
|
||||
gettext-runtime | [] [] [] [] [] | 26
|
||||
gcc | [] [] [] | 6
|
||||
gettext-examples | [] [] [] [] [] [] | 26
|
||||
gettext-runtime | [] [] [] [] [] [] | 28
|
||||
gettext-tools | [] [] [] [] [] | 19
|
||||
gimp-print | [] [] | 12
|
||||
gip | [] [] | 12
|
||||
@@ -996,26 +996,26 @@ translation percentage of at least 50%.
|
||||
iso_3166_2 | | 2
|
||||
iso_3166_3 | [] [] | 9
|
||||
iso_4217 | [] [] | 14
|
||||
iso_639 | [] [] | 16
|
||||
iso_639 | [] | 14
|
||||
jpilot | [] [] [] [] | 7
|
||||
jtag | [] | 3
|
||||
jwhois | [] [] [] | 13
|
||||
kbd | [] [] | 12
|
||||
keytouch | [] | 4
|
||||
keytouch-editor | | 2
|
||||
keytouch-keyboa... | [] | 4
|
||||
keytouch-keyboa... | | 2
|
||||
latrine | [] [] | 8
|
||||
ld | [] [] [] | 7
|
||||
ld | [] [] [] [] | 8
|
||||
leafpad | [] [] [] [] | 23
|
||||
libc | [] [] [] | 23
|
||||
libexif | [] | 4
|
||||
libextractor | [] | 5
|
||||
libgpewidget | [] [] [] | 19
|
||||
libgpg-error | [] | 4
|
||||
libgphoto2 | [] | 7
|
||||
libgphoto2_port | [] [] [] | 10
|
||||
libgphoto2 | [] | 8
|
||||
libgphoto2_port | [] [] [] | 11
|
||||
libgsasl | [] | 8
|
||||
libiconv | | 0
|
||||
libiconv | [] | 4
|
||||
libidn | [] [] | 10
|
||||
lifelines | | 4
|
||||
lilypond | | 2
|
||||
@@ -1030,7 +1030,7 @@ translation percentage of at least 50%.
|
||||
nano | [] [] | 15
|
||||
nano_1_0 | [] [] [] | 18
|
||||
opcodes | [] [] | 10
|
||||
parted | [] [] [] | 9
|
||||
parted | [] [] [] | 10
|
||||
pilot-qof | [] | 3
|
||||
psmisc | [] | 10
|
||||
pwdutils | [] | 3
|
||||
@@ -1038,7 +1038,7 @@ translation percentage of at least 50%.
|
||||
qof | [] | 2
|
||||
radius | [] | 6
|
||||
recode | [] [] [] | 25
|
||||
rpm | [] [] [] | 13
|
||||
rpm | [] [] [] [] | 14
|
||||
screem | [] | 2
|
||||
scrollkeeper | [] [] [] [] | 26
|
||||
sed | [] [] [] | 22
|
||||
@@ -1054,11 +1054,11 @@ translation percentage of at least 50%.
|
||||
sp | [] | 3
|
||||
stardict | [] [] [] [] | 11
|
||||
system-tools-ba... | [] [] [] [] [] [] [] | 37
|
||||
tar | [] [] [] [] | 17
|
||||
tar | [] [] [] [] | 19
|
||||
texinfo | [] [] [] | 15
|
||||
textutils | [] [] [] | 17
|
||||
tin | | 1
|
||||
tp-robot | [] [] [] | 9
|
||||
tp-robot | [] [] [] | 10
|
||||
tuxpaint | [] [] [] | 16
|
||||
unicode-han-tra... | | 0
|
||||
unicode-transla... | | 2
|
||||
@@ -1072,7 +1072,7 @@ translation percentage of at least 50%.
|
||||
xpad | [] [] [] | 14
|
||||
+---------------------------------------------------+
|
||||
77 teams tg th tk tr uk ven vi wa xh zh_CN zh_HK zh_TW zu
|
||||
172 domains 0 1 1 78 39 0 135 14 1 50 1 52 0 2040
|
||||
172 domains 0 1 1 78 39 0 135 13 1 50 3 54 0 2054
|
||||
|
||||
Some counters in the preceding matrix are higher than the number of
|
||||
visible blocks let us expect. This is because a few extra PO files are
|
||||
@@ -1085,7 +1085,7 @@ distributed as such by its maintainer. There might be an observable
|
||||
lag between the mere existence a PO file and its wide availability in a
|
||||
distribution.
|
||||
|
||||
If June 2006 seems to be old, you may fetch a more recent copy of
|
||||
If July 2006 seems to be old, you may fetch a more recent copy of
|
||||
this `ABOUT-NLS' file on most GNU archive sites. The most up-to-date
|
||||
matrix with full percentage details can be found at
|
||||
`http://www.iro.umontreal.ca/contrib/po/HTML/matrix.html'.
|
||||
|
||||
@@ -1,7 +1,40 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2006-08-19
|
||||
ChangeLog - 2006-10-01
|
||||
|
||||
|
||||
Version 0.2.1 (2006-10-01):
|
||||
* fixed crash for DCC receiver when resuming a file (bug #17885)
|
||||
* fixed DCC error for sender when receiver cancels DCC (bug #17838)
|
||||
* fixed random crash with /upgrade command (error when loading buffers)
|
||||
* fixed buffer search by server/channel: now if only channel is specified,
|
||||
a channel of another server can be found
|
||||
* fixed highlight for DCC, invite and notice: when a window is displaying
|
||||
buffer, there's no highlight
|
||||
* command "/away -all" now allowed when not connected to current server
|
||||
* new signals handled: SIGTERM and SIGHUP (received when terminal is closed):
|
||||
clean WeeChat quit (send quit to irc servers then quit WeeChat)
|
||||
* added some new default key bindings for existing keys (for some OS)
|
||||
* command /key now ok with one arg (key name): display key if found
|
||||
* fixed bug with CTCP VERSION sent on channels (bug #17547)
|
||||
* added current channel completion for /ctcp command
|
||||
* fixed bugs in get_buffer_data() which breaks the retrieval of buffer
|
||||
content (perl, lua)
|
||||
* fixed nicklist display bug when top/bottom (not enough lines) (bug #17537)
|
||||
* fixed bug with auto-rejoin of keyed chans (bug #17534)
|
||||
* added default nick completion when line starts with '//' (bug #17535)
|
||||
* values yes/no accepted (as on/off) for config boolean values (task #5454)
|
||||
* added server default notify level (set by /buffer notify on server buffer)
|
||||
(task #5634)
|
||||
* fixed crashs with /buffer and /charset commands when not connected to any
|
||||
server (bug #17525)
|
||||
* added special vars $nick/$channel/$server for server_command, alias and
|
||||
plugin command handlers
|
||||
* added arguments $1,$2,..,$9 and $* for alias (task #5831)
|
||||
* added hotlist in session file when using /upgrade command (task #5449)
|
||||
* fixed nick refresh problem with unrealircd specific modes: chan owner (~)
|
||||
and chan admin (&) (bug #17340)
|
||||
|
||||
Version 0.2.0 (2006-08-19):
|
||||
* added 'C'lear option on IRC raw buffer
|
||||
@@ -41,6 +74,7 @@ Version 0.2.0 (2006-08-19):
|
||||
* added polish, russian and czech quickstart guide
|
||||
* fixed display bug with special char (bug #16732)
|
||||
* added color encoding for some commands like /me
|
||||
* added aspell plugin
|
||||
* renamed plugins names (removed "lib" prefix in name)
|
||||
* fixed crash when closing DCC/raw buffer if 2 are open (bug #16808)
|
||||
* fixed crashes with DCC chat remove/purge on DCC view (bug #16775)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
WeeChat FAQ, 2006-08-19
|
||||
WeeChat FAQ, 2006-10-01
|
||||
=======================
|
||||
|
||||
Intended audience:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
WeeChat FAQ, 2006-08-19
|
||||
WeeChat FAQ, 2006-10-01
|
||||
=======================
|
||||
|
||||
Public concerné :
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ EXTRA_DIST = config.rpath BUGS FAQ FAQ.fr \
|
||||
debian/rules debian/weechat-common.docs \
|
||||
debian/weechat-common.install debian/weechat-curses.dirs \
|
||||
debian/weechat-curses.install debian/weechat-plugins.install \
|
||||
debian/weechat-curses.menu debian/NEWS \
|
||||
debian/weechat-curses.menu debian/NEWS debian/weechat.xpm \
|
||||
weechat.spec weechat_icon_32.png
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
* FlashCode, 2006-10-01
|
||||
|
||||
WeeChat 0.2.1 released.
|
||||
|
||||
* FlashCode, 2006-08-19
|
||||
|
||||
WeeChat 0.2.0 released.
|
||||
|
||||
Important release notes:
|
||||
|
||||
- if you upgraded with /upgrade in WeeChat, you should /disconnect and
|
||||
|
||||
+3
-2
@@ -19,14 +19,15 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.56)
|
||||
AC_INIT(WeeChat, 0.2.0, flashcode@flashtux.org)
|
||||
AC_INIT(WeeChat, 0.2.1, flashcode@flashtux.org)
|
||||
AC_CONFIG_SRCDIR([src/common/weechat.c])
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_INIT_AUTOMAKE([weechat], [0.2.0])
|
||||
AM_INIT_AUTOMAKE([weechat], [0.2.1])
|
||||
|
||||
# Checks for programs
|
||||
AC_PROG_CC
|
||||
AC_PROG_MAKE_SET
|
||||
AC_GNU_SOURCE
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
# Add some flags for some OS
|
||||
|
||||
+2
-2
@@ -1207,7 +1207,7 @@
|
||||
<entry>Zeichenfolge</entry>
|
||||
<entry>eine beliebige Zeichenfolge</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Befehle, die nach der Verbindung zum Server ausgeführt werden sollen (mehrere Befehle müssen mit einem Semikolon getrennt werden, um ein Semikolon zu schreiben, muss man '\;' verwenden)</entry>
|
||||
<entry>Command(s) to run when connected to server (many commands should be separated by ';', use '\;' for a semicolon, special variables $nick, $channel and $server are replaced by their value)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>server_command_delay</option></entry>
|
||||
@@ -1235,7 +1235,7 @@
|
||||
<entry>Zeichenfolge</entry>
|
||||
<entry>eine beliebige Zeichenfolge</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Durch Kommata getrennte Liste der Notify-Levels für die Channels auf diesem Server (Format: #channel:1,...)</entry>
|
||||
<entry>Comma separated list of notify levels for channels of this server (format: #channel:1,..), a channel name '*' is reserved for server default notify level</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>server_charset_decode_iso</option></entry>
|
||||
|
||||
+178
-175
File diff suppressed because it is too large
Load Diff
+15
-11
@@ -9,23 +9,27 @@
|
||||
<programlisting>
|
||||
einen Alias für einen Befehl anlegen
|
||||
|
||||
Aliasname: Name des Alias
|
||||
Befehl: Befehlsname (WeeChat- oder IRC-Befehl ohne führenden '/', mehrere Befehle können durch Semikola getrennt werden)
|
||||
Argumente: Argumente für den Befehl
|
||||
alias_name: name of alias
|
||||
command: command name (WeeChat or IRC command, many commands can be separated by semicolons)
|
||||
arguments: arguments for command
|
||||
|
||||
</programlisting>
|
||||
<command>is replaced by all arguments.</command>
|
||||
<programlisting>
|
||||
</programlisting>
|
||||
<command>buffer [Aktion [Argumente] | Nummer | [[Server] [Channel]]]</command>
|
||||
<programlisting>
|
||||
Puffer verwalten
|
||||
|
||||
Aktion: Pufferaktion:
|
||||
move: Puffer in der Liste bewegen (kann auch relativ sein, wie -1)
|
||||
close: Puffer schließen (eine Part-Message kann optional angegeben werden)
|
||||
list: alle offenen Puffer auflisten (Standardaktion)
|
||||
notify: Notify-Level für Puffer festlegen (0=nie, 1=bei hervorgehobenen Nachrichten, 2=1+persönliche Nachricht, 3=2+join/part)
|
||||
Server
|
||||
Channel: gehe zum Puffer mit Servernamen oder Channelnamen
|
||||
Nummer: gehe zu Puffer mit dieser Nummer
|
||||
action: action to do:
|
||||
move: move buffer in the list (may be relative, for example -1)
|
||||
close: close buffer (optional arg is part message, for a channel)
|
||||
list: list open buffers (no parameter implies this list)
|
||||
notify: set notify level for buffer (0=never, 1=highlight, 2=1+msg, 3=2+join/part)
|
||||
(when executed on server buffer, this sets default notify level for whole server)
|
||||
server,
|
||||
channel: jump to buffer by server and/or channel name
|
||||
number: jump to buffer by number
|
||||
|
||||
</programlisting>
|
||||
<command>builtin Befehl</command>
|
||||
|
||||
+2
-2
@@ -1207,7 +1207,7 @@
|
||||
<entry>string</entry>
|
||||
<entry>any string</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Command(s) to run when connected to server (many commands should be separated by ';', use '\;' for a semicolon)</entry>
|
||||
<entry>Command(s) to run when connected to server (many commands should be separated by ';', use '\;' for a semicolon, special variables $nick, $channel and $server are replaced by their value)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>server_command_delay</option></entry>
|
||||
@@ -1235,7 +1235,7 @@
|
||||
<entry>string</entry>
|
||||
<entry>any string</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Comma separated list of notify levels for channels of this server (format: #channel:1,..)</entry>
|
||||
<entry>Comma separated list of notify levels for channels of this server (format: #channel:1,..), a channel name '*' is reserved for server default notify level</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>server_charset_decode_iso</option></entry>
|
||||
|
||||
+18
-14
@@ -36,7 +36,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
<bookinfo>
|
||||
|
||||
<title>WeeChat 0.2.0 - User guide</title>
|
||||
<title>WeeChat 0.2.1 - User guide</title>
|
||||
<subtitle>Fast, light and extensible IRC client</subtitle>
|
||||
|
||||
<author>
|
||||
@@ -6557,6 +6557,7 @@ if ($bf)
|
||||
{
|
||||
weechat::print(" > $key => $value");
|
||||
}
|
||||
weechat::print("----------------------");
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -6571,6 +6572,7 @@ if bf != None and bf != {}:
|
||||
weechat.prnt ("**** info for buffer no %d ****" % b)
|
||||
for c in bf[b]:
|
||||
weechat.prnt (" > %s => %s" % (c, bf[b][c]))
|
||||
weechat.prnt ("----------------------")
|
||||
else:
|
||||
weechat.prnt ("**** no buffer info ****")
|
||||
|
||||
@@ -6582,6 +6584,7 @@ if bf != nil and bf != {}
|
||||
c.each do |key, value|
|
||||
Weechat.print(" > #{key} => #{value}")
|
||||
end
|
||||
Weechat.print("----------------------")
|
||||
end
|
||||
else
|
||||
Weechat.print("**** no buffer info ****")
|
||||
@@ -6598,6 +6601,7 @@ if bf then
|
||||
weechat.print(" > " .. key .. " => " .. value)
|
||||
key, value = next (binfos, key)
|
||||
end
|
||||
weechat.print ("----------------------")
|
||||
b, infos = next (bf, b)
|
||||
end
|
||||
else
|
||||
@@ -6645,12 +6649,12 @@ end
|
||||
Examples:
|
||||
<screen>
|
||||
# perl
|
||||
my $server = "freenode";
|
||||
my $channel = "#weechat";
|
||||
my $server = weechat::get_info("server");
|
||||
my $channel = weechat::get_info("channel");
|
||||
my @bc = weechat::get_buffer_data($server, $channel);
|
||||
if (@bc)
|
||||
{
|
||||
weechat::print("**** buffer data for $channel@$server ****");
|
||||
weechat::print("**** buffer data for '$channel'\@'$server' ****");
|
||||
foreach my $l (@bc) {
|
||||
while ( my ($key, $value) = each %$l) {
|
||||
weechat::print(" > $key => $value");
|
||||
@@ -6664,11 +6668,11 @@ else
|
||||
}
|
||||
|
||||
# python
|
||||
server = "freenode"
|
||||
channel = "#weechat"
|
||||
server = weechat.get_info("server")
|
||||
channel = weechat.get_info("channel")
|
||||
bc = weechat.get_buffer_data(server, channel)
|
||||
if bc != None and bc != []:
|
||||
weechat.prnt ("**** buffer data for %s@%s ****" % (channel, server))
|
||||
weechat.prnt ("**** buffer data for '%s'@'%s' ****" % (channel, server))
|
||||
for l in bc:
|
||||
for i in l:
|
||||
weechat.prnt (" > %s => %s" % (i, l[i]))
|
||||
@@ -6677,11 +6681,11 @@ else:
|
||||
weechat.prnt ("**** no buffer data ****")
|
||||
|
||||
# ruby
|
||||
server = "freenode"
|
||||
channel = "#weechat"
|
||||
server = Weechat.get_info("server")
|
||||
channel = Weechat.get_info("channel")
|
||||
bc = Weechat.get_buffer_data(server, channel)
|
||||
if bc != nil and bc != []
|
||||
Weechat.print("**** buffer data for #{channel}@#{server} ****")
|
||||
Weechat.print("**** buffer data for '#{channel}'@'#{server}' ****")
|
||||
bc.each do |l|
|
||||
l.each do |key, value|
|
||||
Weechat.print(" > #{key} => #{value}")
|
||||
@@ -6693,14 +6697,14 @@ else
|
||||
end
|
||||
|
||||
-- lua
|
||||
server = "freenode"
|
||||
channel = "#weechat"
|
||||
server = weechat.get_info("server")
|
||||
channel = weechat.get_info("channel")
|
||||
bc = weechat.get_buffer_data(server, channel)
|
||||
if bc then
|
||||
b, bdatas = next (bc, nil)
|
||||
weechat.print("**** buffer data for " .. channel .. "@" .. server .. " ****")
|
||||
weechat.print("**** buffer data for '" .. channel .. "'@'" .. server .. "' ****")
|
||||
while (b) do
|
||||
key, value = next (chaninfos, nil)
|
||||
key, value = next (bdatas, nil)
|
||||
while (key) do
|
||||
weechat.print(" > " .. key .. " => " .. value)
|
||||
key, value = next (bdatas, key)
|
||||
|
||||
@@ -13,6 +13,9 @@ alias_name: name of alias
|
||||
command: command name (WeeChat or IRC command, many commands can be separated by semicolons)
|
||||
arguments: arguments for command
|
||||
|
||||
</programlisting>
|
||||
<command>is replaced by all arguments.</command>
|
||||
<programlisting>
|
||||
</programlisting>
|
||||
<command>buffer [action [args] | number | [[server] [channel]]]</command>
|
||||
<programlisting>
|
||||
@@ -23,7 +26,8 @@ manage buffers
|
||||
close: close buffer (optional arg is part message, for a channel)
|
||||
list: list open buffers (no parameter implies this list)
|
||||
notify: set notify level for buffer (0=never, 1=highlight, 2=1+msg, 3=2+join/part)
|
||||
server
|
||||
(when executed on server buffer, this sets default notify level for whole server)
|
||||
server,
|
||||
channel: jump to buffer by server and/or channel name
|
||||
number: jump to buffer by number
|
||||
|
||||
|
||||
+2
-2
@@ -1207,7 +1207,7 @@
|
||||
<entry>chaîne</entry>
|
||||
<entry>toute chaîne</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Commande(s) à exécuter lorsque connecté au serveur (plusieurs commandes doivent être séparées par ';', utilisez '\;' pour un point-virgule)</entry>
|
||||
<entry>Commande(s) à exécuter lorsque connecté au serveur (plusieurs commandes doivent être séparées par ';', utilisez '\;' pour un point-virgule, les variables spéciales $nick, $channel et $server sont remplacées par leur valeur)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>server_command_delay</option></entry>
|
||||
@@ -1235,7 +1235,7 @@
|
||||
<entry>chaîne</entry>
|
||||
<entry>toute chaîne</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Liste des niveaux de notifications (séparés par des virgules) pour les canaux de ce serveur (format: #canal:1,..)</entry>
|
||||
<entry>Liste des niveaux de notifications (séparés par des virgules) pour les canaux de ce serveur (format: #canal:1,..), un nom de canal '*' est réservé pour la notification par défaut du serveur</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>server_charset_decode_iso</option></entry>
|
||||
|
||||
+18
-14
@@ -36,7 +36,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
<bookinfo>
|
||||
|
||||
<title>WeeChat 0.2.0 - Guide utilisateur</title>
|
||||
<title>WeeChat 0.2.1 - Guide utilisateur</title>
|
||||
<subtitle>Client IRC rapide, léger et extensible</subtitle>
|
||||
|
||||
<author>
|
||||
@@ -6678,6 +6678,7 @@ if ($bf)
|
||||
{
|
||||
weechat::print(" > $key => $value");
|
||||
}
|
||||
weechat::print("----------------------");
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -6692,6 +6693,7 @@ if bf != None and bf != {}:
|
||||
weechat.prnt ("**** info pour tampon buffer no %d ****" % b)
|
||||
for c in bf[b]:
|
||||
weechat.prnt (" > %s => %s" % (c, bf[b][c]))
|
||||
weechat.prnt ("----------------------")
|
||||
else:
|
||||
weechat.prnt ("**** pas d'info sur les tampons ****")
|
||||
|
||||
@@ -6703,6 +6705,7 @@ if bf != nil and bf != {}
|
||||
c.each do |key, value|
|
||||
Weechat.print(" > #{key} => #{value}")
|
||||
end
|
||||
Weechat.print("----------------------")
|
||||
end
|
||||
else
|
||||
Weechat.print("**** pas d'info sur les tampons ****")
|
||||
@@ -6719,6 +6722,7 @@ if bf then
|
||||
weechat.print(" > " .. key .. " => " .. value)
|
||||
key, value = next (binfos, key)
|
||||
end
|
||||
weechat.print ("----------------------")
|
||||
b, infos = next (bf, b)
|
||||
end
|
||||
else
|
||||
@@ -6766,12 +6770,12 @@ end
|
||||
Examples:
|
||||
<screen>
|
||||
# perl
|
||||
my $server = "freenode";
|
||||
my $channel = "#weechat";
|
||||
my $server = weechat::get_info("server");
|
||||
my $channel = weechat::get_info("channel");
|
||||
my @bc = weechat::get_buffer_data($server, $channel);
|
||||
if (@bc)
|
||||
{
|
||||
weechat::print("**** buffer data for $channel@$server ****");
|
||||
weechat::print("**** buffer data for '$channel'\@'$server' ****");
|
||||
foreach my $l (@bc) {
|
||||
while ( my ($key, $value) = each %$l) {
|
||||
weechat::print(" > $key => $value");
|
||||
@@ -6785,11 +6789,11 @@ else
|
||||
}
|
||||
|
||||
# python
|
||||
server = "freenode"
|
||||
channel = "#weechat"
|
||||
server = weechat.get_info("server")
|
||||
channel = weechat.get_info("channel")
|
||||
bc = weechat.get_buffer_data(server, channel)
|
||||
if bc != None and bc != []:
|
||||
weechat.prnt ("**** buffer data for %s@%s ****" % (channel, server))
|
||||
weechat.prnt ("**** buffer data for '%s'@'%s' ****" % (channel, server))
|
||||
for l in bc:
|
||||
for i in l:
|
||||
weechat.prnt (" > %s => %s" % (i, l[i]))
|
||||
@@ -6798,11 +6802,11 @@ else:
|
||||
weechat.prnt ("**** no buffer data ****")
|
||||
|
||||
# ruby
|
||||
server = "freenode"
|
||||
channel = "#weechat"
|
||||
server = Weechat.get_info("server")
|
||||
channel = Weechat.get_info("channel")
|
||||
bc = Weechat.get_buffer_data(server, channel)
|
||||
if bc != nil and bc != []
|
||||
Weechat.print("**** buffer data for #{channel}@#{server} ****")
|
||||
Weechat.print("**** buffer data for '#{channel}'@'#{server}' ****")
|
||||
bc.each do |l|
|
||||
l.each do |key, value|
|
||||
Weechat.print(" > #{key} => #{value}")
|
||||
@@ -6814,14 +6818,14 @@ else
|
||||
end
|
||||
|
||||
-- lua
|
||||
server = "freenode"
|
||||
channel = "#weechat"
|
||||
server = weechat.get_info("server")
|
||||
channel = weechat.get_info("channel")
|
||||
bc = weechat.get_buffer_data(server, channel)
|
||||
if bc then
|
||||
b, bdatas = next (bc, nil)
|
||||
weechat.print("**** buffer data for " .. channel .. "@" .. server .. " ****")
|
||||
weechat.print("**** buffer data for '" .. channel .. "'@'" .. server .. "' ****")
|
||||
while (b) do
|
||||
key, value = next (chaninfos, nil)
|
||||
key, value = next (bdatas, nil)
|
||||
while (key) do
|
||||
weechat.print(" > " .. key .. " => " .. value)
|
||||
key, value = next (bdatas, key)
|
||||
|
||||
@@ -13,6 +13,9 @@ cr
|
||||
commande: nom de la commande (commande WeeChat ou IRC, plusieurs commandes peuvent être séparées par des point-virgules)
|
||||
paramètres: paramètres pour la commande
|
||||
|
||||
</programlisting>
|
||||
<command>est remplacé par tous les paramètres.</command>
|
||||
<programlisting>
|
||||
</programlisting>
|
||||
<command>buffer [action [args] | nombre | [[serveur] [canal]]]</command>
|
||||
<programlisting>
|
||||
@@ -23,7 +26,8 @@ gestion des tampons
|
||||
close: ferme le tampon (le paramètre optionnel est le message de fin, pour un canal)
|
||||
list: liste les tampons ouverts (pas de paramètre affiche cette liste)
|
||||
notify: fixe le niveau de notification (0=jamais, 1=highlight, 2=1+msg, 3=2+join/part)
|
||||
serveur
|
||||
(quand exécuté sur un tampon serveur, cela fixe le niveau de notification par défaut pour le serveur entier)
|
||||
serveur,
|
||||
canal: saute au tampon par serveur et/ou nom de canal
|
||||
nombre: saute au tampon qui a ce numéro
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.TH WEECHAT 1 "August 2006" "FlashCode"
|
||||
.TH WEECHAT 1 "October 2006" "FlashCode"
|
||||
|
||||
.SH NAME
|
||||
weechat-curses \- Wee Enhanced Environment for Chat (Curses version)
|
||||
|
||||
@@ -50,6 +50,8 @@
|
||||
./src/gui/gui-keyboard.h
|
||||
./src/gui/gui-panel.h
|
||||
./src/gui/gui-window.h
|
||||
./src/common/alias.c
|
||||
./src/common/alias.h
|
||||
./src/common/backtrace.c
|
||||
./src/common/backtrace.h
|
||||
./src/common/command.c
|
||||
|
||||
+825
-793
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,27 @@
|
||||
-- Author: Julien Louis <ptitlouis@sysif.net>
|
||||
-- License: GPLv2
|
||||
-- Description: This lua script prints in the infobar the machine load average
|
||||
--
|
||||
weechat.register("loadavg", "0.1", "unload", "Print the load average in infobar")
|
||||
|
||||
local refresh = weechat.get_config("loadavg_refresh")
|
||||
|
||||
if refresh == "" then
|
||||
refresh = 5
|
||||
weechat.set_config("loadavg_refresh", 5)
|
||||
end
|
||||
|
||||
weechat.add_timer_handler(refresh, "loadavg")
|
||||
|
||||
function loadavg()
|
||||
local load = io.open("/proc/loadavg"):read()
|
||||
load = string.gsub(load, "^([%w.]+) ([%w.]+) ([%w.]+).*", "%1 %2 %3")
|
||||
weechat.print_infobar(refresh, "load: "..load)
|
||||
return weechat.PLUGIN_RC_OK;
|
||||
end
|
||||
|
||||
function unload()
|
||||
weechat.remove_timer_handler("loadavg")
|
||||
return weechat.remove_infobar(1)
|
||||
end
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
##############################################################################
|
||||
# #
|
||||
# Away highlite loger #
|
||||
# #
|
||||
# Perl script for WeeChat. #
|
||||
# #
|
||||
# Log highlite/private msg when you are away #
|
||||
# #
|
||||
# #
|
||||
# #
|
||||
# Copyright (C) 2006 Jiri Golembiovsky <golemj@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 Street, Fifth Floor, Boston, #
|
||||
# MA 02110-1301, USA. #
|
||||
# #
|
||||
##############################################################################
|
||||
|
||||
weechat::register( "AwayLog", "0.4", "", "Log privmsg/highlite when you are away" );
|
||||
|
||||
weechat::add_message_handler( "PRIVMSG", "awaylog" );
|
||||
|
||||
sub test_highlight {
|
||||
$str = shift;
|
||||
$irc_highlight = weechat::get_config( "irc_highlight" );
|
||||
@arr = split( ",", $irc_highlight );
|
||||
$b = 0;
|
||||
$str = lc( $str );
|
||||
while( $item = pop( @arr ) ) {
|
||||
$item = lc( $item );
|
||||
if( substr( $item, 0, 1 ) eq '*' ) { $item = '.' . $item; }
|
||||
if( substr( $item, length( $item ) - 1, 1 ) eq '*' ) { $item = substr( $item, , 0, length( $item ) - 1 ) . ".*"; }
|
||||
if( $str =~ /$item/ ) { $b++; }
|
||||
}
|
||||
return $b;
|
||||
}
|
||||
|
||||
sub awaylog {
|
||||
if( weechat::get_info( "away", $_[0] ) == 1 ) {
|
||||
$i = index( $_[1], " PRIVMSG " );
|
||||
$hostmask = substr( $_[1], 0, $i );
|
||||
$str = substr( $_[1], $i + 9 );
|
||||
$i = index( $str, ":" );
|
||||
$channel = substr( $str, 0, $i - 1 );
|
||||
$message = substr( $str, $i + 1 );
|
||||
if( substr( $hostmask, 0, 1 ) eq ":" ) {
|
||||
$hostmask = substr( $hostmask, 1 );
|
||||
}
|
||||
($nick, $host) = split( "!", $hostmask );
|
||||
$mynick = weechat::get_info( "nick", $_[0] );
|
||||
if( ( index( $message, $mynick ) != -1 ) || ( $channel eq $mynick ) || ( test_highlight( $message ) > 0 ) ) {
|
||||
weechat::print( "$channel -- $nick :: $message", "", $_[0] );
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
#
|
||||
# Copyright (c) 2006 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
|
||||
#
|
||||
|
||||
#
|
||||
# Speaker beep on highlight/private msg.
|
||||
#
|
||||
# History:
|
||||
#
|
||||
# 2006-09-02, FlashCode <flashcode@flashtux.org>:
|
||||
# initial release
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
||||
my $version = "0.1";
|
||||
my $beep_command = "echo -n \a";
|
||||
|
||||
# default values in setup file (~/.weechat/plugins.rc)
|
||||
my $default_beep_highlight = "on";
|
||||
my $default_beep_pv = "on";
|
||||
|
||||
weechat::register("Beep", $version, "", "Speaker beep on highlight/private msg");
|
||||
weechat::set_plugin_config("beep_highlight", $default_beep_highlight) if (weechat::get_plugin_config("beep_highlight") eq "");
|
||||
weechat::set_plugin_config("beep_pv", $default_beep_pv) if (weechat::get_plugin_config("beep_pv") eq "");
|
||||
|
||||
weechat::add_message_handler("weechat_highlight", "highlight");
|
||||
weechat::add_message_handler("weechat_pv", "pv");
|
||||
|
||||
sub highlight
|
||||
{
|
||||
my $beep = weechat::get_plugin_config("beep_highlight");
|
||||
system($beep_command) if ($beep eq "on");
|
||||
return weechat::PLUGIN_RC_OK;
|
||||
}
|
||||
|
||||
sub pv
|
||||
{
|
||||
my $beep = weechat::get_plugin_config("beep_pv");
|
||||
system($beep_command) if ($beep eq "on");
|
||||
return weechat::PLUGIN_RC_OK;
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
##############################################################################
|
||||
# #
|
||||
# Exec #
|
||||
# #
|
||||
# Perl script for WeeChat. #
|
||||
# #
|
||||
# Execute the command and print it to the actual buffer or server #
|
||||
# #
|
||||
# #
|
||||
# #
|
||||
# Copyright (C) 2006 Jiri Golembiovsky <golemj@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 Street, Fifth Floor, Boston, #
|
||||
# MA 02110-1301, USA. #
|
||||
# #
|
||||
##############################################################################
|
||||
|
||||
use Config;
|
||||
|
||||
$Config{usethreads} or die( "Recompile Perl with threads to run this script." );
|
||||
|
||||
use Thread;
|
||||
|
||||
my $registred = 0;
|
||||
weechat::register( "Exec", "0.2", "", "Execute the command and print it to some buffer" );
|
||||
|
||||
weechat::add_command_handler(
|
||||
"exec",
|
||||
execute,
|
||||
"Execute the command and print it to some buffer",
|
||||
"[-o][ -win server:::channel] <cmd line>",
|
||||
" -o print as msg\n".
|
||||
" -win server:::channel print the output to the specific buffer",
|
||||
""
|
||||
);
|
||||
|
||||
sub execute {
|
||||
if( !$registred ) { return; }
|
||||
my $i = 0;
|
||||
my $cmd = "";
|
||||
my $msg = 0;
|
||||
my $win = "";
|
||||
my @arr = split( ' ', $_[1] );
|
||||
my $cmdStart = 0;
|
||||
if( $#arr < 0 ) { return; }
|
||||
for( $i = 0; $i <= $#arr; $i++ ) {
|
||||
if( @arr[$i] eq "-win" ) {
|
||||
$i++;
|
||||
$win = @arr[$i];
|
||||
$cmdStart = $i + 1;
|
||||
}
|
||||
if( @arr[$i] eq "-o" ) {
|
||||
$msg = 1;
|
||||
$cmdStart = $i + 1;
|
||||
}
|
||||
}
|
||||
for( $i = $cmdStart; $i <= $#arr; $i++ ) {
|
||||
if( length( $cmd ) ) { $cmd = $cmd . ' '; }
|
||||
$cmd = $cmd . @arr[$i];
|
||||
}
|
||||
|
||||
my $thr = new Thread \&func_execute, $cmd, $msg, $win;
|
||||
}
|
||||
|
||||
sub func_execute {
|
||||
my $command = shift;
|
||||
my $msg = shift;
|
||||
my $win = shift;
|
||||
my $c = 1;
|
||||
my $char = '';
|
||||
my $date = `date +%Y%m%d%H%M%S%N`;
|
||||
my $out = "";
|
||||
|
||||
if( !length( $command ) ) {
|
||||
weechat::print( "No command to execute (try -? for help)" );
|
||||
return;
|
||||
}
|
||||
|
||||
if( substr( $date, length( $date ) - 1, 1 ) eq "\n" ) { $date = substr( $date, 0, length( $date ) - 1 ); }
|
||||
|
||||
if( length( $command ) ) { system( $command . " > /tmp/weechat_" . $date . " 2>&1" ); }
|
||||
|
||||
open( FD, '<', "/tmp/weechat_" . $date ) or weechat::print( "/tmp/weechat_" . $date . ": $!" );
|
||||
do {
|
||||
$c = read( FD, $char, 1 );
|
||||
$out = $out . $char;
|
||||
} while( $c );
|
||||
close( FD );
|
||||
system( "rm -f /tmp/weechat_" . $date );
|
||||
my $j = index( $win, ':::' );
|
||||
if( length( $win ) && ( $j >= 0 ) ) {
|
||||
if( $msg ) {
|
||||
my $win1 = substr( $win, $j + 3 );
|
||||
my $win2 = substr( $win, 0, $j );
|
||||
my @its = split( "\n", $out );
|
||||
for( $j = 0; $j <= $#its; $j++ ) {
|
||||
weechat::command( $its[$j], $win1, $win2 );
|
||||
}
|
||||
} else {
|
||||
weechat::print( $out, substr( $win, $j + 3 ), substr( $win, 0, $j ) );
|
||||
}
|
||||
} else {
|
||||
if( $msg ) {
|
||||
my $win1 = substr( $win, $j + 3 );
|
||||
my $win2 = substr( $win, 0, $j );
|
||||
my @its = split( "\n", $out );
|
||||
for( $j = 0; $j <= $#its; $j++ ) {
|
||||
weechat::command( $its[$j], $win1, $win2 );
|
||||
}
|
||||
} else {
|
||||
weechat::print( $out );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$registred = 1;
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
# =============================================================================
|
||||
# Copyright (c) 2003-2005 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
|
||||
#
|
||||
# fete.pl (c) Décembre 2003 par FlashCode <flashcode@flashtux.org>
|
||||
# Mis à jour le 04/06/2005, FlashCode <flashcode@flashtux.org>
|
||||
#
|
||||
# Gestion des fêtes du calendrier français avec la commande "/fete"
|
||||
# Syntaxe: /fete - affiche la fête du jour et du lendemain
|
||||
# /fete prenom - cherche un prénom dans le calendrier
|
||||
# =============================================================================
|
||||
|
||||
use locale;
|
||||
|
||||
my $version = "0.4";
|
||||
weechat::register ("Fete", $version, "", "Gestion des fêtes du calendrier français");
|
||||
weechat::print ("Script 'Fete' $version chargé");
|
||||
weechat::add_command_handler ("fete", fete);
|
||||
|
||||
@noms_jours = qw(Dimanche Lundi Mardi Mercredi Jeudi Vendredi Samedi);
|
||||
@noms_mois = qw(Janvier Février Mars Avril Mai Juin Juillet Août Septembre Octobre Novembre Décembre);
|
||||
@fetes = (
|
||||
# janvier
|
||||
[ '!Marie - JOUR de l\'AN', '&Basile', '!Geneviève', '&Odilon', '&Edouard',
|
||||
'&Mélaine', '&Raymond', '&Lucien', '!Alix', '&Guillaume', '&Paulin',
|
||||
'!Tatiana', '!Yvette', '!Nina', '&Rémi', '&Marcel', '!Roseline',
|
||||
'!Prisca', '&Marius', '&Sébastien', '!Agnès', '&Vincent', '&Barnard',
|
||||
'&François de Sales', '-Conversion de St Paul', '!Paule', '!Angèle',
|
||||
'&Thomas d\'Aquin', '&Gildas', '!Martine', '!Marcelle' ],
|
||||
# février
|
||||
[ '!Ella', '-Présentation', '&Blaise', '!Véronique', '!Agathe',
|
||||
'&Gaston', '!Eugénie', '!Jacqueline', '!Apolline', '&Arnaud',
|
||||
'-Notre-Dame de Lourdes', '&Félix', '!Béatrice', '&Valentin', '&Claude',
|
||||
'!Julienne', '&Alexis', '!Bernadette', '&Gabin', '!Aimée',
|
||||
'&Pierre Damien', '!Isabelle', '&Lazare', '&Modeste', '&Roméo', '&Nestor',
|
||||
'!Honorine', '&Romain', '&Auguste' ],
|
||||
# mars
|
||||
[ '&Aubin', '&Charles le Bon', '&Guénolé', '&Casimir', '&Olive', '&Colette',
|
||||
'!Félicité', '&Jean de Dieu', '!Françoise', '&Vivien', '!Rosine',
|
||||
'!Justine', '&Rodrigue', '!Mathilde', '!Louise de Marillac', '!Bénédicte',
|
||||
'&Patrice', '&Cyrille', '&Joseph', '&Herbert', '!Clémence', '!Léa',
|
||||
'&Victorien', '!Catherine de Suède', '-Annonciation', '!Larissa',
|
||||
'&Habib', '&Gontran', '!Gwladys', '&Amédée', '&Benjamin' ],
|
||||
# avril
|
||||
[ '&Hugues', '!Sandrine', '&Richard', '&Isodore', '!Irène', '&Marcellin',
|
||||
'&Jean-Baptiste de la Salle', '!Julie', '&Gautier', '&Fulbert',
|
||||
'&Stanislas', '&Jules', '!Ida', '&Maxime', '&Paterne',
|
||||
'&Benoît-Joseph Labre', '&Anicet', '&Parfait', '!Emma', '!Odette',
|
||||
'&Anselme', '&Alexandre', '&Georges', '&Fidèle', '&Marc', '!Alida',
|
||||
'!Zita', '!Valérie', '!Catherine de Sienne', '&Robert' ],
|
||||
# mai
|
||||
[ '&Jérémie - FETE du TRAVAIL', '&Boris', '&Philippe / Jacques', '&Sylvain',
|
||||
'!Judith', '!Prudence', '!Gisèle', '&Désiré - ANNIVERSAIRE 1945',
|
||||
'&Pacôme', '!Solange', '!Estelle', '&Achille', '!Rolande', '&Mathias',
|
||||
'!Denise', '&Honoré', '&Pascal', '&Eric', '&Yves', '&Bernardin',
|
||||
'&Constantin', '&Emile', '&Didier', '&Donatien', '!Sophie', '&Bérenger',
|
||||
'&Augustin', '&Germain', '&Aymar', '&Ferdinand', '-Visitation' ],
|
||||
# juin
|
||||
[ '&Justin', '!Blandine', '&Kévin', '!Clotilde', '&Igor', '&Norbert',
|
||||
'&Gilbert', '&Médard', '!Diane', '&Landry', '&Barnabé', '&Guy',
|
||||
'&Antoine de Padoue', '&Elisée', '!Germaine', '&Jean-François Régis',
|
||||
'&Hervé', '&Léonce', '&Romuald', '&Silvère', '&Rodolphe', '&Alban',
|
||||
'!Audrey', '&Jean-Baptiste', '&Salomon', '&Anthelme', '&Fernand',
|
||||
'&Irénée', '&Pierre / Paul', '&Martial' ],
|
||||
# juillet
|
||||
[ '&Thierry', '&Martinien', '&Thomas', '&Florent', '&Antoine', '!Mariette',
|
||||
'&Raoul', '&Thibaut', '!Amandine', '&Ulrich', '&Benoît', '&Olivier',
|
||||
'&Henri / Joël', '!Camille - FETE NATIONALE', '&Donald',
|
||||
'-N.D. du Mont Carmel', '!Charlotte', '&Frédéric', '&Arsène', '!Marina',
|
||||
'&Victor', '!Marie-Madeleine', '!Brigitte', '!Christine', '&Jacques',
|
||||
'&Anne', '!Nathalie', '&Samson', '!Marthe', '!Juliette',
|
||||
'&Ignace de Loyola' ],
|
||||
# août
|
||||
[ '&Alphonse', '&Julien', '!Lydie', '&Jean-Marie Vianney', '&Abel',
|
||||
'-Transfiguration', '&Gaëtan', '&Dominique', '&Amour', '&Laurent',
|
||||
'!Claire', '!Clarisse', '&Hippolyte', '&Evrard',
|
||||
'!Marie - ASSOMPTION', '&Armel', '&Hyacinthe', '!Hélène', '&Jean Eudes',
|
||||
'&Bernard', '&Christophe', '&Fabrice', '!Rose de Lima', '&Barthélémy',
|
||||
'&Louis', '!Natacha', '!Monique', '&Augustin', '!Sabine', '&Fiacre',
|
||||
'&Aristide' ],
|
||||
# septembre
|
||||
[ '&Gilles', '!Ingrid', '&Grégoire', '!Rosalie', '!Raïssa', '&Bertrand',
|
||||
'!Reine', '-Nativité de Marie', '&Alain', '!Inès', '&Adelphe',
|
||||
'&Apollinaire', '&Aimé', '-La Ste Croix', '&Roland', '!Edith', '&Renaud',
|
||||
'!Nadège', '!Emilie', '&Davy', '&Matthieu', '&Maurice', '&Constant',
|
||||
'!Thècle', '&Hermann', '&Côme / Damien', '&Vincent de Paul', '&Venceslas',
|
||||
'&Michel / Gabriel', '&Jérôme' ],
|
||||
# octobre
|
||||
[ '!Thérèse de l\'Enfant Jésus', '&Léger', '&Gérard', '&François d\'Assise',
|
||||
'!Fleur', '&Bruno', '&Serge', '!Pélagie', '&Denis', '&Ghislain', '&Firmin',
|
||||
'&Wilfried', '&Géraud', '&Juste', '!Thérèse d\'Avila', '!Edwige',
|
||||
'&Baudouin', '&Luc', '&René', '!Adeline', '!Céline', '!Elodie',
|
||||
'&Jean de Capistran', '&Florentin', '&Crépin', '&Dimitri', '!Emeline',
|
||||
'&Simon / Jude', '&Narcisse', '!Bienvenue', '&Quentin' ],
|
||||
# novembre
|
||||
[ '&Harold - TOUSSAINT', '-Défunts', '&Hubert', '&Charles', '!Sylvie',
|
||||
'!Bertille', '!Carine', '&Geoffroy', '&Théodore', '&Léon',
|
||||
'&Martin - ARMISTICE 1918', '&Christian', '&Brice', '&Sidoine', '&Albert',
|
||||
'!Marguerite', '!Elisabeth', '!Aude', '&Tanguy', '&Edmond',
|
||||
'-Présentation de Marie', '!Cécile', '&Clément', '!Flora', '!Catherine',
|
||||
'!Delphine', '&Séverin', '&Jacques de la Marche', '&Saturnin', '&André' ],
|
||||
# décembre
|
||||
[ '!Florence', '!Viviane', '&Xavier', '!Barbara', '&Gérald', '&Nicolas',
|
||||
'&Ambroise', '-Immaculée Conception', '&Pierre Fourier', '&Romaric',
|
||||
'&Daniel', '!Jeanne de Chantal', '!Lucie', '!Odile', '!Ninon', '!Alice',
|
||||
'&Gaël', '&Gatien', '&Urbain', '&Abraham', '&Pierre Canisius',
|
||||
'!Françoise-Xavier', '&Armand', '!Adèle', '&Emmanuel - NOEL', '&Etienne',
|
||||
'&Jean', '-Sts Innocents', '&David', '&Roger', '&Sylvestre' ],
|
||||
);
|
||||
|
||||
sub fete_jour
|
||||
{
|
||||
my ($sec, $min, $heure, $mjour, $mois, $annee, $sjour, $ajour, $est_dst) = localtime ($_[0]);
|
||||
my $fete = $fetes[$mois][$mjour-1];
|
||||
$fete =~ s/^!/Ste /;
|
||||
$fete =~ s/^&/St /;
|
||||
$fete =~ s/^-//;
|
||||
$fete;
|
||||
}
|
||||
|
||||
sub fete
|
||||
{
|
||||
if ($#_ == 1)
|
||||
{
|
||||
my @params = split " ", @_[1];
|
||||
for $arg (@params)
|
||||
{
|
||||
for (my $mois = 0; $mois <= $#fetes; $mois++)
|
||||
{
|
||||
for (my $jour = 0; $jour < 31; $jour++)
|
||||
{
|
||||
if (uc ($fetes[$mois][$jour]) =~ /\U$arg/)
|
||||
{
|
||||
weechat::print (($jour + 1)." ".$noms_mois[$mois].": ".substr ($fetes[$mois][$jour], 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
my $time_now = time;
|
||||
my ($fete1, $fete2) = (fete_jour ($time_now), fete_jour ($time_now + (3600 * 24)));
|
||||
my ($mjour, $mois, $sjour) = (localtime ($time_now))[3, 4, 6];
|
||||
weechat::print_infobar (0, "$fete1 (demain: $fete2)");
|
||||
}
|
||||
return weechat::PLUGIN_RC_OK;
|
||||
}
|
||||
|
||||
fete ();
|
||||
@@ -0,0 +1,57 @@
|
||||
# This script is a port from the original fortune.pl irssi script written by
|
||||
# Ivo Marino <eim@cpan.org>. This script is in the public domain
|
||||
#
|
||||
# Author: Julien Louis <ptitlouis@sysif.net>
|
||||
|
||||
weechat::register("fortune", "0.1", "", "Send a random fortune cookie to a specified nick");
|
||||
|
||||
weechat::add_command_handler ("fortune", fortune, "Send a random fortune cookie to a specified nick",
|
||||
"<nick> [lang]",
|
||||
"<nick> The nickname to send the fortune cookie\n" .
|
||||
" [lang] The cookie language (Default: en)\n",
|
||||
"%n %-");
|
||||
|
||||
sub fortune {
|
||||
|
||||
my ($server, $param) = @_;
|
||||
my $return = weechat::PLUGIN_RC_OK;
|
||||
my $cookie = '';
|
||||
|
||||
if ($param) {
|
||||
|
||||
if ($server) {
|
||||
(my $nick, my $lang) = split (' ', $param);
|
||||
$lang = 'en' unless ($lang eq 'de'|| $lang eq 'it' || $lang eq
|
||||
'en' || $lang eq 'fr' );
|
||||
weechat::print ("Nick: " . $nick . ", Lang: \"" . $lang . "\"");
|
||||
|
||||
if ($lang eq 'de') {
|
||||
$cookie = `fortune -x`;
|
||||
} elsif ($lang eq 'it') {
|
||||
$cookie = `fortune -a italia`;
|
||||
} else {
|
||||
$cookie = `fortune -a fortunes literature riddles`;
|
||||
}
|
||||
|
||||
$cookie =~ s/\s*\n\s*/ /g;
|
||||
if ($cookie) {
|
||||
$channel = weechat::get_info("channel");
|
||||
if ($channel) {
|
||||
weechat::command($nick . ": " . $cookie, $channel);
|
||||
}
|
||||
} else {
|
||||
weechat::print ("No cookie.");
|
||||
$return = weechat::PLUGIN_RC_KO;
|
||||
}
|
||||
} else {
|
||||
weechat::print ("Not connected to server");
|
||||
$return = weechat::PLUGIN_RC_KO;
|
||||
}
|
||||
} else {
|
||||
weechat::print ("Usage: /fortune <nick> [language]");
|
||||
$return = weechat::PLUGIN_RC_KO;
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
# This script is a port from the hello.pl irssi script written by
|
||||
# Cybertinus <cybertinus@cybertinus.nl>
|
||||
#
|
||||
# Licensed under the GPL v2
|
||||
#
|
||||
# Author: Julien Louis <ptitlouis@sysif.net>
|
||||
|
||||
weechat::register("hello" ,"0.1", "", "Display greetings depending the time");
|
||||
|
||||
weechat::add_command_handler("hello", hello, "", "Send greetings to the current buffer");
|
||||
|
||||
weechat::set_plugin_config("evening_message", "good evening");
|
||||
weechat::set_plugin_config("afternoon_message", "good afternoon");
|
||||
weechat::set_plugin_config("morning_message", "good morning");
|
||||
weechat::set_plugin_config("night_message", "good night");
|
||||
|
||||
|
||||
sub hello {
|
||||
my ($server,$data) = @_;
|
||||
|
||||
$time = (localtime(time))[2];
|
||||
if ($time >= 18) {
|
||||
$text = weechat::get_plugin_config("evening_message");
|
||||
} elsif ($time >= 12) {
|
||||
$text = weechat::get_plugin_config("afternoon_message");
|
||||
} elsif ($time >= 6) {
|
||||
$text = weechat::get_plugin_config("morning_message");
|
||||
} elsif ($time >= 0) {
|
||||
$text = weechat::get_plugin_config("night_message");
|
||||
}
|
||||
weechat::command("$text $data");
|
||||
return weechat::PLUGIN_RC_OK;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
#
|
||||
# This script is mostly a copy/paste from kernel.pl irssi script
|
||||
# This script is in the public domain.
|
||||
#
|
||||
# Julien Louis <ptitlouis@sysif.net>
|
||||
|
||||
use IO::Socket;
|
||||
|
||||
weechat::register("kernel", "0.1", "", "Return latest kernel versions from kernel.org" );
|
||||
|
||||
weechat::add_command_handler("kernel_version", kernel_version);
|
||||
|
||||
sub finger($$) {
|
||||
# Yes, Net::Finger is already done and i'm reinventing the wheel.
|
||||
my ($user, $host) = @_;
|
||||
my $buffer;
|
||||
if (my $socket = IO::Socket::INET->new(
|
||||
PeerHost => $host,
|
||||
PeerPort => 'finger(79)',
|
||||
Proto => 'tcp',
|
||||
))
|
||||
{
|
||||
if (syswrite $socket, "$user\n") {
|
||||
unless (sysread $socket, $buffer, 1024) {
|
||||
# Should i use $! here?
|
||||
weechat::print("Unable to read from the socket: $!");
|
||||
}
|
||||
} else {
|
||||
# ..and here?
|
||||
weechat::print("Unable to write to the socket: $!");
|
||||
}
|
||||
} else {
|
||||
weechat::print("Connection to $host failed: $!");
|
||||
}
|
||||
return $buffer;
|
||||
}
|
||||
|
||||
sub kernel_version {
|
||||
my @version;
|
||||
if (my $finger = finger("", "finger.kernel.org")) {
|
||||
# The magic of the regexps :)
|
||||
@version = $finger =~ /:\s*(\S+)\s*$/gm;
|
||||
# Modify this to do whatever you want.
|
||||
|
||||
my %branches = (
|
||||
26 => "",
|
||||
24 => "",
|
||||
22 => "",
|
||||
20 => "",
|
||||
);
|
||||
|
||||
foreach my $kernel (@version) {
|
||||
if($kernel =~ /2\.6/) {
|
||||
$branches{26} .= " $kernel";
|
||||
} elsif($kernel =~ /2\.4/) {
|
||||
$branches{24} .= " $kernel";
|
||||
} elsif ($kernel =~ /2\.2/) {
|
||||
$branches{22} .= " $kernel";
|
||||
} elsif ($kernel =~ /2\.0/) {
|
||||
$branches{20} .= " $kernel";
|
||||
}
|
||||
}
|
||||
|
||||
my @keys = sort(keys(%branches));
|
||||
foreach my $key (@keys) {
|
||||
weechat::print("branche " . join('.', split(//, $key)));
|
||||
weechat::print("$branches{$key}");
|
||||
}
|
||||
|
||||
# weechat::print("@version");
|
||||
return weechat::PLUGIN_RC_OK;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
#
|
||||
# Copyright (c) 2006 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
|
||||
#
|
||||
|
||||
#
|
||||
# Search for text in WeeChat disk log files.
|
||||
#
|
||||
# History:
|
||||
# 2006-04-17, FlashCode <flashcode@flashtux.org>:
|
||||
# initial release
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
||||
# default values in setup file (~/.weechat/plugins.rc)
|
||||
my $default_max = "8";
|
||||
my $default_server = "off";
|
||||
my $default_grep_options = "-i";
|
||||
|
||||
# init script
|
||||
weechat::register("logsearch", "0.1", "", "Search for text in WeeChat disk log files");
|
||||
weechat::set_plugin_config("max", $default_max) if (weechat::get_plugin_config("max") eq "");
|
||||
weechat::set_plugin_config("server", $default_server) if (weechat::get_plugin_config("server") eq "");
|
||||
weechat::set_plugin_config("grep_options", $default_grep_options) if (weechat::get_plugin_config("grep_options") eq "");
|
||||
|
||||
# add command handler /logsearch
|
||||
weechat::add_command_handler("logsearch", "logsearch",
|
||||
"search for text in WeeChat disk log files",
|
||||
"[-n#] text",
|
||||
"-n#: max number or lines to display\n"
|
||||
."text: regular expression (used by grep)\n\n"
|
||||
."Plugins options (set with /setp):\n"
|
||||
." - perl.logsearch.max: max number of lines displayed by default\n"
|
||||
." - perl.logsearch.server: display result on server "
|
||||
."buffer (if on), otherwise on current buffer\n"
|
||||
." - perl.logsearch.grep_options: options to give to grep program",
|
||||
"");
|
||||
|
||||
# /logsearch command
|
||||
sub logsearch
|
||||
{
|
||||
my $server = shift;
|
||||
my $args = shift;
|
||||
if ($args ne "")
|
||||
{
|
||||
# read settings
|
||||
my $conf_max = weechat::get_plugin_config("max");
|
||||
$conf_max = $default_max if ($conf_max eq "");
|
||||
my $conf_server = weechat::get_plugin_config("server");
|
||||
$conf_server = $default_server if ($conf_server eq "");
|
||||
my $output_server = "";
|
||||
$output_server = $server if (lc($conf_server) eq "on");
|
||||
my $grep_options = weechat::get_plugin_config("grep_options");
|
||||
|
||||
# build log filename
|
||||
my $buffer = weechat::get_info("channel", "");
|
||||
$buffer = ".".$buffer if ($buffer ne "");
|
||||
my $log_path = weechat::get_config("log_path");
|
||||
$log_path =~ s/%h/~\/.weechat/g;
|
||||
my $file = $log_path.$server.$buffer.".weechatlog";
|
||||
|
||||
# run grep in log file
|
||||
if ($args =~ /-n([0-9]+) (.*)/)
|
||||
{
|
||||
$conf_max = $1;
|
||||
$args = $2;
|
||||
}
|
||||
my $command = "grep ".$grep_options." '".$args."' ".$file." 2>/dev/null | tail -n".$conf_max;
|
||||
my $result = `$command`;
|
||||
|
||||
# display result
|
||||
if ($result eq "")
|
||||
{
|
||||
weechat::print("Text not found in $file", "", $output_server);
|
||||
return weechat::PLUGIN_RC_OK;
|
||||
}
|
||||
my @result_array = split(/\n/, $result);
|
||||
weechat::print($_, "", $output_server) foreach(@result_array);
|
||||
}
|
||||
return weechat::PLUGIN_RC_OK;
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
##############################################################################
|
||||
# #
|
||||
# MOC #
|
||||
# #
|
||||
# Perl script for WeeChat. #
|
||||
# #
|
||||
# Show info about current song in moc #
|
||||
# #
|
||||
# #
|
||||
# #
|
||||
# Copyright (C) 2006 Jiri Golembiovsky <golemj@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 Street, Fifth Floor, Boston, #
|
||||
# MA 02110-1301, USA. #
|
||||
# #
|
||||
##############################################################################
|
||||
|
||||
weechat::register( "MOCP", "0.2", "", "Show info about current song in moc" );
|
||||
weechat::add_command_handler(
|
||||
"moc",
|
||||
moc,
|
||||
"Show info about current song in moc",
|
||||
"[[-i][-o][-ot]]",
|
||||
"-i show info about current song (default parameter if no other is given)\n" .
|
||||
"-o print results to the current channel as /msg\n" .
|
||||
"-ot print results to the current channel as /me, this parameter overide -o parameter\n" .
|
||||
"To set output format use moc_set_format command.\n" .
|
||||
"To set another default output type than -i use moc_set_output command.\n",
|
||||
"-i|-o|-ot"
|
||||
);
|
||||
|
||||
weechat::add_command_handler(
|
||||
"moc_set_format",
|
||||
mocSetFormat,
|
||||
"Set output format for moc command",
|
||||
"format_string",
|
||||
"Following combinations will be replaced by apropriate text:\n".
|
||||
" %A - artist\n" .
|
||||
" %B - album\n" .
|
||||
" %F - file name with path\n" .
|
||||
" %H - file name without path\n" .
|
||||
" %J - total time\n" .
|
||||
" %K - current time\n" .
|
||||
" %L - time left\n" .
|
||||
" %M - total seconds\n" .
|
||||
" %N - current seconds\n" .
|
||||
" %S - state\n" .
|
||||
" %T - title\n" .
|
||||
" %U - song title\n" .
|
||||
" %Y - biterate\n" .
|
||||
" %Z - rate\n" .
|
||||
"When no format string is setted then current format string is printed.",
|
||||
""
|
||||
);
|
||||
|
||||
weechat::add_command_handler(
|
||||
"moc_set_output",
|
||||
mocSetOutput,
|
||||
"Set default output for moc command",
|
||||
"i|o|ot",
|
||||
"For more info see help of moc command",
|
||||
"i|o|ot"
|
||||
);
|
||||
|
||||
sub info {
|
||||
my $i;
|
||||
my $res = "";
|
||||
my $sout = `mocp -i`;
|
||||
my @out = split( "\n", $sout );
|
||||
my $format = weechat::get_plugin_config( "outputFormat" );
|
||||
if( length( $format ) == 0 ) { $format = "is listening to %T ::: %H"; }
|
||||
if( $#out < 2 ) { return ""; }
|
||||
for( $i = 0; $i <= $#out; $i++ ) {
|
||||
if( ( index( @out[$i], ' ' ) == -1 ) ||
|
||||
( index( @out[$i], ' ' ) == ( length( @out[$i] ) - 1 ) )
|
||||
) {
|
||||
@out[$i] = "";
|
||||
} else {
|
||||
@out[$i] = substr( @out[$i], index( @out[$i], ' ' ) + 1 );
|
||||
}
|
||||
}
|
||||
$i = 0;
|
||||
while( $i < length( $format ) ) {
|
||||
if( substr( $format, $i, 1 ) eq '%' ) {
|
||||
$i++;
|
||||
if( substr( $format, $i, 1 ) eq 'A' ) { $res = $res . @out[3]; }
|
||||
if( substr( $format, $i, 1 ) eq 'B' ) { $res = $res . @out[5]; }
|
||||
if( substr( $format, $i, 1 ) eq 'F' ) { $res = $res . @out[1]; }
|
||||
if( substr( $format, $i, 1 ) eq 'H' ) {
|
||||
if( index( @out[1], "://" ) > 0 ) {
|
||||
$res = $res . @out[1];
|
||||
} else {
|
||||
$res = $res . substr( @out[1], rindex( @out[1], '/' ) + 1 );
|
||||
}
|
||||
}
|
||||
if( substr( $format, $i, 1 ) eq 'J' ) { $res = $res . @out[6]; }
|
||||
if( substr( $format, $i, 1 ) eq 'K' ) { $res = $res . @out[9]; }
|
||||
if( substr( $format, $i, 1 ) eq 'L' ) { $res = $res . @out[7]; }
|
||||
if( substr( $format, $i, 1 ) eq 'M' ) { $res = $res . @out[8]; }
|
||||
if( substr( $format, $i, 1 ) eq 'N' ) { $res = $res . @out[10]; }
|
||||
if( substr( $format, $i, 1 ) eq 'S' ) { $res = $res . @out[0]; }
|
||||
if( substr( $format, $i, 1 ) eq 'T' ) { $res = $res . @out[2]; }
|
||||
if( substr( $format, $i, 1 ) eq 'U' ) { $res = $res . @out[4]; }
|
||||
if( substr( $format, $i, 1 ) eq 'Y' ) { $res = $res . @out[11]; }
|
||||
if( substr( $format, $i, 1 ) eq 'Z' ) { $res = $res . @out[12]; }
|
||||
} else {
|
||||
$res = $res . substr( $format, $i, 1 );
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
sub moc {
|
||||
my $out;
|
||||
my $outType = weechat::get_plugin_config( "outputType" );
|
||||
if( length( $outType ) == 0 ) { $outType = 'i'; }
|
||||
if( length( $_[1] ) ) { $outType = $_[1]; }
|
||||
if( ( $outType ne 'i' ) && ( $outType ne 'o' ) && ( $outType ne 'ot' ) ) {
|
||||
weechat::print( "Bad parameter or default output type" );
|
||||
}
|
||||
$out = info();
|
||||
if( $outType eq 'i' ) { weechat::print( $out ); }
|
||||
if( $outType eq 'o' ) { weechat::command( $out ); }
|
||||
if( $outType eq 'ot' ) { weechat::command( "/me " . $out ); }
|
||||
return weechat::PLUGIN_RC_OK;
|
||||
}
|
||||
|
||||
sub mocSetFormat {
|
||||
if( length( $_[1] ) ) {
|
||||
weechat::set_plugin_config( "outputFormat", $_[1] );
|
||||
} else {
|
||||
my $format = weechat::get_plugin_config( "outputFormat" );
|
||||
if( length( $format ) == 0 ) { $format = "is listening to %T ::: %H"; }
|
||||
weechat::print( "Current format is \"$format\"" );
|
||||
}
|
||||
return weechat::PLUGIN_RC_OK;
|
||||
}
|
||||
|
||||
sub mocSetOutput {
|
||||
if( length( $_[1] ) ) {
|
||||
if( ( $_[1] eq 'i' ) || ( $_[1] eq 'o' ) || ( $_[1] eq 'ot' ) ) {
|
||||
weechat::set_plugin_config( "outputType", $_[1] );
|
||||
} else {
|
||||
weechat::print( "moc_set_command: bad parameter" );
|
||||
}
|
||||
} else {
|
||||
my $out = weechat::get_plugin_config( "outputType" );
|
||||
if( length( $out ) == 0 ) { $out = 'i'; }
|
||||
weechat::print( "Default output: $out" );
|
||||
}
|
||||
return weechat::PLUGIN_RC_OK;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
#
|
||||
# Copyright (c) 2006 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
|
||||
#
|
||||
|
||||
#
|
||||
# Play a sound when highlighted/private msg, or for ctcp sound event.
|
||||
#
|
||||
# History:
|
||||
#
|
||||
# 2006-05-30, FlashCode <flashcode@flashtux.org>:
|
||||
# added plugin options for commands
|
||||
# 2004-10-01, FlashCode <flashcode@flashtux.org>:
|
||||
# initial release
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
||||
my $version = "0.3";
|
||||
my $command_suffix = " >/dev/null 2>&1 &";
|
||||
|
||||
# default values in setup file (~/.weechat/plugins.rc)
|
||||
my $default_cmd_highlight = "alsaplay -i text ~/sound_highlight.wav";
|
||||
my $default_cmd_pv = "alsaplay -i text ~/sound_pv.wav";
|
||||
my $default_cmd_ctcp = "alsaplay -i text \$filename";
|
||||
|
||||
weechat::register("Sound", $version, "", "Sound for highlights/privates & CTCP sound events");
|
||||
weechat::set_plugin_config("cmd_highlight", $default_cmd_highlight) if (weechat::get_plugin_config("cmd_highlight") eq "");
|
||||
weechat::set_plugin_config("cmd_pv", $default_cmd_pv) if (weechat::get_plugin_config("cmd_pv") eq "");
|
||||
weechat::set_plugin_config("cmd_ctcp", $default_cmd_ctcp) if (weechat::get_plugin_config("cmd_ctcp") eq "");
|
||||
|
||||
weechat::add_message_handler("PRIVMSG", "sound");
|
||||
weechat::add_message_handler("weechat_highlight", "highlight");
|
||||
weechat::add_message_handler("weechat_pv", "pv");
|
||||
weechat::add_command_handler("sound", "sound_cmd");
|
||||
|
||||
sub sound
|
||||
{
|
||||
my $server = $_[0];
|
||||
if ($_[1] =~ /(.*) PRIVMSG (.*)/)
|
||||
{
|
||||
my ($host, $msg) = ($1, $2);
|
||||
if ($host ne "localhost")
|
||||
{
|
||||
if ($msg =~ /\001SOUND ([^ ]*)\001/)
|
||||
{
|
||||
my $filename = $1;
|
||||
my $command = weechat::get_plugin_config("cmd_ctcp");
|
||||
$command =~ s/(\$\w+)/$1/gee;
|
||||
system($command.$command_suffix);
|
||||
}
|
||||
}
|
||||
}
|
||||
return weechat::PLUGIN_RC_OK;
|
||||
}
|
||||
|
||||
sub highlight
|
||||
{
|
||||
my $command = weechat::get_plugin_config("cmd_highlight");
|
||||
system($command.$command_suffix);
|
||||
return weechat::PLUGIN_RC_OK;
|
||||
}
|
||||
|
||||
sub pv
|
||||
{
|
||||
my $command = weechat::get_plugin_config("cmd_pv");
|
||||
system($command.$command_suffix);
|
||||
return weechat::PLUGIN_RC_OK;
|
||||
}
|
||||
|
||||
sub sound_cmd
|
||||
{
|
||||
if ($#_ == 1)
|
||||
{
|
||||
my $filename = $_[1].".wav";
|
||||
my $command = weechat::get_plugin_config("cmd_ctcp");
|
||||
$command =~ s/(\$\w+)/$1/gee;
|
||||
system($command.$command_suffix);
|
||||
weechat::command("/quote PRIVMSG ".weechat::get_info("channel")." :\001SOUND $filename\001") if (@_);
|
||||
}
|
||||
return weechat::PLUGIN_RC_OK;
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
#
|
||||
# Copyright (c) 2006 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
|
||||
#
|
||||
|
||||
#
|
||||
# Translate words and display result in infobar, local buffer or channel
|
||||
#
|
||||
# History:
|
||||
# 2006-07-03, FlashCode <flashcode@flashtux.org>:
|
||||
# initial release
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
||||
# default values in setup file (~/.weechat/plugins.rc)
|
||||
my $default_output_infobar = "on";
|
||||
my $default_timeout = "2";
|
||||
|
||||
# script internal settings
|
||||
my $languages = "de|el|en|es|fr|it|ja|ko|nl|pt|ru|zh|zt";
|
||||
|
||||
# init script
|
||||
weechat::register("translate", "0.1", "", "Translation script");
|
||||
weechat::set_plugin_config("output_infobar", $default_output_infobar) if (weechat::get_plugin_config("output_infobar") eq "");
|
||||
weechat::set_plugin_config("timeout", $default_timeout) if (weechat::get_plugin_config("timeout") eq "");
|
||||
|
||||
# add command handlers for all languages
|
||||
weechat::add_command_handler("translate", "translate", "translate text to other language",
|
||||
"lang1 lang2 text [-o]",
|
||||
"lang1: base language\n"
|
||||
."lang2: target language\n"
|
||||
." text: text to translate\n"
|
||||
." -o: result is written on channel (visible by all)",
|
||||
$languages." ".$languages);
|
||||
|
||||
# translate text with babelfish (altavista)
|
||||
sub babelfish
|
||||
{
|
||||
my $timeout = weechat::get_plugin_config("timeout");
|
||||
$timeout = $default_timeout if ($timeout eq "");
|
||||
|
||||
if (`wget -q --timeout=$timeout --user-agent "Mozilla" --output-document=- "http://babelfish.altavista.com/babelfish/tr?lp=$_[0]_$_[1]&urltext=$_[2]"` =~ /.*<td bgcolor=white class=s><div style=padding:10px;>(.*)<\/div><\/td>/)
|
||||
{
|
||||
return $1;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
# translate output
|
||||
sub translate_output
|
||||
{
|
||||
if ($_[1] == 1)
|
||||
{
|
||||
if (substr($_[0],0,1) eq "/")
|
||||
{
|
||||
weechat::command("/".$_[0], "", "");
|
||||
}
|
||||
else
|
||||
{
|
||||
weechat::command($_[0], "", "");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
my $output_infobar = weechat::get_plugin_config("output_infobar");
|
||||
$output_infobar = $default_output_infobar if ($output_infobar eq "");
|
||||
if ($output_infobar eq "on")
|
||||
{
|
||||
weechat::print_infobar(5, $_[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
weechat::print($_[0], "", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# /translate command
|
||||
sub translate
|
||||
{
|
||||
my $server = shift;
|
||||
my $args = shift;
|
||||
|
||||
if ($args =~ /([a-zA-Z][a-zA-Z]) ([a-zA-Z][a-zA-Z]) (.*)/)
|
||||
{
|
||||
my $lang1 = $1;
|
||||
my $lang2 = $2;
|
||||
my $text = $3;
|
||||
|
||||
# output on channel?
|
||||
my $output_chan = 0;
|
||||
if ($text =~ /(.*) -[oO]$/)
|
||||
{
|
||||
$output_chan = 1;
|
||||
$text = $1;
|
||||
}
|
||||
|
||||
my $result = babelfish($lang1, $lang2, $text);
|
||||
if ($result eq "")
|
||||
{
|
||||
translate_output("Error: unable to translate (bad language or timeout)", 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
translate_output($result, $output_chan);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
translate_output("Error: bad arguments", 0);
|
||||
}
|
||||
|
||||
return weechat::PLUGIN_RC_OK;
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
#####################################################################
|
||||
# xmms perl script for weechat #
|
||||
# #
|
||||
# Displays some useless xmms-infopipe values #
|
||||
# (c) 2006 by Cédric Chalier <llinkz@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 Street, Fifth Floor, Boston, #
|
||||
# MA 02110-1301, USA. #
|
||||
# #
|
||||
#####################################################################
|
||||
# db[x] variables are: #
|
||||
# ----------------------------------------------------------- #
|
||||
# | 0 | XMMS protocol version | 7 | uSecTime #
|
||||
# | 1 | InfoPipe Plugin version | 8 | Time #
|
||||
# | 2 | Status | 9 | Current bitrate #
|
||||
# | 3 | Tunes in playlist | 10 | Samping Frequency #
|
||||
# | 4 | Currently playing | 11 | Channels #
|
||||
# | 5 | uSecPosition | 12 | Title #
|
||||
# | 6 | Position | 13 | File #
|
||||
# #
|
||||
#####################################################################
|
||||
|
||||
weechat::register ("xmms", "1.1", "", "xmms info script (usage: /xmms)");
|
||||
weechat::add_command_handler ("xmms", xmmsinfo);
|
||||
|
||||
sub xmmsinfo {
|
||||
if (! -e "/tmp/xmms-info")
|
||||
{}
|
||||
else
|
||||
{
|
||||
open (fi, "/tmp/xmms-info");
|
||||
@db2 = <fi>;
|
||||
foreach $l (0 .. 14)
|
||||
{
|
||||
($c,$tmp) = split(": " ,$db2[$l]);
|
||||
chomp($tmp);
|
||||
push @db,$tmp;
|
||||
}
|
||||
}
|
||||
if (($db[7]!=-1) && ($db[7]!=0))
|
||||
{
|
||||
weechat::command("/me np: $db[12]");
|
||||
}
|
||||
else
|
||||
{
|
||||
weechat::command("/me np: $db[12] ($db[13])");
|
||||
}
|
||||
@db = ();
|
||||
@db2 = ();
|
||||
close (fi);
|
||||
}
|
||||
# $id: xmms-weechat.pl,v 1.1 2006/05/23 00:50:10 linkz Exp $
|
||||
@@ -0,0 +1,80 @@
|
||||
# --------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 2006 by Jean-Marie Favreau <jm@jmtrivial.info>
|
||||
#
|
||||
# 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
|
||||
#
|
||||
# --------------------------------------------------------------------
|
||||
# This script automatically op and voice some nicks
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
|
||||
import weechat
|
||||
import re
|
||||
|
||||
|
||||
# regexp list for /op
|
||||
U_OP = { "server": { "#chan" : [ "nick1@domain.com", "nick2.*@.*"] } }
|
||||
|
||||
# chan list where all nicks are /voice
|
||||
C_VOICE = { "server": [ "#chan1", "#chan2" ] }
|
||||
|
||||
|
||||
def auto_op(server, args):
|
||||
'''Handle connect'''
|
||||
result = weechat.PLUGIN_RC_OK
|
||||
# first, watch if need /op
|
||||
if U_OP.has_key(server):
|
||||
chans = U_OP[server]
|
||||
try:
|
||||
# find nick and channel
|
||||
nothing, user, channel = args.split(":")
|
||||
nick, next = user.split("!")
|
||||
except ValueError:
|
||||
result = weechat.PLUGIN_RC_KO
|
||||
else:
|
||||
if chans.has_key(channel):
|
||||
users = chans[channel]
|
||||
for userExpr in users:
|
||||
if re.search("^n=" + userExpr, next):
|
||||
weechat.command("/op "+nick, channel, server) # op nick
|
||||
weechat.prnt("[op] "+nick+" on "+channel+"("+server+")") # print
|
||||
return result # exit
|
||||
|
||||
|
||||
# then watch if need /voice
|
||||
if C_VOICE.has_key(server):
|
||||
chans = C_VOICE[server]
|
||||
try:
|
||||
# find nick and channel
|
||||
nothing, user, channel = args.split(":")
|
||||
nick, next = user.split("!")
|
||||
except ValueError:
|
||||
result = weechat.PLUGIN_RC_KO
|
||||
else:
|
||||
if channel in chans:
|
||||
weechat.command("/voice "+nick, channel, server) # voice nick
|
||||
weechat.prnt("[voice] "+nick+" on "+channel+"("+server+")") # print info
|
||||
return result # exit
|
||||
|
||||
# otherwise: nothing to do
|
||||
return result
|
||||
|
||||
|
||||
# register and add function to weechat
|
||||
weechat.register("auto_op", "0.2", "", "auto op plug-in for weechat")
|
||||
weechat.add_message_handler ("join", "auto_op")
|
||||
|
||||
|
||||
@@ -0,0 +1,245 @@
|
||||
# -*- coding: iso-8859-1 -*-
|
||||
|
||||
# =============================================================================
|
||||
# autoauth.py (c) October 2005 by kolter <kolter+dev@openics.org>
|
||||
# Python script for WeeChat.
|
||||
#
|
||||
# Licence : GPL v2
|
||||
# Description : Permits to auto-authenticate when changing nick
|
||||
# Syntax : try /auth help to get help on this script
|
||||
#
|
||||
#
|
||||
# ### changelog ###
|
||||
#
|
||||
# * version 0.5
|
||||
# - fix bug when script script is run for first time
|
||||
# - rewrite half script to improve access to settings
|
||||
# - add a feature to permit to run command(s) when identified
|
||||
# - add completion for commands
|
||||
# * version 0.4
|
||||
# - use set_plugin_config and get_plugin_config to read ans save settings
|
||||
# - remove deprecated import
|
||||
# * version 0.3
|
||||
# - add return codes
|
||||
# * version 0.2
|
||||
# - correct weechatdir with weechat_dir while using weechat.get_info
|
||||
# * version 0.1 :
|
||||
# - first release
|
||||
#
|
||||
# =============================================================================
|
||||
|
||||
|
||||
VERSION="0.5"
|
||||
NAME="autoauth"
|
||||
|
||||
import weechat
|
||||
|
||||
weechat.register (NAME, VERSION, "", "Auto authentification while changing nick")
|
||||
weechat.add_message_handler("NOTICE", "auth_notice_check")
|
||||
weechat.add_command_handler(
|
||||
"auth",
|
||||
"auth_command",
|
||||
"Auto authentification while changing nick",
|
||||
"{ add $nick $pass [$server=current] | del $nick [$server=current] | list | cmd [$command [$server=current]] }",
|
||||
" add : add authorization for $nick with password $pass for $server\n"
|
||||
" del : del authorization for $nick for $server\n"
|
||||
" list : list all authorization settings\n"
|
||||
" cmd : command(s) (separated by '|') to run when identified for $server\n"
|
||||
" %n will be replaced by current nick in each command",
|
||||
"add|del|list|cmd %- %S %S"
|
||||
)
|
||||
|
||||
def auth_cmdlist():
|
||||
cmd = ''
|
||||
cmds = weechat.get_plugin_config("commands")
|
||||
if cmds == '':
|
||||
weechat.prnt("[%s] commands (empty)" % (NAME))
|
||||
else:
|
||||
weechat.prnt("[%s] commands (list)" % (NAME))
|
||||
for c in cmds.split("####"):
|
||||
weechat.prnt(" --> %s : '%s' " % (c.split(":::")[0], c.split(":::")[1]))
|
||||
|
||||
def auth_cmdget(server):
|
||||
cmd = ''
|
||||
cmds = weechat.get_plugin_config("commands")
|
||||
if cmds != '':
|
||||
for c in cmds.split("####"):
|
||||
if c.find(":::") != -1:
|
||||
if c.split(":::")[0] == server:
|
||||
cmd = ":::".join(c.split(":::")[1:])
|
||||
break
|
||||
return cmd
|
||||
|
||||
def auth_cmdset(server, command):
|
||||
cmds = weechat.get_plugin_config("commands")
|
||||
|
||||
found = False
|
||||
conf = []
|
||||
if cmds != '':
|
||||
for c in cmds.split("####"):
|
||||
if c.find(":::") != -1:
|
||||
if c.split(":::")[0] == server:
|
||||
found = True
|
||||
conf.append("%s:::%s" % (server, command))
|
||||
else:
|
||||
conf.append(c)
|
||||
if not found:
|
||||
conf.append("%s:::%s" % (server, command))
|
||||
|
||||
weechat.set_plugin_config("commands", "####".join(conf))
|
||||
weechat.prnt("[%s] command '%s' successfully added for server %s" % (NAME, command, server))
|
||||
|
||||
def auth_cmdunset(server):
|
||||
cmds = weechat.get_plugin_config("commands")
|
||||
|
||||
found = False
|
||||
conf = []
|
||||
if cmds != '':
|
||||
for c in cmds.split("####"):
|
||||
if c.find(":::") != -1:
|
||||
if c.split(":::")[0] != server:
|
||||
conf.append(c)
|
||||
else:
|
||||
found = True
|
||||
if found:
|
||||
weechat.prnt("[%s] command for server '%s' successfully removed" % (NAME, server))
|
||||
weechat.set_plugin_config("commands", "####".join(conf))
|
||||
|
||||
def auth_cmd(args, server):
|
||||
if server == '':
|
||||
if args == '':
|
||||
auth_cmdlist()
|
||||
else:
|
||||
weechat.prnt("[%s] error while setting command, can't find a server" % (NAME))
|
||||
else:
|
||||
if args == '':
|
||||
auth_cmdunset(server)
|
||||
else:
|
||||
auth_cmdset(server, args)
|
||||
|
||||
def auth_list():
|
||||
data = weechat.get_plugin_config("data")
|
||||
|
||||
if data == "":
|
||||
weechat.prnt("[%s] accounts (empty)" % (NAME))
|
||||
else:
|
||||
weechat.prnt("[%s] accounts (list)" % (NAME))
|
||||
for e in data.split(","):
|
||||
if e.find("=") == -1:
|
||||
continue
|
||||
(serv_nick, passwd) = e.split("=")
|
||||
(server, nick) = serv_nick.split(".")
|
||||
weechat.prnt(" --> %s@%s " % (nick, server))
|
||||
|
||||
def auth_notice_check(server, args):
|
||||
if args.find("If this is your nickname, type /msg NickServ") != -1 or args.find("This nickname is registered and protected.") != -1 :
|
||||
passwd = auth_get(weechat.get_info("nick"), server)
|
||||
if passwd != None:
|
||||
weechat.command("/quote nickserv identify %s" % (passwd), "", server)
|
||||
commands = auth_cmdget(server)
|
||||
if commands != '':
|
||||
for c in commands.split("|"):
|
||||
weechat.command(c.strip().replace("%n", weechat.get_info('nick')))
|
||||
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
def auth_del(the_nick, the_server):
|
||||
data = weechat.get_plugin_config("data")
|
||||
|
||||
found = False
|
||||
conf = []
|
||||
for e in data.split(","):
|
||||
if e.find("=") == -1:
|
||||
continue
|
||||
(serv_nick, passwd) = e.split("=")
|
||||
(server, nick) = serv_nick.split(".")
|
||||
if the_nick == nick and the_server == server:
|
||||
found = True
|
||||
else:
|
||||
conf.append("%s.%s=%s" % (server, nick, passwd))
|
||||
|
||||
if found:
|
||||
weechat.set_plugin_config("data", ",".join(conf))
|
||||
weechat.prnt("[%s] nick '%s@%s' successfully remove" % (NAME, the_nick, the_server))
|
||||
else:
|
||||
weechat.prnt("[%s] an error occured while removing nick '%s@%s' (not found)" % (NAME, the_nick, the_server))
|
||||
|
||||
def auth_add(the_nick, the_passwd, the_server):
|
||||
data = weechat.get_plugin_config("data")
|
||||
|
||||
found = False
|
||||
conf = []
|
||||
for e in data.split(","):
|
||||
if e.find("=") == -1:
|
||||
continue
|
||||
(serv_nick, passwd) = e.split("=")
|
||||
(server, nick) = serv_nick.split(".")
|
||||
if the_nick == nick and the_server == server:
|
||||
passwd = the_passwd
|
||||
found = True
|
||||
conf.append("%s.%s=%s" % (server, nick, passwd))
|
||||
|
||||
if not found:
|
||||
conf.append("%s.%s=%s" % (the_server, the_nick, the_passwd))
|
||||
|
||||
weechat.set_plugin_config("data", ",".join(conf))
|
||||
weechat.prnt("[%s] nick '%s@%s' successfully added" % (NAME, the_nick, the_server))
|
||||
|
||||
def auth_get(the_nick, the_server):
|
||||
data = weechat.get_plugin_config("data")
|
||||
|
||||
for e in data.split(","):
|
||||
if e.find("=") == -1:
|
||||
continue
|
||||
(serv_nick, passwd) = e.split("=")
|
||||
(server, nick) = serv_nick.split(".")
|
||||
if the_nick == nick and the_server == server:
|
||||
return passwd
|
||||
return None
|
||||
|
||||
def auth_command(server, args):
|
||||
list_args = args.split(" ")
|
||||
|
||||
#strip spaces
|
||||
while '' in list_args:
|
||||
list_args.remove('')
|
||||
while ' ' in list_args:
|
||||
list_args.remove(' ')
|
||||
|
||||
if len(list_args) == 0:
|
||||
weechat.command("/help auth")
|
||||
elif list_args[0] not in ["add", "del", "list", "cmd"]:
|
||||
weechat.prnt("[%s] bad option while using /auth command, try '/help auth' for more info" % (NAME))
|
||||
elif list_args[0] == "cmd":
|
||||
if len(list_args[1:]) == 1 and list_args[1] in weechat.get_server_info().keys():
|
||||
auth_cmd("", list_args[1])
|
||||
elif len(list_args[1:]) == 1:
|
||||
auth_cmd(list_args[1], weechat.get_info('server'))
|
||||
elif len(list_args[1:]) >= 2:
|
||||
if list_args[-1] in weechat.get_server_info().keys():
|
||||
auth_cmd(" ".join(list_args[1:-1]), list_args[-1])
|
||||
else:
|
||||
auth_cmd(" ".join(list_args[1:]), weechat.get_info('server'))
|
||||
else:
|
||||
auth_cmd(" ".join(list_args[1:]), weechat.get_info(server))
|
||||
elif list_args[0] == "list":
|
||||
auth_list()
|
||||
elif list_args[0] == "add":
|
||||
if len(list_args) < 3 or (len(list_args) == 3 and weechat.get_info("server") == ''):
|
||||
weechat.prnt("[%s] bad option while using /auth command, try '/help auth' for more info" % (NAME))
|
||||
else:
|
||||
if len(list_args) == 3:
|
||||
auth_add(list_args[1], list_args[2], weechat.get_info("server"))
|
||||
else:
|
||||
auth_add(list_args[1], list_args[2], list_args[3])
|
||||
elif list_args[0] == "del":
|
||||
if len(list_args) < 2:
|
||||
weechat.prnt("[%s] bad option while using /auth command, try '/help auth' for more info" % (NAME))
|
||||
else:
|
||||
if len(list_args) == 2:
|
||||
auth_del(list_args[1], weechat.get_info("server"))
|
||||
else:
|
||||
auth_del(list_args[1], list_args[2])
|
||||
else:
|
||||
pass
|
||||
return weechat.PLUGIN_RC_OK
|
||||
@@ -0,0 +1,153 @@
|
||||
# --------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 2006 by Gwenn Gueguen <weechat@grumly.info>
|
||||
#
|
||||
# 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
|
||||
#
|
||||
# --------------------------------------------------------------------
|
||||
# This script automatically sets away after a period of inactivity
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
|
||||
import weechat
|
||||
|
||||
|
||||
"""
|
||||
/autoaway [time [message]]
|
||||
|
||||
/autoaway whithout any parameter disables autoaway
|
||||
|
||||
Script config:
|
||||
time:
|
||||
number of minutes of inactivity after which a user will be marked as away
|
||||
message:
|
||||
message that will be passed to the /away command
|
||||
enabled:
|
||||
is autoaway enabled ?
|
||||
"""
|
||||
|
||||
|
||||
SCRIPT_NAME="autoaway"
|
||||
SCRIPT_VERSION="0.2"
|
||||
SCRIPT_DESC="autoaway script for weechat"
|
||||
|
||||
|
||||
# Names of the settings
|
||||
CONFIG_TIME="time"
|
||||
CONFIG_MESSAGE="message"
|
||||
CONFIG_ENABLED="enabled"
|
||||
|
||||
# Name of the command
|
||||
CMD_AUTOAWAY="autoaway"
|
||||
|
||||
# Default settings
|
||||
DEFAULT_TIME="15"
|
||||
DEFAULT_MESSAGE="idle"
|
||||
|
||||
# Interval (in seconds) between checks
|
||||
TIMER_VALUE=15
|
||||
|
||||
|
||||
def print_settings():
|
||||
weechat.prnt("AutoAway settings:")
|
||||
weechat.prnt(" time: %s minute(s)" % weechat.get_plugin_config(CONFIG_TIME))
|
||||
weechat.prnt(" message: %s" % weechat.get_plugin_config(CONFIG_MESSAGE))
|
||||
if weechat.get_plugin_config(CONFIG_ENABLED) == "true":
|
||||
weechat.prnt(" enabled")
|
||||
else:
|
||||
weechat.prnt(" disabled")
|
||||
|
||||
|
||||
def autoaway(server, args):
|
||||
weechat.remove_timer_handler("timer_handler")
|
||||
|
||||
params = args.split(None, 1)
|
||||
if len(params) == 0:
|
||||
weechat.set_plugin_config(CONFIG_ENABLED, "false")
|
||||
else:
|
||||
weechat.set_plugin_config(CONFIG_ENABLED, "true")
|
||||
weechat.set_plugin_config(CONFIG_TIME, params[0])
|
||||
if len(params) > 1:
|
||||
weechat.set_plugin_config(CONFIG_MESSAGE, params[1])
|
||||
|
||||
previous_inactivity = int(weechat.get_info("inactivity"))
|
||||
weechat.add_timer_handler(TIMER_VALUE, "timer_handler")
|
||||
|
||||
print_settings()
|
||||
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
|
||||
def timer_handler():
|
||||
global previous_inactivity, previous_state
|
||||
|
||||
# Get current away status
|
||||
away_flag = int(weechat.get_info("away"))
|
||||
|
||||
# Get number of seconds of inactivity
|
||||
idle_time = int(weechat.get_info("inactivity"))
|
||||
|
||||
if away_flag == previous_state:
|
||||
# away flag was not changed outside this script
|
||||
if away_flag and idle_time < previous_inactivity:
|
||||
# Inactivity was reset (or overflowed ?)
|
||||
weechat.command("/away -all")
|
||||
elif not away_flag and idle_time >= (60 * int(weechat.get_plugin_config(CONFIG_TIME))):
|
||||
# Time to go away
|
||||
weechat.command("/away -all %s" % weechat.get_plugin_config(CONFIG_MESSAGE))
|
||||
|
||||
previous_state = int(weechat.get_info("away"))
|
||||
previous_inactivity = idle_time
|
||||
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
|
||||
if weechat.register(SCRIPT_NAME, SCRIPT_VERSION, "", SCRIPT_DESC):
|
||||
|
||||
try:
|
||||
previous_state = int(weechat.get_info("away"))
|
||||
except ValueError:
|
||||
previous_state = 0
|
||||
|
||||
# Set config to default values if undefined
|
||||
try:
|
||||
idle_time = int(weechat.get_plugin_config(CONFIG_TIME))
|
||||
except ValueError:
|
||||
weechat.set_plugin_config(CONFIG_TIME, DEFAULT_TIME)
|
||||
|
||||
if weechat.get_plugin_config(CONFIG_MESSAGE) == None:
|
||||
weechat.set_plugin_config(CONFIG_MESSAGE, DEFAULT_MESSAGE)
|
||||
|
||||
if weechat.get_plugin_config(CONFIG_ENABLED) == None:
|
||||
weechat.set_plugin_config(CONFIG_ENABLED, "false")
|
||||
|
||||
|
||||
# Display a summary of the settings
|
||||
print_settings()
|
||||
|
||||
|
||||
# Start the timer if necessary
|
||||
if weechat.get_plugin_config(CONFIG_ENABLED) == "true":
|
||||
previous_inactivity = int(weechat.get_info("inactivity"))
|
||||
weechat.add_timer_handler(TIMER_VALUE, "timer_handler")
|
||||
|
||||
|
||||
weechat.add_command_handler(CMD_AUTOAWAY, "autoaway", "Set autoaway",
|
||||
"[time [message]]",
|
||||
"time: number of minutes before being marked as away\n"
|
||||
+ "message: away message\n"
|
||||
+ "\n"
|
||||
+ "whithout any argument, autoaway will be disabled\n")
|
||||
|
||||
@@ -0,0 +1,429 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
Catapult by Stalwart <stlwrt@gmail.com>
|
||||
Licensed under GNU GPL 2
|
||||
"""
|
||||
|
||||
import weechat
|
||||
import random
|
||||
|
||||
weechat.register("Catapult", "0.1", "", "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")
|
||||
|
||||
# slapper
|
||||
def slapper(server, args):
|
||||
objects = [
|
||||
"a rather large squid",
|
||||
"a hydraulic pump",
|
||||
"a book by Stephen King",
|
||||
"a 10mbit network card",
|
||||
"a ladies handbag",
|
||||
"some girl scouts",
|
||||
"a football team",
|
||||
"a bottle",
|
||||
"a yellow marshmellow",
|
||||
"a match",
|
||||
"the queen of England",
|
||||
"a taxi",
|
||||
"100 feet of wire",
|
||||
"a bag of Cheerios",
|
||||
"a hat",
|
||||
"a fist",
|
||||
"the back hand",
|
||||
"with the forehead",
|
||||
"a computer moniter",
|
||||
"a coconut",
|
||||
"a microfone",
|
||||
"a cellphone",
|
||||
"a snowplough",
|
||||
"a doggy",
|
||||
"Bill Clinton",
|
||||
"a stone",
|
||||
"a club. With a nail in it",
|
||||
"a small asteroid, rich in iron",
|
||||
"a small interstellar spaceship",
|
||||
"a fresh zuccini",
|
||||
"a laptop",
|
||||
"a big dictionary",
|
||||
"a baseball bat",
|
||||
"NeverNet",
|
||||
"some porn",
|
||||
"a mIRC script",
|
||||
"a canoe",
|
||||
"a tortoise",
|
||||
"a horse",
|
||||
"the book of Kells",
|
||||
"a whale",
|
||||
"a rubber dildo",
|
||||
"a well groomed poodle",
|
||||
"a channel operator",
|
||||
"a news paper (New York Times Sunday Edition)",
|
||||
"a gnarly werewolf",
|
||||
"a vampire. They really suck",
|
||||
"a perl script",
|
||||
"a bag of doggie chow",
|
||||
"a fat walrus",
|
||||
"an IP adress",
|
||||
"a catholic priest",
|
||||
"James Dean",
|
||||
"Ronald MacDonald (he *IS* good for something)",
|
||||
"Autoconf version 2.13",
|
||||
"a PRIVMSG",
|
||||
"an email adress",
|
||||
"some ANSI color codes",
|
||||
"a thermonuclear weapon. Yehaw",
|
||||
"the hitch hikers guide to the galaxy, revised edition",
|
||||
"Nessie, the Loch Ness monster",
|
||||
"a tuna. Still in the can! *BONK* That will leave a mark",
|
||||
"a few fluffy pillows",
|
||||
"a red chinese dragon",
|
||||
"a linux-manual (signed by L. Torvalds)",
|
||||
"Stage1",
|
||||
"Bill Gates underpants",
|
||||
"GM Abraham and the whole OW-Staff",
|
||||
"Sphere 1.0",
|
||||
"a Linuxkernel",
|
||||
"Lenin's Collected Works",
|
||||
"Stalin's Collected Works",
|
||||
"a iron Tux",
|
||||
"a glowing 23",
|
||||
"your mum (CLEAN YOUR ROOM!)",
|
||||
"a complete GNOME-Documentation",
|
||||
"a Portagetree",
|
||||
"thand[Z]'s transparent Tanga",
|
||||
"a Kernelpanic",
|
||||
"Windoze XP",
|
||||
"an AK-47 (die, you imperialist dog!)",
|
||||
"a bag full with Michael Jacksons droped noses",
|
||||
"an NBP-Manifesto (Hail Limonew! Hail our Leader! Hail!)",
|
||||
"an NBP-Flag (Lead us to freedom, Leader Limonew!)",
|
||||
"Mein Kampf (Doppelausgabe, Hardcover)",
|
||||
"Invader Zim's iron fist",
|
||||
"some ASCII-Arts",
|
||||
"The Family Learning Channel",
|
||||
"GOD",
|
||||
"Dorian Grey's picture",
|
||||
"some unlocked Grenades *BOOM*",
|
||||
"the Win2k Buglist",
|
||||
"a widescreen TV (it can damage your brain!)",
|
||||
"a chain saw",
|
||||
"a huge tree"
|
||||
]
|
||||
if args <> "":
|
||||
weechat.command("/me slaps %s with %s." % (args, random.choice(objects)))
|
||||
return weechat.PLUGIN_RC_OK
|
||||
else:
|
||||
weechat.prnt("You must specify target")
|
||||
return weechat.PLUGIN_RC_KO
|
||||
|
||||
# fortune cookies
|
||||
def fortune(server, args):
|
||||
objects = [
|
||||
"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!",
|
||||
"Think big. Pollute the Mississippi.",
|
||||
"An optimist is a man who looks forward to marriage. A pessimist is a married optimist.",
|
||||
"There are never any bugs you haven't found yet.",
|
||||
"It don't mean a THING if you ain't got that SWING!!",
|
||||
"Atomic batteries to power, turbines to speed. -- Robin, The Boy Wonder",
|
||||
"Two wrongs don't make a right, but three lefts do.",
|
||||
"A log may float in a river, but that does not make it a crocodile.",
|
||||
"Art is Nature speeded up and God slowed down. -- Chazal",
|
||||
"Texas law forbids anyone to have a pair of pliers in his possession.",
|
||||
"UFOs are for real: the Air Force doesn't exist.",
|
||||
"Expansion means complexity; and complexity decay.",
|
||||
"I came, I saw, I deleted all your files.",
|
||||
"The Magic of Windows: Turns a 486 back into a PC/XT.",
|
||||
"Our vision is to speed up time, eventually eliminating it. -- Alex Schure",
|
||||
"Breaking Windows isn't just for kids anymore...",
|
||||
"Neckties strangle clear thinking. -- Lin Yutang",
|
||||
"I'm prepared for all emergencies but totally unprepared for everyday life.",
|
||||
"Yow! I just went below the poverty line!",
|
||||
"Break into jail and claim police brutality.",
|
||||
"BOFH Excuse #290: The CPU has shifted, and become decentralized.",
|
||||
"Did you hear about the model who sat on a broken bottle and cut a nice figure?",
|
||||
"We have a equal opportunity Calculus class -- it's fully integrated.",
|
||||
"BOFH Excuse #170: popper unable to process jumbo kernel",
|
||||
"It's later than you think.",
|
||||
"My Aunt MAUREEN was a military advisor to IKE & TINA TURNER!!",
|
||||
"Everyone hates me because I'm paranoid.",
|
||||
"When you are in it up to your ears, keep your mouth shut.",
|
||||
"Theory is gray, but the golden tree of life is green. -- Goethe",
|
||||
"Most Texans think Hanukkah is some sort of duck call. -- Richard Lewis",
|
||||
"grasshopotomaus: A creature that can leap to tremendous heights... once.",
|
||||
"It takes both a weapon, and two people, to commit a murder.",
|
||||
"Facts are the enemy of truth. -- Don Quixote",
|
||||
"Forty two.",
|
||||
"BOFH Excuse #424: operation failed because: there is no message for this error (#1014)",
|
||||
"Never leave anything to chance; make sure all your crimes are premeditated.",
|
||||
"BOFH Excuse #60: system has been recalled",
|
||||
"Science and religion are in full accord but science and faith are in complete discord.",
|
||||
"A likely impossibility is always preferable to an unconvincing possibility. -- Aristotle",
|
||||
"The angry man always thinks he can do more than he can. -- Albertano of Brescia",
|
||||
"Hello again, Peabody here... -- Mister Peabody",
|
||||
"Nobody ever died from oven crude poisoning.",
|
||||
"Dogs crawl under fences... software crawls under Windows 95.",
|
||||
"Say something you'll be sorry for, I love receiving apologies.",
|
||||
"NOTICE: -- THE ELEVATORS WILL BE OUT OF ORDER TODAY -- (The nearest working elevator is in the building across the street.)",
|
||||
"THERE ARE PLENTY OF BUSINESSES LIKE SHOW BUSINESS -- Bart Simpson on chalkboard in episode 1F19",
|
||||
"Life is what happens to you while you're busy making other plans. -- John Lennon, Beautiful Boy",
|
||||
"While having never invented a sin, I'm trying to perfect several.",
|
||||
"Emacs, n.: A slow-moving parody of a text editor.",
|
||||
" ... with liberty and justice for all ... who can afford it.",
|
||||
"Princess Leia: Aren't you a little short for a stormtrooper?",
|
||||
"The Official Colorado State Vegetable is now the 'state legislator'",
|
||||
"Abandon the search for Truth; settle for a good fantasy.",
|
||||
"There's nothing to writing. All you do is sit at a typewriter and open a vein. -- Red Smith",
|
||||
"Our OS who art in CPU, UNIX be thy name. Thy programs run, thy syscalls done, In kernel as it is in user!",
|
||||
"All hope abandon, ye who enter here! -- Dante Alighieri",
|
||||
"The human mind ordinarily operates at only ten percent of its capacity -- the rest is overhead for the operating system.",
|
||||
"Professor: 'If a dog craps anywhere in the universe, you can bet I won't be out of loop.'",
|
||||
"I WILL NOT MAKE FLATUENT NOISES IN CLASS -- Bart Simpson on chalkboard in episode 7F13",
|
||||
"Listen you donkey raping shit eater.",
|
||||
"In specifications, Murphy's Law supersedes Ohm's.",
|
||||
"One of Bender's kids: Our dad is a giant toy!",
|
||||
"I am a jelly donut. I am a jelly donut.",
|
||||
"We are all in the gutter, but some of us are looking at the stars. -- Oscar Wilde",
|
||||
"Bender to Zoidberg: 'You're looking less nuts, crabby.'",
|
||||
"Things will be bright in P.M. A cop will shine a light in your face.",
|
||||
"A journey of a thousand miles begins with a cash advance.",
|
||||
"Everything that can be invented has been invented. -- Charles Duell, Director of U.S. Patent Office, 1899",
|
||||
"Vote anarchist.",
|
||||
"paranoia, n.: A healthy understanding of the way the universe works.",
|
||||
"BOFH Excuse #401: Sales staff sold a product we don't offer.",
|
||||
"BOFH Excuse #200: The monitor needs another box of pixels.",
|
||||
"The important thing is not to stop questioning.",
|
||||
"Not all men who drink are poets. Some of us drink because we aren't poets.",
|
||||
"Oh my god, dude!",
|
||||
"BOFH Excuse #441: Hash table has woodworm",
|
||||
"BOFH Excuse #112: The monitor is plugged into the serial port",
|
||||
"There's so much to say but your eyes keep interrupting me.",
|
||||
"For the next hour, WE will control all that you see and hear.",
|
||||
"Reality continues to ruin my life. -- Calvin",
|
||||
"The shortest distance between two points is under construction. -- Noelie Alito",
|
||||
"BOFH Excuse #192: runaway cat on system.",
|
||||
"My haircut is totally traditional!",
|
||||
"You! What PLANET is this! -- McCoy, 'The City on the Edge of Forever', stardate 3134.0",
|
||||
"BOFH Excuse #433: error: one bad user found in front of screen",
|
||||
"Dyslexics have more fnu.",
|
||||
"I'm not stupid, I'm not expendable, and I'M NOT GOING!",
|
||||
"It's clever, but is it art?",
|
||||
"His life was formal; his actions seemed ruled with a ruler.",
|
||||
"Yeah. Except for being entirely different, they're pretty much the same.",
|
||||
"Oh, I get it!! 'The BEACH goes on', huh, SONNY??",
|
||||
"Ban the bomb. Save the world for conventional warfare.",
|
||||
"Everything that you know is wrong, but you can be straightened out.",
|
||||
"If I pull this SWITCH I'll be RITA HAYWORTH!! Or a SCIENTOLOGIST!",
|
||||
"Tex SEX! The HOME of WHEELS! The dripping of COFFEE!! Take me to Minnesota but don't EMBARRASS me!!",
|
||||
"clovek, ktory si ako prvy kupil fax musel byt strasny kokot.",
|
||||
"Are you a turtle?",
|
||||
"You will be the last person to buy a Chrysler.",
|
||||
"If in doubt, mumble.",
|
||||
"Nice guys don't finish nice.",
|
||||
"You cannot use your friends and have them too.",
|
||||
"Microsoft is to Software as McDonalds is to Cuisine.",
|
||||
"panic: can't find /",
|
||||
"I used to be an agnostic, but now I'm not so sure.",
|
||||
"May your SO always know when you need a hug.",
|
||||
"We are MicroSoft. You will be assimilated. Resistance is futile. (Attributed to B.G., Gill Bates)",
|
||||
"Life is a whim of several billion cells to be you for a while.",
|
||||
"BOFH Excuse #347: The rubber band broke",
|
||||
"Death has been proven to be 99% fatal in laboratory rats.",
|
||||
"There are only two kinds of tequila. Good and better.",
|
||||
"C for yourself.",
|
||||
"Tact, n.: The unsaid part of what you're thinking.",
|
||||
"Shit Happens."
|
||||
]
|
||||
weechat.command(("Wanda the Fish says: %s") % random.choice(objects))
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
# winjoke
|
||||
def winjoke(server, args):
|
||||
objects = [
|
||||
"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.",
|
||||
"Why use Windows, since there is a door?",
|
||||
"In a world without fences who needs Gates?",
|
||||
"Another name for a Windows tutorial is crash course!",
|
||||
"Failure is not an option -- it comes bundled with Windows.",
|
||||
"NT... the last two letters of bowel movement",
|
||||
"Some software money can't buy. For everything else there's Micros~1.",
|
||||
"Sticks and Stones may break my bones but FUD will never concern me.",
|
||||
"Every program expands until it can send mail. ...Except Exchange. ",
|
||||
"Microsoft: 'You've got questions. We've got dancing paperclips.'",
|
||||
".vbs = Virus Bearing Script?",
|
||||
"Technology is positive when the creators put the interests of their users before their bottom line.",
|
||||
"Have you ever noticed that at trade shows Microsoft is always the one giving away stress balls?",
|
||||
"Do you remember when you only had to pay for windows when *you* broke them? (Submitted by Noel Maddy)",
|
||||
"National Weather Service advice for those threatened by severe thunderstorms: 'Go inside a sturdy building and stay away from WINDOWS!' (Submitted by Ben Bullock)",
|
||||
"Microsoft is to Software as McDonalds is to Cuisine.",
|
||||
"Microsoft should switch to the vacuum cleaner business where people actually want products that suck. (Submitted by Bruno Bratti)",
|
||||
"Everyone seems so impatient and angry these days. I think it's because so many people use Windows at work -- do you think you'd be Politeness Man after working on Windows 8 hrs. or more? (Submitted by Chip Atkinson)",
|
||||
"NT 5.0 so vaporous it's in danger of being added to the periodic table as a noble gas. (Spotted in a Slashdot discussion)",
|
||||
"My Beowulf cluster will beat your Windows NT network any day. (Submitted by wbogardt[at]gte.net)",
|
||||
"It's no wonder they call it WinNT; WNT = VMS++; (Submitted by Chris Abbey)",
|
||||
"Double your disk space - delete Windows! (Submitted by Albert Dorofeev)",
|
||||
"The Edsel. New Coke. Windows 2000. All mandatory case studies for bizschool students in 2020. (From a LinuxToday post by Bear Giles)",
|
||||
"I will never trust someone called GATES that sells WINDOWS. (Submitted by Federico Roman)",
|
||||
"'Microsoft technology' -- isn't that an oxymoron?",
|
||||
"MCSE == Mentally Challenged Slave of the Empire.",
|
||||
"Windows NT -- it'll drive you buggy!",
|
||||
"Where do you want to go today? Don't ask Microsoft for directions.",
|
||||
"MS and Y2K: Windows 95, 98, ... and back again to 01",
|
||||
"There's the light at the end of the the Windows.",
|
||||
"People use dummies for crash-tests. Windows is so difficult they had to educate the dummies first -- by giving them 'Windows for Dummies' books!",
|
||||
"Windows: The first user interface where you click Start to turn it off.",
|
||||
"NT == No Thanks",
|
||||
"With Windows Millennium, Microsoft was able to get the boot time down to 25 seconds. That's almost as short as it's uptime.",
|
||||
"Windows 2000: Designed for the Internet. The Internet: Designed for UNIX.",
|
||||
"MCSE = Minesweeper Consultant, Solitaire Expert",
|
||||
"MCSE = Meaningless Certificate, Software Expired",
|
||||
"I'm not a programmer, but I play one at Microsoft.",
|
||||
"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))
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
# linjoke
|
||||
def linjoke(server, args):
|
||||
objects = [
|
||||
"Got Linux?",
|
||||
"Microsoft gives you Windows... Linux gives you the whole house.",
|
||||
"Linux, DOS, Windows NT -- The Good, the Bad, and the Ugly",
|
||||
"Linux: the operating system with a CLUE... Command Line User Environment",
|
||||
"If Bill Gates is the Devil then Linus Torvalds must be the Messiah.",
|
||||
"Linux. Where do you want to go tomorrow?",
|
||||
"Linux: The choice of a GNU generation",
|
||||
"When you say I wrote a program that crashed Windows, people just stare at you blankly and say Hey, I got those with the system, *for free*. -- Linus Torvalds",
|
||||
"We all know Linux is great...it does infinite loops in 5 seconds. -- Linus Torvalds",
|
||||
"Some people have told me they dont think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. Theyd be a lot more careful about what they say if they had. -- Linus Torvalds",
|
||||
"Veni, vidi, Linux!",
|
||||
"Type cat vmlinuz > /dev/audio to hear the Voice of God.",
|
||||
"Linux: Because a PC is a terrible thing to waste.",
|
||||
"Linux: Because rebooting is for adding new hardware",
|
||||
"We are Linux. Resistance is measured in Ohms.",
|
||||
"Free Software: the Software by the People, of the People and for the People. Develop! Share! Enhance! and Enjoy! (Submitted by Andy Tai)",
|
||||
"Get it up, keep it up... LINUX: Viagra for the PC. (Submitted by Chris Abbey)",
|
||||
"Peace, Love and Compile the kernel.... (Submitted by Justin L. Herreman)",
|
||||
"Free your software, and your ass will follow",
|
||||
"Reset button? Which reset button? - Linux, the OS that never sleeps.",
|
||||
"Linux: Where do you want to GO... Oh, Im already there!",
|
||||
"Windows contains FAT. Use Linux -- you wont ever have to worry about your weight.",
|
||||
"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))
|
||||
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
|
||||
@@ -0,0 +1,156 @@
|
||||
"""
|
||||
:Author: Henning Hasemann <hhasemann [at] web [dot] de>
|
||||
:Updated: Daga <daga [at] daga [dot] dyndns [dot] org>
|
||||
|
||||
:What it does:
|
||||
With this script you can configure weechat
|
||||
to give custom responses to CTCP-Requests.
|
||||
|
||||
:Usage:
|
||||
Load this file somehow.
|
||||
You can configure replies to CTCP-requests
|
||||
with the /set_ctcp - command. (examples below)
|
||||
|
||||
Released under GPL license.
|
||||
|
||||
Hope you enjoy it :-)
|
||||
-- Henning aka asmanian
|
||||
"""
|
||||
|
||||
version = "0.8"
|
||||
history = """
|
||||
0.1 initial
|
||||
0.2
|
||||
- now displays a "CTCP FOOBAR received from ..."
|
||||
0.3
|
||||
- now /help set_ctcp is available
|
||||
0.4
|
||||
- corrected a few typos
|
||||
- made special variables (e.g. version) easier to use
|
||||
0.5
|
||||
- removed debugging messages
|
||||
0.6
|
||||
- bugfix (sometimes /set_ctcp did not work)
|
||||
0.7 (Daga)
|
||||
- added multi-server support
|
||||
0.8
|
||||
- fixed on_msg (occasionally caused a minor fault)
|
||||
"""
|
||||
|
||||
short_syntax = """[REQUEST ANSWER]"""
|
||||
|
||||
syntax = """ Examples:
|
||||
|
||||
/set_ctcp
|
||||
show settings for common CTCP-Requests.
|
||||
where "OFF" means "use weechat default behaviour.
|
||||
|
||||
/set_ctcp VERSION I prefer using weechat $version
|
||||
Reply with a fancy message.
|
||||
$version is substituted with weechats version.
|
||||
Other variables are: $away, $nick and $server.
|
||||
(If you find something else that could make sense
|
||||
here, let me know!)
|
||||
|
||||
/set_ctcp HOW_ARE_YOU Good.
|
||||
Set answer to a rather unusual CTCP-request.
|
||||
|
||||
/set_ctcp VERSION OFF
|
||||
Disable special behavior when CTCP VERSION comes in.
|
||||
atm this leaves an entry in plugins.rc which
|
||||
can be safely removed.
|
||||
"""
|
||||
|
||||
|
||||
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 not wc.get_plugin_config("requests"):
|
||||
wc.set_plugin_config("requests", " ".join(["VERSION", "USERINFO", "FINGER", "TIME", "PING"]))
|
||||
|
||||
def get_answers():
|
||||
# Strangely, get_plugin_config sometimes returns
|
||||
# the integer 0
|
||||
requests = wc.get_plugin_config("requests")
|
||||
if requests:
|
||||
requests = requests.split()
|
||||
else:
|
||||
requests = ["VERSION", "USERINFO", "FINGER", "TIME", "PING"]
|
||||
|
||||
d = {}
|
||||
for r in requests:
|
||||
d[r] = wc.get_plugin_config("CTCP_" + r)
|
||||
return d
|
||||
|
||||
def set_answer(k, v):
|
||||
wc.set_plugin_config("CTCP_" + k, v)
|
||||
requests = wc.get_plugin_config("requests").split()
|
||||
if k.upper() not in requests:
|
||||
requests.append(k.upper())
|
||||
wc.set_plugin_config("requests", " ".join(requests))
|
||||
|
||||
def show_syntax():
|
||||
wc.prnt("usage: /set_ctcp %s" % short_syntax)
|
||||
wc.prnt("(For more information type /help set_ctcp)")
|
||||
|
||||
def on_msg(server, args):
|
||||
nothing, info, message = args.split(":", 2)
|
||||
hostmask = info.split(None, 2)[0]
|
||||
source = hostmask.split("!")[0]
|
||||
|
||||
answers = get_answers()
|
||||
|
||||
try:
|
||||
if message.startswith("\x01") and message.endswith("\x01"):
|
||||
req = message[1:-1]
|
||||
ans = answers[req]
|
||||
if not ans or ans == "OFF":
|
||||
raise ValueError
|
||||
|
||||
info = {
|
||||
"version": wc.get_info("version"),
|
||||
"nick": wc.get_info("nick"),
|
||||
"away": wc.get_info("away") and "away" or "there",
|
||||
"server": server,
|
||||
}
|
||||
|
||||
while True:
|
||||
match = re.search(r'[^\\]\$([a-z]+)\b', ans) #, r'--\1--', ans)
|
||||
if match is None: break
|
||||
else:
|
||||
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))
|
||||
wc.command("/quote NOTICE %s :\x01%s %s\x01" % (
|
||||
source, req, ans), "", server)
|
||||
return wc.PLUGIN_RC_OK_IGNORE_ALL
|
||||
|
||||
except Exception, e:
|
||||
pass
|
||||
|
||||
return wc.PLUGIN_RC_OK
|
||||
|
||||
def set(server, args):
|
||||
try:
|
||||
argv = args.split(None, 1)
|
||||
answers = get_answers()
|
||||
|
||||
if not len(argv):
|
||||
for k, v in answers.items():
|
||||
wc.prnt("%10s: %s" % (k, v or "OFF"))
|
||||
|
||||
elif len(argv) == 2:
|
||||
set_answer(argv[0], argv[1])
|
||||
|
||||
else:
|
||||
show_syntax()
|
||||
except Exception, e:
|
||||
pass
|
||||
|
||||
return wc.PLUGIN_RC_OK
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
# -*- coding: iso-8859-15 -*-
|
||||
|
||||
"""
|
||||
:Author: Henning Hasemann <hhasemann [at] web [dot] de>
|
||||
|
||||
Usage:
|
||||
|
||||
- Load this plugin
|
||||
- In a channel or query type "/flip foo something" to
|
||||
send the reversed text "gnihtemos oof"
|
||||
- In a channel or query type "/leet something else" to
|
||||
send the h4x02-5r!pT - Version of your text.
|
||||
(Please use with caution such crap is discouraged in most channels)
|
||||
|
||||
Released under GPL licence.
|
||||
"""
|
||||
|
||||
__version__ = "0.1"
|
||||
__history__ = """
|
||||
0.1 initial
|
||||
"""
|
||||
|
||||
short_syntax = """TEXT"""
|
||||
syntax_flip = """ Example:
|
||||
|
||||
/flip foo bar
|
||||
sends "rab oof" to the channel
|
||||
"""
|
||||
syntax_leet = """ Example:
|
||||
|
||||
/leet eleet
|
||||
sends "31337" (or similar) to the channel
|
||||
"""
|
||||
|
||||
import weechat as wc
|
||||
import string, random
|
||||
|
||||
wc.register("gimmicks", __version__, "", "string gimmicks")
|
||||
wc.add_command_handler("flip", "flip", "", short_syntax, syntax_flip)
|
||||
wc.add_command_handler("leet", "leet", "", short_syntax, syntax_leet)
|
||||
|
||||
leet_dict = {
|
||||
"e": ["3"],
|
||||
"l": ["1", "!", "|"],
|
||||
"r": ["|2"],
|
||||
"b": ["8"],
|
||||
"v": [r'\/'],
|
||||
"t": ["7"],
|
||||
"i": ["!"],
|
||||
"w": [r'\/\/', 'vv'],
|
||||
"a": ["/\\", "<|", "4"],
|
||||
"k": ["x"],
|
||||
"n": [r'|\|'],
|
||||
"s": ["5","$"],
|
||||
"q": ["O."],
|
||||
"z": ["zZz", "7_"],
|
||||
"u": ["(_)"],
|
||||
"p": ["|°", "|*"],
|
||||
"d": ["|)", "I>", "ol"],
|
||||
"f": ["i="],
|
||||
"g": ["@"],
|
||||
"h": ["|-|"],
|
||||
"j": ["_I"],
|
||||
"y": ["`/"],
|
||||
"x": ["><"],
|
||||
"c": ["[", "(", "{"],
|
||||
"m": ["|v|", "nn"],
|
||||
"o": ["0", "()"],
|
||||
}
|
||||
|
||||
def leet(server, args):
|
||||
casechange = True
|
||||
strange = True
|
||||
stay = False
|
||||
|
||||
r = ""
|
||||
luflag = 0
|
||||
for x in list(args):
|
||||
if stay:
|
||||
alt = [x]
|
||||
else:
|
||||
alt = []
|
||||
if casechange:
|
||||
alt.append(luflag and x.lower() or x.upper())
|
||||
luflag = not luflag
|
||||
if strange:
|
||||
alt += leet_dict.get(x.lower(), [])
|
||||
r += random.choice(alt)
|
||||
wc.command(r)
|
||||
return 0
|
||||
|
||||
def flip(server, args):
|
||||
l = list(args)
|
||||
l.reverse()
|
||||
wc.command("".join(l))
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,204 @@
|
||||
# -*- encoding: iso-8859-1 -*-
|
||||
#
|
||||
# Copyright (c) 2006 by EgS <i@egs.name>
|
||||
#
|
||||
# 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
|
||||
#
|
||||
|
||||
|
||||
#######################################################################
|
||||
# #
|
||||
# This script enables the user to keep their nicks and recover it in #
|
||||
# case it get's stolen. It uses the servers prefered nicks, so there #
|
||||
# is no need for any kind of setup. #
|
||||
# #
|
||||
# Name: Keepnick #
|
||||
# Licence: GPL v2 #
|
||||
# Author: Marcus Eggenberger <i@egs.name> #
|
||||
# #
|
||||
# Usage: #
|
||||
# /keepnick on|off|<positive number> #
|
||||
# #
|
||||
# use /help command for detailed information #
|
||||
# #
|
||||
# Changelog: #
|
||||
# 0.4: now starts on load and features user defined check intervals #
|
||||
# 0.3: Fixed major bug with continuous nickchanges #
|
||||
# 0.2: Fixed Bug: now only checks connected servers #
|
||||
# 0.1: first version released #
|
||||
# #
|
||||
#######################################################################
|
||||
|
||||
# ====================
|
||||
# Imports
|
||||
# ====================
|
||||
import sys
|
||||
|
||||
# ====================
|
||||
# Constants
|
||||
# ====================
|
||||
NAME = 'Keepnick'
|
||||
VERSION = '0.4'
|
||||
DESCRIPTION = "Plugin to keep your nick and recover it in case it's stolen"
|
||||
|
||||
ISON = '/ison %s'
|
||||
NICK = '/nick %s'
|
||||
|
||||
NICKSTEALER_LEFT = "Nickstealer left Network: %s!"
|
||||
KEEPNICK_ARG_ERROR = "\"%s\" is not a valid argument to /keepnick"
|
||||
KEEPNICK_ON = "Keepnick locked and loaded! (checking every %s seconds)"
|
||||
KEEPNICK_OFF = "Keepnick offline!"
|
||||
|
||||
DELAY = 10
|
||||
|
||||
# ====================
|
||||
# Exceptions
|
||||
# ====================
|
||||
|
||||
# ====================
|
||||
# Helpers
|
||||
# ====================
|
||||
class WeePrint(object):
|
||||
def write(self, text):
|
||||
text = text.rstrip(' \0\n') # strip the null byte appended by pythons print
|
||||
if text:
|
||||
weechat.prnt(text,'')
|
||||
|
||||
def registerFunction(function):
|
||||
# Register a python function as a commandhandler
|
||||
# Function needs to be named like weeFunction and
|
||||
# is bound to /function
|
||||
# docstring is used for weechat help
|
||||
functionname = function.__name__ # guess what :)
|
||||
weecommand = functionname[3:].lower() # strip the wee
|
||||
|
||||
doc = function.__doc__.splitlines()
|
||||
arguments = doc[0] # First docstring line is the arguments string
|
||||
description = doc[1][4:]
|
||||
args_description = '\n'.join([line[4:] for line in doc[2:-1]]) # join rest and strip indentation
|
||||
|
||||
if not function.func_defaults: # use args default value as template
|
||||
template = ''
|
||||
elif len(function.func_defaults) == 1:
|
||||
template = function.func_defaults[0]
|
||||
elif len(function.func_defaults) == 2:
|
||||
template = func.func_defaults[1]
|
||||
|
||||
weechat.add_command_handler(weecommand, functionname, description, arguments, args_description, template)
|
||||
|
||||
def registerFunctions():
|
||||
functions = [function for name, function in globals().iteritems() if name.startswith('wee') and callable(function)]
|
||||
for func in functions:
|
||||
registerFunction(func)
|
||||
|
||||
# ====================
|
||||
# Functions
|
||||
# ====================
|
||||
def servernicks(servername):
|
||||
server = weechat.get_server_info()[servername]
|
||||
servernicks = [server['nick1'], server['nick2'], server['nick3']]
|
||||
return servernicks
|
||||
|
||||
def ison(server, nicklist):
|
||||
weechat.command(ISON % ' '.join(nicklist), "", server)
|
||||
|
||||
def gotnick(server):
|
||||
server = weechat.get_server_info()[server]
|
||||
return server['nick'].lower() == server['nick1'].lower()
|
||||
|
||||
def checknicks():
|
||||
for servername, server in weechat.get_server_info().iteritems():
|
||||
if not gotnick(servername) and server['ssl_connected'] + server['is_connected']:
|
||||
ison(servername, servernicks(servername))
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
def grabnick(server, nick):
|
||||
if not gotnick(server):
|
||||
print NICKSTEALER_LEFT % server
|
||||
weechat.command(NICK % nick, '', server)
|
||||
|
||||
def isonhandler(server, args):
|
||||
nothing, message, nicks = args.split(':')
|
||||
nicks = [nick.lower() for nick in nicks.split()]
|
||||
for nick in servernicks(server):
|
||||
if nick.lower() == weechat.get_info("nick",server):
|
||||
return weechat.PLUGIN_RC_OK_IGNORE_ALL
|
||||
elif nick.lower() not in nicks:
|
||||
grabnick(server, nick)
|
||||
return weechat.PLUGIN_RC_OK_IGNORE_ALL
|
||||
|
||||
if 0 in [nick.lower() in [mynick.lower() for mynick in servernicks(server)] for nick in nicks]:
|
||||
# if any nick wich is return by ison is not on our checklist we're not the caller
|
||||
return weechat.PLUGIN_RC_OK
|
||||
else:
|
||||
# seems like we're the caller -> ignore the output
|
||||
return weechat.PLUGIN_RC_OK_IGNORE_ALL
|
||||
|
||||
def weeKeepnick(server, args="ON|OFF"):
|
||||
"""ON|OFF|<positive number>
|
||||
Enables or Disables the use of keepnick.
|
||||
When active Keepnick ensures that you keep your preferred nicks.
|
||||
Keepnick checks for the preferred nicks of each server config,
|
||||
so there is no need to configure anything. Using a number as the
|
||||
argument it sets the checkperiod to that number in seconds.
|
||||
|
||||
Example:
|
||||
/keepnick ON
|
||||
"""
|
||||
VALIDARGS = ['ON','OFF']
|
||||
|
||||
weechat.remove_handler('303', "isonhandler")
|
||||
weechat.remove_timer_handler("checknicks")
|
||||
|
||||
try:
|
||||
delay = int(args)
|
||||
if delay < 1:
|
||||
raise ValueError
|
||||
globals()['DELAY'] = delay
|
||||
except ValueError:
|
||||
if args.upper() not in VALIDARGS:
|
||||
print KEEPNICK_ARG_ERROR % args
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
if args.upper() != 'OFF':
|
||||
weechat.add_timer_handler(DELAY,"checknicks")
|
||||
weechat.add_message_handler('303', "isonhandler")
|
||||
print KEEPNICK_ON % DELAY
|
||||
else:
|
||||
print KEEPNICK_OFF
|
||||
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
# ====================
|
||||
# Let's Register!
|
||||
# ====================
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
import weechat
|
||||
except ImportError:
|
||||
print "This script is to be loaded as PythonScript in WeeChat"
|
||||
print "Get WeeChat now at: http://weechat.flashtux.org/"
|
||||
import sys
|
||||
sys.exit(10)
|
||||
|
||||
# kick pythons print to weechat.prnt(msg, '')
|
||||
sys.stdout = WeePrint()
|
||||
weechat.register(NAME, VERSION, "", DESCRIPTION)
|
||||
registerFunctions()
|
||||
weeKeepnick('','ON')
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
"""
|
||||
:Author: Henning Hasemann <hhasemann [at] web [dot] de>
|
||||
|
||||
:What it does:
|
||||
This plugin lets you inform all users in the current
|
||||
channel about the song which music-player-daemon (MPD)
|
||||
is currently playing.
|
||||
|
||||
:Usage:
|
||||
/mpdnp - Display file mpd is playing to current channel.
|
||||
|
||||
:Configuration Variables:
|
||||
============= ==========================================
|
||||
Variable name Meaning
|
||||
============= ==========================================
|
||||
host The host where your mpd runs
|
||||
port The port to connect to mpd (usually 6600)
|
||||
format How this script should display
|
||||
whats going on.
|
||||
You may use the following variables here:
|
||||
$artist, $title_or_file,
|
||||
$length_min, $length_sec, $pct,
|
||||
$pos_min, $pos_sec
|
||||
|
||||
Released under GPL licence.
|
||||
"""
|
||||
|
||||
todo = """
|
||||
- maybe support sending commands to mpd.
|
||||
- maybe make condional display
|
||||
(displaying some characters only
|
||||
if preceding or trailing variables are set)
|
||||
"""
|
||||
|
||||
import weechat as wc
|
||||
import mpdclient as mpd
|
||||
import re
|
||||
from os.path import basename, splitext
|
||||
|
||||
default_fmt = "/me 's MPD plays: $artist - $title_or_file ($length_min:$length_sec)"
|
||||
|
||||
wc.register("mpdnp", "0.3", "", "np for mpd")
|
||||
|
||||
def subst(text, values):
|
||||
out = ""
|
||||
n = 0
|
||||
for match in re.finditer(findvar, text):
|
||||
if match is None: continue
|
||||
else:
|
||||
l, r = match.span()
|
||||
nam = match.group(1)
|
||||
out += text[n:l+1] + values.get(nam, "") #"$" + nam)
|
||||
n = r
|
||||
return out + text[n:]
|
||||
|
||||
def np(server, args):
|
||||
"""
|
||||
Send information about the currently
|
||||
played song to the channel.
|
||||
"""
|
||||
host = wc.get_plugin_config("host")
|
||||
port = int(wc.get_plugin_config("port"))
|
||||
cont = mpd.MpdController(host=host, port=port)
|
||||
song = cont.getCurrentSong()
|
||||
pos, length, pct = cont.getSongPosition()
|
||||
|
||||
# insert artist, title, album, track, path
|
||||
d = song.__dict__
|
||||
d.update({
|
||||
"title_or_file": song.title or splitext(basename(song.path))[0],
|
||||
"pos_sec": "%02d" % (pos / 60),
|
||||
"pos_min": str(pos / 60),
|
||||
"length_sec": "%02d" % (length % 60),
|
||||
"length_min": str(length / 60),
|
||||
"pct": "%2.0f" % pct,
|
||||
})
|
||||
|
||||
wc.command(subst(wc.get_plugin_config("format"), d))
|
||||
return 0
|
||||
|
||||
def dbgnp(server, args):
|
||||
try:
|
||||
return np(server, args)
|
||||
except Exception, e:
|
||||
print e
|
||||
|
||||
wc.add_command_handler("mpdnp", "np", "", "", np.__doc__)
|
||||
|
||||
findvar = re.compile(r'[^\\]\$([a-z_]+)(\b|[^a-z_])')
|
||||
|
||||
default = {
|
||||
"host": "localhost",
|
||||
"port": "6600",
|
||||
"format": default_fmt,
|
||||
}
|
||||
|
||||
for k, v in default.items():
|
||||
if not wc.get_plugin_config(k):
|
||||
wc.set_plugin_config(k, v)
|
||||
|
||||
|
||||
@@ -0,0 +1,445 @@
|
||||
# -*- encoding: iso-8859-1 -*-
|
||||
#
|
||||
# Copyright (c) 2006 by EgS <i@egs.name>
|
||||
#
|
||||
# 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
|
||||
#
|
||||
|
||||
|
||||
#######################################################################
|
||||
# #
|
||||
# This script enables the execution of events triggered commands #
|
||||
# where the events are attach or detach of the screen weechat #
|
||||
# is running in. #
|
||||
# #
|
||||
# Name: OnAttach #
|
||||
# Licence: GPL v2 #
|
||||
# Author: Marcus Eggenberger <i@egs.name> #
|
||||
# #
|
||||
# Usage: #
|
||||
# /onattach or /ondetach to add new events #
|
||||
# /screenevents to manage events #
|
||||
# #
|
||||
# use /help command for detailed information #
|
||||
# #
|
||||
# Changelog: #
|
||||
# 0.5: added screen guessing to backup screen-detection #
|
||||
# 0.4: fixed TypeError in weechat 0.1.9 #
|
||||
# 0.3: now checking on startup if weechat runs in a screen #
|
||||
# 0.2: added usage of get/set_plugin_config to store eventlist #
|
||||
# 0.1: first version released #
|
||||
# #
|
||||
#######################################################################
|
||||
|
||||
|
||||
|
||||
# ====================
|
||||
# Imports
|
||||
# ====================
|
||||
import os
|
||||
import sys
|
||||
|
||||
# ====================
|
||||
# Constants
|
||||
# ====================
|
||||
NAME = 'OnAttach'
|
||||
VERSION = '0.5'
|
||||
DESCRIPTION = "Executing commands on screen Attach/Detach"
|
||||
|
||||
OFF = False
|
||||
ON = True
|
||||
|
||||
# ====================
|
||||
# Exceptions
|
||||
# ====================
|
||||
class OnAttachError(Exception):
|
||||
pass
|
||||
|
||||
# ====================
|
||||
# Helpers
|
||||
# ====================
|
||||
class WeePrint(object):
|
||||
def write(self, text):
|
||||
text = text.rstrip(' \0\n') # strip the null byte appended by pythons print
|
||||
if text:
|
||||
weechat.prnt(text,'')
|
||||
|
||||
def getScreenByPpid():
|
||||
# the screen we are in should be our parents parent
|
||||
# aka something like:
|
||||
# SCREEN
|
||||
# \_ -/bin/bash
|
||||
# \_ weechat-curses
|
||||
ppid = os.getppid()
|
||||
|
||||
# get SCREEN pid
|
||||
pipe = os.popen("ps o ppid= -p %d" % ppid)
|
||||
screenpid = pipe.read().strip()
|
||||
pipe.close()
|
||||
|
||||
# check if screen pid really belongs to a screen
|
||||
pipe = os.popen("ps o cmd= -p %s" % screenpid)
|
||||
cmd = pipe.read().strip()
|
||||
pipe.close()
|
||||
|
||||
if 'screen' not in cmd.lower():
|
||||
raise OnAttachError
|
||||
else:
|
||||
return screenpid
|
||||
|
||||
def getScreenByList():
|
||||
# checks if there is only one attached screen
|
||||
# if so use: it! ;)
|
||||
pipe = os.popen("screen -list | grep -i attached")
|
||||
screens = pipe.read().strip()
|
||||
pipe.close()
|
||||
screens = screens.splitlines()
|
||||
|
||||
if len(screens) > 1:
|
||||
print "There are more then one screen currently attached."
|
||||
print "Detach all other running screens and reload OnAttach"
|
||||
print "to ensure correct screen detection."
|
||||
raise OnAttachError
|
||||
|
||||
try:
|
||||
socket, status = screens[0].split()
|
||||
except:
|
||||
# thats no common screen list...
|
||||
print "failed!"
|
||||
raise OnAttachError
|
||||
else:
|
||||
print "Using screen %s" % socket
|
||||
return socket
|
||||
|
||||
def getScreenPid():
|
||||
try:
|
||||
return getScreenByPpid()
|
||||
except OnAttachError:
|
||||
print "!!! Unable to determine screen by parentid!"
|
||||
print "Trying to guess screen..."
|
||||
return getScreenByList()
|
||||
|
||||
def registerFunction(function):
|
||||
# Register a python function as a commandhandler
|
||||
# Function needs to be named like weeFunction and
|
||||
# is bound to /function
|
||||
# docstring is used for weechat help
|
||||
functionname = function.__name__ # guess what :)
|
||||
weecommand = functionname[3:].lower() # strip the wee
|
||||
|
||||
doc = function.__doc__.splitlines()
|
||||
arguments = doc[0] # First docstring line is the arguments string
|
||||
description = doc[1][4:]
|
||||
args_description = '\n'.join([line[4:] for line in doc[2:-1]]) # join rest and strip indentation
|
||||
|
||||
if not function.func_defaults: # use args default value as template
|
||||
template = ''
|
||||
elif len(function.func_defaults) == 1:
|
||||
template = function.func_defaults[0]
|
||||
elif len(function.func_defaults) == 2:
|
||||
template = func.func_defaults[1]
|
||||
|
||||
weechat.add_command_handler(weecommand, functionname, description, arguments, args_description, template)
|
||||
|
||||
def registerFunctions():
|
||||
functions = [function for name, function in globals().iteritems() if name.startswith('wee') and callable(function)]
|
||||
for func in functions:
|
||||
registerFunction(func)
|
||||
|
||||
# ====================
|
||||
# Classes
|
||||
# ====================
|
||||
class Event(object):
|
||||
ESCAPECHAR = '\\'
|
||||
SEPARATOR = ';'
|
||||
|
||||
def __init__(self, delay, step, channel, server, command, activehigh=True):
|
||||
self.delay = int(delay)
|
||||
self.step = step
|
||||
self.channel = channel
|
||||
self.server = server
|
||||
self.command = command
|
||||
self.activestate = activehigh
|
||||
self.reset()
|
||||
|
||||
#@classmethod
|
||||
def unserialize(cls, step, serial):
|
||||
try:
|
||||
# let's try the easy way :)
|
||||
delay, channel, server, command, activestate = serial.split()
|
||||
except ValueError:
|
||||
# ok we got an escaped separator... :/
|
||||
data = serial.split(cls.SEPARATOR)
|
||||
for i in range(len(data)):
|
||||
if data[i].endswith(cls.ESCAPECHAR):
|
||||
data[i+1] = data[i] + cls.SEPARATOR + data[i+1]
|
||||
data = [item.replace(cls.ESCAPECHAR + cls.SEPARATOR, cls.SEPARATOR) for item in data if not item.endswith(cls.ESCAPECHAR)]
|
||||
delay, channel, server, command, activestate = data
|
||||
|
||||
|
||||
delay = int(delay)
|
||||
activestate = activestate == 'True'
|
||||
|
||||
return cls(delay, step, channel, server, command, activestate)
|
||||
# lets go for 2.3 compatiblity
|
||||
unserialize = classmethod(unserialize)
|
||||
|
||||
#@property
|
||||
def serialized(self):
|
||||
data = [self.delay, self.channel, self.server, self.command, self.activestate]
|
||||
data = [str(item).replace(self.SEPARATOR, self.ESCAPECHAR + self.SEPARATOR) for item in data]
|
||||
return self.SEPARATOR.join(data)
|
||||
# lets go for 2.3 compatiblity
|
||||
serialized = property(serialized)
|
||||
|
||||
def reset(self):
|
||||
self.currentdelay = self.delay
|
||||
self.fired = False
|
||||
|
||||
def fire(self):
|
||||
weechat.command(self.command, self.channel, self.server)
|
||||
self.fired = True
|
||||
|
||||
def stimulus(self, state):
|
||||
if state != self.activestate:
|
||||
self.reset()
|
||||
else:
|
||||
self.currentdelay -= self.step
|
||||
if self.currentdelay <= 0 and not self.fired:
|
||||
self.fire()
|
||||
|
||||
class CheckStatus(object):
|
||||
ESCAPECHAR = '\\'
|
||||
SEPARATOR = '|'
|
||||
|
||||
eventlist = []
|
||||
step = 5
|
||||
def __init__(self):
|
||||
try:
|
||||
self.screenpid = getScreenPid()
|
||||
except OnAttachError:
|
||||
raise
|
||||
|
||||
# try to read config data
|
||||
serializedEvents = weechat.get_plugin_config("events")
|
||||
if not serializedEvents:
|
||||
return
|
||||
|
||||
events = serializedEvents.split(self.SEPARATOR)
|
||||
for i in range(len(events)):
|
||||
if events[i].endswith(self.ESCAPECHAR):
|
||||
events[i+1] = events[i] + self.SEPARATOR + ss[i+1]
|
||||
events = [event.replace(self.ESCAPECHAR + self.SEPARATOR, self.SEPARATOR) for event in events if not event.endswith(self.ESCAPECHAR)]
|
||||
for event in events:
|
||||
try:
|
||||
self.eventlist.append(Event.unserialize(self.step, event))
|
||||
except:
|
||||
print "Unable to unserialize event!"
|
||||
print "Try to add the event manualy and save config again."
|
||||
|
||||
def __call__(self, server="", args=""):
|
||||
# check if the screen is attached or detatched
|
||||
pipe = os.popen("screen -list | grep %s" % self.screenpid)
|
||||
screenlist = pipe.read().strip()
|
||||
pipe.close()
|
||||
|
||||
if 'attached' in screenlist.lower():
|
||||
state = ON
|
||||
elif 'detached' in screenlist.lower():
|
||||
state = OFF
|
||||
else:
|
||||
print "Unable to determine screen status"
|
||||
return weechat.PLUGIN_RC_KO
|
||||
|
||||
for event in self.eventlist:
|
||||
event.stimulus(state)
|
||||
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
def addEvent(self, delay, channel, server, command, activehigh=True):
|
||||
event = Event(delay, self.step, channel, server, command, activehigh)
|
||||
self.eventlist.append(event)
|
||||
|
||||
def showEvents(self):
|
||||
format = "%2s | %-10s | %-10s | %-15s | %-7s | %-2s %s"
|
||||
separator = "---+------------+------------+-----------------+---------+----"
|
||||
print separator
|
||||
print format % ("ID", "Server", "Channel", "Command", "Delay", "on", "")
|
||||
print separator
|
||||
for i in range(len(self.eventlist)):
|
||||
event = self.eventlist[i]
|
||||
if event.activestate:
|
||||
atde = 'AT'
|
||||
else:
|
||||
atde = 'DE'
|
||||
|
||||
if event.fired:
|
||||
fired = '*'
|
||||
else:
|
||||
fired = ''
|
||||
print format % (i, event.server[:10], event.channel[:10], event.command[:15], "%3d sec" % event.delay, atde, fired)
|
||||
print separator
|
||||
|
||||
def save(self):
|
||||
weechat.set_plugin_config("events",self.serialized)
|
||||
|
||||
#@property
|
||||
def serialized(self):
|
||||
events = [str(event.serialized).replace(self.SEPARATOR, self.ESCAPECHAR + self.SEPARATOR) for event in self.eventlist]
|
||||
return self.SEPARATOR.join(events)
|
||||
# lets go for 2.3 compatiblity
|
||||
serialized = property(serialized)
|
||||
|
||||
def dropEvent(self, eventid):
|
||||
del self.eventlist[eventid]
|
||||
|
||||
# ====================
|
||||
# Functions
|
||||
# ====================
|
||||
def addEvent(server, args, activehigh=True):
|
||||
delay, channel, command = args.split(' ', 2)
|
||||
delay = int(delay)
|
||||
|
||||
channel = channel.strip("'\"")
|
||||
checkStatus.addEvent(delay, channel, server, command, activehigh)
|
||||
if activehigh:
|
||||
atde = "at"
|
||||
else:
|
||||
atde = "de"
|
||||
|
||||
print "Added %stach event '%s' for channel %s on network %s with %d seconds delay" % (atde, command, channel, server, delay)
|
||||
|
||||
def weeOnAttach(server, args):
|
||||
"""delay channel command
|
||||
Adds a command which is executed after attaching the screen
|
||||
The command is executed <delay> seconds after the attach.
|
||||
Use "" or '' as channel if the command should be executed in
|
||||
the server buffer.
|
||||
|
||||
Example:
|
||||
/onattach 180 &bitlbee account on 0
|
||||
"""
|
||||
try:
|
||||
addEvent(server, args)
|
||||
except:
|
||||
weechat.command("/help onattach", "", server)
|
||||
return 0
|
||||
else:
|
||||
return 1
|
||||
|
||||
def weeOnDetach(server, args):
|
||||
"""delay channel command
|
||||
Adds a command which is executed after detaching the screen
|
||||
The command is executed <delay> seconds after the detach.
|
||||
Use "" or '' as channel if the command should be executed in
|
||||
the server buffer.
|
||||
|
||||
Example:
|
||||
/ondetach 180 &bitlbee account on 0
|
||||
"""
|
||||
try:
|
||||
addEvent(server, args, activehigh=False)
|
||||
except:
|
||||
weechat.command("/help onattach", "", server)
|
||||
return 0
|
||||
else:
|
||||
return 1
|
||||
|
||||
def weeScreenevents(server, args="show|save|drop"):
|
||||
"""show | save | drop eventid [eventid [...]]
|
||||
shows, saves or drops events
|
||||
show:
|
||||
Shows all current active events
|
||||
|
||||
save:
|
||||
Saves current events permanently
|
||||
|
||||
drop:
|
||||
Delete event from onAttach/onDetach list.
|
||||
Use /showevents to get eventid
|
||||
"""
|
||||
try:
|
||||
action, args = args.split(' ',1)
|
||||
except ValueError:
|
||||
action = args.strip()
|
||||
args = ''
|
||||
|
||||
actions = {'show':showEvents,
|
||||
'drop':dropEvent,
|
||||
'save':saveEvents}
|
||||
try:
|
||||
action = actions[action]
|
||||
except KeyError:
|
||||
weechat.command("/help screenevents", "", server)
|
||||
return 0
|
||||
else:
|
||||
return action(server, args)
|
||||
|
||||
|
||||
|
||||
def showEvents(server, args):
|
||||
checkStatus.showEvents()
|
||||
return 1
|
||||
|
||||
def dropEvent(server, args):
|
||||
try:
|
||||
eventids = [int(id) for id in args.split()]
|
||||
except:
|
||||
print "eventid musst be a number!"
|
||||
return 0
|
||||
|
||||
eventids.sort()
|
||||
eventids.reverse()
|
||||
for eventid in eventids:
|
||||
try:
|
||||
checkStatus.dropEvent(eventid)
|
||||
except:
|
||||
print "Unable to drop Event %d" % eventid
|
||||
return 0
|
||||
print "dropped %d events!" % len(eventids)
|
||||
return 1
|
||||
|
||||
def saveEvents(server, args):
|
||||
checkStatus.save()
|
||||
return 1
|
||||
|
||||
# ====================
|
||||
# Let's Register!
|
||||
# ====================
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
import weechat
|
||||
except ImportError:
|
||||
print "This script is to be loaded as PythonScript in WeeChat"
|
||||
print "Get WeeChat now at: http://weechat.flashtux.org/"
|
||||
import sys
|
||||
sys.exit(10)
|
||||
|
||||
# kick pythons print to weechat.prnt(msg, '')
|
||||
sys.stdout = WeePrint()
|
||||
weechat.register(NAME, VERSION, "", DESCRIPTION)
|
||||
try:
|
||||
checkStatus = CheckStatus()
|
||||
except OnAttachError:
|
||||
print "!!! Requirements for %s not met:" % NAME
|
||||
print "!!! - WeeChat is not running in a screen or not able to get screen PID"
|
||||
print "!!! --> Run WeeChat in a screen to fix the problem!"
|
||||
else:
|
||||
|
||||
weechat.add_timer_handler(checkStatus.step, "checkStatus")
|
||||
|
||||
registerFunctions()
|
||||
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
|
||||
# =============================================================================
|
||||
# shell.py (c) March 2006 by Kolter <kolter+dev@openics.org>
|
||||
#
|
||||
# Licence : GPL v2
|
||||
# Description : running shell commands in WeeChat
|
||||
# Syntax : try /help shell to get some help on this script
|
||||
# Precond : needs weechat > 0.1.7 to run else it will crash WeeChat ;-)
|
||||
#
|
||||
#
|
||||
# ### changelog ###
|
||||
#
|
||||
# * version 0.1 :
|
||||
# - first release
|
||||
#
|
||||
# =============================================================================
|
||||
|
||||
import weechat, os, popen2
|
||||
|
||||
SHELL_CMD="shell"
|
||||
SHELL_PREFIX="[shell] "
|
||||
|
||||
weechat.register ("Shell", "0.1", "", "Running shell commands in WeeChat")
|
||||
weechat.add_command_handler(
|
||||
SHELL_CMD,
|
||||
"shell",
|
||||
"Running shell commands in WeeChat",
|
||||
"[-o] <command line>",
|
||||
" -o : print output on current server/channel\n"
|
||||
"<command line> : shell command or builtin like cd, getenv, setenv, unsetenv",
|
||||
"-o|cd|getenv|setenv|unsetenv cd|getenv|setenv|unsetenv"
|
||||
)
|
||||
|
||||
def shell_exec(command):
|
||||
proc = popen2.Popen3(command, True)
|
||||
status = proc.wait()
|
||||
results = []
|
||||
if status == 0:
|
||||
results = proc.fromchild.readlines()
|
||||
else:
|
||||
results = proc.childerr.readlines()
|
||||
return status, results
|
||||
|
||||
def shell_output(command, inchan):
|
||||
status, results = shell_exec(command)
|
||||
if status == 0:
|
||||
for line in results:
|
||||
if inchan:
|
||||
weechat.command(line.rstrip('\n'))
|
||||
else:
|
||||
weechat.prnt(line.rstrip('\n'))
|
||||
else:
|
||||
weechat.prnt("%san error occured while running command `%s'" % (SHELL_PREFIX, command))
|
||||
for line in results:
|
||||
weechat.prnt(line.rstrip('\n'))
|
||||
|
||||
|
||||
def shell_chdir(directory):
|
||||
if directory == "":
|
||||
if os.environ.has_key('HOME'):
|
||||
directory = os.environ['HOME']
|
||||
try:
|
||||
os.chdir(directory)
|
||||
except:
|
||||
weechat.prnt("%san error occured while running command `cd %s'" % (SHELL_PREFIX, directory))
|
||||
else:
|
||||
pass
|
||||
|
||||
def shell_getenv(var, inchan):
|
||||
var = var.strip()
|
||||
if var == "":
|
||||
weechat.prnt("%swrong syntax, try 'getenv VAR'" % (SHELL_PREFIX))
|
||||
return
|
||||
|
||||
value = os.getenv(var)
|
||||
if value == None:
|
||||
weechat.prnt("%s$%s is not set" % (SHELL_PREFIX, var))
|
||||
else:
|
||||
if inchan:
|
||||
weechat.command("$%s=%s" % (var, os.getenv(var)))
|
||||
else:
|
||||
weechat.prnt("%s$%s=%s" % (SHELL_PREFIX, var, os.getenv(var)))
|
||||
|
||||
def shell_setenv(expr, inchan):
|
||||
expr = expr.strip()
|
||||
lexpr = expr.split('=')
|
||||
|
||||
if (len(lexpr) < 2):
|
||||
weechat.prnt("%swrong syntax, try 'setenv VAR=VALUE'" % (SHELL_PREFIX))
|
||||
return
|
||||
|
||||
os.environ[lexpr[0].strip()] = "=".join(lexpr[1:])
|
||||
if not inchan:
|
||||
weechat.prnt("%s$%s is now set to '%s'" % (SHELL_PREFIX, lexpr[0], "=".join(lexpr[1:])))
|
||||
|
||||
def shell_unsetenv(var, inchan):
|
||||
var = var.strip()
|
||||
if var == "":
|
||||
weechat.prnt("%swrong syntax, try 'unsetenv VAR'" % (SHELL_PREFIX))
|
||||
return
|
||||
|
||||
if os.environ.has_key(var):
|
||||
del os.environ[var]
|
||||
weechat.prnt("%s$%s is now unset" % (SHELL_PREFIX, var))
|
||||
else:
|
||||
weechat.prnt("%s$%s is not set" % (SHELL_PREFIX, var))
|
||||
|
||||
def shell(server, args):
|
||||
largs = args.split(" ")
|
||||
|
||||
#strip spaces
|
||||
while '' in largs:
|
||||
largs.remove('')
|
||||
while ' ' in largs:
|
||||
largs.remove(' ')
|
||||
|
||||
if len(largs) == 0:
|
||||
weechat.command("/help %s" % SHELL_CMD)
|
||||
else:
|
||||
inchan = False
|
||||
if largs[0] == '-o':
|
||||
inchan = True
|
||||
largs = largs[1:]
|
||||
|
||||
if largs[0] == 'cd':
|
||||
shell_chdir(" ".join(largs[1:]), inchan)
|
||||
elif largs[0] == 'getenv':
|
||||
shell_getenv (" ".join(largs[1:]), inchan)
|
||||
elif largs[0] == 'setenv':
|
||||
shell_setenv (" ".join(largs[1:]), inchan)
|
||||
elif largs[0] == 'unsetenv':
|
||||
shell_unsetenv (" ".join(largs[1:]), inchan)
|
||||
else:
|
||||
shell_output(" ".join(largs), inchan)
|
||||
|
||||
return weechat.PLUGIN_RC_OK
|
||||
@@ -0,0 +1,197 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
Theme manager for WeeChat.
|
||||
It loads configuration parameters from file
|
||||
and allows to create new theme out of current configuration.
|
||||
|
||||
by Stalwart <stlwrt@gmail.com>
|
||||
|
||||
Licensed under GNU GPL v2
|
||||
|
||||
"""
|
||||
|
||||
## ---------- Code starts here ----------
|
||||
import weechat
|
||||
import os
|
||||
|
||||
VERSION = "0.2.3"
|
||||
|
||||
weechat.register("theme", VERSION, "", "Theme manager for WeeChat")
|
||||
|
||||
THEMEDIR = weechat.get_info("weechat_dir") + '/themes'
|
||||
|
||||
weechat.add_command_handler("theme", "parameter_parser", "Apply and create themes", "[load <name> | save <name>]", "", "load|save")
|
||||
|
||||
settings = [
|
||||
'look_startup_logo',
|
||||
'look_startup_version',
|
||||
'look_weechat_slogan',
|
||||
'look_buffer_timestamp',
|
||||
'look_color_nicks_number',
|
||||
'look_color_actions',
|
||||
'look_nicklist',
|
||||
'look_nicklist_position',
|
||||
'look_nicklist_min_size',
|
||||
'look_nicklist_max_size',
|
||||
'look_no_nickname',
|
||||
'look_nickmode',
|
||||
'look_nickmode_empty',
|
||||
'look_nick_prefix',
|
||||
'look_nick_suffix',
|
||||
'look_align_nick',
|
||||
'look_align_other',
|
||||
'look_align_size',
|
||||
'look_align_size_max',
|
||||
'look_infobar',
|
||||
'look_infobar_timestamp',
|
||||
'look_infobar_seconds',
|
||||
'look_infobar_delay_highlight',
|
||||
'look_hotlist_names_count',
|
||||
'look_hotlist_names_level',
|
||||
'look_hotlist_names_length',
|
||||
'look_read_marker',
|
||||
'look_input_format',
|
||||
'col_separator',
|
||||
'col_title',
|
||||
'col_title_bg',
|
||||
'col_chat',
|
||||
'col_chat_time',
|
||||
'col_chat_time_sep',
|
||||
'col_chat_prefix1',
|
||||
'col_chat_prefix2',
|
||||
'col_chat_server',
|
||||
'col_chat_join',
|
||||
'col_chat_part',
|
||||
'col_chat_nick',
|
||||
'col_chat_host',
|
||||
'col_chat_channel',
|
||||
'col_chat_dark',
|
||||
'col_chat_highlight',
|
||||
'col_chat_bg',
|
||||
'col_chat_read_marker',
|
||||
'col_chat_read_marker_bg',
|
||||
'col_status',
|
||||
'col_status_delimiters',
|
||||
'col_status_channel',
|
||||
'col_status_data_msg',
|
||||
'col_status_private',
|
||||
'col_status_highlight',
|
||||
'col_status_data_other',
|
||||
'col_status_more',
|
||||
'col_status_bg',
|
||||
'col_infobar',
|
||||
'col_infobar_delimiters',
|
||||
'col_infobar_highlight',
|
||||
'col_infobar_bg',
|
||||
'col_input',
|
||||
'col_input_server',
|
||||
'col_input_channel',
|
||||
'col_input_nick',
|
||||
'col_input_delimiters',
|
||||
'col_input_bg',
|
||||
'col_nick',
|
||||
'col_nick_away',
|
||||
'col_nick_chanowner',
|
||||
'col_nick_chanadmin',
|
||||
'col_nick_op',
|
||||
'col_nick_halfop',
|
||||
'col_nick_voice',
|
||||
'col_nick_more',
|
||||
'col_nick_sep',
|
||||
'col_nick_self',
|
||||
'col_nick_color1',
|
||||
'col_nick_color2',
|
||||
'col_nick_color3',
|
||||
'col_nick_color4',
|
||||
'col_nick_color5',
|
||||
'col_nick_color6',
|
||||
'col_nick_color7',
|
||||
'col_nick_color8',
|
||||
'col_nick_color9',
|
||||
'col_nick_color10',
|
||||
'col_nick_private',
|
||||
'col_nick_bg',
|
||||
'col_chat_dcc_selected',
|
||||
'col_dcc_waiting',
|
||||
'col_dcc_connecting',
|
||||
'col_dcc_active',
|
||||
'col_dcc_done',
|
||||
'col_dcc_failed',
|
||||
'col_dcc_aborted'
|
||||
]
|
||||
|
||||
def themes_dir_available(writeable):
|
||||
if not os.access(THEMEDIR, os.F_OK):
|
||||
os.mkdir(THEMEDIR, 0700)
|
||||
if writeable:
|
||||
if os.access(THEMEDIR, os.W_OK):
|
||||
return 1
|
||||
else:
|
||||
return 0
|
||||
else:
|
||||
if os.access(THEMEDIR, os.R_OK):
|
||||
return 1
|
||||
else:
|
||||
return 0
|
||||
|
||||
def save_theme(theme_filename):
|
||||
if themes_dir_available(1):
|
||||
try:
|
||||
themefile = open("%s/%s" % (THEMEDIR, theme_filename), 'wU')
|
||||
except:
|
||||
weechat.print_infobar(3, "Bad theme name, try another")
|
||||
else:
|
||||
themefile.write("# This WeeChat theme has been generated by Themes v.%s\n" % VERSION)
|
||||
for variable in settings:
|
||||
try:
|
||||
value = weechat.get_config(variable)
|
||||
except:
|
||||
weechat.prnt("Unable to get the value of %s" % variable)
|
||||
else:
|
||||
themefile.write("%s=%s\n" % (variable, value))
|
||||
themefile.flush()
|
||||
themefile.close()
|
||||
weechat.print_infobar(3, "Theme %s saved" % theme_filename)
|
||||
|
||||
def load_theme(theme_filename):
|
||||
if themes_dir_available(0):
|
||||
if os.access("%s/%s" % (THEMEDIR, theme_filename), os.F_OK):
|
||||
themefile = open("%s/%s" % (THEMEDIR, theme_filename), 'rU')
|
||||
lines = themefile.readlines()
|
||||
for line in lines:
|
||||
if ((len(line) > 3) and (line[0] != '#') and (line.find("="))):
|
||||
try:
|
||||
weechat.set_config(line[:line.find("=")], line[line.find("=")+1:].replace("\n", ""))
|
||||
except:
|
||||
weechat.prnt("Unable to set the value of %s" % variable)
|
||||
weechat.print_infobar(3, "Theme %s applied" % theme_filename)
|
||||
else:
|
||||
weechat.print_infobar(3, "Theme %s doesn't exist" % theme_filename)
|
||||
themefile.close()
|
||||
|
||||
def list_themes():
|
||||
if themes_dir_available(0):
|
||||
files = os.listdir(THEMEDIR)
|
||||
if len(files):
|
||||
weechat.prnt('Available themes:')
|
||||
for filename in files:
|
||||
if filename[-9:] == '.weetheme':
|
||||
weechat.prnt(" %s" % filename[:-9])
|
||||
else:
|
||||
weechat.prnt('Theme directory is empty, you can create new theme out of your current configuration by executing "/theme save <name>". Additional themes available on http://weechat.flashtux.org')
|
||||
else:
|
||||
weechat.prnt('Theme directory is not available. Please, check access rights')
|
||||
|
||||
def parameter_parser(server, args):
|
||||
if ((args != '') & (len(args.split()) == 2)):
|
||||
if args.split()[0] == 'save':
|
||||
save_theme(args.split()[1] + '.weetheme')
|
||||
elif args.split()[0] == 'load':
|
||||
load_theme(args.split()[1] + '.weetheme')
|
||||
else:
|
||||
weechat.prnt('Invalid parameter, must be "load" or "save"')
|
||||
else:
|
||||
list_themes()
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
|
||||
@@ -0,0 +1,334 @@
|
||||
#!/bin/env python
|
||||
#
|
||||
# TinyUrl, version 3.3, for weechat version 0.1.9
|
||||
#
|
||||
# Listens to all channels for long URLs, and submits them to tinyurl.com
|
||||
# for easier links.
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# By default, any URL longer than 30 characters in length is grabbed,
|
||||
# submitted to 'tinyurl', and printed in the channel for your eyes only.
|
||||
# For example, you may see something like this:
|
||||
#
|
||||
# [11:21] <@lack> http://www.cbc.ca/story/canada/national/2005/11/12/mcdona
|
||||
# lds-051112.html?ref=rss
|
||||
# [11:21] -P- [AKA] http://tinyurl.com/9dthl
|
||||
#
|
||||
# Now you can just cut&paste the easier, shorter URL into your favourite
|
||||
# browser.
|
||||
#
|
||||
# If you want to be extra-helpful (or annoying) to certain channels you
|
||||
# are in, you can actually have the script say the tinyurl.com equivalent
|
||||
# of all long URLs, by adding the channel to the 'activechans' list. In
|
||||
# that case, everyone in the channel would see the following:
|
||||
#
|
||||
# [11:25] <testuser> http://www.cbc.ca/story/canada/national/2005/11/12/mcdona
|
||||
# lds-051112.html?ref=rss
|
||||
# [11:25] <@lack> [AKA] http://tinyurl.com/9dthl
|
||||
#
|
||||
# Configuration:
|
||||
#
|
||||
# Run '/help tinyurl' for the actual usage for setting these options:
|
||||
#
|
||||
# activechans
|
||||
# A comma-delimited list of channels you will actually "say" the
|
||||
# tinyurl in. By default the list is empty. Be warned, some channels
|
||||
# won't appreciate extra help (or 'noise' as they like to call it), and
|
||||
# some channels already have bots that do this. Please only enable
|
||||
# this in channels where the ops have given you permission.
|
||||
#
|
||||
# urllength
|
||||
# An integer, default value 30. Any URL this long or longer will
|
||||
# trigger a tinyurl event.
|
||||
#
|
||||
# printall
|
||||
# Either "on" or "off", default "on". When ON, you will see the
|
||||
# tinyurl printed in your window for any channels not in your
|
||||
# activechans list. When OFF, you will not see any tinyurls except in
|
||||
# your activechans list.
|
||||
#
|
||||
# Requirements:
|
||||
#
|
||||
# - Designed to run with weechat version 0.1.9 or better.
|
||||
# http://weechat.flashtux.org/
|
||||
#
|
||||
# - Requires that 'curl' is in the path (tested with curl 7.15.0).
|
||||
# http://curl.haxx.se/
|
||||
#
|
||||
# Copyright (C) 2005 Jim Ramsay <i.am@jimramsay.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 Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
# USA.
|
||||
#
|
||||
# Changelog:
|
||||
#
|
||||
# Version 3.3, July 4, 2006
|
||||
# Catches possible error in os.waitpid
|
||||
# Properly prints tinyurls in query windows
|
||||
#
|
||||
# Version 3.2, June 15, 2006
|
||||
# Multiple configuration bugfixes, pointed out by Stalwart on #weechat.
|
||||
#
|
||||
# Version 3.1, June 15, 2006
|
||||
# Now kills any leftover curl processes when the script is unloaded.
|
||||
# Thanks again to kolter for the great idea!
|
||||
# Also cleaned up /tinyurl command, added comletion_template, updated
|
||||
# help text, improved option parsing logic, etc.
|
||||
#
|
||||
# Version 3.0, June 15, 2006
|
||||
# Fixes "tinyurl script sometimes makes weechat freeze" issue by using
|
||||
# the new timer handlers available in Weechat 0.1.9
|
||||
# Also includes URL detection fix from Raimund Specht
|
||||
# <raimund@spemaus.de>.
|
||||
#
|
||||
# Version 2.0, Dec 13, 2005
|
||||
# Also catches https, ftp, and ftps URLs, thanks to kolter for the
|
||||
# suggestion!
|
||||
#
|
||||
# Version 1.1, Dec 2, 2005
|
||||
# Fixed undefined 'urlend' thanks to kolter@irc.freenode.org#weechat
|
||||
#
|
||||
# TODO:
|
||||
#
|
||||
# - Handle outgoing messages and replace long urls with the tinyurl
|
||||
# equivalent automatically.
|
||||
# - On load, check that 'curl' is installed, and fail if not.
|
||||
#
|
||||
|
||||
import os, tempfile, re
|
||||
try:
|
||||
import urllib
|
||||
except:
|
||||
raise ImportError("You need to reload the python plugin to reload urllib")
|
||||
import weechat
|
||||
|
||||
# Register with weechat
|
||||
weechat.register( "TinyUrl", "3.3", "tinyurlShutdown", "Waits for URLs and sends them to 'tinyurl' for you" )
|
||||
|
||||
# Global variables
|
||||
tinyurlParams = ("urllength","activechans","printall")
|
||||
tinyurlProcessList = {}
|
||||
|
||||
# Set default settings values:
|
||||
if weechat.get_plugin_config('urllength') == "":
|
||||
weechat.set_plugin_config('urllength', "30")
|
||||
if weechat.get_plugin_config('printall') != "on" and \
|
||||
weechat.get_plugin_config('printall') != "off":
|
||||
weechat.set_plugin_config('printall', "on")
|
||||
|
||||
# Start the timer thread and register handlers
|
||||
weechat.add_timer_handler( 1, "tinyurlCheckComplete" )
|
||||
weechat.add_message_handler("privmsg", "tinyurlHandleMessage")
|
||||
weechat.add_command_handler("tinyurl", "tinyurlMain", \
|
||||
"Sets/Gets 'tinyurl' settings.",
|
||||
"[<variable> [[=] <value>]]",
|
||||
"""When run without arguments, displays all tinyurl settings
|
||||
|
||||
<variable> : Sets or displays a single tinyurl setting. One of:
|
||||
activechans [[=] #chan1[,#chan2...]]
|
||||
List of channels where others will see your tinyurls.
|
||||
Default: None
|
||||
urllength [[=] length]
|
||||
Will not create tinyurls for any URLs shorter than this.
|
||||
Default: 30
|
||||
printall [[=] on|off]
|
||||
When off, will not display private tinyurls, just those
|
||||
displayed publicly in your "active channels"
|
||||
Default: on""",
|
||||
"urllength|activechans|printall"
|
||||
)
|
||||
|
||||
def tinyurlShutdown():
|
||||
"""Cleanup - Kills any leftover child processes"""
|
||||
if len(tinyurlProcessList.keys()) > 0:
|
||||
weechat.prnt( "-TinyUrl- Cleaning up unfinished processes:" )
|
||||
for pid in tinyurlProcessList.keys():
|
||||
weechat.prnt( " Process %d" % pid )
|
||||
try:
|
||||
os.kill(pid, 9)
|
||||
os.waitpid( pid, 0 )
|
||||
except:
|
||||
weechat.prnt( " Cleanup failed, skipping" )
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
def tinyurlGet( name = "" ):
|
||||
"""Gets a variable value"""
|
||||
if name == "":
|
||||
weechat.prnt( "-TinyUrl- Get all:" )
|
||||
for name in tinyurlParams:
|
||||
weechat.prnt( " %s = %s" % (name, weechat.get_plugin_config(name)) )
|
||||
else:
|
||||
weechat.prnt( "-TinyUrl- Get:" )
|
||||
if name in tinyurlParams:
|
||||
weechat.prnt( " %s = %s" % (name, weechat.get_plugin_config(name)) )
|
||||
else:
|
||||
weechat.prnt( " Unknown parameter \"%s\", try '/help tinyurl'" % name )
|
||||
return
|
||||
|
||||
def tinyurlSet( name, value ):
|
||||
"""Sets a variable value"""
|
||||
if value == "":
|
||||
tinyurlGet( name )
|
||||
else:
|
||||
weechat.prnt( "-TinyUrl- Set:" )
|
||||
if name in tinyurlParams:
|
||||
if name == "printall":
|
||||
if value == "0" or value.lower() == "no" or value.lower() == "off":
|
||||
weechat.set_plugin_config(name, "off")
|
||||
elif value == "1" or value.lower() == "yes" or value.lower() == "on":
|
||||
weechat.set_plugin_config(name, "on")
|
||||
else:
|
||||
weechat.prnt( " printall must be one of 'on' or 'off'" )
|
||||
weechat.prnt( " value = '%s'" % value )
|
||||
return
|
||||
else:
|
||||
if name == "activechans":
|
||||
vs = re.split(", |,| ", value)
|
||||
values = []
|
||||
for v in vs:
|
||||
if v.startswith("#"):
|
||||
values.append(v)
|
||||
value = ",".join(values)
|
||||
weechat.set_plugin_config(name, value)
|
||||
weechat.prnt( " %s = %s" % (name, weechat.get_plugin_config(name)) )
|
||||
else:
|
||||
weechat.prnt( " Unknown parameter \'%s\'" % name )
|
||||
return
|
||||
|
||||
def tinyurlMain( server, args ):
|
||||
"""Main handler for the /tinyurl command"""
|
||||
args = args.split( " " )
|
||||
while '' in args:
|
||||
args.remove('')
|
||||
while ' ' in args:
|
||||
args.remove(' ')
|
||||
if len(args) == 0:
|
||||
tinyurlGet()
|
||||
else:
|
||||
name = args[0]
|
||||
value = ""
|
||||
if len(args) > 1:
|
||||
if args[1] == "=":
|
||||
value = " ".join(args[2:])
|
||||
else:
|
||||
value = " ".join(args[1:])
|
||||
tinyurlSet( args[0], value )
|
||||
else:
|
||||
tinyurlGet( name )
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
def tinyurlGetUrl( url, channel, server ):
|
||||
"""Starts a background process which will query 'tinyurl.com' and put the
|
||||
result in a file that the timer function 'tinyurlCheck' will find and
|
||||
parse."""
|
||||
global tinyurlProcessList
|
||||
handle, filename = tempfile.mkstemp( prefix="weechat-tinyurl.py-" )
|
||||
os.close(handle)
|
||||
cmd = ("curl -d url=%s http://tinyurl.com/create.php --stderr /dev/null -o %s" % \
|
||||
(urllib.quote(url), filename)).split()
|
||||
try:
|
||||
pid = os.spawnvp( os.P_NOWAIT, cmd[0], cmd )
|
||||
tinyurlProcessList[pid] = (filename, channel, server)
|
||||
except Exception, e:
|
||||
weechat.prnt( "-TinyUrl- Error: Could not spawn curl: %s" % e )
|
||||
|
||||
def tinyurlParsefile( filename ):
|
||||
"""Parses the given HTML file and pulls out the tinyurl."""
|
||||
turl = None
|
||||
try:
|
||||
html = open(filename, "r")
|
||||
for line in html:
|
||||
if( line.startswith("<input type=hidden name=tinyurl value=\"") ):
|
||||
turlend = line[39:].find("\"")
|
||||
if turlend > -1:
|
||||
turl = line[39:][:turlend]
|
||||
break
|
||||
html.close()
|
||||
except Exception, e:
|
||||
weechat.prnt( "-TinyUrl- Error: Could not open result file %s: %s" % (filename, e) )
|
||||
return turl
|
||||
|
||||
def tinyurlPrint( url, channel, server ):
|
||||
"""Prints the new tinyurl either to just you, or to the whole channel"""
|
||||
activeChans = weechat.get_plugin_config('activechans').split(',')
|
||||
if channel in activeChans:
|
||||
weechat.command( "/msg %s [AKA] %s" % ( channel, url) )
|
||||
else:
|
||||
weechat.prnt( "[AKA] %s" % (url), channel, server )
|
||||
|
||||
def tinyurlFindUrlstart( msg, start = 0 ):
|
||||
"""Finds the beginnings of URLs"""
|
||||
index = -1
|
||||
if start < 0 or start >= len(msg):
|
||||
return index
|
||||
for prefix in ( "http://", "https://", "ftp://", "ftps://" ):
|
||||
index = msg.find( prefix, start )
|
||||
if index > -1:
|
||||
break
|
||||
return index
|
||||
|
||||
def tinyurlFindUrlend( msg, urlstart ):
|
||||
"""Finds the ends of URLs (Strips following punctuation)"""
|
||||
m = msg[urlstart:]
|
||||
index = m.find( " " )
|
||||
if index == -1:
|
||||
index = len(m)
|
||||
while msg[index-1] in ( "?", ".", "!" ):
|
||||
index -= 1
|
||||
return index + urlstart
|
||||
|
||||
def tinyurlCheckComplete():
|
||||
"""The periodic poll of all waiting processes"""
|
||||
global tinyurlProcessList
|
||||
for pid in tinyurlProcessList.keys():
|
||||
(filename, channel, server) = tinyurlProcessList[pid]
|
||||
try:
|
||||
(p, er) = os.waitpid( pid, os.WNOHANG )
|
||||
if p != 0:
|
||||
if er == 0:
|
||||
tinyurl = tinyurlParsefile(filename)
|
||||
if tinyurl is not None:
|
||||
tinyurlPrint( tinyurl, channel, server )
|
||||
else:
|
||||
weechat.prnt( "-TinyUrl- Error: 'curl' did not run properly" )
|
||||
os.unlink(filename)
|
||||
del tinyurlProcessList[pid]
|
||||
except OSError, e:
|
||||
weechat.prnt( "-TinyUrl- Error: 'curl' process not found: %s", e )
|
||||
os.unlink(filename)
|
||||
del tinyurlProcessList[pid]
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
def tinyurlHandleMessage( server, args ):
|
||||
"""Handles IRC PRIVMSG and checks for URLs"""
|
||||
maxlen = int(weechat.get_plugin_config( "urllength" ))
|
||||
activeChans = weechat.get_plugin_config('activechans').split(',')
|
||||
onlyActiveChans = weechat.get_plugin_config('printall') == "off"
|
||||
(source, type, channel, msg) = args.split(" ", 3)
|
||||
if onlyActiveChans and channel not in activeChans:
|
||||
return weechat.PLUGIN_RC_OK
|
||||
if not channel.startswith("#"):
|
||||
channel = source.split("!", 2)[0][1:]
|
||||
urlstart = tinyurlFindUrlstart( msg )
|
||||
while urlstart > -1 and urlstart is not None:
|
||||
urlend = tinyurlFindUrlend( msg, urlstart )
|
||||
url = msg[urlstart:urlend]
|
||||
if len(url) >= maxlen:
|
||||
tinyurlGetUrl(url, channel, server)
|
||||
# Check for more URLs
|
||||
urlstart = tinyurlFindUrlstart( msg, urlend+1 )
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
"""
|
||||
:Author: Henning Hasemann <hhasemann [at] web [dot] de>
|
||||
|
||||
:What it does:
|
||||
This script listens for messages beginning
|
||||
with a special token and appends these messages
|
||||
to a file.
|
||||
This way people can post you short assignments which
|
||||
you cant forget and dont have to look up in your look.
|
||||
(try appending "cat /path/to/mytodofile" at your .bashrc)
|
||||
|
||||
:Usage:
|
||||
- Load this file
|
||||
- Make sure to set suitable configuration values.
|
||||
token: The piece of text that signals a TODO
|
||||
file: The file where the TODOs should be appended
|
||||
allowed_sources: A space-seperated list of nicknames
|
||||
which are allowed to send TODOs to you.
|
||||
- Whenever any allowed person sends a message beginning
|
||||
with your desired token, the rest of that message is
|
||||
append to the desired TODO-file.
|
||||
|
||||
Released under GPL licence.
|
||||
"""
|
||||
__version__ = "0.1"
|
||||
|
||||
import weechat as wc
|
||||
|
||||
wc.register("todo", __version__, "", "automatic TODO")
|
||||
wc.add_message_handler("privmsg", "on_msg")
|
||||
|
||||
default = {
|
||||
"token": "##todo ",
|
||||
"file": "/home/USER/todo",
|
||||
"allowed_sources": "",
|
||||
}
|
||||
|
||||
for k, v in default.items():
|
||||
if not wc.get_plugin_config(k):
|
||||
wc.set_plugin_config(k, v)
|
||||
|
||||
def source_allowed(src):
|
||||
return src in wc.get_plugin_config("allowed_sources").split()
|
||||
|
||||
def on_msg(server, args):
|
||||
# args looks like:
|
||||
# :foo!foo@host PRIVMSG #channel :Hello, how are you?
|
||||
|
||||
token = wc.get_plugin_config("token")
|
||||
filename = wc.get_plugin_config("file")
|
||||
|
||||
try:
|
||||
nothing, info, message = args.split(":", 2)
|
||||
hostmask, privmsg, channel = info.split(None, 2)
|
||||
source = hostmask.split("!")[0]
|
||||
except ValueError:
|
||||
# Parsing didnt work,
|
||||
# this happens mostly when strange messages
|
||||
# arrive that dont have the format described above
|
||||
return 0
|
||||
|
||||
if source_allowed(source) and message.lower().startswith(token):
|
||||
wc.print_infobar(5, "NEW TASK: " + str(message[7:]))
|
||||
f = open(filename, "a")
|
||||
f.write("%s (%s)\n" % (message[7:], source))
|
||||
f.close()
|
||||
|
||||
return 0
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
# -*- encoding: iso-8859-1 -*-
|
||||
#
|
||||
# Copyright (c) 2006 by EgS <i@egs.name>
|
||||
#
|
||||
# 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
|
||||
#
|
||||
|
||||
|
||||
#######################################################################
|
||||
# #
|
||||
# This script adds a simple command to toggle weechat options #
|
||||
# #
|
||||
# Name: Toggle #
|
||||
# Licence: GPL v2 #
|
||||
# Author: Marcus Eggenberger <i@egs.name> #
|
||||
# #
|
||||
# Usage: #
|
||||
# /toggle look_nicklist #
|
||||
# #
|
||||
# use /help command for detailed information #
|
||||
# #
|
||||
# Changelog: #
|
||||
# 0.1: first version released #
|
||||
# #
|
||||
#######################################################################
|
||||
|
||||
|
||||
|
||||
# ====================
|
||||
# Imports
|
||||
# ====================
|
||||
import sys
|
||||
|
||||
# ====================
|
||||
# Constants
|
||||
# ====================
|
||||
NAME = 'Toggle'
|
||||
VERSION = '0.1'
|
||||
DESCRIPTION = "Simple tool to toggle ON/OFF settings"
|
||||
|
||||
VALUES = ['OFF','ON']
|
||||
|
||||
# ====================
|
||||
# Exceptions
|
||||
# ====================
|
||||
|
||||
# ====================
|
||||
# Helpers
|
||||
# ====================
|
||||
class WeePrint(object):
|
||||
def write(self, text):
|
||||
text = text.rstrip(' \0\n') # strip the null byte appended by pythons print
|
||||
if text:
|
||||
weechat.prnt(text,'')
|
||||
|
||||
def registerFunction(function):
|
||||
# Register a python function as a commandhandler
|
||||
# Function needs to be named like weeFunction and
|
||||
# is bound to /function
|
||||
# docstring is used for weechat help
|
||||
functionname = function.__name__ # guess what :)
|
||||
weecommand = functionname[3:].lower() # strip the wee
|
||||
|
||||
doc = function.__doc__.splitlines()
|
||||
arguments = doc[0] # First docstring line is the arguments string
|
||||
description = doc[1][4:]
|
||||
args_description = '\n'.join([line[4:] for line in doc[2:-1]]) # join rest and strip indentation
|
||||
|
||||
if not function.func_defaults: # use args default value as template
|
||||
template = ''
|
||||
elif len(function.func_defaults) == 1:
|
||||
template = function.func_defaults[0]
|
||||
elif len(function.func_defaults) == 2:
|
||||
template = func.func_defaults[1]
|
||||
|
||||
weechat.add_command_handler(weecommand, functionname, description, arguments, args_description, template)
|
||||
|
||||
def registerFunctions():
|
||||
functions = [function for name, function in globals().iteritems() if name.startswith('wee') and callable(function)]
|
||||
for func in functions:
|
||||
registerFunction(func)
|
||||
|
||||
# ====================
|
||||
# Functions
|
||||
# ====================
|
||||
def weeToggle(server, args="%o"):
|
||||
"""<setting>
|
||||
Toggles any setting from ON to OFF and vice versa.
|
||||
Example:
|
||||
/toggle look_nicklist
|
||||
"""
|
||||
option = args
|
||||
currentvalue = weechat.get_config(option).upper()
|
||||
if currentvalue not in VALUES:
|
||||
print "%s cannot be toggled!" % option
|
||||
else:
|
||||
newvalue = VALUES[VALUES.index(currentvalue) - 1]
|
||||
weechat.set_config(option, newvalue)
|
||||
print "%s = %s" % (option, newvalue)
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
# ====================
|
||||
# Let's Register!
|
||||
# ====================
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
import weechat
|
||||
except ImportError:
|
||||
print "This script is to be loaded as PythonScript in WeeChat"
|
||||
print "Get WeeChat now at: http://weechat.flashtux.org/"
|
||||
import sys
|
||||
sys.exit(10)
|
||||
|
||||
# kick pythons print to weechat.prnt(msg, '')
|
||||
sys.stdout = WeePrint()
|
||||
weechat.register(NAME, VERSION, "", DESCRIPTION)
|
||||
registerFunctions()
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
# This script sends "uname -a" output to current channel.
|
||||
# Just type /uname while chatting on some channel ;)
|
||||
|
||||
# by Stalwart <stlwrt doggy gmail.com>
|
||||
#
|
||||
# Released under GPL licence.
|
||||
|
||||
import weechat
|
||||
from os import popen
|
||||
|
||||
def senduname(server, args):
|
||||
unameout = popen ('uname -a')
|
||||
uname = unameout.readline()
|
||||
weechat.command(uname[:-1])
|
||||
return 0
|
||||
|
||||
weechat.register ('uname', '1.0', '', """Sends "uname -a" output to current channel""")
|
||||
weechat.add_command_handler ('uname', 'senduname')
|
||||
@@ -0,0 +1,447 @@
|
||||
#
|
||||
# UrlGrab, version 1.0, for weechat version 0.1.6
|
||||
#
|
||||
# Listens to all channels for URLs, collects them in a list, and launches
|
||||
# them in your favourite web server on the local host or a remote server.
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# The /url command provides access to all UrlGrab functions. Run
|
||||
# '/url help' for complete command usage.
|
||||
#
|
||||
# In general, use '/url list' to list the entire url list for the current
|
||||
# channel, and '/url <n>' to launch the nth url in the list. For
|
||||
# example, to launch the first (and most-recently added) url in the list,
|
||||
# you would run '/url 1'
|
||||
#
|
||||
# From the server window, you must specify a specific channel for the
|
||||
# list and launch commands, for example:
|
||||
# /url list #weechat
|
||||
# /url 3 #weechat
|
||||
#
|
||||
# Configuration:
|
||||
#
|
||||
# The '/url set' command lets you get and set the following options:
|
||||
#
|
||||
# historysize
|
||||
# The maximum number of URLs saved per channel. Default is 10
|
||||
#
|
||||
# method
|
||||
# Must be one of 'local' or 'remote' - Defines how URLs are launched by
|
||||
# the script. If 'local', the script will run 'localcmd' on the host.
|
||||
# If 'remote', the script will run 'remotessh remotehost remotecmd' on
|
||||
# the local host which should normally use ssh to connect to another
|
||||
# host and run the browser command there.
|
||||
#
|
||||
# localcmd
|
||||
# The command to run on the local host to launch URLs in 'local' mode.
|
||||
# The string '%s' will be replaced with the URL. The default is
|
||||
# 'firefox %s'.
|
||||
#
|
||||
# remotessh
|
||||
# The command (and arguments) used to connect to the remote host for
|
||||
# 'remote' mode. The default is 'ssh -x' which will connect as the
|
||||
# current username via ssh and disable X11 forwarding.
|
||||
#
|
||||
# remotehost
|
||||
# The remote host to which we will connect in 'remote' mode. For ssh,
|
||||
# this can just be a hostname or 'user@host' to specify a username
|
||||
# other than your current login name. The default is 'localhost'.
|
||||
#
|
||||
# remotecmd
|
||||
# The command to execute on the remote host for 'remote' mode. The
|
||||
# default is 'bash -c "DISPLAY=:0.0 firefox %s"' Which runs bash, sets
|
||||
# up the environment to display on the remote host's main X display,
|
||||
# and runs firefox. As with 'localcmd', the string '%s' will be
|
||||
# replaced with the URL.
|
||||
#
|
||||
# cmdoutput
|
||||
# The file where the command output (if any) is saved. Overwritten
|
||||
# each time you launch a new URL. Default is ~/.weechat/urllaunch.log
|
||||
#
|
||||
# Requirements:
|
||||
#
|
||||
# - Designed to run with weechat version 1.0.6 or better.
|
||||
# http://weechat.flashtux.org/
|
||||
#
|
||||
# Acknowlegements:
|
||||
#
|
||||
# - Based on an earlier version called 'urlcollector.py' by 'kolter' of
|
||||
# irc.freenode.net/#weechat Honestly, I just cleaned up the code a bit and
|
||||
# made the settings a little more useful (to me).
|
||||
#
|
||||
# Copyright (C) 2005 Jim Ramsay <i.am@jimramsay.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 Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
# USA.
|
||||
#
|
||||
|
||||
import os
|
||||
import weechat
|
||||
|
||||
UC_NAME="UrlGrab"
|
||||
UC_VERSION="1.0"
|
||||
|
||||
weechat.register (UC_NAME, UC_VERSION, "", "Url collector/launcher for weechat")
|
||||
weechat.add_message_handler("privmsg", "urlGrabCheck")
|
||||
weechat.add_command_handler("url", "urlGrabMain",
|
||||
"Controls UrlGrab -> '/url help' for usage")
|
||||
|
||||
def urlGrabPrint(message):
|
||||
weechat.prnt("-[%s]- %s" % ( UC_NAME, message ) )
|
||||
|
||||
class WeechatSetting:
|
||||
def __init__(self, name, default, description = "" ):
|
||||
self.name = name
|
||||
self.default = default
|
||||
self.description = description
|
||||
test = weechat.get_plugin_config( name )
|
||||
if test is None or test == "":
|
||||
weechat.set_plugin_config( name, default )
|
||||
|
||||
class UrlGrabSettings:
|
||||
def __init__(self):
|
||||
self.settings = {
|
||||
'historysize':WeechatSetting('historysize', '10',
|
||||
"Number of URLs to keep per channel" ),
|
||||
'method':WeechatSetting('method', 'local',
|
||||
"""Where to launch URLs
|
||||
If 'local', runs %localcmd%.
|
||||
If 'remote' runs the following command:
|
||||
`%remotessh% %remotehost% %remotecmd`"""),
|
||||
'localcmd':WeechatSetting('localcmd', 'firefox %s',
|
||||
"""Command to launch local URLs. '%s' becomes the URL.
|
||||
Default 'firefox %s'"""),
|
||||
'remotessh':WeechatSetting('remotessh', 'ssh -x',
|
||||
"""Command (and arguments) to connect to a remote machine.
|
||||
Default 'ssh -x'"""),
|
||||
'remotehost':WeechatSetting('remotehost', 'localhost',
|
||||
"""Hostname for remote launching
|
||||
Default 'localhost'"""),
|
||||
'remotecmd':WeechatSetting('remotecmd',
|
||||
'bash -c \"DISPLAY=:0.0 firefox %s\"',
|
||||
"""Command to launch remote URLs. '%s' becomes the URL.
|
||||
Default 'bash -c \"DISPLAY=:0.0 firefox %s\"'"""),
|
||||
'cmdlog':WeechatSetting('cmdlog',
|
||||
'~/.weechat/urllaunch.log',
|
||||
"""File where command output is saved. Overwritten each
|
||||
time an URL is launched
|
||||
Default '~/.weechat/urllaunch.log'""" )
|
||||
}
|
||||
|
||||
def has(self, name):
|
||||
return self.settings.has_key(name)
|
||||
|
||||
def names(self):
|
||||
return self.settings.keys()
|
||||
|
||||
def description(self, name):
|
||||
return self.settings[name].description
|
||||
|
||||
def set(self, name, value):
|
||||
# Force string values only
|
||||
if type(value) != type("a"):
|
||||
value = str(value)
|
||||
if name == "method":
|
||||
if value.lower() == "remote":
|
||||
weechat.set_plugin_config( 'method', "remote" )
|
||||
elif value.lower() == "local":
|
||||
weechat.set_plugin_config( 'method', "local" )
|
||||
else:
|
||||
raise ValueError( "\'%s\' is not \'local\' or \'remote\'" % value )
|
||||
elif name == "localcmd":
|
||||
if value.find( "%s" ) == -1:
|
||||
weechat.set_plugin_config( 'localcmd', value + " %s" )
|
||||
else:
|
||||
weechat.set_plugin_config( 'localcmd', value )
|
||||
elif name == "remotecmd":
|
||||
if value.find( "%s" ) == -1:
|
||||
weechat.set_plugin_config( 'remotecmd', value + " %s" )
|
||||
else:
|
||||
weechat.set_plugin_config( 'remotecmd', value )
|
||||
elif self.has(name):
|
||||
weechat.set_plugin_config( name, value )
|
||||
if name == "historysize":
|
||||
urlGrab.setHistorysize(int(value))
|
||||
else:
|
||||
raise KeyError( name )
|
||||
|
||||
def get(self, name):
|
||||
if self.has(name):
|
||||
return weechat.get_plugin_config(name)
|
||||
else:
|
||||
raise KeyError( name )
|
||||
|
||||
def prnt(self, name, verbose = True):
|
||||
weechat.prnt( " %s = %s" % (name.ljust(11), self.get(name)) )
|
||||
if verbose:
|
||||
weechat.prnt( " -> %s" % (self.settings[name].description) )
|
||||
|
||||
def prntall(self):
|
||||
for key in self.names():
|
||||
self.prnt(key, verbose = False)
|
||||
|
||||
def createCmdList(self, url):
|
||||
if weechat.get_plugin_config( 'method' ) == 'remote':
|
||||
tmplist = weechat.get_plugin_config( 'remotessh' ).split(" ")
|
||||
tmplist.append(weechat.get_plugin_config( 'remotehost' ))
|
||||
tmplist.append(weechat.get_plugin_config( 'remotecmd' ) % (url))
|
||||
else:
|
||||
tmplist = (weechat.get_plugin_config( 'localcmd' ) % (url) ).split(" ")
|
||||
return tmplist
|
||||
|
||||
class UrlGrabber:
|
||||
def __init__(self, historysize):
|
||||
# init
|
||||
self.urls = {}
|
||||
self.historysize = 5
|
||||
# control
|
||||
self.setHistorysize(historysize)
|
||||
|
||||
def setHistorysize(self, count):
|
||||
if count > 1:
|
||||
self.historysize = count
|
||||
|
||||
def getHistorysize(self):
|
||||
return self.historysize
|
||||
|
||||
def addUrl(self, url, channel, server):
|
||||
# check for server
|
||||
if not self.urls.has_key(server):
|
||||
self.urls[server] = {}
|
||||
# check for chan
|
||||
if not self.urls[server].has_key(channel):
|
||||
self.urls[server][channel] = []
|
||||
# add url
|
||||
if url in self.urls[server][channel]:
|
||||
self.urls[server][channel].remove(url)
|
||||
self.urls[server][channel].insert(0, url)
|
||||
# removing old urls
|
||||
while len(self.urls[server][channel]) > self.historysize:
|
||||
self.urls[server][channel].pop()
|
||||
|
||||
def hasIndex( self, index, channel, server ):
|
||||
return self.urls.has_key(server) and \
|
||||
self.urls[server].has_key(channel) and \
|
||||
len(self.url[server][channel]) >= index
|
||||
|
||||
def hasChannel( self, channel, server ):
|
||||
return self.urls.has_key(server) and \
|
||||
self.urls[server].has_key(channel)
|
||||
|
||||
def hasServer( self, server ):
|
||||
return self.urls.has_key(server)
|
||||
|
||||
def getUrl(self, index, channel, server):
|
||||
url = ""
|
||||
if self.urls.has_key(server):
|
||||
if self.urls[server].has_key(channel):
|
||||
if len(self.urls[server][channel]) >= index:
|
||||
url = self.urls[server][channel][index-1]
|
||||
return url
|
||||
|
||||
|
||||
def prnt(self, channel, server):
|
||||
found = True
|
||||
if self.urls.has_key(server):
|
||||
if self.urls[server].has_key(channel):
|
||||
urlGrabPrint(channel + "@" + server)
|
||||
if len(self.urls[server][channel]) > 0:
|
||||
i = 1
|
||||
for url in self.urls[server][channel]:
|
||||
weechat.prnt(" --> " + str(i) + " : " + url)
|
||||
i += 1
|
||||
else:
|
||||
found = False
|
||||
elif channel == "*":
|
||||
for channel in self.urls[server].keys():
|
||||
self.prnt(channel, server)
|
||||
else:
|
||||
found = False
|
||||
else:
|
||||
found = False
|
||||
|
||||
if not found:
|
||||
urlGrabPrint(channel + "@" + server + ": no entries")
|
||||
|
||||
def urlGrabParsemsg(command):
|
||||
infos = command.split(" ")
|
||||
chan = infos[2]
|
||||
message = " ".join(infos[3:])[1:]
|
||||
return (chan, message)
|
||||
|
||||
def urlGrabCheck(server, args):
|
||||
global urlGrab
|
||||
chan, message = urlGrabParsemsg(args)
|
||||
# Ignore output from 'tinyurl.py'
|
||||
if message.startswith( "[AKA] http://tinyurl.com" ):
|
||||
return weechat.PLUGIN_RC_OK
|
||||
# Check for URLs
|
||||
for word in message.split(" "):
|
||||
if word[0:7] == "http://" or \
|
||||
word[0:8] == "https://" or \
|
||||
word[0:6] == "ftp://":
|
||||
urlGrab.addUrl(word, chan, server)
|
||||
# check for any dead children and clean them up
|
||||
while True:
|
||||
try:
|
||||
mypid, status = os.waitpid(0, os.WNOHANG)
|
||||
except:
|
||||
break
|
||||
else:
|
||||
if mypid <= 0:
|
||||
break
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
def urlGrabOpen(index, channel = None):
|
||||
global urlGrab, urlGrabSettings
|
||||
|
||||
server = weechat.get_info("server")
|
||||
if channel is None or channel == "":
|
||||
channel = weechat.get_info("channel")
|
||||
|
||||
if channel == "":
|
||||
urlGrabPrint( "No current channel, you must specify one" )
|
||||
elif not urlGrab.hasChannel( channel, server ):
|
||||
urlGrabPrint("No URL found - Invalid channel")
|
||||
else:
|
||||
if index <= 0:
|
||||
urlGrabPrint("No URL found - Invalid index")
|
||||
return
|
||||
url = urlGrab.getUrl(index, channel, server)
|
||||
if url == "":
|
||||
urlGrabPrint("No URL found - Invalid index")
|
||||
else:
|
||||
urlGrabPrint("loading %s %sly" % (url, urlGrabSettings.get("method")))
|
||||
logfile = os.path.expanduser( urlGrabSettings.get( 'cmdlog' ) )
|
||||
|
||||
argl = urlGrabSettings.createCmdList( url )
|
||||
dout = open(logfile, "w")
|
||||
dout.write( "UrlGrab: Running '%s'\n" % (" ".join(argl)) )
|
||||
dout.close()
|
||||
try:
|
||||
childpid = os.fork()
|
||||
except:
|
||||
urlGrabPrint("Fork failed!")
|
||||
if childpid == 0:
|
||||
# in the child- Detach from tty and Exec the command
|
||||
logfile = os.path.expanduser( urlGrabSettings.get( 'cmdlog' ) )
|
||||
din = open("/dev/null", "r")
|
||||
dout = open(logfile, "a")
|
||||
try:
|
||||
# Redirect IO for the child
|
||||
os.dup2(din.fileno(), 0)
|
||||
os.dup2(dout.fileno(), 1)
|
||||
os.dup2(dout.fileno(), 2)
|
||||
except:
|
||||
dout.write( "UrlGrab: IO Redirection failed\n" )
|
||||
dout.close()
|
||||
din.close()
|
||||
sys.exit(1)
|
||||
try:
|
||||
# Actually run the command
|
||||
os.execvp( argl[0], argl )
|
||||
except:
|
||||
dout.write( "UrlGrab: Exec failed" )
|
||||
dout.close()
|
||||
din.close()
|
||||
sys.exit(1)
|
||||
else:
|
||||
# In the parent - Don't wait now, wait later.
|
||||
return
|
||||
|
||||
def urlGrabList( args ):
|
||||
global urlGrab
|
||||
channel = ""
|
||||
if len(args) == 0:
|
||||
channel = weechat.get_info("channel")
|
||||
else:
|
||||
channel = args[0]
|
||||
|
||||
if channel == "" or channel == "all":
|
||||
channel = "*"
|
||||
urlGrab.prnt(channel, weechat.get_info("server"))
|
||||
|
||||
def urlGrabHelp():
|
||||
weechat.prnt("")
|
||||
urlGrabPrint("Help")
|
||||
weechat.prnt(" Usage : ")
|
||||
weechat.prnt(" /url help")
|
||||
weechat.prnt(" -> display this help")
|
||||
weechat.prnt(" /url list [channel]")
|
||||
weechat.prnt(" -> display list of recorded urls in the specified channel")
|
||||
weechat.prnt(" If no channel is given, lists the current channel")
|
||||
weechat.prnt(" /url set [name [[=] value]]")
|
||||
weechat.prnt(" -> set or get one of the parameters")
|
||||
weechat.prnt(" /url n [channel]")
|
||||
weechat.prnt(" -> launch the nth url in `/url list`")
|
||||
weechat.prnt(" or the nth url in the specified channel")
|
||||
weechat.prnt("")
|
||||
|
||||
def urlGrabMain(server, args):
|
||||
largs = args.split(" ")
|
||||
#strip spaces
|
||||
while '' in largs:
|
||||
largs.remove('')
|
||||
while ' ' in largs:
|
||||
largs.remove(' ')
|
||||
if len(largs) == 0:
|
||||
urlGrabHelp()
|
||||
else:
|
||||
if largs[0] == 'help':
|
||||
urlGrabHelp()
|
||||
elif largs[0] == 'list':
|
||||
urlGrabList( largs[1:] )
|
||||
elif largs[0] == 'set':
|
||||
try:
|
||||
if (len(largs) == 1):
|
||||
urlGrabPrint( "Available settings:" )
|
||||
urlGrabSettings.prntall()
|
||||
elif (len(largs) == 2):
|
||||
name = largs[1]
|
||||
urlGrabPrint( "Get %s" % name )
|
||||
urlGrabSettings.prnt( name )
|
||||
elif (len(largs) > 2):
|
||||
name = largs[1]
|
||||
value = None
|
||||
if( largs[2] != "="):
|
||||
value = " ".join(largs[2:])
|
||||
elif( largs > 3 and largs[2] == "=" ):
|
||||
value = " ".join(largs[3:])
|
||||
urlGrabPrint( "set %s = \'%s\'" % (name, value) )
|
||||
if value is not None:
|
||||
try:
|
||||
urlGrabSettings.set( name, value )
|
||||
urlGrabSettings.prnt( name, verbose=False )
|
||||
except ValueError, msg:
|
||||
weechat.prnt( " Failed: %s" % msg )
|
||||
else:
|
||||
weechat.prnt( " Failed: No value given" )
|
||||
except KeyError:
|
||||
weechat.prnt( " Failed: Unrecognized parameter '%s'" % name )
|
||||
else:
|
||||
try:
|
||||
no = int(largs[0])
|
||||
if len(largs) > 1:
|
||||
urlGrabOpen(no, largs[1])
|
||||
else:
|
||||
urlGrabOpen(no)
|
||||
except ValueError:
|
||||
urlGrabPrint( "Unknown command '%s'. Try '/url help' for usage" % largs[0])
|
||||
return weechat.PLUGIN_RC_OK
|
||||
|
||||
# Initialize global variables
|
||||
urlGrabSettings = UrlGrabSettings()
|
||||
urlGrab = UrlGrabber( urlGrabSettings.get('historysize') )
|
||||
@@ -0,0 +1,20 @@
|
||||
# ==================================================================================================
|
||||
# myuptime.rb (c) April 2006 by David DEMONCHY (fusco) <fusco.spv@gmail.com>
|
||||
#
|
||||
# Licence : GPL v2
|
||||
# Description : Print machine uptime in the current canal
|
||||
# Syntax : /myuptime
|
||||
# => <nick> uptime <hostname> : 00:16:58 up 11:09, 4 users, load average: 0.05, 0.21, 0.29
|
||||
#
|
||||
# ==================================================================================================
|
||||
|
||||
def weechat_init
|
||||
Weechat.register("myuptime", "0.1", "", "Script ruby WeeChat for display my uptime")
|
||||
Weechat.add_command_handler("myuptime", "myuptime")
|
||||
return Weechat::PLUGIN_RC_OK
|
||||
end
|
||||
|
||||
def myuptime(server, args)
|
||||
Weechat.command("/me uptime "+ `hostname`.chomp + ":" + `uptime`.chomp)
|
||||
return Weechat::PLUGIN_RC_OK
|
||||
end
|
||||
@@ -0,0 +1,66 @@
|
||||
# =============================================================================
|
||||
# wee-now-playing.rb (c) March 2006 by Tassilo Horn <heimdall@uni-koblenz.de>
|
||||
#
|
||||
# Licence : GPL v2
|
||||
# Description : Print what amaroK or moc is playing
|
||||
# Syntax : /np
|
||||
# => <nick> is listening to <Artist> - <Title>
|
||||
# Precond : needs Ruby (1.8) and amaroK or moc (Music on Console)
|
||||
#
|
||||
# =============================================================================
|
||||
|
||||
def get_np_info
|
||||
artist = title = ""
|
||||
catch( :info_available ) do
|
||||
# AMAROK
|
||||
# ======
|
||||
# The dcopfind returns the string "DCOPRef(amarok,)" if amaroK is
|
||||
# running, "" otherwise. So if the string is longer than 0 we can get
|
||||
# the track.
|
||||
if `dcopfind amarok`.length > 0
|
||||
artist = `dcop amarok player artist`.chomp
|
||||
title = `dcop amarok player title`.chomp
|
||||
throw( :info_available )
|
||||
end
|
||||
|
||||
# MOCP
|
||||
# ====
|
||||
# Amarok was not running, so check if mocp plays something!
|
||||
if !`ps -e | grep mocp`.empty?
|
||||
info_string = `mocp -i`
|
||||
if !(info_string =~ /^State: STOP/)
|
||||
info_string.grep(/^Artist:|^SongTitle:/) do |line|
|
||||
if line =~ /^Artist:/
|
||||
artist = line.gsub!(/^Artist:/, '').strip!
|
||||
else
|
||||
title = line.gsub!(/^SongTitle:/, '').strip!
|
||||
end
|
||||
end
|
||||
throw( :info_available )
|
||||
end
|
||||
end
|
||||
end
|
||||
if !artist.empty? && !title.empty?
|
||||
"#{artist} - #{title}"
|
||||
else
|
||||
""
|
||||
end
|
||||
end
|
||||
|
||||
def bye(server='', args='')
|
||||
return Weechat::PLUGIN_RC_OK
|
||||
end
|
||||
|
||||
def print_now_playing(server='', args='')
|
||||
np_string = get_np_info
|
||||
if np_string.empty?
|
||||
np_string = "nothing"
|
||||
end
|
||||
Weechat.command( "/me listenes to " + np_string + "." )
|
||||
end
|
||||
|
||||
def weechat_init
|
||||
Weechat.register("wee-now-playing", "0.1", "bye", "print now-playing infos")
|
||||
Weechat.add_command_handler("np", "print_now_playing")
|
||||
return Weechat::PLUGIN_RC_OK
|
||||
end
|
||||
@@ -21,6 +21,8 @@ noinst_LIBRARIES = lib_weechat_main.a
|
||||
|
||||
lib_weechat_main_a_SOURCES = weechat.c \
|
||||
weechat.h \
|
||||
alias.c \
|
||||
alias.h \
|
||||
backtrace.c \
|
||||
backtrace.h \
|
||||
command.c \
|
||||
|
||||
@@ -0,0 +1,367 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2006 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/* alias.c: WeeChat alias */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "alias.h"
|
||||
#include "util.h"
|
||||
#include "../irc/irc.h"
|
||||
|
||||
|
||||
t_weechat_alias *weechat_alias = NULL;
|
||||
t_weechat_alias *weechat_last_alias = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* alias_search: search an alias
|
||||
*/
|
||||
|
||||
t_weechat_alias *
|
||||
alias_search (char *alias_name)
|
||||
{
|
||||
t_weechat_alias *ptr_alias;
|
||||
|
||||
for (ptr_alias = weechat_alias; ptr_alias; ptr_alias = ptr_alias->next_alias)
|
||||
{
|
||||
if (ascii_strcasecmp (alias_name, ptr_alias->alias_name) == 0)
|
||||
return ptr_alias;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* alias_find_pos: find position for an alias (for sorting aliases)
|
||||
*/
|
||||
|
||||
t_weechat_alias *
|
||||
alias_find_pos (char *alias_name)
|
||||
{
|
||||
t_weechat_alias *ptr_alias;
|
||||
|
||||
for (ptr_alias = weechat_alias; ptr_alias; ptr_alias = ptr_alias->next_alias)
|
||||
{
|
||||
if (ascii_strcasecmp (alias_name, ptr_alias->alias_name) < 0)
|
||||
return ptr_alias;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* alias_insert_sorted: insert alias into sorted list
|
||||
*/
|
||||
|
||||
void
|
||||
alias_insert_sorted (t_weechat_alias *alias)
|
||||
{
|
||||
t_weechat_alias *pos_alias;
|
||||
|
||||
pos_alias = alias_find_pos (alias->alias_name);
|
||||
|
||||
if (weechat_alias)
|
||||
{
|
||||
if (pos_alias)
|
||||
{
|
||||
/* insert alias into the list (before alias found) */
|
||||
alias->prev_alias = pos_alias->prev_alias;
|
||||
alias->next_alias = pos_alias;
|
||||
if (pos_alias->prev_alias)
|
||||
pos_alias->prev_alias->next_alias = alias;
|
||||
else
|
||||
weechat_alias = alias;
|
||||
pos_alias->prev_alias = alias;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* add alias to the end */
|
||||
alias->prev_alias = weechat_last_alias;
|
||||
alias->next_alias = NULL;
|
||||
weechat_last_alias->next_alias = alias;
|
||||
weechat_last_alias = alias;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
alias->prev_alias = NULL;
|
||||
alias->next_alias = NULL;
|
||||
weechat_alias = alias;
|
||||
weechat_last_alias = alias;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* alias_new: create new alias and add it to alias list
|
||||
*/
|
||||
|
||||
t_weechat_alias *
|
||||
alias_new (char *alias_name, char *alias_command)
|
||||
{
|
||||
t_weechat_alias *new_alias, *ptr_alias;
|
||||
|
||||
while (alias_name[0] == '/')
|
||||
{
|
||||
alias_name++;
|
||||
}
|
||||
|
||||
if (ascii_strcasecmp (alias_name, "builtin") == 0)
|
||||
return NULL;
|
||||
|
||||
ptr_alias = alias_search (alias_name);
|
||||
if (ptr_alias)
|
||||
{
|
||||
if (ptr_alias->alias_command)
|
||||
free (ptr_alias->alias_command);
|
||||
ptr_alias->alias_command = strdup (alias_command);
|
||||
return ptr_alias;
|
||||
}
|
||||
|
||||
if ((new_alias = ((t_weechat_alias *) malloc (sizeof (t_weechat_alias)))))
|
||||
{
|
||||
new_alias->alias_name = strdup (alias_name);
|
||||
new_alias->alias_command = (char *) malloc (strlen (alias_command) + 1);
|
||||
new_alias->running = 0;
|
||||
if (new_alias->alias_command)
|
||||
strcpy (new_alias->alias_command, alias_command);
|
||||
alias_insert_sorted (new_alias);
|
||||
return new_alias;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* alias_get_final_command: get final command pointed by an alias
|
||||
*/
|
||||
|
||||
char *
|
||||
alias_get_final_command (t_weechat_alias *alias)
|
||||
{
|
||||
t_weechat_alias *ptr_alias;
|
||||
char *result;
|
||||
|
||||
if (alias->running)
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s circular reference when calling alias \"/%s\"\n"),
|
||||
WEECHAT_ERROR, alias->alias_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ptr_alias = alias_search ((alias->alias_command[0] == '/') ?
|
||||
alias->alias_command + 1 : alias->alias_command);
|
||||
if (ptr_alias)
|
||||
{
|
||||
alias->running = 1;
|
||||
result = alias_get_final_command (ptr_alias);
|
||||
alias->running = 0;
|
||||
return result;
|
||||
}
|
||||
return (alias->alias_command[0] == '/') ?
|
||||
alias->alias_command + 1 : alias->alias_command;
|
||||
}
|
||||
|
||||
/*
|
||||
* alias_add_word: add word to string and increment length
|
||||
* This function should NOT be called directly.
|
||||
*/
|
||||
|
||||
void
|
||||
alias_add_word (char **alias, int *length, char *word)
|
||||
{
|
||||
int length_word;
|
||||
|
||||
if (!word)
|
||||
return;
|
||||
|
||||
length_word = strlen (word);
|
||||
if (length_word == 0)
|
||||
return;
|
||||
|
||||
if (*alias == NULL)
|
||||
{
|
||||
*alias = (char *) malloc (length_word + 1);
|
||||
strcpy (*alias, word);
|
||||
}
|
||||
else
|
||||
{
|
||||
*alias = realloc (*alias, strlen (*alias) + length_word + 1);
|
||||
strcat (*alias, word);
|
||||
}
|
||||
*length += length_word;
|
||||
}
|
||||
|
||||
/*
|
||||
* alias_replace_args: replace arguments ($1, $2, .. or $*) in alias arguments
|
||||
*/
|
||||
|
||||
char *
|
||||
alias_replace_args (char *alias_args, char *user_args)
|
||||
{
|
||||
char **argv, *start, *pos, *res;
|
||||
int argc, length_res;
|
||||
|
||||
argv = explode_string (user_args, " ", 0, &argc);
|
||||
|
||||
res = NULL;
|
||||
length_res = 0;
|
||||
start = alias_args;
|
||||
pos = start;
|
||||
while (pos && pos[0])
|
||||
{
|
||||
if ((pos[0] == '\\') && (pos[1] == '$'))
|
||||
{
|
||||
pos[0] = '\0';
|
||||
alias_add_word (&res, &length_res, start);
|
||||
alias_add_word (&res, &length_res, "$");
|
||||
pos[0] = '\\';
|
||||
start = pos + 2;
|
||||
pos = start;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pos[0] == '$')
|
||||
{
|
||||
if (pos[1] == '*')
|
||||
{
|
||||
pos[0] = '\0';
|
||||
alias_add_word (&res, &length_res, start);
|
||||
alias_add_word (&res, &length_res, user_args);
|
||||
pos[0] = '$';
|
||||
start = pos + 2;
|
||||
pos = start;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((pos[1] >= '1') && (pos[1] <= '9'))
|
||||
{
|
||||
pos[0] = '\0';
|
||||
alias_add_word (&res, &length_res, start);
|
||||
if (pos[1] - '0' <= argc)
|
||||
alias_add_word (&res, &length_res, argv[pos[1] - '1']);
|
||||
pos[0] = '$';
|
||||
start = pos + 2;
|
||||
pos = start;
|
||||
}
|
||||
else
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
else
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
if (argv)
|
||||
free_exploded_string (argv);
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* alias_replace_vars: replace special vars ($nick, $channel, $server) in a string
|
||||
*/
|
||||
|
||||
char *
|
||||
alias_replace_vars (char *string)
|
||||
{
|
||||
char *nick, *channel, *server;
|
||||
char empty_string[1] = { '\0' };
|
||||
char *res, *temp;
|
||||
|
||||
nick = (SERVER(gui_current_window->buffer)
|
||||
&& SERVER(gui_current_window->buffer)->nick) ?
|
||||
SERVER(gui_current_window->buffer)->nick : empty_string;
|
||||
channel = (CHANNEL(gui_current_window->buffer)) ?
|
||||
CHANNEL(gui_current_window->buffer)->name : empty_string;
|
||||
server = (SERVER(gui_current_window->buffer)) ?
|
||||
SERVER(gui_current_window->buffer)->name : empty_string;
|
||||
|
||||
/* replace nick */
|
||||
temp = weechat_strreplace (string, "$nick", nick);
|
||||
if (!temp)
|
||||
return NULL;
|
||||
res = temp;
|
||||
|
||||
/* replace channel */
|
||||
temp = weechat_strreplace (res, "$channel", channel);
|
||||
free (res);
|
||||
if (!temp)
|
||||
return NULL;
|
||||
res = temp;
|
||||
|
||||
/* replace server */
|
||||
temp = weechat_strreplace (res, "$server", server);
|
||||
free (res);
|
||||
if (!temp)
|
||||
return NULL;
|
||||
res = temp;
|
||||
|
||||
/* return result */
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* alias_free: free an alias and reomve it from list
|
||||
*/
|
||||
|
||||
void
|
||||
alias_free (t_weechat_alias *alias)
|
||||
{
|
||||
t_weechat_alias *new_weechat_alias;
|
||||
|
||||
/* remove alias from list */
|
||||
if (weechat_last_alias == alias)
|
||||
weechat_last_alias = alias->prev_alias;
|
||||
if (alias->prev_alias)
|
||||
{
|
||||
(alias->prev_alias)->next_alias = alias->next_alias;
|
||||
new_weechat_alias = weechat_alias;
|
||||
}
|
||||
else
|
||||
new_weechat_alias = alias->next_alias;
|
||||
|
||||
if (alias->next_alias)
|
||||
(alias->next_alias)->prev_alias = alias->prev_alias;
|
||||
|
||||
/* free data */
|
||||
if (alias->alias_name)
|
||||
free (alias->alias_name);
|
||||
if (alias->alias_command)
|
||||
free (alias->alias_command);
|
||||
free (alias);
|
||||
weechat_alias = new_weechat_alias;
|
||||
}
|
||||
|
||||
/*
|
||||
* alias_free_all: free all alias
|
||||
*/
|
||||
|
||||
void
|
||||
alias_free_all ()
|
||||
{
|
||||
while (weechat_alias)
|
||||
alias_free (weechat_alias);
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2006 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_ALIAS_H
|
||||
#define __WEECHAT_ALIAS_H 1
|
||||
|
||||
typedef struct t_weechat_alias t_weechat_alias;
|
||||
|
||||
struct t_weechat_alias
|
||||
{
|
||||
char *alias_name;
|
||||
char *alias_command;
|
||||
int running;
|
||||
t_weechat_alias *prev_alias;
|
||||
t_weechat_alias *next_alias;
|
||||
};
|
||||
|
||||
extern t_weechat_alias *weechat_alias;
|
||||
extern t_weechat_alias *weechat_last_alias;
|
||||
|
||||
extern t_weechat_alias *alias_search (char *);
|
||||
extern t_weechat_alias *alias_new (char *, char *);
|
||||
extern char *alias_get_final_command (t_weechat_alias *);
|
||||
extern char *alias_replace_args (char *, char *);
|
||||
extern char *alias_replace_vars (char *);
|
||||
extern void alias_free (t_weechat_alias *);
|
||||
extern void alias_free_all ();
|
||||
|
||||
#endif /* alias.h */
|
||||
@@ -28,7 +28,11 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifndef __USE_GNU
|
||||
#define __USE_GNU
|
||||
#endif
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
#ifdef HAVE_BACKTRACE
|
||||
|
||||
+192
-496
@@ -30,6 +30,7 @@
|
||||
|
||||
#include "weechat.h"
|
||||
#include "command.h"
|
||||
#include "alias.h"
|
||||
#include "fifo.h"
|
||||
#include "log.h"
|
||||
#include "session.h"
|
||||
@@ -53,7 +54,9 @@ 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"),
|
||||
"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."),
|
||||
"%- %A", 0, MAX_ARGS, 1, NULL, weechat_cmd_alias },
|
||||
{ "buffer", N_("manage buffers"),
|
||||
N_("[action [args] | number | [[server] [channel]]]"),
|
||||
@@ -62,7 +65,8 @@ t_weechat_command weechat_commands[] =
|
||||
" close: close buffer (optional arg is part message, for a channel)\n"
|
||||
" list: list open buffers (no parameter implies this list)\n"
|
||||
" notify: set notify level for buffer (0=never, 1=highlight, 2=1+msg, 3=2+join/part)\n"
|
||||
"server\n"
|
||||
" (when executed on server buffer, this sets default notify level for whole server)\n"
|
||||
"server,\n"
|
||||
"channel: jump to buffer by server and/or channel name\n"
|
||||
" number: jump to buffer by number"),
|
||||
"move|close|list|notify", 0, MAX_ARGS, 0, NULL, weechat_cmd_buffer },
|
||||
@@ -121,8 +125,8 @@ 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: bind this key to an internal function or a command "
|
||||
N_("[key [function/command]] [unbind key] [functions] [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"
|
||||
@@ -225,9 +229,6 @@ t_weechat_command weechat_commands[] =
|
||||
{ NULL, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL }
|
||||
};
|
||||
|
||||
t_weechat_alias *weechat_alias = NULL;
|
||||
t_weechat_alias *weechat_last_alias = NULL;
|
||||
|
||||
t_weelist *index_commands;
|
||||
t_weelist *last_index_command;
|
||||
|
||||
@@ -274,403 +275,6 @@ command_index_free ()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* alias_search: search an alias
|
||||
*/
|
||||
|
||||
t_weechat_alias *
|
||||
alias_search (char *alias_name)
|
||||
{
|
||||
t_weechat_alias *ptr_alias;
|
||||
|
||||
for (ptr_alias = weechat_alias; ptr_alias; ptr_alias = ptr_alias->next_alias)
|
||||
{
|
||||
if (ascii_strcasecmp (alias_name, ptr_alias->alias_name) == 0)
|
||||
return ptr_alias;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* alias_find_pos: find position for an alias (for sorting aliases)
|
||||
*/
|
||||
|
||||
t_weechat_alias *
|
||||
alias_find_pos (char *alias_name)
|
||||
{
|
||||
t_weechat_alias *ptr_alias;
|
||||
|
||||
for (ptr_alias = weechat_alias; ptr_alias; ptr_alias = ptr_alias->next_alias)
|
||||
{
|
||||
if (ascii_strcasecmp (alias_name, ptr_alias->alias_name) < 0)
|
||||
return ptr_alias;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* alias_insert_sorted: insert alias into sorted list
|
||||
*/
|
||||
|
||||
void
|
||||
alias_insert_sorted (t_weechat_alias *alias)
|
||||
{
|
||||
t_weechat_alias *pos_alias;
|
||||
|
||||
pos_alias = alias_find_pos (alias->alias_name);
|
||||
|
||||
if (weechat_alias)
|
||||
{
|
||||
if (pos_alias)
|
||||
{
|
||||
/* insert alias into the list (before alias found) */
|
||||
alias->prev_alias = pos_alias->prev_alias;
|
||||
alias->next_alias = pos_alias;
|
||||
if (pos_alias->prev_alias)
|
||||
pos_alias->prev_alias->next_alias = alias;
|
||||
else
|
||||
weechat_alias = alias;
|
||||
pos_alias->prev_alias = alias;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* add alias to the end */
|
||||
alias->prev_alias = weechat_last_alias;
|
||||
alias->next_alias = NULL;
|
||||
weechat_last_alias->next_alias = alias;
|
||||
weechat_last_alias = alias;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
alias->prev_alias = NULL;
|
||||
alias->next_alias = NULL;
|
||||
weechat_alias = alias;
|
||||
weechat_last_alias = alias;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* alias_new: create new alias and add it to alias list
|
||||
*/
|
||||
|
||||
t_weechat_alias *
|
||||
alias_new (char *alias_name, char *alias_command)
|
||||
{
|
||||
t_weechat_alias *new_alias, *ptr_alias;
|
||||
|
||||
while (alias_name[0] == '/')
|
||||
{
|
||||
alias_name++;
|
||||
}
|
||||
|
||||
if (ascii_strcasecmp (alias_name, "builtin") == 0)
|
||||
return NULL;
|
||||
|
||||
ptr_alias = alias_search (alias_name);
|
||||
if (ptr_alias)
|
||||
{
|
||||
if (ptr_alias->alias_command)
|
||||
free (ptr_alias->alias_command);
|
||||
ptr_alias->alias_command = strdup (alias_command);
|
||||
return ptr_alias;
|
||||
}
|
||||
|
||||
if ((new_alias = ((t_weechat_alias *) malloc (sizeof (t_weechat_alias)))))
|
||||
{
|
||||
new_alias->alias_name = strdup (alias_name);
|
||||
new_alias->alias_command = (char *) malloc (strlen (alias_command) + 1);
|
||||
new_alias->running = 0;
|
||||
if (new_alias->alias_command)
|
||||
strcpy (new_alias->alias_command, alias_command);
|
||||
alias_insert_sorted (new_alias);
|
||||
return new_alias;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* alias_get_final_command: get final command pointer by an alias
|
||||
*/
|
||||
|
||||
char *
|
||||
alias_get_final_command (t_weechat_alias *alias)
|
||||
{
|
||||
t_weechat_alias *ptr_alias;
|
||||
char *result;
|
||||
|
||||
if (alias->running)
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s circular reference when calling alias \"/%s\"\n"),
|
||||
WEECHAT_ERROR, alias->alias_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ptr_alias = alias_search ((alias->alias_command[0] == '/') ?
|
||||
alias->alias_command + 1 : alias->alias_command);
|
||||
if (ptr_alias)
|
||||
{
|
||||
alias->running = 1;
|
||||
result = alias_get_final_command (ptr_alias);
|
||||
alias->running = 0;
|
||||
return result;
|
||||
}
|
||||
return (alias->alias_command[0] == '/') ?
|
||||
alias->alias_command + 1 : alias->alias_command;
|
||||
}
|
||||
|
||||
/*
|
||||
* alias_free: free an alias and reomve it from list
|
||||
*/
|
||||
|
||||
void
|
||||
alias_free (t_weechat_alias *alias)
|
||||
{
|
||||
t_weechat_alias *new_weechat_alias;
|
||||
|
||||
/* remove alias from list */
|
||||
if (weechat_last_alias == alias)
|
||||
weechat_last_alias = alias->prev_alias;
|
||||
if (alias->prev_alias)
|
||||
{
|
||||
(alias->prev_alias)->next_alias = alias->next_alias;
|
||||
new_weechat_alias = weechat_alias;
|
||||
}
|
||||
else
|
||||
new_weechat_alias = alias->next_alias;
|
||||
|
||||
if (alias->next_alias)
|
||||
(alias->next_alias)->prev_alias = alias->prev_alias;
|
||||
|
||||
/* free data */
|
||||
if (alias->alias_name)
|
||||
free (alias->alias_name);
|
||||
if (alias->alias_command)
|
||||
free (alias->alias_command);
|
||||
free (alias);
|
||||
weechat_alias = new_weechat_alias;
|
||||
}
|
||||
|
||||
/*
|
||||
* alias_free_all: free all alias
|
||||
*/
|
||||
|
||||
void
|
||||
alias_free_all ()
|
||||
{
|
||||
while (weechat_alias)
|
||||
alias_free (weechat_alias);
|
||||
}
|
||||
|
||||
/*
|
||||
* explode_string: explode a string according to separators
|
||||
*/
|
||||
|
||||
char **
|
||||
explode_string (char *string, char *separators, int num_items_max,
|
||||
int *num_items)
|
||||
{
|
||||
int i, n_items;
|
||||
char **array;
|
||||
char *ptr, *ptr1, *ptr2;
|
||||
|
||||
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)))
|
||||
{
|
||||
while (strchr (separators, ptr[0]) != NULL)
|
||||
ptr++;
|
||||
i++;
|
||||
}
|
||||
n_items = i;
|
||||
}
|
||||
|
||||
array =
|
||||
(char **) malloc ((num_items_max ? n_items : n_items + 1) *
|
||||
sizeof (char *));
|
||||
|
||||
ptr1 = string;
|
||||
ptr2 = string;
|
||||
|
||||
for (i = 0; i < n_items; i++)
|
||||
{
|
||||
while (strchr (separators, ptr1[0]) != NULL)
|
||||
ptr1++;
|
||||
if (i == (n_items - 1) || (ptr2 = strpbrk (ptr1, separators)) == NULL)
|
||||
if ((ptr2 = strchr (ptr1, '\r')) == NULL)
|
||||
if ((ptr2 = strchr (ptr1, '\n')) == NULL)
|
||||
ptr2 = strchr (ptr1, '\0');
|
||||
|
||||
if ((ptr1 == NULL) || (ptr2 == NULL))
|
||||
{
|
||||
array[i] = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ptr2 - ptr1 > 0)
|
||||
{
|
||||
array[i] =
|
||||
(char *) malloc ((ptr2 - ptr1 + 1) * sizeof (char));
|
||||
array[i] = strncpy (array[i], ptr1, ptr2 - ptr1);
|
||||
array[i][ptr2 - ptr1] = '\0';
|
||||
ptr1 = ++ptr2;
|
||||
}
|
||||
else
|
||||
{
|
||||
array[i] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
/*
|
||||
* free_exploded_string: free an exploded string
|
||||
*/
|
||||
|
||||
void
|
||||
free_exploded_string (char **exploded_string)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (exploded_string)
|
||||
{
|
||||
for (i = 0; exploded_string[i]; i++)
|
||||
free (exploded_string[i]);
|
||||
free (exploded_string);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* split_multi_command: split a serie of commands separated by 'sep'
|
||||
* and ecscaped with '\'
|
||||
* - empty commands are removed
|
||||
* - spaces on the left of each commands are stripped
|
||||
*
|
||||
* result must be freed with free_multi_command
|
||||
*/
|
||||
|
||||
char **
|
||||
split_multi_command (char *command, char sep)
|
||||
{
|
||||
int nb_substr, arr_idx, str_idx, type;
|
||||
char **array;
|
||||
char *buffer, *ptr, *p;
|
||||
|
||||
if (command == NULL)
|
||||
return NULL;
|
||||
|
||||
nb_substr = 1;
|
||||
ptr = command;
|
||||
while ( (p = strchr(ptr, sep)) != NULL)
|
||||
{
|
||||
nb_substr++;
|
||||
ptr = ++p;
|
||||
}
|
||||
|
||||
array = (char **) malloc ((nb_substr + 1) * sizeof(char *));
|
||||
if (!array)
|
||||
return NULL;
|
||||
|
||||
buffer = (char *) malloc ( (strlen(command) + 1) * sizeof (char));
|
||||
if (!buffer)
|
||||
{
|
||||
free (array);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ptr = command;
|
||||
str_idx = 0;
|
||||
arr_idx = 0;
|
||||
while(*ptr != '\0')
|
||||
{
|
||||
type = 0;
|
||||
if (*ptr == ';')
|
||||
{
|
||||
if (ptr == command)
|
||||
type = 1;
|
||||
else if ( *(ptr-1) != '\\')
|
||||
type = 1;
|
||||
else if ( *(ptr-1) == '\\')
|
||||
type = 2;
|
||||
}
|
||||
if (type == 1)
|
||||
{
|
||||
buffer[str_idx] = '\0';
|
||||
str_idx = -1;
|
||||
p = buffer;
|
||||
/* strip white spaces a the begining of the line */
|
||||
while (*p == ' ') p++;
|
||||
if (p && p[0])
|
||||
array[arr_idx++] = strdup (p);
|
||||
}
|
||||
else if (type == 2)
|
||||
buffer[--str_idx] = *ptr;
|
||||
else
|
||||
buffer[str_idx] = *ptr;
|
||||
str_idx++;
|
||||
ptr++;
|
||||
}
|
||||
|
||||
buffer[str_idx] = '\0';
|
||||
p = buffer;
|
||||
while (*p == ' ') p++;
|
||||
if (p && p[0])
|
||||
array[arr_idx++] = strdup (p);
|
||||
|
||||
array[arr_idx] = NULL;
|
||||
|
||||
free (buffer);
|
||||
|
||||
array = (char **) realloc (array, (arr_idx + 1) * sizeof(char *));
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
/*
|
||||
* free_multi_command : free a list of commands splitted
|
||||
* with split_multi_command
|
||||
*/
|
||||
|
||||
void
|
||||
free_multi_command (char **commands)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (commands)
|
||||
{
|
||||
for (i = 0; commands[i]; i++)
|
||||
free (commands[i]);
|
||||
free (commands);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* exec_weechat_command: executes a command (WeeChat internal or IRC)
|
||||
* if only_builtin == 1, then try only WeeChat/IRC commands
|
||||
@@ -687,6 +291,8 @@ exec_weechat_command (t_irc_server *server, t_irc_channel *channel, char *string
|
||||
char *command, *pos, *ptr_args, *ptr_args2, *ptr_args3;
|
||||
char **argv, **argv2, *alias_command;
|
||||
char **commands, **ptr_cmd, **ptr_next_cmd;
|
||||
char *args_replaced, *vars_replaced, *new_ptr_cmd;
|
||||
int some_args_replaced;
|
||||
t_weechat_alias *ptr_alias;
|
||||
|
||||
if ((!string) || (!string[0]) || (string[0] != '/'))
|
||||
@@ -721,7 +327,13 @@ exec_weechat_command (t_irc_server *server, t_irc_channel *channel, char *string
|
||||
if (only_builtin)
|
||||
rc = -1;
|
||||
else
|
||||
rc = plugin_cmd_handler_exec ((server) ? server->name : "", command + 1, ptr_args);
|
||||
{
|
||||
vars_replaced = alias_replace_vars (ptr_args);
|
||||
rc = plugin_cmd_handler_exec ((server) ? server->name : "", command + 1,
|
||||
(vars_replaced) ? vars_replaced : ptr_args);
|
||||
if (vars_replaced)
|
||||
free (vars_replaced);
|
||||
}
|
||||
#else
|
||||
rc = -1;
|
||||
#endif
|
||||
@@ -755,55 +367,82 @@ exec_weechat_command (t_irc_server *server, t_irc_channel *channel, char *string
|
||||
}
|
||||
else
|
||||
{
|
||||
/* an alias can contain many commandes separated by ';' */
|
||||
/* an alias can contain many commands separated by ';' */
|
||||
commands = split_multi_command (ptr_alias->alias_command, ';');
|
||||
if (commands)
|
||||
{
|
||||
ptr_alias->running = 1;
|
||||
some_args_replaced = 0;
|
||||
ptr_alias->running = 1;
|
||||
for (ptr_cmd=commands; *ptr_cmd; ptr_cmd++)
|
||||
{
|
||||
ptr_next_cmd = ptr_cmd;
|
||||
ptr_next_cmd++;
|
||||
|
||||
if (*ptr_next_cmd == NULL && ptr_args)
|
||||
{
|
||||
/* if alias has arguments, they are now
|
||||
arguments of the last command in the list */
|
||||
length1 = strlen (*ptr_cmd);
|
||||
length2 = strlen (ptr_args);
|
||||
|
||||
alias_command = (char *) malloc ( 1 + length1 + 1 + length2 + 1);
|
||||
if (alias_command)
|
||||
{
|
||||
if (*ptr_cmd[0] != '/')
|
||||
strcpy (alias_command, "/");
|
||||
else
|
||||
strcpy (alias_command, "");
|
||||
|
||||
strcat (alias_command, *ptr_cmd);
|
||||
strcat (alias_command, " ");
|
||||
strcat (alias_command, ptr_args);
|
||||
|
||||
(void) exec_weechat_command (server, channel, alias_command, only_builtin);
|
||||
free (alias_command);
|
||||
}
|
||||
}
|
||||
else
|
||||
vars_replaced = alias_replace_vars (*ptr_cmd);
|
||||
new_ptr_cmd = (vars_replaced) ? vars_replaced : *ptr_cmd;
|
||||
args_replaced = alias_replace_args (new_ptr_cmd, ptr_args);
|
||||
if (args_replaced)
|
||||
{
|
||||
some_args_replaced = 1;
|
||||
if (*ptr_cmd[0] == '/')
|
||||
(void) exec_weechat_command (server, channel, *ptr_cmd, only_builtin);
|
||||
(void) exec_weechat_command (server, channel, args_replaced, only_builtin);
|
||||
else
|
||||
{
|
||||
alias_command = (char *) malloc (1 + strlen(*ptr_cmd) + 1);
|
||||
alias_command = (char *) malloc (1 + strlen(args_replaced) + 1);
|
||||
if (alias_command)
|
||||
{
|
||||
strcpy (alias_command, "/");
|
||||
strcat (alias_command, *ptr_cmd);
|
||||
strcat (alias_command, args_replaced);
|
||||
(void) exec_weechat_command (server, channel, alias_command, only_builtin);
|
||||
free (alias_command);
|
||||
}
|
||||
}
|
||||
free (args_replaced);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* if alias has arguments, they are now
|
||||
arguments of the last command in the list (if no $1,$2,..$*) was found */
|
||||
if ((*ptr_next_cmd == NULL) && ptr_args && (!some_args_replaced))
|
||||
{
|
||||
length1 = strlen (new_ptr_cmd);
|
||||
length2 = strlen (ptr_args);
|
||||
|
||||
alias_command = (char *) malloc ( 1 + length1 + 1 + length2 + 1);
|
||||
if (alias_command)
|
||||
{
|
||||
if (*ptr_cmd[0] != '/')
|
||||
strcpy (alias_command, "/");
|
||||
else
|
||||
strcpy (alias_command, "");
|
||||
|
||||
strcat (alias_command, new_ptr_cmd);
|
||||
strcat (alias_command, " ");
|
||||
strcat (alias_command, ptr_args);
|
||||
|
||||
(void) exec_weechat_command (server, channel, alias_command, only_builtin);
|
||||
free (alias_command);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*ptr_cmd[0] == '/')
|
||||
(void) exec_weechat_command (server, channel, new_ptr_cmd, only_builtin);
|
||||
else
|
||||
{
|
||||
alias_command = (char *) malloc (1 + strlen (new_ptr_cmd) + 1);
|
||||
if (alias_command)
|
||||
{
|
||||
strcpy (alias_command, "/");
|
||||
strcat (alias_command, new_ptr_cmd);
|
||||
(void) exec_weechat_command (server, channel, alias_command, only_builtin);
|
||||
free (alias_command);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (vars_replaced)
|
||||
free (vars_replaced);
|
||||
}
|
||||
ptr_alias->running = 0;
|
||||
free_multi_command (commands);
|
||||
@@ -1365,7 +1004,7 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel,
|
||||
t_irc_channel *ptr_channel;
|
||||
long number;
|
||||
char *error, *pos, **argv;
|
||||
int argc, target_buffer;
|
||||
int argc, target_buffer, count;
|
||||
|
||||
irc_find_context (server, channel, &window, &buffer);
|
||||
|
||||
@@ -1445,31 +1084,34 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel,
|
||||
}
|
||||
if (BUFFER_IS_SERVER(buffer))
|
||||
{
|
||||
if (SERVER(buffer)->channels)
|
||||
if (SERVER(buffer))
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s can not close server buffer while channels "
|
||||
"are open\n"),
|
||||
WEECHAT_ERROR);
|
||||
free_exploded_string (argv);
|
||||
return -1;
|
||||
if (SERVER(buffer)->channels)
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s can not close server buffer while channels "
|
||||
"are open\n"),
|
||||
WEECHAT_ERROR);
|
||||
free_exploded_string (argv);
|
||||
return -1;
|
||||
}
|
||||
server_disconnect (SERVER(buffer), 0);
|
||||
ptr_server = SERVER(buffer);
|
||||
if (!buffer->all_servers)
|
||||
{
|
||||
gui_buffer_free (buffer, 1);
|
||||
ptr_server->buffer = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_server->buffer = NULL;
|
||||
buffer->server = NULL;
|
||||
gui_window_switch_server (window);
|
||||
}
|
||||
gui_status_draw (gui_current_window->buffer, 1);
|
||||
gui_input_draw (gui_current_window->buffer, 1);
|
||||
}
|
||||
server_disconnect (SERVER(buffer), 0);
|
||||
ptr_server = SERVER(buffer);
|
||||
if (!buffer->all_servers)
|
||||
{
|
||||
gui_buffer_free (buffer, 1);
|
||||
ptr_server->buffer = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_server->buffer = NULL;
|
||||
buffer->server = NULL;
|
||||
gui_window_switch_server (window);
|
||||
}
|
||||
gui_status_draw (gui_current_window->buffer, 1);
|
||||
gui_input_draw (gui_current_window->buffer, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1519,24 +1161,42 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel,
|
||||
{
|
||||
if (argc < 2)
|
||||
{
|
||||
/* display notify level for all buffers */
|
||||
gui_printf (NULL, "\n");
|
||||
gui_printf (NULL, _("Notify levels: "));
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
|
||||
/* display default notify level for all connected servers */
|
||||
gui_printf (NULL, _("Default notify levels for servers:"));
|
||||
count = 0;
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
gui_printf (NULL, "%d.%s:",
|
||||
if (ptr_server->buffer)
|
||||
{
|
||||
gui_printf (NULL, " %s:%d",
|
||||
ptr_server->name,
|
||||
server_get_default_notify_level (ptr_server));
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if (count == 0)
|
||||
gui_printf (NULL, " -");
|
||||
gui_printf (NULL, "\n");
|
||||
|
||||
/* display notify level for all buffers */
|
||||
gui_printf (NULL, _("Notify levels:"));
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer;
|
||||
ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
gui_printf (NULL, " %d.%s:",
|
||||
ptr_buffer->number,
|
||||
(ptr_buffer->type == BUFFER_TYPE_DCC) ? "DCC" :
|
||||
((ptr_buffer->type == BUFFER_TYPE_RAW_DATA) ? _("Raw IRC data") :
|
||||
((BUFFER_IS_SERVER(ptr_buffer)) ? SERVER(ptr_buffer)->name :
|
||||
CHANNEL(ptr_buffer)->name)));
|
||||
((BUFFER_IS_SERVER(ptr_buffer) && SERVER(ptr_buffer)) ? SERVER(ptr_buffer)->name :
|
||||
((CHANNEL(ptr_buffer)) ? (CHANNEL(ptr_buffer)->name) : "-"))));
|
||||
if ((!BUFFER_IS_CHANNEL(ptr_buffer))
|
||||
&& (!BUFFER_IS_PRIVATE(ptr_buffer)))
|
||||
gui_printf (NULL, "-");
|
||||
else
|
||||
gui_printf (NULL, "%d", ptr_buffer->notify_level);
|
||||
if (ptr_buffer->next_buffer)
|
||||
gui_printf (NULL, " ");
|
||||
}
|
||||
gui_printf (NULL, "\n");
|
||||
}
|
||||
@@ -1556,28 +1216,47 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel,
|
||||
free_exploded_string (argv);
|
||||
return -1;
|
||||
}
|
||||
if ((!BUFFER_IS_CHANNEL(buffer))
|
||||
&& (!BUFFER_IS_PRIVATE(buffer)))
|
||||
if (!SERVER(buffer)
|
||||
|| ((!BUFFER_IS_SERVER(buffer))
|
||||
&& (!BUFFER_IS_CHANNEL(buffer))
|
||||
&& (!BUFFER_IS_PRIVATE(buffer))))
|
||||
{
|
||||
/* invalid buffer type (only ok on channel or private) */
|
||||
/* invalid buffer type (only ok on server, channel or private) */
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL, _("%s incorrect buffer for notify (must be channel or private)\n"),
|
||||
gui_printf (NULL,
|
||||
_("%s incorrect buffer for notify "
|
||||
"(must be server, channel or private)\n"),
|
||||
WEECHAT_ERROR);
|
||||
free_exploded_string (argv);
|
||||
return -1;
|
||||
}
|
||||
buffer->notify_level = number;
|
||||
channel_set_notify_level (SERVER(buffer),
|
||||
CHANNEL(buffer),
|
||||
number);
|
||||
irc_display_prefix (NULL, NULL, PREFIX_INFO);
|
||||
gui_printf (NULL, _("New notify level for %s%s%s: %s%d %s"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
CHANNEL(buffer)->name,
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
number,
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
if (BUFFER_IS_SERVER(buffer))
|
||||
{
|
||||
server_set_default_notify_level (SERVER(buffer),
|
||||
number);
|
||||
irc_display_prefix (NULL, NULL, PREFIX_INFO);
|
||||
gui_printf (NULL, _("New default notify level for server %s%s%s: %s%d %s"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_SERVER),
|
||||
SERVER(buffer)->name,
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
number,
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
}
|
||||
else
|
||||
{
|
||||
channel_set_notify_level (SERVER(buffer),
|
||||
CHANNEL(buffer),
|
||||
number);
|
||||
irc_display_prefix (NULL, NULL, PREFIX_INFO);
|
||||
gui_printf (NULL, _("New notify level for %s%s%s: %s%d %s"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
CHANNEL(buffer)->name,
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
number,
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
}
|
||||
switch (number)
|
||||
{
|
||||
case 0:
|
||||
@@ -1596,6 +1275,7 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel,
|
||||
gui_printf (NULL, "\n");
|
||||
break;
|
||||
}
|
||||
config_change_notify_levels ();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1715,9 +1395,9 @@ weechat_cmd_charset_display (t_gui_buffer *buffer)
|
||||
char *value, *string, *herited;
|
||||
int length;
|
||||
|
||||
if (BUFFER_IS_SERVER(buffer) ||
|
||||
BUFFER_IS_CHANNEL(buffer) ||
|
||||
BUFFER_IS_PRIVATE(buffer))
|
||||
if ((BUFFER_IS_SERVER(buffer) && (SERVER(buffer)))
|
||||
|| BUFFER_IS_CHANNEL(buffer)
|
||||
|| BUFFER_IS_PRIVATE(buffer))
|
||||
{
|
||||
if (BUFFER_IS_SERVER(buffer))
|
||||
{
|
||||
@@ -1866,11 +1546,14 @@ weechat_cmd_charset_set (t_gui_buffer *buffer, char **string, char *charset,
|
||||
}
|
||||
if (BUFFER_IS_SERVER(buffer))
|
||||
{
|
||||
if (charset)
|
||||
config_option_list_set (string, "server", charset);
|
||||
else
|
||||
config_option_list_remove (string, "server");
|
||||
weechat_cmd_charset_display (buffer);
|
||||
if (SERVER(buffer))
|
||||
{
|
||||
if (charset)
|
||||
config_option_list_set (string, "server", charset);
|
||||
else
|
||||
config_option_list_remove (string, "server");
|
||||
weechat_cmd_charset_display (buffer);
|
||||
}
|
||||
}
|
||||
else if (BUFFER_IS_CHANNEL(buffer) ||
|
||||
BUFFER_IS_PRIVATE(buffer))
|
||||
@@ -2584,7 +2267,7 @@ int
|
||||
weechat_cmd_key (t_irc_server *server, t_irc_channel *channel,
|
||||
char *arguments)
|
||||
{
|
||||
char *pos;
|
||||
char *pos, *internal_code;
|
||||
int i;
|
||||
t_gui_key *ptr_key;
|
||||
|
||||
@@ -2667,11 +2350,24 @@ weechat_cmd_key (t_irc_server *server, t_irc_channel *channel,
|
||||
pos = strchr (arguments, ' ');
|
||||
if (!pos)
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s wrong argument count for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "key");
|
||||
return -1;
|
||||
ptr_key = NULL;
|
||||
internal_code = gui_keyboard_get_internal_code (arguments);
|
||||
if (internal_code)
|
||||
ptr_key = gui_keyboard_search (internal_code);
|
||||
if (ptr_key)
|
||||
{
|
||||
gui_printf (NULL, "\n");
|
||||
gui_printf (NULL, _("Key:\n"));
|
||||
weechat_cmd_key_display (ptr_key, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_INFO);
|
||||
gui_printf (NULL, _("No key found.\n"));
|
||||
}
|
||||
if (internal_code)
|
||||
free (internal_code);
|
||||
return 0;
|
||||
}
|
||||
pos[0] = '\0';
|
||||
pos++;
|
||||
|
||||
@@ -46,31 +46,13 @@ struct t_weechat_command
|
||||
/* function called when user enters cmd */
|
||||
};
|
||||
|
||||
typedef struct t_weechat_alias t_weechat_alias;
|
||||
|
||||
struct t_weechat_alias
|
||||
{
|
||||
char *alias_name;
|
||||
char *alias_command;
|
||||
int running;
|
||||
t_weechat_alias *prev_alias;
|
||||
t_weechat_alias *next_alias;
|
||||
};
|
||||
|
||||
extern t_weechat_command weechat_commands[];
|
||||
|
||||
extern t_weechat_alias *weechat_alias;
|
||||
extern t_weelist *index_commands;
|
||||
extern t_weelist *last_index_command;
|
||||
|
||||
extern void command_index_build ();
|
||||
extern void command_index_free ();
|
||||
extern t_weechat_alias *alias_search (char *);
|
||||
extern t_weechat_alias *alias_new (char *, char *);
|
||||
extern char *alias_get_final_command (t_weechat_alias *);
|
||||
extern void alias_free_all ();
|
||||
extern char **explode_string (char *, char *, int, int *);
|
||||
extern void free_exploded_string (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);
|
||||
|
||||
+18
-5
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "weechat.h"
|
||||
#include "completion.h"
|
||||
#include "alias.h"
|
||||
#include "command.h"
|
||||
#include "log.h"
|
||||
#include "utf8.h"
|
||||
@@ -117,7 +118,7 @@ completion_get_command_infos (t_completion *completion,
|
||||
char **template, int *max_arg)
|
||||
{
|
||||
t_weechat_alias *ptr_alias;
|
||||
char *ptr_command;
|
||||
char *ptr_command, *ptr_command2, *pos;
|
||||
int i;
|
||||
#ifdef PLUGINS
|
||||
t_weechat_plugin *ptr_plugin;
|
||||
@@ -136,6 +137,14 @@ completion_get_command_infos (t_completion *completion,
|
||||
}
|
||||
else
|
||||
ptr_command = completion->base_command;
|
||||
|
||||
ptr_command2 = strdup (ptr_command);
|
||||
if (!ptr_command2)
|
||||
return;
|
||||
|
||||
pos = strchr (ptr_command2, ' ');
|
||||
if (pos)
|
||||
pos[0] = '\0';
|
||||
|
||||
#ifdef PLUGINS
|
||||
/* look for plugin command handler */
|
||||
@@ -147,10 +156,11 @@ completion_get_command_infos (t_completion *completion,
|
||||
{
|
||||
if ((ptr_handler->type == HANDLER_COMMAND)
|
||||
&& (ascii_strcasecmp (ptr_handler->command,
|
||||
ptr_command) == 0))
|
||||
ptr_command2) == 0))
|
||||
{
|
||||
*template = ptr_handler->completion_template;
|
||||
*max_arg = MAX_ARGS;
|
||||
free (ptr_command2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -161,10 +171,11 @@ completion_get_command_infos (t_completion *completion,
|
||||
for (i = 0; weechat_commands[i].command_name; i++)
|
||||
{
|
||||
if (ascii_strcasecmp (weechat_commands[i].command_name,
|
||||
ptr_command) == 0)
|
||||
ptr_command2) == 0)
|
||||
{
|
||||
*template = weechat_commands[i].completion_template;
|
||||
*max_arg = weechat_commands[i].max_arg;
|
||||
free (ptr_command2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -174,14 +185,16 @@ completion_get_command_infos (t_completion *completion,
|
||||
{
|
||||
if ((irc_commands[i].cmd_function_args || irc_commands[i].cmd_function_1arg)
|
||||
&& (ascii_strcasecmp (irc_commands[i].command_name,
|
||||
ptr_command) == 0))
|
||||
ptr_command2) == 0))
|
||||
{
|
||||
*template = irc_commands[i].completion_template;
|
||||
*max_arg = irc_commands[i].max_arg;
|
||||
free (ptr_command2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
free (ptr_command2);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -874,7 +887,7 @@ completion_find_context (t_completion *completion, char *buffer, int size, int p
|
||||
|
||||
/* look for context */
|
||||
completion_free (completion);
|
||||
command = (buffer[0] == '/') ? 1 : 0;
|
||||
command = ((buffer[0] == '/') && (buffer[1] != '/')) ? 1 : 0;
|
||||
command_arg = 0;
|
||||
i = 0;
|
||||
while (i < pos)
|
||||
|
||||
@@ -76,7 +76,8 @@ hotlist_find_pos (t_weechat_hotlist *new_hotlist)
|
||||
*/
|
||||
|
||||
void
|
||||
hotlist_add (int priority, t_irc_server *server, t_gui_buffer *buffer)
|
||||
hotlist_add (int priority, t_irc_server *server, t_gui_buffer *buffer,
|
||||
int allow_current_buffer)
|
||||
{
|
||||
t_weechat_hotlist *new_hotlist, *pos_hotlist;
|
||||
|
||||
@@ -84,7 +85,8 @@ hotlist_add (int priority, t_irc_server *server, t_gui_buffer *buffer)
|
||||
return;
|
||||
|
||||
/* do not highlight current buffer */
|
||||
if (buffer == gui_current_window->buffer)
|
||||
if ((buffer == gui_current_window->buffer)
|
||||
&& (!allow_current_buffer))
|
||||
return;
|
||||
|
||||
if ((pos_hotlist = hotlist_search (buffer)))
|
||||
|
||||
@@ -43,7 +43,7 @@ struct t_weechat_hotlist
|
||||
extern t_weechat_hotlist *hotlist;
|
||||
extern t_gui_buffer *hotlist_initial_buffer;
|
||||
|
||||
extern void hotlist_add (int, t_irc_server *, t_gui_buffer *);
|
||||
extern void hotlist_add (int, t_irc_server *, t_gui_buffer *, int);
|
||||
extern void hotlist_free (t_weechat_hotlist *);
|
||||
extern void hotlist_free_all ();
|
||||
extern void hotlist_remove_buffer (t_gui_buffer *);
|
||||
|
||||
+112
-9
@@ -36,6 +36,7 @@
|
||||
|
||||
#include "weechat.h"
|
||||
#include "session.h"
|
||||
#include "hotlist.h"
|
||||
#include "log.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
@@ -436,6 +437,33 @@ session_save_uptime (FILE *file)
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* session_save_hotlist: save hotlist into session file
|
||||
*/
|
||||
|
||||
int
|
||||
session_save_hotlist (FILE *file)
|
||||
{
|
||||
int rc;
|
||||
t_weechat_hotlist *ptr_hotlist;
|
||||
|
||||
rc = 1;
|
||||
|
||||
for (ptr_hotlist = hotlist; ptr_hotlist;
|
||||
ptr_hotlist = ptr_hotlist->next_hotlist)
|
||||
{
|
||||
rc = rc && (session_write_id (file, SESSION_OBJ_HOTLIST));
|
||||
rc = rc && (session_write_int (file, SESSION_HOTL_PRIORITY, ptr_hotlist->priority));
|
||||
rc = rc && (session_write_str (file, SESSION_HOTL_SERVER, (ptr_hotlist->server) ? ptr_hotlist->server->name : NULL));
|
||||
rc = rc && (session_write_int (file, SESSION_HOTL_BUFFER_NUMBER, ptr_hotlist->buffer->number));
|
||||
rc = rc && (session_write_id (file, SESSION_HOTL_END));
|
||||
|
||||
if (!rc)
|
||||
return 0;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* session_save: save current session
|
||||
*/
|
||||
@@ -456,6 +484,7 @@ session_save (char *filename)
|
||||
rc = rc && (session_save_history (file, history_global_last));
|
||||
rc = rc && (session_save_buffers (file));
|
||||
rc = rc && (session_save_uptime (file));
|
||||
rc = rc && (session_save_hotlist (file));
|
||||
|
||||
fclose (file);
|
||||
|
||||
@@ -976,7 +1005,8 @@ session_load_server (FILE *file)
|
||||
break;
|
||||
default:
|
||||
weechat_log_printf (_("session: warning: ignoring value from "
|
||||
"server (object id: %d)\n"));
|
||||
"server (object id: %d)\n"),
|
||||
object_id);
|
||||
rc = rc && (session_read_ignore_value (file));
|
||||
break;
|
||||
}
|
||||
@@ -1078,7 +1108,8 @@ session_load_channel (FILE *file)
|
||||
break;
|
||||
default:
|
||||
weechat_log_printf (_("session: warning: ignoring value from "
|
||||
"channel (object id: %d)\n"));
|
||||
"channel (object id: %d)\n"),
|
||||
object_id);
|
||||
rc = rc && (session_read_ignore_value (file));
|
||||
break;
|
||||
}
|
||||
@@ -1148,7 +1179,8 @@ session_load_nick (FILE *file)
|
||||
break;
|
||||
default:
|
||||
weechat_log_printf (_("session: warning: ignoring value from "
|
||||
"nick (object id: %d)\n"));
|
||||
"nick (object id: %d)\n"),
|
||||
object_id);
|
||||
rc = rc && (session_read_ignore_value (file));
|
||||
break;
|
||||
}
|
||||
@@ -1311,7 +1343,8 @@ session_load_dcc (FILE *file)
|
||||
break;
|
||||
default:
|
||||
weechat_log_printf (_("session: warning: ignoring value from "
|
||||
"DCC (object id: %d)\n"));
|
||||
"DCC (object id: %d)\n"),
|
||||
object_id);
|
||||
rc = rc && (session_read_ignore_value (file));
|
||||
break;
|
||||
}
|
||||
@@ -1361,7 +1394,8 @@ session_load_history (FILE *file)
|
||||
break;
|
||||
default:
|
||||
weechat_log_printf (_("session: warning: ignoring value from "
|
||||
"history (object id: %d)\n"));
|
||||
"history (object id: %d)\n"),
|
||||
object_id);
|
||||
rc = rc && (session_read_ignore_value (file));
|
||||
break;
|
||||
}
|
||||
@@ -1463,7 +1497,8 @@ session_load_buffer (FILE *file)
|
||||
break;
|
||||
default:
|
||||
weechat_log_printf (_("session: warning: ignoring value from "
|
||||
"buffer (object id: %d)\n"));
|
||||
"buffer (object id: %d)\n"),
|
||||
object_id);
|
||||
rc = rc && (session_read_ignore_value (file));
|
||||
break;
|
||||
}
|
||||
@@ -1540,7 +1575,8 @@ session_load_line (FILE *file)
|
||||
break;
|
||||
default:
|
||||
weechat_log_printf (_("session: warning: ignoring value from "
|
||||
"line (object id: %d)\n"));
|
||||
"line (object id: %d)\n"),
|
||||
object_id);
|
||||
rc = rc && (session_read_ignore_value (file));
|
||||
break;
|
||||
}
|
||||
@@ -1577,7 +1613,67 @@ session_load_uptime (FILE *file)
|
||||
break;
|
||||
default:
|
||||
weechat_log_printf (_("session: warning: ignoring value from "
|
||||
"uptime (object id: %d)\n"));
|
||||
"uptime (object id: %d)\n"),
|
||||
object_id);
|
||||
rc = rc && (session_read_ignore_value (file));
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* session_load_hotlist: load hotlist from file
|
||||
*/
|
||||
|
||||
int
|
||||
session_load_hotlist (FILE *file)
|
||||
{
|
||||
int object_id, rc;
|
||||
int priority;
|
||||
char *server_name;
|
||||
t_irc_server *ptr_server;
|
||||
int buffer_number;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
priority = 0;
|
||||
ptr_server = NULL;
|
||||
ptr_buffer = NULL;
|
||||
|
||||
/* read hotlist values */
|
||||
rc = 1;
|
||||
while (rc)
|
||||
{
|
||||
if (feof (file))
|
||||
{
|
||||
session_crash (file, _("unexpected end of file (reading hotlist)"));
|
||||
return 0;
|
||||
}
|
||||
if (fread ((void *)(&object_id), sizeof (int), 1, file) == 0)
|
||||
return 0;
|
||||
switch (object_id)
|
||||
{
|
||||
case SESSION_HOTL_END:
|
||||
hotlist_add (priority, ptr_server, ptr_buffer, 1);
|
||||
return 1;
|
||||
case SESSION_HOTL_PRIORITY:
|
||||
rc = rc && (session_read_int (file, &priority));
|
||||
break;
|
||||
case SESSION_HOTL_SERVER:
|
||||
server_name = NULL;
|
||||
if (!session_read_str (file, &server_name))
|
||||
return 0;
|
||||
ptr_server = server_search (server_name);
|
||||
free (server_name);
|
||||
break;
|
||||
case SESSION_HOTL_BUFFER_NUMBER:
|
||||
rc = rc && (session_read_int (file, &buffer_number));
|
||||
ptr_buffer = gui_buffer_search_by_number (buffer_number);
|
||||
break;
|
||||
default:
|
||||
weechat_log_printf (_("session: warning: ignoring value from "
|
||||
"history (object id: %d)\n"),
|
||||
object_id);
|
||||
rc = rc && (session_read_ignore_value (file));
|
||||
break;
|
||||
}
|
||||
@@ -1690,6 +1786,13 @@ session_load (char *filename)
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case SESSION_OBJ_HOTLIST:
|
||||
if (!session_load_hotlist (file))
|
||||
{
|
||||
session_crash (file, _("failed to load hotlist"));
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
weechat_log_printf (_("ignoring object (id: %d)\n"),
|
||||
object_id);
|
||||
@@ -1720,7 +1823,7 @@ session_load (char *filename)
|
||||
irc_display_prefix (NULL, gui_current_window->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (gui_current_window->buffer,
|
||||
_("%s can't delete session file (%s)\n"),
|
||||
WEECHAT_ERROR);
|
||||
WEECHAT_ERROR, filename);
|
||||
}
|
||||
|
||||
irc_display_prefix (NULL, gui_current_window->buffer, PREFIX_INFO);
|
||||
|
||||
+10
-1
@@ -44,7 +44,8 @@ enum t_session_object
|
||||
SESSION_OBJ_HISTORY,
|
||||
SESSION_OBJ_BUFFER,
|
||||
SESSION_OBJ_LINE,
|
||||
SESSION_OBJ_UPTIME
|
||||
SESSION_OBJ_UPTIME,
|
||||
SESSION_OBJ_HOTLIST
|
||||
};
|
||||
|
||||
enum t_session_server
|
||||
@@ -187,6 +188,14 @@ enum t_session_uptime
|
||||
SESSION_UPT_START_TIME
|
||||
};
|
||||
|
||||
enum t_session_hotlist
|
||||
{
|
||||
SESSION_HOTL_END = 0,
|
||||
SESSION_HOTL_PRIORITY,
|
||||
SESSION_HOTL_SERVER,
|
||||
SESSION_HOTL_BUFFER_NUMBER
|
||||
};
|
||||
|
||||
int session_save (char *filename);
|
||||
int session_load (char *filename);
|
||||
|
||||
|
||||
@@ -26,7 +26,10 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifndef __USE_XOPEN
|
||||
#define __USE_XOPEN
|
||||
#endif
|
||||
|
||||
#if defined(__OpenBSD__)
|
||||
#include <utf8/wchar.h>
|
||||
|
||||
@@ -320,3 +320,208 @@ get_timeval_diff (struct timeval *tv1, struct timeval *tv2)
|
||||
}
|
||||
return ((diff_usec / 1000) + (diff_sec * 1000));
|
||||
}
|
||||
|
||||
/*
|
||||
* explode_string: explode a string according to separators
|
||||
*/
|
||||
|
||||
char **
|
||||
explode_string (char *string, char *separators, int num_items_max,
|
||||
int *num_items)
|
||||
{
|
||||
int i, n_items;
|
||||
char **array;
|
||||
char *ptr, *ptr1, *ptr2;
|
||||
|
||||
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)))
|
||||
{
|
||||
while (strchr (separators, ptr[0]) != NULL)
|
||||
ptr++;
|
||||
i++;
|
||||
}
|
||||
n_items = i;
|
||||
}
|
||||
|
||||
array =
|
||||
(char **) malloc ((num_items_max ? n_items : n_items + 1) *
|
||||
sizeof (char *));
|
||||
|
||||
ptr1 = string;
|
||||
ptr2 = string;
|
||||
|
||||
for (i = 0; i < n_items; i++)
|
||||
{
|
||||
while (strchr (separators, ptr1[0]) != NULL)
|
||||
ptr1++;
|
||||
if (i == (n_items - 1) || (ptr2 = strpbrk (ptr1, separators)) == NULL)
|
||||
if ((ptr2 = strchr (ptr1, '\r')) == NULL)
|
||||
if ((ptr2 = strchr (ptr1, '\n')) == NULL)
|
||||
ptr2 = strchr (ptr1, '\0');
|
||||
|
||||
if ((ptr1 == NULL) || (ptr2 == NULL))
|
||||
{
|
||||
array[i] = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ptr2 - ptr1 > 0)
|
||||
{
|
||||
array[i] =
|
||||
(char *) malloc ((ptr2 - ptr1 + 1) * sizeof (char));
|
||||
array[i] = strncpy (array[i], ptr1, ptr2 - ptr1);
|
||||
array[i][ptr2 - ptr1] = '\0';
|
||||
ptr1 = ++ptr2;
|
||||
}
|
||||
else
|
||||
{
|
||||
array[i] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
/*
|
||||
* free_exploded_string: free an exploded string
|
||||
*/
|
||||
|
||||
void
|
||||
free_exploded_string (char **exploded_string)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (exploded_string)
|
||||
{
|
||||
for (i = 0; exploded_string[i]; i++)
|
||||
free (exploded_string[i]);
|
||||
free (exploded_string);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* split_multi_command: split a list of commands separated by 'sep'
|
||||
* and ecscaped with '\'
|
||||
* - empty commands are removed
|
||||
* - spaces on the left of each commands are stripped
|
||||
* Result must be freed with free_multi_command
|
||||
*/
|
||||
|
||||
char **
|
||||
split_multi_command (char *command, char sep)
|
||||
{
|
||||
int nb_substr, arr_idx, str_idx, type;
|
||||
char **array;
|
||||
char *buffer, *ptr, *p;
|
||||
|
||||
if (command == NULL)
|
||||
return NULL;
|
||||
|
||||
nb_substr = 1;
|
||||
ptr = command;
|
||||
while ( (p = strchr(ptr, sep)) != NULL)
|
||||
{
|
||||
nb_substr++;
|
||||
ptr = ++p;
|
||||
}
|
||||
|
||||
array = (char **) malloc ((nb_substr + 1) * sizeof(char *));
|
||||
if (!array)
|
||||
return NULL;
|
||||
|
||||
buffer = (char *) malloc ( (strlen(command) + 1) * sizeof (char));
|
||||
if (!buffer)
|
||||
{
|
||||
free (array);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ptr = command;
|
||||
str_idx = 0;
|
||||
arr_idx = 0;
|
||||
while(*ptr != '\0')
|
||||
{
|
||||
type = 0;
|
||||
if (*ptr == ';')
|
||||
{
|
||||
if (ptr == command)
|
||||
type = 1;
|
||||
else if ( *(ptr-1) != '\\')
|
||||
type = 1;
|
||||
else if ( *(ptr-1) == '\\')
|
||||
type = 2;
|
||||
}
|
||||
if (type == 1)
|
||||
{
|
||||
buffer[str_idx] = '\0';
|
||||
str_idx = -1;
|
||||
p = buffer;
|
||||
/* strip white spaces a the begining of the line */
|
||||
while (*p == ' ') p++;
|
||||
if (p && p[0])
|
||||
array[arr_idx++] = strdup (p);
|
||||
}
|
||||
else if (type == 2)
|
||||
buffer[--str_idx] = *ptr;
|
||||
else
|
||||
buffer[str_idx] = *ptr;
|
||||
str_idx++;
|
||||
ptr++;
|
||||
}
|
||||
|
||||
buffer[str_idx] = '\0';
|
||||
p = buffer;
|
||||
while (*p == ' ') p++;
|
||||
if (p && p[0])
|
||||
array[arr_idx++] = strdup (p);
|
||||
|
||||
array[arr_idx] = NULL;
|
||||
|
||||
free (buffer);
|
||||
|
||||
array = (char **) realloc (array, (arr_idx + 1) * sizeof(char *));
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
/*
|
||||
* free_multi_command : free a list of commands splitted
|
||||
* with split_multi_command
|
||||
*/
|
||||
|
||||
void
|
||||
free_multi_command (char **commands)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (commands)
|
||||
{
|
||||
for (i = 0; commands[i]; i++)
|
||||
free (commands[i]);
|
||||
free (commands);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,5 +30,7 @@ extern char *weechat_iconv (char *, char *, char *);
|
||||
extern int weechat_iconv_check (char *, char *);
|
||||
extern char *weechat_strreplace (char *, char *, char *);
|
||||
extern long get_timeval_diff (struct timeval *, struct timeval *);
|
||||
extern char **explode_string (char *, char *, int, int *);
|
||||
extern void free_exploded_string (char **);
|
||||
|
||||
#endif /* util.h */
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
#endif
|
||||
|
||||
#include "weechat.h"
|
||||
#include "alias.h"
|
||||
#include "backtrace.h"
|
||||
#include "command.h"
|
||||
#include "fifo.h"
|
||||
|
||||
+10
-4
@@ -37,6 +37,7 @@
|
||||
|
||||
#include "weechat.h"
|
||||
#include "weeconfig.h"
|
||||
#include "alias.h"
|
||||
#include "command.h"
|
||||
#include "fifo.h"
|
||||
#include "log.h"
|
||||
@@ -1008,7 +1009,8 @@ t_config_option weechat_options_server[] =
|
||||
"", NULL, NULL, &(cfg_server.hostname), NULL },
|
||||
{ "server_command", N_("command(s) to run when connected to server"),
|
||||
N_("command(s) to run when connected to server (many commands should be "
|
||||
"separated by ';', use '\\;' for a semicolon)"),
|
||||
"separated by ';', use '\\;' for a semicolon, special variables $nick, "
|
||||
"$channel and $server are replaced by their value)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &(cfg_server.command), NULL },
|
||||
{ "server_command_delay", N_("delay (in seconds) after command was executed"),
|
||||
@@ -1024,7 +1026,9 @@ t_config_option weechat_options_server[] =
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
NULL, NULL, &(cfg_server.autorejoin), NULL, NULL },
|
||||
{ "server_notify_levels", N_("notify levels for channels of this server"),
|
||||
N_("comma separated list of notify levels for channels of this server (format: #channel:1,..)"),
|
||||
N_("comma separated list of notify levels for channels of this server "
|
||||
"(format: #channel:1,..), a channel name '*' is reserved for server "
|
||||
"default notify level"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &(cfg_server.notify_levels), config_change_notify_levels },
|
||||
{ "server_charset_decode_iso", N_("charset for decoding ISO on server and channels"),
|
||||
@@ -1344,9 +1348,11 @@ config_option_set_value (t_config_option *option, char *value)
|
||||
switch (option->option_type)
|
||||
{
|
||||
case OPTION_TYPE_BOOLEAN:
|
||||
if (ascii_strcasecmp (value, "on") == 0)
|
||||
if ((ascii_strcasecmp (value, "on") == 0)
|
||||
|| (ascii_strcasecmp (value, "yes") == 0))
|
||||
*(option->ptr_int) = BOOL_TRUE;
|
||||
else if (ascii_strcasecmp (value, "off") == 0)
|
||||
else if ((ascii_strcasecmp (value, "off") == 0)
|
||||
|| (ascii_strcasecmp (value, "no") == 0))
|
||||
*(option->ptr_int) = BOOL_FALSE;
|
||||
else
|
||||
return -1;
|
||||
|
||||
@@ -75,7 +75,9 @@ gui_keyboard_default_bindings ()
|
||||
gui_keyboard_bind ( /* down */ "meta2-B", "down");
|
||||
gui_keyboard_bind ( /* ^down */ "meta-Ob", "down_global");
|
||||
gui_keyboard_bind ( /* pgup */ "meta2-5~", "page_up");
|
||||
gui_keyboard_bind ( /* pgup */ "meta2-I", "page_up");
|
||||
gui_keyboard_bind ( /* pgdn */ "meta2-6~", "page_down");
|
||||
gui_keyboard_bind ( /* pgdn */ "meta2-G", "page_down");
|
||||
gui_keyboard_bind ( /* m-pgup */ "meta-meta2-5~", "scroll_up");
|
||||
gui_keyboard_bind ( /* m-pgdn */ "meta-meta2-6~", "scroll_down");
|
||||
gui_keyboard_bind ( /* m-home */ "meta-meta2-1~", "scroll_top");
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "../../common/utf8.h"
|
||||
#include "../../common/util.h"
|
||||
#include "../../common/weeconfig.h"
|
||||
#include "../../irc/irc.h"
|
||||
#include "gui-curses.h"
|
||||
|
||||
#ifdef PLUGINS
|
||||
@@ -43,6 +44,20 @@
|
||||
#endif
|
||||
|
||||
|
||||
int send_irc_quit = 0;
|
||||
|
||||
|
||||
/*
|
||||
* gui_main_quit: quit weechat (signal received)
|
||||
*/
|
||||
|
||||
void
|
||||
gui_main_quit ()
|
||||
{
|
||||
quit_weechat = 1;
|
||||
send_irc_quit = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_main_loop: main loop for WeeChat with ncurses GUI
|
||||
*/
|
||||
@@ -61,6 +76,7 @@ gui_main_loop ()
|
||||
struct tm *local_time;
|
||||
|
||||
quit_weechat = 0;
|
||||
send_irc_quit = 0;
|
||||
|
||||
new_time = time (NULL);
|
||||
gui_last_activity_time = new_time;
|
||||
@@ -70,6 +86,11 @@ gui_main_loop ()
|
||||
old_min = -1;
|
||||
old_sec = -1;
|
||||
check_away = 0;
|
||||
|
||||
/* if SIGTERM or SIGHUP received => quit */
|
||||
signal (SIGTERM, gui_main_quit);
|
||||
signal (SIGHUP, gui_main_quit);
|
||||
|
||||
while (!quit_weechat)
|
||||
{
|
||||
/* refresh needed ? */
|
||||
@@ -261,6 +282,8 @@ gui_main_loop ()
|
||||
/* manages active DCC */
|
||||
dcc_handle ();
|
||||
}
|
||||
if (send_irc_quit)
|
||||
irc_cmd_send_quit (NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -168,7 +168,7 @@ gui_window_set_weechat_color (WINDOW *window, int num_color)
|
||||
int
|
||||
gui_window_calculate_pos_size (t_gui_window *window, int force_calculate)
|
||||
{
|
||||
int max_length, max_height, lines;
|
||||
int max_length, max_height, lines, width_used;
|
||||
int num_nicks, num_op, num_halfop, num_voice, num_normal;
|
||||
int add_right, add_left, add_top, add_bottom;
|
||||
|
||||
@@ -203,10 +203,12 @@ gui_window_calculate_pos_size (t_gui_window *window, int force_calculate)
|
||||
{
|
||||
nick_count (CHANNEL(window->buffer), &num_nicks, &num_op,
|
||||
&num_halfop, &num_voice, &num_normal);
|
||||
if (((max_length + 2) * num_nicks) % (window->win_width - add_left - add_right) == 0)
|
||||
lines = ((max_length + 2) * num_nicks) / (window->win_width - add_left - add_right);
|
||||
width_used = (window->win_width - add_left - add_right)
|
||||
- ((window->win_width - add_left - add_right) % (max_length + 2));
|
||||
if (((max_length + 2) * num_nicks) % width_used == 0)
|
||||
lines = ((max_length + 2) * num_nicks) / width_used;
|
||||
else
|
||||
lines = (((max_length + 2) * num_nicks) / (window->win_width - add_left - add_right)) + 1;
|
||||
lines = (((max_length + 2) * num_nicks) / width_used) + 1;
|
||||
if ((cfg_look_nicklist_max_size > 0) && (lines > cfg_look_nicklist_max_size))
|
||||
lines = cfg_look_nicklist_max_size;
|
||||
if ((cfg_look_nicklist_min_size > 0) && (lines < cfg_look_nicklist_min_size))
|
||||
|
||||
+43
-8
@@ -41,6 +41,7 @@
|
||||
#include "../common/hotlist.h"
|
||||
#include "../common/log.h"
|
||||
#include "../common/utf8.h"
|
||||
#include "../common/util.h"
|
||||
#include "../irc/irc.h"
|
||||
|
||||
|
||||
@@ -238,8 +239,8 @@ gui_buffer_new (t_gui_window *window, void *server, void *channel, int type,
|
||||
t_gui_buffer *
|
||||
gui_buffer_search (char *server, char *channel)
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
t_irc_server *ptr_server, *ptr_srv;
|
||||
t_irc_channel *ptr_channel, *ptr_chan;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
ptr_server = NULL;
|
||||
@@ -257,12 +258,6 @@ gui_buffer_search (char *server, char *channel)
|
||||
if (!ptr_server)
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_server = SERVER(gui_current_window->buffer);
|
||||
if (!ptr_server)
|
||||
ptr_server = SERVER(gui_buffers);
|
||||
}
|
||||
|
||||
if (channel && channel[0])
|
||||
{
|
||||
@@ -272,6 +267,26 @@ gui_buffer_search (char *server, char *channel)
|
||||
if (ptr_channel)
|
||||
ptr_buffer = ptr_channel->buffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (ptr_srv = irc_servers; ptr_srv;
|
||||
ptr_srv = ptr_srv->next_server)
|
||||
{
|
||||
for (ptr_chan = ptr_srv->channels; ptr_chan;
|
||||
ptr_chan = ptr_chan->next_channel)
|
||||
{
|
||||
if (ascii_strcasecmp (ptr_chan->name, channel) == 0)
|
||||
{
|
||||
ptr_channel = ptr_chan;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ptr_channel)
|
||||
break;
|
||||
}
|
||||
if (ptr_channel)
|
||||
ptr_buffer = ptr_channel->buffer;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -289,6 +304,26 @@ gui_buffer_search (char *server, char *channel)
|
||||
gui_buffers : ptr_buffer;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_search_by_number: search a buffer by number
|
||||
*/
|
||||
|
||||
t_gui_buffer *
|
||||
gui_buffer_search_by_number (int number)
|
||||
{
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer;
|
||||
ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
if (ptr_buffer->number == number)
|
||||
return ptr_buffer;
|
||||
}
|
||||
|
||||
/* buffer not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_find_window: find a window displaying buffer
|
||||
*/
|
||||
|
||||
@@ -180,13 +180,13 @@ gui_add_to_line (t_gui_buffer *buffer, int type, char *nick, char *message)
|
||||
buffer->notify_level)
|
||||
{
|
||||
if (buffer->last_line->line_with_highlight)
|
||||
hotlist_add (HOTLIST_HIGHLIGHT, SERVER(buffer), buffer);
|
||||
hotlist_add (HOTLIST_HIGHLIGHT, SERVER(buffer), buffer, 0);
|
||||
else if (BUFFER_IS_PRIVATE(buffer) && (buffer->last_line->line_with_message))
|
||||
hotlist_add (HOTLIST_PRIVATE, SERVER(buffer), buffer);
|
||||
hotlist_add (HOTLIST_PRIVATE, SERVER(buffer), buffer, 0);
|
||||
else if (buffer->last_line->line_with_message)
|
||||
hotlist_add (HOTLIST_MSG, SERVER(buffer), buffer);
|
||||
hotlist_add (HOTLIST_MSG, SERVER(buffer), buffer, 0);
|
||||
else
|
||||
hotlist_add (HOTLIST_LOW, SERVER(buffer), buffer);
|
||||
hotlist_add (HOTLIST_LOW, SERVER(buffer), buffer, 0);
|
||||
gui_status_draw (gui_current_window->buffer, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,6 +83,7 @@ extern void gui_window_print_log (t_gui_window *);
|
||||
extern t_gui_buffer *gui_buffer_servers_search ();
|
||||
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 t_gui_buffer *gui_buffer_get_dcc (t_gui_window *);
|
||||
extern void gui_buffer_clear (t_gui_buffer *);
|
||||
@@ -159,6 +160,7 @@ extern void gui_keyboard_init ();
|
||||
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 *gui_keyboard_bind (char *, char *);
|
||||
|
||||
+17
-16
@@ -72,7 +72,8 @@ channel_new (t_irc_server *server, int channel_type, char *channel_name)
|
||||
new_channel->display_creation_date = 0;
|
||||
new_channel->nicks = NULL;
|
||||
new_channel->last_nick = NULL;
|
||||
|
||||
new_channel->buffer = NULL;
|
||||
|
||||
/* add new channel to queue */
|
||||
new_channel->prev_channel = server->last_channel;
|
||||
new_channel->next_channel = NULL;
|
||||
@@ -488,7 +489,7 @@ int
|
||||
channel_get_notify_level (t_irc_server *server, t_irc_channel *channel)
|
||||
{
|
||||
char *name, *pos, *pos2;
|
||||
int notify;
|
||||
int server_default_notify, notify;
|
||||
|
||||
if ((!server) || (!channel))
|
||||
return NOTIFY_LEVEL_DEFAULT;
|
||||
@@ -496,26 +497,31 @@ channel_get_notify_level (t_irc_server *server, t_irc_channel *channel)
|
||||
if ((!server->notify_levels) || (!server->notify_levels[0]))
|
||||
return NOTIFY_LEVEL_DEFAULT;
|
||||
|
||||
server_default_notify = server_get_default_notify_level (server);
|
||||
if ((channel->type != CHANNEL_TYPE_CHANNEL)
|
||||
&& (server_default_notify == 1))
|
||||
server_default_notify = 2;
|
||||
|
||||
name = (char *) malloc (strlen (channel->name) + 2);
|
||||
strcpy (name, channel->name);
|
||||
strcat (name, ":");
|
||||
pos = strstr (server->notify_levels, name);
|
||||
free (name);
|
||||
if (!pos)
|
||||
return NOTIFY_LEVEL_DEFAULT;
|
||||
return server_default_notify;
|
||||
|
||||
pos2 = pos + strlen (channel->name);
|
||||
if (pos2[0] != ':')
|
||||
return NOTIFY_LEVEL_DEFAULT;
|
||||
return server_default_notify;
|
||||
pos2++;
|
||||
if (!pos2[0])
|
||||
return NOTIFY_LEVEL_DEFAULT;
|
||||
return server_default_notify;
|
||||
|
||||
notify = (int)(pos2[0] - '0');
|
||||
if ((notify < NOTIFY_LEVEL_MIN) || (notify > NOTIFY_LEVEL_MAX))
|
||||
return NOTIFY_LEVEL_DEFAULT;
|
||||
else
|
||||
if ((notify >= NOTIFY_LEVEL_MIN) && (notify <= NOTIFY_LEVEL_MAX))
|
||||
return notify;
|
||||
|
||||
return server_default_notify;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -530,14 +536,9 @@ channel_set_notify_level (t_irc_server *server, t_irc_channel *channel, int noti
|
||||
if ((!server) || (!channel))
|
||||
return;
|
||||
|
||||
if (notify == NOTIFY_LEVEL_DEFAULT)
|
||||
config_option_list_remove (&(server->notify_levels), channel->name);
|
||||
else
|
||||
{
|
||||
level_string[0] = notify + '0';
|
||||
level_string[1] = '\0';
|
||||
config_option_list_set (&(server->notify_levels), channel->name, level_string);
|
||||
}
|
||||
level_string[0] = notify + '0';
|
||||
level_string[1] = '\0';
|
||||
config_option_list_set (&(server->notify_levels), channel->name, level_string);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -47,18 +47,18 @@ t_irc_command irc_commands[] =
|
||||
N_("[-all] [message]"),
|
||||
N_(" -all: toggle away status on all connected servers\n"
|
||||
"message: message for away (if no message is given, away status is removed)"),
|
||||
"-all", 0, MAX_ARGS, 1, 1, NULL, irc_cmd_send_away, NULL },
|
||||
"-all", 0, MAX_ARGS, 1, 0, NULL, irc_cmd_send_away, NULL },
|
||||
{ "ban", N_("bans nicks or hosts"),
|
||||
N_("[channel] [nickname [nickname ...]]"),
|
||||
N_(" channel: channel for ban\n"
|
||||
"nickname: user or host to ban"),
|
||||
"%N", 0, MAX_ARGS, 0, 1, NULL, irc_cmd_send_ban, NULL },
|
||||
{ "ctcp", N_("send a CTCP message (Client-To-Client Protocol)"),
|
||||
N_("nickname type [arguments]"),
|
||||
N_(" nickname: user to send CTCP to\n"
|
||||
N_("receiver type [arguments]"),
|
||||
N_(" receiver: nick or channel to send CTCP to\n"
|
||||
" type: CTCP type (examples: \"version\", \"ping\", ..)\n"
|
||||
"arguments: arguments for CTCP"),
|
||||
"%n action|ping|version", 2, MAX_ARGS, 1, 1, NULL, irc_cmd_send_ctcp, NULL },
|
||||
"%c|%n action|ping|version", 2, MAX_ARGS, 1, 1, NULL, irc_cmd_send_ctcp, NULL },
|
||||
{ "cycle", N_("leave and rejoin a channel"),
|
||||
N_("[channel[,channel]] [part_message]"),
|
||||
N_(" channel: channel name for cycle\n"
|
||||
|
||||
+10
-6
@@ -63,10 +63,13 @@ char *dcc_status_string[] = /* strings for DCC status */
|
||||
void
|
||||
dcc_redraw (int highlight)
|
||||
{
|
||||
gui_window_redraw_buffer (gui_buffer_get_dcc (gui_current_window));
|
||||
if (highlight)
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
ptr_buffer = gui_buffer_get_dcc (gui_current_window);
|
||||
gui_window_redraw_buffer (ptr_buffer);
|
||||
if (highlight && gui_add_hotlist && (ptr_buffer->num_displayed == 0))
|
||||
{
|
||||
hotlist_add (highlight, NULL, gui_buffer_get_dcc (gui_current_window));
|
||||
hotlist_add (highlight, NULL, ptr_buffer, 0);
|
||||
gui_status_draw (gui_current_window->buffer, 0);
|
||||
}
|
||||
}
|
||||
@@ -1418,7 +1421,7 @@ dcc_file_send_child (t_irc_dcc *ptr_dcc)
|
||||
if ((num_read < 1) &&
|
||||
((num_read != -1) || (errno != EAGAIN)))
|
||||
{
|
||||
dcc_file_write_pipe (ptr_dcc, DCC_FAILED, DCC_ERROR_READ_LOCAL);
|
||||
dcc_file_write_pipe (ptr_dcc, DCC_FAILED, DCC_ERROR_SEND_BLOCK);
|
||||
return;
|
||||
}
|
||||
if (num_read == 4)
|
||||
@@ -1459,7 +1462,7 @@ dcc_file_send_child (t_irc_dcc *ptr_dcc)
|
||||
usleep (1000);
|
||||
else
|
||||
{
|
||||
dcc_file_write_pipe (ptr_dcc, DCC_FAILED, DCC_ERROR_READ_LOCAL);
|
||||
dcc_file_write_pipe (ptr_dcc, DCC_FAILED, DCC_ERROR_SEND_BLOCK);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1827,7 +1830,8 @@ dcc_handle ()
|
||||
}
|
||||
if (ptr_dcc->type == DCC_FILE_RECV)
|
||||
{
|
||||
dcc_file_child_read (ptr_dcc);
|
||||
if (ptr_dcc->child_read != -1)
|
||||
dcc_file_child_read (ptr_dcc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
-1
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "../common/weechat.h"
|
||||
#include "irc.h"
|
||||
#include "../common/command.h"
|
||||
#include "../common/util.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
@@ -121,6 +121,10 @@ irc_mode_channel_set (t_irc_channel *channel, char *modes)
|
||||
argv[current_arg--] : NULL;
|
||||
switch (pos[0])
|
||||
{
|
||||
case 'a': /* unrealircd specific flag */
|
||||
irc_mode_channel_set_nick (channel, ptr_arg,
|
||||
set_flag, NICK_CHANADMIN);
|
||||
break;
|
||||
case 'h':
|
||||
irc_mode_channel_set_nick (channel, ptr_arg,
|
||||
set_flag, NICK_HALFOP);
|
||||
@@ -144,6 +148,10 @@ irc_mode_channel_set (t_irc_channel *channel, char *modes)
|
||||
irc_mode_channel_set_nick (channel, ptr_arg,
|
||||
set_flag, NICK_OP);
|
||||
break;
|
||||
case 'q': /* unrealircd specific flag */
|
||||
irc_mode_channel_set_nick (channel, ptr_arg,
|
||||
set_flag, NICK_CHANOWNER);
|
||||
break;
|
||||
case 'v':
|
||||
irc_mode_channel_set_nick (channel, ptr_arg,
|
||||
set_flag, NICK_VOICE);
|
||||
|
||||
+98
-62
@@ -37,6 +37,7 @@
|
||||
|
||||
#include "../common/weechat.h"
|
||||
#include "irc.h"
|
||||
#include "../common/alias.h"
|
||||
#include "../common/command.h"
|
||||
#include "../common/hotlist.h"
|
||||
#include "../common/util.h"
|
||||
@@ -413,8 +414,11 @@ 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);
|
||||
hotlist_add (HOTLIST_HIGHLIGHT, server, server->buffer);
|
||||
gui_status_draw (gui_current_window->buffer, 1);
|
||||
if (gui_add_hotlist && (server->buffer->num_displayed == 0))
|
||||
{
|
||||
hotlist_add (HOTLIST_HIGHLIGHT, server, server->buffer, 0);
|
||||
gui_status_draw (gui_current_window->buffer, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -736,13 +740,14 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *nick, char *arguments
|
||||
{
|
||||
irc_display_prefix (server, server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer,
|
||||
_("User mode %s%s %s[%s%s%s]\n"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
nick,
|
||||
_("User mode %s[%s%s%s]%s by %s%s\n"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
pos_modes,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK));
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
nick);
|
||||
}
|
||||
irc_mode_user_set (server, pos_modes);
|
||||
}
|
||||
@@ -1023,8 +1028,11 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *nick, char *argumen
|
||||
(ascii_strcasecmp (nick, "chanserv") != 0) &&
|
||||
(ascii_strcasecmp (nick, "memoserv") != 0))
|
||||
{
|
||||
hotlist_add (HOTLIST_PRIVATE, server, server->buffer);
|
||||
gui_status_draw (gui_current_window->buffer, 1);
|
||||
if (gui_add_hotlist && (server->buffer->num_displayed == 0))
|
||||
{
|
||||
hotlist_add (HOTLIST_PRIVATE, server, server->buffer, 0);
|
||||
gui_status_draw (gui_current_window->buffer, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1208,6 +1216,73 @@ irc_cmd_recv_pong (t_irc_server *server, char *host, char *nick, char *arguments
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_reply_version: send version in reply to "CTCP VERSION" request
|
||||
*/
|
||||
|
||||
void
|
||||
irc_cmd_reply_version (t_irc_server *server, t_irc_channel *channel,
|
||||
char *host, char *nick, char *message)
|
||||
{
|
||||
char *pos;
|
||||
struct utsname *buf;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
ptr_buffer = (channel) ? channel->buffer : server->buffer;
|
||||
|
||||
command_ignored |= ignore_check (host, "ctcp", NULL, server->name);
|
||||
if (!command_ignored)
|
||||
{
|
||||
pos = strchr (message, ' ');
|
||||
if (pos)
|
||||
{
|
||||
while (pos[0] == ' ')
|
||||
pos++;
|
||||
if (pos[0] == '\01')
|
||||
pos = NULL;
|
||||
else if (!pos[0])
|
||||
pos = NULL;
|
||||
}
|
||||
|
||||
buf = (struct utsname *) malloc (sizeof (struct utsname));
|
||||
if (buf && (uname (buf) >= 0))
|
||||
{
|
||||
server_sendf (server,
|
||||
"NOTICE %s :%sVERSION %s v%s"
|
||||
" compiled on %s, running "
|
||||
"%s %s / %s%s",
|
||||
nick, "\01", PACKAGE_NAME, PACKAGE_VERSION, __DATE__,
|
||||
&buf->sysname,
|
||||
&buf->release, &buf->machine, "\01\r\n");
|
||||
free (buf);
|
||||
}
|
||||
else
|
||||
server_sendf (server,
|
||||
"NOTICE %s :%sVERSION %s v%s"
|
||||
" compiled on %s%s",
|
||||
nick, "\01", PACKAGE_NAME, PACKAGE_VERSION, __DATE__,
|
||||
"\01\r\n");
|
||||
irc_display_prefix (server, ptr_buffer, PREFIX_SERVER);
|
||||
gui_printf (ptr_buffer,
|
||||
_("CTCP %sVERSION%s received from %s%s"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
nick);
|
||||
if (pos)
|
||||
gui_printf (ptr_buffer, "%s: %s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
pos);
|
||||
else
|
||||
gui_printf (ptr_buffer, "\n");
|
||||
#ifdef PLUGINS
|
||||
(void) plugin_msg_handler_exec (server->name,
|
||||
"weechat_ctcp",
|
||||
irc_last_command_received);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_recv_privmsg: 'privmsg' command received
|
||||
*/
|
||||
@@ -1219,7 +1294,6 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
char *pos_file, *pos_addr, *pos_port, *pos_size, *pos_start_resume; /* for DCC */
|
||||
t_irc_channel *ptr_channel;
|
||||
t_irc_nick *ptr_nick;
|
||||
struct utsname *buf;
|
||||
int highlight;
|
||||
|
||||
/* no host => we can't identify sender of message! */
|
||||
@@ -1348,6 +1422,11 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
nick);
|
||||
return 0;
|
||||
}
|
||||
if (strncmp (pos, "\01VERSION", 8) == 0)
|
||||
{
|
||||
irc_cmd_reply_version (server, ptr_channel, host, nick, pos);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* unknown CTCP ? */
|
||||
pos2 = strchr (pos + 1, '\01');
|
||||
@@ -1449,57 +1528,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
/* version asked by another user => answer with WeeChat version */
|
||||
if (strncmp (pos, "\01VERSION", 8) == 0)
|
||||
{
|
||||
command_ignored |= ignore_check (host, "ctcp", NULL, server->name);
|
||||
if (!command_ignored)
|
||||
{
|
||||
pos2 = strchr (pos + 8, ' ');
|
||||
if (pos2)
|
||||
{
|
||||
while (pos2[0] == ' ')
|
||||
pos2++;
|
||||
if (pos2[0] == '\01')
|
||||
pos2 = NULL;
|
||||
else if (!pos2[0])
|
||||
pos2 = NULL;
|
||||
}
|
||||
|
||||
buf = (struct utsname *) malloc (sizeof (struct utsname));
|
||||
if (buf && (uname (buf) >= 0))
|
||||
{
|
||||
server_sendf (server,
|
||||
"NOTICE %s :%sVERSION %s v%s"
|
||||
" compiled on %s, running "
|
||||
"%s %s / %s%s",
|
||||
nick, "\01", PACKAGE_NAME, PACKAGE_VERSION, __DATE__,
|
||||
&buf->sysname,
|
||||
&buf->release, &buf->machine, "\01\r\n");
|
||||
free (buf);
|
||||
}
|
||||
else
|
||||
server_sendf (server,
|
||||
"NOTICE %s :%sVERSION %s v%s"
|
||||
" compiled on %s%s",
|
||||
nick, "\01", PACKAGE_NAME, PACKAGE_VERSION, __DATE__,
|
||||
"\01\r\n");
|
||||
irc_display_prefix (server, server->buffer, PREFIX_SERVER);
|
||||
gui_printf (server->buffer,
|
||||
_("CTCP %sVERSION%s received from %s%s"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
nick);
|
||||
if (pos2)
|
||||
gui_printf (server->buffer, "%s: %s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
pos2);
|
||||
else
|
||||
gui_printf (server->buffer, "\n");
|
||||
#ifdef PLUGINS
|
||||
(void) plugin_msg_handler_exec (server->name,
|
||||
"weechat_ctcp",
|
||||
irc_last_command_received);
|
||||
#endif
|
||||
}
|
||||
irc_cmd_reply_version (server, NULL, host, nick, pos);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2333,7 +2362,7 @@ int
|
||||
irc_cmd_recv_001 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
{
|
||||
char *pos;
|
||||
char **commands, **ptr;
|
||||
char **commands, **ptr, *vars_replaced;
|
||||
t_irc_channel *ptr_channel;
|
||||
char *away_msg;
|
||||
|
||||
@@ -2362,7 +2391,13 @@ irc_cmd_recv_001 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
if (commands)
|
||||
{
|
||||
for (ptr = commands; *ptr; ptr++)
|
||||
user_command (server, NULL, *ptr, 0);
|
||||
{
|
||||
vars_replaced = alias_replace_vars (*ptr);
|
||||
user_command (server, NULL,
|
||||
(vars_replaced) ? vars_replaced : *ptr, 0);
|
||||
if (vars_replaced)
|
||||
free (vars_replaced);
|
||||
}
|
||||
free_multi_command (commands);
|
||||
}
|
||||
|
||||
@@ -3353,6 +3388,7 @@ irc_cmd_recv_324 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
else
|
||||
ptr_channel->modes = (char *) malloc (strlen (pos_modes) + 1);
|
||||
strcpy (ptr_channel->modes, pos_modes);
|
||||
irc_mode_channel_set (ptr_channel, pos_modes);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+12
-1
@@ -348,7 +348,18 @@ irc_cmd_send_away (t_irc_server *server, t_irc_channel *channel,
|
||||
}
|
||||
}
|
||||
else
|
||||
irc_send_away (server, arguments);
|
||||
{
|
||||
if (server->is_connected)
|
||||
irc_send_away (server, arguments);
|
||||
else
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf_nolog (NULL,
|
||||
_("%s command \"%s\" needs a server connection!\n"),
|
||||
WEECHAT_ERROR, "away");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
gui_status_draw (buffer, 1);
|
||||
gui_add_hotlist = 1;
|
||||
|
||||
@@ -1935,6 +1935,53 @@ server_set_away (t_irc_server *server, char *nick, int is_away)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* server_get_default_notify_level: get default notify level for server
|
||||
*/
|
||||
|
||||
int
|
||||
server_get_default_notify_level (t_irc_server *server)
|
||||
{
|
||||
int notify, value;
|
||||
char *pos;
|
||||
|
||||
notify = NOTIFY_LEVEL_DEFAULT;
|
||||
|
||||
if (!server || !server->notify_levels)
|
||||
return notify;
|
||||
|
||||
pos = strstr (server->notify_levels, "*:");
|
||||
if (pos)
|
||||
{
|
||||
pos += 2;
|
||||
if (pos[0])
|
||||
{
|
||||
value = (int)(pos[0] - '0');
|
||||
if ((value >= NOTIFY_LEVEL_MIN) && (value <= NOTIFY_LEVEL_MAX))
|
||||
notify = value;
|
||||
}
|
||||
}
|
||||
|
||||
return notify;
|
||||
}
|
||||
|
||||
/*
|
||||
* server_set_default_notify_level: set default notify level for server
|
||||
*/
|
||||
|
||||
void
|
||||
server_set_default_notify_level (t_irc_server *server, int notify)
|
||||
{
|
||||
char level_string[2];
|
||||
|
||||
if (server)
|
||||
{
|
||||
level_string[0] = notify + '0';
|
||||
level_string[1] = '\0';
|
||||
config_option_list_set (&(server->notify_levels), "*", level_string);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* server_print_log: print server infos in log (usually for crash dump)
|
||||
*/
|
||||
|
||||
@@ -355,6 +355,8 @@ extern int server_name_already_exists (char *);
|
||||
extern void server_remove_away ();
|
||||
extern void server_check_away ();
|
||||
extern void server_set_away (t_irc_server *, char *, int);
|
||||
extern int server_get_default_notify_level (t_irc_server *);
|
||||
extern void server_set_default_notify_level (t_irc_server *, int);
|
||||
extern void server_print_log (t_irc_server *);
|
||||
|
||||
/* proxy functions (irc-server.c) */
|
||||
|
||||
@@ -1180,6 +1180,39 @@ weechat_aspell_is_simili_number (char *word)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_aspell_is_url :
|
||||
* detect if a word is an url
|
||||
*/
|
||||
int
|
||||
weechat_aspell_is_url (char *word)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = 0;
|
||||
if (strncasecmp(word, "http://", 7) == 0
|
||||
|| strncasecmp(word, "https://", 8) == 0
|
||||
|| strncasecmp(word, "ftp://", 6) == 0
|
||||
|| strncasecmp(word, "tftp://", 7) == 0
|
||||
|| strncasecmp(word, "ftps://", 7) == 0
|
||||
|| strncasecmp(word, "ssh://", 6) == 0
|
||||
|| strncasecmp(word, "fish://", 7) == 0
|
||||
|| strncasecmp(word, "dict://", 7) == 0
|
||||
|| strncasecmp(word, "ldap://", 7) == 0
|
||||
|| strncasecmp(word, "file://", 7) == 0
|
||||
|| strncasecmp(word, "telnet://", 9) == 0
|
||||
|| strncasecmp(word, "gopher://", 9) == 0
|
||||
|| strncasecmp(word, "irc://", 6) == 0
|
||||
|| strncasecmp(word, "ircs://", 7) == 0
|
||||
|| strncasecmp(word, "irc6://", 7) == 0
|
||||
|| strncasecmp(word, "irc6s://", 8) == 0
|
||||
|| strncasecmp(word, "cvs://", 6) == 0
|
||||
|| strncasecmp(word, "svn://", 6) == 0
|
||||
|| strncasecmp(word, "svn+ssh://", 10) == 0)
|
||||
ret = 1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_aspell_keyb_check : handler to check spelling on input line
|
||||
*/
|
||||
@@ -1189,6 +1222,8 @@ weechat_aspell_keyb_check (t_weechat_plugin *p, int argc, char **argv,
|
||||
{
|
||||
char *server, *channel;
|
||||
aspell_config_t *c;
|
||||
cmds_keep_t *cmd;
|
||||
int keep_cmd_found;
|
||||
char *input, *ptr_input, *pos_space, *clword;
|
||||
int count, offset;
|
||||
|
||||
@@ -1225,40 +1260,57 @@ weechat_aspell_keyb_check (t_weechat_plugin *p, int argc, char **argv,
|
||||
|
||||
if (!input[0])
|
||||
return PLUGIN_RC_OK;
|
||||
|
||||
|
||||
if (input[0] == '/')
|
||||
return PLUGIN_RC_OK;
|
||||
{
|
||||
keep_cmd_found = 0;
|
||||
for(cmd = cmd_tokeep; cmd->cmd; ++cmd)
|
||||
{
|
||||
if (strncasecmp (input, cmd->cmd, cmd->len) == 0) {
|
||||
keep_cmd_found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (keep_cmd_found == 0)
|
||||
return PLUGIN_RC_OK;
|
||||
}
|
||||
|
||||
count = 0;
|
||||
ptr_input = input;
|
||||
weechat_aspell_plugin->input_color (weechat_aspell_plugin, 0, 0, 0);
|
||||
while (ptr_input && ptr_input[0])
|
||||
{
|
||||
{
|
||||
pos_space = strchr (ptr_input, ' ');
|
||||
if (pos_space)
|
||||
pos_space[0] = '\0';
|
||||
|
||||
clword = weechat_aspell_clean_word (ptr_input, &offset);
|
||||
if (clword)
|
||||
if (ptr_input[0] != '/' && ptr_input[0] != '-' && ptr_input[0] != '#')
|
||||
{
|
||||
if ( (int) strlen (clword) >= aspell_plugin_options.word_size)
|
||||
clword = weechat_aspell_clean_word (ptr_input, &offset);
|
||||
if (clword)
|
||||
{
|
||||
if (!weechat_aspell_is_simili_number (clword))
|
||||
if ( (int) strlen (clword) >= aspell_plugin_options.word_size)
|
||||
{
|
||||
if (!weechat_aspell_nick_in_channel (clword, server, channel))
|
||||
if (!weechat_aspell_is_url (clword))
|
||||
{
|
||||
if (aspell_speller_check (c->speller->speller, clword, -1) != 1)
|
||||
if (!weechat_aspell_is_simili_number (clword))
|
||||
{
|
||||
if (count == 0)
|
||||
weechat_aspell_plugin->input_color (weechat_aspell_plugin, 0, 0, 0);
|
||||
weechat_aspell_plugin->input_color (weechat_aspell_plugin, aspell_plugin_options.color,
|
||||
ptr_input - input + offset, strlen (clword));
|
||||
count++;
|
||||
if (!weechat_aspell_nick_in_channel (clword, server, channel))
|
||||
{
|
||||
if (aspell_speller_check (c->speller->speller, clword, -1) != 1)
|
||||
{
|
||||
if (count == 0)
|
||||
weechat_aspell_plugin->input_color (weechat_aspell_plugin, 0, 0, 0);
|
||||
weechat_aspell_plugin->input_color (weechat_aspell_plugin, aspell_plugin_options.color,
|
||||
ptr_input - input + offset, strlen (clword));
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
free (clword);
|
||||
}
|
||||
free (clword);
|
||||
}
|
||||
|
||||
if (pos_space)
|
||||
|
||||
@@ -78,6 +78,12 @@ typedef struct iso_countries_t
|
||||
char *name;
|
||||
} iso_countries_t;
|
||||
|
||||
typedef struct cmds_keep_t
|
||||
{
|
||||
char *cmd;
|
||||
int len;
|
||||
} cmds_keep_t;
|
||||
|
||||
/* aspell supported langs 2006-05-27 */
|
||||
iso_langs_t langs_avail[] =
|
||||
{
|
||||
@@ -178,4 +184,23 @@ iso_countries_t countries_avail[] =
|
||||
{ NULL, NULL}
|
||||
};
|
||||
|
||||
/* internal or irc commands to be use with spellchecking */
|
||||
cmds_keep_t cmd_tokeep[] =
|
||||
{
|
||||
{ "/builtin ", 9 },
|
||||
{ "/ame " , 5 },
|
||||
{ "/amsg " , 6 },
|
||||
{ "/away " , 6 },
|
||||
{ "/cycle " , 7 },
|
||||
{ "/kick " , 6 },
|
||||
{ "/kickban " , 9 },
|
||||
{ "/me " , 4 },
|
||||
{ "/notice " , 8 },
|
||||
{ "/part " , 6 },
|
||||
{ "/query " , 7 },
|
||||
{ "/quit " , 6 },
|
||||
{ "/topic " , 7 },
|
||||
{ NULL, 0}
|
||||
};
|
||||
|
||||
#endif /* WEECHAT_ASPELL__H */
|
||||
|
||||
@@ -1767,8 +1767,8 @@ weechat_lua_get_buffer_data (lua_State *L)
|
||||
server = lua_tostring (lua_current_interpreter, -1);
|
||||
break;
|
||||
case 2:
|
||||
channel = lua_tostring (lua_current_interpreter, -2);
|
||||
server = lua_tostring (lua_current_interpreter, -1);
|
||||
server = lua_tostring (lua_current_interpreter, -2);
|
||||
channel = lua_tostring (lua_current_interpreter, -1);
|
||||
break;
|
||||
default:
|
||||
lua_plugin->print_server (lua_plugin,
|
||||
@@ -1777,7 +1777,7 @@ weechat_lua_get_buffer_data (lua_State *L)
|
||||
lua_pushnumber (lua_current_interpreter, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
buffer_data = lua_plugin->get_buffer_data (lua_plugin, (char *) server, (char *) channel);
|
||||
if (!buffer_data)
|
||||
{
|
||||
|
||||
@@ -1531,6 +1531,8 @@ static XS (XS_weechat_get_buffer_data)
|
||||
server = SvPV (ST (0), PL_na);
|
||||
if (items >= 2)
|
||||
channel = SvPV (ST (1), PL_na);
|
||||
|
||||
SP -= items;
|
||||
|
||||
buffer_data = perl_plugin->get_buffer_data (perl_plugin, server, channel);
|
||||
count = 0;
|
||||
|
||||
@@ -58,7 +58,7 @@ weechat_python_exec (t_weechat_plugin *plugin,
|
||||
PyObject *rc;
|
||||
int ret;
|
||||
|
||||
PyEval_AcquireLock ();
|
||||
/* PyEval_AcquireLock (); */
|
||||
PyThreadState_Swap (script->interpreter);
|
||||
|
||||
evMain = PyImport_AddModule ((char *) "__main__");
|
||||
@@ -70,9 +70,7 @@ weechat_python_exec (t_weechat_plugin *plugin,
|
||||
plugin->print_server (plugin,
|
||||
"Python error: unable to run function \"%s\"",
|
||||
function);
|
||||
|
||||
PyEval_ReleaseThread (python_current_script->interpreter);
|
||||
|
||||
/* PyEval_ReleaseThread (python_current_script->interpreter); */
|
||||
return PLUGIN_RC_KO;
|
||||
}
|
||||
|
||||
@@ -99,9 +97,7 @@ weechat_python_exec (t_weechat_plugin *plugin,
|
||||
if (rc == Py_None)
|
||||
{
|
||||
python_plugin->print_server (python_plugin, "Python error: function \"%s\" must return a valid value", function);
|
||||
|
||||
PyEval_ReleaseThread (python_current_script->interpreter);
|
||||
|
||||
/* PyEval_ReleaseThread (python_current_script->interpreter); */
|
||||
return PLUGIN_RC_OK;
|
||||
}
|
||||
|
||||
@@ -116,7 +112,7 @@ weechat_python_exec (t_weechat_plugin *plugin,
|
||||
if (ret < 0)
|
||||
ret = PLUGIN_RC_OK;
|
||||
|
||||
PyEval_ReleaseThread (python_current_script->interpreter);
|
||||
/* PyEval_ReleaseThread (python_current_script->interpreter); */
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -1592,7 +1588,7 @@ weechat_python_load (t_weechat_plugin *plugin, char *filename)
|
||||
|
||||
python_current_script = NULL;
|
||||
|
||||
PyEval_AcquireLock ();
|
||||
/* PyEval_AcquireLock (); */
|
||||
python_current_interpreter = Py_NewInterpreter ();
|
||||
PySys_SetArgv(1, argv);
|
||||
|
||||
@@ -1601,13 +1597,11 @@ weechat_python_load (t_weechat_plugin *plugin, char *filename)
|
||||
plugin->print_server (plugin,
|
||||
"Python error: unable to create new sub-interpreter");
|
||||
fclose (fp);
|
||||
|
||||
PyEval_ReleaseLock ();
|
||||
|
||||
/* PyEval_ReleaseLock (); */
|
||||
return 0;
|
||||
}
|
||||
|
||||
//PyThreadState_Swap (python_current_interpreter);
|
||||
/* PyThreadState_Swap (python_current_interpreter); */
|
||||
|
||||
weechat_module = Py_InitModule ("weechat", weechat_python_funcs);
|
||||
|
||||
@@ -1618,7 +1612,7 @@ weechat_python_load (t_weechat_plugin *plugin, char *filename)
|
||||
fclose (fp);
|
||||
|
||||
Py_EndInterpreter (python_current_interpreter);
|
||||
PyEval_ReleaseLock ();
|
||||
/* PyEval_ReleaseLock (); */
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1659,7 +1653,7 @@ weechat_python_load (t_weechat_plugin *plugin, char *filename)
|
||||
|
||||
if (PyErr_Occurred ()) PyErr_Print ();
|
||||
Py_EndInterpreter (python_current_interpreter);
|
||||
PyEval_ReleaseLock ();
|
||||
/* PyEval_ReleaseLock (); */
|
||||
|
||||
/* if script was registered, removing from list */
|
||||
if (python_current_script != NULL)
|
||||
@@ -1681,14 +1675,13 @@ weechat_python_load (t_weechat_plugin *plugin, char *filename)
|
||||
|
||||
if (PyErr_Occurred ()) PyErr_Print ();
|
||||
Py_EndInterpreter (python_current_interpreter);
|
||||
PyEval_ReleaseLock ();
|
||||
/* PyEval_ReleaseLock (); */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
python_current_script->interpreter = (PyThreadState *) python_current_interpreter;
|
||||
|
||||
PyEval_ReleaseThread (python_current_script->interpreter);
|
||||
/* PyEval_ReleaseThread (python_current_script->interpreter); */
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -1943,9 +1936,9 @@ weechat_plugin_init (t_weechat_plugin *plugin)
|
||||
}
|
||||
|
||||
PyEval_InitThreads();
|
||||
//python_mainThreadState = PyThreadState_Swap(NULL);
|
||||
/* python_mainThreadState = PyThreadState_Swap(NULL); */
|
||||
python_mainThreadState = PyEval_SaveThread();
|
||||
PyEval_ReleaseLock ();
|
||||
/* PyEval_ReleaseLock (); */
|
||||
|
||||
if (python_mainThreadState == NULL)
|
||||
{
|
||||
@@ -1985,9 +1978,9 @@ weechat_plugin_end (t_weechat_plugin *plugin)
|
||||
/* free Python interpreter */
|
||||
if (python_mainThreadState != NULL)
|
||||
{
|
||||
PyEval_AcquireLock ();
|
||||
/* PyEval_AcquireLock (); */
|
||||
PyThreadState_Swap (python_mainThreadState);
|
||||
PyEval_ReleaseLock ();
|
||||
/* PyEval_ReleaseLock (); */
|
||||
python_mainThreadState = NULL;
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -18,7 +18,7 @@
|
||||
#
|
||||
|
||||
%define name weechat
|
||||
%define version 0.2.0
|
||||
%define version 0.2.1
|
||||
%define release 1
|
||||
|
||||
Name: %{name}
|
||||
@@ -67,6 +67,8 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_docdir}/%{name}/weechat_quickstart*
|
||||
|
||||
%changelog
|
||||
* Sun Oct 01 2006 FlashCode <flashcode@flashtux.org> 0.2.1-1
|
||||
- Released version 0.2.1
|
||||
* Sat Aug 19 2006 FlashCode <flashcode@flashtux.org> 0.2.0-1
|
||||
- Released version 0.2.0
|
||||
* Thu May 25 2006 FlashCode <flashcode@flashtux.org> 0.1.9-1
|
||||
|
||||
+37
-37
@@ -118,8 +118,8 @@ country code serves to distinguish the dialects.
|
||||
language and `CC' denoting the country, is the one use on systems based
|
||||
on GNU libc. On other systems, some variations of this scheme are
|
||||
used, such as `LL' or `LL_CC.ENCODING'. You can get the list of
|
||||
locales supported by your system for your country by running the command
|
||||
`locale -a | grep '^LL''.
|
||||
locales supported by your system for your language by running the
|
||||
command `locale -a | grep '^LL''.
|
||||
|
||||
Not all programs have translations for all languages. By default, an
|
||||
English message is shown in place of a nonexistent translation. If you
|
||||
@@ -179,7 +179,7 @@ programming skill, here.
|
||||
======================
|
||||
|
||||
Languages are not equally supported in all packages. The following
|
||||
matrix shows the current state of internationalization, as of June
|
||||
matrix shows the current state of internationalization, as of July
|
||||
2006. The matrix shows, in regard of each package, for which languages
|
||||
PO files have been submitted to translation coordination, with a
|
||||
translation percentage of at least 50%.
|
||||
@@ -199,7 +199,7 @@ translation percentage of at least 50%.
|
||||
bibshelf | [] |
|
||||
binutils | [] |
|
||||
bison | [] [] |
|
||||
bison-runtime | |
|
||||
bison-runtime | [] |
|
||||
bluez-pin | [] [] [] [] [] |
|
||||
cflow | [] |
|
||||
clisp | [] [] |
|
||||
@@ -225,8 +225,8 @@ translation percentage of at least 50%.
|
||||
gbiff | [] |
|
||||
gcal | [] |
|
||||
gcc | [] |
|
||||
gettext-examples | [] [] [] [] |
|
||||
gettext-runtime | [] [] [] [] |
|
||||
gettext-examples | [] [] [] [] [] |
|
||||
gettext-runtime | [] [] [] [] [] |
|
||||
gettext-tools | [] [] |
|
||||
gimp-print | [] [] [] [] |
|
||||
gip | [] |
|
||||
@@ -303,7 +303,7 @@ translation percentage of at least 50%.
|
||||
libgphoto2 | [] [] |
|
||||
libgphoto2_port | [] [] |
|
||||
libgsasl | |
|
||||
libiconv | |
|
||||
libiconv | [] [] |
|
||||
libidn | [] [] |
|
||||
lifelines | [] () |
|
||||
lilypond | [] |
|
||||
@@ -342,7 +342,7 @@ translation percentage of at least 50%.
|
||||
sp | [] |
|
||||
stardict | [] |
|
||||
system-tools-ba... | [] [] [] [] [] [] [] [] [] |
|
||||
tar | |
|
||||
tar | [] |
|
||||
texinfo | [] [] [] |
|
||||
textutils | [] [] [] |
|
||||
tin | () () |
|
||||
@@ -360,7 +360,7 @@ translation percentage of at least 50%.
|
||||
xpad | [] [] |
|
||||
+----------------------------------------------------+
|
||||
af am ar az be bg bs ca cs cy da de el en en_GB eo
|
||||
11 0 1 2 8 20 1 42 43 2 62 97 18 1 16 13
|
||||
11 0 1 2 8 21 1 42 43 2 62 99 18 1 16 16
|
||||
|
||||
es et eu fa fi fr ga gl gu he hi hr hu id is it
|
||||
+--------------------------------------------------+
|
||||
@@ -478,10 +478,10 @@ translation percentage of at least 50%.
|
||||
libextractor | [] |
|
||||
libgpewidget | [] [] [] [] [] |
|
||||
libgpg-error | |
|
||||
libgphoto2 | [] [] |
|
||||
libgphoto2 | [] [] [] |
|
||||
libgphoto2_port | [] [] |
|
||||
libgsasl | [] [] |
|
||||
libiconv | |
|
||||
libiconv | [] |
|
||||
libidn | [] [] |
|
||||
lifelines | () |
|
||||
lilypond | [] |
|
||||
@@ -496,7 +496,7 @@ translation percentage of at least 50%.
|
||||
nano | [] () [] [] [] [] |
|
||||
nano_1_0 | [] [] [] [] [] |
|
||||
opcodes | [] [] [] [] |
|
||||
parted | [] [] [] |
|
||||
parted | [] [] [] [] |
|
||||
pilot-qof | |
|
||||
psmisc | [] [] [] |
|
||||
pwdutils | |
|
||||
@@ -520,11 +520,11 @@ translation percentage of at least 50%.
|
||||
sp | [] |
|
||||
stardict | [] |
|
||||
system-tools-ba... | [] [] [] [] [] [] [] [] |
|
||||
tar | [] [] [] [] [] |
|
||||
tar | [] [] [] [] [] [] |
|
||||
texinfo | [] [] |
|
||||
textutils | [] [] [] [] [] |
|
||||
tin | [] () |
|
||||
tp-robot | [] [] [] |
|
||||
tp-robot | [] [] [] [] |
|
||||
tuxpaint | [] [] |
|
||||
unicode-han-tra... | |
|
||||
unicode-transla... | [] [] |
|
||||
@@ -538,7 +538,7 @@ translation percentage of at least 50%.
|
||||
xpad | [] [] [] |
|
||||
+--------------------------------------------------+
|
||||
es et eu fa fi fr ga gl gu he hi hr hu id is it
|
||||
89 21 16 2 41 118 59 14 1 8 1 6 60 30 0 52
|
||||
89 21 16 2 41 119 61 14 1 8 1 6 61 30 0 53
|
||||
|
||||
ja ko ku ky lg lt lv mk mn ms mt nb ne nl nn no
|
||||
+--------------------------------------------------+
|
||||
@@ -640,14 +640,14 @@ translation percentage of at least 50%.
|
||||
iso_3166_2 | [] |
|
||||
iso_3166_3 | [] |
|
||||
iso_4217 | [] [] [] |
|
||||
iso_639 | [] [] [] |
|
||||
iso_639 | [] [] |
|
||||
jpilot | () () () |
|
||||
jtag | |
|
||||
jwhois | [] |
|
||||
kbd | [] |
|
||||
keytouch | [] |
|
||||
keytouch-editor | |
|
||||
keytouch-keyboa... | [] |
|
||||
keytouch-keyboa... | |
|
||||
latrine | [] |
|
||||
ld | |
|
||||
leafpad | [] [] |
|
||||
@@ -716,7 +716,7 @@ translation percentage of at least 50%.
|
||||
xpad | [] [] [] |
|
||||
+--------------------------------------------------+
|
||||
ja ko ku ky lg lt lv mk mn ms mt nb ne nl nn no
|
||||
40 24 2 1 1 3 1 2 3 21 0 15 1 102 6 3
|
||||
40 24 2 1 1 3 1 2 3 21 0 15 1 101 5 3
|
||||
|
||||
nso or pa pl pt pt_BR rm ro ru rw sk sl sq sr sv ta
|
||||
+------------------------------------------------------+
|
||||
@@ -758,7 +758,7 @@ translation percentage of at least 50%.
|
||||
gawk | [] [] [] [] |
|
||||
gbiff | [] |
|
||||
gcal | [] |
|
||||
gcc | |
|
||||
gcc | [] |
|
||||
gettext-examples | [] [] [] [] [] [] [] [] |
|
||||
gettext-runtime | [] [] [] [] [] [] [] [] |
|
||||
gettext-tools | [] [] [] [] [] [] [] |
|
||||
@@ -835,7 +835,7 @@ translation percentage of at least 50%.
|
||||
libgpewidget | [] [] [] [] [] [] [] |
|
||||
libgpg-error | [] [] |
|
||||
libgphoto2 | [] |
|
||||
libgphoto2_port | [] [] |
|
||||
libgphoto2_port | [] [] [] |
|
||||
libgsasl | [] [] [] [] |
|
||||
libiconv | |
|
||||
libidn | [] [] () |
|
||||
@@ -894,7 +894,7 @@ translation percentage of at least 50%.
|
||||
xpad | [] [] [] |
|
||||
+------------------------------------------------------+
|
||||
nso or pa pl pt pt_BR rm ro ru rw sk sl sq sr sv ta
|
||||
0 2 3 58 31 53 5 76 72 5 42 48 12 51 128 2
|
||||
0 2 3 58 31 53 5 76 72 5 42 48 12 51 130 2
|
||||
|
||||
tg th tk tr uk ven vi wa xh zh_CN zh_HK zh_TW zu
|
||||
+---------------------------------------------------+
|
||||
@@ -911,7 +911,7 @@ translation percentage of at least 50%.
|
||||
bibshelf | [] | 7
|
||||
binutils | [] [] [] | 9
|
||||
bison | [] [] [] | 19
|
||||
bison-runtime | [] [] [] | 15
|
||||
bison-runtime | [] [] [] | 16
|
||||
bluez-pin | [] [] [] [] [] [] | 28
|
||||
cflow | [] [] | 4
|
||||
clisp | | 6
|
||||
@@ -936,9 +936,9 @@ translation percentage of at least 50%.
|
||||
gawk | [] [] | 15
|
||||
gbiff | [] | 5
|
||||
gcal | [] | 5
|
||||
gcc | [] [] [] | 5
|
||||
gettext-examples | [] [] [] [] [] | 24
|
||||
gettext-runtime | [] [] [] [] [] | 26
|
||||
gcc | [] [] [] | 6
|
||||
gettext-examples | [] [] [] [] [] [] | 26
|
||||
gettext-runtime | [] [] [] [] [] [] | 28
|
||||
gettext-tools | [] [] [] [] [] | 19
|
||||
gimp-print | [] [] | 12
|
||||
gip | [] [] | 12
|
||||
@@ -996,26 +996,26 @@ translation percentage of at least 50%.
|
||||
iso_3166_2 | | 2
|
||||
iso_3166_3 | [] [] | 9
|
||||
iso_4217 | [] [] | 14
|
||||
iso_639 | [] [] | 16
|
||||
iso_639 | [] | 14
|
||||
jpilot | [] [] [] [] | 7
|
||||
jtag | [] | 3
|
||||
jwhois | [] [] [] | 13
|
||||
kbd | [] [] | 12
|
||||
keytouch | [] | 4
|
||||
keytouch-editor | | 2
|
||||
keytouch-keyboa... | [] | 4
|
||||
keytouch-keyboa... | | 2
|
||||
latrine | [] [] | 8
|
||||
ld | [] [] [] | 7
|
||||
ld | [] [] [] [] | 8
|
||||
leafpad | [] [] [] [] | 23
|
||||
libc | [] [] [] | 23
|
||||
libexif | [] | 4
|
||||
libextractor | [] | 5
|
||||
libgpewidget | [] [] [] | 19
|
||||
libgpg-error | [] | 4
|
||||
libgphoto2 | [] | 7
|
||||
libgphoto2_port | [] [] [] | 10
|
||||
libgphoto2 | [] | 8
|
||||
libgphoto2_port | [] [] [] | 11
|
||||
libgsasl | [] | 8
|
||||
libiconv | | 0
|
||||
libiconv | [] | 4
|
||||
libidn | [] [] | 10
|
||||
lifelines | | 4
|
||||
lilypond | | 2
|
||||
@@ -1030,7 +1030,7 @@ translation percentage of at least 50%.
|
||||
nano | [] [] | 15
|
||||
nano_1_0 | [] [] [] | 18
|
||||
opcodes | [] [] | 10
|
||||
parted | [] [] [] | 9
|
||||
parted | [] [] [] | 10
|
||||
pilot-qof | [] | 3
|
||||
psmisc | [] | 10
|
||||
pwdutils | [] | 3
|
||||
@@ -1038,7 +1038,7 @@ translation percentage of at least 50%.
|
||||
qof | [] | 2
|
||||
radius | [] | 6
|
||||
recode | [] [] [] | 25
|
||||
rpm | [] [] [] | 13
|
||||
rpm | [] [] [] [] | 14
|
||||
screem | [] | 2
|
||||
scrollkeeper | [] [] [] [] | 26
|
||||
sed | [] [] [] | 22
|
||||
@@ -1054,11 +1054,11 @@ translation percentage of at least 50%.
|
||||
sp | [] | 3
|
||||
stardict | [] [] [] [] | 11
|
||||
system-tools-ba... | [] [] [] [] [] [] [] | 37
|
||||
tar | [] [] [] [] | 17
|
||||
tar | [] [] [] [] | 19
|
||||
texinfo | [] [] [] | 15
|
||||
textutils | [] [] [] | 17
|
||||
tin | | 1
|
||||
tp-robot | [] [] [] | 9
|
||||
tp-robot | [] [] [] | 10
|
||||
tuxpaint | [] [] [] | 16
|
||||
unicode-han-tra... | | 0
|
||||
unicode-transla... | | 2
|
||||
@@ -1072,7 +1072,7 @@ translation percentage of at least 50%.
|
||||
xpad | [] [] [] | 14
|
||||
+---------------------------------------------------+
|
||||
77 teams tg th tk tr uk ven vi wa xh zh_CN zh_HK zh_TW zu
|
||||
172 domains 0 1 1 78 39 0 135 14 1 50 1 52 0 2040
|
||||
172 domains 0 1 1 78 39 0 135 13 1 50 3 54 0 2054
|
||||
|
||||
Some counters in the preceding matrix are higher than the number of
|
||||
visible blocks let us expect. This is because a few extra PO files are
|
||||
@@ -1085,7 +1085,7 @@ distributed as such by its maintainer. There might be an observable
|
||||
lag between the mere existence a PO file and its wide availability in a
|
||||
distribution.
|
||||
|
||||
If June 2006 seems to be old, you may fetch a more recent copy of
|
||||
If July 2006 seems to be old, you may fetch a more recent copy of
|
||||
this `ABOUT-NLS' file on most GNU archive sites. The most up-to-date
|
||||
matrix with full percentage details can be found at
|
||||
`http://www.iro.umontreal.ca/contrib/po/HTML/matrix.html'.
|
||||
|
||||
+35
-1
@@ -1,7 +1,40 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2006-08-19
|
||||
ChangeLog - 2006-10-01
|
||||
|
||||
|
||||
Version 0.2.1 (2006-10-01):
|
||||
* fixed crash for DCC receiver when resuming a file (bug #17885)
|
||||
* fixed DCC error for sender when receiver cancels DCC (bug #17838)
|
||||
* fixed random crash with /upgrade command (error when loading buffers)
|
||||
* fixed buffer search by server/channel: now if only channel is specified,
|
||||
a channel of another server can be found
|
||||
* fixed highlight for DCC, invite and notice: when a window is displaying
|
||||
buffer, there's no highlight
|
||||
* command "/away -all" now allowed when not connected to current server
|
||||
* new signals handled: SIGTERM and SIGHUP (received when terminal is closed):
|
||||
clean WeeChat quit (send quit to irc servers then quit WeeChat)
|
||||
* added some new default key bindings for existing keys (for some OS)
|
||||
* command /key now ok with one arg (key name): display key if found
|
||||
* fixed bug with CTCP VERSION sent on channels (bug #17547)
|
||||
* added current channel completion for /ctcp command
|
||||
* fixed bugs in get_buffer_data() which breaks the retrieval of buffer
|
||||
content (perl, lua)
|
||||
* fixed nicklist display bug when top/bottom (not enough lines) (bug #17537)
|
||||
* fixed bug with auto-rejoin of keyed chans (bug #17534)
|
||||
* added default nick completion when line starts with '//' (bug #17535)
|
||||
* values yes/no accepted (as on/off) for config boolean values (task #5454)
|
||||
* added server default notify level (set by /buffer notify on server buffer)
|
||||
(task #5634)
|
||||
* fixed crashs with /buffer and /charset commands when not connected to any
|
||||
server (bug #17525)
|
||||
* added special vars $nick/$channel/$server for server_command, alias and
|
||||
plugin command handlers
|
||||
* added arguments $1,$2,..,$9 and $* for alias (task #5831)
|
||||
* added hotlist in session file when using /upgrade command (task #5449)
|
||||
* fixed nick refresh problem with unrealircd specific modes: chan owner (~)
|
||||
and chan admin (&) (bug #17340)
|
||||
|
||||
Version 0.2.0 (2006-08-19):
|
||||
* added 'C'lear option on IRC raw buffer
|
||||
@@ -41,6 +74,7 @@ Version 0.2.0 (2006-08-19):
|
||||
* added polish, russian and czech quickstart guide
|
||||
* fixed display bug with special char (bug #16732)
|
||||
* added color encoding for some commands like /me
|
||||
* added aspell plugin
|
||||
* renamed plugins names (removed "lib" prefix in name)
|
||||
* fixed crash when closing DCC/raw buffer if 2 are open (bug #16808)
|
||||
* fixed crashes with DCC chat remove/purge on DCC view (bug #16775)
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
WeeChat FAQ, 2006-08-19
|
||||
WeeChat FAQ, 2006-10-01
|
||||
=======================
|
||||
|
||||
Intended audience:
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
WeeChat FAQ, 2006-08-19
|
||||
WeeChat FAQ, 2006-10-01
|
||||
=======================
|
||||
|
||||
Public concerné :
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ EXTRA_DIST = config.rpath BUGS FAQ FAQ.fr \
|
||||
debian/rules debian/weechat-common.docs \
|
||||
debian/weechat-common.install debian/weechat-curses.dirs \
|
||||
debian/weechat-curses.install debian/weechat-plugins.install \
|
||||
debian/weechat-curses.menu debian/NEWS \
|
||||
debian/weechat-curses.menu debian/NEWS debian/weechat.xpm \
|
||||
weechat.spec weechat_icon_32.png
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
* FlashCode, 2006-10-01
|
||||
|
||||
WeeChat 0.2.1 released.
|
||||
|
||||
* FlashCode, 2006-08-19
|
||||
|
||||
WeeChat 0.2.0 released.
|
||||
|
||||
Important release notes:
|
||||
|
||||
- if you upgraded with /upgrade in WeeChat, you should /disconnect and
|
||||
|
||||
@@ -19,14 +19,15 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.56)
|
||||
AC_INIT(WeeChat, 0.2.0, flashcode@flashtux.org)
|
||||
AC_INIT(WeeChat, 0.2.1, flashcode@flashtux.org)
|
||||
AC_CONFIG_SRCDIR([src/common/weechat.c])
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_INIT_AUTOMAKE([weechat], [0.2.0])
|
||||
AM_INIT_AUTOMAKE([weechat], [0.2.1])
|
||||
|
||||
# Checks for programs
|
||||
AC_PROG_CC
|
||||
AC_PROG_MAKE_SET
|
||||
AC_GNU_SOURCE
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
# Add some flags for some OS
|
||||
|
||||
@@ -1207,7 +1207,7 @@
|
||||
<entry>Zeichenfolge</entry>
|
||||
<entry>eine beliebige Zeichenfolge</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Befehle, die nach der Verbindung zum Server ausgeführt werden sollen (mehrere Befehle müssen mit einem Semikolon getrennt werden, um ein Semikolon zu schreiben, muss man '\;' verwenden)</entry>
|
||||
<entry>Command(s) to run when connected to server (many commands should be separated by ';', use '\;' for a semicolon, special variables $nick, $channel and $server are replaced by their value)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>server_command_delay</option></entry>
|
||||
@@ -1235,7 +1235,7 @@
|
||||
<entry>Zeichenfolge</entry>
|
||||
<entry>eine beliebige Zeichenfolge</entry>
|
||||
<entry>''</entry>
|
||||
<entry>Durch Kommata getrennte Liste der Notify-Levels für die Channels auf diesem Server (Format: #channel:1,...)</entry>
|
||||
<entry>Comma separated list of notify levels for channels of this server (format: #channel:1,..), a channel name '*' is reserved for server default notify level</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>server_charset_decode_iso</option></entry>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user