# -*- coding: utf-8 -*- # # Forcenick v1.1 - forces your original nickname # Copyright (C) 2011 Alexander Duscheleit # # Based on forcenick.rb Copyright (C) 2007 Pavel Shevchuk # http://www.weechat.org/scripts/source/old/forcenick.rb.html # 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, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """Forces your original nickname, wipes out ghosts and nick stealers""" import weechat as w SCRIPT_NAME = "forcenick" SCRIPT_AUTHOR = "Alexander Duscheleit" SCRIPT_VERSION = "1.4" SCRIPT_LICENSE = "GPL3" SCRIPT_DESC = "Forces your original nickname, wipes out ghosts and nick stealers" if w.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE, SCRIPT_DESC, '', ''): w.hook_signal("irc_server_connected", SCRIPT_NAME, "") def forcenick(data, signal, server_name): il = w.infolist_get("irc_server", "", server_name) sbuffer = w.buffer_search("irc", server_name + "#weechat") if w.infolist_next(il): cur_nick = w.infolist_string(il, 'nick') nicks = w.infolist_string(il, 'nicks') forced_nick = nicks.split(',')[0] password = w.infolist_string(il, 'password') w.infolist_free(il) if (password and cur_nick != forced_nick): w.command(sbuffer, "/msg nickserv ghost %s %s" % (forced_nick, password)) w.command(sbuffer, "/nick %s" % (forced_nick)) w.command(sbuffer, "/msg nickserv identify %s" % (password)) return w.WEECHAT_RC_OK