Skip to content

Commit

Permalink
Handle non-ascii IRC messages
Browse files Browse the repository at this point in the history
  • Loading branch information
singingwolfboy committed Mar 17, 2014
1 parent c0b8bbf commit af8cb99
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions chanlogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def _format_template(tpl, bot, **kwargs):
origin=bot.origin, datetime=dt.isoformat(),
date=dt.date().isoformat(), time=dt.time().isoformat(),
**kwargs
)
) + "\n"


def setup(bot):
Expand Down Expand Up @@ -101,7 +101,7 @@ def log_message(bot, message):
fpath = get_fpath(bot)
with bot.memory['chanlog_locks'][fpath]:
with open(fpath, "a") as f:
f.write(logline + "\n")
f.write(logline.encode('utf-8'))


@willie.module.rule('.*')
Expand All @@ -113,7 +113,7 @@ def log_join(bot, trigger):
fpath = get_fpath(bot, channel=trigger)
with bot.memory['chanlog_locks'][fpath]:
with open(fpath, "a") as f:
f.write(logline + "\n")
f.write(logline.encode('utf-8'))


@willie.module.rule('.*')
Expand All @@ -125,7 +125,7 @@ def log_part(bot, trigger):
fpath = get_fpath(bot, channel=trigger)
with bot.memory['chanlog_locks'][fpath]:
with open(fpath, "a") as f:
f.write(logline + "\n")
f.write(logline.encode('utf-8'))


@willie.module.rule('.*')
Expand All @@ -142,7 +142,7 @@ def log_quit(bot, trigger):
fpath = get_fpath(bot, channel)
with bot.memory['chanlog_locks'][fpath]:
with open(fpath, "a") as f:
f.write(logline + "\n")
f.write(logline.encode('utf-8'))


@willie.module.rule('.*')
Expand All @@ -159,4 +159,4 @@ def log_nick_change(bot, trigger):
fpath = get_fpath(bot, channel)
with bot.memory['chanlog_locks'][fpath]:
with open(fpath, "a") as f:
f.write(logline + "\n")
f.write(logline.encode('utf-8'))

0 comments on commit af8cb99

Please sign in to comment.