Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • weechat/scripts
1 result
Show changes
Commits on Source (3)
Loading
Loading
@@ -22,6 +22,8 @@
#
# History:
#
# 2017-08-29, Alex Xu (Hello71) <alex_y_xu@yahoo.ca>:
# version 0.6: fix escaping of "signal_data"
# 2011-02-13, Sebastien Helleu <flashcode@flashtux.org>:
# version 0.5: use new help format for command arguments
# 2010-05-29, Sebastien Helleu <flashcode@flashtux.org>:
Loading
Loading
@@ -36,7 +38,7 @@
 
use strict;
 
my $version = "0.5";
my $version = "0.6";
my $command_suffix = " &";
 
weechat::register("launcher", "FlashCode <flashcode\@flashtux.org>", $version, "GPL3",
Loading
Loading
@@ -109,9 +111,8 @@ sub signal
my $command = weechat::config_get_plugin("signal.$_[1]");
if ($command ne "")
{
$signal_data =~ s/([\$`"])/\\$1/g;
$signal_data =~ s/\n/ /g;
$command =~ s/\$signal_data/"$signal_data"/g;
$signal_data =~ s/'/'\''/g;
$command =~ s/\$signal_data/'$signal_data'/g;
system($command.$command_suffix);
}
return weechat::WEECHAT_RC_OK;
Loading
Loading
Loading
Loading
@@ -19,6 +19,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# 2017-08-17: nils_2 (freenode.#weechat)
# 1.4.1: fix eval_expression for nicks
# : add evaluation for options
#
# 2017-08-17: nils_2 (freenode.#weechat)
# 1.4 : eval_expression for nicks
# : use irc.server.<servername>.password
# ; add short /help
Loading
Loading
@@ -87,7 +91,7 @@ except Exception:
# -------------------------------[ Constants ]-------------------------------------
SCRIPT_NAME = "keepnick"
SCRIPT_AUTHOR = "nils_2 <weechatter@arcor.de>"
SCRIPT_VERSION = "1.4"
SCRIPT_VERSION = "1.4.1"
SCRIPT_LICENCE = "GPL3"
SCRIPT_DESC = "keep your nick and recover it in case it's occupied"
 
Loading
Loading
@@ -95,9 +99,9 @@ ISON = '/ison %s'
 
OPTIONS = { 'delay' : ('600','delay (in seconds) to look at occupied nick (0 means OFF). It is not recommended to flood the server with /ison requests)'),
'timeout' : ('60','timeout (in seconds) to wait for an answer from server.'),
'serverlist' : ('','comma separated list of servers to look at. Try to register a nickname on server (see: /msg NickServ help).regular expression are allowed (eg. ".*" = matches ALL server,"freen.*" = matches freenode, freenet....)'),
'serverlist' : ('','comma separated list of servers to look at. Try to register a nickname on server (see: /msg NickServ help).regular expression are allowed (eg. ".*" = matches ALL server,"freen.*" = matches freenode, freenet....) (this option is evaluated).'),
'text' : ('Nickstealer left Network: %s!','text that will be displayed if your nick will not be occupied anymore. (\"%s\" is a placeholder for the servername)'),
'nickserv' : ('/msg -server $server NICKSERV IDENTIFY $passwd','Use SASL authentification, if possible. This command will be used to IDENTIFY you on server (following placeholder can be used: \"$server\" for servername; \"$passwd\" for password). You can create an option for every server to store password: \"plugins.var.python.%s.<servername>.password\", otherwise the \"irc.server.<servername>.password\" option will be used.' % SCRIPT_NAME),
'nickserv' : ('/msg -server $server NICKSERV IDENTIFY $passwd','Use SASL authentification, if possible. This command will be used to IDENTIFY you on server (following placeholder can be used: \"$server\" for servername; \"$passwd\" for password). You can create an option for every server to store password: \"plugins.var.python.%s.<servername>.password\", otherwise the \"irc.server.<servername>.password\" option will be used (this option is evaluated).' % SCRIPT_NAME),
'command' : ('/nick %s','This command will be used to rename your nick (\"%s\" will be replaced with your nickname)'),
'debug' : ('off', 'When enabled, will output verbose debugging information during script operation'),
}
Loading
Loading
@@ -124,7 +128,7 @@ def redirect_isonhandler(data, signal, hashtable):
ISON_nicks = [nick.lower() for nick in ISON_nicks.split()]
 
for nick in server_nicks(hashtable['server']):
mynick = string_eval_expression( weechat.info_get('irc_nick',hashtable['server']) )
mynick = weechat.info_get('irc_nick',hashtable['server']) # current nick on server
 
if nick.lower() == mynick.lower():
debug_print("I already have nick %s; not changing" % mynick)
Loading
Loading
@@ -139,14 +143,15 @@ def redirect_isonhandler(data, signal, hashtable):
def server_nicks(servername):
infolist = weechat.infolist_get('irc_server','',servername)
weechat.infolist_next(infolist)
nicks = weechat.infolist_string(infolist, 'nicks')
nicks = string_eval_expression( weechat.infolist_string(infolist, 'nicks') ) # nicks in config
weechat.infolist_free(infolist)
return nicks.split(',')
 
def server_enabled(servername):
serverlist = OPTIONS['serverlist'].split(',')
server_matched = re.search(r"\b({})\b".format("|".join(serverlist)),
servername)
serverlist = string_eval_expression( OPTIONS['serverlist'] ).split(',')
server_matched = re.search(r"\b({})\b".format("|".join(serverlist)),servername)
if servername in serverlist or server_matched:
return True
else:
Loading
Loading
@@ -210,7 +215,7 @@ def grabnick_and_auth(servername, nick):
 
if password != '' and OPTIONS['nickserv'] != '':
# command stored in "keepnick.nickserv" option
t = Template(OPTIONS['nickserv'])
t = Template(string_eval_expression( OPTIONS['nickserv']) )
run_msg = t.safe_substitute(server=servername, passwd=password)
weechat.command('', run_msg)
 
Loading
Loading
Loading
Loading
@@ -35,7 +35,7 @@ require 'singleton'
# Register url-hinter plugin to weechat and do initialization.
#
def weechat_init
Weechat.register('url_hinter', 'Kengo Tateish', '0.3', 'GPL3', 'Open an url in the weechat buffer to type a hint', '', '')
Weechat.register('url_hinter', 'Kengo Tateish', '0.4', 'GPL3', 'Open an url in the weechat buffer to type a hint', '', '')
Weechat.hook_command(
'url_hinter',
'Search url strings, and highlight them, and if you type a hint key, open the url related to hint key.',
Loading
Loading
@@ -372,6 +372,6 @@ class Line
end
 
def urls
remove_color_message.scan(/https?:\/\/[^ \(\)\r\n]*/).uniq
remove_color_message.encode("UTF-8", invalid: :replace, undef: :replace).scan(/https?:\/\/[^ \(\)\r\n]*/).uniq
end
end