- logfile.write(now.strftime(form) + " " + line + "\n")
- logfile.close()
-
- def handle_privmsg(tokens):
-
- def handle_input(msg, target):
-
- def notice(msg):
- line = "NOTICE " + target + " :" + msg
- self.io.send_line(line)
- log(line)
-
- matches = re.findall("(https?://[^\s>]+)", msg)
- for i in range(len(matches)):
- handle_url(matches[i], notice)
- if "!" == msg[0]:
- tokens = msg[1:].split()
- argument = str.join(" ", tokens[1:])
- handle_command(tokens[0], argument, notice, target, self)
- return
- file = open(self.markovfile, "a")
- file.write(msg + "\n")
- file.close()
-
- sender = ""
- for rune in tokens[0]:
- if rune == "!":
- break
- if rune != ":":
- sender += rune
- receiver = ""
- for rune in tokens[2]:
- if rune == "!":
- break
- if rune != ":":
- receiver += rune
- target = sender
- if receiver != self.nickname:
- target = receiver
- msg = str.join(" ", tokens[3:])[1:]
- handle_input(msg, target)
-
- def name_from_join_or_part(tokens):
- token = tokens[0][1:]
- index_cut = token.find("@")
- index_ex = token.find("!")
- if index_ex > 0 and index_ex < index_cut:
- index_cut = index_ex
- return token[:index_cut]
+ write_to_file(self.rawlogdir + now.strftime("%Y-%m-%d") + ".txt",
+ "a", now.strftime(form) + " " + line.line + "\n")
+ to_log = irclog.format_logline(line, self.channel)
+ if to_log != None:
+ write_to_file(self.logdir + now.strftime("%Y-%m-%d") + ".txt",
+ "a", now.strftime(form) + " " + to_log + "\n")
+
+ def handle_privmsg(line):
+
+ def notice(msg):
+ line = "NOTICE " + target + " :" + msg
+ self.io.send_line(line)
+ log(line)
+
+ target = line.sender
+ if line.receiver != self.nickname:
+ target = line.receiver
+ msg = str.join(" ", line.tokens[3:])[1:]
+ matches = re.findall("(https?://[^\s>]+)", msg)
+ for i in range(len(matches)):
+ handle_url(matches[i], notice)
+ if "!" == msg[0]:
+ tokens = msg[1:].split()
+ argument = str.join(" ", tokens[1:])
+ handle_command(tokens[0], argument, notice, target, self)
+ return
+ write_to_file(self.markovfile, "a", msg + "\n")