...
 
Commits (144)
...@@ -31,11 +31,13 @@ Then the author will send a pull request on this repository. ...@@ -31,11 +31,13 @@ Then the author will send a pull request on this repository.
There are two ways to send a new release for a script: There are two ways to send a new release for a script:
* Send a pull request, the commit message must have the name of script, * Send a pull request (*recommended*). +
version, and changes, like that: + The commit message must have the name of script, version, and changes,
like that: +
`script.py 0.3: fix...` + `script.py 0.3: fix...` +
Please submit only one script per pull request. Only one script is allowed per pull request.
* Use the form at: <https://weechat.org/scripts/update/>. * Use the form at: <https://weechat.org/scripts/update/> (please use this form
only if you can not send a pull request).
When sending a new version : When sending a new version :
......
; WeeChat-Script to replace emotion-tags with random emoticons. ; WeeChat-Script to replace emotion-tags with random emoticons.
; Copyright (C) 2017 Alvar <post@0x21.biz> ; Copyright (C) 2017-2018 Alvar <post@0x21.biz>
; ;
; This program is free software: you can redistribute it and/or modify ; 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 ; it under the terms of the GNU General Public License as published by
...@@ -53,15 +53,11 @@ ...@@ -53,15 +53,11 @@
(emoticonize-line new-line) (emoticonize-line new-line)
new-line))) new-line)))
; Pointer String String -> Weechat-Return ; Pointer ? ? String -> String
; This function was registered to be called when an input was submitted and ; This function was registered to be called when an input was submitted and
; will try to replace ~~EMOTIONs to emoticons. ; will try to replace ~~EMOTIONs to emoticons.
(define (command-run data buffer command) (define (weechataboo-hook data modifier modifier-data msg)
(let* (emoticonize-line msg))
((input (weechat:buffer_get_string buffer "input"))
(output (emoticonize-line input)))
(weechat:buffer_set buffer "input" output))
weechat:WEECHAT_RC_OK)
; Pointer String List -> Weechat-Return ; Pointer String List -> Weechat-Return
; Function which tells you to RTFM. ; Function which tells you to RTFM.
...@@ -75,25 +71,28 @@ ...@@ -75,25 +71,28 @@
(let* (let*
; Some defaults which may be useful‥ ; Some defaults which may be useful‥
((emotions ((emotions
'(("angry" "눈_눈,(¬_¬),(`ε´),(¬▂¬),(▽д▽)") '(("aggressive" "o(-`д´- 。),凸ಠ益ಠ)凸,' ̿'̵͇̿̿з=(◕_◕)=ε/̵͇̿̿/'̿'̿ ̿,O=('-'Q),。゜(`Д´)゜。,┌∩┐(ಠ_ಠ)┌∩┐")
("blush" "(´ω`*),(‘-’*),(/ε\*),(*゚∀゚*),(*´ェ`*)") ("angry" "눈_눈,(¬_¬),(`ε´),(¬▂¬),(▽д▽),ಠ_ರೃ,(⋋▂⋌),(‡▼益▼),(*`へ´*)")
("cry" "(;へ:),(πーπ),(iДi),(;Д;),(╥_╥)") ("blush" "(´ω`*),(‘-’*),(/ε\*),(*゚∀゚*),(*´ェ`*)")
("dance" "ヾ(^^ゞ),(ノ^o^)ノ,⌎⌈╹우╹⌉⌍,└|゚ε゚|┐,┌|゚з゚|┘,(〜 ̄△ ̄)〜") ("cat" "≋≋≋≋≋̯̫⌧̯̫(ˆ•̮ ̮•ˆ)")
("drink" "(^-^)_日,(*^◇^)_旦,(  ゜Д゜)⊃旦,~~旦_(-ω-`。)") ("cry" "(;へ:),(πーπ),(iДi),(;Д;),(╥_╥),ಥ╭╮ಥ")
("excited" "(≧∇≦*),ヽ(^Д^)ノ,(* >ω<)") ("dance" "ヾ(^^ゞ),(ノ^o^)ノ,⌎⌈╹우╹⌉⌍,└|゚ε゚|┐,┌|゚з゚|┘,(〜 ̄△ ̄)〜")
("gross" "(咒),( ≖ิ‿≖ิ ),ʅ(◔౪◔ ) ʃ") ("drink" "(^-^)_日,(*^◇^)_旦,(  ゜Д゜)⊃旦,~~旦_(-ω-`。)")
("happy" "≖‿≖,(^ω^),(^ω^),ヽ(ヅ)ノ,(¬‿¬)") ("excited" "(≧∇≦*),ヽ(^Д^)ノ,(* >ω<)")
("heart" "♡^▽^♡,✿♥‿♥✿,(。♥‿♥。),ヽ(o♡o)/") ("gross" "(咒),( ≖ิ‿≖ิ ),ʅ(◔౪◔ ) ʃ")
("hug" "⊂(・﹏・⊂),(っ´▽`)っ,(づ ̄ ³ ̄)づ,⊂(´・ω・`⊂)") ("happy" "≖‿≖,(^ω^),(^ω^),ヽ(ヅ)ノ,(¬‿¬),(◡‿◡✿),(❀◦‿◦),(⁎⚈᷀᷁ᴗ⚈᷀᷁⁎)")
("kiss" "|°з°|,(*^3^),(´ε`*)") ("heart" "♡^▽^♡,✿♥‿♥✿,(。♥‿♥。),ヽ(o♡o)/,(◍•ᴗ•◍)❤,(˘︶˘).。.:*♡,❣◕ ‿ ◕❣")
("lenny" "( ͡ ͜ʖ ͡ ),( ͡~ ͜ʖ ͡°),( ͡~ ͜ʖ ͡~),ヽ( ͝° ͜ʖ͡°)ノ,(つ ͡° ͜ʖ ͡°)つ") ("hug" "⊂(・﹏・⊂),(っ´▽`)っ,(づ ̄ ³ ̄)づ,⊂(´・ω・`⊂)")
("magic" "(っ・ω・)っ≡≡≡≡≡≡☆,ヽ༼ຈل͜ຈ༽⊃─☆*:・゚") ("kiss" "|°з°|,(*^3^),(´ε`*),(っ˘з(˘⌣˘ ),(*^3^)/~♡")
("sheep" "@^ェ^@,@・ェ・@") ("lenny" "( ͡ ͜ʖ ͡ ),( ͡~ ͜ʖ ͡°),( ͡~ ͜ʖ ͡~),ヽ( ͝° ͜ʖ͡°)ノ,(つ ͡° ͜ʖ ͡°)つ,( ͝סּ ͜ʖ͡סּ),")
("shrug" "┐(´д`)┌,╮(╯∀╰)╭,┐(´∀`)┌,ʅ(́◡◝)ʃ,ヽ(~~~ )ノ") ("magic" "(っ・ω・)っ≡≡≡≡≡≡☆,ヽ༼ຈل͜ຈ༽⊃─☆*:・゚")
("shock" "(゚д゚;)") ("sheep" "@^ェ^@,@・ェ・@")
("shy" "(/ω\),(‘-’*),(´~`ヾ),(〃´∀`)") ("shock" "(゚д゚;)")
("smug" "( ̄ω ̄),( ̄ー ̄),( ̄ー ̄),(^~^)") ("shrug" "┐(´д`)┌,╮(╯∀╰)╭,┐(´∀`)┌,ʅ(́◡◝)ʃ,ヽ(~~~ )ノ,ヽ(。_°)ノ,¯\(◉◡◔)/¯,◔_◔")
("wink" "ヾ(^∇^),ヾ(☆▽☆),(。-ω-)ノ,( ・ω・)ノ"))) ("shy" "(/ω\),(‘-’*),(´~`ヾ),(〃´∀`)")
("smug" "( ̄ω ̄),( ̄ー ̄),( ̄ー ̄),(^~^)")
("sword" "╰(◕ヮ◕)つ¤=[]———,╰(⇀︿⇀)つ-]═───,∩(˵☯‿☯˵)つ¤=[]:::::>")
("wink" "ヾ(^∇^),ヾ(☆▽☆),(。-ω-)ノ,( ・ω・)ノ")))
(names (string-join (map car emotions) ","))) (names (string-join (map car emotions) ",")))
(and (and
(weechat:config_set_plugin "emotions" names) (weechat:config_set_plugin "emotions" names)
...@@ -112,13 +111,14 @@ ...@@ -112,13 +111,14 @@
(weechat:register (weechat:register
"weechataboo" "Alvar" "0.1" "GPL3" "weechataboo" "Alvar" "0.1.2" "GPL3"
"Replace emotion-tags with random emoticons" "clean-up" "") "Replace emotion-tags with random emoticons" "clean-up" "")
(and (eq? (weechat:config_is_set_plugin "emotions") 0) (and (eq? (weechat:config_is_set_plugin "emotions") 0)
(initial-setup)) (initial-setup))
(weechat:hook_command_run "/input return" "command-run" "") (weechat:hook_modifier "irc_out1_privmsg" "weechataboo-hook" "")
(weechat:hook_command (weechat:hook_command
"weechataboo" "weechataboo"
(string-append "This script automatically replaces written emotion-keywords\n" (string-append "This script automatically replaces written emotion-keywords\n"
......
use strict;
use Encode qw(encode_utf8);
weechat::register(
'autonickprefix',
'Juerd <#####@juerd.nl>',
'1.00',
'PD',
"Change 'nick: ' prefix if the nick is changed while you're still editing.",
'',
''
);
# This is a port of the Irssi script autonickprefix.pl, the main difference
# being that WeeChat has an input *per buffer*, so the script needs to iterate
# over the buffers instead of just the current one, because there could be
# multiple messages waiting to be sent.
sub nick_changed {
my (undef, $server, $args) = @_;
$server = (split /,/, $server)[0];
my ($oldnick, $newnick) = $args =~ /\:(.*)\!(?:.*)\:(.*)/
or return weechat::WEECHAT_RC_OK;
my $hdata = weechat::hdata_get("buffer");
my $buffer = weechat::hdata_get_list($hdata, "gui_buffers");
my $char = weechat::config_get('completion.nick_completer');
while ($buffer) {
weechat::buffer_get_string($buffer,'localvar_server') eq $server
or next;
my $pos = weechat::buffer_get_integer($buffer, 'input_pos');
my $input = weechat::buffer_get_string($buffer, 'input');
$pos >= length("$oldnick$char") or next;
$input =~ s/^\Q$oldnick$char/$newnick$char/ or next;
my $delta = length($newnick) - length($oldnick);
weechat::buffer_set($buffer, "input", $input);
weechat::buffer_set($buffer, "input_pos", $pos + $delta);
} continue {
$buffer = weechat::hdata_pointer($hdata, $buffer, "next_buffer");
}
return weechat::WEECHAT_RC_OK;
}
weechat::hook_signal("*,irc_in_nick", "nick_changed", "");
This diff is collapsed.
# #
# Copyright (c) 2010-2013 by Nils Görs <weechatter@arcor.de> # Copyright (c) 2010-2018 by Nils Görs <weechatter@arcor.de>
# #
# display the status and visited buffers of your buddies in a buddylist bar # display the status and visited buffers of your buddies in a buddylist bar
# #
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
# 1.9 : added: cursor support
# 1.8 : fixed: problem with temporary server # 1.8 : fixed: problem with temporary server
# : added: %h variable for filename # : added: %h variable for filename
# 1.7 : fixed: perl error when adding and removing nick # 1.7 : fixed: perl error when adding and removing nick
...@@ -81,7 +82,7 @@ ...@@ -81,7 +82,7 @@
use strict; use strict;
my $prgname = "buddylist"; my $prgname = "buddylist";
my $version = "1.8"; my $version = "1.9";
my $description = "display status from your buddies a bar-item."; my $description = "display status from your buddies a bar-item.";
# -------------------------------[ config ]------------------------------------- # -------------------------------[ config ]-------------------------------------
...@@ -121,6 +122,9 @@ my %mouse_keys = ("\@item(buddylist):button1*" ...@@ -121,6 +122,9 @@ my %mouse_keys = ("\@item(buddylist):button1*"
"\@chat(*)>item(buddylist):button1-gesture-*" => "hsignal:buddylist_mouse", "\@chat(*)>item(buddylist):button1-gesture-*" => "hsignal:buddylist_mouse",
"\@item(buddylist):button1-gesture-*" => "hsignal:buddylist_mouse"); "\@item(buddylist):button1-gesture-*" => "hsignal:buddylist_mouse");
my %cursor_keys = ( "\@item(buddylist):q" => "hsignal:buddylist_cursor",
"\@item(buddylist):w" => "hsignal:buddylist_cursor");
my $debug_redir_out = "off"; my $debug_redir_out = "off";
# ------------------------------[ internal ]----------------------------------- # ------------------------------[ internal ]-----------------------------------
...@@ -196,7 +200,9 @@ weechat::hook_signal("upgrade_ended", "buddylist_upgrade_ended", ""); ...@@ -196,7 +200,9 @@ weechat::hook_signal("upgrade_ended", "buddylist_upgrade_ended", "");
if ($weechat_version >= 0x00030600){ if ($weechat_version >= 0x00030600){
weechat::hook_focus($prgname, "hook_focus_buddylist", ""); weechat::hook_focus($prgname, "hook_focus_buddylist", "");
weechat::hook_hsignal("buddylist_mouse","buddylist_hsignal_mouse", ""); weechat::hook_hsignal("buddylist_mouse","buddylist_hsignal_mouse", "");
weechat::hook_hsignal("buddylist_cursor","buddylist_hsignal_cursor", "");
weechat::key_bind("mouse", \%mouse_keys); weechat::key_bind("mouse", \%mouse_keys);
weechat::key_bind("cursor", \%cursor_keys);
} }
...@@ -248,10 +254,13 @@ weechat::hook_command($prgname, $description, ...@@ -248,10 +254,13 @@ weechat::hook_command($prgname, $description,
"\n". "\n".
"'plugins.var.perl.buddylist.use.redirection' : using redirection to get status of buddies (needs weechat >=0.3.4) (default: on).\n". "'plugins.var.perl.buddylist.use.redirection' : using redirection to get status of buddies (needs weechat >=0.3.4) (default: on).\n".
"\n\n". "\n\n".
"Mouse-support (standard key bindings):\n". "Mouse-support:\n".
" click left mouse-button on buddy to open a query buffer.\n". " click left mouse-button on buddy to open a query buffer.\n".
" add a buddy by dragging a nick with left mouse-button from nicklist or chat-area and drop on buddylist.\n". " add a buddy by dragging a nick with left mouse-button from nicklist or chat-area and drop on buddylist.\n".
" remove a buddy by dragging a buddy with left mouse-button from buddylist and drop it on any area.\n". " remove a buddy by dragging a buddy with left mouse-button from buddylist and drop it on any area.\n".
"Cursor-Mode:\n".
" q open query with nick (/query)\n".
" w query information about user (/whois)\n".
"\n\n". "\n\n".
"Troubleshooting:\n". "Troubleshooting:\n".
"If buddylist will not be refreshed in nicklist-mode, check the following WeeChat options:\n". "If buddylist will not be refreshed in nicklist-mode, check the following WeeChat options:\n".
...@@ -1521,7 +1530,7 @@ $server = $channel if ( $server eq "server"); ...@@ -1521,7 +1530,7 @@ $server = $channel if ( $server eq "server");
return weechat::WEECHAT_RC_OK; return weechat::WEECHAT_RC_OK;
} }
# -------------------------------[ mouse support ]------------------------------------- # --------------------------[ mouse and cursor support ]--------------------------------
sub hook_focus_buddylist{ sub hook_focus_buddylist{
my %info = %{$_[1]}; my %info = %{$_[1]};
my $bar_item_line = int($info{"_bar_item_line"}); my $bar_item_line = int($info{"_bar_item_line"});
...@@ -1529,9 +1538,9 @@ sub hook_focus_buddylist{ ...@@ -1529,9 +1538,9 @@ sub hook_focus_buddylist{
return if ($#buddylist_focus == -1); return if ($#buddylist_focus == -1);
my $flag = 0; my $flag = 0;
# if button1 was pressed on "offline" buddy, do nothing!!! # mouse or key pressed on "offline" buddy, do nothing!!!
if ( ($info{"_bar_item_name"} eq $prgname) && ($bar_item_line >= 0) && ($bar_item_line <= $#buddylist_focus) && ($info{"_key"} eq "button1" ) ){ if ( ($info{"_bar_item_name"} eq $prgname) && ($bar_item_line >= 0) && ($bar_item_line <= $#buddylist_focus) ){
$hash = $buddylist_focus[$bar_item_line]; $hash = $buddylist_focus[$bar_item_line];
my $hash_focus = $hash; my $hash_focus = $hash;
while ( my ($key,$value) = each %$hash_focus ){ while ( my ($key,$value) = each %$hash_focus ){
if ( $key eq "status" and $value eq "2" ){ if ( $key eq "status" and $value eq "2" ){
...@@ -1574,4 +1583,20 @@ sub buddylist_hsignal_mouse{ ...@@ -1574,4 +1583,20 @@ sub buddylist_hsignal_mouse{
weechat::bar_item_update($prgname); weechat::bar_item_update($prgname);
return weechat::WEECHAT_RC_OK; return weechat::WEECHAT_RC_OK;
} }
# this is the end
sub buddylist_hsignal_cursor{
my ($data, $signal, %hash) = ($_[0], $_[1], %{$_[2]});
# no server?
return weechat::WEECHAT_RC_OK if (not defined $hash{"server"});
# check which key was pressed and do some magic!
if ( $hash{"_key"} eq "q" ){
weechat::command("", "/query -server " . $hash{"server"} . " " . $hash{"nick"});
}elsif ( $hash{"_key"} eq "w" ){
weechat::command(weechat::buffer_search("==","irc.server.".$hash{"server"}), "/WHOIS " . $hash{"nick"});
}
# STOP cursor mode
weechat::command("", "/cursor stop");
return weechat::WEECHAT_RC_OK;
}
# #
# Copyright (c) 2010-2015 by Nils Görs <weechatter@arcor.de> # Copyright (c) 2010-2018 by Nils Görs <weechatter@arcor.de>
# Copyleft (ɔ) 2013 by oakkitten # Copyleft (ɔ) 2013 by oakkitten
# #
# colors the channel text with nick color and also highlight the whole line # colors the channel text with nick color and also highlight the whole line
...@@ -18,32 +18,10 @@ ...@@ -18,32 +18,10 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# with version 3.0 some options were renamed or have new possible values:
# old: new:
# avail_buffer buffer
# blacklist_channels blacklist_buffers
# highlight new values
# obsolete options:
# buffer_autoset
# hotlist_max_level_nicks_add
# highlight_regex
# highlight_words
# shuffle
# chat see option highlight
# i recommend to remove all colorize_lines options, first:
# /script unload colorize_lines
# /unset plugins.var.perl.colorize_lines.*
# /unset plugins.desc.perl.colorize_lines*
# /script load colorize_lines.pl
# you can colorize lines with a channel color instead of nick color:
# /buffer set localvar_set_colorize_lines yellow
# /buffer set localvar_set_colorize_lines *yellow
# history: # history:
# 3.6: new option "own_lines_color" (idea by Linkandzelda)
# : add help about "localvar" to option
# 3.5: new options "highlight_words" and "highlight_words_color" (idea by jokrebel)
# 3.4: new options "tags" and "ignore_tags" # 3.4: new options "tags" and "ignore_tags"
# 3.3: use localvar "colorize_lines" for buffer related color (idea by tomoe-mami) # 3.3: use localvar "colorize_lines" for buffer related color (idea by tomoe-mami)
# 3.2: minor logic fix # 3.2: minor logic fix
...@@ -106,29 +84,35 @@ ...@@ -106,29 +84,35 @@
use strict; use strict;
my $PRGNAME = "colorize_lines"; my $PRGNAME = "colorize_lines";
my $VERSION = "3.4"; my $VERSION = "3.6";
my $AUTHOR = "Nils Görs <weechatter\@arcor.de>"; my $AUTHOR = "Nils Görs <weechatter\@arcor.de>";
my $LICENCE = "GPL3"; my $LICENCE = "GPL3";
my $DESCR = "Colorize users' text in chat area with their nick color, including highlights"; my $DESCR = "Colorize users' text in chat area with their nick color, including highlights";
my %config = ("buffers" => "all", # all, channel, query my %config = ("buffers" => "all", # all, channel, query
"blacklist_buffers" => "", # "a,b,c" "blacklist_buffers" => "", # "a,b,c"
"lines" => "on", "lines" => "on",
"highlight" => "on", # on, off, nicks "highlight" => "on", # on, off, nicks
"nicks" => "", # "d,e,f", "/file" "nicks" => "", # "d,e,f", "/file"
"own_lines" => "on", # on, off, only "own_lines" => "on", # on, off, only
"tags" => "irc_privmsg", "own_lines_color" => "", # empty means, use color from option "chat_nick_self"
"ignore_tags" => "irc_ctcp", "tags" => "irc_privmsg",
"ignore_tags" => "irc_ctcp",
"highlight_words" => "off", # on, off
"highlight_words_color" => "black,darkgray",
); );
my %help_desc = ("buffers" => "Buffer type affected by the script (all/channel/query, default: all)", my %help_desc = ("buffers" => "Buffer type affected by the script (all/channel/query, default: all)",
"blacklist_buffers" => "Comma-separated list of channels to be ignored (e.g. freenode.#weechat,*.#python)", "blacklist_buffers" => "Comma-separated list of channels to be ignored (e.g. freenode.#weechat,*.#python)",
"lines" => "Apply nickname color to the lines (off/on/nicks). The latter will limit highlighting to nicknames in option 'nicks'", "lines" => "Apply nickname color to the lines (off/on/nicks). The latter will limit highlighting to nicknames in option 'nicks'. You can use a localvar to color all lines with a given color (eg: /buffer set localvar_set_colorize_lines *yellow)",
"highlight" => "Apply highlight color to the highlighted lines (off/on/nicks). The latter will limit highlighting to nicknames in option 'nicks'", "highlight" => "Apply highlight color to the highlighted lines (off/on/nicks). The latter will limit highlighting to nicknames in option 'nicks'",
"nicks" => "Comma-separater list of nicks (e.g. freenode.cat,*.dog) OR file name starting with '/' (e.g. /file.txt). In the latter case, nicknames will get loaded from that file inside weechat folder (e.g. from ~/.weechat/file.txt). Nicknames in file are newline-separated (e.g. freenode.dog\\n*.cat)", "nicks" => "Comma-separater list of nicks (e.g. freenode.cat,*.dog) OR file name starting with '/' (e.g. /file.txt). In the latter case, nicknames will get loaded from that file inside weechat folder (e.g. from ~/.weechat/file.txt). Nicknames in file are newline-separated (e.g. freenode.dog\\n*.cat)",
"own_lines" => "Apply nickname color to own lines (off/on/only). The latter turns off all other kinds of coloring altogether", "own_lines" => "Apply nickname color to own lines (off/on/only). The latter turns off all other kinds of coloring altogether",
"tags" => "Comma-separated list of tags to accept (see /debug tags)", "own_lines_color" => "this color will be used for own messages. Set an empty value to use weechat.color.chat_nick_self",
"ignore_tags" => "Comma-separated list of tags to ignore (see /debug tags)", "tags" => "Comma-separated list of tags to accept (see /debug tags)",
"ignore_tags" => "Comma-separated list of tags to ignore (see /debug tags)",
"highlight_words" => "highlight word(s) in text, matching word(s) in weechat.look.highlight",
"highlight_words_color" => "color for highlight word in text (fg:bg)",
); );
my @ignore_tags_array; my @ignore_tags_array;
...@@ -189,7 +173,9 @@ sub colorize_cb ...@@ -189,7 +173,9 @@ sub colorize_cb
# process only if own_lines is "on" or "only" (i.e. not "off") # process only if own_lines is "on" or "only" (i.e. not "off")
return $string if ($config{own_lines} eq "off") && not ($channel_color); return $string if ($config{own_lines} eq "off") && not ($channel_color);
$color = weechat::color("chat_nick_self"); $color = weechat::color($config{own_lines_color});
$color = weechat::color("chat_nick_self") if ($config{own_lines_color} eq "");
$color = $channel_color if ($channel_color) && ($config{own_lines} eq "off"); $color = $channel_color if ($channel_color) && ($config{own_lines} eq "off");
} else { } else {
...@@ -223,12 +209,41 @@ sub colorize_cb ...@@ -223,12 +209,41 @@ sub colorize_cb
$color = $channel_color if ($channel_color); $color = $channel_color if ($channel_color);
} else { } else {
# oh well # oh well
return $string; return $string if ($config{highlight_words} ne "on");
} }
} }
my $right_nocolor = weechat::string_remove_color($right, "");
if ((
$config{highlight_words} eq "on"
) && ($my_nick ne $nick) && (
weechat::string_has_highlight($right_nocolor, weechat::config_string(weechat::config_get("weechat.look.highlight")))
))
{
my $high_word_color = weechat::color(weechat::config_get_plugin("highlight_words_color"));
my $reset = weechat::color('reset');
my @highlight_array = split(/,/,weechat::config_string(weechat::config_get("weechat.look.highlight")));
my @line_array = split(/ /,$right);
foreach my $l (@line_array) {
foreach my $h (@highlight_array) {
my $i = $h;
# check word case insensitiv || check if word matches without "(?-i)" at beginning
if ( lc($l) eq lc($h) || (index($h,"(?-i)") != -1 && ($l eq substr($i,5,length($i)-5,""))) ) {
$right =~ s/\Q$l\E/$high_word_color$l$reset/;
# word starts with (?-i) and has a wildcard ?
} elsif ((index($h,"(?-i)") != -1) && (index($h,"*") != -1) ){
my $i = $h;
my $t = substr($i,5,length($i)-5,"");
my $regex = weechat::string_mask_to_regex($t);
$right =~ s/\Q$l\E/$high_word_color$l$reset/ if ($l =~ /^$regex$/i); # use * without sensitive
}elsif ((index($h,"*") == 0 || index($h,"*") == length($h)-1)){# wildcard at beginning or end ?
my $regex = weechat::string_mask_to_regex($h);
$right =~ s/\Q$l\E/$high_word_color$l$reset/ if ($l =~ /^$regex$/i);
}
}
}
}
######################################## inject colors and go! ######################################## inject colors and go!
my $out = ""; my $out = "";
if ($action) { if ($action) {
# remove the first color reset - after * nick # remove the first color reset - after * nick
......
...@@ -322,7 +322,7 @@ for full pod documentation, filter this script with ...@@ -322,7 +322,7 @@ for full pod documentation, filter this script with
use MIME::Base64; use MIME::Base64;
use constant SCRIPT_NAME => 'coords'; use constant SCRIPT_NAME => 'coords';
weechat::register(SCRIPT_NAME, 'Nei <anti.teamidiot.de>', '0.7.3.1', 'GPL3', 'copy text and urls', 'stop_coords', '') || return; weechat::register(SCRIPT_NAME, 'Nei <anti.teamidiot.de>', '0.7.3.2', 'GPL3', 'copy text and urls', 'stop_coords', '') || return;
sub SCRIPT_FILE() { sub SCRIPT_FILE() {
my $infolistptr = weechat::infolist_get('perl_script', '', SCRIPT_NAME); my $infolistptr = weechat::infolist_get('perl_script', '', SCRIPT_NAME);
my $filename = weechat::infolist_string($infolistptr, 'filename') if weechat::infolist_next($infolistptr); my $filename = weechat::infolist_string($infolistptr, 'filename') if weechat::infolist_next($infolistptr);
...@@ -898,7 +898,7 @@ weechat::key_bind('mouse', +{ ...@@ -898,7 +898,7 @@ weechat::key_bind('mouse', +{
map { $_ => 'hsignal:'.SCRIPT_NAME } map { $_ => 'hsignal:'.SCRIPT_NAME }
'@chat:button1*', '@chat:button1-event-*', '@chat(perl.[*):button1' '@chat:button1*', '@chat:button1-event-*', '@chat(perl.[*):button1'
}); });
weechat::command('', '/alias copywin '.CMD_COPYWIN) weechat::command('', '/alias add copywin '.CMD_COPYWIN)
if 'copywin' ne CMD_COPYWIN && !Nlib::i2h('alias', '', 'copywin') && Nlib::i2h('hook', '', 'command,alias'); if 'copywin' ne CMD_COPYWIN && !Nlib::i2h('alias', '', 'copywin') && Nlib::i2h('hook', '', 'command,alias');
# downloaded line fields # downloaded line fields
......
use strict;
use Encode qw(encode_utf8);
weechat::register(
'ctrl_w',
'Juerd <#####@juerd.nl>',
'1.00',
'PD',
'Implement readline-like ^W',
'',
''
);
sub ctrl_w {
my ($data, $buffer, $args) = @_;
my $pos = weechat::buffer_get_integer($buffer, 'input_pos');
my $input = weechat::buffer_get_string($buffer, 'input');
utf8::decode($input);
substr($input, 0, $pos) =~ s/(\S+\s*)\z// and $pos -= length $1;
utf8::encode($input);
weechat::buffer_set($buffer, "input", $input);
weechat::buffer_set($buffer, "input_pos", $pos);
return weechat::WEECHAT_RC_OK;
}
weechat::hook_command("ctrl_w", "Delete previous word like readline ^W", "", "", "", "ctrl_w", "");
# Print helpful message if ctrl-W is still bound to the default function.
my $i = weechat::infolist_get("key", "", "default");
weechat::infolist_reset_item_cursor($i);
while (weechat::infolist_next($i)) {
my $k = weechat::infolist_string($i, "key");
my $c = weechat::infolist_string($i, "command");
$k =~ m[^ctrl-w$]i or next;
$c =~ m[^/input delete_previous_word]i or next;
weechat::print("", "$k is still bound to $c; to use the ctrl_w script, use /key bind $k /ctrl_w");
last;
}
# echo.pl by ArZa <arza@arza.us>: Print a line and additionally set activity level
# This program is free software: you can modify/redistribute it under the terms of
# GNU General Public License by Free Software Foundation, either version 3 or later
# which you can get from <http://www.gnu.org/licenses/>.
# This program is distributed in the hope that it will be useful, but without any warranty.
weechat::register("echo", "ArZa <arza\@arza.us>", "0.1", "GPL3", "Print a line and additionally set activity level", "", "");
weechat::hook_command(
"echo",
"Print a line and additionally set activity level. Local variables are expanded when starting with \$ and can be escaped with \\.",
"[ -p/-plugin <plugin> ] [ -b/-buffer <buffer name/number> | -c/-core ] [ -l/-level <level>] [text]",
"-plugin: plugin where printed, default: current plugin
-buffer: buffer where printed, default: current buffer, e.g. #weechat or freenode.#weechat)
-core: print to the core buffer
-level: number of the activity level, default: low:
0=low, 1=message, 2=private, 3=highlight
Examples:
/echo This is a test message
/echo -b freenode.#weechat -level 3 Highlight!
/echo -core This goes to the core buffer
/echo -buffer #weechat -l 1 My variable \\\$name is \$name on \$channel",
"-buffer %(buffer_names) || -core || -level 1|2|3 || -plugin %(plugins_names)", "echo", ""
);
sub echo {
my @args=split(/ /, $_[2]);
my $i=0;
my ($plugin, $buffer, $level) = ("", "", "");
while($i<=$#args){ # go through command options
if($args[$i] eq "-b" || $args[$i] eq "-buffer"){
$i++;
$buffer=$args[$i] if $args[$i];
}elsif($args[$i] eq "-p" || $args[$i] eq "-plugin"){
$i++;
$plugin=$args[$i] if $args[$i];
}elsif($args[$i] eq "-c" || $args[$i] eq "-core"){
$buffer=weechat::buffer_search_main();
}elsif($args[$i] eq "-l" || $args[$i] eq "-level"){
$i++;
$level=$args[$i] if $args[$i];
}else{
last;
}
$i++;
}
if($plugin ne ""){ # use specific plugin if set
$buffer=weechat::buffer_search($plugin, $buffer);
}elsif($buffer ne ""){
if($buffer=~/^\d+$/){ # if got a number
my $infolist = weechat::infolist_get("buffer", "", "");
while(weechat::infolist_next($infolist)){ # find the buffer for the number
if(weechat::infolist_integer($infolist, "number") eq $buffer){
$buffer=weechat::buffer_search( weechat::infolist_string($infolist, "plugin"), weechat::infolist_string($infolist, "name") );
last;
}
}
weechat::infolist_free($infolist);
}elsif( weechat::buffer_search ( weechat::buffer_get_string( weechat::current_buffer(), "plugin" ), $buffer ) ){ # if buffer found in current plugin
$buffer=weechat::buffer_search ( weechat::buffer_get_string( weechat::current_buffer(), "plugin" ), $buffer );
}else{ # search even more to find the correct buffer
my $infolist = weechat::infolist_get("buffer", "", "");
while(weechat::infolist_next($infolist)){ # find the buffer for a short_name
if(lc(weechat::infolist_string($infolist, "short_name")) eq lc($buffer)){
$buffer=weechat::buffer_search( weechat::infolist_string($infolist, "plugin"), weechat::infolist_string($infolist, "name") );
last;
}
}
weechat::infolist_free($infolist);
}
}
$buffer=weechat::current_buffer() if $buffer eq "" || $buffer eq $args[$i-1]; # otherwise use the current buffer
my $j=$i;
$args[$j]=~s/^\\\-/-/ if $args[$j]; # "\-" -> "-" in the beginning
while($j<=$#args){ # go through text
if($args[$j]=~/^\$/){ # replace variables
$args[$j]=weechat::buffer_string_replace_local_var($buffer, $args[$j]);
}elsif($args[$j]=~/^\\[\$\\]/){ # escape variables
$args[$j]=~s/^\\//;
}
$j++;
}
weechat::print($buffer, join(' ', @args[$i..$#args])); # print the text
weechat::buffer_set($buffer, "hotlist", $level); # set hotlist level
}
use strict;
use Encode qw(encode_utf8);
weechat::register(
'foo',
'Juerd <#####@juerd.nl>',
'3.00',
'PD',
'Rot n+i encryption and decryption',
'',
''
);
# This is a port of the irssi script foo.pl that has existed since 2001.
# It was originally written as a simple scripting example, but is still
# sometimes used for fun.
# Didn't port the non-ascii stuff to weechat, because it assumes Windows-1252
# or latin1, which nobody uses anymore. Some UTF-8 thing would be better.
#my $char1 = "\xC0-\xCF\xD2-\xD6\xD8-\xDD";
#my $char2 = "\xE0-\xF6\xF8-\xFF";
sub rot {
my ($dir, $rotABC, $rot123, $rotshift, $msg) = @_;
my $i = 0;
for (0 .. length $msg) {
my $char = \substr $msg, $_, 1;
$i += $rotshift;
$$char =~ tr/a-zA-Z/b-zaB-ZA/ for 1..abs $dir *26 - ($rotABC + $i) % 26;
$$char =~ tr/0-9/1-90/ for 1..abs $dir *10 - ($rot123 + $i) % 10;
}
return $msg;
}
# weechat encodes ^O, ^B, and ^_ differently.
my $O = "\x1c";
my $B = "(?:[\x1a\x1b]\x01)"; # \x1a is on, \x1b is off.
my $U = "(?:[\x1a\x1b]\x04)";
sub hook_print_cb {
my ($data, $buffer, $date, $tags, $displayed, $highlight, $prefix, $msg) = @_;
return weechat::WEECHAT_RC_OK unless $msg =~ s/^$O($B+)$O($B+)$O($O*)//;
$msg = rot 1, length($1)/2, length($2)/2, length $3, $msg;
weechat::print_date_tags($buffer, $date, $tags, "$prefix\t\x1a\x01$msg");
return weechat::WEECHAT_RC_OK;
}
sub hook_cmd_rot_cb {
my ($data, $buffer, $args) = @_;
my $rotABC = 1 + int rand 13;
my $rot123 = 1 + 2 * int rand 4;
my $rotshift = 1 + int rand 10;
weechat::command(
$buffer,
encode_utf8(sprintf "/say \cO%s\cO%s\cO%s%s",
"\cB" x $rotABC,
"\cB" x $rot123,
"\cO" x $rotshift,
rot 0, $rotABC, $rot123, $rotshift, $args
)
);
}
# Yuck, symbolic references to subs instead of actual CODE refs...
weechat::hook_print("", "notify_none,notify_message,notify_private,notify_highlight", "", 0, "hook_print_cb", "");
weechat::hook_command("rot", "Sends via UeberRot", "", "", "", "hook_cmd_rot_cb", "");
This diff is collapsed.
# jump_smart_higher.pl for WeeChat by arza <arza@arza.us>, distributed freely and without any warranty, licensed under GPL3 <http://www.gnu.org/licenses/gpl.html> # jump_smart_closest.pl for WeeChat by arza <arza@arza.us>, distributed freely and without any warranty, licensed under GPL3 <http://www.gnu.org/licenses/gpl.html>
# Jump to a higher buffer with activity, similar to /input smart_jump (alt-a) but jump to a buffer with higher number if possible # Jump to the numerically closest buffer with the highest activity, similar to /input jump_smart (alt-a) but jump to the buffer that has the highest activity level and is next/previous buffer by number regardless of weechat.look.hotlist_sort
# Changelog: # Changelog:
# 2013-10-22 0.1 initial release # 2013-10-22 0.1 initial release
# 2014-10-23 0.2 don't try to change to current buffer # 2014-10-23 0.2 don't try to change to current buffer
# 2018-07-07 0.3 reverse direction jumping, new commands /jump_smart_previous and /jump_smart_next, renamed from jump_smart_higher.pl to jump_smart_closest.pl
weechat::register('jump_smart_higher', 'arza <arza@arza.us>', '0.2', 'GPL3', 'Jump to a higher buffer with activity', '', ''); weechat::register('jump_smart_closest', 'arza <arza@arza.us>', '0.3', 'GPL3', 'Jump to next/previous buffer with highest activity', '', '');
weechat::hook_command('jump_smart_higher', 'Jump to a higher buffer with activity', '',
weechat::hook_command('jump_smart_higher', 'See jump_smart_next and jump_smart_previous', '', '', '', 'command_next', ''); # compatibility
weechat::hook_command('jump_smart_previous', 'Jump to previous buffer with highest activity', '',
'Jump to the buffer that
1. has the highest activity level
2. is before current buffer if possible
3. has the highest number',
'', 'command_previous', '');
weechat::hook_command('jump_smart_next', 'Jump to next buffer with activity', '',
'Jump to the buffer that 'Jump to the buffer that
1. has the highest activity level 1. has the highest activity level
2. is after current buffer if possible 2. is after current buffer if possible
3. has the lowest number', 3. has the lowest number',
'', 'command', ''); '', 'command_next', '');
sub command_previous { my $buffer=$_[1];
my $max_priority = 0;
my $max_number = -1000000;
my $current_number = weechat::buffer_get_integer($buffer, 'number');
my $number = 0;
my $priority = 0;
my $infolist = weechat::infolist_get('hotlist', '', '');
while(weechat::infolist_next($infolist)){
$number = weechat::infolist_integer($infolist, 'buffer_number');
if($number == $current_number){ next; }
$priority = weechat::infolist_integer($infolist, 'priority');
if($priority > $max_priority){ $max_priority = $priority; $max_number = -1000000; }
elsif($priority < $max_priority){ next; }
if($number > $current_number){ $number -= 10000; }
if($number > $max_number){ $max_number = $number; }
}
weechat::infolist_free($infolist);
weechat::command($buffer, "/buffer " . $max_number % 10000);
}
sub command { my $buffer=$_[1]; sub command_next { my $buffer=$_[1];
my $max_priority = 0; my $max_priority = 0;
my $min_number = 1000000; my $min_number = 1000000;
my $current_number = weechat::buffer_get_integer($buffer, 'number'); my $current_number = weechat::buffer_get_integer($buffer, 'number');
......
This diff is collapsed.
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# #
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Copyright (c) 2009-2014 by rettub <rettub@gmx.net> # Copyright (c) 2009-2014 by rettub <rettub@gmx.net>
# Copyright (c) 2011-2017 by nils_2 <weechatter@arcor.de> # Copyright (c) 2011-2018 by nils_2 <weechatter@arcor.de>
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# #
# Simple IRC query blocker. # Simple IRC query blocker.
# - requires WeeChat 0.3.2 or newer # - requires WeeChat 0.4.2 or newer
# - suggests perl script newsbar # - suggests perl script newsbar
# #
# Got inspiration from (xchat script): # Got inspiration from (xchat script):
...@@ -38,13 +38,20 @@ ...@@ -38,13 +38,20 @@
# #
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# History: # History:
# 2018-07-30, usefulz & nils_2:
# version 1.2:
# FIX: undefine subroutine
# ADD: eval_expression() for options
# FIX: Warnung: Use of uninitialized value using highmon as a bar
# FIX: Warnung: Use of uninitialized value using newsbar
#
# 2017-04-14, nils_2: # 2017-04-14, nils_2:
# version 1.1: # version 1.1:
# ADD: function to ignore server (https://github.com/weechat/scripts/issues/79) # ADD: function to ignore server (https://github.com/weechat/scripts/issues/79)
# #
# 2016-12-11, mumixam: # 2016-12-11, mumixam:
# version 1.0: # version 1.0:
# FIX: message starting with color not caught # FIX: message starting with color not caught
# #
# 2014-05-22, nils_2: # 2014-05-22, nils_2:
# version 0.9: # version 0.9:
...@@ -106,7 +113,7 @@ use strict; ...@@ -106,7 +113,7 @@ use strict;
my $SCRIPT = 'query_blocker'; my $SCRIPT = 'query_blocker';
my $AUTHOR = 'rettub <rettub@gmx.net>'; my $AUTHOR = 'rettub <rettub@gmx.net>';
my $VERSION = '1.1'; my $VERSION = '1.2';
my $LICENSE = 'GPL3'; my $LICENSE = 'GPL3';
my $DESCRIPTION = 'Simple blocker for private message (i.e. spam)'; my $DESCRIPTION = 'Simple blocker for private message (i.e. spam)';
my $COMMAND = "query_blocker"; # new command name my $COMMAND = "query_blocker"; # new command name
...@@ -118,11 +125,11 @@ my %help_desc = ( "block_queries" => "to enable or disable $COMMAND (defau ...@@ -118,11 +125,11 @@ my %help_desc = ( "block_queries" => "to enable or disable $COMMAND (defau
"show_nick_only" => "only show nick and server. (default: 'off')", "show_nick_only" => "only show nick and server. (default: 'off')",
"show_first_message_only"=> "Show only first message sent by blocked queries (default: 'on')", "show_first_message_only"=> "Show only first message sent by blocked queries (default: 'on')",
"whitelist" => "path/file-name to store/read nicks not to be blocked (default: qb-whitelist.txt)", "whitelist" => "path/file-name to store/read nicks not to be blocked (default: qb-whitelist.txt)",
"auto_message" => "messages to inform user that you don't like to get private messages without asking first. '%N' will be replaced with users nick.", "auto_message" => "messages to inform user that you don't like to get private messages without asking first. '%N' will be replaced with users nick (note: content is evaluated, see /help eval).",
"auto_message_prefix" => "Prefix for auto message, may not be empty!", "auto_message_prefix" => "Prefix for auto message, may not be empty! (note: content is evaluated, see /help eval)",
"msgbuffer" => "buffer used to display $SCRIPT messages (current = current buffer, private = private buffer, weechat = weechat core buffer, server = server buffer, buffer = $SCRIPT buffer, highmon = highmon buffer)", "msgbuffer" => "buffer used to display $SCRIPT messages (current = current buffer, private = private buffer, weechat = weechat core buffer, server = server buffer, buffer = $SCRIPT buffer, highmon = highmon buffer, newsbar = newsbar-bar)",
"logger" => "logger status for $SCRIPT buffer (default: 'off')", "logger" => "logger status for $SCRIPT buffer (default: 'off')",
"hotlist_show" => "$SCRIPT buffer appear in hotlists (status bar/buffer.pl) (default: 'off')", "hotlist_show" => "$SCRIPT buffer appear in hotlists (status bar/buflist) (default: 'off')",
"open_on_startup" => "open $SCRIPT buffer on startup. option msgbuffer has to be set to 'buffer' (default: 'off')", "open_on_startup" => "open $SCRIPT buffer on startup. option msgbuffer has to be set to 'buffer' (default: 'off')",
"temporary_mode" => "if 'on' you have to manually add a nick to whitelist. otherwise a conversation will be temporary only and after closing query buffer the nick will be discard (default: 'off')", "temporary_mode" => "if 'on' you have to manually add a nick to whitelist. otherwise a conversation will be temporary only and after closing query buffer the nick will be discard (default: 'off')",
"ignore_auto_message" => "path/file-name to store/read nicks to not send an auto message (default: qb-ignore_auto_message.txt)", "ignore_auto_message" => "path/file-name to store/read nicks to not send an auto message (default: qb-ignore_auto_message.txt)",
...@@ -299,6 +306,7 @@ sub print_info { ...@@ -299,6 +306,7 @@ sub print_info {
my ( $buffer, $server, $my_nick, $nick, $message ) = @_; my ( $buffer, $server, $my_nick, $nick, $message ) = @_;
my $prefix_network = weechat::config_string( weechat::config_get("weechat.look.prefix_network")); my $prefix_network = weechat::config_string( weechat::config_get("weechat.look.prefix_network"));
my $buf_pointer = ""; my $buf_pointer = "";
my $bar_pointer = "";
my $orig_message = $message; my $orig_message = $message;
if ( $buffer eq "current" ){ if ( $buffer eq "current" ){
...@@ -320,11 +328,11 @@ sub print_info { ...@@ -320,11 +328,11 @@ sub print_info {
} }
# no buffer found, use weechat fallback buffer # no buffer found, use weechat fallback buffer
if ( $buf_pointer eq "" ){ if ( $buf_pointer eq "" or not defined $buf_pointer ){
if ( $server eq "" ){ if ( $server eq "" ){
$buf_pointer = weechat::buffer_search_main(); $buf_pointer = weechat::buffer_search_main();
}else{ }else{
$buf_pointer = fallback($server); $buf_pointer = fallback_buffer($server);
} }
} }
return $buf_pointer if (lc(weechat::config_get_plugin('quiet') eq "on")); return $buf_pointer if (lc(weechat::config_get_plugin('quiet') eq "on"));
...@@ -334,7 +342,6 @@ sub print_info { ...@@ -334,7 +342,6 @@ sub print_info {
}else{ }else{
$message = ""; $message = "";
} }
unless ( exists $Blocked{$server.".".$nick} and lc(weechat::config_get_plugin('show_first_message_only') eq 'off') ) { unless ( exists $Blocked{$server.".".$nick} and lc(weechat::config_get_plugin('show_first_message_only') eq 'off') ) {
weechat::print($buf_pointer,"$prefix_network\t" weechat::print($buf_pointer,"$prefix_network\t"
.irc_nick_find_color($nick).$nick .irc_nick_find_color($nick).$nick
...@@ -365,17 +372,18 @@ sub print_info { ...@@ -365,17 +372,18 @@ sub print_info {
return $buf_pointer; return $buf_pointer;
} }
sub eval_expression{
my ($string) = @_;
return weechat::string_eval_expression($string, {}, {},{});
}
# get value from msgbuffer_fallback option
sub fallback_buffer{ sub fallback_buffer{
my $server = @_; my ($server) = @_;
my $fallback = weechat::config_string( weechat::config_get("irc.look.msgbuffer_fallback") ); my $fallback = weechat::config_string( weechat::config_get("irc.look.msgbuffer_fallback") );
my $buf_pointer; my $buf_pointer;
if ( $fallback eq "current" ) $buf_pointer = weechat::current_buffer() if ( $fallback eq "current" );
{ $buf_pointer = weechat::buffer_search("irc","server".".".$server) if ( $fallback eq "server" );
my $buf_pointer = weechat::current_buffer();
}elsif ( $fallback eq "server" )
{
$buf_pointer = weechat::buffer_search("irc","server".".".$server);
}
return $buf_pointer; return $buf_pointer;
} }
...@@ -431,19 +439,35 @@ sub modifier_irc_in_privmsg { ...@@ -431,19 +439,35 @@ sub modifier_irc_in_privmsg {
# auto responce msg to query_nick (deny_message) # auto responce msg to query_nick (deny_message)
my $msg = weechat::config_get_plugin('auto_message_prefix') . weechat::config_get_plugin('auto_message'); my $msg = weechat::config_get_plugin('auto_message_prefix') . weechat::config_get_plugin('auto_message');
$msg =~ s/%N/$query_nick/g; # keep this for historical reasons
$msg = eval_expression($msg);
$msg =~ s/%N/$query_nick/g;
if (lc(weechat::config_get_plugin('show_deny_message')) eq 'off' or lc(weechat::config_get_plugin('quiet') eq 'on')) if (lc(weechat::config_get_plugin('show_deny_message')) eq 'off' or lc(weechat::config_get_plugin('quiet') eq 'on'))
{ {
# According to the RFC 1459, automatic messages must not be sent as response to NOTICEs and currently it might be possible to get in loop of automatic away messages or something similar. # According to the RFC 1459, automatic messages must not be sent as response to NOTICEs and currently it might be possible to get in loop of automatic away messages or something similar.
# weechat::command( '', "/mute -all /msg -server $server $query_nick $msg " ); # weechat::command( '', "/mute -all /msg -server $server $query_nick $msg " );
weechat::command( '', "/mute -all /notice -server $server $query_nick $msg " ); weechat::command( '', "/mute -all /notice -server $server $query_nick $msg " );
} }
else else # show deny message!
{ {
# weechat::command( '', "/mute -all /msg -server $server $query_nick $msg " ); # weechat::command( '', "/mute -all /msg -server $server $query_nick $msg " );
weechat::command( '', "/mute -all /notice -server $server $query_nick $msg " ); weechat::command( '', "/mute -all /notice -server $server $query_nick $msg " );
weechat::print($buf_pointer,"$SCRIPT\t"."$query_nick"."@"."$server: $msg"); if ( newsbar() eq "1" and lc(weechat::config_get_plugin('msgbuffer')) eq 'newsbar' ) {
weechat::command( '',
"/newsbar add --color lightred [QUERY-WARN]\t" # $color $category
. irc_nick_find_color($query_nick)
. $query_nick
. weechat::color('reset') . '@'
. irc_nick_find_color($server)
. $server
. weechat::color('reset')
. ": "
. weechat::color('bold')
. "$msg");
}
else {
weechat::print($buf_pointer,"$SCRIPT\t"."$query_nick"."@"."$server: $msg");
}
} }
# counter for how many blocked messages # counter for how many blocked messages
$Blocked{$server.".".$query_nick} = 0; $Blocked{$server.".".$query_nick} = 0;
...@@ -716,6 +740,7 @@ sub qb_msg { ...@@ -716,6 +740,7 @@ sub qb_msg {
return weechat::WEECHAT_RC_OK if ($server eq ""); return weechat::WEECHAT_RC_OK if ($server eq "");
my ($msg) = $command =~ /^\/msg -server .*?\s.*?\s(.*)/; my ($msg) = $command =~ /^\/msg -server .*?\s.*?\s(.*)/;
return weechat::WEECHAT_RC_OK if (not defined $msg);
my $n = _get_nick($_[2]); my $n = _get_nick($_[2]);
return weechat::WEECHAT_RC_OK if (lc($n) eq "nickserv" or lc($n) eq "chanserv"); return weechat::WEECHAT_RC_OK if (lc($n) eq "nickserv" or lc($n) eq "chanserv");
my $prefix = weechat::config_get_plugin('auto_message_prefix'); my $prefix = weechat::config_get_plugin('auto_message_prefix');
...@@ -771,8 +796,8 @@ sub buffer_closing_cb ...@@ -771,8 +796,8 @@ sub buffer_closing_cb
if ( weechat::register( $SCRIPT, $AUTHOR, $VERSION, $LICENSE, $DESCRIPTION, "", "" ) ) { if ( weechat::register( $SCRIPT, $AUTHOR, $VERSION, $LICENSE, $DESCRIPTION, "", "" ) ) {
weechat::hook_command( $COMMAND, $DESCRIPTION, $ARGS_HELP, $CMD_HELP, $COMPLETITION, $CALLBACK, "" ); weechat::hook_command( $COMMAND, $DESCRIPTION, $ARGS_HELP, $CMD_HELP, $COMPLETITION, $CALLBACK, "" );
$weechat_version = weechat::info_get("version_number", ""); $weechat_version = weechat::info_get("version_number", "");
if ( ($weechat_version ne "") && (weechat::info_get("version_number", "") < 0x00030200) ) { if ( ($weechat_version ne "") && (weechat::info_get("version_number", "") < 0x00040200) ) {
weechat::print("",weechat::prefix("error")."$SCRIPT: needs WeeChat >= 0.3.2. Please upgrade: http://www.weechat.org/"); weechat::print("",weechat::prefix("error")."$SCRIPT: needs WeeChat >= 0.4.2. Please upgrade: http://www.weechat.org/");
weechat::command("","/wait 1ms /perl unload $SCRIPT"); weechat::command("","/wait 1ms /perl unload $SCRIPT");
} }
......
# #
# Copyright (c) 2013-2014 by Nils Görs <weechatter@arcor.de> # Copyright (c) 2013-2018 by Nils Görs <weechatter@arcor.de>
# Copyright (c) 2013-2014 by Stefan Wold <ratler@stderr.eu> # Copyright (c) 2013-2014 by Stefan Wold <ratler@stderr.eu>
# based on irssi script stalker.pl from Kaitlyn Parkhurst (SymKat) <symkat@symkat.com> # based on irssi script stalker.pl from Kaitlyn Parkhurst (SymKat) <symkat@symkat.com>
# https://github.com/symkat/Stalker # https://github.com/symkat/Stalker
...@@ -20,6 +20,13 @@ ...@@ -20,6 +20,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
# History: # History:
# version 1.6.1:nils_2@freenode.#weechat
# 2018-01-11: fix: wrong variable name
#
# version 1.6:nils_2@freenode.#weechat
# 2018-01-09: add: use hook_process_hashtable() for /WHOIS
# : imp: use hook_process_hashtable() instead hook_process() for security reasons
#
# version 1.5:nils_2@freenode.#weechat # version 1.5:nils_2@freenode.#weechat
# 2015-06-15: add: new option del_date # 2015-06-15: add: new option del_date
# #
...@@ -101,7 +108,7 @@ use File::Spec; ...@@ -101,7 +108,7 @@ use File::Spec;
use DBI; use DBI;
my $SCRIPT_NAME = "stalker"; my $SCRIPT_NAME = "stalker";
my $SCRIPT_VERSION = "1.5"; my $SCRIPT_VERSION = "1.6.1";
my $SCRIPT_AUTHOR = "Nils Görs <weechatter\@arcor.de>"; my $SCRIPT_AUTHOR = "Nils Görs <weechatter\@arcor.de>";
my $SCRIPT_LICENCE = "GPL3"; my $SCRIPT_LICENCE = "GPL3";
my $SCRIPT_DESC = "Records and correlates nick!user\@host information"; my $SCRIPT_DESC = "Records and correlates nick!user\@host information";
...@@ -148,7 +155,7 @@ my %desc_options = ('db_name' => 'file containing the SQLite database ...@@ -148,7 +155,7 @@ my %desc_options = ('db_name' => 'file containing the SQLite database
'ignore_whois' => 'When enabled, /WHOIS won\'t be monitored. (default: off)', 'ignore_whois' => 'When enabled, /WHOIS won\'t be monitored. (default: off)',
'tags' => 'comma separated list of tags used for messages printed by stalker. See documentation for possible tags (e.g. \'no_log\', \'no_highlight\'). This option does not effect DEBUG messages.', 'tags' => 'comma separated list of tags used for messages printed by stalker. See documentation for possible tags (e.g. \'no_log\', \'no_highlight\'). This option does not effect DEBUG messages.',
'additional_join_info' => 'add a line below the JOIN message that will display alternative nicks (tags: "irc_join", "irc_smart_filter" will be add to additional_join_info). You can use a localvar to drop additional join info for specific buffer(s) "stalker_drop_additional_join_info" (default: off)', 'additional_join_info' => 'add a line below the JOIN message that will display alternative nicks (tags: "irc_join", "irc_smart_filter" will be add to additional_join_info). You can use a localvar to drop additional join info for specific buffer(s) "stalker_drop_additional_join_info" (default: off)',
'timeout' => 'timeout in seconds for hook_process(), used with option "additional_join_info". On slower machines, like raspberry pi, increase time. (default: 1)', 'timeout' => 'timeout in seconds for hook_process_hashtable(), used with option "additional_join_info". On slower machines, like raspberry pi, increase time. (default: 1)',
'flood_timer' => 'Time in seconds for which flood protection is active. Once max_nicks is reached, joins will be ignored for the remaining duration of the timer. (default:10)', 'flood_timer' => 'Time in seconds for which flood protection is active. Once max_nicks is reached, joins will be ignored for the remaining duration of the timer. (default:10)',
'flood_max_nicks' => 'Maximum number of joins to allow in flood_timer length of time. Once maximum number of joins is reached, joins will be ignored until the timer ends (default:20)', 'flood_max_nicks' => 'Maximum number of joins to allow in flood_timer length of time. Once maximum number of joins is reached, joins will be ignored until the timer ends (default:20)',
); );
...@@ -181,7 +188,7 @@ my %indices = ( ...@@ -181,7 +188,7 @@ my %indices = (
], ],
); );
# ---------------[ external routines for hook_process() ]--------------------- # ---------------[ external routines for hook_process_hashtable() ]---------------------
if ($#ARGV == 8 ) # (0-8) nine arguments given? if ($#ARGV == 8 ) # (0-8) nine arguments given?
{ {
my $db_filename = $ARGV[0]; my $db_filename = $ARGV[0];
...@@ -515,7 +522,7 @@ sub add_record ...@@ -515,7 +522,7 @@ sub add_record
my ( $nick, $user, $host, $serv ) = @_; my ( $nick, $user, $host, $serv ) = @_;
return unless ($nick and $user and $host and $serv); return unless ($nick and $user and $host and $serv);
# Check if we already have this record, before using a hook_process() # Check if we already have this record, before using a hook_process_hashtable()
my $sth = $DBH_child->prepare( "SELECT nick FROM records WHERE nick = ? AND user = ? AND host = ? AND serv = ?" ); my $sth = $DBH_child->prepare( "SELECT nick FROM records WHERE nick = ? AND user = ? AND host = ? AND serv = ?" );
$sth->execute( $nick, $user, $host, $serv ); $sth->execute( $nick, $user, $host, $serv );
my $result = $sth->fetchrow_hashref; my $result = $sth->fetchrow_hashref;
...@@ -533,7 +540,22 @@ sub add_record ...@@ -533,7 +540,22 @@ sub add_record
my $db_filename = weechat_dir(); my $db_filename = weechat_dir();
DEBUG("info", "Start hook_process(), to add $nick $user\@$host on $serv to database"); DEBUG("info", "Start hook_process(), to add $nick $user\@$host on $serv to database");
weechat::hook_process("perl $filename $db_filename 'db_add_record' '$nick' '$user' '$host' '$serv' 'dummy' 'dummy' 'dummy'", 1000 * $options{'timeout'},"db_add_record_cb","");
weechat::hook_process_hashtable("perl",
{
"arg1" => $filename,
"arg2" => $db_filename,
"arg3" => 'db_add_record',
"arg4" => $nick,
"arg5" => $user,
"arg6" => $host,
"arg7" => $serv,
"arg8" => 'dummy',
"arg9" => 'dummy',
"arg10" => 'dummy',
}, 1000 * $options{'timeout'},"db_add_record_cb","");
} }
# function called when data from child is available, or when child has ended, arguments and return value # function called when data from child is available, or when child has ended, arguments and return value
...@@ -1102,7 +1124,6 @@ sub irc_in2_whois_cb ...@@ -1102,7 +1124,6 @@ sub irc_in2_whois_cb
my (undef, undef, undef, $nick, $user, $host, undef) = split(' ', $callback_data); my (undef, undef, undef, $nick, $user, $host, undef) = split(' ', $callback_data);
my $msgbuffer_whois = weechat::config_string(weechat::config_get('irc.msgbuffer.whois')); my $msgbuffer_whois = weechat::config_string(weechat::config_get('irc.msgbuffer.whois'));
DEBUG('info', 'weechat_hook_signal(): WHOIS'); DEBUG('info', 'weechat_hook_signal(): WHOIS');
# check for nick_regex # check for nick_regex
...@@ -1144,11 +1165,32 @@ sub irc_in2_whois_cb ...@@ -1144,11 +1165,32 @@ sub irc_in2_whois_cb
} }
my $use_regex = 0; my $use_regex = 0;
my $nicks_found = join( ", ", (get_nick_records('yes', 'nick', $nick, $server, $use_regex))); my $filename = get_script_filename();
# my $nicks_found = join( ", ", (get_nick_records('no', 'nick', $nick, $server, $use_regex))); return weechat::WEECHAT_RC_OK if ($filename eq "");
my $db_filename = weechat_dir();
my $name = weechat::buffer_get_string($ptr_buffer,'localvar_name');
DEBUG("info", "Start hook_process(), get additional for WHOIS() info from $nick with $user\@$host on $name");
weechat::hook_process_hashtable("perl",
{
"arg1" => $filename,
"arg2" => $db_filename,
"arg3" => 'additional_join_info',
"arg4" => $nick,
"arg5" => $user,
"arg6" => $host,
"arg7" => $server,
"arg8" => $options{'max_recursion'},
"arg9" => $options{'ignore_guest_nicks'},
"arg10" => $options{'guest_nick_regex'},
}, 1000 * $options{'timeout'},"hook_process_get_nicks_records_cb","$nick $ptr_buffer 'dummy'");
# my $nicks_found = join( ", ", (get_nick_records('yes', 'nick', $nick, $server, $use_regex)));
return weechat::WEECHAT_RC_OK;
# only the given nick is returned? # only the given nick is returned?
return weechat::WEECHAT_RC_OK if ($nicks_found eq $nick or $nicks_found eq ""); # return weechat::WEECHAT_RC_OK if ($nicks_found eq $nick or $nicks_found eq "");
# more than one nick was returned from sqlite # more than one nick was returned from sqlite
my $prefix_network = weechat::prefix('network'); my $prefix_network = weechat::prefix('network');
...@@ -1259,7 +1301,21 @@ sub irc_in2_join_cb ...@@ -1259,7 +1301,21 @@ sub irc_in2_join_cb
my $db_filename = weechat_dir(); my $db_filename = weechat_dir();
DEBUG("info", "Start hook_process(), get additional info from $nick with $user\@$host on $name"); DEBUG("info", "Start hook_process(), get additional info from $nick with $user\@$host on $name");
weechat::hook_process("perl $filename $db_filename 'additional_join_info' '$nick' '$user' '$host' '$server' $options{'max_recursion'} $options{'ignore_guest_nicks'} '$options{'guest_nick_regex'}'", 1000 * $options{'timeout'},"hook_process_get_nicks_records_cb","$nick $buffer $my_tags");
weechat::hook_process_hashtable("perl",
{
"arg1" => $filename,
"arg2" => $db_filename,
"arg3" => 'additional_join_info',
"arg4" => $nick,
"arg5" => $user,
"arg6" => $host,
"arg7" => $server,
"arg8" => $options{'max_recursion'},
"arg9" => $options{'ignore_guest_nicks'},
"arg10" => $options{'guest_nick_regex'},
}, 1000 * $options{'timeout'},"hook_process_get_nicks_records_cb","$nick $buffer $my_tags");
} }
return weechat::WEECHAT_RC_OK; return weechat::WEECHAT_RC_OK;
} }
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
# #
# History: # History:
# #
# 2018-05-14, CrazyCat <crazycat@c-p-f.org>
# version 1.2 : added check for no swap
# 2009-10-13, wishbone <djwishbone@gmail.com> # 2009-10-13, wishbone <djwishbone@gmail.com>
# version 1: initial release # version 1: initial release
# #
...@@ -64,7 +66,7 @@ ...@@ -64,7 +66,7 @@
use strict; use strict;
my $VERSION = "1.0"; my $VERSION = "1.2";
weechat::register("stats_bar","wishbone",$VERSION,"GPL3","statistics bar", "", ""); weechat::register("stats_bar","wishbone",$VERSION,"GPL3","statistics bar", "", "");
my ($refresh,$old_refresh) = (10,0); my ($refresh,$old_refresh) = (10,0);
...@@ -75,6 +77,7 @@ my %stats_data =( ...@@ -75,6 +77,7 @@ my %stats_data =(
inf_stats => "0", inf_stats => "0",
load_stats => "0", load_stats => "0",
mem_stats => "0", mem_stats => "0",
temp_stats => "0",
); );
my $stats_interface = ""; my $stats_interface = "";
...@@ -101,9 +104,9 @@ if (!weechat::config_is_set_plugin('stats_interface')) { ...@@ -101,9 +104,9 @@ if (!weechat::config_is_set_plugin('stats_interface')) {
weechat::bar_item_new('inf_stats','stats_cb',"inf_stats"); weechat::bar_item_new('inf_stats','stats_cb',"inf_stats");
weechat::bar_item_new('load_stats','stats_cb',"load_stats"); weechat::bar_item_new('load_stats','stats_cb',"load_stats");
weechat::bar_item_new('mem_stats','stats_cb',"mem_stats"); weechat::bar_item_new('mem_stats','stats_cb',"mem_stats");
weechat::bar_item_new('temp_stats','stats_cb',"temp_stats");
refresh_stats_cb(); refresh_stats_cb();
$refresh_hook = weechat::hook_timer($refresh*1000, 0,0,'refresh_stats_cb', ""); $refresh_hook = weechat::hook_timer($refresh*1000, 0,0,'refresh_stats_cb', "");
$config_hook1 = weechat::hook_config("plugins.var.perl.stats_bar.*","read_settings","");
...@@ -123,11 +126,10 @@ sub stats_cb { ...@@ -123,11 +126,10 @@ sub stats_cb {
} }
sub refresh_stats_cb { sub refresh_stats_cb {
# get_inf_stats();
# get_load_stats();
weechat::bar_item_update('inf_stats'); weechat::bar_item_update('inf_stats');
weechat::bar_item_update('load_stats'); weechat::bar_item_update('load_stats');
weechat::bar_item_update('mem_stats'); weechat::bar_item_update('mem_stats');
weechat::bar_item_update('temp_stats');
return weechat::WEECHAT_RC_OK; return weechat::WEECHAT_RC_OK;
} }
...@@ -190,7 +192,7 @@ sub get_inf_stats { ...@@ -190,7 +192,7 @@ sub get_inf_stats {
chomp @lines; chomp @lines;
@lines = grep(/^\s*($stats_interface)/,@lines); @lines = grep(/^\s*($stats_interface)/,@lines);
if (@lines) { if (@lines) {
if ($lines[0] !~ /^(\s*)(.*):(\d+)\s+\d+\s+\d+\s+\d+\s+\d+\s+\d+\s+\d+\s+\d+\s+(\d+)/) { if ($lines[0] !~ /^(\s*)(.*):\s*(\d+)\s+\d+\s+\d+\s+\d+\s+\d+\s+\d+\s+\d+\s+\d+\s+(\d+)/) {
} else { } else {
$last_in = $3; $last_in = $3;
$last_out = $4; $last_out = $4;
...@@ -227,7 +229,11 @@ sub get_mem_stats { ...@@ -227,7 +229,11 @@ sub get_mem_stats {
($swaptotal) = ($lines[2] =~ /^SwapTotal:\s+(\d+)/); ($swaptotal) = ($lines[2] =~ /^SwapTotal:\s+(\d+)/);
($swapfree) = ($lines[3] =~ /^SwapFree:\s+(\d+)/); ($swapfree) = ($lines[3] =~ /^SwapFree:\s+(\d+)/);
$mem_percentage = ($memfree/$memtotal)*100; $mem_percentage = ($memfree/$memtotal)*100;
$swap_percentage = ($swapfree/$swaptotal)*100; if ($swaptotal == 0) {
$swap_percentage = 0;
} else {
$swap_percentage = ($swapfree/$swaptotal)*100;
}
$stats_data{mem_stats} = sprintf("m:%.0f%% s:%.0f%%",$mem_percentage, $swap_percentage); $stats_data{mem_stats} = sprintf("m:%.0f%% s:%.0f%%",$mem_percentage, $swap_percentage);
} else { } else {
...@@ -238,4 +244,17 @@ sub get_mem_stats { ...@@ -238,4 +244,17 @@ sub get_mem_stats {
} }
} }
sub get_temp_stats {
my @lines = ();
my ($tempmil,$temp);
if (!open(DEV, "< /sys/class/thermal/thermal_zone0/temp")) {
weechat::print("", "Failed to open /sys/class/thermal/thermal_zone0/temp");
} else {
@lines = <DEV>;
close DEV;
chomp @lines;
($tempmil) = ($lines[0] =~ /(\d+)/);
$temp = ($tempmil)/1000;
$stats_data{temp_stats} = sprintf("CPU:%2.1lf°C", $temp);
}
}
# #
# Copyright (c) 2011-2013 by Nils Görs <weechatter@arcor.de> # Copyright (c) 2011-2018 by Nils Görs <weechatter@arcor.de>
# #
# unset script option(s) from not installed scripts # unset script option(s) from not installed scripts
# #
...@@ -17,10 +17,9 @@ ...@@ -17,10 +17,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
# #
# 18-04-18: 0.4: add support for php and javascript
# 14-10-04: 0.3: fixed: problem with unset options (reported by GermainZ) # 14-10-04: 0.3: fixed: problem with unset options (reported by GermainZ)
# # 13-07-27: 0.2: added: support for guile_script
# 13-07-27: 0.2 : added: support for guile_script
#
# 11-08-28: 0.1 # 11-08-28: 0.1
# #
# Development is currently hosted at # Development is currently hosted at
...@@ -29,19 +28,21 @@ ...@@ -29,19 +28,21 @@
use strict; use strict;
my $PRGNAME = "unset_unused"; my $PRGNAME = "unset_unused";
my $VERSION = "0.3"; my $VERSION = "0.4";
my $AUTHOR = "Nils Görs <weechatter\@arcor.de>"; my $AUTHOR = "Nils Görs <weechatter\@arcor.de>";
my $LICENCE = "GPL3"; my $LICENCE = "GPL3";
my $DESCR = "unset script option(s) from not installed scripts (YOU ARE USING THIS SCRIPT AT YOUR OWN RISK!)"; my $DESCR = "unset script option(s) from not installed scripts (YOU ARE USING THIS SCRIPT AT YOUR OWN RISK!)";
my $weechat_version = ""; my $weechat_version = "";
my @option_list; my @option_list;
my %script_plugins = ( my %script_plugins = (
"python" => "python_script", "python" => "python_script",
"perl" => "perl_script", "perl" => "perl_script",
"ruby" => "ruby_script", "ruby" => "ruby_script",
"tcl" => "tcl_script", "tcl" => "tcl_script",
"lua" => "lua_script", "lua" => "lua_script",
"guile" => "guile_script", "guile" => "guile_script",
"php" => "php_script",
"javascript" => "javascript_script",
); );
my $option_struct; my $option_struct;
...@@ -142,10 +143,11 @@ $weechat_version = weechat::info_get("version_number", ""); ...@@ -142,10 +143,11 @@ $weechat_version = weechat::info_get("version_number", "");
weechat::hook_command($PRGNAME, $DESCR, weechat::hook_command($PRGNAME, $DESCR,
"list || unset\n", "list || unset\n",
" list : list all unused script options\n". " list: list all script options from not installed scripts (run this command first!)\n".
" unset : reset config options (without warning!)\n\n". " unset: remove script options from not installed scripts (without warning!)\n\n".
"If \"plugins.desc.\" exists, it will be removed, too.\n". "If \"plugins.desc.\" exists, it will be removed, too.\n\n".
"save your settings with \"/save plugins\" or restore settings with \"/reload plugins\"". "save your settings with \"/save plugins\" or restore settings with \"/reload plugins\"\n".
"You can also use \"/unset -mask\", see /help unset".
"\n", "\n",
"list %-||". "list %-||".
"unset %-", "unset %-",
......
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
# History: # History:
# 2016-09-24: # 2016-09-24:
# v0.1: Initial release # v0.1: Initial release
# 2018-06-19:
# v0.2: py3k-ok
# #
# TODO: # TODO:
# - Colors support # - Colors support
...@@ -34,13 +36,13 @@ try: ...@@ -34,13 +36,13 @@ try:
from weechat import WEECHAT_RC_OK from weechat import WEECHAT_RC_OK
import_ok = True import_ok = True
except ImportError: except ImportError:
print "This script must be run under WeeChat." print("This script must be run under WeeChat.")
print "Get WeeChat now at: http://www.weechat.org/" print("Get WeeChat now at: http://www.weechat.org/")
import_ok = False import_ok = False
SCRIPT_NAME = "aformat" SCRIPT_NAME = "aformat"
SCRIPT_AUTHOR = "Hairo R. Carela <hairocr8@gmail.com>" SCRIPT_AUTHOR = "Hairo R. Carela <hairocr8@gmail.com>"
SCRIPT_VERSION = "0.1" SCRIPT_VERSION = "0.2"
SCRIPT_LICENSE = "WTFPL" SCRIPT_LICENSE = "WTFPL"
SCRIPT_DESC = ("Alternate way of text formatting, see /help for instructions") SCRIPT_DESC = ("Alternate way of text formatting, see /help for instructions")
...@@ -49,11 +51,6 @@ PY3 = sys.version > '3' ...@@ -49,11 +51,6 @@ PY3 = sys.version > '3'
class format: class format:
# Special byte sequences, using weechat.color("stuff") had some unwanted # Special byte sequences, using weechat.color("stuff") had some unwanted
# results, i'll look into it if needed. Colors are unused for now # results, i'll look into it if needed. Colors are unused for now
# PURPLE = '\x0306'
# BLUE = '\x0302'
# GREEN = '\x0303'
# YELLOW = '\x0308'
# RED = '\x0304'
BOLD = '\x02' BOLD = '\x02'
ITALIC = '\x1D' ITALIC = '\x1D'
UNDERLINE = '\x1F' UNDERLINE = '\x1F'
......
# -*- coding: utf-8 -*-
#
# Copyright (c) 2011-2013 by F. Besser <fbesser@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 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/>.
#
#
# History:
# 2013-09-01, nils_2@freenode.#weechat:
# version 0.2: add support of servername for "-exclude"
# : make script behave like /allchan and /allserver command
# : add function "-current"
# : case-insensitive search for query/server
#