Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create LICENSE #34

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
3ac42a7
Restructure the configuration file
sfan5 Feb 25, 2014
2be068b
Add SSL support
sfan5 Feb 25, 2014
99262cf
Add proper .gitgnore
sfan5 Feb 25, 2014
98c2759
Use hostmasks instead of nicknames
sfan5 Feb 25, 2014
b697fbe
Remove optional modules
sfan5 Feb 25, 2014
ff0a483
Fix things..
sfan5 Feb 25, 2014
7b58e66
SSL is a nightmare to debug
sfan5 Feb 25, 2014
db55f94
Export match_hostmask method in the phenny object
sfan5 Jun 21, 2014
2a188e5
Whitespace fixes
sfan5 Jun 21, 2014
9a2aabc
Forward hostmask to command handlers
sfan5 Jun 22, 2014
9bf057d
Add hooking functionality
sfan5 Jun 22, 2014
4945919
Change some stuff in the config
sfan5 Jun 22, 2014
1e046e6
Add 'nohook' function attribute
sfan5 Jun 22, 2014
6eb3e32
Add variable exporting
sfan5 Jul 19, 2014
9c888a6
Fix default config file
sfan5 Jul 19, 2014
834f7d3
Make variable exporting work
sfan5 Jul 19, 2014
8c7ba18
Fix hooks
sfan5 Jul 19, 2014
362f6b7
↪ Python 3
sfan5 Jul 20, 2014
29473ce
Don't crash on receiving invalid UTF-8
sfan5 Jul 20, 2014
c1b3bae
Don't crash on trying to send invalid UTF-8 either
sfan5 Jul 20, 2014
f725aaa
Don't crash if there is an exception in a handler not initiated by an
sfan5 Jul 23, 2014
8566474
Fix wrong encoding of post data in web.py
sfan5 Jul 24, 2014
014d719
Update some important modules to Python 3
sfan5 Aug 26, 2014
6fb19c6
Prevent escaping command prefix multiple times when using reload.py
sfan5 Oct 24, 2014
22f3025
Add LICENSE
asl97 Sep 26, 2015
807b8ef
Fix default prefix
asl97 Sep 26, 2015
cc64732
Use requests and quote_plus
asl97 Sep 26, 2015
e487ad0
Remove urllib
asl97 Sep 26, 2015
82833ca
Fix amount in web.get
asl97 Sep 26, 2015
0b9901a
Remove newline in middle of file
asl97 Sep 26, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*~
*.py[co]
__pycache__
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from http://inamidst.com/phenny/:

Eiffel Forum License, version 2

1. Permission is hereby granted to use, copy, modify and/or
distribute this package, provided that:
* copyright notices are retained unchanged,
* any distribution of this package, whether modified or not,
includes this license text.
2. Permission is hereby also granted to distribute binary programs
which depend on this package. If the binary program depends on a
modified version of this package, you are encouraged to publicly
release the modified version of this package.

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT WARRANTY. ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE TO ANY PARTY FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THIS PACKAGE.
2 changes: 1 addition & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ Installation &c.

Enjoy!

--
--
Sean B. Palmer, http://inamidst.com/sbp/
31 changes: 15 additions & 16 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
import sys, os, time, threading, signal
import bot

class Watcher(object):
class Watcher(object):
# Cf. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496735
def __init__(self):
self.child = os.fork()
if self.child != 0:
if self.child != 0:
self.watch()

def watch(self):
Expand All @@ -27,36 +27,35 @@ def kill(self):
try: os.kill(self.child, signal.SIGKILL)
except OSError: pass

def run_phenny(config):
if hasattr(config, 'delay'):
def run_phenny(config):
if hasattr(config, 'delay'):
delay = config.delay
else: delay = 20

def connect(config):
def connect(config):
p = bot.Phenny(config)
p.run(config.host, config.port)

try: Watcher()
except Exception, e:
print >> sys.stderr, 'Warning:', e, '(in __init__.py)'
except Exception as e:
print('Warning:', e, '(in __init__.py)', file=sys.stderr)

while True:
while True:
try: connect(config)
except KeyboardInterrupt:
except KeyboardInterrupt:
sys.exit()

if not isinstance(delay, int):
if not isinstance(delay, int):
break

warning = 'Warning: Disconnected. Reconnecting in %s seconds...' % delay
print >> sys.stderr, warning
print('Warning: Disconnected. Reconnecting in %s seconds...' % delay, file=sys.stderr)
time.sleep(delay)

def run(config):
def run(config):
t = threading.Thread(target=run_phenny, args=(config,))
if hasattr(t, 'run'):
if hasattr(t, 'run'):
t.run()
else: t.start()

if __name__ == '__main__':
print __doc__
if __name__ == '__main__':
print(__doc__)
Loading