im.py: a python communications tool

2013-04-05 Thread Jake D
Hey Usenetites!
I have a horrible Python program to allow two people to chat with each
other.  It has horribly any functionality, but it is meant for the
public to work on, not necessarily me.  Anyways, here's a quick FAQ.

What does this do that IRC can't?  What does this do that AIM can't?
--It allows direct communication between two computers, whereas IRC
doesn't.  And AIM and similar services require a username, etc.  This
is made specifically for two users on a network to chat.
What version of Python is this written in?
--Python 2.7.3.
What is the licence?
--It's released under a special FOSS licence.  Here it is:
You can do whatever you want with this program.

Alright, now, here's the code:

#!/usr/bin/python
#An instant messaging program implemented in Python.
#Created on Sunday, December 30, 2012 (long before it's Usenet
publication)

import socket
import sys
import threading

def server_listen():
while True:
r = c.recv(8192)

if r == "\quit":
c.close()
s.close()
sys.exit(0)

print con_addr[0], ": " + r

def client_listen():
while True:
r = s.recv(8192)

if r == "\quit":
s.close()
sys.exit(0)

print sys.argv[1], ": " + r

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

if sys.argv[1] == "-l":
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind(('', 5067))
s.listen(5)
c, con_addr = s.accept()

while True:
r = c.recv(8192)

if r == "\quit":
c.close()
s.close()
sys.exit(0)

print con_addr[0], ": " + r
i = raw_input("You: ")

if i == "\quit":
c.send("\quit")
c.close()
s.close()
sys.exit(0)

c.send(i)

else:
s.connect((socket.gethostbyname(sys.argv[1]), 5067))
print "Chat initiated with " + sys.argv[1] + "!"

while True:
i = raw_input("You: ")

if i == "\quit":
s.send("\quit")
s.close()
sys.exit(0)

s.send(i)
r = s.recv(8192)

if r == "\quit":
s.close()
sys.exit(0)

print sys.argv[1] + ": " + r

I encourage people to modify this code, because really, it sucks.
Enjoy!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: im.py: a python communications tool

2013-04-06 Thread Jake D
On Apr 5, 9:26 pm, Andrew Berg  wrote:
> On 2013.04.05 20:07, Roy Smith wrote:> I know this is off-topic, but I 
> encourage people to NOT invent their own
> > licenses.
>
> Perhaps he meant this existing license:http://www.wtfpl.net/about/
> --
> CPython 3.3.0 | Windows NT 6.2.9200 / FreeBSD 9.1

Yep.  As a matter of fact, I did.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: im.py: a python communications tool

2013-04-06 Thread Jake D
On Apr 5, 8:52 pm, Demian Brecht  wrote:
> Thanks for sharing some of your work with the community. However...
>
> Speaking to the sharing aspect: Why would you post a block of code in an
> email? If you're looking for people to contribute, it would likely be a
> much better idea to post it on github (which was built for collaborative
> work).
>
> As for the code itself, if you /know/ it sucks and are advertising it as
> such, you're not really enticing people to work on it. In its current
> state, it looks like a non-extensible prototype, just poking around to see
> how you can achieve a p2p connectivity, without doing /any/ research
> (supporting modules, etc) or design before just starting to throw something
> together.
>
> I'd venture to say that the chances of actually getting anyone to
> contribute to this in its current state (especially purely over a mailing
> list) would be slim to none. People generally tend to want to see that
> there's actually effort and thought put into something before they put
> /their/ own time into it.

Jeez, harsh.  I __am__ putting this on github, and I __am__ coming
back to this program and working on it now.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: im.py: a python communications tool

2013-04-08 Thread Jake D
On Apr 7, 6:36 pm, Steven D'Aprano  wrote:
> On Sun, 07 Apr 2013 14:47:11 -0700, jhunter.dunefsky wrote:
> > Actually, my current licence can be found here:
> >https://github.com/jhunter-d/im.py/blob/master/LICENCE.  Whaddaya think
> > about this, Useneters?
>
> I think you're looking for a world of pain, when somebody uses your
> software, it breaks something, and they sue you. Your licence currently
> means that you are responsible for the performance of your software.
>
> Why don't you use a recognised, tested, legally-correct licence, like the
> MIT licence, instead of trying to be clever and/or lazy with a one-liner?
>
> E.g.http://opensource.org/licenses/MIT
>
> Software licencing is a solved problem. Do you really think that people
> write three or four paragraph licences because they *like* legal
> boilerplate? Did you imagine that you were the first person to think, "I
> know! I'll write a one-liner telling people they can do whatever they
> want with my software! Nothing can possibly go wrong!"?
>
> Use a known, tested, working solution, and save yourself the pain.
>
> --
> Steven

MIT is actually the best one I've seen so far.  I'm updating LICENCE.
-- 
http://mail.python.org/mailman/listinfo/python-list


New version

2013-04-09 Thread Jake D
There's a new version of im.py out on GitHub:
https://github.com/jhunter-d/im.py/blob/master/im.py
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: im.py: a python communications tool

2013-04-09 Thread Jake D
I just put out a new version of im.py on GitHub.  You can find it
here:
https://github.com/jhunter-d/im.py/blob/master/im.py
-- 
http://mail.python.org/mailman/listinfo/python-list