aboutsummaryrefslogtreecommitdiffstats
path: root/weechat/python
diff options
context:
space:
mode:
Diffstat (limited to 'weechat/python')
-rw-r--r--weechat/python/autojoin_on_invite.py27
-rw-r--r--weechat/python/colorize_nicks.py5
2 files changed, 26 insertions, 6 deletions
diff --git a/weechat/python/autojoin_on_invite.py b/weechat/python/autojoin_on_invite.py
index cdaeaf0..45adab5 100644
--- a/weechat/python/autojoin_on_invite.py
+++ b/weechat/python/autojoin_on_invite.py
@@ -20,6 +20,8 @@
# (this script requires WeeChat 0.3.0 or newer)
#
# History:
+# 2015-10-11, Simmo Saan <simmo.saan@gmail.com>
+# version 0.6: allow joining channels with keys in autojoin
# 2013-12-21, Sebastien Helleu <flashcode@flashtux.org>
# version 0.5: fix parsing of INVITE message
# 2013-11-28, sakkemo <scajanus@gmail.com>
@@ -36,7 +38,7 @@ import re
SCRIPT_NAME = "autojoin_on_invite"
SCRIPT_AUTHOR = "xt <xt@bash.no>"
-SCRIPT_VERSION = "0.5"
+SCRIPT_VERSION = "0.6"
SCRIPT_LICENSE = "GPL3"
SCRIPT_DESC = "Auto joins channels when invited"
@@ -49,6 +51,7 @@ settings = {
'ignore_nicks': '', # comma separated list of nicks
#that we will not accept auto invite from
'ignore_channels': '', # comma separated list of channels to not join
+ 'autojoin_key': 'on', # use channel keys from server's autojoin list
}
if w.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE,
@@ -59,6 +62,20 @@ if w.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE,
w.hook_signal('*,irc_in2_invite', 'invite_cb', '')
+def join(server, channel):
+ key = None
+
+ if w.config_string_to_boolean(w.config_get_plugin('autojoin_key')):
+ autojoin = w.config_string(w.config_get('irc.server.%s.autojoin' % server)).split(' ', 1)
+
+ if len(autojoin) > 1: # any keys specified
+ autojoin_keys = dict(zip(autojoin[0].split(','), autojoin[1].split(',')))
+ key = autojoin_keys.get(channel) # defaults to None when not set
+
+ if key:
+ w.command('', '/quote -server %s JOIN %s %s' % (server, channel, key))
+ else:
+ w.command('', '/quote -server %s JOIN %s' % (server, channel))
def invite_cb(data, signal, signal_data):
server = signal.split(',')[0] # EFNet,irc_in_INVITE
@@ -69,7 +86,7 @@ def invite_cb(data, signal, signal_data):
if from_nick in w.config_get_plugin('whitelist_nicks').split(',') or channel in w.config_get_plugin('whitelist_channels').split(','):
w.prnt('', 'Automatically joining %s on server %s, invitation from %s (whitelist).' \
%(channel, server, from_nick))
- w.command('', '/quote -server %s JOIN %s' % (server, channel))
+ join(server, channel)
else:
w.prnt('', 'Ignoring invite from %s to channel %s. Neither inviter nor channel in whitelist.' %(from_nick, channel))
@@ -77,7 +94,7 @@ def invite_cb(data, signal, signal_data):
if from_nick in w.config_get_plugin('whitelist_nicks').split(','):
w.prnt('', 'Automatically joining %s on server %s, invitation from %s (whitelist).' \
%(channel, server, from_nick))
- w.command('', '/quote -server %s JOIN %s' % (server, channel))
+ join(server, channel)
else:
w.prnt('', 'Ignoring invite from %s to channel %s. Inviter not in whitelist.' %(from_nick, channel))
@@ -85,7 +102,7 @@ def invite_cb(data, signal, signal_data):
if channel in w.config_get_plugin('whitelist_channels').split(','):
w.prnt('', 'Automatically joining %s on server %s, invitation from %s (whitelist).' \
%(channel, server, from_nick))
- w.command('', '/quote -server %s JOIN %s' % (server, channel))
+ join(server, channel)
else:
w.prnt('', 'Ignoring invite from %s to channel %s. Channel not in whitelist.' %(from_nick, channel))
@@ -97,6 +114,6 @@ def invite_cb(data, signal, signal_data):
else:
w.prnt('', 'Automatically joining %s on server %s, invitation from %s.' \
%(channel, server, from_nick))
- w.command('', '/quote -server %s JOIN %s' % (server, channel))
+ join(server, channel)
return w.WEECHAT_RC_OK
diff --git a/weechat/python/colorize_nicks.py b/weechat/python/colorize_nicks.py
index 03dac1d..506a3ab 100644
--- a/weechat/python/colorize_nicks.py
+++ b/weechat/python/colorize_nicks.py
@@ -21,6 +21,8 @@
#
#
# History:
+# 2016-05-01, Simmo Saan <simmo.saan@gmail.com>
+# version 22: invalidate cached colors on hash algorithm change
# 2015-07-28, xt
# version 21: fix problems with nicks with commas in them
# 2015-04-19, xt
@@ -75,7 +77,7 @@ w = weechat
SCRIPT_NAME = "colorize_nicks"
SCRIPT_AUTHOR = "xt <xt@bash.no>"
-SCRIPT_VERSION = "21"
+SCRIPT_VERSION = "22"
SCRIPT_LICENSE = "GPL"
SCRIPT_DESC = "Use the weechat nick colors in the chat area"
@@ -339,6 +341,7 @@ if __name__ == "__main__":
w.hook_modifier('weechat_print', 'colorize_cb', '')
# Hook config for changing colors
w.hook_config('weechat.color.chat_nick_colors', 'populate_nicks', '')
+ w.hook_config('weechat.look.nick_color_hash', 'populate_nicks', '')
# Hook for working togheter with other scripts (like colorize_lines)
w.hook_modifier('colorize_nicks', 'colorize_cb', '')
# Hook for modifying input