<commit_before>"""
whois.py - Retrieve WHOIS information on a user and show to the channel.
Author: <NAME> http://embolalia.net
Phenny (About): http://inamidst.com/phenny/
"""
from time import sleep
import re
whois, got318 = False, False
nick, host, rl, chans, idle, signon = None, None, None, None, None, None

def sendwhois(phenny, input):
    global whois, got318, nick, host, rl, chans, idle, signon
    whois = True
    phenny.write(['WHOIS'], input.group(2)) #A whois needs a 2nd parameter to get the signon time... name+" "+name doesn't work.

    while not got318: #Wait until event 318 (End of /WHOIS list.)
        sleep(0.5)

    msg1 = '[WHOIS] Nick: ' + str(nick) + ' Host: ' + str(host) + \
           ' Real name: ' + str(rl)
    msg2 = str(nick) + ' is on the channels: ' + str(chans)
    phenny.say(msg1)
    phenny.say(msg2)
    #phenny.say(nick + ' has been idle ' + idle + ', signed on ' + signon)

    #reset variables.
    whois, got318 = False, False
    nick, host, rl, chans, idle, signon = None, None, None, None, None, None
sendwhois.commands = ['whois']

def whois311(phenny, input):
    global nick, host, rl, whois
    if whois:
        raw = re.match('\S+ 311 \S+ (\S+) (\S+) (\S+) (\S+) :(\S+)', \
                        phenny.raw)
        nick = raw.group(1)
        host = raw.group(2) + '@' + raw.group(3)
        rl = raw.group(5)
    debug = {}
    debug["whois"] = whois
    debug["phenny.raw"] = phenny.raw
    debug["raw"] = raw
    debug["nick"] = nick
    debug["host"] = host
    debug["rl"] = rl
    debug["devchan"] = input.devchan
    phenny.msg("#Embo", "[DEBUGMSG](311 whois reutnr)"+str(debug))

whois311.event = '311'
whois311.rule = '.*'

def whois319(phenny, input):
    print input.bytes
    print input.match
    print input.event
    print input.args
    print input
    if whois:
        global chans
        chans = input.group(1)
whois319.event = '319'
whois319.rule = '(.*)'

"""
#Not sure what's going on with this...
def whois317(phenny, input):<commit_msg>Removing debug messages, forever (hopefully) fixing Issue #2<commit_after>"""
whois.py - Retrieve WHOIS information on a user and show to the channel.
Author: <NAME> http://embolalia.net
Phenny (About): http://inamidst.com/phenny/
"""
from time import sleep
import re
whois, got318 = False, False
nick, host, rl, chans, idle, signon = None, None, None, None, None, None

def sendwhois(phenny, input):
    global whois, got318, nick, host, rl, chans, idle, signon
    whois = True
    phenny.write(['WHOIS'], input.group(2)) #A whois needs a 2nd parameter to get the signon time... name+" "+name doesn't work.

    while not got318: #Wait until event 318 (End of /WHOIS list.)
        sleep(0.5)

    msg1 = '[WHOIS] Nick: ' + str(nick) + ' Host: ' + str(host) + \
           ' Real name: ' + str(rl)
    msg2 = str(nick) + ' is on the channels: ' + str(chans)
    phenny.say(msg1)
    phenny.say(msg2)
    #phenny.say(nick + ' has been idle ' + idle + ', signed on ' + signon)

    #reset variables.
    whois, got318 = False, False
    nick, host, rl, chans, idle, signon = None, None, None, None, None, None
sendwhois.commands = ['whois']

def whois311(phenny, input):
    global nick, host, rl, whois
    if whois:
        raw = re.match('\S+ 311 \S+ (\S+) (\S+) (\S+) (\S+) :(\S+)', \
                        phenny.raw)
        nick = raw.group(1)
        host = raw.group(2) + '@' + raw.group(3)
        rl = raw.group(5)

whois311.event = '311'
whois311.rule = '.*'

def whois319(phenny, input):
    print input.bytes
    print input.match
    print input.event
    print input.args
    print input
    if whois:
        global chans
        chans = input.group(1)
whois319.event = '319'
whois319.rule = '(.*)'

"""
#Not sure what's going on with this...
def whois317(phenny, input):
{'fraction_non_alphanumeric': 0.15934065934065933, 'fraction_numerical': 0.03139717425431711, 'mean_word_length': 2.7407045009784734, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '459160', 'n_tokens_mistral': 1490, 'n_tokens_neox': 1373, 'n_words': 409}