I would like for someone to help me
a little with my irc client project. People have told me a few times that I
should try studying up on using sockets, asynchat and asynchronous module. I
have done some looking into all of these. The one thing that bothers me is
where should I begin? I have tried reaching other irc client owners but that
proved to be a loss. this is why I would really appreciate it if someone
would be nice enough to help understand what all is need for the connection
to the various irc servers and the implementation of the irc commands.
Also I would like to know what is the difference between a GUI and
Console interface? Which would be better for a irc client?
It is becoming more and more apparent that the use of python within irc
is fading do to the fact that there isn't a client that can run in windows
98- 2000. And I would like to bring some light to this by creating a irc
client with the help of as many people as it takes.
I saw in a book I read a few days ago a python script that was separated
in different parts using comments. Is this a good idea?
Can I actually make just one .py file that will have everything needed to
run the new client? Or will I have to separate each script into different
.py files? For example if I do need to make separate files should it look
something like this?
1) Server.py : this script will contain all information for connecting to
the various server for irc.
2) Gui.py : This is script will contain all information for making the Gui
for the client.
3) Commands.py : This will contain all of the irc commmands need to function
properly.
4) Script.py : This file i'm not so sure what this should contain. But I
would like for this to the file that lets you interact with irc by allowing
you to use python as the main scripting language. Also if possible include
the gui for the script editor as well.
From all the information I mentioned above is it possible for me to start
building? If I have missed anything please feel free to inform me. Also let
me hear your views on this and if you would like to help me in this
contribution to the open source community.
List of references for the beginning:
1. http://www.amk.ca/bookstore/
This site has info on many Python related books. I'd choose one from
here... ;)
(oops, just noticed that the rest of my references are all in German...
Sorry... If you want them anyways, tell me so!)
--
Yours sincerely,
Heiko Wundram
Dear Relfx,
it is true, or does it only appear to me, that you have never programmed
seriously (better: larger projects) in Python (or in any other language)
before? (Your question whether it is better to partition a project into
separate files or not)
Nor had any contact with the basic layer of TCP/IP communication (which the
module asynchat adresses)? (Your question of where to begin with all the
documentation that was offered)
Nor had any contact with the low layer of the IRC protocol (not that what
mIRC offers you)? (You asked it directly)
Nor had any contact with a different OS than Windows 98-2000? (Your question
concerning GUI vs. Non-GUI; Windows is actually always GUI, except for
DOS-mode, which dropped out in 2000 anyway)
Sorry to have to say it that way, but you're missing on all the important
programming principles that are the basis when trying to write a program that
serves as a client for the Internet Relay Chat Network. <wink>
I guess that you want to start to learn programming Python, but why not try
something smaller (and different) for a start?
What I'll try to do here is layout something I did when I started programming
back in the 80's. (I was in primary school back then)
I had started programming an external interface I got for running my
model-train, but I never knew what I did, I just had a big hunk of
documentation that was with the interface and I always kept typing in
commands they listed (used GWBasic back then).
<--- Ad 1-4: That's the situation you are facing now. People sent you lots of
documentation info that you actually don't know how to use because you don't
know about the basics. --->
Well, I wasn't too satisfied with that, I wanted to do something on my own.
But as I didn't know what all those commands were doing, I realized that I
would first have to walk my way up the ladder with something different.
I chose something that I thought would be handy in school, a little program
that would ask me maths-questions like (200/40?) and would wait for an input
and then compare that to the true result. If it matched, it would say 'OK!',
otherwise it would beep and say 'Wrong...'.
Well those were (I think, I wouldn't be able to reproduce them today
anyways... ;)) 10-20 lines of Code in GWBasic, but I knew exactly what they
were doing.
Some days later I expanded the whole thing. I added a loop that would ask a
question at least three times before giving up with 'Wrong...', some days
later again I expanded the whole thing with a scoring system based on the
time it took to answer, some days later again I expanded the whole thing with
a system that would only give you a certain amount of time to answer a
question, etc. etc. etc.
Then in '88 I got MS QuickBasic 4.5. I ported the whole thing (yep, Basic was
incompatible with Basic), and tried to add some fancier text-mode graphics
such as a text-mode banner which could only be viewed well when I put my PC
on slow mode (I had an 80386 SX-16 back then, man was that fast ;))
When in '91 I got access to Turbo C++ 3.0 (a different programming language),
I ported the whole thing to C++. And in time I added support for TurboVision,
that was a text-based GUI-Interface they were shipping along. And I added
DOS-mode sound support using direct writes to the SoundBlaster (yes, direct
hardware programming was still in back then)
Then in '94 I got access to MS C++ 6.0 (I think it was...). And thats when I
did my first step towards GUI-programming, still using the old Windows
<yuckyucky> API. I didn't come far here, btw. It actually stagnated my
programming for three years... ;)
And when in '97 I got access to MS Visual C++ 5.0 (yet a different
programming language), I ported the whole thing and again added support for a
GUI based on the MFC. And I added support for TTS and Voice-Control of the
program using the stuff that they shipped with MS Visual C++ 5.0 Enterprise.
And also in '97 I started with Tcl (and esp. Linux), to which I ported the
whole thing again (of course without all the fancy features of TTS, etc.)
... blablabla
I could continue now, but I think you get the point. Start off small (to
learn the basics), and then always keep adding things on top. You have to
start this way bottom up, only a true genius will succeed top down.
Why not take a small project that might come in handy for you in daily life
(you choose one), then go and buy a good book on Python, and then learn
Python and especially good programming practice step by step by implementing
something like I did above?
Please, please, please, take my advice seriously!
Don't let yourself be disencouraged (and I know its a stony road), but please
start from bottom up! For one you have an actual feeling of success when you
have built a small project, and secondly you feel even more success when you
manage to add a feature to the project.
On another note: I really don't understand why you still keep asking people
in this newsgroup/mailinglist for help, as noone has so far offered help
besides giving you references to documentation, but which you yourself say
don't (yet) mean much to you. I'm also going to give you documentation at the
end, but this documentation is not about anything concerning your IRC-client
project, but rather something general about programming and Python.
And on a third note: I guess people here actually aren't all that fancied by
the idea of having an IRC-client that is scriptable through Python (or
written in Python). It sounds hard, but that's Usenet. People will only get
annoyed when you continue "bugging" them in this fashion. Believe me, I've
had this experience more than once, and it's absolutely no fun to be on
thetarget list of a mail-loop. <wink> ;)
Don't flame me for this message; in my eyes this had to be said. And Relfx
don't let my words discourage you, Python is a way cool programming language
which is easy to learn, and fun to discover. (btw. I'm new to Python too,
started looking into it about 3 Months ago after I felt angry with Perl once
too often... ;))
And if anyone is interested, the little program that I still try to write in
every language I move to is called "KOPF". ("Kopfrechnen" means calculating
in your head in German... ;))
--
Yours sincerely,
Heiko Wundram
Head and founding-member of the "Celler Open Source Gemeinde"
(Celle Open Source Community)
[snip]
Start by
1. Get irc RFC at http://www.efnet.org/docs/efnetfaq.html
2. Read it.
3. Understand it.
4. See example of a small irc bot - silmarill.org/fortuneBot/
5. Make a bot yourself, implementing all irc commands you want.
6. Learn Tkinter - read tkinter python.org tutorial chapter, other online
tutorials and if you still don't understand it, buy a book on it (e.g.
programming python by mark lutz has a chapter on that).
7. Write the client using Tkinter and plain sockets.
OR
7. if you don't like Tkinter looks (I personally don't), get wxPython and
read tutorial(s) on it, look at demos', examples, etc. It's more complex
thank tkinter, but looks better.
--
Cymbaline: intelligent learning mp3 player - python, linux, console.
get it at: cy.silmarill.org
I think irssi now has a cleaner design (Because it is redesigned.)
The code are very simple and clean. But it only runs on linux.