Remove trailing whitespace

This commit is contained in:
j883376
2013-05-06 13:07:41 -04:00
parent 7a93966158
commit ffcff4aea1
548 changed files with 16397 additions and 16398 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ ADD_DEFINITIONS(-DUCS)
TARGET_LINK_LIBRARIES(ucs Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
IF(MSVC)
SET_TARGET_PROPERTIES(ucs PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
TARGET_LINK_LIBRARIES(ucs "Ws2_32.lib")
ENDIF(MSVC)
+5 -5
View File
@@ -28,7 +28,7 @@
extern Database database;
extern uint32 ChatMessagesSent;
ChatChannel::ChatChannel(string inName, string inOwner, string inPassword, bool inPermanent, int inMinimumStatus) :
ChatChannel::ChatChannel(string inName, string inOwner, string inPassword, bool inPermanent, int inMinimumStatus) :
DeleteTimer(0) {
Name = inName;
@@ -43,7 +43,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",
_log(UCS__TRACE, "New ChatChannel created: Name: [%s], Owner: [%s], Password: [%s], MinStatus: %i",
Name.c_str(), Owner.c_str(), Password.c_str(), MinimumStatus);
}
@@ -301,7 +301,7 @@ bool ChatChannel::RemoveClient(Client *c) {
return false;
_log(UCS__TRACE, "Starting delete timer for empty password protected channel %s", Name.c_str());
DeleteTimer.Start(RuleI(Channels, DeleteTimer) * 60000);
}
@@ -455,7 +455,7 @@ ChatChannel *ChatChannelList::AddClientToChannel(string ChannelName, Client *c)
if(!c) return nullptr;
if((ChannelName.length() > 0) && (isdigit(ChannelName[0]))) {
c->GeneralChannelMessage("The channel name can not begin with a number.");
return nullptr;
@@ -465,7 +465,7 @@ ChatChannel *ChatChannelList::AddClientToChannel(string ChannelName, Client *c)
string::size_type Colon = ChannelName.find_first_of(":");
if(Colon == string::npos)
if(Colon == string::npos)
NormalisedName = CapitaliseName(ChannelName);
else {
NormalisedName = CapitaliseName(ChannelName.substr(0, Colon));
+36 -36
View File
@@ -83,8 +83,8 @@ vector<string> ParseRecipients(string RecipientString) {
// This method parses the Recipient List in the mailto command, which can look like this example:
//
// "Baalinor <SOE.EQ.BTG2.Baalinor>,
// -Friends <SOE.EQ.BTG2.Playedtest SOE.EQ.BTG2.Dyetest>,
// "Baalinor <SOE.EQ.BTG2.Baalinor>,
// -Friends <SOE.EQ.BTG2.Playedtest SOE.EQ.BTG2.Dyetest>,
// Guild <SOE.EQ.BTG2.Dsfvxcbcx SOE.EQ.BTG2.Necronor>, SOE.EQ.BTG2.luccerathe, SOE.EQ.BTG2.codsas
//
// First, it splits it up at commas, so it looks like this:
@@ -180,7 +180,7 @@ vector<string> ParseRecipients(string RecipientString) {
break;
}
RecipientList.push_back(Secret + Recips.substr(CurrentPos,
RecipientList.push_back(Secret + Recips.substr(CurrentPos,
Space - CurrentPos));
CurrentPos = Space + 1;
}
@@ -191,9 +191,9 @@ vector<string> ParseRecipients(string RecipientString) {
}
}
(*Iterator) = Secret + (*Iterator);
Iterator++;
}
@@ -212,7 +212,7 @@ vector<string> ParseRecipients(string RecipientString) {
if(LastPeriod != string::npos) {
(*Iterator) = (*Iterator).substr(LastPeriod + 1);
for(unsigned int i = 0; i < (*Iterator).length(); i++) {
if(i == 0)
@@ -240,7 +240,7 @@ vector<string> ParseRecipients(string RecipientString) {
static void ProcessMailTo(Client *c, string MailMessage) {
_log(UCS__TRACE, "MAILTO: From %s, %s", c->MailBoxName().c_str(), MailMessage.c_str());
vector<string> Recipients;
string::size_type FirstQuote = MailMessage.find_first_of("\"", 0);
@@ -335,7 +335,7 @@ static void ProcessMailTo(Client *c, string MailMessage) {
Success = false;
}
}
if(Success) {
// Success
EQApplicationPacket *outapp = new EQApplicationPacket(OP_MailDeliveryStatus, 10);
@@ -494,7 +494,7 @@ Clientlist::Clientlist(int ChatPort) {
Client::Client(EQStream *eqs) {
ClientStream = eqs;
ClientStream = eqs;
CurrentMailBox = 0;
@@ -571,7 +571,7 @@ void Clientlist::CheckForStaleConnections(Client *c) {
_log(UCS__CLIENT, "Client connection from %s:%d closed.", inet_ntoa(in),
ntohs((*Iterator)->ClientStream->GetRemotePort()));
safe_delete((*Iterator));
Iterator = ClientChatConnections.erase(Iterator);
@@ -611,7 +611,7 @@ void Clientlist::Process() {
_log(UCS__CLIENT, "Client connection from %s:%d closed.", inet_ntoa(in),
ntohs((*Iterator)->ClientStream->GetRemotePort()));
safe_delete((*Iterator));
Iterator = ClientChatConnections.erase(Iterator);
@@ -698,7 +698,7 @@ void Clientlist::Process() {
case OP_Mail: {
string CommandString = (const char*)app->pBuffer;
ProcessOPMailCommand((*Iterator), CommandString);
break;
@@ -762,7 +762,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, string CommandString)
string::size_type Space = CommandString.find_first_of(" ");
if(Space != string::npos) {
if(Space != string::npos) {
Command = CommandString.substr(0, Space);
@@ -793,7 +793,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, string CommandString)
case CommandListAll:
ChannelList->SendAllChannels(c);
break;
case CommandList:
c->ProcessChannelList(Parameters);
break;
@@ -875,7 +875,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, string CommandString)
}
case CommandSetMailForwarding:
break;
case CommandBuddy:
RemoveApostrophes(Parameters);
ProcessCommandBuddy(c, Parameters);
@@ -924,7 +924,7 @@ void Client::SendMailBoxes() {
int PacketLength = 10;
string s;
for(int i = 0; i < Count; i++) {
s += GetMailPrefix() + Characters[i].Name;
@@ -1028,7 +1028,7 @@ void Client::JoinChannels(string ChannelNameList) {
if(NumberOfChannels == MAX_JOINED_CHANNELS) {
GeneralChannelMessage("You have joined the maximum number of channels. /leave one before trying to join another.");
break;
}
@@ -1238,7 +1238,7 @@ void Client::ProcessChannelList(string Input) {
ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName);
if(RequiredChannel)
if(RequiredChannel)
RequiredChannel->SendChannelMembers(this);
else
GeneralChannelMessage("Channel " + Input + " not found.");
@@ -1289,7 +1289,7 @@ void Client::SendChannelList() {
safe_delete(outapp);
}
void Client::SendChannelMessage(string Message)
void Client::SendChannelMessage(string Message)
{
string::size_type MessageStart = Message.find_first_of(" ");
@@ -1348,11 +1348,11 @@ void Client::SendChannelMessage(string Message)
}
}
int AllowedMessages = RuleI(Chat, MinimumMessagesPerInterval) + GetKarma();
AllowedMessages = AllowedMessages > RuleI(Chat, MaximumMessagesPerInterval) ? RuleI(Chat, MaximumMessagesPerInterval) : AllowedMessages;
AllowedMessages = AllowedMessages > RuleI(Chat, MaximumMessagesPerInterval) ? RuleI(Chat, MaximumMessagesPerInterval) : AllowedMessages;
if(RuleI(Chat, MinStatusToBypassAntiSpam) <= Status)
AllowedMessages = 10000;
AttemptedMessages++;
if(AttemptedMessages > AllowedMessages)
{
@@ -1363,7 +1363,7 @@ void Client::SendChannelMessage(string Message)
if(GlobalChatLimiterTimer)
{
char TimeLeft[256];
sprintf(TimeLeft, "You are currently rate limited, you cannot send more messages for %i seconds.",
sprintf(TimeLeft, "You are currently rate limited, you cannot send more messages for %i seconds.",
(GlobalChatLimiterTimer->GetRemainingTime() / 1000));
GeneralChannelMessage(TimeLeft);
}
@@ -1446,7 +1446,7 @@ void Client::SendChannelMessageByNumber(string Message) {
}
}
_log(UCS__TRACE, "%s tells %s, [%s]", GetName().c_str(), RequiredChannel->GetName().c_str(),
_log(UCS__TRACE, "%s tells %s, [%s]", GetName().c_str(), RequiredChannel->GetName().c_str(),
Message.substr(MessageStart + 1).c_str());
if(RuleB(Chat, EnableAntiSpam))
@@ -1463,7 +1463,7 @@ void Client::SendChannelMessageByNumber(string Message) {
}
}
int AllowedMessages = RuleI(Chat, MinimumMessagesPerInterval) + GetKarma();
AllowedMessages = AllowedMessages > RuleI(Chat, MaximumMessagesPerInterval) ? RuleI(Chat, MaximumMessagesPerInterval) : AllowedMessages;
AllowedMessages = AllowedMessages > RuleI(Chat, MaximumMessagesPerInterval) ? RuleI(Chat, MaximumMessagesPerInterval) : AllowedMessages;
if(RuleI(Chat, MinStatusToBypassAntiSpam) <= Status)
AllowedMessages = 10000;
@@ -1477,7 +1477,7 @@ void Client::SendChannelMessageByNumber(string Message) {
if(GlobalChatLimiterTimer)
{
char TimeLeft[256];
sprintf(TimeLeft, "You are currently rate limited, you cannot send more messages for %i seconds.",
sprintf(TimeLeft, "You are currently rate limited, you cannot send more messages for %i seconds.",
(GlobalChatLimiterTimer->GetRemainingTime() / 1000));
GeneralChannelMessage(TimeLeft);
}
@@ -1544,7 +1544,7 @@ void Client::ToggleAnnounce(string State)
string Message = "Announcing now ";
if(Announce)
if(Announce)
Message += "on";
else
Message += "off";
@@ -1746,7 +1746,7 @@ void Client::SetChannelOwner(string CommandString) {
void Client::OPList(string CommandString) {
string::size_type ChannelStart = CommandString.find_first_not_of(" ");
if(ChannelStart == string::npos) {
string Message = "Incorrect syntax: /chat oplist <channel>";
GeneralChannelMessage(Message);
@@ -1969,7 +1969,7 @@ void Client::ChannelGrantModerator(string CommandString) {
}
else {
RequiredChannel->AddModerator(Moderator);
if(RequiredClient)
RequiredClient->GeneralChannelMessage(GetName() + " has made you a moderator of channel " + ChannelName);
@@ -2056,7 +2056,7 @@ void Client::ChannelGrantVoice(string CommandString) {
}
else {
RequiredChannel->AddVoice(Voicee);
if(RequiredClient)
RequiredClient->GeneralChannelMessage(GetName() + " has given you voice in channel " + ChannelName);
@@ -2256,7 +2256,7 @@ Client *Clientlist::IsCharacterOnline(string CharacterName) {
// If the mail is destined for the primary mailbox for this character, or the one they have selected
//
if((MailBoxNumber == 0) || (MailBoxNumber == (*Iterator)->GetMailBoxNumber()))
if((MailBoxNumber == 0) || (MailBoxNumber == (*Iterator)->GetMailBoxNumber()))
return (*Iterator);
}
@@ -2280,7 +2280,7 @@ void Client::SendNotification(int MailBoxNumber, string Subject, string From, in
char sMessageID[100];
char Sequence[100];
sprintf(TimeStamp, "%i", (int)time(nullptr));
sprintf(sMessageID, "%i", MessageID);
@@ -2296,8 +2296,8 @@ void Client::SendNotification(int MailBoxNumber, string Subject, string From, in
VARSTRUCT_ENCODE_INTSTRING(PacketBuffer, MailBoxNumber);
VARSTRUCT_ENCODE_STRING(PacketBuffer, sMessageID);
VARSTRUCT_ENCODE_STRING(PacketBuffer, TimeStamp);
VARSTRUCT_ENCODE_STRING(PacketBuffer, "1");
VARSTRUCT_ENCODE_STRING(PacketBuffer, From.c_str());
VARSTRUCT_ENCODE_STRING(PacketBuffer, "1");
VARSTRUCT_ENCODE_STRING(PacketBuffer, From.c_str());
VARSTRUCT_ENCODE_STRING(PacketBuffer, Subject.c_str());
_pkt(UCS__PACKETS, outapp);
@@ -2314,13 +2314,13 @@ void Client::ChangeMailBox(int NewMailBox) {
SetMailBox(NewMailBox);
_log(UCS__TRACE, "New mailbox is %s", MailBoxName().c_str());
EQApplicationPacket *outapp = new EQApplicationPacket(OP_MailboxChange, 2);
char *buf = (char *)outapp->pBuffer;
VARSTRUCT_ENCODE_INTSTRING(buf, NewMailBox);
_pkt(UCS__PACKETS, outapp);
QueuePacket(outapp);
+2 -2
View File
@@ -33,7 +33,7 @@
#define MAX_JOINED_CHANNELS 10
enum { CommandJoin = 0, CommandLeaveAll, CommandLeave, CommandListAll, CommandList, CommandSet, CommandAnnounce, CommandSetOwner,
CommandOPList, CommandInvite, CommandGrant, CommandModerate, CommandVoice, CommandKick,
CommandOPList, CommandInvite, CommandGrant, CommandModerate, CommandVoice, CommandKick,
CommandPassword, CommandToggleInvites, CommandAFK, CommandUptime,
CommandGetHeaders, CommandGetBody, CommandMailTo, CommandSetMessageStatus, CommandSelectMailBox,
CommandSetMailForwarding, CommandBuddy, CommandIgnorePlayer,
@@ -46,7 +46,7 @@ struct CommandEntry {
typedef enum { ConnectionTypeUnknown, ConnectionTypeCombined, ConnectionTypeMail, ConnectionTypeChat } ConnectionType;
static const CommandEntry Commands[] = {
static const CommandEntry Commands[] = {
{ "join", CommandJoin },
{ "leaveall", CommandLeaveAll },
{ "leave", CommandLeave },
+14 -14
View File
@@ -161,7 +161,7 @@ int Database::FindAccount(const char *CharacterName, Client *c) {
}
safe_delete_array(query);
if (mysql_num_rows(result) != 1)
if (mysql_num_rows(result) != 1)
{
_log(UCS__ERROR, "Bad result from query");
mysql_free_result(result);
@@ -183,7 +183,7 @@ int Database::FindAccount(const char *CharacterName, Client *c) {
}
safe_delete_array(query);
for(unsigned int i = 0; i < mysql_num_rows(result); i++)
for(unsigned int i = 0; i < mysql_num_rows(result); i++)
{
row = mysql_fetch_row(result);
c->AddCharacter(atoi(row[0]), row[1], atoi(row[2]));
@@ -214,7 +214,7 @@ bool Database::VerifyMailKey(string CharacterName, int IPAddress, string MailKey
row = mysql_fetch_row(result);
// The key is the client's IP address (expressed as 8 hex digits) and an 8 hex digit random string generated
// by world.
// by world.
//
char CombinedKey[17];
@@ -222,7 +222,7 @@ bool Database::VerifyMailKey(string CharacterName, int IPAddress, string MailKey
sprintf(CombinedKey, "%08X%s", IPAddress, MailKey.c_str());
else
sprintf(CombinedKey, "%s", MailKey.c_str());
_log(UCS__TRACE, "DB key is [%s], Client key is [%s]", row[0], CombinedKey);
bool Valid = !strcmp(row[0], CombinedKey);
@@ -407,7 +407,7 @@ void Database::SendHeaders(Client *c) {
my_ulonglong NumRows = mysql_num_rows(result);
int HeaderCountPacketLength = 0;
sprintf(Buf, "%i", c->GetMailBoxNumber());
HeaderCountPacketLength += (strlen(Buf) + 1);
@@ -552,7 +552,7 @@ bool Database::SendMail(string Recipient, string From, string Subject, string Bo
//printf("Database::SendMail(%s, %s, %s)\n", Recipient.c_str(), From.c_str(), Subject.c_str());
string::size_type LastPeriod = Recipient.find_last_of(".");
if(LastPeriod == string::npos)
CharacterName = Recipient;
else
@@ -560,7 +560,7 @@ bool Database::SendMail(string Recipient, string From, string Subject, string Bo
CharacterName[0] = toupper(CharacterName[0]);
for(unsigned int i = 1; i < CharacterName.length(); i++)
for(unsigned int i = 1; i < CharacterName.length(); i++)
CharacterName[i] = tolower(CharacterName[i]);
CharacterID = FindCharacter(CharacterName.c_str());
@@ -585,7 +585,7 @@ bool Database::SendMail(string Recipient, string From, string Subject, string Bo
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,
if(!RunQuery(query, MakeAnyLenString(&query, MailQuery, CharacterID, Now, From.c_str(), EscSubject, EscBody,
RecipientsString.c_str(), 1), errbuf, 0, 0, &LastMsgID)) {
_log(UCS__ERROR, "SendMail: Query %s failed with error %s", query, errbuf);
@@ -610,7 +610,7 @@ bool Database::SendMail(string Recipient, string From, string Subject, string Bo
c->SendNotification(c->GetMailBoxNumber(CharacterName), Subject, FQN, LastMsgID);
}
MailMessagesSent++;
return true;
@@ -660,7 +660,7 @@ void Database::ExpireMail() {
// Expire Trash
if(RuleI(Mail, ExpireTrash) >= 0) {
if(RunQuery(query, MakeAnyLenString(&query, "delete from `mail` where `status`=4 and `timestamp` < %i",
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);
}
@@ -671,7 +671,7 @@ void Database::ExpireMail() {
}
// Expire Read
if(RuleI(Mail, ExpireRead) >= 0) {
if(RunQuery(query, MakeAnyLenString(&query, "delete from `mail` where `status`=3 and `timestamp` < %i",
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);
}
@@ -682,7 +682,7 @@ void Database::ExpireMail() {
}
// Expire Unread
if(RuleI(Mail, ExpireUnread) >= 0) {
if(RunQuery(query, MakeAnyLenString(&query, "delete from `mail` where `status`=1 and `timestamp` < %i",
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);
}
@@ -707,7 +707,7 @@ void Database::AddFriendOrIgnore(int CharID, int Type, string Name) {
_log(UCS__TRACE, "Wrote Friend/Ignore entry for charid %i, type %i, name %s to database.",
CharID, Type, Name.c_str());
safe_delete_array(query);
}
@@ -724,7 +724,7 @@ void Database::RemoveFriendOrIgnore(int CharID, int Type, string Name) {
_log(UCS__TRACE, "Removed Friend/Ignore entry for charid %i, type %i, name %s from database.",
CharID, Type, Name.c_str());
safe_delete_array(query);
}
+2 -2
View File
@@ -61,13 +61,13 @@ public:
void AddFriendOrIgnore(int CharID, int Type, string Name);
void RemoveFriendOrIgnore(int CharID, int Type, string Name);
void GetFriendsAndIgnore(int CharID, vector<string> &Friends, vector<string> &Ignorees);
protected:
void HandleMysqlError(uint32 errnum);
private:
void DBInitVars();
};
#endif
+1 -1
View File
@@ -134,7 +134,7 @@ int main() {
CL = new Clientlist(Config->ChatPort);
ChannelList = new ChatChannelList();
database.LoadChatChannels();
if (signal(SIGINT, CatchSignal) == SIG_ERR) {
+1 -1
View File
@@ -36,7 +36,7 @@ public:
// Produce a const singleton
static const ucsconfig *get() {
if (_chat_config == nullptr)
if (_chat_config == nullptr)
LoadConfig();
return(_chat_config);
}
+7 -7
View File
@@ -4,13 +4,13 @@ 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 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
@@ -59,7 +59,7 @@ void WorldServer::OnConnected()
void WorldServer::Process()
{
WorldConnection::Process();
if (!Connected())
return;
@@ -118,10 +118,10 @@ void WorldServer::Process()
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,
database.SendMail(string("SOE.EQ.") + Config->ShortName + string(".") + string(mail->to),
string(mail->from),
mail->subject,
mail->message,
string());
break;
}
+1 -1
View File
@@ -27,7 +27,7 @@ public:
WorldServer();
virtual ~WorldServer();
virtual void Process();
private:
virtual void OnConnected();
};