Here are the changes I made:
- Created CommandBlockManager - people who are familiar with the code know that Simon (original author) created a cool class called ResponseBlockManager that puts the response from the LJ server in a convienient hashtable. I decided to take that and do the same thing for commands sent to the server. This class manages the name/value pairs that get sent to the server, and centralizes the memory management of these pairs.
It works like this:
CommandBlockManager *man = new CommandBlockManager();
man->SetValue( "username", "foobie" );
man->SetValue( "password", "pencil" );
man->SetValue( "mode", "login" );
SendCommand( man->GetCommandBlock() );
And the GetCommandBlock generates the string:
Since this makes the code so much cleaner I am hoping this eliminates all of the problems people have had communicating with the server... (note the word 'hope' :P)
- Account Manager Fixed (finally!!) - I don't know if it was my code, or simon's code, but there was a sizeof() where there should have been a strlen(). No finger pointing necessary, it is fixed now. Honestly, I can't believe this didn't cause it to crash all the time. :)
- Tons of little bugs fixed - Found a bunch of memory leaks, off-by-one errors, and the like. Now that this code is moving more towards my style from Simon's, and I am getting more intimate with all of it, I am seeing lots of things that are wrong with it, both bugs that were there when I picked up the code and bugs I introduced out of negligence or ignorance of the codebase.