PDA

View Full Version : Disabling MoTD.


Kingly_Krab
11-06-2013, 05:58 PM
Would it be possible to do so? And if so, is my method below the correct way? My reason for disabling this is because I have a much more dynamic custom MoTD and I'd rather it not send this one.


Line 427-443 of worldserver.cpp. - The original code without any modifications.
case ServerOP_Motd:
{
ServerMotd_Struct* smotd = (ServerMotd_Struct*) pack->pBuffer;
EQApplicationPacket *outapp;
outapp = new EQApplicationPacket(OP_MOTD);
char tmp[500] = {0};
sprintf(tmp, "%s", smotd->motd);

outapp->size = strlen(tmp)+1;
outapp->pBuffer = new uchar[outapp->size];
memset(outapp->pBuffer,0,outapp->size);
strcpy((char*)outapp->pBuffer, tmp);

entity_list.QueueClients(0, outapp);
safe_delete(outapp);

break;
}

Line 427-443 of worldserver.cpp. - My proposed way of removal.
case ServerOP_Motd:
{
ServerMotd_Struct* smotd = (ServerMotd_Struct*) pack->pBuffer;
EQApplicationPacket *outapp;
outapp = new EQApplicationPacket(OP_MOTD);
char tmp[500] = {0};
sprintf(tmp, "%s", smotd->motd);

outapp->size = strlen(tmp)+1;
outapp->pBuffer = new uchar[outapp->size];
memset(outapp->pBuffer,0,outapp->size);
strcpy((char*)outapp->pBuffer, tmp);

//entity_list.QueueClients(0, outapp);
safe_delete(outapp);

break;
}

demonstar55
11-06-2013, 06:16 PM
As long as the client doesn't complain about not getting it, you can just comment out all but the break.

Kingly_Krab
11-06-2013, 06:18 PM
As long as the client doesn't complain about not getting it, you can just comment out all but the break.
I will re-compile my server with all of that done and get back to you with it later.

Kingly_Krab
11-06-2013, 08:24 PM
Okay, I re-compiled with that and it didn't get rid of the MoTD. I found another occurrence in zoneserver.cpp. Lines 915-925. My again proposed fix for it, but this time in zoneserver.cpp and worldserver.cpp, not just worldserver.cpp.

case ServerOP_Motd:
{
//if (pack->size != sizeof(ServerMotd_Struct))
{
//zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_Motd. Got: %d, Expected: %d",pack->size,sizeof(ServerMotd_Struct));
//break;
//}
//ServerMotd_Struct* smotd = (ServerMotd_Struct*) pack->pBuffer;
//database.SetVariable("MOTD",smotd->motd);
//this->SendEmoteMessage(smotd->myname, 0, 0, 13, "Updated Motd.");
//zoneserver_list.SendPacket(pack);
break;
}

Kingly_Krab
11-06-2013, 11:08 PM
Even with this removed it still sends the messages, almost as though it's just bypassing this code for some reason. :|

I found the following in client.cpp, I believe this is where it's actually sent, thus why it's bypassing the other. Possibly, commenting this out will remove the sending of the MoTD. (Lines 826 - 841 in client.cpp)
outapp = new EQApplicationPacket(OP_MOTD);
char tmp[500] = {0};
if (database.GetVariable("MOTD", tmp, 500)) {
outapp->size = strlen(tmp)+1;
outapp->pBuffer = new uchar[outapp->size];
memset(outapp->pBuffer,0,outapp->size);
strcpy((char*)outapp->pBuffer, tmp);

} else {
// Null Message of the Day. :)
outapp->size = 1;
outapp->pBuffer = new uchar[outapp->size];
outapp->pBuffer[0] = 0;
}
QueuePacket(outapp);
safe_delete(outapp);