mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 23:01:30 +00:00
Convert 'UCS' debugging _log to logger.LogDebugType
This commit is contained in:
parent
f26f49c2a1
commit
40d32fc1e5
@ -82,6 +82,7 @@ static const char* LogCategoryName[EQEmuLogSys::LogCategory::MaxCategoryID] = {
|
|||||||
"Doors",
|
"Doors",
|
||||||
"Guild",
|
"Guild",
|
||||||
"Inventory",
|
"Inventory",
|
||||||
|
"Launcher",
|
||||||
"Netcode",
|
"Netcode",
|
||||||
"Object",
|
"Object",
|
||||||
"Rules",
|
"Rules",
|
||||||
|
|||||||
@ -59,6 +59,7 @@ public:
|
|||||||
Doors,
|
Doors,
|
||||||
Guilds,
|
Guilds,
|
||||||
Inventory,
|
Inventory,
|
||||||
|
Launcher,
|
||||||
Netcode,
|
Netcode,
|
||||||
Object,
|
Object,
|
||||||
Rules,
|
Rules,
|
||||||
|
|||||||
@ -17,10 +17,11 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "../common/eqemu_logsys.h"
|
||||||
|
#include "../common/string_util.h"
|
||||||
#include "chatchannel.h"
|
#include "chatchannel.h"
|
||||||
#include "clientlist.h"
|
#include "clientlist.h"
|
||||||
#include "database.h"
|
#include "database.h"
|
||||||
#include "../common/string_util.h"
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
extern Database database;
|
extern Database database;
|
||||||
@ -41,7 +42,7 @@ ChatChannel::ChatChannel(std::string inName, std::string inOwner, std::string in
|
|||||||
|
|
||||||
Moderated = false;
|
Moderated = false;
|
||||||
|
|
||||||
_log(UCS__TRACE, "New ChatChannel created: Name: [%s], Owner: [%s], Password: [%s], MinStatus: %i",
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "New ChatChannel created: Name: [%s], Owner: [%s], Password: [%s], MinStatus: %i",
|
||||||
Name.c_str(), Owner.c_str(), Password.c_str(), MinimumStatus);
|
Name.c_str(), Owner.c_str(), Password.c_str(), MinimumStatus);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -148,7 +149,7 @@ void ChatChannelList::SendAllChannels(Client *c) {
|
|||||||
|
|
||||||
void ChatChannelList::RemoveChannel(ChatChannel *Channel) {
|
void ChatChannelList::RemoveChannel(ChatChannel *Channel) {
|
||||||
|
|
||||||
_log(UCS__TRACE, "RemoveChannel(%s)", Channel->GetName().c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "RemoveChannel(%s)", Channel->GetName().c_str());
|
||||||
|
|
||||||
LinkedListIterator<ChatChannel*> iterator(ChatChannels);
|
LinkedListIterator<ChatChannel*> iterator(ChatChannels);
|
||||||
|
|
||||||
@ -169,7 +170,7 @@ void ChatChannelList::RemoveChannel(ChatChannel *Channel) {
|
|||||||
|
|
||||||
void ChatChannelList::RemoveAllChannels() {
|
void ChatChannelList::RemoveAllChannels() {
|
||||||
|
|
||||||
_log(UCS__TRACE, "RemoveAllChannels");
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "RemoveAllChannels");
|
||||||
|
|
||||||
LinkedListIterator<ChatChannel*> iterator(ChatChannels);
|
LinkedListIterator<ChatChannel*> iterator(ChatChannels);
|
||||||
|
|
||||||
@ -227,7 +228,7 @@ void ChatChannel::AddClient(Client *c) {
|
|||||||
|
|
||||||
if(IsClientInChannel(c)) {
|
if(IsClientInChannel(c)) {
|
||||||
|
|
||||||
_log(UCS__ERROR, "Client %s already in channel %s", c->GetName().c_str(), GetName().c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client %s already in channel %s", c->GetName().c_str(), GetName().c_str());
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -236,7 +237,7 @@ void ChatChannel::AddClient(Client *c) {
|
|||||||
|
|
||||||
int AccountStatus = c->GetAccountStatus();
|
int AccountStatus = c->GetAccountStatus();
|
||||||
|
|
||||||
_log(UCS__TRACE, "Adding %s to channel %s", c->GetName().c_str(), Name.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Adding %s to channel %s", c->GetName().c_str(), Name.c_str());
|
||||||
|
|
||||||
LinkedListIterator<Client*> iterator(ClientsInChannel);
|
LinkedListIterator<Client*> iterator(ClientsInChannel);
|
||||||
|
|
||||||
@ -261,7 +262,7 @@ bool ChatChannel::RemoveClient(Client *c) {
|
|||||||
|
|
||||||
if(!c) return false;
|
if(!c) return false;
|
||||||
|
|
||||||
_log(UCS__TRACE, "RemoveClient %s from channel %s", c->GetName().c_str(), GetName().c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "RemoveClient %s from channel %s", c->GetName().c_str(), GetName().c_str());
|
||||||
|
|
||||||
bool HideMe = c->GetHideMe();
|
bool HideMe = c->GetHideMe();
|
||||||
|
|
||||||
@ -298,7 +299,7 @@ bool ChatChannel::RemoveClient(Client *c) {
|
|||||||
if((Password.length() == 0) || (RuleI(Channels, DeleteTimer) == 0))
|
if((Password.length() == 0) || (RuleI(Channels, DeleteTimer) == 0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
_log(UCS__TRACE, "Starting delete timer for empty password protected channel %s", Name.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Starting delete timer for empty password protected channel %s", Name.c_str());
|
||||||
|
|
||||||
DeleteTimer.Start(RuleI(Channels, DeleteTimer) * 60000);
|
DeleteTimer.Start(RuleI(Channels, DeleteTimer) * 60000);
|
||||||
}
|
}
|
||||||
@ -396,7 +397,7 @@ void ChatChannel::SendMessageToChannel(std::string Message, Client* Sender) {
|
|||||||
|
|
||||||
if(ChannelClient)
|
if(ChannelClient)
|
||||||
{
|
{
|
||||||
_log(UCS__TRACE, "Sending message to %s from %s",
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Sending message to %s from %s",
|
||||||
ChannelClient->GetName().c_str(), Sender->GetName().c_str());
|
ChannelClient->GetName().c_str(), Sender->GetName().c_str());
|
||||||
ChannelClient->SendChannelMessage(Name, Message, Sender);
|
ChannelClient->SendChannelMessage(Name, Message, Sender);
|
||||||
}
|
}
|
||||||
@ -478,7 +479,7 @@ ChatChannel *ChatChannelList::AddClientToChannel(std::string ChannelName, Client
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
_log(UCS__TRACE, "AddClient to channel [%s] with password [%s]", NormalisedName.c_str(), Password.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "AddClient to channel [%s] with password [%s]", NormalisedName.c_str(), Password.c_str());
|
||||||
|
|
||||||
ChatChannel *RequiredChannel = FindChannel(NormalisedName);
|
ChatChannel *RequiredChannel = FindChannel(NormalisedName);
|
||||||
|
|
||||||
@ -554,7 +555,7 @@ void ChatChannelList::Process() {
|
|||||||
|
|
||||||
if(CurrentChannel && CurrentChannel->ReadyToDelete()) {
|
if(CurrentChannel && CurrentChannel->ReadyToDelete()) {
|
||||||
|
|
||||||
_log(UCS__TRACE, "Empty temporary password protected channel %s being destroyed.",
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Empty temporary password protected channel %s being destroyed.",
|
||||||
CurrentChannel->GetName().c_str());
|
CurrentChannel->GetName().c_str());
|
||||||
|
|
||||||
RemoveChannel(CurrentChannel);
|
RemoveChannel(CurrentChannel);
|
||||||
@ -571,7 +572,7 @@ void ChatChannel::AddInvitee(std::string Invitee) {
|
|||||||
|
|
||||||
Invitees.push_back(Invitee);
|
Invitees.push_back(Invitee);
|
||||||
|
|
||||||
_log(UCS__TRACE, "Added %s as invitee to channel %s", Invitee.c_str(), Name.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added %s as invitee to channel %s", Invitee.c_str(), Name.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -586,7 +587,7 @@ void ChatChannel::RemoveInvitee(std::string Invitee) {
|
|||||||
|
|
||||||
Invitees.erase(Iterator);
|
Invitees.erase(Iterator);
|
||||||
|
|
||||||
_log(UCS__TRACE, "Removed %s as invitee to channel %s", Invitee.c_str(), Name.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed %s as invitee to channel %s", Invitee.c_str(), Name.c_str());
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -612,7 +613,7 @@ void ChatChannel::AddModerator(std::string Moderator) {
|
|||||||
|
|
||||||
Moderators.push_back(Moderator);
|
Moderators.push_back(Moderator);
|
||||||
|
|
||||||
_log(UCS__TRACE, "Added %s as moderator to channel %s", Moderator.c_str(), Name.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added %s as moderator to channel %s", Moderator.c_str(), Name.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -627,7 +628,7 @@ void ChatChannel::RemoveModerator(std::string Moderator) {
|
|||||||
|
|
||||||
Moderators.erase(Iterator);
|
Moderators.erase(Iterator);
|
||||||
|
|
||||||
_log(UCS__TRACE, "Removed %s as moderator to channel %s", Moderator.c_str(), Name.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed %s as moderator to channel %s", Moderator.c_str(), Name.c_str());
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -653,7 +654,7 @@ void ChatChannel::AddVoice(std::string inVoiced) {
|
|||||||
|
|
||||||
Voiced.push_back(inVoiced);
|
Voiced.push_back(inVoiced);
|
||||||
|
|
||||||
_log(UCS__TRACE, "Added %s as voiced to channel %s", inVoiced.c_str(), Name.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added %s as voiced to channel %s", inVoiced.c_str(), Name.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -668,7 +669,7 @@ void ChatChannel::RemoveVoice(std::string inVoiced) {
|
|||||||
|
|
||||||
Voiced.erase(Iterator);
|
Voiced.erase(Iterator);
|
||||||
|
|
||||||
_log(UCS__TRACE, "Removed %s as voiced to channel %s", inVoiced.c_str(), Name.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed %s as voiced to channel %s", inVoiced.c_str(), Name.c_str());
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "../common/debug.h"
|
#include "../common/debug.h"
|
||||||
#include "../common/string_util.h"
|
#include "../common/string_util.h"
|
||||||
|
#include "../common/eqemu_logsys.h"
|
||||||
|
|
||||||
#include "clientlist.h"
|
#include "clientlist.h"
|
||||||
#include "database.h"
|
#include "database.h"
|
||||||
@ -235,7 +236,7 @@ std::vector<std::string> ParseRecipients(std::string RecipientString) {
|
|||||||
|
|
||||||
static void ProcessMailTo(Client *c, std::string MailMessage) {
|
static void ProcessMailTo(Client *c, std::string MailMessage) {
|
||||||
|
|
||||||
_log(UCS__TRACE, "MAILTO: From %s, %s", c->MailBoxName().c_str(), MailMessage.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MAILTO: From %s, %s", c->MailBoxName().c_str(), MailMessage.c_str());
|
||||||
|
|
||||||
std::vector<std::string> Recipients;
|
std::vector<std::string> Recipients;
|
||||||
|
|
||||||
@ -304,7 +305,7 @@ static void ProcessMailTo(Client *c, std::string MailMessage) {
|
|||||||
|
|
||||||
if (!database.SendMail(Recipient, c->MailBoxName(), Subject, Body, RecipientsString)) {
|
if (!database.SendMail(Recipient, c->MailBoxName(), Subject, Body, RecipientsString)) {
|
||||||
|
|
||||||
_log(UCS__ERROR, "Failed in SendMail(%s, %s, %s, %s)", Recipient.c_str(),
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Failed in SendMail(%s, %s, %s, %s)", Recipient.c_str(),
|
||||||
c->MailBoxName().c_str(), Subject.c_str(), RecipientsString.c_str());
|
c->MailBoxName().c_str(), Subject.c_str(), RecipientsString.c_str());
|
||||||
|
|
||||||
int PacketLength = 10 + Recipient.length() + Subject.length();
|
int PacketLength = 10 + Recipient.length() + Subject.length();
|
||||||
@ -399,7 +400,7 @@ static void ProcessSetMessageStatus(std::string SetMessageCommand) {
|
|||||||
|
|
||||||
static void ProcessCommandBuddy(Client *c, std::string Buddy) {
|
static void ProcessCommandBuddy(Client *c, std::string Buddy) {
|
||||||
|
|
||||||
_log(UCS__TRACE, "Received buddy command with parameters %s", Buddy.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received buddy command with parameters %s", Buddy.c_str());
|
||||||
c->GeneralChannelMessage("Buddy list modified");
|
c->GeneralChannelMessage("Buddy list modified");
|
||||||
|
|
||||||
uint8 SubAction = 1;
|
uint8 SubAction = 1;
|
||||||
@ -429,7 +430,7 @@ static void ProcessCommandBuddy(Client *c, std::string Buddy) {
|
|||||||
|
|
||||||
static void ProcessCommandIgnore(Client *c, std::string Ignoree) {
|
static void ProcessCommandIgnore(Client *c, std::string Ignoree) {
|
||||||
|
|
||||||
_log(UCS__TRACE, "Received ignore command with parameters %s", Ignoree.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received ignore command with parameters %s", Ignoree.c_str());
|
||||||
c->GeneralChannelMessage("Ignore list modified");
|
c->GeneralChannelMessage("Ignore list modified");
|
||||||
|
|
||||||
uint8 SubAction = 0;
|
uint8 SubAction = 0;
|
||||||
@ -480,9 +481,9 @@ Clientlist::Clientlist(int ChatPort) {
|
|||||||
exit(1);
|
exit(1);
|
||||||
|
|
||||||
if (chatsf->Open())
|
if (chatsf->Open())
|
||||||
_log(UCS__INIT,"Client (UDP) Chat listener started on port %i.", ChatPort);
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server,"Client (UDP) Chat listener started on port %i.", ChatPort);
|
||||||
else {
|
else {
|
||||||
_log(UCS__ERROR,"Failed to start client (UDP) listener (port %-4i)", ChatPort);
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server,"Failed to start client (UDP) listener (port %-4i)", ChatPort);
|
||||||
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -559,13 +560,13 @@ void Clientlist::CheckForStaleConnections(Client *c) {
|
|||||||
if(((*Iterator) != c) && ((c->GetName() == (*Iterator)->GetName())
|
if(((*Iterator) != c) && ((c->GetName() == (*Iterator)->GetName())
|
||||||
&& (c->GetConnectionType() == (*Iterator)->GetConnectionType()))) {
|
&& (c->GetConnectionType() == (*Iterator)->GetConnectionType()))) {
|
||||||
|
|
||||||
_log(UCS__CLIENT, "Removing old connection for %s", c->GetName().c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removing old connection for %s", c->GetName().c_str());
|
||||||
|
|
||||||
struct in_addr in;
|
struct in_addr in;
|
||||||
|
|
||||||
in.s_addr = (*Iterator)->ClientStream->GetRemoteIP();
|
in.s_addr = (*Iterator)->ClientStream->GetRemoteIP();
|
||||||
|
|
||||||
_log(UCS__CLIENT, "Client connection from %s:%d closed.", inet_ntoa(in),
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client connection from %s:%d closed.", inet_ntoa(in),
|
||||||
ntohs((*Iterator)->ClientStream->GetRemotePort()));
|
ntohs((*Iterator)->ClientStream->GetRemotePort()));
|
||||||
|
|
||||||
safe_delete((*Iterator));
|
safe_delete((*Iterator));
|
||||||
@ -585,7 +586,7 @@ void Clientlist::Process() {
|
|||||||
|
|
||||||
in.s_addr = eqs->GetRemoteIP();
|
in.s_addr = eqs->GetRemoteIP();
|
||||||
|
|
||||||
_log(UCS__CLIENT, "New Client UDP connection from %s:%d", inet_ntoa(in), ntohs(eqs->GetRemotePort()));
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "New Client UDP connection from %s:%d", inet_ntoa(in), ntohs(eqs->GetRemotePort()));
|
||||||
|
|
||||||
eqs->SetOpcodeManager(&ChatOpMgr);
|
eqs->SetOpcodeManager(&ChatOpMgr);
|
||||||
|
|
||||||
@ -605,7 +606,7 @@ void Clientlist::Process() {
|
|||||||
|
|
||||||
in.s_addr = (*Iterator)->ClientStream->GetRemoteIP();
|
in.s_addr = (*Iterator)->ClientStream->GetRemoteIP();
|
||||||
|
|
||||||
_log(UCS__CLIENT, "Client connection from %s:%d closed.", inet_ntoa(in),
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client connection from %s:%d closed.", inet_ntoa(in),
|
||||||
ntohs((*Iterator)->ClientStream->GetRemotePort()));
|
ntohs((*Iterator)->ClientStream->GetRemotePort()));
|
||||||
|
|
||||||
safe_delete((*Iterator));
|
safe_delete((*Iterator));
|
||||||
@ -645,7 +646,7 @@ void Clientlist::Process() {
|
|||||||
|
|
||||||
if(strlen(PacketBuffer) != 9)
|
if(strlen(PacketBuffer) != 9)
|
||||||
{
|
{
|
||||||
_log(UCS__ERROR, "Mail key is the wrong size. Version of world incompatible with UCS.");
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Mail key is the wrong size. Version of world incompatible with UCS.");
|
||||||
KeyValid = false;
|
KeyValid = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -666,11 +667,11 @@ void Clientlist::Process() {
|
|||||||
else
|
else
|
||||||
CharacterName = MailBoxString.substr(LastPeriod + 1);
|
CharacterName = MailBoxString.substr(LastPeriod + 1);
|
||||||
|
|
||||||
_log(UCS__TRACE, "Received login for user %s with key %s", MailBox, Key);
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received login for user %s with key %s", MailBox, Key);
|
||||||
|
|
||||||
if(!database.VerifyMailKey(CharacterName, (*Iterator)->ClientStream->GetRemoteIP(), Key)) {
|
if(!database.VerifyMailKey(CharacterName, (*Iterator)->ClientStream->GetRemoteIP(), Key)) {
|
||||||
|
|
||||||
_log(UCS__ERROR, "Chat Key for %s does not match, closing connection.", MailBox);
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Chat Key for %s does not match, closing connection.", MailBox);
|
||||||
|
|
||||||
KeyValid = false;
|
KeyValid = false;
|
||||||
|
|
||||||
@ -702,7 +703,7 @@ void Clientlist::Process() {
|
|||||||
|
|
||||||
default: {
|
default: {
|
||||||
|
|
||||||
_log(UCS__ERROR, "Unhandled chat opcode %8X", opcode);
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unhandled chat opcode %8X", opcode);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -715,7 +716,7 @@ void Clientlist::Process() {
|
|||||||
|
|
||||||
in.s_addr = (*Iterator)->ClientStream->GetRemoteIP();
|
in.s_addr = (*Iterator)->ClientStream->GetRemoteIP();
|
||||||
|
|
||||||
_log(UCS__TRACE, "Force disconnecting client: %s:%d, KeyValid=%i, GetForceDisconnect()=%i",
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Force disconnecting client: %s:%d, KeyValid=%i, GetForceDisconnect()=%i",
|
||||||
inet_ntoa(in), ntohs((*Iterator)->ClientStream->GetRemotePort()),
|
inet_ntoa(in), ntohs((*Iterator)->ClientStream->GetRemotePort()),
|
||||||
KeyValid, (*Iterator)->GetForceDisconnect());
|
KeyValid, (*Iterator)->GetForceDisconnect());
|
||||||
|
|
||||||
@ -859,7 +860,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, std::string CommandString)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CommandSetMessageStatus:
|
case CommandSetMessageStatus:
|
||||||
_log(UCS__TRACE, "Set Message Status, Params: %s", Parameters.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set Message Status, Params: %s", Parameters.c_str());
|
||||||
ProcessSetMessageStatus(Parameters);
|
ProcessSetMessageStatus(Parameters);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -884,7 +885,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, std::string CommandString)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
c->SendHelp();
|
c->SendHelp();
|
||||||
_log(UCS__ERROR, "Unhandled OP_Mail command: %s", CommandString.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unhandled OP_Mail command: %s", CommandString.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -895,7 +896,7 @@ void Clientlist::CloseAllConnections() {
|
|||||||
|
|
||||||
for(Iterator = ClientChatConnections.begin(); Iterator != ClientChatConnections.end(); ++Iterator) {
|
for(Iterator = ClientChatConnections.begin(); Iterator != ClientChatConnections.end(); ++Iterator) {
|
||||||
|
|
||||||
_log(UCS__TRACE, "Removing client %s", (*Iterator)->GetName().c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removing client %s", (*Iterator)->GetName().c_str());
|
||||||
|
|
||||||
(*Iterator)->CloseConnection();
|
(*Iterator)->CloseConnection();
|
||||||
}
|
}
|
||||||
@ -904,7 +905,7 @@ void Clientlist::CloseAllConnections() {
|
|||||||
void Client::AddCharacter(int CharID, const char *CharacterName, int Level) {
|
void Client::AddCharacter(int CharID, const char *CharacterName, int Level) {
|
||||||
|
|
||||||
if(!CharacterName) return;
|
if(!CharacterName) return;
|
||||||
_log(UCS__TRACE, "Adding character %s with ID %i for %s", CharacterName, CharID, GetName().c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Adding character %s with ID %i for %s", CharacterName, CharID, GetName().c_str());
|
||||||
CharacterEntry NewCharacter;
|
CharacterEntry NewCharacter;
|
||||||
NewCharacter.CharID = CharID;
|
NewCharacter.CharID = CharID;
|
||||||
NewCharacter.Name = CharacterName;
|
NewCharacter.Name = CharacterName;
|
||||||
@ -970,7 +971,7 @@ void Client::AddToChannelList(ChatChannel *JoinedChannel) {
|
|||||||
for(int i = 0; i < MAX_JOINED_CHANNELS; i++)
|
for(int i = 0; i < MAX_JOINED_CHANNELS; i++)
|
||||||
if(JoinedChannels[i] == nullptr) {
|
if(JoinedChannels[i] == nullptr) {
|
||||||
JoinedChannels[i] = JoinedChannel;
|
JoinedChannels[i] = JoinedChannel;
|
||||||
_log(UCS__TRACE, "Added Channel %s to slot %i for %s", JoinedChannel->GetName().c_str(), i + 1, GetName().c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added Channel %s to slot %i for %s", JoinedChannel->GetName().c_str(), i + 1, GetName().c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1011,7 +1012,7 @@ void Client::JoinChannels(std::string ChannelNameList) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_log(UCS__TRACE, "Client: %s joining channels %s", GetName().c_str(), ChannelNameList.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client: %s joining channels %s", GetName().c_str(), ChannelNameList.c_str());
|
||||||
|
|
||||||
int NumberOfChannels = ChannelCount();
|
int NumberOfChannels = ChannelCount();
|
||||||
|
|
||||||
@ -1112,7 +1113,7 @@ void Client::JoinChannels(std::string ChannelNameList) {
|
|||||||
|
|
||||||
void Client::LeaveChannels(std::string ChannelNameList) {
|
void Client::LeaveChannels(std::string ChannelNameList) {
|
||||||
|
|
||||||
_log(UCS__TRACE, "Client: %s leaving channels %s", GetName().c_str(), ChannelNameList.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client: %s leaving channels %s", GetName().c_str(), ChannelNameList.c_str());
|
||||||
|
|
||||||
std::string::size_type CurrentPos = 0;
|
std::string::size_type CurrentPos = 0;
|
||||||
|
|
||||||
@ -1291,7 +1292,7 @@ void Client::SendChannelMessage(std::string Message)
|
|||||||
|
|
||||||
std::string ChannelName = Message.substr(1, MessageStart-1);
|
std::string ChannelName = Message.substr(1, MessageStart-1);
|
||||||
|
|
||||||
_log(UCS__TRACE, "%s tells %s, [%s]", GetName().c_str(), ChannelName.c_str(), Message.substr(MessageStart + 1).c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "%s tells %s, [%s]", GetName().c_str(), ChannelName.c_str(), Message.substr(MessageStart + 1).c_str());
|
||||||
|
|
||||||
ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName);
|
ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName);
|
||||||
|
|
||||||
@ -1434,7 +1435,7 @@ void Client::SendChannelMessageByNumber(std::string Message) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_log(UCS__TRACE, "%s tells %s, [%s]", GetName().c_str(), RequiredChannel->GetName().c_str(),
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "%s tells %s, [%s]", GetName().c_str(), RequiredChannel->GetName().c_str(),
|
||||||
Message.substr(MessageStart + 1).c_str());
|
Message.substr(MessageStart + 1).c_str());
|
||||||
|
|
||||||
if(RuleB(Chat, EnableAntiSpam))
|
if(RuleB(Chat, EnableAntiSpam))
|
||||||
@ -1646,7 +1647,7 @@ void Client::SetChannelPassword(std::string ChannelPassword) {
|
|||||||
else
|
else
|
||||||
Message = "Password change on channel " + ChannelName;
|
Message = "Password change on channel " + ChannelName;
|
||||||
|
|
||||||
_log(UCS__TRACE, "Set password of channel [%s] to [%s] by %s", ChannelName.c_str(), Password.c_str(), GetName().c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set password of channel [%s] to [%s] by %s", ChannelName.c_str(), Password.c_str(), GetName().c_str());
|
||||||
|
|
||||||
ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName);
|
ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName);
|
||||||
|
|
||||||
@ -1701,7 +1702,7 @@ void Client::SetChannelOwner(std::string CommandString) {
|
|||||||
if((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
if((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||||
ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
|
ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
|
||||||
|
|
||||||
_log(UCS__TRACE, "Set owner of channel [%s] to [%s]", ChannelName.c_str(), NewOwner.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set owner of channel [%s] to [%s]", ChannelName.c_str(), NewOwner.c_str());
|
||||||
|
|
||||||
ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName);
|
ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName);
|
||||||
|
|
||||||
@ -1789,7 +1790,7 @@ void Client::ChannelInvite(std::string CommandString) {
|
|||||||
if((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
if((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||||
ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
|
ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
|
||||||
|
|
||||||
_log(UCS__TRACE, "[%s] invites [%s] to channel [%s]", GetName().c_str(), Invitee.c_str(), ChannelName.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] invites [%s] to channel [%s]", GetName().c_str(), Invitee.c_str(), ChannelName.c_str());
|
||||||
|
|
||||||
Client *RequiredClient = CL->FindCharacter(Invitee);
|
Client *RequiredClient = CL->FindCharacter(Invitee);
|
||||||
|
|
||||||
@ -1917,7 +1918,7 @@ void Client::ChannelGrantModerator(std::string CommandString) {
|
|||||||
if((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
if((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||||
ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
|
ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
|
||||||
|
|
||||||
_log(UCS__TRACE, "[%s] gives [%s] moderator rights to channel [%s]", GetName().c_str(), Moderator.c_str(), ChannelName.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] gives [%s] moderator rights to channel [%s]", GetName().c_str(), Moderator.c_str(), ChannelName.c_str());
|
||||||
|
|
||||||
Client *RequiredClient = CL->FindCharacter(Moderator);
|
Client *RequiredClient = CL->FindCharacter(Moderator);
|
||||||
|
|
||||||
@ -1998,7 +1999,7 @@ void Client::ChannelGrantVoice(std::string CommandString) {
|
|||||||
if((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
if((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||||
ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
|
ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
|
||||||
|
|
||||||
_log(UCS__TRACE, "[%s] gives [%s] voice to channel [%s]", GetName().c_str(), Voicee.c_str(), ChannelName.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] gives [%s] voice to channel [%s]", GetName().c_str(), Voicee.c_str(), ChannelName.c_str());
|
||||||
|
|
||||||
Client *RequiredClient = CL->FindCharacter(Voicee);
|
Client *RequiredClient = CL->FindCharacter(Voicee);
|
||||||
|
|
||||||
@ -2086,7 +2087,7 @@ void Client::ChannelKick(std::string CommandString) {
|
|||||||
if((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
if((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||||
ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
|
ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
|
||||||
|
|
||||||
_log(UCS__TRACE, "[%s] kicks [%s] from channel [%s]", GetName().c_str(), Kickee.c_str(), ChannelName.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] kicks [%s] from channel [%s]", GetName().c_str(), Kickee.c_str(), ChannelName.c_str());
|
||||||
|
|
||||||
Client *RequiredClient = CL->FindCharacter(Kickee);
|
Client *RequiredClient = CL->FindCharacter(Kickee);
|
||||||
|
|
||||||
@ -2195,32 +2196,32 @@ void Client::SetConnectionType(char c) {
|
|||||||
case 'S':
|
case 'S':
|
||||||
{
|
{
|
||||||
TypeOfConnection = ConnectionTypeCombined;
|
TypeOfConnection = ConnectionTypeCombined;
|
||||||
_log(UCS__TRACE, "Connection type is Combined (SoF/SoD)");
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Combined (SoF/SoD)");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'U':
|
case 'U':
|
||||||
{
|
{
|
||||||
TypeOfConnection = ConnectionTypeCombined;
|
TypeOfConnection = ConnectionTypeCombined;
|
||||||
UnderfootOrLater = true;
|
UnderfootOrLater = true;
|
||||||
_log(UCS__TRACE, "Connection type is Combined (Underfoot+)");
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Combined (Underfoot+)");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'M':
|
case 'M':
|
||||||
{
|
{
|
||||||
TypeOfConnection = ConnectionTypeMail;
|
TypeOfConnection = ConnectionTypeMail;
|
||||||
_log(UCS__TRACE, "Connection type is Mail (6.2 or Titanium client)");
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Mail (6.2 or Titanium client)");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'C':
|
case 'C':
|
||||||
{
|
{
|
||||||
TypeOfConnection = ConnectionTypeChat;
|
TypeOfConnection = ConnectionTypeChat;
|
||||||
_log(UCS__TRACE, "Connection type is Chat (6.2 or Titanium client)");
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Chat (6.2 or Titanium client)");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
TypeOfConnection = ConnectionTypeUnknown;
|
TypeOfConnection = ConnectionTypeUnknown;
|
||||||
_log(UCS__TRACE, "Connection type is unknown.");
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is unknown.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2298,11 +2299,11 @@ void Client::SendNotification(int MailBoxNumber, std::string Subject, std::strin
|
|||||||
|
|
||||||
void Client::ChangeMailBox(int NewMailBox) {
|
void Client::ChangeMailBox(int NewMailBox) {
|
||||||
|
|
||||||
_log(UCS__TRACE, "%s Change to mailbox %i", MailBoxName().c_str(), NewMailBox);
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "%s Change to mailbox %i", MailBoxName().c_str(), NewMailBox);
|
||||||
|
|
||||||
SetMailBox(NewMailBox);
|
SetMailBox(NewMailBox);
|
||||||
|
|
||||||
_log(UCS__TRACE, "New mailbox is %s", MailBoxName().c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "New mailbox is %s", MailBoxName().c_str());
|
||||||
|
|
||||||
auto outapp = new EQApplicationPacket(OP_MailboxChange, 2);
|
auto outapp = new EQApplicationPacket(OP_MailboxChange, 2);
|
||||||
|
|
||||||
@ -2376,13 +2377,13 @@ std::string Client::MailBoxName() {
|
|||||||
|
|
||||||
if((Characters.size() == 0) || (CurrentMailBox > (Characters.size() - 1)))
|
if((Characters.size() == 0) || (CurrentMailBox > (Characters.size() - 1)))
|
||||||
{
|
{
|
||||||
_log(UCS__ERROR, "MailBoxName() called with CurrentMailBox set to %i and Characters.size() is %i",
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MailBoxName() called with CurrentMailBox set to %i and Characters.size() is %i",
|
||||||
CurrentMailBox, Characters.size());
|
CurrentMailBox, Characters.size());
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
_log(UCS__TRACE, "MailBoxName() called with CurrentMailBox set to %i and Characters.size() is %i",
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MailBoxName() called with CurrentMailBox set to %i and Characters.size() is %i",
|
||||||
CurrentMailBox, Characters.size());
|
CurrentMailBox, Characters.size());
|
||||||
|
|
||||||
return Characters[CurrentMailBox].Name;
|
return Characters[CurrentMailBox].Name;
|
||||||
|
|||||||
@ -110,15 +110,15 @@ void Database::GetAccountStatus(Client *client) {
|
|||||||
client->GetAccountID());
|
client->GetAccountID());
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
if (!results.Success()) {
|
if (!results.Success()) {
|
||||||
_log(UCS__ERROR, "Unable to get account status for character %s, error %s", client->GetName().c_str(), results.ErrorMessage().c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unable to get account status for character %s, error %s", client->GetName().c_str(), results.ErrorMessage().c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_log(UCS__TRACE, "GetAccountStatus Query: %s", query.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "GetAccountStatus Query: %s", query.c_str());
|
||||||
|
|
||||||
if(results.RowCount() != 1)
|
if(results.RowCount() != 1)
|
||||||
{
|
{
|
||||||
_log(UCS__ERROR, "Error in GetAccountStatus");
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error in GetAccountStatus");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,13 +129,13 @@ void Database::GetAccountStatus(Client *client) {
|
|||||||
client->SetKarma(atoi(row[2]));
|
client->SetKarma(atoi(row[2]));
|
||||||
client->SetRevoked((atoi(row[3])==1?true:false));
|
client->SetRevoked((atoi(row[3])==1?true:false));
|
||||||
|
|
||||||
_log(UCS__TRACE, "Set account status to %i, hideme to %i and karma to %i for %s", client->GetAccountStatus(), client->GetHideMe(), client->GetKarma(), client->GetName().c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set account status to %i, hideme to %i and karma to %i for %s", client->GetAccountStatus(), client->GetHideMe(), client->GetKarma(), client->GetName().c_str());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Database::FindAccount(const char *characterName, Client *client) {
|
int Database::FindAccount(const char *characterName, Client *client) {
|
||||||
|
|
||||||
_log(UCS__TRACE, "FindAccount for character %s", characterName);
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "FindAccount for character %s", characterName);
|
||||||
|
|
||||||
|
|
||||||
client->ClearCharacters();
|
client->ClearCharacters();
|
||||||
@ -144,12 +144,12 @@ int Database::FindAccount(const char *characterName, Client *client) {
|
|||||||
characterName);
|
characterName);
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
if (!results.Success()) {
|
if (!results.Success()) {
|
||||||
_log(UCS__ERROR, "FindAccount query failed: %s", query.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "FindAccount query failed: %s", query.c_str());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (results.RowCount() != 1) {
|
if (results.RowCount() != 1) {
|
||||||
_log(UCS__ERROR, "Bad result from query");
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Bad result from query");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ int Database::FindAccount(const char *characterName, Client *client) {
|
|||||||
|
|
||||||
int accountID = atoi(row[1]);
|
int accountID = atoi(row[1]);
|
||||||
|
|
||||||
_log(UCS__TRACE, "Account ID for %s is %i", characterName, accountID);
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Account ID for %s is %i", characterName, accountID);
|
||||||
|
|
||||||
query = StringFormat("SELECT `id`, `name`, `level` FROM `character_data` "
|
query = StringFormat("SELECT `id`, `name`, `level` FROM `character_data` "
|
||||||
"WHERE `account_id` = %i AND `name` != '%s'",
|
"WHERE `account_id` = %i AND `name` != '%s'",
|
||||||
@ -179,7 +179,7 @@ bool Database::VerifyMailKey(std::string characterName, int IPAddress, std::stri
|
|||||||
characterName.c_str());
|
characterName.c_str());
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
if (!results.Success()) {
|
if (!results.Success()) {
|
||||||
_log(UCS__ERROR, "Error retrieving mailkey from database: %s", results.ErrorMessage().c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error retrieving mailkey from database: %s", results.ErrorMessage().c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ bool Database::VerifyMailKey(std::string characterName, int IPAddress, std::stri
|
|||||||
else
|
else
|
||||||
sprintf(combinedKey, "%s", MailKey.c_str());
|
sprintf(combinedKey, "%s", MailKey.c_str());
|
||||||
|
|
||||||
_log(UCS__TRACE, "DB key is [%s], Client key is [%s]", row[0], combinedKey);
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "DB key is [%s], Client key is [%s]", row[0], combinedKey);
|
||||||
|
|
||||||
return !strcmp(row[0], combinedKey);
|
return !strcmp(row[0], combinedKey);
|
||||||
}
|
}
|
||||||
@ -206,14 +206,14 @@ int Database::FindCharacter(const char *characterName) {
|
|||||||
std::string query = StringFormat("SELECT `id` FROM `character_data` WHERE `name`='%s' LIMIT 1", safeCharName);
|
std::string query = StringFormat("SELECT `id` FROM `character_data` WHERE `name`='%s' LIMIT 1", safeCharName);
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
if (!results.Success()) {
|
if (!results.Success()) {
|
||||||
_log(UCS__ERROR, "FindCharacter failed. %s %s", query.c_str(), results.ErrorMessage().c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "FindCharacter failed. %s %s", query.c_str(), results.ErrorMessage().c_str());
|
||||||
safe_delete(safeCharName);
|
safe_delete(safeCharName);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
safe_delete(safeCharName);
|
safe_delete(safeCharName);
|
||||||
|
|
||||||
if (results.RowCount() != 1) {
|
if (results.RowCount() != 1) {
|
||||||
_log(UCS__ERROR, "Bad result from FindCharacter query for character %s", characterName);
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Bad result from FindCharacter query for character %s", characterName);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,7 +229,7 @@ bool Database::GetVariable(const char* varname, char* varvalue, uint16 varvalue_
|
|||||||
std::string query = StringFormat("SELECT `value` FROM `variables` WHERE `varname` = '%s'", varname);
|
std::string query = StringFormat("SELECT `value` FROM `variables` WHERE `varname` = '%s'", varname);
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
if (!results.Success()) {
|
if (!results.Success()) {
|
||||||
_log(UCS__ERROR, "Unable to get message count from database. %s %s", query.c_str(), results.ErrorMessage().c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unable to get message count from database. %s %s", query.c_str(), results.ErrorMessage().c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,12 +245,12 @@ bool Database::GetVariable(const char* varname, char* varvalue, uint16 varvalue_
|
|||||||
|
|
||||||
bool Database::LoadChatChannels() {
|
bool Database::LoadChatChannels() {
|
||||||
|
|
||||||
_log(UCS__INIT, "Loading chat channels from the database.");
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Loading chat channels from the database.");
|
||||||
|
|
||||||
const std::string query = "SELECT `name`, `owner`, `password`, `minstatus` FROM `chatchannels`";
|
const std::string query = "SELECT `name`, `owner`, `password`, `minstatus` FROM `chatchannels`";
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
if (!results.Success()) {
|
if (!results.Success()) {
|
||||||
_log(UCS__ERROR, "Failed to load channels. %s %s", query.c_str(), results.ErrorMessage().c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Failed to load channels. %s %s", query.c_str(), results.ErrorMessage().c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,25 +267,25 @@ bool Database::LoadChatChannels() {
|
|||||||
|
|
||||||
void Database::SetChannelPassword(std::string channelName, std::string password) {
|
void Database::SetChannelPassword(std::string channelName, std::string password) {
|
||||||
|
|
||||||
_log(UCS__TRACE, "Database::SetChannelPassword(%s, %s)", channelName.c_str(), password.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Database::SetChannelPassword(%s, %s)", channelName.c_str(), password.c_str());
|
||||||
|
|
||||||
std::string query = StringFormat("UPDATE `chatchannels` SET `password` = '%s' WHERE `name` = '%s'",
|
std::string query = StringFormat("UPDATE `chatchannels` SET `password` = '%s' WHERE `name` = '%s'",
|
||||||
password.c_str(), channelName.c_str());
|
password.c_str(), channelName.c_str());
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
if(!results.Success())
|
if(!results.Success())
|
||||||
_log(UCS__ERROR, "Error updating password in database: %s, %s", query.c_str(), results.ErrorMessage().c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error updating password in database: %s, %s", query.c_str(), results.ErrorMessage().c_str());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::SetChannelOwner(std::string channelName, std::string owner) {
|
void Database::SetChannelOwner(std::string channelName, std::string owner) {
|
||||||
|
|
||||||
_log(UCS__TRACE, "Database::SetChannelOwner(%s, %s)", channelName.c_str(), owner.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Database::SetChannelOwner(%s, %s)", channelName.c_str(), owner.c_str());
|
||||||
|
|
||||||
std::string query = StringFormat("UPDATE `chatchannels` SET `owner` = '%s' WHERE `name` = '%s'",
|
std::string query = StringFormat("UPDATE `chatchannels` SET `owner` = '%s' WHERE `name` = '%s'",
|
||||||
owner.c_str(), channelName.c_str());
|
owner.c_str(), channelName.c_str());
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
if(!results.Success())
|
if(!results.Success())
|
||||||
_log(UCS__ERROR, "Error updating Owner in database: %s, %s", query.c_str(), results.ErrorMessage().c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error updating Owner in database: %s, %s", query.c_str(), results.ErrorMessage().c_str());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,7 +295,7 @@ void Database::SendHeaders(Client *client) {
|
|||||||
int unknownField3 = 1;
|
int unknownField3 = 1;
|
||||||
int characterID = FindCharacter(client->MailBoxName().c_str());
|
int characterID = FindCharacter(client->MailBoxName().c_str());
|
||||||
|
|
||||||
_log(UCS__TRACE, "Sendheaders for %s, CharID is %i", client->MailBoxName().c_str(), characterID);
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Sendheaders for %s, CharID is %i", client->MailBoxName().c_str(), characterID);
|
||||||
|
|
||||||
if(characterID <= 0)
|
if(characterID <= 0)
|
||||||
return;
|
return;
|
||||||
@ -382,7 +382,7 @@ void Database::SendBody(Client *client, int messageNumber) {
|
|||||||
|
|
||||||
int characterID = FindCharacter(client->MailBoxName().c_str());
|
int characterID = FindCharacter(client->MailBoxName().c_str());
|
||||||
|
|
||||||
_log(UCS__TRACE, "SendBody: MsgID %i, to %s, CharID is %i", messageNumber, client->MailBoxName().c_str(), characterID);
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SendBody: MsgID %i, to %s, CharID is %i", messageNumber, client->MailBoxName().c_str(), characterID);
|
||||||
|
|
||||||
if(characterID <= 0)
|
if(characterID <= 0)
|
||||||
return;
|
return;
|
||||||
@ -399,7 +399,7 @@ void Database::SendBody(Client *client, int messageNumber) {
|
|||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
|
|
||||||
_log(UCS__TRACE, "Message: %i body (%i bytes)", messageNumber, strlen(row[1]));
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Message: %i body (%i bytes)", messageNumber, strlen(row[1]));
|
||||||
|
|
||||||
int packetLength = 12 + strlen(row[0]) + strlen(row[1]) + strlen(row[2]);
|
int packetLength = 12 + strlen(row[0]) + strlen(row[1]) + strlen(row[2]);
|
||||||
|
|
||||||
@ -445,7 +445,7 @@ bool Database::SendMail(std::string recipient, std::string from, std::string sub
|
|||||||
|
|
||||||
characterID = FindCharacter(characterName.c_str());
|
characterID = FindCharacter(characterName.c_str());
|
||||||
|
|
||||||
_log(UCS__TRACE, "SendMail: CharacterID for recipient %s is %i", characterName.c_str(), characterID);
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SendMail: CharacterID for recipient %s is %i", characterName.c_str(), characterID);
|
||||||
|
|
||||||
if(characterID <= 0)
|
if(characterID <= 0)
|
||||||
return false;
|
return false;
|
||||||
@ -467,11 +467,11 @@ bool Database::SendMail(std::string recipient, std::string from, std::string sub
|
|||||||
safe_delete_array(escBody);
|
safe_delete_array(escBody);
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
if(!results.Success()) {
|
if(!results.Success()) {
|
||||||
_log(UCS__ERROR, "SendMail: Query %s failed with error %s", query.c_str(), results.ErrorMessage().c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SendMail: Query %s failed with error %s", query.c_str(), results.ErrorMessage().c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_log(UCS__TRACE, "MessageID %i generated, from %s, to %s", results.LastInsertedID(), from.c_str(), recipient.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MessageID %i generated, from %s, to %s", results.LastInsertedID(), from.c_str(), recipient.c_str());
|
||||||
|
|
||||||
|
|
||||||
Client *client = CL->IsCharacterOnline(characterName);
|
Client *client = CL->IsCharacterOnline(characterName);
|
||||||
@ -488,7 +488,7 @@ bool Database::SendMail(std::string recipient, std::string from, std::string sub
|
|||||||
|
|
||||||
void Database::SetMessageStatus(int messageNumber, int status) {
|
void Database::SetMessageStatus(int messageNumber, int status) {
|
||||||
|
|
||||||
_log(UCS__TRACE, "SetMessageStatus %i %i", messageNumber, status);
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SetMessageStatus %i %i", messageNumber, status);
|
||||||
|
|
||||||
if(status == 0) {
|
if(status == 0) {
|
||||||
std::string query = StringFormat("DELETE FROM `mail` WHERE `msgid` = %i", messageNumber);
|
std::string query = StringFormat("DELETE FROM `mail` WHERE `msgid` = %i", messageNumber);
|
||||||
@ -499,24 +499,24 @@ void Database::SetMessageStatus(int messageNumber, int status) {
|
|||||||
std::string query = StringFormat("UPDATE `mail` SET `status` = %i WHERE `msgid`=%i", status, messageNumber);
|
std::string query = StringFormat("UPDATE `mail` SET `status` = %i WHERE `msgid`=%i", status, messageNumber);
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
if (!results.Success())
|
if (!results.Success())
|
||||||
_log(UCS__ERROR, "Error updating status %s, %s", query.c_str(), results.ErrorMessage().c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error updating status %s, %s", query.c_str(), results.ErrorMessage().c_str());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::ExpireMail() {
|
void Database::ExpireMail() {
|
||||||
|
|
||||||
_log(UCS__INIT, "Expiring mail...");
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expiring mail...");
|
||||||
|
|
||||||
std::string query = "SELECT COUNT(*) FROM `mail`";
|
std::string query = "SELECT COUNT(*) FROM `mail`";
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
if (!results.Success()) {
|
if (!results.Success()) {
|
||||||
_log(UCS__ERROR, "Unable to get message count from database. %s %s", query.c_str(), results.ErrorMessage().c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unable to get message count from database. %s %s", query.c_str(), results.ErrorMessage().c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
|
|
||||||
_log(UCS__INIT, "There are %s messages in the database.", row[0]);
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "There are %s messages in the database.", row[0]);
|
||||||
|
|
||||||
// Expire Trash
|
// Expire Trash
|
||||||
if(RuleI(Mail, ExpireTrash) >= 0) {
|
if(RuleI(Mail, ExpireTrash) >= 0) {
|
||||||
@ -524,9 +524,9 @@ void Database::ExpireMail() {
|
|||||||
time(nullptr) - RuleI(Mail, ExpireTrash));
|
time(nullptr) - RuleI(Mail, ExpireTrash));
|
||||||
results = QueryDatabase(query);
|
results = QueryDatabase(query);
|
||||||
if(results.Success())
|
if(results.Success())
|
||||||
_log(UCS__INIT, "Expired %i trash messages.", results.RowsAffected());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expired %i trash messages.", results.RowsAffected());
|
||||||
else
|
else
|
||||||
_log(UCS__ERROR, "Error expiring trash messages, %s %s", query.c_str(), results.ErrorMessage().c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error expiring trash messages, %s %s", query.c_str(), results.ErrorMessage().c_str());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -536,9 +536,9 @@ void Database::ExpireMail() {
|
|||||||
time(nullptr) - RuleI(Mail, ExpireRead));
|
time(nullptr) - RuleI(Mail, ExpireRead));
|
||||||
results = QueryDatabase(query);
|
results = QueryDatabase(query);
|
||||||
if(results.Success())
|
if(results.Success())
|
||||||
_log(UCS__INIT, "Expired %i read messages.", results.RowsAffected());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expired %i read messages.", results.RowsAffected());
|
||||||
else
|
else
|
||||||
_log(UCS__ERROR, "Error expiring read messages, %s %s", query.c_str(), results.ErrorMessage().c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error expiring read messages, %s %s", query.c_str(), results.ErrorMessage().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expire Unread
|
// Expire Unread
|
||||||
@ -547,9 +547,9 @@ void Database::ExpireMail() {
|
|||||||
time(nullptr) - RuleI(Mail, ExpireUnread));
|
time(nullptr) - RuleI(Mail, ExpireUnread));
|
||||||
results = QueryDatabase(query);
|
results = QueryDatabase(query);
|
||||||
if(results.Success())
|
if(results.Success())
|
||||||
_log(UCS__INIT, "Expired %i unread messages.", results.RowsAffected());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expired %i unread messages.", results.RowsAffected());
|
||||||
else
|
else
|
||||||
_log(UCS__ERROR, "Error expiring unread messages, %s %s", query.c_str(), results.ErrorMessage().c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error expiring unread messages, %s %s", query.c_str(), results.ErrorMessage().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -560,9 +560,9 @@ void Database::AddFriendOrIgnore(int charID, int type, std::string name) {
|
|||||||
charID, type, CapitaliseName(name).c_str());
|
charID, type, CapitaliseName(name).c_str());
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
if(!results.Success())
|
if(!results.Success())
|
||||||
_log(UCS__ERROR, "Error adding friend/ignore, query was %s : %s", query.c_str(), results.ErrorMessage().c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error adding friend/ignore, query was %s : %s", query.c_str(), results.ErrorMessage().c_str());
|
||||||
else
|
else
|
||||||
_log(UCS__TRACE, "Wrote Friend/Ignore entry for charid %i, type %i, name %s to database.", charID, type, name.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Wrote Friend/Ignore entry for charid %i, type %i, name %s to database.", charID, type, name.c_str());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -573,9 +573,9 @@ void Database::RemoveFriendOrIgnore(int charID, int type, std::string name) {
|
|||||||
charID, type, CapitaliseName(name).c_str());
|
charID, type, CapitaliseName(name).c_str());
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
if(!results.Success())
|
if(!results.Success())
|
||||||
_log(UCS__ERROR, "Error removing friend/ignore, query was %s", query.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error removing friend/ignore, query was %s", query.c_str());
|
||||||
else
|
else
|
||||||
_log(UCS__TRACE, "Removed Friend/Ignore entry for charid %i, type %i, name %s from database.", charID, type, name.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed Friend/Ignore entry for charid %i, type %i, name %s from database.", charID, type, name.c_str());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -584,7 +584,7 @@ void Database::GetFriendsAndIgnore(int charID, std::vector<std::string> &friends
|
|||||||
std::string query = StringFormat("select `type`, `name` FROM `friends` WHERE `charid`=%i", charID);
|
std::string query = StringFormat("select `type`, `name` FROM `friends` WHERE `charid`=%i", charID);
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
if (!results.Success()) {
|
if (!results.Success()) {
|
||||||
_log(UCS__ERROR, "GetFriendsAndIgnore query error %s, %s", query.c_str(), results.ErrorMessage().c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "GetFriendsAndIgnore query error %s, %s", query.c_str(), results.ErrorMessage().c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -595,12 +595,12 @@ void Database::GetFriendsAndIgnore(int charID, std::vector<std::string> &friends
|
|||||||
if(atoi(row[0]) == 0)
|
if(atoi(row[0]) == 0)
|
||||||
{
|
{
|
||||||
ignorees.push_back(name);
|
ignorees.push_back(name);
|
||||||
_log(UCS__TRACE, "Added Ignoree from DB %s", name.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added Ignoree from DB %s", name.c_str());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
friends.push_back(name);
|
friends.push_back(name);
|
||||||
_log(UCS__TRACE, "Added Friend from DB %s", name.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added Friend from DB %s", name.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
22
ucs/ucs.cpp
22
ucs/ucs.cpp
@ -78,11 +78,11 @@ int main() {
|
|||||||
|
|
||||||
Timer InterserverTimer(INTERSERVER_TIMER); // does auto-reconnect
|
Timer InterserverTimer(INTERSERVER_TIMER); // does auto-reconnect
|
||||||
|
|
||||||
_log(UCS__INIT, "Starting EQEmu Universal Chat Server.");
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Starting EQEmu Universal Chat Server.");
|
||||||
|
|
||||||
if (!ucsconfig::LoadConfig()) {
|
if (!ucsconfig::LoadConfig()) {
|
||||||
|
|
||||||
_log(UCS__INIT, "Loading server configuration failed.");
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Loading server configuration failed.");
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -90,13 +90,13 @@ int main() {
|
|||||||
Config = ucsconfig::get();
|
Config = ucsconfig::get();
|
||||||
|
|
||||||
if(!load_log_settings(Config->LogSettingsFile.c_str()))
|
if(!load_log_settings(Config->LogSettingsFile.c_str()))
|
||||||
_log(UCS__INIT, "Warning: Unable to read %s", Config->LogSettingsFile.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str());
|
||||||
else
|
else
|
||||||
_log(UCS__INIT, "Log settings loaded from %s", Config->LogSettingsFile.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str());
|
||||||
|
|
||||||
WorldShortName = Config->ShortName;
|
WorldShortName = Config->ShortName;
|
||||||
|
|
||||||
_log(UCS__INIT, "Connecting to MySQL...");
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connecting to MySQL...");
|
||||||
|
|
||||||
if (!database.Connect(
|
if (!database.Connect(
|
||||||
Config->DatabaseHost.c_str(),
|
Config->DatabaseHost.c_str(),
|
||||||
@ -113,13 +113,13 @@ int main() {
|
|||||||
if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) {
|
if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) {
|
||||||
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading rule set '%s'", tmp);
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading rule set '%s'", tmp);
|
||||||
if(!RuleManager::Instance()->LoadRules(&database, tmp)) {
|
if(!RuleManager::Instance()->LoadRules(&database, tmp)) {
|
||||||
_log(UCS__ERROR, "Failed to load ruleset '%s', falling back to defaults.", tmp);
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(!RuleManager::Instance()->LoadRules(&database, "default")) {
|
if(!RuleManager::Instance()->LoadRules(&database, "default")) {
|
||||||
_log(UCS__INIT, "No rule set configured, using default rules");
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "No rule set configured, using default rules");
|
||||||
} else {
|
} else {
|
||||||
_log(UCS__INIT, "Loaded default rule set 'default'", tmp);
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Loaded default rule set 'default'", tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ int main() {
|
|||||||
|
|
||||||
if(Config->ChatPort != Config->MailPort)
|
if(Config->ChatPort != Config->MailPort)
|
||||||
{
|
{
|
||||||
_log(UCS__ERROR, "MailPort and CharPort must be the same in eqemu_config.xml for UCS.");
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MailPort and CharPort must be the same in eqemu_config.xml for UCS.");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,11 +138,11 @@ int main() {
|
|||||||
database.LoadChatChannels();
|
database.LoadChatChannels();
|
||||||
|
|
||||||
if (signal(SIGINT, CatchSignal) == SIG_ERR) {
|
if (signal(SIGINT, CatchSignal) == SIG_ERR) {
|
||||||
_log(UCS__ERROR, "Could not set signal handler");
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Could not set signal handler");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (signal(SIGTERM, CatchSignal) == SIG_ERR) {
|
if (signal(SIGTERM, CatchSignal) == SIG_ERR) {
|
||||||
_log(UCS__ERROR, "Could not set signal handler");
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Could not set signal handler");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -16,6 +16,7 @@
|
|||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
#include "../common/debug.h"
|
#include "../common/debug.h"
|
||||||
|
#include "../common/eqemu_logsys.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -51,7 +52,7 @@ WorldServer::~WorldServer()
|
|||||||
|
|
||||||
void WorldServer::OnConnected()
|
void WorldServer::OnConnected()
|
||||||
{
|
{
|
||||||
_log(UCS__INIT, "Connected to World.");
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connected to World.");
|
||||||
WorldConnection::OnConnected();
|
WorldConnection::OnConnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +67,7 @@ void WorldServer::Process()
|
|||||||
|
|
||||||
while((pack = tcpc.PopPacket()))
|
while((pack = tcpc.PopPacket()))
|
||||||
{
|
{
|
||||||
_log(UCS__TRACE, "Received Opcode: %4X", pack->opcode);
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received Opcode: %4X", pack->opcode);
|
||||||
|
|
||||||
switch(pack->opcode)
|
switch(pack->opcode)
|
||||||
{
|
{
|
||||||
@ -87,7 +88,7 @@ void WorldServer::Process()
|
|||||||
|
|
||||||
std::string Message = Buffer;
|
std::string Message = Buffer;
|
||||||
|
|
||||||
_log(UCS__TRACE, "Player: %s, Sent Message: %s", From, Message.c_str());
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Player: %s, Sent Message: %s", From, Message.c_str());
|
||||||
|
|
||||||
Client *c = CL->FindCharacter(From);
|
Client *c = CL->FindCharacter(From);
|
||||||
|
|
||||||
@ -98,7 +99,7 @@ void WorldServer::Process()
|
|||||||
|
|
||||||
if(!c)
|
if(!c)
|
||||||
{
|
{
|
||||||
_log(UCS__TRACE, "Client not found.");
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client not found.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
#include "../common/debug.h"
|
#include "../common/debug.h"
|
||||||
|
#include "../common/eqemu_logsys.h"
|
||||||
#include "ucs.h"
|
#include "ucs.h"
|
||||||
#include "world_config.h"
|
#include "world_config.h"
|
||||||
#include "../common/logsys.h"
|
#include "../common/logsys.h"
|
||||||
@ -17,7 +18,7 @@ void UCSConnection::SetConnection(EmuTCPConnection *inStream)
|
|||||||
{
|
{
|
||||||
if(Stream)
|
if(Stream)
|
||||||
{
|
{
|
||||||
_log(UCS__ERROR, "Incoming UCS Connection while we were already connected to a UCS.");
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Incoming UCS Connection while we were already connected to a UCS.");
|
||||||
Stream->Disconnect();
|
Stream->Disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +52,7 @@ bool UCSConnection::Process()
|
|||||||
{
|
{
|
||||||
struct in_addr in;
|
struct in_addr in;
|
||||||
in.s_addr = GetIP();
|
in.s_addr = GetIP();
|
||||||
_log(UCS__ERROR, "UCS authorization failed.");
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "UCS authorization failed.");
|
||||||
auto pack = new ServerPacket(ServerOP_ZAAuthFailed);
|
auto pack = new ServerPacket(ServerOP_ZAAuthFailed);
|
||||||
SendPacket(pack);
|
SendPacket(pack);
|
||||||
delete pack;
|
delete pack;
|
||||||
@ -63,7 +64,7 @@ bool UCSConnection::Process()
|
|||||||
{
|
{
|
||||||
struct in_addr in;
|
struct in_addr in;
|
||||||
in.s_addr = GetIP();
|
in.s_addr = GetIP();
|
||||||
_log(UCS__ERROR, "UCS authorization failed.");
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "UCS authorization failed.");
|
||||||
auto pack = new ServerPacket(ServerOP_ZAAuthFailed);
|
auto pack = new ServerPacket(ServerOP_ZAAuthFailed);
|
||||||
SendPacket(pack);
|
SendPacket(pack);
|
||||||
delete pack;
|
delete pack;
|
||||||
@ -73,7 +74,7 @@ bool UCSConnection::Process()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_log(UCS__ERROR,"**WARNING** You have not configured a world shared key in your config file. You should add a <key>STRING</key> element to your <world> element to prevent unauthroized zone access.");
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a <key>STRING</key> element to your <world> element to prevent unauthroized zone access.");
|
||||||
authenticated = true;
|
authenticated = true;
|
||||||
}
|
}
|
||||||
delete pack;
|
delete pack;
|
||||||
@ -91,12 +92,12 @@ bool UCSConnection::Process()
|
|||||||
}
|
}
|
||||||
case ServerOP_ZAAuth:
|
case ServerOP_ZAAuth:
|
||||||
{
|
{
|
||||||
_log(UCS__ERROR, "Got authentication from UCS when they are already authenticated.");
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Got authentication from UCS when they are already authenticated.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
_log(UCS__ERROR, "Unknown ServerOPcode from UCS 0x%04x, size %d", pack->opcode, pack->size);
|
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unknown ServerOPcode from UCS 0x%04x, size %d", pack->opcode, pack->size);
|
||||||
DumpPacket(pack->pBuffer, pack->size);
|
DumpPacket(pack->pBuffer, pack->size);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user