summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lua/loadavg.lua27
-rw-r--r--scripts/perl/audacious.pl45
-rw-r--r--scripts/perl/awaylog.pl68
-rw-r--r--scripts/perl/beep.pl56
-rw-r--r--scripts/perl/bufsave.pl82
-rw-r--r--scripts/perl/exec.pl129
-rw-r--r--scripts/perl/fete.pl163
-rw-r--r--scripts/perl/fortune.pl57
-rw-r--r--scripts/perl/growl-notify.pl94
-rw-r--r--scripts/perl/hello.pl34
-rw-r--r--scripts/perl/kernel.pl74
-rw-r--r--scripts/perl/layout.pl216
-rw-r--r--scripts/perl/logsearch.pl98
-rw-r--r--scripts/perl/logurlsql.pl72
-rw-r--r--scripts/perl/moc.pl166
-rw-r--r--scripts/perl/oldtopic.pl242
-rw-r--r--scripts/perl/sound.pl96
-rw-r--r--scripts/perl/translate.pl131
-rw-r--r--scripts/perl/weeter.pl78
-rw-r--r--scripts/perl/xmms.pl64
-rw-r--r--scripts/python/amarok.py231
-rw-r--r--scripts/python/auto_op.py86
-rw-r--r--scripts/python/autoauth.py245
-rw-r--r--scripts/python/autoaway.py153
-rw-r--r--scripts/python/awl.py76
-rw-r--r--scripts/python/catapult.py910
-rw-r--r--scripts/python/clonescan.py168
-rw-r--r--scripts/python/ctcp.py175
-rw-r--r--scripts/python/gimmicks.py99
-rw-r--r--scripts/python/keepnick.py204
-rw-r--r--scripts/python/last.fm.py56
-rw-r--r--scripts/python/mp3blaster.py36
-rw-r--r--scripts/python/mpd.py66
-rw-r--r--scripts/python/mpdnp.py101
-rw-r--r--scripts/python/onattach.py445
-rw-r--r--scripts/python/pyexec.py62
-rw-r--r--scripts/python/response.py289
-rw-r--r--scripts/python/shell.py136
-rw-r--r--scripts/python/theme.py196
-rw-r--r--scripts/python/tinyurl.py333
-rw-r--r--scripts/python/todo.py69
-rw-r--r--scripts/python/toggle.py131
-rw-r--r--scripts/python/uname.py18
-rw-r--r--scripts/python/urlgrab.py462
-rw-r--r--scripts/python/weempd.py40
-rw-r--r--scripts/python/weexaile.py53
-rw-r--r--scripts/ruby/browse.rb127
-rw-r--r--scripts/ruby/forcenick.rb35
-rw-r--r--scripts/ruby/myuptime.rb20
-rw-r--r--scripts/ruby/now-playing.rb66
-rw-r--r--scripts/ruby/rbox.rb84
51 files changed, 0 insertions, 7164 deletions
diff --git a/scripts/lua/loadavg.lua b/scripts/lua/loadavg.lua
deleted file mode 100644
index e56e814ff..000000000
--- a/scripts/lua/loadavg.lua
+++ /dev/null
@@ -1,27 +0,0 @@
--- 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
-
diff --git a/scripts/perl/audacious.pl b/scripts/perl/audacious.pl
deleted file mode 100644
index 8013f24f7..000000000
--- a/scripts/perl/audacious.pl
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# Copyright (c) 2006 by DeltaS4 <deltas4@gmail.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-#
-
-#
-# Changelog:
-# 0.1: first version
-# 0.2: now you don't need the Song Change plugin enabled because
-# it uses audtool --current-song to get the music name as nenolod
-# suggested (http://boards.nenolod.net/index.php?showtopic=147). :)
-#
-
-#
-# /setp perl.audacious.msg = "<msg that u want before the song>"
-# example: "is playing" * YourNick is playing Artist - Title
-# "now playing:" * YourNick now playing: Artist - Title
-# "at" * YourNick at Artist - Title
-#
-
-weechat::register ("audacious", "0.2", "", "audacious-weechat current song script (usage: /music)");
-weechat::add_command_handler ("music", audtool);
-
-$msg = weechat::get_plugin_config("msg");
-if ($msg eq $null) { weechat::set_plugin_config("msg", "is playing"); }
-
-sub audtool {
- $cs = `audtool --current-song`; chomp($cs);
- $msg = weechat::get_plugin_config("msg");
-
- weechat::command("/me $msg $cs");
-}
diff --git a/scripts/perl/awaylog.pl b/scripts/perl/awaylog.pl
deleted file mode 100644
index 0e70248c2..000000000
--- a/scripts/perl/awaylog.pl
+++ /dev/null
@@ -1,68 +0,0 @@
-##############################################################################
-# #
-# 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;
-}
-
diff --git a/scripts/perl/beep.pl b/scripts/perl/beep.pl
deleted file mode 100644
index 0005082f0..000000000
--- a/scripts/perl/beep.pl
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# Copyright (c) 2006-2007 by FlashCode <flashcode@flashtux.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 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, see <http://www.gnu.org/licenses/>.
-#
-
-#
-# Speaker beep on highlight/private msg.
-#
-# History:
-# 2007-08-10, FlashCode <flashcode@flashtux.org>:
-# version 0.2: upgraded licence to GPL 3
-# 2006-09-02, FlashCode <flashcode@flashtux.org>:
-# version 0.1: initial release
-#
-
-use strict;
-
-my $version = "0.2";
-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;
-}
diff --git a/scripts/perl/bufsave.pl b/scripts/perl/bufsave.pl
deleted file mode 100644
index b123cfa65..000000000
--- a/scripts/perl/bufsave.pl
+++ /dev/null
@@ -1,82 +0,0 @@
-#
-# Copyright (c) 2006-2007 by FlashCode <flashcode@flashtux.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 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, see <http://www.gnu.org/licenses/>.
-#
-
-#
-# Save current buffer to a file.
-#
-# History:
-#
-# 2007-08-10, FlashCode <flashcode@flashtux.org>:
-# version 0.3: upgraded licence to GPL 3
-# 2007-06-12, FlashCode <flashcode@flashtux.org>:
-# version 0.2: added filename completion
-# 2006-10-27, FlashCode <flashcode@flashtux.org>:
-# version 0.1: initial release
-#
-
-use strict;
-
-my $version = "0.3";
-
-weechat::register("bufsave", $version, "", "Save buffer content to a file");
-weechat::add_command_handler("bufsave", "bufsave_cmd",
- "save current buffer to a file",
- "filename",
- "filename: target file (must not exist)",
- "%f");
-
-sub bufsave_cmd
-{
- if ($#_ == 1)
- {
- my $server = shift;
- my $filename = shift;
-
- return weechat::PLUGIN_RC_OK if (! $filename);
-
- if (-e $filename)
- {
- weechat::print("Error: target file already exists!");
- return weechat::PLUGIN_RC_KO;
- }
-
- my $channel = weechat::get_info("channel");
- my @bc = weechat::get_buffer_data($server, $channel);
- if (@bc)
- {
- if (! open(FILE, ">$filename"))
- {
- weechat::print("Error writing to target file!");
- return weechat::PLUGIN_RC_KO;
- }
- foreach my $line (reverse(@bc))
- {
- my %l = %$line;
- print FILE "$l{date} " if ($l{date});
- print FILE "\<$l{nick}\> " if ($l{nick});
- print FILE "$l{data}\n";
- }
- close(FILE);
- }
- else
- {
- weechat::print("Error: no buffer data");
- return weechat::PLUGIN_RC_KO;
- }
- }
- return weechat::PLUGIN_RC_OK;
-}
diff --git a/scripts/perl/exec.pl b/scripts/perl/exec.pl
deleted file mode 100644
index 1bb3cf3d8..000000000
--- a/scripts/perl/exec.pl
+++ /dev/null
@@ -1,129 +0,0 @@
-##############################################################################
-# #
-# 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;
-
diff --git a/scripts/perl/fete.pl b/scripts/perl/fete.pl
deleted file mode 100644
index 45de419b9..000000000
--- a/scripts/perl/fete.pl
+++ /dev/null
@@ -1,163 +0,0 @@
-#
-# Copyright (c) 2003-2007 by FlashCode <flashcode@flashtux.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 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, see <http://www.gnu.org/licenses/>.
-#
-# fete.pl (c) December 2003 by FlashCode <flashcode@flashtux.org>
-# Updated on 2007-08-10 by FlashCode <flashcode@flashtux.org>
-#
-# Manages french calendat feasts with "/fete" command
-# Syntax: /fete - display today's and tomorrow's feast
-# /fete firstname - search for name in calendar
-#
-
-use locale;
-
-my $version = "0.7";
-
-weechat::register ("Fete", $version, "", "Gestion des fêtes du calendrier français", "UTF-8");
-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 ();
diff --git a/scripts/perl/fortune.pl b/scripts/perl/fortune.pl
deleted file mode 100644
index 5eba1405c..000000000
--- a/scripts/perl/fortune.pl
+++ /dev/null
@@ -1,57 +0,0 @@
-# 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;
-}
-
-
diff --git a/scripts/perl/growl-notify.pl b/scripts/perl/growl-notify.pl
deleted file mode 100644
index ce429d6fc..000000000
--- a/scripts/perl/growl-notify.pl
+++ /dev/null
@@ -1,94 +0,0 @@
-# growl-notify.pl -- Have Weechat send notifications thru Mac::Growl
-# Copyright (c) 2007 Zak B. Elep <zakame@spunge.org>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-use strict;
-
-use Mac::Growl;
-
-my $app = 'Weechat (Curses)';
-my @messages_events = (
- [ nick => 'Changed Nick', '$nick has changed nick to $text' ],
- [ join => 'Joined Room', '$nick has joined $text' ],
- [ part => 'Left Room', '$nick has left $channel($text)' ],
- [ quit => 'Quit', '$nick has quit($text)' ],
- [ topic => 'Set Topic', '$nick has set topic to \'$text\'' ],
- [ weechat_highlight => 'Highlight Mentioned', '$text in $channel' ],
- [ weechat_pv => 'Private Message', '$nick: $text' ],
-);
-my $notes;
-push @$notes, $_->[1] foreach @messages_events;
-
-Mac::Growl::RegisterNotifications $app, $notes, $notes;
-
-my $version = '0.2';
-weechat::register 'growl-notify', $version, '',
- 'Send Weechat notifications thru Mac::Growl';
-
-for my $message (@messages_events) {
- no strict 'refs'; # access symbol table
- my $subname = join '', __PACKAGE__, '::handler_', $message->[0];
- *{$subname} = sub
- {
- my($server, $args) = @_;
- # weechat::print $args;
- my($mask, $nick, $channel, $text);
- (undef, $channel, $text) = split /:/, $args, 3;
- ($mask, undef, $channel) = split / /, $channel;
- ($nick, undef) = split /!/, $mask;
- Mac::Growl::PostNotification $app, $message->[1],
- $message->[1], eval qq("$message->[2]"),
- ($message->[0] =~ /(pv|highlight)/ ? 1 : 0);
- return weechat::PLUGIN_RC_OK;
- };
- weechat::add_message_handler $message->[0], $subname;
-}
-
-__END__
-
-=head1 NAME
-
-growl-notify.pl - Send Weechat notifications thru the Growl framework for Mac
-
-=head1 SYNOPSIS
-
- # in Weechat console, do
- /perl load /path/to/growl-notify.pl
-
- # or put script in .weechat/perl/autoload/
-
-=head1 DESCRIPTION
-
-growl-notify is a script plugin for Weechat that sends notifications of common
-IRC events (such as joins, highlights, and private messages) to the Growl
-notification framework for the Macintosh. It uses the perl module L<Mac::Growl>
-to do its magic, even allowing the ncurses version of Weechat to generate
-graphical or audible event notifications.
-
-=head1 SEE ALSO
-
-L<http://growl.info>, L<Mac::Growl>, L<http://weechat.flashtux.org>
-
-=head1 AUTHORS
-
-Zak B. Elep, C<< zakame at spunge.org >>
-
-=cut
-
diff --git a/scripts/perl/hello.pl b/scripts/perl/hello.pl
deleted file mode 100644
index ff9417a3b..000000000
--- a/scripts/perl/hello.pl
+++ /dev/null
@@ -1,34 +0,0 @@
-# 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;
-}
-
diff --git a/scripts/perl/kernel.pl b/scripts/perl/kernel.pl
deleted file mode 100644
index ba8fae1a4..000000000
--- a/scripts/perl/kernel.pl
+++ /dev/null
@@ -1,74 +0,0 @@
-#
-# 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;
- }
-}
-
diff --git a/scripts/perl/layout.pl b/scripts/perl/layout.pl
deleted file mode 100644
index 5afc0f1fc..000000000
--- a/scripts/perl/layout.pl
+++ /dev/null
@@ -1,216 +0,0 @@
-#
-# Copyright (c) 2007 by FlashCode <flashcode@flashtux.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 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, see <http://www.gnu.org/licenses/>.
-#
-
-#
-# Save/restore buffers layout.
-#
-# History:
-#
-# 2007-08-10, FlashCode <flashcode@flashtux.org>:
-# version 0.2, minor changes in script description
-# 2007-08-10, FlashCode <flashcode@flashtux.org>:
-# version 0.1, initial release
-#
-
-use strict;
-
-my $version = "0.2";
-
-# default values in setup file (~/.weechat/plugins.rc)
-my $default_auto_save = "on";
-
-weechat::register("layout", $version, "unload_layout", "Save/restore buffers layout");
-weechat::set_plugin_config("auto_save", $default_auto_save) if (weechat::get_plugin_config("auto_save") eq "");
-
-weechat::add_command_handler("layout", "layout",
- "save/restore buffers layout",
- "[save]",
- "save: save buffers order",
- "save");
-weechat::add_event_handler("buffer_open", "buffer_open");
-
-
-# get buffer name, depending on type of buffer
-
-sub get_buffer_name
-{
- # DCC type ?
- return "<DCC>" if ($_[0] eq "1");
-
- # RAW IRC type ?
- return "<RAW>" if ($_[0] eq "2");
-
- # no channel ?
- if ($_[2] eq "")
- {
- return "<servers>" if (weechat::get_config("look_one_server_buffer") eq "on");
- return "<empty>" if ($_[1] eq "");
- return $_[1];
- }
-
- # return server/channel
- return $_[1]."/".$_[2];
-}
-
-# get buffer list and build a hash: number => name
-
-sub get_layout_hash
-{
- my %buflist;
- my $bufinfo = weechat::get_buffer_info();
- if ($bufinfo)
- {
- while (my ($nobuf, $binfos) = each %$bufinfo)
- {
- $buflist{$nobuf}{"server"} = $$binfos{"server"};
- $buflist{$nobuf}{"channel"} = $$binfos{"channel"};
- $buflist{$nobuf}{"name"} = get_buffer_name($$binfos{"type"},
- $$binfos{"server"},
- $$binfos{"channel"});
- }
- }
- return %buflist;
-}
-
-# get buffet list and build a hash: name => number
-
-sub get_layout_hash_by_name
-{
- my %buflist;
- my $bufinfo = weechat::get_buffer_info();
- if ($bufinfo)
- {
- while (my ($nobuf, $binfos) = each %$bufinfo)
- {
- my $name = get_buffer_name($$binfos{"type"},
- $$binfos{"server"},
- $$binfos{"channel"});
- $buflist{$name} = $nobuf;
- }
- }
- return %buflist;
-}
-
-# build a string with buffer list hash
-
-sub get_layout_string
-{
- my $layout = "";
- my %buflist = get_layout_hash();
- my @keys = sort { $a <=> $b } (keys %buflist);
- foreach my $key (@keys)
- {
- $layout .= ",".$key.":".$buflist{$key}{"name"};
- }
- $layout = substr($layout, 1);
- return $layout;
-}
-
-# build a hash (name => number) from config string
-
-sub get_hash_from_string
-{
- my %buflist;
- my @fields = split(/,/, $_[0]);
- foreach my $field (@fields)
- {
- $buflist{$2} = $1 if ($field =~ /([0-9]+):(.*)/);
- }
- return %buflist;
-}
-
-# save layout to plugin option
-
-sub save_layout
-{
- my $layout = get_layout_string();
- if ($layout ne "")
- {
- weechat::print_server("Layout: saving buffers order: $layout");
- weechat::set_plugin_config("buffers", $layout);
- }
-}
-
-# the /layout command
-
-sub layout
-{
- if ($_[1] eq "save")
- {
- save_layout();
- }
- else
- {
- weechat::command("/help layout");
- }
- return weechat::PLUGIN_RC_OK;
-}
-
-# event handler called when a buffer is open
-
-sub buffer_open
-{
- # retrieve current layout and config layout
- my %buflist = get_layout_hash();
- my %buflist_name = get_layout_hash_by_name();
- my %config = get_hash_from_string(weechat::get_plugin_config("buffers"));
-
- my $name = $buflist{$_[0]}{"name"};
-
- # scan open buffers and look for correct position
- my $pos = $config{$name};
- if ($pos ne "")
- {
- my @keys = sort { $b <=> $a } (keys %buflist);
- my $nbbuf = $#keys + 1;
-
- # find best position (move to last known buffer + 1)
- my ($best_pos, $best_pos2) = (-1, -1);
- my $config_seen = 0;
- foreach my $key (@keys)
- {
- $config_seen = 1 if (($name ne $buflist{$key}{"name"})
- && ($config{$buflist{$key}{"name"}} ne ""));
- $best_pos = scalar($key) if ($config_seen == 0);
- }
- foreach my $key (@keys)
- {
- $best_pos2 = scalar($key) if (($best_pos2 == -1)
- && ($name ne $buflist{$key}{"name"})
- && ($config{$buflist{$key}{"name"}} ne "")
- && (scalar($config{$name}) < scalar($config{$buflist{$key}{"name"}})));
- }
- $best_pos = $best_pos2 if (($best_pos2 != -1) && ($best_pos2 < $best_pos));
-
- if (($best_pos != -1) && ($best_pos != scalar($buflist_name{$name})))
- {
- weechat::command("/buffer move $best_pos",
- $buflist{$_[0]}{"channel"},
- $buflist{$_[0]}{"server"});
- }
- }
-
- return weechat::PLUGIN_RC_OK;
-}
-
-# function called when unloading script (save layout if auto_save is on)
-
-sub unload_layout
-{
- my $auto_save = weechat::get_plugin_config("auto_save");
- save_layout() if (lc($auto_save) eq "on");
-}
diff --git a/scripts/perl/logsearch.pl b/scripts/perl/logsearch.pl
deleted file mode 100644
index 75001af96..000000000
--- a/scripts/perl/logsearch.pl
+++ /dev/null
@@ -1,98 +0,0 @@
-#
-# Copyright (c) 2006-2007 by FlashCode <flashcode@flashtux.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 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, see <http://www.gnu.org/licenses/>.
-#
-
-#
-# Search for text in WeeChat disk log files.
-#
-# History:
-# 2007-08-10, FlashCode <flashcode@flashtux.org>:
-# version 0.2: upgraded licence to GPL 3
-# 2006-04-17, FlashCode <flashcode@flashtux.org>:
-# version 0.1: initial release
-#
-
-use strict;
-
-my $version = "0.2";
-
-# 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", $version, "", "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;
-}
diff --git a/scripts/perl/logurlsql.pl b/scripts/perl/logurlsql.pl
deleted file mode 100644
index c52820867..000000000
--- a/scripts/perl/logurlsql.pl
+++ /dev/null
@@ -1,72 +0,0 @@
-# perl
-# Logs URLs to a p5-DBI-MySQL database.
-# This script is BSD licensed.
-# Hacked together by Karlis "Hagabard" Loen in Feb 2007
-# hagabard AT gmail DOT com
-# Table format: (ircurls is default table name in script)
-#+-----------+---------------+------+-----+---------+-------+
-#| Field | Type | Null | Key | Default | Extra |
-#+-----------+---------------+------+-----+---------+-------+
-#| timestamp | timestamp(14) | YES | | NULL | |
-#| hostmask | text(255) | YES | | NULL | |
-#| target | text(255) | YES | | NULL | |
-#| url | text(255) | YES | | NULL | |
-#+-----------+---------------+------+-----+---------+-------+
-# In the future I hope to get around to adding stuff like:
-#+-----------+---------------+------+-----+---------+-------+
-#| httptitle | text(255) | YES | | NULL | |
-#| httpdinfo | text(255) | YES | | NULL | |
-#| tinyurl | text(255) | YES | | NULL | |
-#+-----------+---------------+------+-----+---------+-------+
-# Test other DBI types, maybe /setp perl.logurlsql.dbtype="Pg" works?
-
-# Tested with p5-DBI-Mysql, others untested
-use DBI;
-
-weechat::register("logurlsql", "0.2", "", "WeeChat p5-DBI script to log URLs to a SQL Database.");
-
-weechat::add_message_handler("*", "cmd_logurl");
-
-# Setup Database connection, now with /setp for your configuration pleasure
-weechat::set_plugin_config("dbtype", "mysql") if (weechat::get_plugin_config("dbtype") eq "");
-weechat::set_plugin_config("dbhost", "localhost") if (weechat::get_plugin_config("dbhost") eq "");
-weechat::set_plugin_config("dbname", "weechat") if (weechat::get_plugin_config("dbname") eq "");
-weechat::set_plugin_config("dbtable", "ircurls") if (weechat::get_plugin_config("dbtable") eq "");
-weechat::set_plugin_config("dbuser", "irc") if (weechat::get_plugin_config("dbuser") eq "");
-weechat::set_plugin_config("dbpass", "forever") if (weechat::get_plugin_config("dbpass") eq "");
-
-# Regexps
-sub URL_SCHEME_REGEX() { '(http|ftp|https|news|irc)' }
-sub URL_GUESS_REGEX() { '(www|ftp)' }
-sub URL_BASE_REGEX() { '[a-z0-9_\-+\\/:?%.&!~;,=\#<]' }
-
-# This sub borrowed from the BSD licensed urlplot.pl irssi script by bwolf.
-sub scan_url {
- my $rawtext = shift;
- return $1 if $rawtext =~ m|(@{[ URL_SCHEME_REGEX ]}://@{[ URL_BASE_REGEX ]}+)|io;
- # The URL misses a scheme, try to be smart
- if ($rawtext =~ m|@{[ URL_GUESS_REGEX ]}\.@{[ URL_BASE_REGEX ]}+|io) {
- my $preserve = $&;
- return "http://$preserve" if $1 =~ /^www/;
- return "ftp://$preserve" if $1 =~ /^ftp/;
- }
- return undef;
-}
-
-sub cmd_logurl {
- ($null, $target, $data) = split ":",$_[1],3;
- ($hostmask, $null, $target) = split " ", $target;
- if (defined($url = scan_url($data))) {
- #weechat::print("hostmask=$hostmask, target=$target, url=$url");
- db_insert($hostmask, $target, $url);
- }
- return weechat::PLUGIN_RC_OK;
-}
-
-sub db_insert {
- my ($hostmask, $target, $url)=@_;
- my $dbh = DBI->connect( "DBI:". weechat::get_plugin_config(dbtype) .":". weechat::get_plugin_config(dbname) .":". weechat::get_plugin_config(dbhost), weechat::get_plugin_config(dbuser), weechat::get_plugin_config(dbpass));
- my $sql="insert into ". weechat::get_plugin_config(dbtable) ." (timestamp, hostmask, target, url) values (NOW()".",". $dbh->quote($hostmask) ."," . $dbh->quote($target) ."," . $dbh->quote($url) .")";
- my $sth = $dbh->do($sql);
- $dbh->disconnect();
-}
diff --git a/scripts/perl/moc.pl b/scripts/perl/moc.pl
deleted file mode 100644
index 23fbcd364..000000000
--- a/scripts/perl/moc.pl
+++ /dev/null
@@ -1,166 +0,0 @@
-##############################################################################
-# #
-# 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;
-}
-
diff --git a/scripts/perl/oldtopic.pl b/scripts/perl/oldtopic.pl
deleted file mode 100644
index 013b5e95c..000000000
--- a/scripts/perl/oldtopic.pl
+++ /dev/null
@@ -1,242 +0,0 @@
-#
-# Copyright (c) 2007 by FlashCode <flashcode@flashtux.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 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, see <http://www.gnu.org/licenses/>.
-#
-
-#
-# Display old topics for a channel.
-#
-# History:
-# 2007-08-10, FlashCode <flashcode@flashtux.org>:
-# version 0.2: upgraded licence to GPL 3
-# 2007-03-29, FlashCode <flashcode@flashtux.org>:
-# version 0.1: initial release
-#
-
-use strict;
-
-my $version = "0.2";
-
-my $plugin_help_options = "Plugins options (set with /setp):\n"
- ." - perl.oldtopic.log_server: if on, displays all topic changes on server buffer\n"
- ." - perl.oldtopic.max_topics: number of topics to keep for each channel "
- ."(0 = do not keep any topics)";
-
-# default values in setup file (~/.weechat/plugins.rc)
-my $default_log_server = "off";
-my $default_max_topics = "10";
-
-# init script
-weechat::register("oldtopic", $version, "", "Display old topics for a channel");
-weechat::set_plugin_config("log_server", $default_log_server) if (weechat::get_plugin_config("log_server") eq "");
-weechat::set_plugin_config("max_topics", $default_max_topics) if (weechat::get_plugin_config("max_topics") eq "");
-
-# message and command handlers
-weechat::add_message_handler("topic", "topic_msg");
-weechat::add_message_handler("332", "topic_332_msg");
-weechat::add_message_handler("333", "topic_333_msg");
-weechat::add_command_handler ("lasttopic", "lasttopic_cmd",
- "Display last topic for a channel (topic before current one)",
- "[channel]",
- "channel: channel name (default: current channel)\n\n"
- .$plugin_help_options,
- "%C");
-weechat::add_command_handler ("oldtopic", "oldtopic_cmd",
- "Display old topics for a channel",
- "[channel]",
- "channel: channel name (default: current channel)\n\n"
- .$plugin_help_options,
- "%C");
-
-my %oldtopic;
-undef %oldtopic;
-
-my %msg_332_topic;
-undef %msg_332_topic;
-
-sub get_config
-{
- my $conf_log_server = weechat::get_plugin_config("log_server");
- $conf_log_server = $default_log_server if ($conf_log_server eq "");
-
- my $conf_max = weechat::get_plugin_config("max_topics");
- $conf_max = $default_max_topics if ($conf_max eq "");
- $conf_max = 0 if ($conf_max < 0);
-
- return ($conf_log_server, $conf_max);
-}
-
-sub add_topic
-{
- my ($server, $channel, $nick, $topic, $topicdate, $conf_max) =
- ($_[0], $_[1], $_[2], $_[3], $_[4], $_[5]);
-
- my $time = $topicdate;
- $time = time() if ($time eq "");
-
- $oldtopic{$server}{$channel}{$time}{"nick"} = $nick;
- $oldtopic{$server}{$channel}{$time}{"topic"} = $topic;
- my $numchan = scalar(keys(%{$oldtopic{$server}{$channel}}));
- if ($numchan > $conf_max)
- {
- my $diff = $numchan - $conf_max;
- my $count = 0;
- foreach my $date (sort keys %{$oldtopic{$server}{$channel}})
- {
- delete($oldtopic{$server}{$channel}{$date});
- $count++;
- last if ($count >= $diff);
- }
- }
-}
-
-# received when someone changes topic on a channel
-sub topic_msg
-{
- my $server = $_[0];
- my ($conf_log_server, $conf_max) = get_config();
-
- if ($_[1] =~ /(.*) TOPIC (.*)/)
- {
- my $nick = $1;
- my $args = $2;
- my $nick = $1 if ($nick =~ /:?([^!]+)(!?.*)/);
- if ($args =~ /([\#\&\+\!][^ ]*) (.*)/)
- {
- my $channel = $1;
- my $topic = $2;
- $topic = $1 if ($topic =~ /:(.*)/);
-
- if ($conf_log_server eq "on")
- {
- weechat::print("Topic on $channel changed by ${nick} to: \"${topic}\x0F\"",
- "", $server);
- }
-
- if ($conf_max > 0)
- {
- add_topic($server, $channel, $nick, $topic, "", $conf_max);
- }
- else
- {
- delete($oldtopic{$server}{$channel});
- }
- }
- }
- return weechat::PLUGIN_RC_OK;
-}
-
-# topic for a channel (when joining channel)
-sub topic_332_msg
-{
- my $server = $_[0];
-
- if ($_[1] =~ /(.*) 332 (.*)/)
- {
- my $args = $2;
- if ($args =~ /([\#\&\+\!][^ ]*) (.*)/)
- {
- my $channel = $1;
- my $topic = $2;
- $topic = $1 if ($topic =~ /:(.*)/);
- $msg_332_topic{$server}{$channel} = $topic;
- }
- }
- return weechat::PLUGIN_RC_OK;
-}
-
-# nick/date for topic (when joining channel, received after 332)
-sub topic_333_msg
-{
- my $server = $_[0];
-
- if ($_[1] =~ /.* 333 .* ([\#\&\+\!][^ ]*) (.*) ([0-9]+)/)
- {
- my $channel = $1;
- my $nick = $2;
- my $date = $3;
- my ($conf_log_server, $conf_max) = get_config();
- add_topic($server, $channel, $nick,
- $msg_332_topic{$server}{$channel},
- $date, $conf_max);
- }
- return weechat::PLUGIN_RC_OK;
-}
-
-sub lasttopic_cmd
-{
- my $server = weechat::get_info("server");
- my $channel = weechat::get_info("channel");
- $channel = $_[1] if ($_[1] ne "");
-
- if ($channel ne "")
- {
- my ($conf_log_server, $conf_max) = get_config();
-
- delete($oldtopic{$server}{$channel}) if ($conf_max == 0);
-
- my $count = 0;
- my $found = 0;
- foreach my $date (sort { $b <=> $a } keys %{$oldtopic{$server}{$channel}})
- {
- $count++;
- if ($count > 1)
- {
- $found = 1;
- weechat::print("Last topic for ${server}/${channel}: on ".localtime($date)." by ".
- $oldtopic{$server}{$channel}{$date}{"nick"}.": \"".
- $oldtopic{$server}{$channel}{$date}{"topic"}."\x0F\"");
- last;
- }
- }
- weechat::print("Last topic not found for channel ${server}/${channel}.") if ($found == 0);
- }
- else
- {
- weechat::print("Error: this buffer is not a channel.");
- }
-
- return weechat::PLUGIN_RC_OK;
-}
-
-sub oldtopic_cmd
-{
- my $server = weechat::get_info("server");
- my $channel = weechat::get_info("channel");
- $channel = $_[1] if ($_[1] ne "");
-
- if ($channel ne "")
- {
- my ($conf_log_server, $conf_max) = get_config();
-
- delete($oldtopic{$server}{$channel}) if ($conf_max == 0);
-
- my $found = 0;
- foreach my $date (sort keys %{$oldtopic{$server}{$channel}})
- {
- $found = 1;
- weechat::print("Topic for ${server}/${channel} on ".localtime($date)." by ".
- $oldtopic{$server}{$channel}{$date}{"nick"}.": \"".
- $oldtopic{$server}{$channel}{$date}{"topic"}."\x0F\"");
- }
- weechat::print("No old topic for channel ${server}/${channel}.") if ($found == 0);
- }
- else
- {
- weechat::print("Error: this buffer is not a channel.");
- }
-
- return weechat::PLUGIN_RC_OK;
-}
diff --git a/scripts/perl/sound.pl b/scripts/perl/sound.pl
deleted file mode 100644
index 956d5b7df..000000000
--- a/scripts/perl/sound.pl
+++ /dev/null
@@ -1,96 +0,0 @@
-#
-# Copyright (c) 2006-2007 by FlashCode <flashcode@flashtux.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 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, see <http://www.gnu.org/licenses/>.
-#
-
-#
-# Play a sound when highlighted/private msg, or for ctcp sound event.
-#
-# History:
-#
-# 2007-08-10, FlashCode <flashcode@flashtux.org>:
-# version 0.4: upgraded licence to GPL 3
-# 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.4";
-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;
-}
diff --git a/scripts/perl/translate.pl b/scripts/perl/translate.pl
deleted file mode 100644
index 306d3816a..000000000
--- a/scripts/perl/translate.pl
+++ /dev/null
@@ -1,131 +0,0 @@
-#
-# Copyright (c) 2006-2007 by FlashCode <flashcode@flashtux.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 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, see <http://www.gnu.org/licenses/>.
-#
-
-#
-# Translate words and display result in infobar, local buffer or channel
-#
-# History:
-# 2007-08-10, FlashCode <flashcode@flashtux.org>:
-# version 0.2: upgraded licence to GPL 3
-# 2006-07-03, FlashCode <flashcode@flashtux.org>:
-# version 0.1: initial release
-#
-
-use strict;
-
-my $version = "0.2";
-
-# 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", $version, "", "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;
-}
diff --git a/scripts/perl/weeter.pl b/scripts/perl/weeter.pl
deleted file mode 100644
index 7c5c05f8f..000000000
--- a/scripts/perl/weeter.pl
+++ /dev/null
@@ -1,78 +0,0 @@
-# weeter.pl -- Send CTCP ACTION messages as Twitter status updates
-# Copyright (c) 2007 Zak B. Elep <zakame@spunge.org>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-use strict;
-
-use Net::Twitter;
-
-my $version = '0.1';
-weechat::register 'weeter', $version, '',
- 'Send CTCP ACTION messages as Twitter status updates';
-
-my %credentials;
-for(qw(username password)){
- $credentials{$_} = weechat::get_plugin_config $_;
-}
-my $twitter = new Net::Twitter %credentials;
-
-weechat::add_modifier 'irc_user', 'privmsg', 'twitter_update';
-sub twitter_update
-{
- my $message = $_[1];
- (my $status = $message) =~ s#^/me\s+##;
- update $twitter $status unless $status eq $message;
- return $message;
-}
-
-__END__
-
-=head1 NAME
-
-weeter.pl - Send Weechat CTCP ACTION messages to Twitter as status updates
-
-=head1 SYNOPSIS
-
- # in Weechat console, do
- /setp perl.weeter.username = 'your-twitter-username'
- /setp perl.weeter.password = 'your-twitter-password'
- /perl load /path/to/weeter.pl
-
- # or do the /setp and put script in .weechat/perl/autoload
-
-=head1 DESCRIPTION
-
-weeter is a script plugin for Weechat that enables CTCP ACTION messages (aka
-C</me> actions) to be sent to the Twitter web service as user status updates.
-It uses the L<Net::Twitter> plugin from CPAN to do its work.
-
-weeter requires the variables C<perl.weeter.username> and
-C<perl.weeter.password> defined prior to use.
-
-=head1 SEE ALSO
-
-L<http://twitter.com>, L<Net::Twitter>, L<http://weechat.flashtux.org>
-
-=head1 AUTHORS
-
-Zak B. Elep, C<< zakame at spunge.org >>
-
-=cut
-
diff --git a/scripts/perl/xmms.pl b/scripts/perl/xmms.pl
deleted file mode 100644
index d68fe35d9..000000000
--- a/scripts/perl/xmms.pl
+++ /dev/null
@@ -1,64 +0,0 @@
-#####################################################################
-# xmms perl script for weechat #
-# #
-# Displays some useless xmms-infopipe values #
-# (c) 2006 by Cédric Chalier <ounaid AT gmail DOT com> #
-# #
-# This program is free software; you can redistribute it and/or #
-# modify it under the terms of the GNU General Public License #
-# 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 $
diff --git a/scripts/python/amarok.py b/scripts/python/amarok.py
deleted file mode 100644
index 79827185b..000000000
--- a/scripts/python/amarok.py
+++ /dev/null
@@ -1,231 +0,0 @@
-#
-# Copyright (c) 2006 by Eric Gach <eric.gach@gmail.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-#
-
-import weechat
-import os
-import subprocess
-import traceback
-
-__desc__ = 'Amarok control and now playing script for Weechat.'
-__version__ = '1.0.2'
-__author__ = 'Eric Gach <eric.gach@gmail.com>'
-# With changes by Leonid Evdokimov (weechat at darkk dot net another dot ru):
-# http://darkk.net.ru/weechat/amarok.py
-# v 1.0.1 - added %year%
-# v 1.0.2 - fixed bug with dead zombie-childs
-# fixed bug when loading second instance of the script
-# added better default for dcop_user setting
-
-dcop = {}
-debug = {}
-infobar = {}
-output = {}
-ssh = {}
-
-class amarokException(Exception):
- pass
-
-def amarokCommand(server, args):
- try:
- args = args.split(' ')
- if args[0] == 'infobar':
- if infobar['enabled']:
- infobar['enabled'] = False
- weechat.set_plugin_config('infobar_enabled', '0')
- weechat.remove_timer_handler('amarokInfobarUpdate')
- weechat.remove_infobar(0)
- weechat.prnt('Infobar disabled')
- else:
- infobar['enabled'] = True
- weechat.set_plugin_config('infobar_enabled', '1')
- amarokInfobarUpdate()
- weechat.add_timer_handler(infobar['update'], 'amarokInfobarUpdate')
- weechat.prnt('Infobar enabled')
- return weechat.PLUGIN_RC_OK
- elif args[0] == 'next':
- __executeCommand('next')
- weechat.prnt('Amarok: Playing next song.')
- return weechat.PLUGIN_RC_OK
- elif args[0] == 'np':
- return amarokNowPlaying(server)
- elif args[0] == 'pause':
- __executeCommand('pause')
- weechat.prnt('Amarok: Song paused.')
- return weechat.PLUGIN_RC_OK
- elif args[0] == 'play':
- __executeCommand('play')
- weechat.prnt('Amarok: Started playing.')
- return weechat.PLUGIN_RC_OK
- elif args[0] == 'prev':
- __executeCommand('prev')
- weechat.prnt('Amarok: Playing previous song.')
- return weechat.PLUGIN_RC_OK
- elif args[0] == 'stop':
- __executeCommand('stop')
- weechat.prnt('Amarok: Stop playing.')
- return weechat.PLUGIN_RC_OK
- elif args[0] == '':
- return amarokDisplayHelp(server)
- else:
- weechat.prnt('Amarok: Unknown command %s' % (args[0]), '', server)
- return weechat.PLUGIN_RC_OK
- except amarokException, ex:
- return weechat.PLUGIN_RC_KO
- except:
- file = open(debug['file'], 'w')
- traceback.print_exc(None, file)
- weechat.prnt('Unknown Exception encountered. Stack dumped to %s' % (debug['file']), '', server)
- return weechat.PLUGIN_RC_KO
-
-def amarokDisplayHelp(server):
- weechat.prnt('%s - Version: %s' % (__desc__, __version__), '', server)
- weechat.prnt('Author: %s' % (__author__), '', server)
- weechat.prnt('', '', server)
- weechat.prnt('Commands Available', '', server)
- weechat.prnt(' /amarok next - Move to the next song in the playlist.', '', server)
- weechat.prnt(' /amarok np - Display currently playing song.', '', server)
- weechat.prnt(' /amarok play - Start playing music.', '', server)
- weechat.prnt(' /amarok pause - Toggle between pause/playing.', '', server)
- weechat.prnt(' /amarok prev - Move to the previous song in the playlist.', '', server)
- weechat.prnt(' /amarok stop - Stop playing music.', '', server)
- weechat.prnt(' /amarok infobar - Toggle the infobar display.', '', server)
- weechat.prnt('', '', server)
- weechat.prnt('Formatting', '', server)
- weechat.prnt(' %artist% - Replaced with the song artist.', '', server)
- weechat.prnt(' %title% - Replaced with the song title.', '', server)
- weechat.prnt(' %album% - Replaced with the song album.', '', server)
- weechat.prnt(' %year% - Replaced with the song year tag.', '', server)
- weechat.prnt(' %cTime% - Replaced with how long the song has been playing.', '', server)
- weechat.prnt(' %tTime% - Replaced with the length of the song.', '', server)
- weechat.prnt(' %bitrate% - Replaced with the bitrate of the song.', '', server)
- return weechat.PLUGIN_RC_OK
-
-def amarokInfobarUpdate():
- __loadSettings()
- if infobar['enabled'] == False:
- return weechat.PLUGIN_RC_OK
-
- isPlaying = __executeCommands((__dcopCommand('isPlaying'),))
- if isPlaying.strip() == 'false':
- weechat.print_infobar(infobar['update'], 'Amarok is not currently playing')
- return weechat.PLUGIN_RC_OK
- else:
- song = __getSongInfo()
- format = __formatNP(infobar['format'], song)
- weechat.print_infobar(infobar['update'], format)
- return weechat.PLUGIN_RC_OK
-
-
-def amarokNowPlaying(server):
- __loadSettings()
- isPlaying = __executeCommands((__dcopCommand('isPlaying'),))
- if isPlaying.strip() == 'false':
- weechat.prnt('Amarok is not playing.', '', server)
- return weechat.PLUGIN_RC_KO
- else:
- song = __getSongInfo()
- format = __formatNP(output['format'], song)
- weechat.command(format)
- return weechat.PLUGIN_RC_OK
-
-def amarokUnload():
- """Unload the plugin from weechat"""
- if infobar['enabled']:
- weechat.remove_infobar(0)
- weechat.remove_timer_handler('amarokInfobarUpdate')
- return weechat.PLUGIN_RC_OK
-
-def __formatNP(template, song):
- np = template.replace('%artist%', song['artist'])
- np = np.replace('%title%', song['title'])
- np = np.replace('%album%', song['album'])
- np = np.replace('%cTime%', song['cTime'])
- np = np.replace('%tTime%', song['tTime'])
- np = np.replace('%bitrate%', song['bitrate'])
- np = np.replace('%year%', song['year'])
- return np
-
-def __dcopCommand(cmd):
- if dcop['user'] == ':':
- return 'dcop amarok player %s' % (cmd)
- else:
- return 'dcop --user %s amarok player %s' % (dcop['user'], cmd)
-
-def __executeCommands(cmds):
- from subprocess import PIPE
- cmds = " && ".join(cmds)
- if ssh['enabled']:
- cmds = 'ssh -p %d %s@%s "%s"' % (ssh['port'], ssh['user'], ssh['host'], cmds)
- proc = subprocess.Popen(cmds, shell = True, stderr = PIPE, stdout = PIPE, close_fds = True)
- error = proc.stderr.read()
- if error != '':
- weechat.prnt(error)
- output = proc.stdout.read()
- proc.wait()
- return output
-
-def __getSongInfo():
- """Get the song information from amarok"""
- song = {}
- songs = __executeCommands(
- (
- __dcopCommand('artist'),
- __dcopCommand('title'),
- __dcopCommand('album'),
- __dcopCommand('currentTime'),
- __dcopCommand('totalTime'),
- __dcopCommand('bitrate'),
- __dcopCommand('year')
- )
- )
-
- song['artist'], song['title'], song['album'], song['cTime'], song['tTime'], song['bitrate'], song['year'], empty = songs.split("\n")
- return song
-
-def __loadSettings():
- dcop['user'] = __loadSetting('dcop_user', ':')
- debug['file'] = os.path.expanduser(__loadSetting('debug_file', '~/amarok_debug.txt'))
- infobar['enabled'] = __loadSetting('infobar_enabled', '0', 'bool')
- infobar['format'] = __loadSetting('infobar_format', 'Now Playing: %title% by %artist%')
- infobar['update'] = __loadSetting('infobar_update', '10', 'int')
- output['format'] = __loadSetting('output_format', '/me is listening to %C04%title%%C by %C03%artist%%C from %C12%album%%C [%cTime% of %tTime% @ %bitrate%kbps]')
- ssh['enabled'] = __loadSetting('ssh_enabled', '0', 'bool')
- ssh['host'] = __loadSetting('ssh_host', 'localhost')
- ssh['port'] = __loadSetting('ssh_port', '22', 'int')
- ssh['user'] = __loadSetting('ssh_user', 'user')
-
-def __loadSetting(setting, default=None, type=None):
- value = weechat.get_plugin_config(setting)
- if value == '' and default != None:
- weechat.set_plugin_config(setting, default)
- value = default
-
- if type == 'int' or type == 'bool':
- value = int(value)
- if type == 'bool':
- value = bool(value)
-
- return value
-
-if weechat.register('amarok', __version__, 'amarokUnload', __desc__):
- __loadSettings()
- if infobar['enabled']:
- amarokInfobarUpdate()
- weechat.add_timer_handler(infobar['update'], 'amarokInfobarUpdate')
- weechat.add_command_handler('amarok', 'amarokCommand', 'Manage amarok or display now playing information.', 'next|np|play|pause|prev|stop|infobar')
-
diff --git a/scripts/python/auto_op.py b/scripts/python/auto_op.py
deleted file mode 100644
index 5cdf3b9d5..000000000
--- a/scripts/python/auto_op.py
+++ /dev/null
@@ -1,86 +0,0 @@
-# --------------------------------------------------------------------
-#
-# 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
-# --------------------------------------------------------------------
-#
-# 2006-12-14, FlashCode <flashcode@flashtux.org>:
-# fixed message split (for servers like quakenet with no ":" after "JOIN")
-
-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
- user, channel = args.split(" JOIN ")
- nick, next = user.split("!")
- if channel.startswith(':'):
- channel = channel[1:]
- 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
- user, channel = args.split(" JOIN ")
- nick, next = user.split("!")
- if channel.startswith(':'):
- channel = channel[1:]
- 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.3", "", "auto op plug-in for weechat")
-weechat.add_message_handler ("join", "auto_op")
-
-
diff --git a/scripts/python/autoauth.py b/scripts/python/autoauth.py
deleted file mode 100644
index 6480cd73d..000000000
--- a/scripts/python/autoauth.py
+++ /dev/null
@@ -1,245 +0,0 @@
-# -*- 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
diff --git a/scripts/python/autoaway.py b/scripts/python/autoaway.py
deleted file mode 100644
index b61d74dfe..000000000
--- a/scripts/python/autoaway.py
+++ /dev/null
@@ -1,153 +0,0 @@
-# --------------------------------------------------------------------
-#
-# 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")
-
diff --git a/scripts/python/awl.py b/scripts/python/awl.py
deleted file mode 100644
index 798b3542f..000000000
--- a/scripts/python/awl.py
+++ /dev/null
@@ -1,76 +0,0 @@
-"""
- This script shows buffer list in infobar. Nothing more.
- It's inspired by `awl.pl` irssi script, but is less advanced. :)
-
- The script is in the public domain.
- Leonid Evdokimov (weechat at darkk dot net dot ru)
- http://darkk.net.ru/weechat/awl.py
-
-0.1 - initial commit
-0.2 - added `show_servers` option
-0.3 - infobar is actually redrawed only if that's necessary
-"""
-
-#######################################################################
-
-import weechat
-from itertools import ifilter
-
-VERSION = "0.3"
-NAME = "awl"
-# how often to refresh infobar
-timer_interval = 1
-blist = ()
-
-def cleanup():
- weechat.remove_infobar(-1)
- return weechat.PLUGIN_RC_OK
-
-def cfg_boolean(key, default = False):
- map = {True: 'ON', False: 'OFF'}
- value = weechat.get_plugin_config(key).upper()
- if not value in map.values():
- if value:
- weechat.prnt("[%s]: invalid %s value (%s), resetting to %s" % (NAME, key, value, map[default]))
- weechat.set_plugin_config(key, map[default])
- value = default
- else:
- value = ifilter(lambda p: p[1] == value, map.iteritems()).next()[0]
- return value
-
-def update_channels():
- global blist
- names = ()
- buffers = weechat.get_buffer_info()
- if buffers != None:
- for index, buffer in buffers.iteritems():
- #**** info for buffer no 8 ****
- # > log_filename, notify_level, server, num_displayed, type, channel
- if len(buffer['channel']):
- name = buffer['channel']
- elif len(buffer['server']):
- if cfg_boolean('show_servers'):
- name = "[" + buffer['server'] + "]"
- else:
- continue
- else:
- name = "?"
- names += ("%i:%s" % (index, name), )
- if (names != blist):
- the_string = " ".join(names)
- blist = names
- weechat.remove_infobar(-1)
- weechat.print_infobar(0, the_string);
-
-def on_timer():
- update_channels()
- return weechat.PLUGIN_RC_OK
-
-if weechat.register(NAME, VERSION, "cleanup", "bufferlist in infobar"):
- #message handlers are called __before__ buflist is changed, so we don't use them
- weechat.add_timer_handler(timer_interval, "on_timer")
- cfg_boolean('show_servers', False)
- update_channels()
-
-# vim:set tabstop=4 softtabstop=4 shiftwidth=4:
-# vim:set expandtab:
diff --git a/scripts/python/catapult.py b/scripts/python/catapult.py
deleted file mode 100644
index 011cba339..000000000
--- a/scripts/python/catapult.py
+++ /dev/null
@@ -1,910 +0,0 @@
-# Catapult v0.2 - less ordinary abuse generator
-# Copyright (C) 2007 Pavel Shevchuk <stlwrt@gmail.com>
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-import weechat
-import random
-
-weechat.register("Catapult", "0.2", "", "Less ordinary abuse generator.")
-weechat.add_command_handler("slap", "slapper", "Creative slapper", "<target>", "", "%n")
-weechat.add_command_handler("give", "giver", "Creative giver", "<target>", "", "%n")
-weechat.add_command_handler("hate", "hater", "Creative hater", "<target>", "", "%n")
-weechat.add_command_handler("love", "lover", "Creative lover", "<target>", "", "%n")
-weechat.add_command_handler("dance", "dancer", "Creative dancer", "<target>", "", "%n")
-weechat.add_command_handler("excuse", "excuser", "BOFH excuses")
-weechat.add_command_handler("fortune", "fortune", "Fortune cookies!")
-weechat.add_command_handler("winjoke", "winjoke", "Windoze jokes")
-weechat.add_command_handler("linjoke", "linjoke", "Linux jokes")
-
-# slapper
-def slapper(server, args):
- 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",
- "a 50'' CRT monitor",
- "a warehouse (Quadratisch. Praktisch. Gut.)"
- ]
- 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
-
-# giver
-def giver(server, args):
- objects = [
- "a binary four",
- "a nice cup of SHUT THE FUCK UP",
- "an asskick",
- "a sign: 'Please kill yourself'",
- "a sign: 'Please go home now'",
- "an unlocked Grenade *tick tick BOOM*",
- "a gun - do it for mankind!"
-
- ]
- if args <> "":
- weechat.command("/me gives %s %s." % (args, random.choice(objects)))
- return weechat.PLUGIN_RC_OK
- else:
- weechat.prnt("You must specify target")
- return weechat.PLUGIN_RC_KO
-
-# hater
-def hater(server, args):
- objects = [
- "so much, that he spits hellfire",
- "so much, that he want's to shoot someone",
- "SOOOO MUUUUCH!!!"
-
- ]
- if args <> "":
- weechat.command("/me hates %s %s." % (args, random.choice(objects)))
- return weechat.PLUGIN_RC_OK
- else:
- weechat.prnt("You must specify target")
- return weechat.PLUGIN_RC_KO
-
-# lover
-def lover(server, args):
- actions = [
- "a *mwah*",
- "a wet kiss",
- "a tight and long hug",
- "an ass-squeeze",
- "a tight hug",
- "a wet kiss",
- "a nice, tight hug",
- "a kiss on the cheek",
- "a wet, french kiss",
- "a kiss",
- "a hug",
- "sex",
- "sweet romance",
- "some groping",
- "bed actions",
- "oral sex",
- "a porn-tape",
- "anal love",
- ]
- if args <> "":
- weechat.command("/me cheers %s with %s.." % (args, random.choice(actions)))
- return weechat.PLUGIN_RC_OK
- else:
- weechat.prnt("You must specify target")
- return weechat.PLUGIN_RC_KO
-
-# dancer
-def dancer(server, args):
- objects = [
- "used condoms",
- "condoms",
- "used tampons",
- "tampons",
- "roses",
- "rosebuds",
- "rice",
- "uncooked rice",
- "bananas",
- "little pieces of paper with the text *YAY!* on",
- "little pieces of paper with the text *w00t!* on",
- "little pieces of paper with the text *WOOHOO!* on",
- "little pieces of paper with the text *Kiss my cheek!* on",
- "coconuts with faces on",
- "little pieces of paper with the text *LOVE ROCKS!* on",
- "little pieces of paper with the text *LETS HAVE SEX!* on",
- "little pieces of paper with the text *GOD BLESS AMERICA!* on",
- "balloons with faces on",
- "balloons",
- "chocolate cakes",
- "english teachers",
- "pr0n magazines",
- "vietnamese kids",
- "snowballs",
- "rocks",
- "Michael Jackson (naked)",
- "unlocked Grenades *BOOM*",
- "Nine Inch Nails",
- "Bodyparts (bloody, wet & sexy)",
- ]
- if args <> "":
- weechat.command("/me dances around %s throwing %s.." % (args, random.choice(objects)))
- return weechat.PLUGIN_RC_OK
- else:
- weechat.prnt("You must specify target")
- return weechat.PLUGIN_RC_KO
-
-# BOFH excuser
-def excuser(server, args):
- excuses = [
- "clock speed",
- "solar flares",
- "electromagnetic radiation from satellite debris",
- "static from nylon underwear",
- "static from plastic slide rules",
- "global warming",
- "poor power conditioning",
- "static buildup",
- "doppler effect",
- "hardware stress fractures",
- "magnetic interference from money/credit cards",
- "dry joints on cable plug",
- "we're waiting for [the phone company] to fix that line",
- "sounds like a Windows problem, try calling Microsoft support",
- "temporary routing anomaly",
- "somebody was calculating pi on the server",
- "fat electrons in the lines",
- "excess surge protection",
- "floating point processor overflow",
- "divide-by-zero error",
- "POSIX compliance problem",
- "monitor resolution too high",
- "improperly oriented keyboard",
- "network packets travelling uphill (use a carrier pigeon)",
- "Decreasing electron flux",
- "first Saturday after first full moon in Winter",
- "radiosity depletion",
- "CPU radiator broken",
- "It works the way the Wang did, what's the problem",
- "positron router malfunction",
- "cellular telephone interference",
- "techtonic stress",
- "piezo-electric interference",
- "(l)user error",
- "working as designed",
- "dynamic software linking table corrupted",
- "heavy gravity fluctuation, move computer to floor rapidly",
- "secretary plugged hairdryer into UPS",
- "terrorist activities",
- "not enough memory, go get system upgrade",
- "interrupt configuration error",
- "spaghetti cable cause packet failure",
- "boss forgot system password",
- "bank holiday - system operating credits not recharged",
- "virus attack, luser responsible",
- "waste water tank overflowed onto computer",
- "Complete Transient Lockout",
- "bad ether in the cables",
- "Bogon emissions",
- "Change in Earth's rotational speed",
- "Cosmic ray particles crashed through the hard disk platter",
- "Smell from unhygienic janitorial staff wrecked the tape heads",
- "Little hamster in running wheel had coronary; waiting for replacement to be Fedexed from Wyoming",
- "Evil dogs hypnotised the night shift",
- "Plumber mistook routing panel for decorative wall fixture",
- "Electricians made popcorn in the power supply",
- "Groundskeepers stole the root password",
- "high pressure system failure",
- "failed trials, system needs redesigned",
- "system has been recalled",
- "not approved by the FCC",
- "need to wrap system in aluminum foil to fix problem",
- "not properly grounded, please bury computer",
- "CPU needs recalibration",
- "system needs to be rebooted",
- "bit bucket overflow",
- "descramble code needed from software company",
- "only available on a need to know basis",
- "knot in cables caused data stream to become twisted and kinked",
- "nesting roaches shorted out the ether cable",
- "The file system is full of it",
- "Satan did it",
- "Daemons did it",
- "You're out of memory",
- "There isn't any problem",
- "Unoptimized hard drive",
- "Typo in the code",
- "Yes, yes, its called a design limitation",
- "Look, buddy: Windows 3.1 IS A General Protection Fault.",
- "That's a great computer you have there; have you considered how it would work as a BSD machine?",
- "Please excuse me, I have to circuit an AC line through my head to get this database working.",
- "Yeah, yo mama dresses you funny and you need a mouse to delete files.",
- "Support staff hung over, send aspirin and come back LATER.",
- "Someone is standing on the ethernet cable, causing a kink in the cable",
- "Windows 95 undocumented \"feature\"",
- "Runt packets",
- "Password is too complex to decrypt",
- "Boss' kid fucked up the machine",
- "Electromagnetic energy loss",
- "Budget cuts",
- "Mouse chewed through power cable",
- "Stale file handle (next time use Tupperware(tm)!)",
- "Feature not yet implemented",
- "Internet outage",
- "Pentium FDIV bug",
- "Vendor no longer supports the product",
- "Small animal kamikaze attack on power supplies",
- "The vendor put the bug there.",
- "SIMM crosstalk.",
- "IRQ dropout",
- "Collapsed Backbone",
- "Power company testing new voltage spike (creation) equipment",
- "operators on strike due to broken coffee machine",
- "backup tape overwritten with copy of system manager's favourite CD",
- "UPS interrupted the server's power",
- "The electrician didn't know what the yellow cable was so he yanked the ethernet out.",
- "The keyboard isn't plugged in",
- "The air conditioning water supply pipe ruptured over the machine room",
- "The electricity substation in the car park blew up.",
- "The rolling stones concert down the road caused a brown out",
- "The salesman drove over the CPU board.",
- "The monitor is plugged into the serial port",
- "Root nameservers are out of sync",
- "electro-magnetic pulses from French above ground nuke testing.",
- "your keyboard's space bar is generating spurious keycodes.",
- "the real ttys became pseudo ttys and vice-versa.",
- "the printer thinks its a router.",
- "the router thinks its a printer.",
- "evil hackers from Serbia.",
- "we just switched to FDDI.",
- "halon system went off and killed the operators.",
- "because Bill Gates is a Jehovah's witness and so nothing can work on St. Swithin's day.",
- "user to computer ratio too high.",
- "user to computer ration too low.",
- "we just switched to Sprint.",
- "it has Intel Inside",
- "Sticky bits on disk.",
- "Power Company having EMP problems with their reactor",
- "The ring needs another token",
- "new management",
- "telnet: Unable to connect to remote host: Connection refused",
- "SCSI Chain overterminated",
- "It's not plugged in.",
- "because of network lag due to too many people playing deathmatch",
- "You put the disk in upside down.",
- "Daemons loose in system.",
- "User was distributing pornography on server; system seized by FBI.",
- "BNC (brain not connected)",
- "UBNC (user brain not connected)",
- "LBNC (luser brain not connected)",
- "disks spinning backwards - toggle the hemisphere jumper.",
- "new guy cross-connected phone lines with ac power bus.",
- "had to use hammer to free stuck disk drive heads.",
- "Too few computrons available.",
- "Flat tire on station wagon with tapes. (\"Never underestimate the bandwidth of a station wagon full of tapes hurling down the highway\" Andrew S. Tannenbaum) ",
- "Communications satellite used by the military for star wars.",
- "Party-bug in the Aloha protocol.",
- "Insert coin for new game",
- "Dew on the telephone lines.",
- "Arcserve crashed the server again.",
- "Some one needed the powerstrip, so they pulled the switch plug.",
- "My pony-tail hit the on/off switch on the power strip.",
- "Big to little endian conversion error",
- "You can tune a file system, but you can't tune a fish (from most tunefs man pages)",
- "Dumb terminal",
- "Zombie processes haunting the computer",
- "Incorrect time synchronization",
- "Defunct processes",
- "Stubborn processes",
- "non-redundant fan failure ",
- "monitor VLF leakage",
- "bugs in the RAID",
- "no \"any\" key on keyboard",
- "root rot",
- "Backbone Scoliosis",
- "/pub/lunch",
- "excessive collisions & not enough packet ambulances",
- "le0: no carrier: transceiver cable problem?",
- "broadcast packets on wrong frequency",
- "popper unable to process jumbo kernel",
- "NOTICE: alloc: /dev/null: filesystem full",
- "pseudo-user on a pseudo-terminal",
- "Recursive traversal of loopback mount points",
- "Backbone adjustment",
- "OS swapped to disk",
- "vapors from evaporating sticky-note adhesives",
- "sticktion",
- "short leg on process table",
- "multicasts on broken packets",
- "ether leak",
- "Atilla the Hub",
- "endothermal recalibration",
- "filesystem not big enough for Jumbo Kernel Patch",
- "loop found in loop in redundant loopback",
- "system consumed all the paper for paging",
- "permission denied",
- "Reformatting Page. Wait...",
- "..disk or the processor is on fire.",
- "SCSI's too wide.",
- "Proprietary Information.",
- "Just type 'mv * /dev/null'.",
- "runaway cat on system.",
- "Did you pay the new Support Fee?",
- "We only support a 1200 bps connection.",
- "We only support a 28000 bps connection.",
- "Me no internet, only janitor, me just wax floors.",
- "I'm sorry a pentium won't do, you need an SGI to connect with us.",
- "Post-it Note Sludge leaked into the monitor.",
- "the curls in your keyboard cord are losing electricity.",
- "The monitor needs another box of pixels.",
- "RPC_PMAP_FAILURE",
- "kernel panic: write-only-memory (/dev/wom0) capacity exceeded.",
- "Write-only-memory subsystem too slow for this machine. Contact your local dealer.",
- "Just pick up the phone and give modem connect sounds. \"Well you said we should get more lines so we don't have voice lines.\"",
- "Quantum dynamics are affecting the transistors",
- "Police are examining all internet packets in the search for a narco-net-trafficker",
- "We are currently trying a new concept of using a live mouse. Unfortunately, one has yet to survive being hooked up to the computer.....please bear with us.",
- "Your mail is being routed through Germany ... and they're censoring us.",
- "Only people with names beginning with 'A' are getting mail this week (a la Microsoft)",
- "We didn't pay the Internet bill and it's been cut off.",
- "Lightning strikes.",
- "Of course it doesn't work. We've performed a software upgrade.",
- "Change your language to Finnish.",
- "Fluorescent lights are generating negative ions. If turning them off doesn't work, take them out and put tin foil on the ends.",
- "High nuclear activity in your area.",
- "What office are you in? Oh, that one. Did you know that your building was built over the universities first nuclear research site? And wow, aren't you the lucky one, your office is right over where the core is buried!",
- "The MGs ran out of gas.",
- "The UPS doesn't have a battery backup.",
- "Recursivity. Call back if it happens again.",
- "Someone thought The Big Red Button was a light switch.",
- "The mainframe needs to rest. It's getting old, you know.",
- "I'm not sure. Try calling the Internet's head office -- it's in the book.",
- "The lines are all busy (busied out, that is -- why let them in to begin with?).",
- "Jan 9 16:41:27 huber su: 'su root' succeeded for .... on /dev/pts/1",
- "It's those computer people in X {city of world}. They keep stuffing things up.",
- "A star wars satellite accidently blew up the WAN.",
- "Fatal error right in front of screen",
- "That function is not currently supported, but Bill Gates assures us it will be featured in the next upgrade.",
- "wrong polarity of neutron flow",
- "Lusers learning curve appears to be fractal",
- "We had to turn off that service to comply with the CDA Bill.",
- "Ionization from the air-conditioning",
- "TCP/IP UDP alarm threshold is set too low.",
- "Someone is broadcasting pygmy packets and the router doesn't know how to deal with them.",
- "The new frame relay network hasn't bedded down the software loop transmitter yet. ",
- "Fanout dropping voltage too much, try cutting some of those little traces",
- "Plate voltage too low on demodulator tube",
- "You did wha... oh _dear_....",
- "CPU needs bearings repacked",
- "Too many little pins on CPU confusing it, bend back and forth until 10-20% are neatly removed. Do _not_ leave metal bits visible!",
- "_Rosin_ core solder? But...",
- "Software uses US measurements, but the OS is in metric...",
- "The computer fleetly, mouse and all.",
- "Your cat tried to eat the mouse.",
- "The Borg tried to assimilate your system. Resistance is futile.",
- "It must have been the lightning storm we had (yesterday) (last week) (last month)",
- "Due to Federal Budget problems we have been forced to cut back on the number of users able to access the system at one time. (namely none allowed....)",
- "Too much radiation coming from the soil.",
- "Unfortunately we have run out of bits/bytes/whatever. Don't worry, the next supply will be coming next week.",
- "Program load too heavy for processor to lift.",
- "Processes running slowly due to weak power supply",
- "Our ISP is having {switching,routing,SMDS,frame relay} problems",
- "We've run out of licenses",
- "Interference from lunar radiation",
- "Standing room only on the bus.",
- "You need to install an RTFM interface.",
- "That would be because the software doesn't work.",
- "That's easy to fix, but I can't be bothered.",
- "Someone's tie is caught in the printer, and if anything else gets printed, he'll be in it too.",
- "We're upgrading /dev/null",
- "The Usenet news is out of date",
- "Our POP server was kidnapped by a weasel.",
- "It's stuck in the Web.",
- "Your modem doesn't speak English.",
- "The mouse escaped.",
- "All of the packets are empty.",
- "The UPS is on strike.",
- "Neutrino overload on the nameserver",
- "Melting hard drives",
- "Someone has messed up the kernel pointers",
- "The kernel license has expired",
- "Netscape has crashed",
- "The cord jumped over and hit the power switch.",
- "It was OK before you touched it.",
- "Bit rot",
- "U.S. Postal Service",
- "Your Flux Capacitor has gone bad.",
- "The Dilithium Crystals need to be rotated.",
- "The static electricity routing is acting up...",
- "Traceroute says that there is a routing problem in the backbone. It's not our problem.",
- "The co-locator cannot verify the frame-relay gateway to the ISDN server.",
- "High altitude condensation from U.S.A.F prototype aircraft has contaminated the primary subnet mask. Turn off your computer for 9 days to avoid damaging it.",
- "Lawn mower blade in your fan need sharpening",
- "Electrons on a bender",
- "Telecommunications is upgrading. ",
- "Telecommunications is downgrading.",
- "Telecommunications is downshifting.",
- "Hard drive sleeping. Let it wake up on it's own...",
- "Interference between the keyboard and the chair.",
- "The CPU has shifted, and become decentralized.",
- "Due to the CDA, we no longer have a root account.",
- "We ran out of dial tone and we're and waiting for the phone company to deliver another bottle.",
- "You must've hit the wrong any key.",
- "PCMCIA slave driver",
- "The Token fell out of the ring. Call us when you find it.",
- "The hardware bus needs a new token.",
- "Too many interrupts",
- "Not enough interrupts",
- "The data on your hard drive is out of balance.",
- "Digital Manipulator exceeding velocity parameters",
- "appears to be a Slow/Narrow SCSI-0 Interface problem",
- "microelectronic Riemannian curved-space fault in write-only file system",
- "fractal radiation jamming the backbone",
- "routing problems on the neural net",
- "IRQ-problems with the Un-Interruptible-Power-Supply",
- "CPU-angle has to be adjusted because of vibrations coming from the nearby road",
- "emissions from GSM-phones",
- "CD-ROM server needs recalibration",
- "firewall needs cooling",
- "asynchronous inode failure",
- "transient bus protocol violation",
- "incompatible bit-registration operators",
- "your process is not ISO 9000 compliant",
- "You need to upgrade your VESA local bus to a MasterCard local bus.",
- "The recent proliferation of Nuclear Testing",
- "Elves on strike. (Why do they call EMAG Elf Magic)",
- "Internet exceeded Luser level, please wait until a luser logs off before attempting to log back on.",
- "Your EMAIL is now being delivered by the USPS.",
- "Your computer hasn't been returning all the bits it gets from the Internet.",
- "You've been infected by the Telescoping Hubble virus.",
- "Scheduled global CPU outage",
- "Your Pentium has a heating problem - try cooling it with ice cold water.(Do not turn off your computer, you do not want to cool down the Pentium Chip while he isn't working, do you?)",
- "Your processor has processed too many instructions. Turn it off immediately, do not type any commands!!",
- "Your packets were eaten by the terminator",
- "Your processor does not develop enough heat.",
- "We need a licensed electrician to replace the light bulbs in the computer room.",
- "The POP server is out of Coke",
- "Fiber optics caused gas main leak",
- "Server depressed, needs Prozac",
- "quantum decoherence",
- "those damn raccoons!",
- "suboptimal routing experience",
- "A plumber is needed, the network drain is clogged",
- "50% of the manual is in .pdf readme files",
- "the AA battery in the wallclock sends magnetic interference",
- "the xy axis in the trackball is coordinated with the summer solstice",
- "the butane lighter causes the pincushioning",
- "old inkjet cartridges emanate barium-based fumes",
- "manager in the cable duct",
- "We'll fix that in the next (upgrade, update, patch release, service pack).",
- "HTTPD Error 666 : BOFH was here",
- "HTTPD Error 4004 : very old Intel cpu - insufficient processing power",
- "The ATM board has run out of 10 pound notes. We are having a whip round to refill it, care to contribute ?",
- "Network failure - call NBC",
- "Having to manually track the satellite.",
- "Your/our computer(s) had suffered a memory leak, and we are waiting for them to be topped up.",
- "The rubber band broke",
- "We're on Token Ring, and it looks like the token got loose.",
- "Stray Alpha Particles from memory packaging caused Hard Memory Error on Server.",
- "paradigm shift...without a clutch",
- "PEBKAC (Problem Exists Between Keyboard And Chair)",
- "The cables are not the same length.",
- "Second-system effect.",
- "Chewing gum on /dev/sd3c",
- "Boredom in the Kernel.",
- "the daemons! the daemons! the terrible daemons!",
- "I'd love to help you -- it's just that the Boss won't let me near the computer. ",
- "struck by the Good Times virus",
- "YOU HAVE AN I/O ERROR -> Incompetent Operator error",
- "Your parity check is overdrawn and you're out of cache.",
- "Communist revolutionaries taking over the server room and demanding all the computers in the building or they shoot the sysadmin. Poor misguided fools.",
- "Plasma conduit breach",
- "Out of cards on drive D:",
- "Sand fleas eating the Internet cables",
- "parallel processors running perpendicular today",
- "ATM cell has no roaming feature turned on, notebooks can't connect",
- "Webmasters kidnapped by evil cult.",
- "Failure to adjust for daylight savings time.",
- "Virus transmitted from computer to sysadmins.",
- "Virus due to computers having unsafe sex.",
- "Incorrectly configured static routes on the corerouters.",
- "Forced to support NT servers; sysadmins quit.",
- "Suspicious pointer corrupted virtual machine",
- "It's the InterNIC's fault.",
- "Root name servers corrupted.",
- "Budget cuts forced us to sell all the power cords for the servers.",
- "Someone hooked the twisted pair wires into the answering machine.",
- "Operators killed by year 2000 bug bite.",
- "We've picked COBOL as the language of choice.",
- "Operators killed when huge stack of backup tapes fell over.",
- "Robotic tape changer mistook operator's tie for a backup tape.",
- "Someone was smoking in the computer room and set off the halon systems.",
- "Your processor has taken a ride to Heaven's Gate on the UFO behind Hale-Bopp's comet.",
- "it's an ID-10-T error",
- "Dyslexics retyping hosts file on servers",
- "The Internet is being scanned for viruses.",
- "Your computer's union contract is set to expire at midnight.",
- "Bad user karma.",
- "/dev/clue was linked to /dev/null",
- "Increased sunspot activity.",
- "We already sent around a notice about that.",
- "It's union rules. There's nothing we can do about it. Sorry.",
- "Interference from the Van Allen Belt.",
- "Jupiter is aligned with Mars.",
- "Redundant ACLs. ",
- "Mail server hit by UniSpammer.",
- "T-1's congested due to porn traffic to the news server.",
- "Data for intranet got routed through the extranet and landed on the internet.",
- "We are a 100% Microsoft Shop.",
- "We are Microsoft. What you are experiencing is not a problem; it is an undocumented feature.",
- "Sales staff sold a product we don't offer.",
- "Secretary sent chain letter to all 5000 employees.",
- "Sysadmin didn't hear pager go off due to loud music from bar-room speakers.",
- "Sysadmin accidentally destroyed pager with a large hammer.",
- "Sysadmins unavailable because they are in a meeting talking about why they are unavailable so much.",
- "Bad cafeteria food landed all the sysadmins in the hospital.",
- "Route flapping at the NAP.",
- "Computers under water due to SYN flooding.",
- "The vulcan-death-grip ping has been applied.",
- "Electrical conduits in machine room are melting.",
- "Traffic jam on the Information Superhighway.",
- "Radial Telemetry Infiltration",
- "Cow-tippers tipped a cow onto the server.",
- "tachyon emissions overloading the system",
- "Maintenance window broken",
- "We're out of slots on the server",
- "Computer room being moved. Our systems are down for the weekend.",
- "Sysadmins busy fighting SPAM.",
- "Repeated reboots of the system failed to solve problem",
- "Feature was not beta tested",
- "Domain controller not responding",
- "Someone else stole your IP address, call the Internet detectives!",
- "It's not RFC-822 compliant.",
- "operation failed because: there is no message for this error (#1014)",
- "stop bit received",
- "internet is needed to catch the etherbunny",
- "network down, IP packets delivered via UPS",
- "Firmware update in the coffee machine",
- "Temporal anomaly",
- "Mouse has out-of-cheese-error",
- "Borg implants are failing",
- "Borg nanites have infested the server",
- "error: one bad user found in front of screen",
- "Please state the nature of the technical emergency",
- "Internet shut down due to maintenance",
- "Daemon escaped from pentagram",
- "crop circles in the corn shell",
- "sticky bit has come loose",
- "Hot Java has gone cold",
- "Cache miss - please take better aim next time",
- "Hash table has woodworm",
- "Trojan horse ran out of hay",
- "Zombie processes detected, machine is haunted.",
- "overflow error in /dev/null",
- "Browser's cookie is corrupted -- someone's been nibbling on it.",
- "Mailer-daemon is busy burning your message in hell.",
- "According to Microsoft, it's by design",
- "vi needs to be upgraded to vii",
- "greenpeace free'd the mallocs",
- "Terrorists crashed an airplane into the server room, have to remove /bin/laden. (rm -rf /bin/laden)",
- "astropneumatic oscillations in the water-cooling",
- "Somebody ran the operating system through a spelling checker.",
- "Rhythmic variations in the voltage reaching the power supply.",
- "Keyboard Actuator Failure. Order and Replace.",
- "Packet held up at customs.",
- "Propagation delay.",
- "High line impedance.",
- "Someone set us up the bomb.",
- "Power surges on the Underground."
- ]
- weechat.command(random.choice(excuses))
- return weechat.PLUGIN_RC_OK
-
-
-# fortune cookies
-def fortune(server, args):
- fortunes = [
- "There are three kinds of people: men, women, and unix.",
- "BOFH Excuse #118: the router thinks its a printer.",
- "CHUBBY CHECKER just had a CHICKEN SANDWICH in downtown DULUTH!",
- "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(fortunes))
- return weechat.PLUGIN_RC_OK
-
-# winjoke
-def winjoke(server, args):
- winjokes = [
- "Windows NT, from the people who invented EDLIN!",
- "Windows: Microsoft's tax on computer illiterates.",
- "The nice thing about Windows is - It does not just crash, it displays a dialog box and lets you press 'OK' first.",
- "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(winjokes))
- return weechat.PLUGIN_RC_OK
-
-# linjoke
-def linjoke(server, args):
- linjokes = [
- "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(linjokes))
- return weechat.PLUGIN_RC_OK
diff --git a/scripts/python/clonescan.py b/scripts/python/clonescan.py
deleted file mode 100644
index 6fbee97fc..000000000
--- a/scripts/python/clonescan.py
+++ /dev/null
@@ -1,168 +0,0 @@
-#
-# Copyright (c) 2006 by SpideR <spider312@free.fr> http://spiderou.net
-#
-# 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
-#
-
-# WeeChat clone scanner
-# Scans clones on a chan when you ask it to do (/clones)
-# Able to scan for a nick's clones on each join, if you ask it to do (/autoclones)
-
-import weechat
-
-SCRIPT_NAME="clonescan"
-SCRIPT_VERSION="0.1"
-SCRIPT_DESC="clonescan script for weechat"
-SCRIPT_DISP=SCRIPT_NAME+" v"+SCRIPT_VERSION
-
-# Register, Handlers, config check/creation
-if weechat.register(SCRIPT_NAME, SCRIPT_VERSION, "unload", SCRIPT_DESC):
- weechat.add_command_handler("clones","scanchan",
- "Scans clones on specified or current chan",
- "[#chan]")
- weechat.add_command_handler("autoclones","toggleauto",
- "Manage auto clone-scanning",
- "[enable|disable|show]")
- weechat.add_message_handler ("join", "scanjoin")
- autoscan = weechat.get_plugin_config("autoscan")
- if ( ( autoscan != "true" ) and ( autoscan != "false" ) ):
- weechat.set_plugin_config("autoscan","false")
- weechat.prnt("Unconfigured autoscan set to 'disabled', to enable : /autoclones enable")
- weechat.prnt(SCRIPT_DISP+" loaded")
-else:
- weechat.prnt(SCRIPT_DISP+" not loaded")
-
-# Unload handler
-def unload():
- weechat.prnt("starting "+SCRIPT_DISP+" unload ...")
- return 0
-
-# Auto scan on JOIN
-def scanjoin(server,args):
- result = weechat.PLUGIN_RC_OK
- if ( weechat.get_plugin_config("autoscan") == "true" ):
- try: # Cut args because it contains nick, host and chan
- nothing, user, chan = args.split(":") # :Mag!Magali@RS2I-35243B84.ipt.aol.com JOIN :#bringue
- nick, next = user.split("!") # Mag!Magali@RS2I-35243B84.ipt.aol.com JOIN
- userathost, nothing = next.split(" JOIN ") # Magali@RS2I-35243B84.ipt.aol.com JOIN
- host = removeuser(userathost) # Magali@RS2I-35243B84.ipt.aol.com
- # Problems with IPv6 hosts' ":" :
- # [:higuita!n=higuita@2001:b18:400f:0:211:d8ff:fe82:b10e JOIN :#weechat]
- except ValueError:
- result = weechat.PLUGIN_RC_KO
- weechat.prnt("Eror parsing args : ["+args+"]",server,server)
- else:
- clones = scannick(server,chan,nick,host) # Scan for that user's clones
- if ( len(clones) > 0):
- disp = "Clone sur "+chan+"@"+server+" : "+dispclones(nick,clones,host)
- weechat.print_infobar(5,disp) # Display on infobar
- weechat.prnt(disp) # Display on current buffer
- weechat.prnt(disp,server,server) # Display on server buffer
- return result
-
-# Config auto scan
-def toggleauto(server,args):
- # Get current value
- autoscan = weechat.get_plugin_config("autoscan")
- # Testing / repairing
- if ( autoscan == "true" ):
- auto = True
- elif ( autoscan == "false" ):
- auto = False
- else:
- weechat.prnt("Unknown value ["+autoscan+"], disabling")
- weechat.set_plugin_config("autoscan","false")
- auto = False
- # managing arg
- if ( args == "enable" ):
- if auto:
- weechat.prnt("Auto clone scanning remain enabled")
- else:
- weechat.set_plugin_config("autoscan","true")
- weechat.prnt("Auto clone scanning is now enabled")
- elif ( args == "disable" ):
- if auto:
- weechat.set_plugin_config("autoscan","false")
- weechat.prnt("Auto clone scanning is now disabled")
- else:
- weechat.prnt("Auto clone scanning remain disabled")
- elif ( args == "break" ):
- weechat.set_plugin_config("autoscan","blah")
- else:
- if auto:
- weechat.prnt("Auto clone scanning enabled")
- else:
- weechat.prnt("Auto clone scanning disabled")
- return weechat.PLUGIN_RC_OK
-
-# Manual channel scan
-def scanchan(server,args):
- # Defining chan to scan (contained in args, current chan otherwise)
- if ( args == "" ):
- chan = weechat.get_info("channel",server)
- else:
- chan = args
- # Scan
- if ( chan != "" ):
- nicks = weechat.get_nick_info(server,chan)
- allclones = [] # List containing all detected clones, for not to re-scan them
- nbclones = 0 # number of clones
- if nicks != None:
- if nicks != {}:
- weechat.prnt("Scanning "+chan+" ...")
- for nick in nicks:
- if nick not in allclones:
- host = removeuser(nicks[nick]["host"])
- clones = scannick(server,chan,nick,host)
- if ( len(clones) > 0 ):
- allclones = allclones + clones
- nbclones = nbclones+1
- weechat.prnt(" - "+dispclones(nick,clones,host))
- weechat.prnt(str(nbclones)+" clones found")
- else:
- weechat.prnt("Nobody on "+chan+", are you sure it's a chan and you are present on it ?")
- else:
- weechat.prnt("Eror reading nick list")
- else:
- weechat.prnt("Not on a chan")
- return weechat.PLUGIN_RC_OK
-
-# Scan of a nick
-# Returns list of nick clones (not containing nick himself)
-def scannick(server,chan,nick,host):
- cloneof = []
- compares = weechat.get_nick_info(server,chan)
- if compares != None:
- if compares != {}:
- for compare in compares:
- if ( ( nick != compare ) and ( host == removeuser(compares[compare]["host"])) ):
- cloneof.append(compare)
- else:
- weechat.prnt("pas de pseudo")
-
- else:
- weechat.prnt("erreur de lecture des pseudos")
- return cloneof
-
-# Display of one clone line
-def dispclones(nick,clones,host):
- clones.append(nick)
- clones.sort()
- return str(clones)+" ("+host+")"
-
-# Return host by user@host
-def removeuser(userathost):
- splitted = userathost.split("@")
- return splitted[1]
diff --git a/scripts/python/ctcp.py b/scripts/python/ctcp.py
deleted file mode 100644
index d8459e51d..000000000
--- a/scripts/python/ctcp.py
+++ /dev/null
@@ -1,175 +0,0 @@
-"""
- :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
- -- Leonid Evdokimov (weechat at darkk dot net one more dot ru)
-"""
-
-version = "0.10"
-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)
- 0.9
- - added dump_to_servchan and dump_to_current setting
- 0.10
- - added SILENT (asmanian)
-"""
-
-short_syntax = """[REQUEST ANSWER]"""
-
-syntax = """ Examples:
-
- /set_ctcp
- show settings for common CTCP-Requests.
- where "OFF" means "use weechat default behaviour,
- "SILENT" means: "dont answer at all".
-
- /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
-
-if wc.register("ctcp", version, "", "Customize CTCP replies"):
- wc.add_command_handler("set_ctcp", "set", "", short_syntax, syntax)
- wc.add_message_handler("privmsg", "on_msg")
-
- if not wc.get_plugin_config("requests"):
- wc.set_plugin_config("requests", " ".join(["VERSION", "USERINFO", "FINGER", "TIME", "PING"]))
-
- for key, default in {'dump_to_servchan': 'OFF', 'dump_to_current': 'ON'}.iteritems():
- value = wc.get_plugin_config(key)
- if not value in ['ON', 'OFF']:
- if value:
- wc.prnt("[ctcp]: invalid %s value, resetting to %s" % (key, default))
- wc.set_plugin_config(key, default)
-
-def get_answers():
- # Strangely, get_plugin_config sometimes returns
- # the integer 0
- 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
-
- if ans == "SILENT":
- return wc.PLUGIN_RC_OK_IGNORE_ALL
-
- 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:]
-
- if wc.get_plugin_config("dump_to_servchan") == 'ON':
- wc.prnt("CTCP %s received from %s (on %s)" % (req, source, server), server)
- if wc.get_plugin_config("dump_to_current") == 'ON':
- wc.prnt("CTCP %s received from %s (on %s)" % (req, source, server))
- wc.command("/quote NOTICE %s :\x01%s %s\x01" % (
- source, req, ans), "", server)
- return wc.PLUGIN_RC_OK_IGNORE_ALL
-
- 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
-
diff --git a/scripts/python/gimmicks.py b/scripts/python/gimmicks.py
deleted file mode 100644
index 3d8cc9621..000000000
--- a/scripts/python/gimmicks.py
+++ /dev/null
@@ -1,99 +0,0 @@
-# -*- 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
-
-
-
diff --git a/scripts/python/keepnick.py b/scripts/python/keepnick.py
deleted file mode 100644
index 7f8c4e024..000000000
--- a/scripts/python/keepnick.py
+++ /dev/null
@@ -1,204 +0,0 @@
-# -*- 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')
-
-
-
-
diff --git a/scripts/python/last.fm.py b/scripts/python/last.fm.py
deleted file mode 100644
index 87256f7ce..000000000
--- a/scripts/python/last.fm.py
+++ /dev/null
@@ -1,56 +0,0 @@
-"""
- :Author: Tim Schumacher <tim AT we-are-teh-b DOT org>
-
- :What it does:
- This script informs the active window of your last
- submitted song at last.fm
-
- :Usage:
- /np - Displays your last submitted song.
-
- :Configuration Variables:
- ============= ==========================================
- Variable name Meaning
- ============= ==========================================
- lastfmuser Your username at last.fm
-
- Released under GPL licence.
-"""
-#!/usr/bin/python
-
-todo = """
- - Realy check if a song was recent.
- - Define 'recent' through a userdefinedvar
- - Add more help
-
-"""
-
-import urllib
-import weechat as wc
-
-wc.register("lastfmnp", "0.2.1", "", "now playing for last.fm")
-
-def getLastSong(server, args):
- """
- Provides your last submitted song in last.fm to the actual context
- """
- user = wc.get_plugin_config("lastfmuser")
- url = "http://ws.audioscrobbler.com/1.0/user/" + user + "/recenttracks.txt"
- url_handle = urllib.urlopen(url)
- lines = url_handle.readlines()
- song = lines[0].split(",")[1].replace("\n","");
- if song == '':
- song = 'nothing :-)';
- wc.command("np: " + song)
- return 0
-
-
-wc.add_command_handler("np", "getLastSong")
-
-default = {
- "lastfmuser": "timds235"
-}
-
-for k, v in default.items():
- if not wc.get_plugin_config(k):
- wc.set_plugin_config(k, v)
diff --git a/scripts/python/mp3blaster.py b/scripts/python/mp3blaster.py
deleted file mode 100644
index d30c96133..000000000
--- a/scripts/python/mp3blaster.py
+++ /dev/null
@@ -1,36 +0,0 @@
-# mp3blaster nowplaying script by Stalwart <stlwrt@gmail.com>
-# written for Caleb
-# released under GNU GPL v2 or newer
-
-import weechat
-from os.path import expandvars, expanduser
-
-def mp3blasternp(server, args):
- try:
- statusfile = open(expandvars(expanduser(weechat.get_plugin_config('statusfile'))), 'rU')
- info = statusfile.readlines()
- statusfile.close()
- artist = title = path = ''
- for line in info:
- if (line.split()[0] == 'artist'):
- artist = line.strip(' \n')[7:]
- elif (line.split()[0] == 'title'):
- title = line.strip(' \n')[6:]
- elif (line.split()[0] == 'path'):
- path = line.strip(' \n')[5:]
- if (title):
- if (artist):
- weechat.command('/me np: '+artist+' - '+title)
- else:
- weechat.command('/me np: '+title)
- else:
- weechat.command('/me np: '+path)
- except:
- if (weechat.get_plugin_config('statusfile') == ''):
- weechat.set_plugin_config('statusfile', '~/.mp3blasterstatus')
- weechat.prnt('mp3blaster status file not found. Set proper using /setp python.mp3blaster.statusfile = /path/to/file')
-
- return 0
-
-weechat.register ('mp3blaster', '1.0', '', 'Posts track now played by mp3blaster')
-weechat.add_command_handler ('np', 'mp3blasternp')
diff --git a/scripts/python/mpd.py b/scripts/python/mpd.py
deleted file mode 100644
index 36ba41e1d..000000000
--- a/scripts/python/mpd.py
+++ /dev/null
@@ -1,66 +0,0 @@
-# Author: Skippy the Kangoo <Skippythekangoo AT yahoo DOT fr>
-# This script manages basic controls of mpd (play/pause, next song, previous song, increase volume, decrease volume, display current song)
-# Usage: /mpd toggle|next|prev|volume_up|volume_down|status
-# Released under GNU GPL v2 or newer
-
-import weechat
-from os import popen
-
-weechat.register ('mpd', '0.0.2', '', 'mpd control script')
-
-weechat.add_command_handler('mpd', 'mpd', 'mpd control', 'toggle|next|prev|volume_up|volume_down|status', '', 'toggle|next|prev|volume_up|volume_down|status')
-
-def toggle (server, args,):
- popen('mpc toggle')
- return weechat.PLUGIN_RC_OK
-
-def next (server, args,):
- popen('mpc next')
- return weechat.PLUGIN_RC_OK
-
-def prev (server, args,):
- popen('mpc prev')
- return weechat.PLUGIN_RC_OK
-
-def volume_up (server, args,):
- popen('mpc volume +10')
- return weechat.PLUGIN_RC_OK
-
-def volume_down (server, args,):
- volume_down = popen('mpc volume -10')
- return weechat.PLUGIN_RC_OK
-
-def status (server, args,):
- status = popen('mpc').readline().rstrip()
- weechat.print_infobar(3, status)
- return weechat.PLUGIN_RC_OK
-
-def mpd(server, args):
-
- largs = args.split(" ")
-
- #strip spaces
- while '' in largs:
- largs.remove('')
- while ' ' in largs:
- largs.remove(' ')
-
- if len(largs) == 0:
- weechat.command("/help mpd")
- return weechat.PLUGIN_RC_OK
- else:
- inchan = False
-
- if largs[0] == 'toggle':
- toggle(" ".join(largs[1:]), inchan)
- elif largs[0] == 'next':
- next(" ".join(largs[1:]), inchan)
- elif largs[0] == 'prev':
- prev(' '.join(largs[1:]), inchan)
- elif largs[0] == 'volume_up':
- volume_up(' '.join(largs[1:]), inchan)
- elif largs[0] == 'volume_down':
- volume_down(' '.join(largs[1:]), inchan)
- elif largs[0] == 'status':
- status(" ".join(largs[1:]), inchan)
- return weechat.PLUGIN_RC_OK
diff --git a/scripts/python/mpdnp.py b/scripts/python/mpdnp.py
deleted file mode 100644
index 37e9da6c3..000000000
--- a/scripts/python/mpdnp.py
+++ /dev/null
@@ -1,101 +0,0 @@
-"""
- :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)
-
-
diff --git a/scripts/python/onattach.py b/scripts/python/onattach.py
deleted file mode 100644
index d5117716e..000000000
--- a/scripts/python/onattach.py
+++ /dev/null
@@ -1,445 +0,0 @@
-# -*- 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()
-
-
diff --git a/scripts/python/pyexec.py b/scripts/python/pyexec.py
deleted file mode 100644
index 93bef6851..000000000
--- a/scripts/python/pyexec.py
+++ /dev/null
@@ -1,62 +0,0 @@
-"""
- PyExec: Python code execution script for WeeChat
- Author: Christian Taylor <cht@chello.at>
- License: GPL version 2 or later
-"""
-
-version = "0.2"
-helptext = """ The WeeChat script-API is imported into the global namespace, you can
- call all API functions (for instance "get_info") directly. The modules
- "sys", "os" and "math" are imported by default.
- Any occurance of ";; " is treated as a newline.
-
- For automatic argument conversion to string, use:
- "send" instead of "command"
- "echo" instead of "prnt" (prints only to current buffer)
- (also provided: "echo_server", "echo_infobar")
-
- Additional shortcut functions:
- "nicks()" returns a dictionary of nicknames for the current channel.
- It takes a channelname and a servername as optional arguments.
-
- Examples:
- /pyexec for i in range(3): send(i+1);; echo("Done")
- /pyexec for nick in nicks(): send("/voice " + nick)
- /pyexec echo(2**64)
-"""
-
-
-from __future__ import division
-import sys, os, math
-from weechat import *
-
-register("PyExec", version, "", "Run Python code in WeeChat")
-add_command_handler("pyexec", "pyexec", " Runs Python code directly from the WeeChat command line.", "[Python code]", helptext)
-
-def echo(text):
- return prnt(str(text))
-
-def echo_server(text):
- return print_server(str(text))
-
-def echo_infobar(time, text):
- return print_infobar(time, str(text))
-
-def send(text):
- return command(str(text))
-
-def nicks(channel=None, server=None):
- if not server:
- server = get_info("server")
- if not channel:
- channel = get_info("channel")
- return get_nick_info(server, channel)
-
-def pyexec(server, pycode):
- try:
- exec pycode.replace(";; ", "\n")
- except:
- (e_type, e_value, e_trace) = sys.exc_info()
- prnt("PyExec: %s: %s" % (str(e_type).replace("exceptions.", ""), e_value))
-
- return PLUGIN_RC_OK
diff --git a/scripts/python/response.py b/scripts/python/response.py
deleted file mode 100644
index 0f763971e..000000000
--- a/scripts/python/response.py
+++ /dev/null
@@ -1,289 +0,0 @@
-"""
- Response: Simple autoresponse script for WeeChat
- Author: Christian Taylor <cht@chello.at>
- License: GPL version 2 or later
-"""
-
-version = "0.1"
-
-helptext = """ /response list
- Displays a list of your current responses.
-
- /response toggle <number>
- Activates or deactivates response with the specified number.
-
- /response delete <number>
- Deletes response with the specified number.
-
- /response add "<message-regexp>" "<command>"
- Adds a response that executes <command> when it encounters a message matching
- the specified regular expression in any channel.
- <command> can be an actual command to be executed (for instance "/nick xyz")
- or a simple text (for instance "xyz") which is then posted to the channel.
- The following sequences are replaced in <command>:
- \\nick => nickname of the user that triggered the response
- \\mask => hostmask of the user that triggered the response
- \\channel => name of the channel in which the response was triggered
- \\<number> => matches of the message regular expression subgroups, \\0 for whole match
- $<number> => whitespace-separated word number <number> of the whole triggering message
- (starts with 0; negative numbers count from the last word)
-
- /response add "<hostmask-regexp>" "<channel-regexp>" "<message-regexp>" "<command>"
- Same as above, but only triggers if hostmask and channel match the given additional regexps.
- Blank regexps ("") will trigger for any hostmask and/or channel.
-
- Examples:
- /response add "^!whoami" "/msg \\channel You are \\nick (\\mask) in \\channel!"
- /response add "^!make (.*)" "/msg \\channel No rule for \\1. Stop."
- /response add "somebody@somehost" "" "^!op" "/op \\nick"
-"""
-
-import weechat, sys, re, pickle
-
-weechat.register("Response", version, "", "Execute commands on specific triggers")
-
-weechat.add_message_handler("privmsg", "triggercheck")
-weechat.add_command_handler("response", "triggercontrol", " Allows you to view, add and delete responses:", "<operation>", helptext, "add|delete|list|toggle")
-
-debug = 0
-
-t_enabled = 0
-t_nick = 1
-t_channel = 2
-t_trigger = 3
-t_reaction = 4
-t_outstream = 5
-
-def triggercheck(server, args):
- null, context, message = args.split(":", 2)
- mask, null, channel = context.strip().split(" ", 2)
- nick, whois = mask.split("!", 1)
-
- if debug: tell("Server: " + server + " | Mask: " + mask + " | Channel: " + channel + " | Message: " + message, server)
-
- for trigger in triggerlist:
- if trigger[t_enabled]:
- if trigger[t_channel]:
- channelmatch = re.compile(trigger[t_channel]).search(channel)
- else:
- channelmatch = True
-
- if channelmatch and trigger[t_nick]:
- nickmatch = re.compile(trigger[t_nick]).search(whois)
- else:
- nickmatch = True
-
- if channelmatch and nickmatch and trigger[t_trigger]:
- messagematch = re.compile(trigger[t_trigger]).search(message)
- else:
- messagematch = False
-
- if channelmatch and nickmatch and messagematch:
- reaction = trigger[t_reaction]
- reaction = reaction.replace("\\nick", nick)
- reaction = reaction.replace("\\{nick}", nick)
- reaction = reaction.replace("\\mask", whois)
- reaction = reaction.replace("\\{mask}", whois)
- reaction = reaction.replace("\\channel", channel)
- reaction = reaction.replace("\\{channel}", channel)
-
- messagewords = message.split()
-
- wordstring = re.compile("\\${?(-?\\d+)}?").search(reaction)
- replacecount = 0
- while wordstring and replacecount < 256:
- replacecount += 1
- try:
- reaction = reaction.replace(wordstring.group(0), messagewords[int(wordstring.group(1))])
- except IndexError:
- reaction = reaction.replace(wordstring.group(0), "")
- wordstring = re.compile("\\${?(-?\\d+)}?").search(reaction)
-
- subgroupstring = re.compile("\\\\{?(\\d+)}?").search(reaction)
- replacecount = 0
- while subgroupstring and replacecount < 256:
- replacecount += 1
- try:
- reaction = reaction.replace(subgroupstring.group(0), messagematch.group(int(subgroupstring.group(1))))
- except (IndexError, TypeError):
- reaction = reaction.replace(subgroupstring.group(0), "")
- subgroupstring = re.compile("\\\\{?(\\d+)}?").search(reaction)
-
- if trigger[t_outstream] == 1: weechat.command(reaction, channel, server)
- if trigger[t_outstream] == 2: weechat.prnt(reaction, channel, server)
-
- return weechat.PLUGIN_RC_OK
-
-def tell(text, server):
- return weechat.prnt(str(text), "[" + str(server) + "]", server)
-
-def triggercontrol(server, args):
- try:
- if args.startswith("list"): return listdisplay(server, args)
- if args.startswith("toggle"): return activetoggle(server, args)
- if args.startswith("delete"): return deletetrigger(server, args)
- if args.startswith("add"): return addtrigger(server, args)
- if args.startswith("ostoggle"): return outstreamtoggle(server, args)
- if args.startswith("debug"): return debugtoggle(server, args)
-
- tell("Unknown operation. Supported operations are add / delete / list / toggle.", server)
- except ValueError:
- tell("Error: Incorrect syntax (malformed number).", server)
- except:
- (e_type, e_value, e_trace) = sys.exc_info()
- tell("Error: %s: %s" % (str(e_type).replace("exceptions.", ""), e_value), server)
-
- return weechat.PLUGIN_RC_OK
-
-def savetriggers(varname):
- savestring = pickle.dumps(triggerlist)
- savestring = savestring.replace("\n", "\\$$$")
- return weechat.set_plugin_config(varname, savestring)
-
-def loadtriggers(varname):
- try:
- oldtriggers = weechat.get_plugin_config(varname)
- if oldtriggers:
- oldtriggers = oldtriggers.replace("\\$$$", "\n")
- newtriggerlist = pickle.loads(oldtriggers)
- return newtriggerlist
- else:
- return oldtriggers
- except:
- return False
-
-def triggerstring(i, trigger):
- if trigger:
- cl = str(i+1) + " "
- if i < 9: cl += " "
-
- if trigger[t_enabled]:
- cl += "[X] "
- else:
- cl += "[ ] "
-
- if trigger[t_nick]:
- cl += "\"" + str(trigger[t_nick]) + "\" in "
- else:
- cl += "(everyone) in "
-
- if trigger[t_channel]:
- cl += "\"" + str(trigger[t_channel]) + "\": "
- else:
- cl += "(all channels): "
-
- cl += "\"" + str(trigger[t_trigger]) + "\" => "
-
- cl += "\"" + str(trigger[t_reaction]) + "\""
-
- #if trigger[t_outstream] == 1: cl += " <public output>"
- if trigger[t_outstream] == 2: cl += " <private output>"
-
- return cl
- else:
- return "No response number " + str(i+1)
-
-def listdisplay(server, args):
- if triggerlist:
- tell(" --- Responses ---", server)
- for i, trigger in enumerate(triggerlist):
- tell(triggerstring(i, trigger), server)
- else:
- tell("No responses in the list.", server)
-
- return weechat.PLUGIN_RC_OK
-
-def activetoggle(server, args):
- triggernum = int(args.replace("toggle ", ""))
- if 1 <= triggernum < len(triggerlist) +1:
- if triggerlist[triggernum-1][t_enabled]:
- triggerlist[triggernum-1][t_enabled] = 0
- tell("Deactivated response number " + str(triggernum), server)
- else:
- triggerlist[triggernum-1][t_enabled] = 1
- tell("Activated response number " + str(triggernum), server)
- savetriggers("responses")
- else:
- tell("There is no response number " + str(triggernum), server)
-
- return weechat.PLUGIN_RC_OK
-
-def outstreamtoggle(server, args):
- triggernum = int(args.replace("ostoggle ", ""))
- if 1 <= triggernum < len(triggerlist) +1:
- if triggerlist[triggernum-1][t_outstream] == 1:
- triggerlist[triggernum-1][t_outstream] = 2
- tell("Set response number " + str(triggernum) + " to private output", server)
- else:
- triggerlist[triggernum-1][t_outstream] = 1
- tell("Set response number " + str(triggernum) + " to public output", server)
- savetriggers("responses")
- else:
- tell("There is no response number " + str(triggernum), server)
-
- return weechat.PLUGIN_RC_OK
-
-def deletetrigger(server, args):
- triggernum = int(args.replace("delete ", ""))
- if 1 <= triggernum < len(triggerlist) +1:
- del triggerlist[triggernum-1]
- tell("Deleted response number " + str(triggernum), server)
- if triggerlist:
- listdisplay(server, args)
- savetriggers("responses")
- else:
- tell("There is no response number " + str(triggernum), server)
-
- return weechat.PLUGIN_RC_OK
-
-def addtrigger(server, args):
- newtriggerargs = args.replace("add ", "")
- if newtriggerargs.startswith('"') and newtriggerargs.endswith('"'):
- newtriggerargs = newtriggerargs[1:-1]
- newtrigger = newtriggerargs.split('" "')
- elif newtriggerargs.startswith("'") and newtriggerargs.endswith("'"):
- newtriggerargs = newtriggerargs[1:-1]
- newtrigger = newtriggerargs.split("' '")
- else:
- tell ("Error: Incorrectly formatted input.", server)
- return weechat.PLUGIN_RC_OK
-
- if len(newtrigger) == 2:
- triggerlist.append([1, "", "", 1])
- triggerlist[-1][3:3] = newtrigger
- tell(triggerstring(len(triggerlist)-1, triggerlist[-1]), server)
- elif len(newtrigger) == 3:
- triggerlist.append([1, "", 1])
- triggerlist[-1][2:2] = newtrigger
- tell(triggerstring(len(triggerlist)-1, triggerlist[-1]), server)
- elif len(newtrigger) == 4:
- triggerlist.append([1, 1])
- triggerlist[-1][1:1] = newtrigger
- tell(triggerstring(len(triggerlist)-1, triggerlist[-1]), server)
- else:
- tell("Error: Incorrectly formatted input.", server)
- return weechat.PLUGIN_RC_OK
-
- savetriggers("responses")
-
- return weechat.PLUGIN_RC_OK
-
-def debugtoggle(server, args):
- global debug
- if debug:
- debug = 0
- tell("Debugging output deactivated", server)
- else:
- debug = 1
- tell("Debugging output activated", server)
-
- return weechat.PLUGIN_RC_OK
-
-
-triggerlist = []
-newtriggerlist = loadtriggers("responses")
-if newtriggerlist:
- triggerlist = newtriggerlist
- weechat.prnt("Response: Loaded " + str(len(triggerlist)) + " responses, " + str(len([1 for x in triggerlist if x[t_enabled]])) + " are active.")
-else:
- weechat.prnt("Response: No previously saved responses. Type '/help response' for usage information.")
diff --git a/scripts/python/shell.py b/scripts/python/shell.py
deleted file mode 100644
index 1d14b3db5..000000000
--- a/scripts/python/shell.py
+++ /dev/null
@@ -1,136 +0,0 @@
-
-# =============================================================================
-# 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
diff --git a/scripts/python/theme.py b/scripts/python/theme.py
deleted file mode 100644
index 146350d50..000000000
--- a/scripts/python/theme.py
+++ /dev/null
@@ -1,196 +0,0 @@
-"""
-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
-
-
diff --git a/scripts/python/tinyurl.py b/scripts/python/tinyurl.py
deleted file mode 100644
index c0816b45b..000000000
--- a/scripts/python/tinyurl.py
+++ /dev/null
@@ -1,333 +0,0 @@
-#
-# 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
-
diff --git a/scripts/python/todo.py b/scripts/python/todo.py
deleted file mode 100644
index 7189b280e..000000000
--- a/scripts/python/todo.py
+++ /dev/null
@@ -1,69 +0,0 @@
-"""
- :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
-
diff --git a/scripts/python/toggle.py b/scripts/python/toggle.py
deleted file mode 100644
index 1edb12ca7..000000000
--- a/scripts/python/toggle.py
+++ /dev/null
@@ -1,131 +0,0 @@
-# -*- 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()
-
-
diff --git a/scripts/python/uname.py b/scripts/python/uname.py
deleted file mode 100644
index c95ad3f17..000000000
--- a/scripts/python/uname.py
+++ /dev/null
@@ -1,18 +0,0 @@
-# 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')
diff --git a/scripts/python/urlgrab.py b/scripts/python/urlgrab.py
deleted file mode 100644
index 360a7eaa4..000000000
--- a/scripts/python/urlgrab.py
+++ /dev/null
@@ -1,462 +0,0 @@
-#
-# UrlGrab, version 1.1, for weechat version 0.2.4
-#
-# 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
-#
-# default
-# The command that will be run if no arguemnts to /url are given.
-# Default is help
-#
-# Requirements:
-#
-# - Designed to run with weechat version 0.2.4 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).
-#
-# - With changes by Leonid Evdokimov (weechat at darkk dot net another dot ru):
-# http://darkk.net.ru/weechat/urlgrab.py
-# v1.1: added better handling of dead zombie-childs
-# added parsing of private messages
-# added default command setting
-# added parsing of scrollback buffers on load
-#
-# 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 sys
-import os
-import weechat
-import subprocess
-
-UC_NAME="UrlGrab"
-UC_VERSION="1.1"
-
-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 = {
- 'default':WeechatSetting('default', 'help',
- "default command to /url to run if none given" ),
- '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(server, command):
- # :nick!ident@host PRIVMSG dest :foobarbaz
- l = command.split(' ')
- mask = l[0][1:]
- dest = l[2]
- message = ' '.join(l[3:])[1:]
- ###########################################
- #nothing, info, message = command.split(":", 2)
- #info = info.split(' ')
- if dest == weechat.get_info('nick', server):
- source = mask.split("!")[0]
- else:
- source = dest
- return (source, message)
-
-def urlGrabCheckMsgline(server, chan, message):
- # 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)
-
-def urlGrabCheck(server, args):
- global urlGrab
- chan, message = urlGrabParsemsg(server, args)
- urlGrabCheckMsgline(server, chan, message)
- return weechat.PLUGIN_RC_OK
-
-def urlGrabCheckOnload():
- for buf in weechat.get_buffer_info().itervalues():
- if len(buf['channel']):
- lines = weechat.get_buffer_data(buf['server'], buf['channel'])
- for line in reversed(lines):
- urlGrabCheckMsgline(buf['server'], buf['channel'], line['data'])
-
-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:
- logfile = os.path.expanduser( urlGrabSettings.get( 'cmdlog' ) )
- try:
- subprocess.Popen(
- argl,
- stdin = open('/dev/null', 'r'),
- stdout = open(logfile, 'a'),
- stderr = subprocess.STDOUT)
- except:
- urlGrabPrint(traceback.format_exc(None))
- sys.exit(0)
- else:
- # In the parent - we may wait for stub to fork again and let the init kill grand-child
- try:
- os.waitpid(childpid, 0)
- except:
- pass
- 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:
- largs = [urlGrabSettings.get('default')]
- 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
-
-if weechat.register (UC_NAME, UC_VERSION, "", "Url collector/launcher for weechat"):
- urlGrabSettings = UrlGrabSettings()
- urlGrab = UrlGrabber( urlGrabSettings.get('historysize') )
- urlGrabCheckOnload()
- weechat.add_message_handler("privmsg", "urlGrabCheck")
- weechat.add_command_handler("url", "urlGrabMain", "Controls UrlGrab -> '/url help' for usage")
-
diff --git a/scripts/python/weempd.py b/scripts/python/weempd.py
deleted file mode 100644
index db7396593..000000000
--- a/scripts/python/weempd.py
+++ /dev/null
@@ -1,40 +0,0 @@
-#Author: Pablo Escobar <pablo__escobar AT tlen DOT pl>
-#What it does: This script shows the currently played song in mpd
-#Usage: /weempd - Displays the songname
-#Released under GNU GPL v2 or newer
-
-#/usr/bin/python
-#coding: utf-8
-
-import weechat
-import re
-import codecs
-from os import popen
-
-weechat.register ('weempd', '0.01', '', """mpd-weechat current song script (usage: /weempd)""")
-weechat.add_command_handler ('weempd', 'show_it_to_them')
-
-default = {
- "msg_head": "is playing",
- "msg_tail": "with mpd",
- "spacer": "★",
- "colour_title": "C12",
- "colour_spacer": "C08",
-}
-
-for k, v in default.items():
- if not weechat.get_plugin_config(k):
- weechat.set_plugin_config(k, v)
-
-def show_it_to_them(server, args):
- spacer = weechat.get_plugin_config("spacer")
- msg_tail = weechat.get_plugin_config("msg_tail")
- msg_head = weechat.get_plugin_config("msg_head")
- colour_title = weechat.get_plugin_config("colour_title")
- colour_spacer = weechat.get_plugin_config("colour_spacer")
- tempinfo = popen('mpc').readline().rstrip()
- all = '/me ' + msg_head + ' %' + colour_spacer + spacer + ' %' + colour_title + tempinfo + ' %' + colour_spacer + spacer + " %C00" + msg_tail
- weechat.command(all)
- return 0
-
-
diff --git a/scripts/python/weexaile.py b/scripts/python/weexaile.py
deleted file mode 100644
index bfab1f378..000000000
--- a/scripts/python/weexaile.py
+++ /dev/null
@@ -1,53 +0,0 @@
-#Author: Pablo Escobar <pablo__escobar AT tlen DOT pl>
-#What it does: This script shows the currently played song in exaile
-#Usage: /weexaile - Displays the songname
-#Released under GNU GPL v2 or newer
-
-#/usr/bin/python
-#coding: utf-8
-
-import weechat
-import re
-import codecs
-from os import popen
-
-weechat.register ('exaile', '0.01', '', """exaile-weechat current song script (usage: /weexaile)""")
-weechat.add_command_handler ('weexaile', 'show_it_to_them')
-
-default = {
- "msg_head": "is playing",
- "msg_tail": "with exaile",
- "spacer": "★",
- "colour_artist": "C03",
- "colour_title": "C02",
- "colour_lenght": "C05",
- "colour_spacer": "C08",
-}
-
-for k, v in default.items():
- if not weechat.get_plugin_config(k):
- weechat.set_plugin_config(k, v)
-
-def show_it_to_them(server, args):
- spacer = weechat.get_plugin_config("spacer")
- msg_tail = weechat.get_plugin_config("msg_tail")
- msg_head = weechat.get_plugin_config("msg_head")
- colour_artist = weechat.get_plugin_config("colour_artist")
- colour_title = weechat.get_plugin_config("colour_title")
- colour_lenght = weechat.get_plugin_config("colour_lenght")
- colour_spacer = weechat.get_plugin_config("colour_spacer")
- exaile_running = popen ('exaile --get-title')
- exaile_running_text = exaile_running.readline().rstrip()
- if exaile_running_text != "No running Exaile instance found.":
- song_name = popen ('exaile --get-title')
- song_name_text = song_name.readline().rstrip()
- song_artist = popen ('exaile --get-artist')
- song_artist_text = song_artist.readline().rstrip()
- song_length = popen ('exaile --get-length')
- song_length_text = song_length.readline().rstrip()
- song_current = popen ('exaile --current-position')
- song_current_text = str(round(float(song_current.readline().rstrip()),2))
- all = '/me ' + msg_head + ' %' + colour_title + song_name_text + ' %' + colour_spacer + spacer + ' %' + colour_artist + song_artist_text + ' %' + colour_spacer + spacer + ' %' + colour_lenght + song_length_text + " (" + song_current_text + "%)" + " %C00" + msg_tail
- weechat.command(all)
- return 0
-
diff --git a/scripts/ruby/browse.rb b/scripts/ruby/browse.rb
deleted file mode 100644
index 9ab9e0e51..000000000
--- a/scripts/ruby/browse.rb
+++ /dev/null
@@ -1,127 +0,0 @@
-# Copyright (c) 2007 by Javier Valencia <jvalencia@log01.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
-#
-
-def weechat_init
- Weechat.register("browse", "0.1", "", "Fast url browsing for Weechat.")
-
- Weechat.add_command_handler(
- "browse",
- "do_browse",
- "Use your preferred browser to navigate an url.",
- "[number of url] (-1 to browse all) (leave empty to browse first one)")
- Weechat.add_command_handler(
- "webbrowser",
- "set_browser",
- "Get/Set browser command",
- "[command] (leavy empty to get current command)")
- Weechat.add_command_handler(
- "urls",
- "get_url_list",
- "Get a list of urls in a channel.")
-
- Weechat.print("")
- Weechat.print("See help for 'browse', 'webbrowser' and 'urls' commands.")
- if Weechat.get_plugin_config("webbrowser").empty?
- Weechat.print("")
- Weechat.print("WARNING: you must define a web browser with the command /webbrowser.")
- end
- return Weechat::PLUGIN_RC_OK
-end
-
-def set_browser(server, args)
- if args.empty?
- Weechat.print("current web browser -> #{Weechat.get_plugin_config('webbrowser')}")
- else
- Weechat.set_plugin_config("webbrowser", args)
- Weechat.print("web browser set to -> #{args}")
- end
- return Weechat::PLUGIN_RC_OK
-end
-
-def get_url_array(buffer_data)
- urls = Array.new
- buffer_data.each do |line|
- line["data"].split.each do |word|
- if word =~ /^http\:\/\/.*/
- urls << word
- end
- end
- end
- return urls.uniq.reverse
-end
-
-def get_url_list(server,args)
- channel = Weechat.get_info("channel")
- if channel.empty?
- Weechat.print("You must be inside a channel.")
- return Weechat::PLUGIN_RC_KO
- end
- buffer = Weechat.get_buffer_data(server, channel)
- unless buffer
- Weechat.print("Error retrieving window buffer, may be a bug?.")
- return Weechat::PLUGIN_RC_KO
- end
- Weechat.print("")
- Weechat.print("URL listing:")
- pos = 0
- get_url_array(buffer).each do |url|
- Weechat.print("#{pos}) #{url}")
- pos += 1
- end
- return Weechat::PLUGIN_RC_OK
-end
-
-def do_browse(server, args)
- num = args.to_i
- channel = Weechat.get_info("channel")
- if channel.empty?
- Weechat.print("You must be inside a channel.")
- return Weechat::PLUGIN_RC_KO
- end
- buffer = Weechat.get_buffer_data(server, channel)
- unless buffer
- Weechat.print("Error retrieving window buffer, may be a bug?.")
- return Weechat::PLUGIN_RC_KO
- end
- browser = Weechat.get_plugin_config("webbrowser")
- if browser.empty?
- Weechat.print("")
- Weechat.print("WARNING: you must define a web browser with the command /webbrowser.")
- return Weechat::PLUGIN_RC_KO
- end
- urls = get_url_array(buffer)
- if urls.empty?
- Weechat.print("No urls in current channel.")
- else
- if num == -1
- Weechat.print("Starting browser...")
- fork do # only for unix/posix
- exec("#{browser} #{urls.join(' ')} &> /dev/null")
- end
- else
- if urls[num]
- Weechat.print("Starting browser...")
- fork do # only for unix/posix
- exec("#{browser} #{urls[num]} &> /dev/null")
- end
- else
- Weechat.print("Invalid url number.")
- end
- end
- end
- return Weechat::PLUGIN_RC_OK
-end
diff --git a/scripts/ruby/forcenick.rb b/scripts/ruby/forcenick.rb
deleted file mode 100644
index 3d2120e74..000000000
--- a/scripts/ruby/forcenick.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-# Forcenick v1.0 - forces your original nickname
-# Copyright (C) 2007 Pavel Shevchuk <stlwrt@gmail.com>
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-def weechat_init
- Weechat.register("forcenick", "1.0", "", "Forces your original nickname, wipes out ghosts and nick stealers")
- Weechat.add_command_handler("forcenick", "forcenick", "Forces server_nick1, identifies to nickserv using server_password. Useful to call from server_command if your connection is unstable")
-end
-
-def forcenick(server, args)
- server_info = Weechat.get_server_info[server]
- cur_nick = server_info['nick']
- forced_nick = server_info['nick1']
- password = server_info['password']
- if cur_nick != forced_nick
- Weechat.command("/msg nickserv ghost #{forced_nick} #{password}", "", server)
- Weechat.command("/nick #{forced_nick}", "", server)
- Weechat.command("/msg nickserv identify #{password}", "", server)
- end
- return Weechat::PLUGIN_RC_OK
-end
-
diff --git a/scripts/ruby/myuptime.rb b/scripts/ruby/myuptime.rb
deleted file mode 100644
index 2aa6fcb6b..000000000
--- a/scripts/ruby/myuptime.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# ==================================================================================================
-# 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
diff --git a/scripts/ruby/now-playing.rb b/scripts/ruby/now-playing.rb
deleted file mode 100644
index 0472226f5..000000000
--- a/scripts/ruby/now-playing.rb
+++ /dev/null
@@ -1,66 +0,0 @@
-# =============================================================================
-# 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
diff --git a/scripts/ruby/rbox.rb b/scripts/ruby/rbox.rb
deleted file mode 100644
index 0adabb2a0..000000000
--- a/scripts/ruby/rbox.rb
+++ /dev/null
@@ -1,84 +0,0 @@
-# Rbox plugin (Rhythmnox control and now playing plugin.)
-# Version 0.2
-# Released under GNU GPL v2
-# Metallines <metallines@gmail.com>
-# /rbox-help for help
-
-def weechat_init
- Weechat.register("rbox", "0.2", "", "Rhythmbox control and now playing plugin.")
- Weechat.add_command_handler("rbox-print", "rbox_print")
- Weechat.add_command_handler("rbox-play", "rbox_play")
- Weechat.add_command_handler("rbox-pause", "rbox_pause")
- Weechat.add_command_handler("rbox-previous", "rbox_previous")
- Weechat.add_command_handler("rbox-next", "rbox_next")
- Weechat.add_command_handler("rbox-help", "rbox_help")
- return Weechat::PLUGIN_RC_OK
-end
-
-def rbox_print(server, args)
- if `ps -C rhythmbox` =~ /rhythmbox/
- artiste = `rhythmbox-client --print-playing-format %ta`.chomp
- titre = `rhythmbox-client --print-playing-format %tt`.chomp
- album = `rhythmbox-client --print-playing-format %at`.chomp
-
- couleur_artiste = "C05"
- couleur_titre = "C10"
- couleur_album = "C03"
- couleur_entre = "C14"
-
- Weechat.command("/me écoute" + " %" + couleur_titre + titre + " %" + couleur_entre + "par" + " %" + couleur_artiste + artiste + " %" + couleur_entre + "de l'album" + " %" + couleur_album + album)
- else
- Weechat.print("Rhythmbox isn't running.")
- end
- return Weechat::PLUGIN_RC_OK
-end
-
-def rbox_play(server, args)
- if `ps -C rhythmbox` =~ /rhythmbox/
- `rhythmbox-client --play`
- Weechat.print("Start playback.")
- else
- Weechat.print("Rhythmbox isn't running.")
- end
- return Weechat::PLUGIN_RC_OK
-end
-
-def rbox_pause(server, args)
- if `ps -C rhythmbox` =~ /rhythmbox/
- `rhythmbox-client --pause`
- Weechat.print("Pause playback.")
- else
- Weechat.print("Rhythmbox isn't running.")
- end
- return Weechat::PLUGIN_RC_OK
-end
-
-def rbox_previous(server, args)
- if `ps -C rhythmbox` =~ /rhythmbox/
- `rhythmbox-client --previous`
- Weechat.print("Skip to the previous track.")
- else
- Weechat.print("Rhythmbox isn't running.")
- end
- return Weechat::PLUGIN_RC_OK
-end
-
-def rbox_next(server, args)
- if `ps -C rhythmbox` =~ /rhythmbox/
- `rhythmbox-client --next`
- Weechat.print("Skip to the next track.")
- else
- Weechat.print("Rhythmbox isn't running.")
- end
- return Weechat::PLUGIN_RC_OK
-end
-
-def rbox_help(server, args)
- Weechat.print("/rbox-play -> Start playback")
- Weechat.print("/rbox-pause -> Pause playback")
- Weechat.print("/rbox-previous -> Skip to previous track")
- Weechat.print("/rbox-next -> Skip to next track")
- Weechat.print("/rbox-print -> Print which song rhythmbox is playing in current channel")
- Weechat.print("/robix-help -> Display this help")
- return Weechat::PLUGIN_RC_OK
-end