mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 18:52:22 +00:00
Change space indentation to tabs
This commit is contained in:
+20
-20
@@ -1,20 +1,20 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
|
||||
|
||||
SET(ucs_sources
|
||||
chatchannel.cpp
|
||||
clientlist.cpp
|
||||
database.cpp
|
||||
ucs.cpp
|
||||
ucsconfig.cpp
|
||||
worldserver.cpp
|
||||
chatchannel.cpp
|
||||
clientlist.cpp
|
||||
database.cpp
|
||||
ucs.cpp
|
||||
ucsconfig.cpp
|
||||
worldserver.cpp
|
||||
)
|
||||
|
||||
SET(ucs_headers
|
||||
chatchannel.h
|
||||
clientlist.h
|
||||
database.h
|
||||
ucsconfig.h
|
||||
worldserver.h
|
||||
chatchannel.h
|
||||
clientlist.h
|
||||
database.h
|
||||
ucsconfig.h
|
||||
worldserver.h
|
||||
)
|
||||
|
||||
ADD_EXECUTABLE(ucs ${ucs_sources} ${ucs_headers})
|
||||
@@ -25,21 +25,21 @@ TARGET_LINK_LIBRARIES(ucs Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_
|
||||
|
||||
IF(MSVC)
|
||||
|
||||
SET_TARGET_PROPERTIES(ucs PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
|
||||
TARGET_LINK_LIBRARIES(ucs "Ws2_32.lib")
|
||||
SET_TARGET_PROPERTIES(ucs PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
|
||||
TARGET_LINK_LIBRARIES(ucs "Ws2_32.lib")
|
||||
ENDIF(MSVC)
|
||||
|
||||
IF(MINGW)
|
||||
TARGET_LINK_LIBRARIES(ucs "WS2_32")
|
||||
TARGET_LINK_LIBRARIES(ucs "WS2_32")
|
||||
ENDIF(MINGW)
|
||||
|
||||
IF(UNIX)
|
||||
TARGET_LINK_LIBRARIES(ucs "dl")
|
||||
TARGET_LINK_LIBRARIES(ucs "z")
|
||||
TARGET_LINK_LIBRARIES(ucs "m")
|
||||
TARGET_LINK_LIBRARIES(ucs "rt")
|
||||
TARGET_LINK_LIBRARIES(ucs "pthread")
|
||||
ADD_DEFINITIONS(-fPIC)
|
||||
TARGET_LINK_LIBRARIES(ucs "dl")
|
||||
TARGET_LINK_LIBRARIES(ucs "z")
|
||||
TARGET_LINK_LIBRARIES(ucs "m")
|
||||
TARGET_LINK_LIBRARIES(ucs "rt")
|
||||
TARGET_LINK_LIBRARIES(ucs "pthread")
|
||||
ADD_DEFINITIONS(-fPIC)
|
||||
ENDIF(UNIX)
|
||||
|
||||
SET(EXECUTABLE_OUTPUT_PATH ../Bin)
|
||||
|
||||
+7
-8
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
EQEMu: Everquest Server Emulator
|
||||
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -11,11 +9,11 @@
|
||||
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.
|
||||
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
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
@@ -44,7 +42,7 @@ ChatChannel::ChatChannel(string inName, string inOwner, string inPassword, bool
|
||||
Moderated = false;
|
||||
|
||||
_log(UCS__TRACE, "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);
|
||||
|
||||
}
|
||||
|
||||
@@ -399,7 +397,7 @@ void ChatChannel::SendMessageToChannel(string Message, Client* Sender) {
|
||||
if(ChannelClient)
|
||||
{
|
||||
_log(UCS__TRACE, "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);
|
||||
}
|
||||
|
||||
@@ -509,7 +507,7 @@ ChatChannel *ChatChannelList::AddClientToChannel(string ChannelName, Client *c)
|
||||
}
|
||||
|
||||
if(RequiredChannel->CheckPassword(Password) || RequiredChannel->IsOwner(c->GetName()) || RequiredChannel->IsModerator(c->GetName()) ||
|
||||
c->IsChannelAdmin()) {
|
||||
c->IsChannelAdmin()) {
|
||||
|
||||
RequiredChannel->AddClient(c);
|
||||
|
||||
@@ -704,3 +702,4 @@ string CapitaliseName(string inString) {
|
||||
|
||||
return NormalisedName;
|
||||
}
|
||||
|
||||
|
||||
+23
-24
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
EQEMu: Everquest Server Emulator
|
||||
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -11,11 +9,11 @@
|
||||
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.
|
||||
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
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
@@ -209,7 +207,7 @@ vector<string> ParseRecipients(string RecipientString) {
|
||||
|
||||
LastPeriod = (*Iterator).find_last_of(".");
|
||||
|
||||
if(LastPeriod != string::npos) {
|
||||
if(LastPeriod != string::npos) {
|
||||
|
||||
(*Iterator) = (*Iterator).substr(LastPeriod + 1);
|
||||
|
||||
@@ -309,7 +307,7 @@ static void ProcessMailTo(Client *c, string MailMessage) {
|
||||
if(!database.SendMail(Recipients[i], c->MailBoxName(), Subject, Body, RecipientsString)) {
|
||||
|
||||
_log(UCS__ERROR, "Failed in SendMail(%s, %s, %s, %s)", Recipients[i].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 + Recipients[i].length() + Subject.length();
|
||||
|
||||
@@ -561,16 +559,16 @@ void Clientlist::CheckForStaleConnections(Client *c) {
|
||||
for(Iterator = ClientChatConnections.begin(); Iterator != ClientChatConnections.end(); Iterator++) {
|
||||
|
||||
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());
|
||||
|
||||
struct in_addr in;
|
||||
struct in_addr in;
|
||||
|
||||
in.s_addr = (*Iterator)->ClientStream->GetRemoteIP();
|
||||
|
||||
_log(UCS__CLIENT, "Client connection from %s:%d closed.", inet_ntoa(in),
|
||||
ntohs((*Iterator)->ClientStream->GetRemotePort()));
|
||||
ntohs((*Iterator)->ClientStream->GetRemotePort()));
|
||||
|
||||
safe_delete((*Iterator));
|
||||
|
||||
@@ -585,7 +583,7 @@ void Clientlist::Process() {
|
||||
|
||||
while((eqs = chatsf->Pop())) {
|
||||
|
||||
struct in_addr in;
|
||||
struct in_addr in;
|
||||
|
||||
in.s_addr = eqs->GetRemoteIP();
|
||||
|
||||
@@ -605,12 +603,12 @@ void Clientlist::Process() {
|
||||
(*Iterator)->AccountUpdate();
|
||||
if((*Iterator)->ClientStream->CheckClosed()) {
|
||||
|
||||
struct in_addr in;
|
||||
struct in_addr in;
|
||||
|
||||
in.s_addr = (*Iterator)->ClientStream->GetRemoteIP();
|
||||
|
||||
_log(UCS__CLIENT, "Client connection from %s:%d closed.", inet_ntoa(in),
|
||||
ntohs((*Iterator)->ClientStream->GetRemotePort()));
|
||||
ntohs((*Iterator)->ClientStream->GetRemotePort()));
|
||||
|
||||
safe_delete((*Iterator));
|
||||
|
||||
@@ -627,7 +625,7 @@ void Clientlist::Process() {
|
||||
bool KeyValid = true;
|
||||
|
||||
while( KeyValid && !(*Iterator)->GetForceDisconnect() &&
|
||||
(app = (EQApplicationPacket *)(*Iterator)->ClientStream->PopPacket())) {
|
||||
(app = (EQApplicationPacket *)(*Iterator)->ClientStream->PopPacket())) {
|
||||
|
||||
_pkt(UCS__PACKETS, app);
|
||||
|
||||
@@ -715,13 +713,13 @@ void Clientlist::Process() {
|
||||
}
|
||||
if(!KeyValid || (*Iterator)->GetForceDisconnect()) {
|
||||
|
||||
struct in_addr in;
|
||||
struct in_addr in;
|
||||
|
||||
in.s_addr = (*Iterator)->ClientStream->GetRemoteIP();
|
||||
|
||||
_log(UCS__TRACE, "Force disconnecting client: %s:%d, KeyValid=%i, GetForceDisconnect()=%i",
|
||||
inet_ntoa(in), ntohs((*Iterator)->ClientStream->GetRemotePort()),
|
||||
KeyValid, (*Iterator)->GetForceDisconnect());
|
||||
inet_ntoa(in), ntohs((*Iterator)->ClientStream->GetRemotePort()),
|
||||
KeyValid, (*Iterator)->GetForceDisconnect());
|
||||
|
||||
(*Iterator)->ClientStream->Close();
|
||||
|
||||
@@ -870,7 +868,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, string CommandString)
|
||||
case CommandSelectMailBox:
|
||||
{
|
||||
string::size_type NumStart = Parameters.find_first_of("0123456789");
|
||||
c->ChangeMailBox(atoi(Parameters.substr(NumStart).c_str()));
|
||||
c->ChangeMailBox(atoi(Parameters.substr(NumStart).c_str()));
|
||||
break;
|
||||
}
|
||||
case CommandSetMailForwarding:
|
||||
@@ -1311,7 +1309,7 @@ void Client::SendChannelMessage(string Message)
|
||||
|
||||
if(ChannelName.compare("Newplayers") != 0)
|
||||
{
|
||||
if(GetKarma() < RuleI(Chat, KarmaGlobalChatLimit))
|
||||
if(GetKarma() < RuleI(Chat, KarmaGlobalChatLimit))
|
||||
{
|
||||
CharacterEntry *char_ent = nullptr;
|
||||
for(int x = 0; x < Characters.size(); ++x)
|
||||
@@ -1424,7 +1422,7 @@ void Client::SendChannelMessageByNumber(string Message) {
|
||||
|
||||
if(RequiredChannel->GetName().compare("Newplayers") != 0)
|
||||
{
|
||||
if(GetKarma() < RuleI(Chat, KarmaGlobalChatLimit))
|
||||
if(GetKarma() < RuleI(Chat, KarmaGlobalChatLimit))
|
||||
{
|
||||
CharacterEntry *char_ent = nullptr;
|
||||
for(int x = 0; x < Characters.size(); ++x)
|
||||
@@ -1447,7 +1445,7 @@ void Client::SendChannelMessageByNumber(string Message) {
|
||||
}
|
||||
|
||||
_log(UCS__TRACE, "%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))
|
||||
{
|
||||
@@ -2139,7 +2137,7 @@ void Client::ChannelKick(string CommandString) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(RequiredChannel->IsModerator(Kickee)) {
|
||||
if(RequiredChannel->IsModerator(Kickee)) {
|
||||
|
||||
RequiredChannel->RemoveModerator(Kickee);
|
||||
|
||||
@@ -2388,13 +2386,13 @@ string Client::MailBoxName() {
|
||||
if((Characters.size() == 0) || (CurrentMailBox > (Characters.size() - 1)))
|
||||
{
|
||||
_log(UCS__ERROR, "MailBoxName() called with CurrentMailBox set to %i and Characters.size() is %i",
|
||||
CurrentMailBox, Characters.size());
|
||||
CurrentMailBox, Characters.size());
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
_log(UCS__TRACE, "MailBoxName() called with CurrentMailBox set to %i and Characters.size() is %i",
|
||||
CurrentMailBox, Characters.size());
|
||||
CurrentMailBox, Characters.size());
|
||||
|
||||
return Characters[CurrentMailBox].Name;
|
||||
|
||||
@@ -2407,3 +2405,4 @@ int Client::GetCharID() {
|
||||
|
||||
return Characters[0].CharID;
|
||||
}
|
||||
|
||||
|
||||
+39
-39
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
EQEMu: Everquest Server Emulator
|
||||
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -11,11 +9,11 @@
|
||||
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.
|
||||
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
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
@@ -32,48 +30,50 @@
|
||||
|
||||
#define MAX_JOINED_CHANNELS 10
|
||||
|
||||
enum { CommandJoin = 0, CommandLeaveAll, CommandLeave, CommandListAll, CommandList, CommandSet, CommandAnnounce, CommandSetOwner,
|
||||
CommandOPList, CommandInvite, CommandGrant, CommandModerate, CommandVoice, CommandKick,
|
||||
CommandPassword, CommandToggleInvites, CommandAFK, CommandUptime,
|
||||
CommandGetHeaders, CommandGetBody, CommandMailTo, CommandSetMessageStatus, CommandSelectMailBox,
|
||||
CommandSetMailForwarding, CommandBuddy, CommandIgnorePlayer,
|
||||
CommandEndOfList };
|
||||
enum {
|
||||
CommandJoin = 0, CommandLeaveAll, CommandLeave, CommandListAll, CommandList, CommandSet, CommandAnnounce, CommandSetOwner,
|
||||
CommandOPList, CommandInvite, CommandGrant, CommandModerate, CommandVoice, CommandKick,
|
||||
CommandPassword, CommandToggleInvites, CommandAFK, CommandUptime,
|
||||
CommandGetHeaders, CommandGetBody, CommandMailTo, CommandSetMessageStatus, CommandSelectMailBox,
|
||||
CommandSetMailForwarding, CommandBuddy, CommandIgnorePlayer,
|
||||
CommandEndOfList
|
||||
};
|
||||
|
||||
struct CommandEntry {
|
||||
const char *CommandString;
|
||||
int CommandCode;
|
||||
int CommandCode;
|
||||
};
|
||||
|
||||
typedef enum { ConnectionTypeUnknown, ConnectionTypeCombined, ConnectionTypeMail, ConnectionTypeChat } ConnectionType;
|
||||
|
||||
static const CommandEntry Commands[] = {
|
||||
{ "join", CommandJoin },
|
||||
{ "leaveall", CommandLeaveAll },
|
||||
{ "leave", CommandLeave },
|
||||
{ "listall", CommandListAll },
|
||||
{ "list", CommandList },
|
||||
{ "set", CommandSet },
|
||||
{ "announce", CommandAnnounce },
|
||||
{ "setowner", CommandSetOwner },
|
||||
{ "oplist", CommandOPList },
|
||||
{ "invite", CommandInvite },
|
||||
{ "grant", CommandGrant },
|
||||
{ "moderate", CommandModerate },
|
||||
{ "voice", CommandVoice },
|
||||
{ "kick", CommandKick },
|
||||
{ "password", CommandPassword },
|
||||
{ "toggleinvites", CommandToggleInvites },
|
||||
{ "afk", CommandAFK },
|
||||
{ "uptime", CommandUptime },
|
||||
{ "getheaders", CommandGetHeaders },
|
||||
{ "getbody", CommandGetBody },
|
||||
{ "mailto", CommandMailTo },
|
||||
{ "setmessagestatus", CommandSetMessageStatus },
|
||||
{ "selectmailbox", CommandSelectMailBox },
|
||||
{ "setmailforwarding", CommandSetMailForwarding },
|
||||
{ "buddy", CommandBuddy },
|
||||
{ "ignoreplayer", CommandIgnorePlayer },
|
||||
{ "", CommandEndOfList } };
|
||||
{ "join", CommandJoin },
|
||||
{ "leaveall", CommandLeaveAll },
|
||||
{ "leave", CommandLeave },
|
||||
{ "listall", CommandListAll },
|
||||
{ "list", CommandList },
|
||||
{ "set", CommandSet },
|
||||
{ "announce", CommandAnnounce },
|
||||
{ "setowner", CommandSetOwner },
|
||||
{ "oplist", CommandOPList },
|
||||
{ "invite", CommandInvite },
|
||||
{ "grant", CommandGrant },
|
||||
{ "moderate", CommandModerate },
|
||||
{ "voice", CommandVoice },
|
||||
{ "kick", CommandKick },
|
||||
{ "password", CommandPassword },
|
||||
{ "toggleinvites", CommandToggleInvites },
|
||||
{ "afk", CommandAFK },
|
||||
{ "uptime", CommandUptime },
|
||||
{ "getheaders", CommandGetHeaders },
|
||||
{ "getbody", CommandGetBody },
|
||||
{ "mailto", CommandMailTo },
|
||||
{ "setmessagestatus", CommandSetMessageStatus },
|
||||
{ "selectmailbox", CommandSelectMailBox },
|
||||
{ "setmailforwarding", CommandSetMailForwarding },
|
||||
{ "buddy", CommandBuddy },
|
||||
{ "ignoreplayer", CommandIgnorePlayer },
|
||||
{ "", CommandEndOfList } };
|
||||
|
||||
struct CharacterEntry {
|
||||
int CharID;
|
||||
|
||||
+28
-29
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
EQEMu: Everquest Server Emulator
|
||||
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -11,11 +9,11 @@
|
||||
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.
|
||||
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
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
@@ -112,7 +110,7 @@ void Database::GetAccountStatus(Client *c) {
|
||||
MYSQL_ROW row;
|
||||
|
||||
if (!RunQuery(query,MakeAnyLenString(&query, "select `status`, `hideme`, `karma`, `revoked` from `account` where `id`='%i' limit 1",
|
||||
c->GetAccountID()),errbuf,&result)){
|
||||
c->GetAccountID()),errbuf,&result)){
|
||||
|
||||
_log(UCS__ERROR, "Unable to get account status for character %s, error %s", c->GetName().c_str(), errbuf);
|
||||
|
||||
@@ -153,7 +151,7 @@ int Database::FindAccount(const char *CharacterName, Client *c) {
|
||||
c->ClearCharacters();
|
||||
|
||||
if (!RunQuery(query,MakeAnyLenString(&query, "select `id`, `account_id`, `level` from `character_` where `name`='%s' limit 1",
|
||||
CharacterName),errbuf,&result))
|
||||
CharacterName),errbuf,&result))
|
||||
{
|
||||
_log(UCS__ERROR, "FindAccount query failed: %s", query);
|
||||
safe_delete_array(query);
|
||||
@@ -176,7 +174,7 @@ int Database::FindAccount(const char *CharacterName, Client *c) {
|
||||
_log(UCS__TRACE, "Account ID for %s is %i", CharacterName, AccountID);
|
||||
|
||||
if (!RunQuery(query,MakeAnyLenString(&query, "select `id`, `name`, `level` from `character_` where `account_id`=%i and `name` !='%s'",
|
||||
AccountID, CharacterName),errbuf,&result))
|
||||
AccountID, CharacterName),errbuf,&result))
|
||||
{
|
||||
safe_delete_array(query);
|
||||
return AccountID;
|
||||
@@ -200,7 +198,7 @@ bool Database::VerifyMailKey(string CharacterName, int IPAddress, string MailKey
|
||||
MYSQL_ROW row;
|
||||
|
||||
if (!RunQuery(query,MakeAnyLenString(&query, "select `mailkey` from `character_` where `name`='%s' limit 1",
|
||||
CharacterName.c_str()),errbuf,&result)){
|
||||
CharacterName.c_str()),errbuf,&result)){
|
||||
|
||||
safe_delete_array(query);
|
||||
|
||||
@@ -243,7 +241,7 @@ int Database::FindCharacter(const char *CharacterName) {
|
||||
char *SafeCharName = RemoveApostrophes(CharacterName);
|
||||
|
||||
if (!RunQuery(query,MakeAnyLenString(&query, "select `id` from `character_` where `name`='%s' limit 1",
|
||||
SafeCharName),errbuf,&result)){
|
||||
SafeCharName),errbuf,&result)){
|
||||
|
||||
_log(UCS__ERROR, "FindCharacter failed. %s %s", query, errbuf);
|
||||
|
||||
@@ -350,7 +348,7 @@ void Database::SetChannelPassword(string ChannelName, string Password) {
|
||||
char *query = 0;
|
||||
|
||||
if(!RunQuery(query, MakeAnyLenString(&query, "UPDATE `chatchannels` set `password`='%s' where `name`='%s'", Password.c_str(),
|
||||
ChannelName.c_str()), errbuf)) {
|
||||
ChannelName.c_str()), errbuf)) {
|
||||
|
||||
_log(UCS__ERROR, "Error updating password in database: %s, %s", query, errbuf);
|
||||
|
||||
@@ -367,7 +365,7 @@ void Database::SetChannelOwner(string ChannelName, string Owner) {
|
||||
char *query = 0;
|
||||
|
||||
if(!RunQuery(query, MakeAnyLenString(&query, "UPDATE `chatchannels` set `owner`='%s' where `name`='%s'", Owner.c_str(),
|
||||
ChannelName.c_str()), errbuf)) {
|
||||
ChannelName.c_str()), errbuf)) {
|
||||
|
||||
_log(UCS__ERROR, "Error updating Owner in database: %s, %s", query, errbuf);
|
||||
|
||||
@@ -393,7 +391,7 @@ void Database::SendHeaders(Client *c) {
|
||||
MYSQL_ROW row;
|
||||
|
||||
if (!RunQuery(query,MakeAnyLenString(&query, "select `msgid`,`timestamp`,`from`,`subject`, `status` from `mail` "
|
||||
"where `charid`=%i", CharacterID),errbuf,&result)){
|
||||
"where `charid`=%i", CharacterID),errbuf,&result)){
|
||||
|
||||
safe_delete_array(query);
|
||||
|
||||
@@ -497,7 +495,7 @@ void Database::SendBody(Client *c, int MessageNumber) {
|
||||
MYSQL_ROW row;
|
||||
|
||||
if (!RunQuery(query,MakeAnyLenString(&query, "select `msgid`, `body`, `to` from `mail` "
|
||||
"where `charid`=%i and `msgid`=%i", CharacterID, MessageNumber), errbuf, &result)){
|
||||
"where `charid`=%i and `msgid`=%i", CharacterID, MessageNumber), errbuf, &result)){
|
||||
safe_delete_array(query);
|
||||
|
||||
return ;
|
||||
@@ -579,14 +577,14 @@ bool Database::SendMail(string Recipient, string From, string Subject, string Bo
|
||||
DoEscapeString(EscBody, Body.c_str(), Body.length());
|
||||
|
||||
const char *MailQuery="INSERT INTO `mail` (`charid`, `timestamp`, `from`, `subject`, `body`, `to`, `status`) "
|
||||
"VALUES ('%i', %i, '%s', '%s', '%s', '%s', %i)";
|
||||
"VALUES ('%i', %i, '%s', '%s', '%s', '%s', %i)";
|
||||
|
||||
uint32 LastMsgID;
|
||||
|
||||
int Now = time(nullptr); // time returns a 64 bit int on Windows at least, which vsnprintf doesn't like.
|
||||
|
||||
if(!RunQuery(query, MakeAnyLenString(&query, MailQuery, CharacterID, Now, From.c_str(), EscSubject, EscBody,
|
||||
RecipientsString.c_str(), 1), errbuf, 0, 0, &LastMsgID)) {
|
||||
RecipientsString.c_str(), 1), errbuf, 0, 0, &LastMsgID)) {
|
||||
|
||||
_log(UCS__ERROR, "SendMail: Query %s failed with error %s", query, errbuf);
|
||||
|
||||
@@ -601,7 +599,7 @@ bool Database::SendMail(string Recipient, string From, string Subject, string Bo
|
||||
|
||||
safe_delete_array(EscSubject);
|
||||
safe_delete_array(EscBody);
|
||||
safe_delete_array(query);
|
||||
safe_delete_array(query);
|
||||
|
||||
Client *c = CL->IsCharacterOnline(CharacterName);
|
||||
|
||||
@@ -624,7 +622,7 @@ void Database::SetMessageStatus(int MessageNumber, int Status) {
|
||||
char *query = 0;
|
||||
|
||||
if(Status == 0)
|
||||
RunQuery(query, MakeAnyLenString(&query, "delete from `mail` where `msgid`=%i", MessageNumber), errbuf);
|
||||
RunQuery(query, MakeAnyLenString(&query, "delete from `mail` where `msgid`=%i", MessageNumber), errbuf);
|
||||
else if (!RunQuery(query, MakeAnyLenString(&query, "update `mail` set `status`=%i where `msgid`=%i", Status, MessageNumber), errbuf)) {
|
||||
|
||||
_log(UCS__ERROR, "Error updating status %s, %s", query, errbuf);
|
||||
@@ -660,9 +658,9 @@ void Database::ExpireMail() {
|
||||
|
||||
// Expire Trash
|
||||
if(RuleI(Mail, ExpireTrash) >= 0) {
|
||||
if(RunQuery(query, MakeAnyLenString(&query, "delete from `mail` where `status`=4 and `timestamp` < %i",
|
||||
time(nullptr) - RuleI(Mail, ExpireTrash)), errbuf, 0, &AffectedRows)) {
|
||||
_log(UCS__INIT, "Expired %i trash messages.", AffectedRows);
|
||||
if(RunQuery(query, MakeAnyLenString(&query, "delete from `mail` where `status`=4 and `timestamp` < %i",
|
||||
time(nullptr) - RuleI(Mail, ExpireTrash)), errbuf, 0, &AffectedRows)) {
|
||||
_log(UCS__INIT, "Expired %i trash messages.", AffectedRows);
|
||||
}
|
||||
else {
|
||||
_log(UCS__ERROR, "Error expiring trash messages, %s %s", query, errbuf);
|
||||
@@ -671,9 +669,9 @@ void Database::ExpireMail() {
|
||||
}
|
||||
// Expire Read
|
||||
if(RuleI(Mail, ExpireRead) >= 0) {
|
||||
if(RunQuery(query, MakeAnyLenString(&query, "delete from `mail` where `status`=3 and `timestamp` < %i",
|
||||
time(nullptr) - RuleI(Mail, ExpireRead)), errbuf, 0, &AffectedRows)) {
|
||||
_log(UCS__INIT, "Expired %i read messages.", AffectedRows);
|
||||
if(RunQuery(query, MakeAnyLenString(&query, "delete from `mail` where `status`=3 and `timestamp` < %i",
|
||||
time(nullptr) - RuleI(Mail, ExpireRead)), errbuf, 0, &AffectedRows)) {
|
||||
_log(UCS__INIT, "Expired %i read messages.", AffectedRows);
|
||||
}
|
||||
else {
|
||||
_log(UCS__ERROR, "Error expiring read messages, %s %s", query, errbuf);
|
||||
@@ -682,9 +680,9 @@ void Database::ExpireMail() {
|
||||
}
|
||||
// Expire Unread
|
||||
if(RuleI(Mail, ExpireUnread) >= 0) {
|
||||
if(RunQuery(query, MakeAnyLenString(&query, "delete from `mail` where `status`=1 and `timestamp` < %i",
|
||||
time(nullptr) - RuleI(Mail, ExpireUnread)), errbuf, 0, &AffectedRows)) {
|
||||
_log(UCS__INIT, "Expired %i unread messages.", AffectedRows);
|
||||
if(RunQuery(query, MakeAnyLenString(&query, "delete from `mail` where `status`=1 and `timestamp` < %i",
|
||||
time(nullptr) - RuleI(Mail, ExpireUnread)), errbuf, 0, &AffectedRows)) {
|
||||
_log(UCS__INIT, "Expired %i unread messages.", AffectedRows);
|
||||
}
|
||||
else {
|
||||
_log(UCS__ERROR, "Error expiring unread messages, %s %s", query, errbuf);
|
||||
@@ -705,7 +703,7 @@ void Database::AddFriendOrIgnore(int CharID, int Type, string Name) {
|
||||
_log(UCS__ERROR, "Error adding friend/ignore, query was %s : %s", query, errbuf);
|
||||
else
|
||||
_log(UCS__TRACE, "Wrote Friend/Ignore entry for charid %i, type %i, name %s to database.",
|
||||
CharID, Type, Name.c_str());
|
||||
CharID, Type, Name.c_str());
|
||||
|
||||
|
||||
safe_delete_array(query);
|
||||
@@ -722,7 +720,7 @@ void Database::RemoveFriendOrIgnore(int CharID, int Type, string Name) {
|
||||
_log(UCS__ERROR, "Error removing friend/ignore, query was %s", query);
|
||||
else
|
||||
_log(UCS__TRACE, "Removed Friend/Ignore entry for charid %i, type %i, name %s from database.",
|
||||
CharID, Type, Name.c_str());
|
||||
CharID, Type, Name.c_str());
|
||||
|
||||
|
||||
safe_delete_array(query);
|
||||
@@ -768,3 +766,4 @@ void Database::GetFriendsAndIgnore(int CharID, vector<string> &Friends, vector<s
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+4
-5
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
EQEMu: Everquest Server Emulator
|
||||
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -11,11 +9,11 @@
|
||||
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.
|
||||
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
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
@@ -71,3 +69,4 @@ private:
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
+14
-16
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
EQEMu: Everquest Server Emulator
|
||||
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -11,11 +9,11 @@
|
||||
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.
|
||||
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
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
@@ -39,7 +37,7 @@ volatile bool RunLoops = true;
|
||||
uint32 MailMessagesSent = 0;
|
||||
uint32 ChatMessagesSent = 0;
|
||||
|
||||
TimeoutManager timeout_manager;
|
||||
TimeoutManager timeout_manager;
|
||||
|
||||
Clientlist *CL;
|
||||
|
||||
@@ -69,8 +67,8 @@ string GetMailPrefix() {
|
||||
}
|
||||
|
||||
int main() {
|
||||
RegisterExecutablePlatform(ExePlatformUCS);
|
||||
set_exception_handler();
|
||||
RegisterExecutablePlatform(ExePlatformUCS);
|
||||
set_exception_handler();
|
||||
|
||||
// Check every minute for unused channels we can delete
|
||||
//
|
||||
@@ -178,13 +176,13 @@ int main() {
|
||||
|
||||
void UpdateWindowTitle(char* iNewTitle) {
|
||||
#ifdef _WINDOWS
|
||||
char tmp[500];
|
||||
if (iNewTitle) {
|
||||
snprintf(tmp, sizeof(tmp), "UCS: %s", iNewTitle);
|
||||
}
|
||||
else {
|
||||
snprintf(tmp, sizeof(tmp), "UCS");
|
||||
}
|
||||
SetConsoleTitle(tmp);
|
||||
char tmp[500];
|
||||
if (iNewTitle) {
|
||||
snprintf(tmp, sizeof(tmp), "UCS: %s", iNewTitle);
|
||||
}
|
||||
else {
|
||||
snprintf(tmp, sizeof(tmp), "UCS");
|
||||
}
|
||||
SetConsoleTitle(tmp);
|
||||
#endif
|
||||
}
|
||||
|
||||
+4
-5
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
EQEMu: Everquest Server Emulator
|
||||
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -11,11 +9,11 @@
|
||||
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.
|
||||
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
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
@@ -27,3 +25,4 @@ ucsconfig *ucsconfig::_chat_config = nullptr;
|
||||
string ucsconfig::GetByName(const string &var_name) const {
|
||||
return(EQEmuConfig::GetByName(var_name));
|
||||
}
|
||||
|
||||
|
||||
+4
-5
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
EQEMu: Everquest Server Emulator
|
||||
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -11,11 +9,11 @@
|
||||
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.
|
||||
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
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
@@ -54,3 +52,4 @@ public:
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
+21
-21
@@ -1,19 +1,19 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
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
|
||||
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.
|
||||
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/debug.h"
|
||||
#include <iostream>
|
||||
@@ -115,16 +115,16 @@ void WorldServer::Process()
|
||||
break;
|
||||
}
|
||||
|
||||
case ServerOP_UCSMailMessage:
|
||||
{
|
||||
ServerMailMessageHeader_Struct *mail = (ServerMailMessageHeader_Struct*)pack->pBuffer;
|
||||
database.SendMail(string("SOE.EQ.") + Config->ShortName + string(".") + string(mail->to),
|
||||
string(mail->from),
|
||||
mail->subject,
|
||||
mail->message,
|
||||
string());
|
||||
break;
|
||||
}
|
||||
case ServerOP_UCSMailMessage:
|
||||
{
|
||||
ServerMailMessageHeader_Struct *mail = (ServerMailMessageHeader_Struct*)pack->pBuffer;
|
||||
database.SendMail(string("SOE.EQ.") + Config->ShortName + string(".") + string(mail->to),
|
||||
string(mail->from),
|
||||
mail->subject,
|
||||
mail->message,
|
||||
string());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+11
-11
@@ -1,19 +1,19 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
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
|
||||
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.
|
||||
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
|
||||
*/
|
||||
#ifndef WORLDSERVER_H
|
||||
#define WORLDSERVER_H
|
||||
|
||||
Reference in New Issue
Block a user