Streamline UCS

This commit is contained in:
Akkadius
2019-09-02 01:39:52 -05:00
parent bfd0752c4d
commit ccbbadc5ee
10 changed files with 124 additions and 124 deletions
+30 -30
View File
@@ -235,7 +235,7 @@ std::vector<std::string> ParseRecipients(std::string RecipientString) {
static void ProcessMailTo(Client *c, std::string MailMessage) {
Log(Logs::Detail, Logs::UCSServer, "MAILTO: From %s, %s", c->MailBoxName().c_str(), MailMessage.c_str());
LogInfo("MAILTO: From [{}], [{}]", c->MailBoxName().c_str(), MailMessage.c_str());
std::vector<std::string> Recipients;
@@ -397,7 +397,7 @@ static void ProcessSetMessageStatus(std::string SetMessageCommand) {
static void ProcessCommandBuddy(Client *c, std::string Buddy) {
Log(Logs::Detail, Logs::UCSServer, "Received buddy command with parameters %s", Buddy.c_str());
LogInfo("Received buddy command with parameters [{}]", Buddy.c_str());
c->GeneralChannelMessage("Buddy list modified");
uint8 SubAction = 1;
@@ -426,7 +426,7 @@ static void ProcessCommandBuddy(Client *c, std::string Buddy) {
static void ProcessCommandIgnore(Client *c, std::string Ignoree) {
Log(Logs::Detail, Logs::UCSServer, "Received ignore command with parameters %s", Ignoree.c_str());
LogInfo("Received ignore command with parameters [{}]", Ignoree.c_str());
c->GeneralChannelMessage("Ignore list modified");
uint8 SubAction = 0;
@@ -482,7 +482,7 @@ Clientlist::Clientlist(int ChatPort) {
const ucsconfig *Config = ucsconfig::get();
Log(Logs::General, Logs::UCSServer, "Loading '%s'", Config->MailOpCodesFile.c_str());
LogInfo("Loading [{}]", Config->MailOpCodesFile.c_str());
if (!ChatOpMgr->LoadOpcodes(Config->MailOpCodesFile.c_str()))
exit(1);
@@ -567,7 +567,7 @@ void Clientlist::CheckForStaleConnections(Client *c) {
if (((*Iterator) != c) && ((c->GetName() == (*Iterator)->GetName())
&& (c->GetConnectionType() == (*Iterator)->GetConnectionType()))) {
Log(Logs::Detail, Logs::UCSServer, "Removing old connection for %s", c->GetName().c_str());
LogInfo("Removing old connection for [{}]", c->GetName().c_str());
struct in_addr in;
@@ -670,7 +670,7 @@ void Clientlist::Process()
}
default: {
Log(Logs::Detail, Logs::UCSServer, "Unhandled chat opcode %8X", opcode);
LogInfo("Unhandled chat opcode %8X", opcode);
break;
}
}
@@ -823,7 +823,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, std::string CommandString)
break;
case CommandSetMessageStatus:
Log(Logs::Detail, Logs::UCSServer, "Set Message Status, Params: %s", Parameters.c_str());
LogInfo("Set Message Status, Params: [{}]", Parameters.c_str());
ProcessSetMessageStatus(Parameters);
break;
@@ -848,7 +848,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, std::string CommandString)
default:
c->SendHelp();
Log(Logs::Detail, Logs::UCSServer, "Unhandled OP_Mail command: %s", CommandString.c_str());
LogInfo("Unhandled OP_Mail command: [{}]", CommandString.c_str());
}
}
@@ -859,7 +859,7 @@ void Clientlist::CloseAllConnections() {
for (Iterator = ClientChatConnections.begin(); Iterator != ClientChatConnections.end(); ++Iterator) {
Log(Logs::Detail, Logs::UCSServer, "Removing client %s", (*Iterator)->GetName().c_str());
LogInfo("Removing client [{}]", (*Iterator)->GetName().c_str());
(*Iterator)->CloseConnection();
}
@@ -868,7 +868,7 @@ void Clientlist::CloseAllConnections() {
void Client::AddCharacter(int CharID, const char *CharacterName, int Level) {
if (!CharacterName) return;
Log(Logs::Detail, Logs::UCSServer, "Adding character %s with ID %i for %s", CharacterName, CharID, GetName().c_str());
LogInfo("Adding character [{}] with ID [{}] for [{}]", CharacterName, CharID, GetName().c_str());
CharacterEntry NewCharacter;
NewCharacter.CharID = CharID;
NewCharacter.Name = CharacterName;
@@ -933,7 +933,7 @@ void Client::AddToChannelList(ChatChannel *JoinedChannel) {
for (int i = 0; i < MAX_JOINED_CHANNELS; i++)
if (JoinedChannels[i] == nullptr) {
JoinedChannels[i] = JoinedChannel;
Log(Logs::Detail, Logs::UCSServer, "Added Channel %s to slot %i for %s", JoinedChannel->GetName().c_str(), i + 1, GetName().c_str());
LogInfo("Added Channel [{}] to slot [{}] for [{}]", JoinedChannel->GetName().c_str(), i + 1, GetName().c_str());
return;
}
}
@@ -974,7 +974,7 @@ void Client::JoinChannels(std::string ChannelNameList) {
}
}
Log(Logs::Detail, Logs::UCSServer, "Client: %s joining channels %s", GetName().c_str(), ChannelNameList.c_str());
LogInfo("Client: [{}] joining channels [{}]", GetName().c_str(), ChannelNameList.c_str());
int NumberOfChannels = ChannelCount();
@@ -1073,7 +1073,7 @@ void Client::JoinChannels(std::string ChannelNameList) {
void Client::LeaveChannels(std::string ChannelNameList) {
Log(Logs::Detail, Logs::UCSServer, "Client: %s leaving channels %s", GetName().c_str(), ChannelNameList.c_str());
LogInfo("Client: [{}] leaving channels [{}]", GetName().c_str(), ChannelNameList.c_str());
std::string::size_type CurrentPos = 0;
@@ -1249,7 +1249,7 @@ void Client::SendChannelMessage(std::string Message)
std::string ChannelName = Message.substr(1, MessageStart - 1);
Log(Logs::Detail, Logs::UCSServer, "%s tells %s, [%s]", GetName().c_str(), ChannelName.c_str(), Message.substr(MessageStart + 1).c_str());
LogInfo("[{}] tells [{}], [[{}]]", GetName().c_str(), ChannelName.c_str(), Message.substr(MessageStart + 1).c_str());
ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName);
@@ -1600,7 +1600,7 @@ void Client::SetChannelPassword(std::string ChannelPassword) {
else
Message = "Password change on channel " + ChannelName;
Log(Logs::Detail, Logs::UCSServer, "Set password of channel [%s] to [%s] by %s", ChannelName.c_str(), Password.c_str(), GetName().c_str());
LogInfo("Set password of channel [[{}]] to [[{}]] by [{}]", ChannelName.c_str(), Password.c_str(), GetName().c_str());
ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName);
@@ -1655,7 +1655,7 @@ void Client::SetChannelOwner(std::string CommandString) {
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
Log(Logs::Detail, Logs::UCSServer, "Set owner of channel [%s] to [%s]", ChannelName.c_str(), NewOwner.c_str());
LogInfo("Set owner of channel [[{}]] to [[{}]]", ChannelName.c_str(), NewOwner.c_str());
ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName);
@@ -1743,7 +1743,7 @@ void Client::ChannelInvite(std::string CommandString) {
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
Log(Logs::Detail, Logs::UCSServer, "[%s] invites [%s] to channel [%s]", GetName().c_str(), Invitee.c_str(), ChannelName.c_str());
LogInfo("[[{}]] invites [[{}]] to channel [[{}]]", GetName().c_str(), Invitee.c_str(), ChannelName.c_str());
Client *RequiredClient = g_Clientlist->FindCharacter(Invitee);
@@ -1871,7 +1871,7 @@ void Client::ChannelGrantModerator(std::string CommandString) {
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
Log(Logs::Detail, Logs::UCSServer, "[%s] gives [%s] moderator rights to channel [%s]", GetName().c_str(), Moderator.c_str(), ChannelName.c_str());
LogInfo("[[{}]] gives [[{}]] moderator rights to channel [[{}]]", GetName().c_str(), Moderator.c_str(), ChannelName.c_str());
Client *RequiredClient = g_Clientlist->FindCharacter(Moderator);
@@ -1952,7 +1952,7 @@ void Client::ChannelGrantVoice(std::string CommandString) {
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
Log(Logs::Detail, Logs::UCSServer, "[%s] gives [%s] voice to channel [%s]", GetName().c_str(), Voicee.c_str(), ChannelName.c_str());
LogInfo("[[{}]] gives [[{}]] voice to channel [[{}]]", GetName().c_str(), Voicee.c_str(), ChannelName.c_str());
Client *RequiredClient = g_Clientlist->FindCharacter(Voicee);
@@ -2040,7 +2040,7 @@ void Client::ChannelKick(std::string CommandString) {
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
Log(Logs::Detail, Logs::UCSServer, "[%s] kicks [%s] from channel [%s]", GetName().c_str(), Kickee.c_str(), ChannelName.c_str());
LogInfo("[[{}]] kicks [[{}]] from channel [[{}]]", GetName().c_str(), Kickee.c_str(), ChannelName.c_str());
Client *RequiredClient = g_Clientlist->FindCharacter(Kickee);
@@ -2150,28 +2150,28 @@ void Client::SetConnectionType(char c) {
{
TypeOfConnection = ConnectionTypeChat;
ClientVersion_ = EQEmu::versions::ClientVersion::Titanium;
Log(Logs::Detail, Logs::UCSServer, "Connection type is Chat (Titanium)");
LogInfo("Connection type is Chat (Titanium)");
break;
}
case EQEmu::versions::ucsTitaniumMail:
{
TypeOfConnection = ConnectionTypeMail;
ClientVersion_ = EQEmu::versions::ClientVersion::Titanium;
Log(Logs::Detail, Logs::UCSServer, "Connection type is Mail (Titanium)");
LogInfo("Connection type is Mail (Titanium)");
break;
}
case EQEmu::versions::ucsSoFCombined:
{
TypeOfConnection = ConnectionTypeCombined;
ClientVersion_ = EQEmu::versions::ClientVersion::SoF;
Log(Logs::Detail, Logs::UCSServer, "Connection type is Combined (SoF)");
LogInfo("Connection type is Combined (SoF)");
break;
}
case EQEmu::versions::ucsSoDCombined:
{
TypeOfConnection = ConnectionTypeCombined;
ClientVersion_ = EQEmu::versions::ClientVersion::SoD;
Log(Logs::Detail, Logs::UCSServer, "Connection type is Combined (SoD)");
LogInfo("Connection type is Combined (SoD)");
break;
}
case EQEmu::versions::ucsUFCombined:
@@ -2179,7 +2179,7 @@ void Client::SetConnectionType(char c) {
TypeOfConnection = ConnectionTypeCombined;
ClientVersion_ = EQEmu::versions::ClientVersion::UF;
UnderfootOrLater = true;
Log(Logs::Detail, Logs::UCSServer, "Connection type is Combined (Underfoot)");
LogInfo("Connection type is Combined (Underfoot)");
break;
}
case EQEmu::versions::ucsRoFCombined:
@@ -2187,7 +2187,7 @@ void Client::SetConnectionType(char c) {
TypeOfConnection = ConnectionTypeCombined;
ClientVersion_ = EQEmu::versions::ClientVersion::RoF;
UnderfootOrLater = true;
Log(Logs::Detail, Logs::UCSServer, "Connection type is Combined (RoF)");
LogInfo("Connection type is Combined (RoF)");
break;
}
case EQEmu::versions::ucsRoF2Combined:
@@ -2195,14 +2195,14 @@ void Client::SetConnectionType(char c) {
TypeOfConnection = ConnectionTypeCombined;
ClientVersion_ = EQEmu::versions::ClientVersion::RoF2;
UnderfootOrLater = true;
Log(Logs::Detail, Logs::UCSServer, "Connection type is Combined (RoF2)");
LogInfo("Connection type is Combined (RoF2)");
break;
}
default:
{
TypeOfConnection = ConnectionTypeUnknown;
ClientVersion_ = EQEmu::versions::ClientVersion::Unknown;
Log(Logs::Detail, Logs::UCSServer, "Connection type is unknown.");
LogInfo("Connection type is unknown");
}
}
}
@@ -2279,12 +2279,12 @@ void Client::SendNotification(int MailBoxNumber, std::string Subject, std::strin
void Client::ChangeMailBox(int NewMailBox)
{
Log(Logs::Detail, Logs::UCSServer, "%s Change to mailbox %i", MailBoxName().c_str(), NewMailBox);
LogInfo("[{}] Change to mailbox [{}]", MailBoxName().c_str(), NewMailBox);
SetMailBox(NewMailBox);
auto id = std::to_string(NewMailBox);
Log(Logs::Detail, Logs::UCSServer, "New mailbox is %s", MailBoxName().c_str());
LogInfo("New mailbox is [{}]", MailBoxName().c_str());
auto outapp = new EQApplicationPacket(OP_MailboxChange, id.length() + 1);