MXP Login issue

Posted by Slakker on Fri 27 Jan 2012 08:17 PM — 2 posts, 13,718 views.

#0
Hey guys :)

First off,
I'm not a complete noob! =P
It's just been a good 10+ years since I've done any mud coding, so I'm really rusty! I've been busy playing the graphic MMOs, and running a raiding guild, but I miss the creativity and detail of my old texted base gaming days. :)
I was suprised to see one of my old snippets still floating around on Samson's smaugfuss site, kinda gave me a warm fuzzy.. LOL

My Setup: I'm running Smaugfuss1.9 on the latest version of Ubuntu. I've got an old laptop acting as a server on my home network. BTW that compiler is SO picky and complains more then my wife does! =P

Issue:
I added the MXP code posted here on the website, and actually got most of it working!... WOOT! The only bug appears to be while logging in I have to enter my name 2x! depending on the client I use. With Mushclient I get this..

What's your name? or create a new Hero type NEW:      
slakker

No such player exists.
Please check your spelling, or type new to start a new player.

Name: 
slakker
Password: 
Reconnecting.


So concluding the issue is in my code and not the client, I have 2 suspects in comm.c

In void new_descriptor( int new_desc ) just before the greetings I've got

 /*
    * MCCP Compression
    */
   write_to_buffer( dnew, (const char *)will_compress2_str, 0 );

   /*
    *telnet negotiation to see if they support MXP
    */
   write_to_buffer( dnew, (const char *)will_mxp_str, 0 );

   /*
    * Send the greeting.



or in void read_from_buffer( DESCRIPTOR_DATA * d ) which I changed because of lots of signed and unsighed char issues.


if ( d->inbuf[i] == (signed char) IAC)
        {
          if (!memcmp(&d->inbuf[i], mxp_do, strlen(mxp_do)))
          {
            i += strlen(mxp_do) - 1;
            turn_on_mxp (d);
            log_string( "client mxp on" );
          }
          else if (!memcmp(&d->inbuf[i], mxp_dont, strlen(mxp_dont)))
          {
            i += strlen(mxp_dont) - 1;
            d->mxp = FALSE;
            log_string( "client mxp off" );
          }
        }
        else if ( d->inbuf[i] == '\b' && k > 0 )
            --k;
        else if ( isascii(d->inbuf[i]) && isprint(d->inbuf[i]) )
            d->incomm[k++] = d->inbuf[i];



I'd appreciate and suggestions on how to solve this.. thanks :)

[Moderator edit] Fixed code inside code tags.
Amended on Sat 28 Jan 2012 09:28 PM by Nick Gammon
#1
Ok figured out the problem. I just needed to move the client checks farther down in read_from_buffer. Works great now expect I've discovered I lose MXP whenever I do a hotboot/copyover, but that should be an easy fix.