mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-03 05:16:37 +00:00
Merge of a monster
This commit is contained in:
+16
-16
@@ -43,7 +43,7 @@ ChatChannel::ChatChannel(std::string inName, std::string inOwner, std::string in
|
||||
|
||||
Moderated = false;
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "New ChatChannel created: Name: [%s], Owner: [%s], Password: [%s], MinStatus: %i",
|
||||
Log(Logs::Detail, Logs::UCS_Server, "New ChatChannel created: Name: [%s], Owner: [%s], Password: [%s], MinStatus: %i",
|
||||
Name.c_str(), Owner.c_str(), Password.c_str(), MinimumStatus);
|
||||
|
||||
}
|
||||
@@ -150,7 +150,7 @@ void ChatChannelList::SendAllChannels(Client *c) {
|
||||
|
||||
void ChatChannelList::RemoveChannel(ChatChannel *Channel) {
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "RemoveChannel(%s)", Channel->GetName().c_str());
|
||||
Log(Logs::Detail, Logs::UCS_Server, "RemoveChannel(%s)", Channel->GetName().c_str());
|
||||
|
||||
LinkedListIterator<ChatChannel*> iterator(ChatChannels);
|
||||
|
||||
@@ -171,7 +171,7 @@ void ChatChannelList::RemoveChannel(ChatChannel *Channel) {
|
||||
|
||||
void ChatChannelList::RemoveAllChannels() {
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "RemoveAllChannels");
|
||||
Log(Logs::Detail, Logs::UCS_Server, "RemoveAllChannels");
|
||||
|
||||
LinkedListIterator<ChatChannel*> iterator(ChatChannels);
|
||||
|
||||
@@ -229,7 +229,7 @@ void ChatChannel::AddClient(Client *c) {
|
||||
|
||||
if(IsClientInChannel(c)) {
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Client %s already in channel %s", c->GetName().c_str(), GetName().c_str());
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Client %s already in channel %s", c->GetName().c_str(), GetName().c_str());
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -238,7 +238,7 @@ void ChatChannel::AddClient(Client *c) {
|
||||
|
||||
int AccountStatus = c->GetAccountStatus();
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Adding %s to channel %s", c->GetName().c_str(), Name.c_str());
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Adding %s to channel %s", c->GetName().c_str(), Name.c_str());
|
||||
|
||||
LinkedListIterator<Client*> iterator(ClientsInChannel);
|
||||
|
||||
@@ -263,7 +263,7 @@ bool ChatChannel::RemoveClient(Client *c) {
|
||||
|
||||
if(!c) return false;
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "RemoveClient %s from channel %s", c->GetName().c_str(), GetName().c_str());
|
||||
Log(Logs::Detail, Logs::UCS_Server, "RemoveClient %s from channel %s", c->GetName().c_str(), GetName().c_str());
|
||||
|
||||
bool HideMe = c->GetHideMe();
|
||||
|
||||
@@ -300,7 +300,7 @@ bool ChatChannel::RemoveClient(Client *c) {
|
||||
if((Password.length() == 0) || (RuleI(Channels, DeleteTimer) == 0))
|
||||
return false;
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Starting delete timer for empty password protected channel %s", Name.c_str());
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Starting delete timer for empty password protected channel %s", Name.c_str());
|
||||
|
||||
DeleteTimer.Start(RuleI(Channels, DeleteTimer) * 60000);
|
||||
}
|
||||
@@ -396,7 +396,7 @@ void ChatChannel::SendMessageToChannel(std::string Message, Client* Sender) {
|
||||
|
||||
if(ChannelClient)
|
||||
{
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Sending message to %s from %s",
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Sending message to %s from %s",
|
||||
ChannelClient->GetName().c_str(), Sender->GetName().c_str());
|
||||
ChannelClient->SendChannelMessage(Name, Message, Sender);
|
||||
}
|
||||
@@ -478,7 +478,7 @@ ChatChannel *ChatChannelList::AddClientToChannel(std::string ChannelName, Client
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "AddClient to channel [%s] with password [%s]", NormalisedName.c_str(), Password.c_str());
|
||||
Log(Logs::Detail, Logs::UCS_Server, "AddClient to channel [%s] with password [%s]", NormalisedName.c_str(), Password.c_str());
|
||||
|
||||
ChatChannel *RequiredChannel = FindChannel(NormalisedName);
|
||||
|
||||
@@ -554,7 +554,7 @@ void ChatChannelList::Process() {
|
||||
|
||||
if(CurrentChannel && CurrentChannel->ReadyToDelete()) {
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Empty temporary password protected channel %s being destroyed.",
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Empty temporary password protected channel %s being destroyed.",
|
||||
CurrentChannel->GetName().c_str());
|
||||
|
||||
RemoveChannel(CurrentChannel);
|
||||
@@ -570,7 +570,7 @@ void ChatChannel::AddInvitee(const std::string &Invitee)
|
||||
if (!IsInvitee(Invitee)) {
|
||||
Invitees.push_back(Invitee);
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Added %s as invitee to channel %s", Invitee.c_str(), Name.c_str());
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Added %s as invitee to channel %s", Invitee.c_str(), Name.c_str());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -581,7 +581,7 @@ void ChatChannel::RemoveInvitee(std::string Invitee)
|
||||
|
||||
if(it != std::end(Invitees)) {
|
||||
Invitees.erase(it);
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Removed %s as invitee to channel %s", Invitee.c_str(), Name.c_str());
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Removed %s as invitee to channel %s", Invitee.c_str(), Name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -595,7 +595,7 @@ void ChatChannel::AddModerator(const std::string &Moderator)
|
||||
if (!IsModerator(Moderator)) {
|
||||
Moderators.push_back(Moderator);
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Added %s as moderator to channel %s", Moderator.c_str(), Name.c_str());
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Added %s as moderator to channel %s", Moderator.c_str(), Name.c_str());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -606,7 +606,7 @@ void ChatChannel::RemoveModerator(const std::string &Moderator)
|
||||
|
||||
if (it != std::end(Moderators)) {
|
||||
Moderators.erase(it);
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Removed %s as moderator to channel %s", Moderator.c_str(), Name.c_str());
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Removed %s as moderator to channel %s", Moderator.c_str(), Name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -620,7 +620,7 @@ void ChatChannel::AddVoice(const std::string &inVoiced)
|
||||
if (!HasVoice(inVoiced)) {
|
||||
Voiced.push_back(inVoiced);
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Added %s as voiced to channel %s", inVoiced.c_str(), Name.c_str());
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Added %s as voiced to channel %s", inVoiced.c_str(), Name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -631,7 +631,7 @@ void ChatChannel::RemoveVoice(const std::string &inVoiced)
|
||||
if (it != std::end(Voiced)) {
|
||||
Voiced.erase(it);
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Removed %s as voiced to channel %s", inVoiced.c_str(), Name.c_str());
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Removed %s as voiced to channel %s", inVoiced.c_str(), Name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+408
-409
File diff suppressed because it is too large
Load Diff
+38
-37
@@ -74,14 +74,14 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
if (!Open(host, user, passwd, database, port, &errnum, errbuf))
|
||||
{
|
||||
Log.Out(Logs::General, Logs::Error, "Failed to connect to database: Error: %s", errbuf);
|
||||
Log(Logs::General, Logs::Error, "Failed to connect to database: Error: %s", errbuf);
|
||||
HandleMysqlError(errnum);
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Out(Logs::General, Logs::Status, "Using database '%s' at %s:%d",database,host,port);
|
||||
Log(Logs::General, Logs::Status, "Using database '%s' at %s:%d",database,host,port);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -110,15 +110,15 @@ void Database::GetAccountStatus(Client *client) {
|
||||
client->GetAccountID());
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Unable to get account status for character %s, error %s", client->GetName().c_str(), results.ErrorMessage().c_str());
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Unable to get account status for character %s, error %s", client->GetName().c_str(), results.ErrorMessage().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "GetAccountStatus Query: %s", query.c_str());
|
||||
Log(Logs::Detail, Logs::UCS_Server, "GetAccountStatus Query: %s", query.c_str());
|
||||
|
||||
if(results.RowCount() != 1)
|
||||
{
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Error in GetAccountStatus");
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Error in GetAccountStatus");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -129,13 +129,13 @@ void Database::GetAccountStatus(Client *client) {
|
||||
client->SetKarma(atoi(row[2]));
|
||||
client->SetRevoked((atoi(row[3])==1?true:false));
|
||||
|
||||
Log.Out(Logs::Detail, Logs::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());
|
||||
Log(Logs::Detail, Logs::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) {
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "FindAccount for character %s", characterName);
|
||||
Log(Logs::Detail, Logs::UCS_Server, "FindAccount for character %s", characterName);
|
||||
|
||||
|
||||
client->ClearCharacters();
|
||||
@@ -144,12 +144,12 @@ int Database::FindAccount(const char *characterName, Client *client) {
|
||||
characterName);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "FindAccount query failed: %s", query.c_str());
|
||||
Log(Logs::Detail, Logs::UCS_Server, "FindAccount query failed: %s", query.c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (results.RowCount() != 1) {
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Bad result from query");
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Bad result from query");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ int Database::FindAccount(const char *characterName, Client *client) {
|
||||
|
||||
int accountID = atoi(row[1]);
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Account ID for %s is %i", characterName, accountID);
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Account ID for %s is %i", characterName, accountID);
|
||||
|
||||
query = StringFormat("SELECT `id`, `name`, `level` FROM `character_data` "
|
||||
"WHERE `account_id` = %i AND `name` != '%s'",
|
||||
@@ -179,7 +179,7 @@ bool Database::VerifyMailKey(std::string characterName, int IPAddress, std::stri
|
||||
characterName.c_str());
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Error retrieving mailkey from database: %s", results.ErrorMessage().c_str());
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Error retrieving mailkey from database: %s", results.ErrorMessage().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ bool Database::VerifyMailKey(std::string characterName, int IPAddress, std::stri
|
||||
else
|
||||
sprintf(combinedKey, "%s", MailKey.c_str());
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "DB key is [%s], Client key is [%s]", (row[0] ? row[0] : ""), combinedKey);
|
||||
Log(Logs::Detail, Logs::UCS_Server, "DB key is [%s], Client key is [%s]", (row[0] ? row[0] : ""), combinedKey);
|
||||
|
||||
return !strcmp(row[0], combinedKey);
|
||||
}
|
||||
@@ -213,7 +213,7 @@ int Database::FindCharacter(const char *characterName)
|
||||
safe_delete_array(safeCharName);
|
||||
|
||||
if (results.RowCount() != 1) {
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Bad result from FindCharacter query for character %s",
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Bad result from FindCharacter query for character %s",
|
||||
characterName);
|
||||
return -1;
|
||||
}
|
||||
@@ -245,7 +245,7 @@ bool Database::GetVariable(const char* varname, char* varvalue, uint16 varvalue_
|
||||
|
||||
bool Database::LoadChatChannels() {
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Loading chat channels from the database.");
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Loading chat channels from the database.");
|
||||
|
||||
const std::string query = "SELECT `name`, `owner`, `password`, `minstatus` FROM `chatchannels`";
|
||||
auto results = QueryDatabase(query);
|
||||
@@ -266,7 +266,7 @@ bool Database::LoadChatChannels() {
|
||||
|
||||
void Database::SetChannelPassword(std::string channelName, std::string password) {
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Database::SetChannelPassword(%s, %s)", channelName.c_str(), password.c_str());
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Database::SetChannelPassword(%s, %s)", channelName.c_str(), password.c_str());
|
||||
|
||||
std::string query = StringFormat("UPDATE `chatchannels` SET `password` = '%s' WHERE `name` = '%s'",
|
||||
password.c_str(), channelName.c_str());
|
||||
@@ -275,7 +275,7 @@ void Database::SetChannelPassword(std::string channelName, std::string password)
|
||||
|
||||
void Database::SetChannelOwner(std::string channelName, std::string owner) {
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Database::SetChannelOwner(%s, %s)", channelName.c_str(), owner.c_str());
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Database::SetChannelOwner(%s, %s)", channelName.c_str(), owner.c_str());
|
||||
|
||||
std::string query = StringFormat("UPDATE `chatchannels` SET `owner` = '%s' WHERE `name` = '%s'",
|
||||
owner.c_str(), channelName.c_str());
|
||||
@@ -288,7 +288,7 @@ void Database::SendHeaders(Client *client) {
|
||||
int unknownField3 = 1;
|
||||
int characterID = FindCharacter(client->MailBoxName().c_str());
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Sendheaders for %s, CharID is %i", client->MailBoxName().c_str(), characterID);
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Sendheaders for %s, CharID is %i", client->MailBoxName().c_str(), characterID);
|
||||
|
||||
if(characterID <= 0)
|
||||
return;
|
||||
@@ -373,7 +373,7 @@ void Database::SendBody(Client *client, int messageNumber) {
|
||||
|
||||
int characterID = FindCharacter(client->MailBoxName().c_str());
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "SendBody: MsgID %i, to %s, CharID is %i", messageNumber, client->MailBoxName().c_str(), characterID);
|
||||
Log(Logs::Detail, Logs::UCS_Server, "SendBody: MsgID %i, to %s, CharID is %i", messageNumber, client->MailBoxName().c_str(), characterID);
|
||||
|
||||
if(characterID <= 0)
|
||||
return;
|
||||
@@ -390,7 +390,7 @@ void Database::SendBody(Client *client, int messageNumber) {
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Message: %i body (%i bytes)", messageNumber, strlen(row[1]));
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Message: %i body (%i bytes)", messageNumber, strlen(row[1]));
|
||||
|
||||
int packetLength = 12 + strlen(row[0]) + strlen(row[1]) + strlen(row[2]);
|
||||
|
||||
@@ -435,7 +435,7 @@ bool Database::SendMail(std::string recipient, std::string from, std::string sub
|
||||
|
||||
characterID = FindCharacter(characterName.c_str());
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "SendMail: CharacterID for recipient %s is %i", characterName.c_str(), characterID);
|
||||
Log(Logs::Detail, Logs::UCS_Server, "SendMail: CharacterID for recipient %s is %i", characterName.c_str(), characterID);
|
||||
|
||||
if(characterID <= 0)
|
||||
return false;
|
||||
@@ -460,7 +460,7 @@ bool Database::SendMail(std::string recipient, std::string from, std::string sub
|
||||
return false;
|
||||
}
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "MessageID %i generated, from %s, to %s", results.LastInsertedID(), from.c_str(), recipient.c_str());
|
||||
Log(Logs::Detail, Logs::UCS_Server, "MessageID %i generated, from %s, to %s", results.LastInsertedID(), from.c_str(), recipient.c_str());
|
||||
|
||||
|
||||
Client *client = g_Clientlist->IsCharacterOnline(characterName);
|
||||
@@ -477,7 +477,7 @@ bool Database::SendMail(std::string recipient, std::string from, std::string sub
|
||||
|
||||
void Database::SetMessageStatus(int messageNumber, int status) {
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "SetMessageStatus %i %i", messageNumber, status);
|
||||
Log(Logs::Detail, Logs::UCS_Server, "SetMessageStatus %i %i", messageNumber, status);
|
||||
|
||||
if(status == 0) {
|
||||
std::string query = StringFormat("DELETE FROM `mail` WHERE `msgid` = %i", messageNumber);
|
||||
@@ -491,7 +491,7 @@ void Database::SetMessageStatus(int messageNumber, int status) {
|
||||
|
||||
void Database::ExpireMail() {
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Expiring mail...");
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Expiring mail...");
|
||||
|
||||
std::string query = "SELECT COUNT(*) FROM `mail`";
|
||||
auto results = QueryDatabase(query);
|
||||
@@ -501,7 +501,7 @@ void Database::ExpireMail() {
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "There are %s messages in the database.", row[0]);
|
||||
Log(Logs::Detail, Logs::UCS_Server, "There are %s messages in the database.", row[0]);
|
||||
|
||||
// Expire Trash
|
||||
if(RuleI(Mail, ExpireTrash) >= 0) {
|
||||
@@ -509,7 +509,7 @@ void Database::ExpireMail() {
|
||||
time(nullptr) - RuleI(Mail, ExpireTrash));
|
||||
results = QueryDatabase(query);
|
||||
if(results.Success())
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Expired %i trash messages.", results.RowsAffected());
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Expired %i trash messages.", results.RowsAffected());
|
||||
}
|
||||
|
||||
// Expire Read
|
||||
@@ -518,7 +518,7 @@ void Database::ExpireMail() {
|
||||
time(nullptr) - RuleI(Mail, ExpireRead));
|
||||
results = QueryDatabase(query);
|
||||
if(results.Success())
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Expired %i read messages.", results.RowsAffected());
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Expired %i read messages.", results.RowsAffected());
|
||||
}
|
||||
|
||||
// Expire Unread
|
||||
@@ -527,7 +527,7 @@ void Database::ExpireMail() {
|
||||
time(nullptr) - RuleI(Mail, ExpireUnread));
|
||||
results = QueryDatabase(query);
|
||||
if(results.Success())
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Expired %i unread messages.", results.RowsAffected());
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Expired %i unread messages.", results.RowsAffected());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -538,7 +538,7 @@ void Database::AddFriendOrIgnore(int charID, int type, std::string name) {
|
||||
charID, type, CapitaliseName(name).c_str());
|
||||
auto results = QueryDatabase(query);
|
||||
if(results.Success())
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Wrote Friend/Ignore entry for charid %i, type %i, name %s to database.", charID, type, name.c_str());
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Wrote Friend/Ignore entry for charid %i, type %i, name %s to database.", charID, type, name.c_str());
|
||||
|
||||
}
|
||||
|
||||
@@ -548,11 +548,12 @@ void Database::RemoveFriendOrIgnore(int charID, int type, std::string name) {
|
||||
"AND `type` = %i AND `name` = '%s'",
|
||||
charID, type, CapitaliseName(name).c_str());
|
||||
auto results = QueryDatabase(query);
|
||||
if(!results.Success())
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Error removing friend/ignore, query was %s", query.c_str());
|
||||
else
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Removed Friend/Ignore entry for charid %i, type %i, name %s from database.", charID, type, name.c_str());
|
||||
|
||||
if (!results.Success()) {
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Error removing friend/ignore, query was %s", query.c_str());
|
||||
}
|
||||
else {
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Removed Friend/Ignore entry for charid %i, type %i, name %s from database.", charID, type, name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void Database::GetFriendsAndIgnore(int charID, std::vector<std::string> &friends, std::vector<std::string> &ignorees) {
|
||||
@@ -570,12 +571,12 @@ void Database::GetFriendsAndIgnore(int charID, std::vector<std::string> &friends
|
||||
if(atoi(row[0]) == 0)
|
||||
{
|
||||
ignorees.push_back(name);
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Added Ignoree from DB %s", name.c_str());
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Added Ignoree from DB %s", name.c_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
friends.push_back(name);
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Added Friend from DB %s", name.c_str());
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Added Friend from DB %s", name.c_str());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -594,7 +595,7 @@ void Database::LoadLogSettings(EQEmuLogSys::LogSettings* log_settings){
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
int log_category = 0;
|
||||
Log.file_logs_enabled = false;
|
||||
LogSys.file_logs_enabled = false;
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
log_category = atoi(row[0]);
|
||||
@@ -617,7 +618,7 @@ void Database::LoadLogSettings(EQEmuLogSys::LogSettings* log_settings){
|
||||
If we go through this whole loop and nothing is set to any debug level, there is no point to create a file or keep anything open
|
||||
*/
|
||||
if (log_settings[log_category].log_to_file > 0){
|
||||
Log.file_logs_enabled = true;
|
||||
LogSys.file_logs_enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+16
-16
@@ -38,7 +38,7 @@
|
||||
|
||||
ChatChannelList *ChannelList;
|
||||
Clientlist *g_Clientlist;
|
||||
EQEmuLogSys Log;
|
||||
EQEmuLogSys LogSys;
|
||||
Database database;
|
||||
WorldServer *worldserver = nullptr;
|
||||
|
||||
@@ -64,7 +64,7 @@ std::string GetMailPrefix() {
|
||||
|
||||
int main() {
|
||||
RegisterExecutablePlatform(ExePlatformUCS);
|
||||
Log.LoadLogSettingsDefaults();
|
||||
LogSys.LoadLogSettingsDefaults();
|
||||
set_exception_handler();
|
||||
|
||||
// Check every minute for unused channels we can delete
|
||||
@@ -73,10 +73,10 @@ int main() {
|
||||
|
||||
Timer InterserverTimer(INTERSERVER_TIMER); // does auto-reconnect
|
||||
|
||||
Log.Out(Logs::General, Logs::UCS_Server, "Starting EQEmu Universal Chat Server.");
|
||||
Log(Logs::General, Logs::UCS_Server, "Starting EQEmu Universal Chat Server.");
|
||||
|
||||
if (!ucsconfig::LoadConfig()) {
|
||||
Log.Out(Logs::General, Logs::UCS_Server, "Loading server configuration failed.");
|
||||
Log(Logs::General, Logs::UCS_Server, "Loading server configuration failed.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ int main() {
|
||||
|
||||
WorldShortName = Config->ShortName;
|
||||
|
||||
Log.Out(Logs::General, Logs::UCS_Server, "Connecting to MySQL...");
|
||||
Log(Logs::General, Logs::UCS_Server, "Connecting to MySQL...");
|
||||
|
||||
if (!database.Connect(
|
||||
Config->DatabaseHost.c_str(),
|
||||
@@ -92,26 +92,26 @@ int main() {
|
||||
Config->DatabasePassword.c_str(),
|
||||
Config->DatabaseDB.c_str(),
|
||||
Config->DatabasePort)) {
|
||||
Log.Out(Logs::General, Logs::UCS_Server, "Cannot continue without a database connection.");
|
||||
Log(Logs::General, Logs::UCS_Server, "Cannot continue without a database connection.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Register Log System and Settings */
|
||||
database.LoadLogSettings(Log.log_settings);
|
||||
Log.StartFileLogs();
|
||||
database.LoadLogSettings(LogSys.log_settings);
|
||||
LogSys.StartFileLogs();
|
||||
|
||||
char tmp[64];
|
||||
|
||||
if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) {
|
||||
Log.Out(Logs::General, Logs::UCS_Server, "Loading rule set '%s'", tmp);
|
||||
Log(Logs::General, Logs::UCS_Server, "Loading rule set '%s'", tmp);
|
||||
if(!RuleManager::Instance()->LoadRules(&database, tmp)) {
|
||||
Log.Out(Logs::General, Logs::UCS_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp);
|
||||
Log(Logs::General, Logs::UCS_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp);
|
||||
}
|
||||
} else {
|
||||
if(!RuleManager::Instance()->LoadRules(&database, "default")) {
|
||||
Log.Out(Logs::General, Logs::UCS_Server, "No rule set configured, using default rules");
|
||||
Log(Logs::General, Logs::UCS_Server, "No rule set configured, using default rules");
|
||||
} else {
|
||||
Log.Out(Logs::General, Logs::UCS_Server, "Loaded default rule set 'default'", tmp);
|
||||
Log(Logs::General, Logs::UCS_Server, "Loaded default rule set 'default'", tmp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ int main() {
|
||||
|
||||
if(Config->ChatPort != Config->MailPort)
|
||||
{
|
||||
Log.Out(Logs::General, Logs::UCS_Server, "MailPort and CharPort must be the same in eqemu_config.xml for UCS.");
|
||||
Log(Logs::General, Logs::UCS_Server, "MailPort and CharPort must be the same in eqemu_config.xml for UCS.");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -130,11 +130,11 @@ int main() {
|
||||
database.LoadChatChannels();
|
||||
|
||||
if (signal(SIGINT, CatchSignal) == SIG_ERR) {
|
||||
Log.Out(Logs::General, Logs::UCS_Server, "Could not set signal handler");
|
||||
Log(Logs::General, Logs::UCS_Server, "Could not set signal handler");
|
||||
return 1;
|
||||
}
|
||||
if (signal(SIGTERM, CatchSignal) == SIG_ERR) {
|
||||
Log.Out(Logs::General, Logs::UCS_Server, "Could not set signal handler");
|
||||
Log(Logs::General, Logs::UCS_Server, "Could not set signal handler");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ int main() {
|
||||
|
||||
g_Clientlist->CloseAllConnections();
|
||||
|
||||
Log.CloseFileLogs();
|
||||
LogSys.CloseFileLogs();
|
||||
|
||||
}
|
||||
|
||||
|
||||
+60
-61
@@ -1,19 +1,19 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "../common/global_define.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
@@ -56,64 +56,63 @@ void WorldServer::ProcessMessage(uint16 opcode, EQ::Net::Packet &p)
|
||||
ServerPacket tpack(opcode, p);
|
||||
ServerPacket *pack = &tpack;
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Received Opcode: %4X", opcode);
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Received Opcode: %4X", opcode);
|
||||
|
||||
switch(opcode)
|
||||
switch (opcode)
|
||||
{
|
||||
case 0: {
|
||||
case 0: {
|
||||
break;
|
||||
}
|
||||
case ServerOP_KeepAlive:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case ServerOP_UCSMessage:
|
||||
{
|
||||
char *Buffer = (char *)pack->pBuffer;
|
||||
|
||||
auto From = new char[strlen(Buffer) + 1];
|
||||
|
||||
VARSTRUCT_DECODE_STRING(From, Buffer);
|
||||
|
||||
std::string Message = Buffer;
|
||||
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Player: %s, Sent Message: %s", From, Message.c_str());
|
||||
|
||||
Client *c = g_Clientlist->FindCharacter(From);
|
||||
|
||||
safe_delete_array(From);
|
||||
|
||||
if (Message.length() < 2)
|
||||
break;
|
||||
}
|
||||
case ServerOP_KeepAlive:
|
||||
|
||||
if (!c)
|
||||
{
|
||||
Log(Logs::Detail, Logs::UCS_Server, "Client not found.");
|
||||
break;
|
||||
}
|
||||
case ServerOP_UCSMessage:
|
||||
|
||||
if (Message[0] == ';')
|
||||
{
|
||||
char *Buffer = (char *)pack->pBuffer;
|
||||
|
||||
auto From = new char[strlen(Buffer) + 1];
|
||||
|
||||
VARSTRUCT_DECODE_STRING(From, Buffer);
|
||||
|
||||
std::string Message = Buffer;
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Player: %s, Sent Message: %s", From, Message.c_str());
|
||||
|
||||
Client *c = g_Clientlist->FindCharacter(From);
|
||||
|
||||
safe_delete_array(From);
|
||||
|
||||
if(Message.length() < 2)
|
||||
break;
|
||||
|
||||
if(!c)
|
||||
{
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "Client not found.");
|
||||
break;
|
||||
}
|
||||
|
||||
if(Message[0] == ';')
|
||||
{
|
||||
c->SendChannelMessageByNumber(Message.substr(1, std::string::npos));
|
||||
}
|
||||
else if(Message[0] == '[')
|
||||
{
|
||||
g_Clientlist->ProcessOPMailCommand(c, Message.substr(1, std::string::npos));
|
||||
}
|
||||
|
||||
break;
|
||||
c->SendChannelMessageByNumber(Message.substr(1, std::string::npos));
|
||||
}
|
||||
|
||||
case ServerOP_UCSMailMessage:
|
||||
else if (Message[0] == '[')
|
||||
{
|
||||
ServerMailMessageHeader_Struct *mail = (ServerMailMessageHeader_Struct*)pack->pBuffer;
|
||||
database.SendMail(std::string("SOE.EQ.") + Config->ShortName + std::string(".") + std::string(mail->to),
|
||||
std::string(mail->from),
|
||||
mail->subject,
|
||||
mail->message,
|
||||
std::string());
|
||||
break;
|
||||
g_Clientlist->ProcessOPMailCommand(c, Message.substr(1, std::string::npos));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case ServerOP_UCSMailMessage:
|
||||
{
|
||||
ServerMailMessageHeader_Struct *mail = (ServerMailMessageHeader_Struct*)pack->pBuffer;
|
||||
database.SendMail(std::string("SOE.EQ.") + Config->ShortName + std::string(".") + std::string(mail->to),
|
||||
std::string(mail->from),
|
||||
mail->subject,
|
||||
mail->message,
|
||||
std::string());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user