Skip to content

Instantly share code, notes, and snippets.

@mniip
Created September 14, 2014 16:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mniip/482db48032ecea47bfad to your computer and use it in GitHub Desktop.
Save mniip/482db48032ecea47bfad to your computer and use it in GitHub Desktop.
__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