Skip to content
This repository has been archived by the owner on May 26, 2018. It is now read-only.

Commit

Permalink
Refixing indentation, adding option to force proper regex form
Browse files Browse the repository at this point in the history
  • Loading branch information
keeperofdakeys committed Nov 29, 2014
1 parent 9725826 commit 1720057
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
10 changes: 6 additions & 4 deletions ircasync.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
import re, socket, asyncore, asynchat
from datetime import datetime

import sys
# A horrible hack - reload sys so we have access to semi-private setdefaultencoding. Not required for python3.
reload(sys)
sys.setdefaultencoding('utf-8')

#RFC 2811: Internet Relay Chat: Client Protocol
#2.3 Messages
# http://www.valinor.sorcery.net/docs/rfc2812/2.3-messages.html
Expand Down Expand Up @@ -302,7 +307,7 @@ def rx_msg(self, args, text, origin):
def start_channels(self, chans):
self._startChannels = chans
#self.bind(self._welcome_join, RPL_WELCOME)

def _welcome_join(self, event, m):
for chan in self._startChannels:
self.todo([JOIN, chan])
Expand Down Expand Up @@ -366,9 +371,6 @@ def chanAddr(host, port, chan):
return "irc://%s%s/%s" % (host, portPart, chanPart)

def debug(*args):
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
sys.stderr.write("DEBUG: ")
for a in args:
sys.stderr.write(str(a))
Expand Down
7 changes: 5 additions & 2 deletions regexbot.example.ini
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,15 @@ max_messsage_size = 200
; Enables the translate feature, used by y/chars/replace_chars/. This replaces a
; char in chars with the respective char in replace_chars. Warning, this may not
; work well for strings with unicode.
translate_enabled = on
translate_enabled = off

; Enables reconnect on connection loss. This is per-socket, so as a consequence,
; the bot will reconnect to channels that it may have previously been kicked from.
; (Obviously this won't affect bans).
reconnect_to_server = on
reconnect_to_server = off

; Force regex that don't end in a / to be treated as an error.
force_ending_slash = on

[ignore]
; Ignore list. Just pop in any "key", and the value is the regular expression
Expand Down

0 comments on commit 1720057

Please sign in to comment.