Created
September 14, 2014 16:54
-
-
Save mniip/482db48032ecea47bfad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__module_name__ = "clones" | |
__module_version__ = "0" | |
__module_description__ = "Clone finder" | |
import xchat | |
clones = {} | |
def who_reply(w, we, u): | |
nick = w[7] | |
ident = w[4] | |
host = w[5] | |
if clones.get(host, None) == None: | |
clones[host] = [] | |
clones[host].append((nick, ident)) | |
xchat.hook_server("352", who_reply) | |
def who_end(w, we, u): | |
global clones | |
lines = [] | |
for host in clones: | |
if len(clones[host]) > 1: | |
line = "\x0304\x02[Clones]" | |
for nick, ident in clones[host]: | |
line += "\x0304" + (" " * (17 - len(nick))) + nick + "\x0308!" + ident + (" " * (10 - len(ident))) | |
line += " \x0302::: \x0309" + host | |
lines.append((len(clones[host]), line)) | |
lines.sort(key = lambda l: l[0]) | |
for _, line in lines: | |
xchat.prnt(line) | |
clones = {} | |
xchat.hook_server("315", who_end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment