Weechat update to v1.1

This commit is contained in:
nemunaire 2015-01-14 11:57:24 +01:00
parent 83863aa05c
commit 3ac7a7504b
18 changed files with 766 additions and 27 deletions

View File

@ -1,5 +1,5 @@
#
# alias.conf -- weechat v0.4.3
# alias.conf -- weechat v1.1
#
[cmd]

View File

@ -1,5 +1,5 @@
#
# aspell.conf -- weechat v0.4.3
# aspell.conf -- weechat v1.1
#
[color]

View File

@ -1,5 +1,5 @@
#
# charset.conf -- weechat v0.4.3
# charset.conf -- weechat v1.1
#
[default]

View File

@ -0,0 +1,11 @@
#
# colorize_nicks.conf -- weechat v1.1
#
[look]
blacklist_channels = ""
blacklist_nicks = "so,root"
colorize_input = on
greedy_matching = on
ignore_tags = ""
min_nick_length = 2

11
.weechat/exec.conf Normal file
View File

@ -0,0 +1,11 @@
#
# exec.conf -- weechat v1.1
#
[command]
default_options = ""
purge_delay = 0
[color]
flag_finished = lightred
flag_running = lightgreen

View File

@ -1,8 +1,10 @@
#
# irc.conf -- weechat v0.4.3
# irc.conf -- weechat v1.1
#
[look]
buffer_open_before_autojoin = on
buffer_open_before_join = off
buffer_switch_autojoin = on
buffer_switch_join = on
color_nicks_in_names = on
@ -26,10 +28,11 @@ highlight_pv = "$nick"
highlight_server = "$nick"
highlight_tags_restrict = "irc_privmsg,irc_notice"
item_away_message = on
item_channel_modes_hide_key = on
item_channel_modes_hide_args = "k"
item_display_server = buffer_plugin
item_nick_modes = on
item_nick_prefix = on
join_auto_add_chantype = off
msgbuffer_fallback = current
new_channel_position = none
new_pv_position = none
@ -57,6 +60,7 @@ smart_filter_join_unmask = 30
smart_filter_mode = "ovh"
smart_filter_nick = on
smart_filter_quit = on
temporary_servers = off
topic_strip_colors = off
[color]
@ -65,6 +69,7 @@ item_away = yellow
item_channel_modes = default
item_lag_counting = default
item_lag_finished = yellow
item_nick_modes = default
message_join = green
message_quit = red
mirc_remap = "1,-1:darkgray"
@ -123,6 +128,7 @@ notify = ""
password = ""
proxy = ""
realname = "Némunaire"
sasl_fail = continue
sasl_mechanism = plain
sasl_password = ""
sasl_timeout = 15
@ -151,6 +157,7 @@ minbif.sasl_mechanism
minbif.sasl_username
minbif.sasl_password
minbif.sasl_timeout
minbif.sasl_fail
minbif.autoconnect = on
minbif.autoreconnect
minbif.autoreconnect_delay
@ -164,8 +171,8 @@ minbif.autojoin
minbif.autorejoin
minbif.autorejoin_delay
minbif.connection_timeout
minbif.anti_flood_prio_high
minbif.anti_flood_prio_low
minbif.anti_flood_prio_high = 0
minbif.anti_flood_prio_low = 1
minbif.away_check
minbif.away_check_max_nicks
minbif.default_msg_kick
@ -187,6 +194,7 @@ geeknode.sasl_mechanism
geeknode.sasl_username
geeknode.sasl_password
geeknode.sasl_timeout
geeknode.sasl_fail
geeknode.autoconnect = on
geeknode.autoreconnect
geeknode.autoreconnect_delay
@ -223,6 +231,7 @@ worldnet.sasl_mechanism
worldnet.sasl_username
worldnet.sasl_password
worldnet.sasl_timeout
worldnet.sasl_fail
worldnet.autoconnect = on
worldnet.autoreconnect
worldnet.autoreconnect_delay
@ -259,6 +268,7 @@ epiknet.sasl_mechanism
epiknet.sasl_username
epiknet.sasl_password
epiknet.sasl_timeout
epiknet.sasl_fail
epiknet.autoconnect = on
epiknet.autoreconnect
epiknet.autoreconnect_delay
@ -295,6 +305,7 @@ freenode.sasl_mechanism
freenode.sasl_username
freenode.sasl_password
freenode.sasl_timeout
freenode.sasl_fail
freenode.autoconnect = on
freenode.autoreconnect
freenode.autoreconnect_delay
@ -308,8 +319,8 @@ freenode.autojoin
freenode.autorejoin
freenode.autorejoin_delay
freenode.connection_timeout
freenode.anti_flood_prio_high
freenode.anti_flood_prio_low
freenode.anti_flood_prio_high = 3
freenode.anti_flood_prio_low = 10
freenode.away_check
freenode.away_check_max_nicks
freenode.default_msg_kick
@ -331,6 +342,7 @@ rezosup.sasl_mechanism
rezosup.sasl_username
rezosup.sasl_password
rezosup.sasl_timeout
rezosup.sasl_fail
rezosup.autoconnect = on
rezosup.autoreconnect
rezosup.autoreconnect_delay
@ -367,6 +379,7 @@ mongueurs.sasl_mechanism
mongueurs.sasl_username
mongueurs.sasl_password
mongueurs.sasl_timeout
mongueurs.sasl_fail
mongueurs.autoconnect = on
mongueurs.autoreconnect
mongueurs.autoreconnect_delay

View File

@ -0,0 +1 @@
../minbif_typing_notice.pl

View File

@ -1,5 +1,5 @@
#
# plugins.conf -- weechat v0.4.3
# plugins.conf -- weechat v1.1
#
[var]
@ -47,6 +47,7 @@ python.screen_away.ignore_relays = "on"
python.screen_away.interval = "5"
python.screen_away.message = "Detached from screen"
python.screen_away.set_away = "on"
python.screen_away.time_format = "since %Y-%m-%d %H:%M:%S%z"
python.title.short_name = "on"
python.title.title_priority = "2"
@ -79,5 +80,6 @@ python.screen_away.command_on_detach = "Commands to execute on detach, separated
python.screen_away.ignore = "Comma-separated list of servers to ignore."
python.screen_away.ignore_relays = "Only check screen status and ignore relay interfaces"
python.screen_away.interval = "How often in seconds to check screen status"
python.screen_away.message = "Away mesage"
python.screen_away.message = "Away message"
python.screen_away.set_away = "Set user as away."
python.screen_away.time_format = "time format append to away message"

View File

@ -1 +0,0 @@
../correction_completion.py

View File

@ -0,0 +1 @@
../screen_away.py

View File

@ -0,0 +1,328 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2010 by xt <xt@bash.no>
#
# 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/>.
#
# This script colors nicks in IRC channels in the actual message
# not just in the prefix section.
#
#
# History:
# 2014-09-17, holomorph
# version 16: use weechat config facilities
# clean unused, minor linting, some simplification
# 2014-05-05, holomorph
# version 15: fix python2-specific re.search check
# 2013-01-29, nils_2
# version 14: make script compatible with Python 3.x
# 2012-10-19, ldvx
# version 13: Iterate over every word to prevent incorrect colorization of
# nicks. Added option greedy_matching.
# 2012-04-28, ldvx
# version 12: added ignore_tags to avoid colorizing nicks if tags are present
# 2012-01-14, nesthib
# version 11: input_text_display hook and modifier to colorize nicks in input bar
# 2010-12-22, xt
# version 10: hook config option for updating blacklist
# 2010-12-20, xt
# version 0.9: hook new config option for weechat 0.3.4
# 2010-11-01, nils_2
# version 0.8: hook_modifier() added to communicate with rainbow_text
# 2010-10-01, xt
# version 0.7: changes to support non-irc-plugins
# 2010-07-29, xt
# version 0.6: compile regexp as per patch from Chris quigybo@hotmail.com
# 2010-07-19, xt
# version 0.5: fix bug with incorrect coloring of own nick
# 2010-06-02, xt
# version 0.4: update to reflect API changes
# 2010-03-26, xt
# version 0.3: fix error with exception
# 2010-03-24, xt
# version 0.2: use ignore_channels when populating to increase performance.
# 2010-02-03, xt
# version 0.1: initial (based on ruby script by dominikh)
#
# Known issues: nicks will not get colorized if they begin with a character
# such as ~ (which some irc networks do happen to accept)
import weechat
import re
w = weechat
SCRIPT_NAME = "colorize_nicks"
SCRIPT_AUTHOR = "xt <xt@bash.no>"
SCRIPT_VERSION = "16"
SCRIPT_LICENSE = "GPL"
SCRIPT_DESC = "Use the weechat nick colors in the chat area"
VALID_NICK = r'([@~&!%+])?([-a-zA-Z0-9\[\]\\`_^\{|\}]+)'
valid_nick_re = re.compile(VALID_NICK)
ignore_channels = []
ignore_nicks = []
# Dict with every nick on every channel with its color as lookup value
colored_nicks = {}
CONFIG_FILE_NAME = "colorize_nicks"
# config file and options
colorize_config_file = ""
colorize_config_option = {}
def colorize_config_init():
'''
Initialization of configuration file.
Sections: look.
'''
global colorize_config_file, colorize_config_option
colorize_config_file = weechat.config_new(CONFIG_FILE_NAME,
"colorize_config_reload_cb", "")
if colorize_config_file == "":
return
# section "look"
section_look = weechat.config_new_section(
colorize_config_file, "look", 0, 0, "", "", "", "", "", "", "", "", "", "")
if section_look == "":
weechat.config_free(colorize_config_file)
return
colorize_config_option["blacklist_channels"] = weechat.config_new_option(
colorize_config_file, section_look, "blacklist_channels",
"string", "Comma separated list of channels", "", 0, 0,
"", "", 0, "", "", "", "", "", "")
colorize_config_option["blacklist_nicks"] = weechat.config_new_option(
colorize_config_file, section_look, "blacklist_nicks",
"string", "Comma separated list of nicks", "", 0, 0,
"so,root", "so,root", 0, "", "", "", "", "", "")
colorize_config_option["min_nick_length"] = weechat.config_new_option(
colorize_config_file, section_look, "min_nick_length",
"integer", "Minimum length nick to colorize", "",
2, 20, "", "", 0, "", "", "", "", "", "")
colorize_config_option["colorize_input"] = weechat.config_new_option(
colorize_config_file, section_look, "colorize_input",
"boolean", "Whether to colorize input", "", 0,
0, "off", "off", 0, "", "", "", "", "", "")
colorize_config_option["ignore_tags"] = weechat.config_new_option(
colorize_config_file, section_look, "ignore_tags",
"string", "Comma separated list of tags to ignore; i.e. irc_join,irc_part,irc_quit", "", 0, 0,
"", "", 0, "", "", "", "", "", "")
colorize_config_option["greedy_matching"] = weechat.config_new_option(
colorize_config_file, section_look, "greedy_matching",
"boolean", "If off, then use lazy matching instead", "", 0,
0, "on", "on", 0, "", "", "", "", "", "")
def colorize_config_read():
''' Read configuration file. '''
global colorize_config_file
return weechat.config_read(colorize_config_file)
def colorize_nick_color(nick, my_nick):
''' Retrieve nick color from weechat. '''
if nick == my_nick:
return w.color(w.config_string(w.config_get('weechat.color.chat_nick_self')))
else:
return w.info_get('irc_nick_color', nick)
def colorize_cb(data, modifier, modifier_data, line):
''' Callback that does the colorizing, and returns new line if changed '''
global ignore_nicks, ignore_channels, colored_nicks
full_name = modifier_data.split(';')[1]
channel = '.'.join(full_name.split('.')[1:])
buffer = w.buffer_search('', full_name)
# Check if buffer has colorized nicks
if buffer not in colored_nicks:
return line
if channel in ignore_channels:
return line
min_length = w.config_integer(colorize_config_option['min_nick_length'])
reset = w.color('reset')
# Don't colorize if the ignored tag is present in message
tags_line = modifier_data.rsplit(';')
if len(tags_line) >= 3:
tags_line = tags_line[2].split(',')
for i in w.config_string(colorize_config_option['ignore_tags']).split(','):
if i in tags_line:
return line
for words in valid_nick_re.findall(line):
nick = words[1]
# Check that nick is not ignored and longer than minimum length
if len(nick) < min_length or nick in ignore_nicks:
continue
# Check that nick is in the dictionary colored_nicks
if nick in colored_nicks[buffer]:
nick_color = colored_nicks[buffer][nick]
# Let's use greedy matching. Will check against every word in a line.
if w.config_boolean(colorize_config_option['greedy_matching']):
for word in line.split():
if nick in word:
# Is there a nick that contains nick and has a greater lenght?
# If so let's save that nick into var biggest_nick
biggest_nick = ""
for i in colored_nicks[buffer]:
if nick in i and nick != i and len(i) > len(nick):
if i in word:
# If a nick with greater len is found, and that word
# also happens to be in word, then let's save this nick
biggest_nick = i
# If there's a nick with greater len, then let's skip this
# As we will have the chance to colorize when biggest_nick
# iterates being nick.
if len(biggest_nick) > 0 and biggest_nick in word:
pass
elif len(word) < len(biggest_nick) or len(biggest_nick) == 0:
new_word = word.replace(nick, '%s%s%s' % (nick_color, nick, reset))
line = line.replace(word, new_word)
# Let's use lazy matching for nick
else:
nick_color = colored_nicks[buffer][nick]
# The two .? are in case somebody writes "nick:", "nick,", etc
# to address somebody
regex = r"(\A|\s).?(%s).?(\Z|\s)" % re.escape(nick)
match = re.search(regex, line)
if match is not None:
new_line = line[:match.start(2)] + nick_color+nick+reset + line[match.end(2):]
line = new_line
return line
def colorize_input_cb(data, modifier, modifier_data, line):
''' Callback that does the colorizing in input '''
global ignore_nicks, ignore_channels, colored_nicks
min_length = w.config_integer(colorize_config_option['min_nick_length'])
if not w.config_boolean(colorize_config_option['colorize_input']):
return line
buffer = w.current_buffer()
# Check if buffer has colorized nicks
if buffer not in colored_nicks:
return line
channel = w.buffer_get_string(buffer, 'name')
if channel in ignore_channels:
return line
reset = w.color('reset')
for words in valid_nick_re.findall(line):
nick = words[1]
# Check that nick is not ignored and longer than minimum length
if len(nick) < min_length or nick in ignore_nicks:
continue
if nick in colored_nicks[buffer]:
nick_color = colored_nicks[buffer][nick]
line = line.replace(nick, '%s%s%s' % (nick_color, nick, reset))
return line
def populate_nicks(*args):
''' Fills entire dict with all nicks weechat can see and what color it has
assigned to it. '''
global colored_nicks
colored_nicks = {}
servers = w.infolist_get('irc_server', '', '')
while w.infolist_next(servers):
servername = w.infolist_string(servers, 'name')
colored_nicks[servername] = {}
my_nick = w.info_get('irc_nick', servername)
channels = w.infolist_get('irc_channel', '', servername)
while w.infolist_next(channels):
pointer = w.infolist_pointer(channels, 'buffer')
nicklist = w.infolist_get('nicklist', pointer, '')
if pointer not in colored_nicks:
colored_nicks[pointer] = {}
while w.infolist_next(nicklist):
nick = w.infolist_string(nicklist, 'name')
nick_color = colorize_nick_color(nick, my_nick)
colored_nicks[pointer][nick] = nick_color
w.infolist_free(nicklist)
w.infolist_free(channels)
w.infolist_free(servers)
return w.WEECHAT_RC_OK
def add_nick(data, signal, type_data):
''' Add nick to dict of colored nicks '''
global colored_nicks
pointer, nick = type_data.split(',')
if pointer not in colored_nicks:
colored_nicks[pointer] = {}
my_nick = w.buffer_get_string(pointer, 'localvar_nick')
nick_color = colorize_nick_color(nick, my_nick)
colored_nicks[pointer][nick] = nick_color
return w.WEECHAT_RC_OK
def remove_nick(data, signal, type_data):
''' Remove nick from dict with colored nicks '''
global colored_nicks
pointer, nick = type_data.split(',')
if pointer in colored_nicks and nick in colored_nicks[pointer]:
del colored_nicks[pointer][nick]
return w.WEECHAT_RC_OK
def update_blacklist(*args):
''' Set the blacklist for channels and nicks. '''
global ignore_channels, ignore_nicks
ignore_channels = w.config_string(colorize_config_option['blacklist_channels']).split(',')
ignore_nicks = w.config_string(colorize_config_option['blacklist_nicks']).split(',')
return w.WEECHAT_RC_OK
if __name__ == "__main__":
if w.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE,
SCRIPT_DESC, "", ""):
colorize_config_init()
colorize_config_read()
# Run once to get data ready
update_blacklist()
populate_nicks()
w.hook_signal('nicklist_nick_added', 'add_nick', '')
w.hook_signal('nicklist_nick_removed', 'remove_nick', '')
w.hook_modifier('weechat_print', 'colorize_cb', '')
# Hook config for changing colors
w.hook_config('weechat.color.chat_nick_colors', 'populate_nicks', '')
# Hook for working togheter with other scripts (like colorize_lines)
w.hook_modifier('colorize_nicks', 'colorize_cb', '')
# Hook for modifying input
w.hook_modifier('250|input_text_display', 'colorize_input_cb', '')
# Hook for updating blacklist (this could be improved to use fnmatch)
weechat.hook_config('%s.look.blacklist*' % SCRIPT_NAME, 'update_blacklist', '')

View File

@ -0,0 +1,197 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2009 by xt <xt@bash.no>
# Copyright (c) 2009 by penryu <penryu@gmail.com>
# Copyright (c) 2010 by Blake Winton <bwinton@latte.ca>
# Copyright (c) 2010 by Aron Griffis <agriffis@n01se.net>
# Copyright (c) 2010 by Jani Kesänen <jani.kesanen@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/>.
#
#
# (this script requires WeeChat 0.3.0 or newer)
#
# History:
# 2014-08-02, Nils Görs <weechatter@arcor.de>
# version 0.14: add time to detach message. (idea by Mikaela)
# 2014-06-19, Anders Bergh <anders1@gmail.com>
# version 0.13: Fix a simple typo in an option description.
# 2014-01-12, Phyks (Lucas Verney) <phyks@phyks.me>
# version 0.12: Added an option to check status of relays to set unaway in
# case of a connected relay.
# 2013-08-30, Anders Einar Hilden <hildenae@gmail.com>
# version: 0.11: Fix reading of set_away
# 2013-06-16, Renato Botelho <rbgarga@gmail.com>
# version 0.10: add option to don't set away, only change nick
# allow multiple commands on attach/dettach
# do not add suffix if nick already have it
# 2012-12-29, David Flatz <david@upcs.at>
# version 0.9: add option to ignore servers and don't set away status for them
# add descriptions to config options
# 2010-08-07, Filip H.F. "FiXato" Slagter <fixato@gmail.com>
# version 0.8: add command on attach feature
# 2010-05-07, Jani Kesänen <jani.kesanen@gmail.com>
# version 0.7: add command on detach feature
# 2010-03-07, Aron Griffis <agriffis@n01se.net>
# version 0.6: move socket check to register,
# add hook_config for interval,
# reduce default interval from 60 to 5
# 2010-02-19, Blake Winton <bwinton@latte.ca>
# version 0.5: add option to change nick when away
# 2010-01-18, xt
# version 0.4: only update servers that are connected
# 2009-11-30, xt <xt@bash.no>
# version 0.3: do not touch servers that are manually set away
# 2009-11-27, xt <xt@bash.no>
# version 0.2: code for TMUX from penryu
# 2009-11-27, xt <xt@bash.no>
# version 0.1: initial release
import weechat as w
import re
import os
import datetime, time
SCRIPT_NAME = "screen_away"
SCRIPT_AUTHOR = "xt <xt@bash.no>"
SCRIPT_VERSION = "0.14"
SCRIPT_LICENSE = "GPL3"
SCRIPT_DESC = "Set away status on screen detach"
settings = {
'message': ('Detached from screen', 'Away message'),
'time_format': ('since %Y-%m-%d %H:%M:%S%z', 'time format append to away message'),
'interval': ('5', 'How often in seconds to check screen status'),
'away_suffix': ('', 'What to append to your nick when you\'re away.'),
'command_on_attach': ('', 'Commands to execute on attach, separated by semicolon'),
'command_on_detach': ('', 'Commands to execute on detach, separated by semicolon'),
'ignore': ('', 'Comma-separated list of servers to ignore.'),
'set_away': ('on', 'Set user as away.'),
'ignore_relays': ('off', 'Only check screen status and ignore relay interfaces'),
}
TIMER = None
SOCK = None
AWAY = False
CONNECTED_RELAY = False
def set_timer():
'''Update timer hook with new interval'''
global TIMER
if TIMER:
w.unhook(TIMER)
TIMER = w.hook_timer(int(w.config_get_plugin('interval')) * 1000,
0, 0, "screen_away_timer_cb", '')
def screen_away_config_cb(data, option, value):
if option.endswith(".interval"):
set_timer()
return w.WEECHAT_RC_OK
def get_servers():
'''Get the servers that are not away, or were set away by this script'''
ignores = w.config_get_plugin('ignore').split(',')
infolist = w.infolist_get('irc_server','','')
buffers = []
while w.infolist_next(infolist):
if not w.infolist_integer(infolist, 'is_connected') == 1 or \
w.infolist_string(infolist, 'name') in ignores:
continue
if not w.config_string_to_boolean(w.config_get_plugin('set_away')) or \
not w.infolist_integer(infolist, 'is_away') or \
w.config_get_plugin('message') in w.infolist_string(infolist, 'away_message'):
# w.infolist_string(infolist, 'away_message') == \
# w.config_get_plugin('message'):
buffers.append((w.infolist_pointer(infolist, 'buffer'),
w.infolist_string(infolist, 'nick')))
w.infolist_free(infolist)
return buffers
def screen_away_timer_cb(buffer, args):
'''Check if screen is attached, update awayness'''
global AWAY, SOCK, CONNECTED_RELAY
set_away = w.config_string_to_boolean(w.config_get_plugin('set_away'))
check_relays = not w.config_string_to_boolean(w.config_get_plugin('ignore_relays'))
suffix = w.config_get_plugin('away_suffix')
attached = os.access(SOCK, os.X_OK) # X bit indicates attached
# Check wether a client is connected on relay or not
CONNECTED_RELAY = False
if check_relays:
infolist = w.infolist_get('relay', '', '')
if infolist:
while w.infolist_next(infolist):
status = w.infolist_string(infolist, 'status_string')
if status == 'connected':
CONNECTED_RELAY = True
break
w.infolist_free(infolist)
if (attached and AWAY) or (check_relays and CONNECTED_RELAY and not attached and AWAY):
w.prnt('', '%s: Screen attached. Clearing away status' % SCRIPT_NAME)
for server, nick in get_servers():
if set_away:
w.command(server, "/away")
if suffix and nick.endswith(suffix):
nick = nick[:-len(suffix)]
w.command(server, "/nick %s" % nick)
AWAY = False
for cmd in w.config_get_plugin("command_on_attach").split(";"):
w.command("", cmd)
elif not attached and not AWAY:
if not CONNECTED_RELAY:
w.prnt('', '%s: Screen detached. Setting away status' % SCRIPT_NAME)
for server, nick in get_servers():
if suffix and not nick.endswith(suffix):
w.command(server, "/nick %s%s" % (nick, suffix));
if set_away:
w.command(server, "/away %s %s" % (w.config_get_plugin('message'), time.strftime(w.config_get_plugin('time_format'))))
AWAY = True
for cmd in w.config_get_plugin("command_on_detach").split(";"):
w.command("", cmd)
return w.WEECHAT_RC_OK
if w.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE,
SCRIPT_DESC, "", ""):
version = w.info_get('version_number', '') or 0
for option, default_desc in settings.iteritems():
if not w.config_is_set_plugin(option):
w.config_set_plugin(option, default_desc[0])
if int(version) >= 0x00030500:
w.config_set_desc_plugin(option, default_desc[1])
if 'STY' in os.environ.keys():
# We are running under screen
cmd_output = os.popen('env LC_ALL=C screen -ls').read()
match = re.search(r'Sockets? in (/.+)\.', cmd_output)
if match:
SOCK = os.path.join(match.group(1), os.environ['STY'])
if not SOCK and 'TMUX' in os.environ.keys():
# We are running under tmux
socket_data = os.environ['TMUX']
SOCK = socket_data.rsplit(',',2)[0]
if SOCK:
set_timer()
w.hook_config("plugins.var.python." + SCRIPT_NAME + ".*",
"screen_away_config_cb", "")

View File

@ -0,0 +1,99 @@
# Show differences between old and new topics
# Author: Dafydd Harries <daf@rhydd.org>
# License: GPL3
import re
import weechat
SCRIPT_NAME = "topicdiff"
SCRIPT_AUTHOR = "Dafydd Harries <daf@rhydd.org>"
SCRIPT_VERSION = "0.2"
SCRIPT_LICENSE = "GPL3"
SCRIPT_DESC = "Show differences between old and new topics."
pending_change_buffer = None
topics = {}
def topic_chunks(s):
return re.split(r'\s+\|\|?\s+', s)
def topic_changed(buffer, new_topic):
if buffer in topics:
old_chunks = set(topic_chunks(topics[buffer]))
new_chunks = set(topic_chunks(new_topic))
removed_chunks = old_chunks - new_chunks
added_chunks = new_chunks - old_chunks
for chunk in removed_chunks:
weechat.prnt(buffer, ' -: %s' % chunk)
for chunk in added_chunks:
weechat.prnt(buffer, ' +: %s' % chunk)
topics[buffer] = new_topic
def print_332(data, buffer, time, tags, displayed, highlight, prefix, message):
#weechat.prnt('', 'print: %r' % (a,))
global pending_change_buffer
pending_change_buffer = buffer
return weechat.WEECHAT_RC_OK
def print_topic(
data, buffer, time, tags, displayed, highlight, prefix, message):
global pending_change_buffer
pending_change_buffer = buffer
return weechat.WEECHAT_RC_OK
def irc_in2_332(data, tags, msg):
global pending_change_buffer
if pending_change_buffer is None:
# Hmm, that's weird.
#weechat.prnt('', 'no pending buffer :(')
return weechat.WEECHAT_RC_OK
match = re.match(r':\S+ 332 \S+ \S+ :(.*)', msg)
if not match:
#weechat.prnt('', 'no match :(')
return weechat.WEECHAT_RC_OK
new_topic = match.group(1)
topic_changed(pending_change_buffer, new_topic)
pending_change_buffer = None
return weechat.WEECHAT_RC_OK
def irc_in2_topic(data, tags, msg):
global pending_change_buffer
#weechat.prnt('', '%r' % ((tags, msg),))
if pending_change_buffer is None:
# Hmm, that's weird.
#weechat.prnt('', 'no pending buffer :(')
return weechat.WEECHAT_RC_OK
match = re.match(r':\S+ TOPIC \S+ :(.*)', msg)
if not match:
#weechat.prnt('', 'no match :(')
return weechat.WEECHAT_RC_OK
new_topic = match.group(1)
topic_changed(pending_change_buffer, new_topic)
pending_change_buffer = None
return weechat.WEECHAT_RC_OK
def register():
weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION,
SCRIPT_LICENSE, SCRIPT_DESC, '', '')
weechat.hook_print('', 'irc_332', '', 1, 'print_332', '')
weechat.hook_print('', 'irc_topic', '', 1, 'print_topic', '')
weechat.hook_signal('*,irc_in2_332', 'irc_in2_332', '')
weechat.hook_signal('*,irc_in2_topic', 'irc_in2_topic', '')
if __name__ == '__main__':
register()

View File

@ -1,5 +1,5 @@
#
# script.conf -- weechat v0.4.3
# script.conf -- weechat v1.1
#
[look]
@ -46,3 +46,4 @@ cache_expire = 60
dir = "%h/script"
hold = ""
url = "http://www.weechat.org/files/plugins.xml.gz"
url_force_https = on

View File

@ -1,5 +1,5 @@
#
# sec.conf -- weechat v0.4.3
# sec.conf -- weechat v1.1
#
[crypt]

47
.weechat/trigger.conf Normal file
View File

@ -0,0 +1,47 @@
#
# trigger.conf -- weechat v1.1
#
[look]
enabled = on
monitor_strip_colors = off
[color]
flag_command = lightgreen
flag_conditions = yellow
flag_regex = lightcyan
flag_return_code = lightmagenta
regex = white
replace = cyan
trigger = green
trigger_disabled = red
[trigger]
beep.arguments = ""
beep.command = "/print -beep"
beep.conditions = "${tg_highlight} || ${tg_msg_pv}"
beep.enabled = on
beep.hook = print
beep.regex = ""
beep.return_code = ok
cmd_pass.arguments = "5000|input_text_display;5000|history_add;5000|irc_command_auth"
cmd_pass.command = ""
cmd_pass.conditions = ""
cmd_pass.enabled = on
cmd_pass.hook = modifier
cmd_pass.regex = "==^((/(msg|quote) +nickserv +(id|identify|register|ghost +[^ ]+|release +[^ ]+|regain +[^ ]+) +)|/oper +[^ ]+ +|/quote +pass +|/set +[^ ]*password[^ ]* +|/secure +(passphrase|decrypt|set +[^ ]+) +)(.*)==$1$.*+"
cmd_pass.return_code = ok
msg_auth.arguments = "5000|irc_message_auth"
msg_auth.command = ""
msg_auth.conditions = ""
msg_auth.enabled = on
msg_auth.hook = modifier
msg_auth.regex = "==^(.*(id|identify|register|ghost +[^ ]+|release +[^ ]+) +)(.*)==$1$.*+"
msg_auth.return_code = ok
server_pass.arguments = "5000|input_text_display;5000|history_add"
server_pass.command = ""
server_pass.conditions = ""
server_pass.enabled = on
server_pass.hook = modifier
server_pass.regex = "==^(/(server|connect) .*-(sasl_)?password=)([^ ]+)(.*)==$1$.*4$5"
server_pass.return_code = ok

View File

@ -1,5 +1,5 @@
#
# weechat.conf -- weechat v0.4.3
# weechat.conf -- weechat v1.1
#
[debug]
@ -17,6 +17,8 @@ bar_more_down = "++"
bar_more_left = "<<"
bar_more_right = ">>"
bar_more_up = "--"
bare_display_exit_on_input = on
bare_display_time_format = "%H:%M"
buffer_auto_renumber = on
buffer_notify_default = message
buffer_position = end
@ -36,6 +38,7 @@ color_nick_offline = on
color_pairs_auto_reset = 5
color_real_white = off
command_chars = ""
command_incomplete = off
confirm_quit = on
day_change = on
day_change_message_1date = "-- %a, %d %b %Y --"
@ -45,7 +48,7 @@ emphasized_attributes = ""
highlight = "nemu*,nému*,mercie_d,stallman"
highlight_regex = ""
highlight_tags = ""
hotlist_add_buffer_if_away = on
hotlist_add_conditions = "${away} || ${buffer.num_displayed} == 0"
hotlist_buffer_separator = ", "
hotlist_count_max = 2
hotlist_count_min_msg = 2
@ -54,6 +57,7 @@ hotlist_names_length = 0
hotlist_names_level = 12
hotlist_names_merged_buffers = off
hotlist_prefix = "H: "
hotlist_remove = merged
hotlist_short_names = on
hotlist_sort = group_time_asc
hotlist_suffix = ""
@ -64,6 +68,7 @@ input_share_overwrite = off
input_undo_max = 32
item_buffer_filter = "*"
item_buffer_zoom = "!"
item_mouse_status = "M"
item_time_format = "%H:%M"
jump_current_to_previous_buffer = on
jump_previous_buffer_when_closing = on
@ -170,13 +175,16 @@ status_data_other = default
status_data_private = lightgreen
status_filter = green
status_more = yellow
status_mouse = green
status_name = white
status_name_ssl = lightgreen
status_nicklist_count = default
status_number = yellow
status_time = default
[completion]
base_word_until_cursor = on
command_inline = on
default_template = "%(nicks)|%(irc_channels)"
nick_add_space = on
nick_completer = ":"
@ -283,20 +291,30 @@ default.buffer = "irc;rezosup.#ykar;2"
default.buffer = "irc;rezosup.#epita;3"
default.buffer = "irc;rezosup.#epita-sup;3"
default.buffer = "irc;rezosup.#epita2015;3"
default.buffer = "irc;rezosup.#nemutest;4"
default.buffer = "irc;rezosup.#nemubot;4"
default.buffer = "irc;rezosup.#nemutest;4"
default.buffer = "irc;freenode.#nemutest;4"
default.buffer = "irc;minbif.#42sha@conference.23.tf:nemu;4"
default.buffer = "irc;rezosup.#acu;5"
default.buffer = "irc;minbif.#42shb@conference.23.tf:nemu;4"
default.buffer = "irc;minbif.#42shc@conference.23.tf:nemu;4"
default.buffer = "irc;minbif.#42shd@conference.23.tf:nemu;4"
default.buffer = "irc;minbif.#42she@conference.23.tf:nemu;4"
default.buffer = "irc;minbif.#42shf@conference.23.tf:nemu;4"
default.buffer = "irc;minbif.#42shg@conference.23.tf:nemu;4"
default.buffer = "irc;minbif.#42shh@conference.23.tf:nemu;4"
default.buffer = "irc;minbif.#42shi@conference.23.tf:nemu;4"
default.buffer = "irc;minbif.#42shj@conference.23.tf:nemu;4"
default.buffer = "irc;minbif.#42shk@conference.23.tf:nemu;4"
default.buffer = "irc;rezosup.#epita2014;5"
default.buffer = "irc;rezosup.#gistre;5"
default.buffer = "irc;rezosup.#srs;5"
default.buffer = "irc;rezosup.#yaka;5"
default.buffer = "irc;rezosup.#gconfs;6"
default.buffer = "irc;rezosup.#k;6"
default.buffer = "irc;rezosup.#acu;5"
default.buffer = "irc;rezosup.#srs;5"
default.buffer = "irc;rezosup.#gistre;5"
default.buffer = "irc;rezosup.#lse;6"
default.buffer = "irc;rezosup.#k;6"
default.buffer = "irc;freenode.#prologin;6"
default.buffer = "irc;freenode.#prologin-staff;6"
default.buffer = "irc;rezosup.#gconfs;6"
default.buffer = "irc;mongueurs.#perlfr;7"
default.buffer = "irc;freenode.#e.fr;7"
default.buffer = "irc;freenode.#frsag;7"
@ -305,22 +323,28 @@ default.buffer = "irc;freenode.#gentoofr;7"
default.buffer = "irc;freenode.#untolduniverse;7"
default.buffer = "irc;mongueurs.#mongueurs;8"
default.buffer = "irc;worldnet.#epita;8"
default.buffer = "irc;freenode.#citadeltoolkit;8"
default.buffer = "irc;freenode.#gentoo-arm;8"
default.buffer = "irc;freenode.#gentoo-e;8"
default.buffer = "irc;freenode.#webos;8"
default.buffer = "irc;freenode.#gentoo-containers;8"
default.buffer = "irc;freenode.#gentoo-e;8"
default.buffer = "irc;freenode.#gentoo-embedded;8"
default.buffer = "irc;freenode.#shipyard;8"
default.buffer = "irc;freenode.#citadeltoolkit;8"
default.buffer = "irc;freenode.#webos;8"
default.buffer = "irc;freenode.#webos-ports;8"
default.buffer = "irc;freenode.#ansible;9"
default.buffer = "irc;freenode.#e;9"
default.buffer = "irc;freenode.#funtoo;9"
default.buffer = "irc;freenode.#gentoo;9"
default.buffer = "irc;freenode.#gentoo-bugs;9"
default.buffer = "irc;freenode.#influxdb;9"
default.buffer = "irc;freenode.#linux-sunxi;9"
default.buffer = "irc;freenode.#docker-fig;9"
default.buffer = "irc;freenode.#gitolite;9"
default.buffer = "irc;minbif.#162605_novaquark@conf.hipchat.com:nqhipchat;10"
default.buffer = "irc;minbif.#162605_chrone@conf.hipchat.com:nqhipchat;10"
default.buffer = "irc;minbif.#162605_tech@conf.hipchat.com:nqhipchat;10"
default.window = "1;0;0;0;irc;minbif.&minbif"
default.current = on
_zoom.window = "1;0;0;0;irc;freenode.#funtoo"
[notify]
irc.freenode.##xen = highlight
@ -332,10 +356,12 @@ irc.freenode.#freebsd = highlight
irc.freenode.#freenode-newyears = highlight
irc.freenode.#funtoo = highlight
irc.freenode.#gentoo = highlight
irc.freenode.#linux-sunxi = message
irc.freenode.#prologin = highlight
irc.freenode.#ubuntu-fr = highlight
irc.freenode.#webos = highlight
irc.freenode.#webos-internals = highlight
irc.freenode.#webos-ports = message
irc.rezosup.#42sh = all
irc.rezosup.#epita2014 = all
irc.rezosup.#epitagueule = all
@ -396,6 +422,7 @@ meta-meta2-A = "/buffer -1"
meta-meta2-B = "/buffer +1"
meta-meta2-C = "/buffer +1"
meta-meta2-D = "/buffer -1"
meta-- = "/filter toggle @"
meta-/ = "/input jump_last_buffer_displayed"
meta-0 = "/buffer *10"
meta-1 = "/buffer *1"
@ -467,6 +494,7 @@ meta-b = "/input move_previous_word"
meta-d = "/input delete_next_word"
meta-f = "/input move_next_word"
meta-h = "/input hotlist_clear"
meta-jmeta-f = "/buffer -"
meta-jmeta-l = "/input jump_last_buffer"
meta-jmeta-r = "/server raw"
meta-jmeta-s = "/server jump"
@ -570,6 +598,7 @@ meta-j97 = "/buffer 97"
meta-j98 = "/buffer 98"
meta-j99 = "/buffer 99"
meta-k = "/input grab_key_command"
meta-l = "/window bare"
meta-m = "/mute mouse toggle"
meta-n = "/window scroll_next_highlight"
meta-p = "/window scroll_previous_highlight"

View File

@ -1,5 +1,5 @@
#
# xfer.conf -- weechat v0.4.3
# xfer.conf -- weechat v1.1
#
[look]