add same_nick

weechat-localhost
Ben Harris 2018-08-11 16:39:57 -04:00
parent d80339eaef
commit 0176e216f2
8 changed files with 220 additions and 4 deletions

View File

@ -407,7 +407,7 @@ gitter.ssl_priorities
gitter.ssl_dhkey_size gitter.ssl_dhkey_size
gitter.ssl_fingerprint gitter.ssl_fingerprint
gitter.ssl_verify gitter.ssl_verify
gitter.password = "323cf7b2994d646e80b261c0d5bc546b766fe0c6" gitter.password = "${sec.data.gitterpass}"
gitter.capabilities gitter.capabilities
gitter.sasl_mechanism gitter.sasl_mechanism
gitter.sasl_username gitter.sasl_username

View File

@ -0,0 +1,121 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Hairo R. Carela <hairocr8@gmail.com>
#
# Everyone is permitted to copy and distribute verbatim or modified
# copies of this license document, and changing it is allowed as long
# as the name is changed.
#
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
#
# 0. You just DO WHAT THE FUCK YOU WANT TO.
#
# Alternate way of text formatting, useful for relays without text formatting
# features (Glowingbear, WeechatAndroid, etc)
#
# Usage:
# /aformat *text* for bold text
# /aformat /text/ for italic text
# /aformat _text_ for underlined text
# /aformat |text| for reversed (black on white) text
#
# History:
# 2016-09-24:
# v0.1: Initial release
# 2018-06-19:
# v0.2: py3k-ok
#
# TODO:
# - Colors support
import sys
try:
import weechat
from weechat import WEECHAT_RC_OK
import_ok = True
except ImportError:
print("This script must be run under WeeChat.")
print("Get WeeChat now at: http://www.weechat.org/")
import_ok = False
SCRIPT_NAME = "aformat"
SCRIPT_AUTHOR = "Hairo R. Carela <hairocr8@gmail.com>"
SCRIPT_VERSION = "0.2"
SCRIPT_LICENSE = "WTFPL"
SCRIPT_DESC = ("Alternate way of text formatting, see /help for instructions")
PY3 = sys.version > '3'
class format:
# Special byte sequences, using weechat.color("stuff") had some unwanted
# results, i'll look into it if needed. Colors are unused for now
BOLD = '\x02'
ITALIC = '\x1D'
UNDERLINE = '\x1F'
REVERSE = '\x16'
END = '\x0F'
if PY3:
unichr = chr
def send(buf, text):
weechat.command(buf, "/input send {}".format(text))
else:
def send(buf, text):
weechat.command(buf, "/input send {}".format(text.encode("utf-8")))
def cb_aformat_cmd(data, buf, args):
if not PY3:
args = args.decode("utf-8")
# Get the indexes of the separators (*/_|) in the string
bolds = [i for i, ltr in enumerate(args) if ltr == "*"]
italics = [i for i, ltr in enumerate(args) if ltr == "/"]
underlines = [i for i, ltr in enumerate(args) if ltr == "_"]
reverses = [i for i, ltr in enumerate(args) if ltr == "|"]
if len(bolds) != 0:
for i, v in enumerate(bolds):
if i%2 == 0:
args = args[:v] + format.BOLD + args[v+1:]
else:
args = args[:v] + format.END + args[v+1:]
if len(italics) != 0:
for i, v in enumerate(italics):
if i%2 == 0:
args = args[:v] + format.ITALIC + args[v+1:]
else:
args = args[:v] + format.END + args[v+1:]
if len(underlines) != 0:
for i, v in enumerate(underlines):
if i%2 == 0:
args = args[:v] + format.UNDERLINE + args[v+1:]
else:
args = args[:v] + format.END + args[v+1:]
if len(reverses) != 0:
for i, v in enumerate(reverses):
if i%2 == 0:
args = args[:v] + format.REVERSE + args[v+1:]
else:
args = args[:v] + format.END + args[v+1:]
send(buf, args)
return weechat.WEECHAT_RC_OK
if import_ok and __name__ == "__main__":
weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION,
SCRIPT_LICENSE, SCRIPT_DESC, '', '')
weechat.hook_command("aformat", "Alternate way of text formatting, useful for relays without text formatting features (Glowingbear, WeechatAndroid, etc)",
"text <*/_|> text <*/_|> more text",
" *: bold text\n"
" /: italic text\n"
" _: underlined text\n"
" |: reversed (black on white) text\n\n"
" eg.: typing: /aformat This /must/ be the *work* of an _enemy_ |stand|\n"
" will output: This {0}must{4} be the {1}work{4} of an {2}enemy{4} {3}stand{4}".format(weechat.color("italic"), weechat.color("bold"), weechat.color("underline"), weechat.color("reverse"), weechat.color("reset")),
"", "cb_aformat_cmd", "")

View File

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

View File

@ -32,7 +32,7 @@ clients_purge_delay = 0
compression_level = 6 compression_level = 6
ipv6 = on ipv6 = on
max_clients = 5 max_clients = 5
password = "${sec.data.pass}" password = "${sec.data.relaypass}"
ssl_cert_key = "%h/ssl/relay.pem" ssl_cert_key = "%h/ssl/relay.pem"
ssl_priorities = "NORMAL:-VERS-SSL3.0" ssl_priorities = "NORMAL:-VERS-SSL3.0"
websocket_allowed_origins = "" websocket_allowed_origins = ""

View File

@ -0,0 +1,89 @@
# Copyright (c) 2013 Shawn Smith <ShawnSmith0828@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/>.
def weechat_init
# Register our plugin with WeeChat
Weechat.register("auth",
"Shawn Smith",
"0.3",
"GPL3",
"Automatically authenticate with NickServ using your sasl_username and sasl_password.",
"",
"")
Weechat.hook_command("auth",
"Automatically authenticate with NickServ using your sasl_username and sasl_password.",
"list [server]",
"list: Displays your sasl_username and sasl_password",
"",
"auth_command_cb",
"")
# Grab the hook for notices.
Weechat.hook_signal("*,irc_in_notice", "auth_notice_cb", "")
return Weechat::WEECHAT_RC_OK
end
# The auth command
def auth_command_cb(data, buffer, args)
server = buffer.split(',')[0]
arg = args.split(' ')
# Check to make sure we were given a valid option.
if arg[0] == "list" && arg[1]
server = arg[1]
# Grab the pointers from the config
sasl_username = Weechat.config_get("irc.server.#{server}.sasl_username")
sasl_password = Weechat.config_get("irc.server.#{server}.sasl_password")
# Print the usernames/passwords
Weechat.print("", "[Auth]: sasl_username: #{Weechat.string_eval_expression("#{wee_string(sasl_username)}", {}, {}, {})}")
Weechat.print("", "[Auth]: sasl_password: #{Weechat.string_eval_expression("#{wee_string(sasl_password)}", {}, {}, {})}")
else
Weechat.command("", "/help auth")
end
return Weechat::WEECHAT_RC_OK
end
# The incoming notice.
def auth_notice_cb(data, buffer, args)
# Notice should come from nickserv, otherwise we ignore it.
if /^:NickServ!.+:This nickname is registered/i =~ args
# Get the server that we're on.
server = buffer.split(',')[0]
# Grab the username/passwords if we have them.
sasl_username = Weechat.config_get("irc.server.#{server}.sasl_username")
sasl_password = Weechat.config_get("irc.server.#{server}.sasl_password")
# Prevents us from sending empty passwords.
if sasl_password != nil
Weechat.command("", "/quote -server #{server} PRIVMSG NickServ IDENTIFY #{Weechat.string_eval_expression("#{wee_string(sasl_username)}", {}, {}, {})} #{Weechat.string_eval_expression("#{wee_string(sasl_password)}", {}, {}, {})}")
# Backwards compatibility hack for shitty servers that don't let you use [nick pass]
Weechat.command("", "/quote -server #{server} PRIVMSG NickServ IDENTIFY #{Weechat.string_eval_expression("#{wee_string(sasl_password)}", {}, {}, {})}")
end
end
return Weechat::WEECHAT_RC_OK
end
def wee_string(input)
return Weechat.config_string(input)
end

View File

@ -0,0 +1 @@
../auth.rb

View File

@ -0,0 +1,3 @@
{
}

View File

@ -54,7 +54,7 @@ day_change_message_1date = "-- %a, %d %b %Y --"
day_change_message_2dates = "-- %%a, %%d %%b %%Y (%a, %d %b %Y) --" day_change_message_2dates = "-- %%a, %%d %%b %%Y (%a, %d %b %Y) --"
eat_newline_glitch = off eat_newline_glitch = off
emphasized_attributes = "" emphasized_attributes = ""
highlight = "" highlight = "ben"
highlight_regex = "" highlight_regex = ""
highlight_tags = "" highlight_tags = ""
hotlist_add_conditions = "${away} || ${buffer.num_displayed} == 0" hotlist_add_conditions = "${away} || ${buffer.num_displayed} == 0"
@ -110,7 +110,7 @@ prefix_error = "=!="
prefix_join = "-->" prefix_join = "-->"
prefix_network = "--" prefix_network = "--"
prefix_quit = "<--" prefix_quit = "<--"
prefix_same_nick = "" prefix_same_nick = ""
prefix_suffix = "│" prefix_suffix = "│"
quote_nick_prefix = "<" quote_nick_prefix = "<"
quote_nick_suffix = ">" quote_nick_suffix = ">"
@ -354,6 +354,7 @@ default.window = "3;1;0;0;core;weechat"
default.current = on default.current = on
[notify] [notify]
irc.bitlbee = highlight
irc.darwin = message irc.darwin = message
irc.freenode.##csharp = highlight irc.freenode.##csharp = highlight
irc.freenode.#litepub = highlight irc.freenode.#litepub = highlight