Browse Source

ssl support

master
jcao219 13 years ago
parent
commit
1f01034a5a
  1. 3
      botconfig.py.example
  2. 5
      oyoyo/client.py
  3. 1
      wolfbot.py

3
botconfig.py.example

@ -1,13 +1,14 @@
PASS = "my_nickserv_pass" PASS = "my_nickserv_pass"
CHANNEL = "#mywolfgame" CHANNEL = "#mywolfgame"
HOST = "irc.freenode.net" HOST = "irc.freenode.net"
PORT = 6667 # SSL not supported yet PORT = 6667
USERNAME = "" # for authentication, can be left blank if same as NICK USERNAME = "" # for authentication, can be left blank if same as NICK
NICK = "mywolfbot" NICK = "mywolfbot"
CMD_CHAR = "!" CMD_CHAR = "!"
CHANGING_HOST_QUIT_MESSAGE = "Changing host" CHANGING_HOST_QUIT_MESSAGE = "Changing host"
SASL_AUTHENTICATION = False # put account name in USERNAME ^ if different from nick SASL_AUTHENTICATION = False # put account name in USERNAME ^ if different from nick
USE_SSL = False
DISABLE_DEBUG_MODE = False # Entirely disable debug mode DISABLE_DEBUG_MODE = False # Entirely disable debug mode
IGNORE_HIDDEN_COMMANDS = True # Ignore commands sent to @#channel or +#channel IGNORE_HIDDEN_COMMANDS = True # Ignore commands sent to @#channel or +#channel
ALLOW_NOTICE_COMMANDS = False # allow /notice #channel !command to be interpreted as a command ALLOW_NOTICE_COMMANDS = False # allow /notice #channel !command to be interpreted as a command

5
oyoyo/client.py

@ -20,6 +20,7 @@ import time
import threading import threading
import traceback import traceback
import sys import sys
import ssl
from oyoyo.parse import parse_raw_irc_command from oyoyo.parse import parse_raw_irc_command
@ -108,6 +109,7 @@ class IRCClient(object):
self.connect_cb = None self.connect_cb = None
self.blocking = True self.blocking = True
self.sasl_auth = False self.sasl_auth = False
self.use_ssl = False
self.lock = threading.RLock() self.lock = threading.RLock()
self.tokenbucket = TokenBucket(23, 1.73) self.tokenbucket = TokenBucket(23, 1.73)
@ -115,6 +117,9 @@ class IRCClient(object):
self.__dict__.update(kwargs) self.__dict__.update(kwargs)
self.command_handler = cmd_handler self.command_handler = cmd_handler
if self.use_ssl:
self.socket = ssl.wrap_socket(self.socket)
self._end = 0 self._end = 0
def send(self, *args, **kwargs): def send(self, *args, **kwargs):

1
wolfbot.py

@ -52,6 +52,7 @@ def main():
password=botconfig.PASS, password=botconfig.PASS,
nickname=botconfig.NICK, nickname=botconfig.NICK,
sasl_auth=botconfig.SASL_AUTHENTICATION, sasl_auth=botconfig.SASL_AUTHENTICATION,
use_ssl=botconfig.USE_SSL,
connect_cb=modules.common.connect_callback connect_cb=modules.common.connect_callback
) )
cli.mainLoop() cli.mainLoop()

Loading…
Cancel
Save