Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Consider adding SSL support #3

Open
wants to merge 2 commits into from

6 participants

@bbqsrc

Hey there,

I've added SSL support, and it is a very minor change, so I think it would be beneficial if you merge this into the upstream :)

Thanks.

Brendan Molloy added some commits
@thingles

Thanks for providing this, I just put this in my copy of Phenny. Would really be nice if this was in the main release.

@bbqsrc

Considering how simple the change is, yes, it would be. Does it still apply cleanly to mainline?

@thingles

I downloaded a fresh copy of the tar.bz yesterday and applied these changes to get it to connect to our SSL only server. Worked fine!

@jpglab

Thank you bbqsrc! Works great.

@sbp
Owner

Would you mind squashing the commits so that I can pull it? Thanks!

@myano

I did a git clone on bbqsrc's phenny repository and used the following in the default.py:

host = 'irc.freenode.net'
port = 7000
ssl = True

and phenny disconnects with:

Connecting to irc.freenode.net:7000... connected!
Closed!
Warning: Disconnected. Reconnecting in 20 seconds...
@deed02392

I'm afraid this doesn't work for me either. Same error as above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 12, 2010
  1. Add SSL support

    Brendan Molloy authored
  2. Add SSL support (correctly, this time.)

    Brendan Molloy authored
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 4 deletions.
  1. +1 −1  __init__.py
  2. +6 −3 irc.py
  3. +5 −0 phenny
View
2  __init__.py
@@ -34,7 +34,7 @@ def run_phenny(config):
def connect(config):
p = bot.Phenny(config)
- p.run(config.host, config.port)
+ p.run(config.host, config.port, config.ssl)
try: Watcher()
except Exception, e:
View
9 irc.py
@@ -64,15 +64,18 @@ def safe(input):
self.__write(args, text)
except Exception, e: pass
- def run(self, host, port=6667):
- self.initiate_connect(host, port)
+ def run(self, host, port=6667, ssl=False):
+ self.initiate_connect(host, port, ssl)
- def initiate_connect(self, host, port):
+ def initiate_connect(self, host, port, ssl):
if self.verbose:
message = 'Connecting to %s:%s...' % (host, port)
print >> sys.stderr, message,
self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
self.connect((host, port))
+ if ssl:
+ import ssl
+ self.socket = ssl.wrap_socket(self.socket)
try: asyncore.loop()
except KeyboardInterrupt:
sys.exit()
View
5 phenny
@@ -27,6 +27,8 @@ def create_default_config(fn):
print >> f, trim("""\
nick = 'phenny'
host = 'irc.example.net'
+ port = 6667
+ ssl = False
channels = ['#example', '#test']
owner = 'yournickname'
@@ -135,6 +137,9 @@ def main(argv=None):
if not hasattr(module, 'port'):
module.port = 6667
+ if not hasattr(module, 'ssl'):
+ module.ssl = False
+
if not hasattr(module, 'password'):
module.password = None
Something went wrong with that request. Please try again.