CivPop3 - A simple Pop3 Client for Civilization

Joined
Jan 21, 2006
Messages
737

Attachments

  • Civ4ScreenShot0000.JPG
    Civ4ScreenShot0000.JPG
    104.7 KB · Views: 523
Feedback welcome, especially on how to encrypt the password and fetch new mails automatically.

So far, it's only possible to see the subject and the sender of messages in your inbox. Should I make them readable from withing Civ4?
 
Could you make a way to be able to send messages from inside the game? I think it would be a good way for mod makers to provide quick and easy bug-reporting ability to users without them having to clutter up forums threads with their issues... I've been hoping for something like that for some time.
 
Using the POP3 protocol, you can access most mail servers and check your mails from inside the game.

@Pedro: I'll see if I can add SMTP-functionality, even though I should be working on other stuff... ;)
 
I have quite much to do over the next month, but I might think about enhancing the mod afterwards. I could imagine implementing SMTP and encryption.
 
Is it possible to send mails as well? Like sending your next civ4 pbem turn? ^^
 
A quick update: I have to lay the project on ice again.

I tried several approaches to loop the code in a separate thread, but on a python level, this causes serious issues with Civ4. The game hangs up when you minimize or end it. It might be possible with some C++ tweaks (or by programming the whole thing in C++), but that's way over my head.

I wasn't any more successful at sending mails via python. Since I'm behind a pretty restrictive firewall at my university, I can't connect to external SMTP servers, and without the ability to test the code I write, I can't work on this feature.

There might be a new version in the future, but don't count on it. If anyone else is willing/able to include the features that have been requested, he's welcome to using the code.
 
This is a very interesting project from a python point of view and I've run into some of the same problems you mention. As for the threading thing, I've noticed that Civ seems to run pretty well in windowed mode and doesn't seem to hang much at all when I'm working in other windows. Maybe that functionality can be hijacked somehow.. don't know, just a theory..

On a more practical note, maybe using python threading is the wrong approch. Civ is already looping why not place the loop's code in the onUpdate event? Should give you the same result.

Just some ideas, I liked this project from the moment I saw it and I will try to put in my build que and see what I can do. :)
 
Threading the code that checks for new mails is necessary in case there is a connection error. If you run the code in the main thread, the game would stall for ~30 seconds until the connection attempt times out.

You are right, however, in saying that one could use the main loop to trigger the new thread (which then runs only once and stops until it's triggered again). I tried using a threading.Timer class to do this, but had the same problems as with an indefinitely looping thread.

I could imagine some ugly hack that checks for the current time in every frame and triggers the CivPop code every 300 seconds. Or even better, the updateScreen() function seems to have this functionality already (g_szTimeText and g_iTimeTextCounter). I guess this would solve the looping problem.
 
Alright, a working loop is up and running. I'm using the time.clock() function to trigger the POP3 code. The game now only hangs when you end it while it is trying to connect to a POP3 server that doesn't exist. As soon as it times out (which is after about 30 secs), you can quit. Unsuccessful connection attempts don't affect a running game.

Is is a pretty small update, but it makes using the mod more comfortable. And since I can't work on SMTP functionality any time soon, I'd better upload it than let it rot on my drive.
 
This is some of the most interesting python modding I've seen. I have had alot of fun playing around with your code. I've been using it to send and fetch http from the civ4players site and show the results (players stats) inside civ.

Just bumped the thread to let you know and to remind you of this so maybe you start playing around with it again :)
 
Well, I do have some good news. I escaped the clutches of a restrictive firewall and was able to successfully send an e-mail via python (using GMX). This means that I can now start working on the interface and will be able to provide a send-mail functionality sometime soon.
 
Well, I do have some good news. I escaped the clutches of a restrictive firewall and was able to successfully send an e-mail via python (using GMX). This means that I can now start working on the interface and will be able to provide a send-mail functionality sometime soon.

:wow: :drool: I can't wait!
 
I replaced the PopUp with 'real' screens over the weekend and the inbox works pretty well so far (see screenshot; texts are still missing and there are some references to the unit statistics screens, which I used as base).

This was the easy part. Now, can anyone point me to a good example of an edit box implementation? The necessary functions are in the API (CyGInterfaceScreen.addEditBox or .addEditBoxGFC and so on), but they are neither used in the vanilla code nor did I find them in any mods. And I'd rather understand the code from an example than using a trial-and-error approach.
 
I released a new version in a new thread, since the mod is now called CivMail. The original name was apparently confusing and is no longer accurate for a mod that has both POP3 and SMTP functionality.

Sadly, you still can't send mails with the newest version. While the code to send a mail is implemented, I haven't managed to actually make messages editable in-game. The new version thus only includes a (much) better Inbox and BtS compatibility.
 
Back
Top Bottom