mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 18:52:22 +00:00
Merge branch 'master' into StringFormatting
Conflicts: common/debug.cpp
This commit is contained in:
+34
-34
@@ -26,7 +26,7 @@
|
||||
extern Database database;
|
||||
extern uint32 ChatMessagesSent;
|
||||
|
||||
ChatChannel::ChatChannel(string inName, string inOwner, string inPassword, bool inPermanent, int inMinimumStatus) :
|
||||
ChatChannel::ChatChannel(std::string inName, std::string inOwner, std::string inPassword, bool inPermanent, int inMinimumStatus) :
|
||||
DeleteTimer(0) {
|
||||
|
||||
Name = inName;
|
||||
@@ -56,7 +56,7 @@ ChatChannel::~ChatChannel() {
|
||||
iterator.RemoveCurrent(false);
|
||||
}
|
||||
|
||||
ChatChannel* ChatChannelList::CreateChannel(string Name, string Owner, string Password, bool Permanent, int MinimumStatus) {
|
||||
ChatChannel* ChatChannelList::CreateChannel(std::string Name, std::string Owner, std::string Password, bool Permanent, int MinimumStatus) {
|
||||
|
||||
ChatChannel *NewChannel = new ChatChannel(CapitaliseName(Name), Owner, Password, Permanent, MinimumStatus);
|
||||
|
||||
@@ -65,9 +65,9 @@ ChatChannel* ChatChannelList::CreateChannel(string Name, string Owner, string Pa
|
||||
return NewChannel;
|
||||
}
|
||||
|
||||
ChatChannel* ChatChannelList::FindChannel(string Name) {
|
||||
ChatChannel* ChatChannelList::FindChannel(std::string Name) {
|
||||
|
||||
string NormalisedName = CapitaliseName(Name);
|
||||
std::string NormalisedName = CapitaliseName(Name);
|
||||
|
||||
LinkedListIterator<ChatChannel*> iterator(ChatChannels);
|
||||
|
||||
@@ -103,7 +103,7 @@ void ChatChannelList::SendAllChannels(Client *c) {
|
||||
|
||||
iterator.Reset();
|
||||
|
||||
string Message;
|
||||
std::string Message;
|
||||
|
||||
char CountString[10];
|
||||
|
||||
@@ -200,7 +200,7 @@ int ChatChannel::MemberCount(int Status) {
|
||||
return Count;
|
||||
}
|
||||
|
||||
void ChatChannel::SetPassword(string inPassword) {
|
||||
void ChatChannel::SetPassword(std::string inPassword) {
|
||||
|
||||
Password = inPassword;
|
||||
|
||||
@@ -211,7 +211,7 @@ void ChatChannel::SetPassword(string inPassword) {
|
||||
}
|
||||
}
|
||||
|
||||
void ChatChannel::SetOwner(string inOwner) {
|
||||
void ChatChannel::SetOwner(std::string inOwner) {
|
||||
|
||||
Owner = inOwner;
|
||||
|
||||
@@ -312,7 +312,7 @@ void ChatChannel::SendOPList(Client *c) {
|
||||
|
||||
c->GeneralChannelMessage("Channel " + Name + " op-list: (Owner=" + Owner + ")");
|
||||
|
||||
list<string>::iterator Iterator;
|
||||
std::list<std::string>::iterator Iterator;
|
||||
|
||||
for(Iterator = Moderators.begin(); Iterator != Moderators.end(); Iterator++)
|
||||
c->GeneralChannelMessage((*Iterator));
|
||||
@@ -327,7 +327,7 @@ void ChatChannel::SendChannelMembers(Client *c) {
|
||||
|
||||
sprintf(CountString, "(%i)", MemberCount(c->GetAccountStatus()));
|
||||
|
||||
string Message = "Channel " + GetName();
|
||||
std::string Message = "Channel " + GetName();
|
||||
|
||||
Message += CountString;
|
||||
|
||||
@@ -380,7 +380,7 @@ void ChatChannel::SendChannelMembers(Client *c) {
|
||||
|
||||
}
|
||||
|
||||
void ChatChannel::SendMessageToChannel(string Message, Client* Sender) {
|
||||
void ChatChannel::SendMessageToChannel(std::string Message, Client* Sender) {
|
||||
|
||||
if(!Sender) return;
|
||||
|
||||
@@ -448,7 +448,7 @@ bool ChatChannel::IsClientInChannel(Client *c) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ChatChannel *ChatChannelList::AddClientToChannel(string ChannelName, Client *c) {
|
||||
ChatChannel *ChatChannelList::AddClientToChannel(std::string ChannelName, Client *c) {
|
||||
|
||||
if(!c) return nullptr;
|
||||
|
||||
@@ -459,11 +459,11 @@ ChatChannel *ChatChannelList::AddClientToChannel(string ChannelName, Client *c)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
string NormalisedName, Password;
|
||||
std::string NormalisedName, Password;
|
||||
|
||||
string::size_type Colon = ChannelName.find_first_of(":");
|
||||
std::string::size_type Colon = ChannelName.find_first_of(":");
|
||||
|
||||
if(Colon == string::npos)
|
||||
if(Colon == std::string::npos)
|
||||
NormalisedName = CapitaliseName(ChannelName);
|
||||
else {
|
||||
NormalisedName = CapitaliseName(ChannelName.substr(0, Colon));
|
||||
@@ -487,7 +487,7 @@ ChatChannel *ChatChannelList::AddClientToChannel(string ChannelName, Client *c)
|
||||
|
||||
if(RequiredChannel->GetMinStatus() > c->GetAccountStatus()) {
|
||||
|
||||
string Message = "You do not have the required account status to join channel " + NormalisedName;
|
||||
std::string Message = "You do not have the required account status to join channel " + NormalisedName;
|
||||
|
||||
c->GeneralChannelMessage(Message);
|
||||
|
||||
@@ -519,11 +519,11 @@ ChatChannel *ChatChannelList::AddClientToChannel(string ChannelName, Client *c)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ChatChannel *ChatChannelList::RemoveClientFromChannel(string inChannelName, Client *c) {
|
||||
ChatChannel *ChatChannelList::RemoveClientFromChannel(std::string inChannelName, Client *c) {
|
||||
|
||||
if(!c) return nullptr;
|
||||
|
||||
string ChannelName = inChannelName;
|
||||
std::string ChannelName = inChannelName;
|
||||
|
||||
if((inChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||
ChannelName = c->ChannelSlotName(atoi(inChannelName.c_str()));
|
||||
@@ -565,7 +565,7 @@ void ChatChannelList::Process() {
|
||||
}
|
||||
}
|
||||
|
||||
void ChatChannel::AddInvitee(string Invitee) {
|
||||
void ChatChannel::AddInvitee(std::string Invitee) {
|
||||
|
||||
if(!IsInvitee(Invitee)) {
|
||||
|
||||
@@ -576,9 +576,9 @@ void ChatChannel::AddInvitee(string Invitee) {
|
||||
|
||||
}
|
||||
|
||||
void ChatChannel::RemoveInvitee(string Invitee) {
|
||||
void ChatChannel::RemoveInvitee(std::string Invitee) {
|
||||
|
||||
list<string>::iterator Iterator;
|
||||
std::list<std::string>::iterator Iterator;
|
||||
|
||||
for(Iterator = Invitees.begin(); Iterator != Invitees.end(); Iterator++) {
|
||||
|
||||
@@ -593,9 +593,9 @@ void ChatChannel::RemoveInvitee(string Invitee) {
|
||||
}
|
||||
}
|
||||
|
||||
bool ChatChannel::IsInvitee(string Invitee) {
|
||||
bool ChatChannel::IsInvitee(std::string Invitee) {
|
||||
|
||||
list<string>::iterator Iterator;
|
||||
std::list<std::string>::iterator Iterator;
|
||||
|
||||
for(Iterator = Invitees.begin(); Iterator != Invitees.end(); Iterator++) {
|
||||
|
||||
@@ -606,7 +606,7 @@ bool ChatChannel::IsInvitee(string Invitee) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void ChatChannel::AddModerator(string Moderator) {
|
||||
void ChatChannel::AddModerator(std::string Moderator) {
|
||||
|
||||
if(!IsModerator(Moderator)) {
|
||||
|
||||
@@ -617,9 +617,9 @@ void ChatChannel::AddModerator(string Moderator) {
|
||||
|
||||
}
|
||||
|
||||
void ChatChannel::RemoveModerator(string Moderator) {
|
||||
void ChatChannel::RemoveModerator(std::string Moderator) {
|
||||
|
||||
list<string>::iterator Iterator;
|
||||
std::list<std::string>::iterator Iterator;
|
||||
|
||||
for(Iterator = Moderators.begin(); Iterator != Moderators.end(); Iterator++) {
|
||||
|
||||
@@ -634,9 +634,9 @@ void ChatChannel::RemoveModerator(string Moderator) {
|
||||
}
|
||||
}
|
||||
|
||||
bool ChatChannel::IsModerator(string Moderator) {
|
||||
bool ChatChannel::IsModerator(std::string Moderator) {
|
||||
|
||||
list<string>::iterator Iterator;
|
||||
std::list<std::string>::iterator Iterator;
|
||||
|
||||
for(Iterator = Moderators.begin(); Iterator != Moderators.end(); Iterator++) {
|
||||
|
||||
@@ -647,7 +647,7 @@ bool ChatChannel::IsModerator(string Moderator) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void ChatChannel::AddVoice(string inVoiced) {
|
||||
void ChatChannel::AddVoice(std::string inVoiced) {
|
||||
|
||||
if(!HasVoice(inVoiced)) {
|
||||
|
||||
@@ -658,9 +658,9 @@ void ChatChannel::AddVoice(string inVoiced) {
|
||||
|
||||
}
|
||||
|
||||
void ChatChannel::RemoveVoice(string inVoiced) {
|
||||
void ChatChannel::RemoveVoice(std::string inVoiced) {
|
||||
|
||||
list<string>::iterator Iterator;
|
||||
std::list<std::string>::iterator Iterator;
|
||||
|
||||
for(Iterator = Voiced.begin(); Iterator != Voiced.end(); Iterator++) {
|
||||
|
||||
@@ -675,9 +675,9 @@ void ChatChannel::RemoveVoice(string inVoiced) {
|
||||
}
|
||||
}
|
||||
|
||||
bool ChatChannel::HasVoice(string inVoiced) {
|
||||
bool ChatChannel::HasVoice(std::string inVoiced) {
|
||||
|
||||
list<string>::iterator Iterator;
|
||||
std::list<std::string>::iterator Iterator;
|
||||
|
||||
for(Iterator = Voiced.begin(); Iterator != Voiced.end(); Iterator++) {
|
||||
|
||||
@@ -688,9 +688,9 @@ bool ChatChannel::HasVoice(string inVoiced) {
|
||||
return false;
|
||||
}
|
||||
|
||||
string CapitaliseName(string inString) {
|
||||
std::string CapitaliseName(std::string inString) {
|
||||
|
||||
string NormalisedName = inString;
|
||||
std::string NormalisedName = inString;
|
||||
|
||||
for(unsigned int i = 0; i < NormalisedName.length(); i++) {
|
||||
|
||||
|
||||
+27
-29
@@ -7,15 +7,13 @@
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class Client;
|
||||
|
||||
class ChatChannel {
|
||||
|
||||
public:
|
||||
|
||||
ChatChannel(string inName, string inOwner, string inPassword, bool inPermanent, int inMinimumStatus = 0);
|
||||
ChatChannel(std::string inName, std::string inOwner, std::string inPassword, bool inPermanent, int inMinimumStatus = 0);
|
||||
~ChatChannel();
|
||||
|
||||
void AddClient(Client *c);
|
||||
@@ -23,25 +21,25 @@ public:
|
||||
bool IsClientInChannel(Client *c);
|
||||
|
||||
int MemberCount(int Status);
|
||||
string GetName() { return Name; }
|
||||
void SendMessageToChannel(string Message, Client* Sender);
|
||||
bool CheckPassword(string inPassword) { return ((Password.length() == 0) || (Password == inPassword)); }
|
||||
void SetPassword(string inPassword);
|
||||
bool IsOwner(string Name) { return (Owner == Name); }
|
||||
void SetOwner(string inOwner);
|
||||
std::string GetName() { return Name; }
|
||||
void SendMessageToChannel(std::string Message, Client* Sender);
|
||||
bool CheckPassword(std::string inPassword) { return ((Password.length() == 0) || (Password == inPassword)); }
|
||||
void SetPassword(std::string inPassword);
|
||||
bool IsOwner(std::string Name) { return (Owner == Name); }
|
||||
void SetOwner(std::string inOwner);
|
||||
void SendChannelMembers(Client *c);
|
||||
int GetMinStatus() { return MinimumStatus; }
|
||||
bool ReadyToDelete() { return DeleteTimer.Check(); }
|
||||
void SendOPList(Client *c);
|
||||
void AddInvitee(string Invitee);
|
||||
void RemoveInvitee(string Invitee);
|
||||
bool IsInvitee(string Invitee);
|
||||
void AddModerator(string Moderator);
|
||||
void RemoveModerator(string Modeerator);
|
||||
bool IsModerator(string Moderator);
|
||||
void AddVoice(string Voiced);
|
||||
void RemoveVoice(string Voiced);
|
||||
bool HasVoice(string Voiced);
|
||||
void AddInvitee(std::string Invitee);
|
||||
void RemoveInvitee(std::string Invitee);
|
||||
bool IsInvitee(std::string Invitee);
|
||||
void AddModerator(std::string Moderator);
|
||||
void RemoveModerator(std::string Modeerator);
|
||||
bool IsModerator(std::string Moderator);
|
||||
void AddVoice(std::string Voiced);
|
||||
void RemoveVoice(std::string Voiced);
|
||||
bool HasVoice(std::string Voiced);
|
||||
inline bool IsModerated() { return Moderated; }
|
||||
void SetModerated(bool inModerated);
|
||||
|
||||
@@ -49,9 +47,9 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
string Name;
|
||||
string Owner;
|
||||
string Password;
|
||||
std::string Name;
|
||||
std::string Owner;
|
||||
std::string Password;
|
||||
|
||||
bool Permanent;
|
||||
bool Moderated;
|
||||
@@ -62,19 +60,19 @@ private:
|
||||
|
||||
LinkedList<Client*> ClientsInChannel;
|
||||
|
||||
list<string> Moderators;
|
||||
list<string> Invitees;
|
||||
list<string> Voiced;
|
||||
std::list<std::string> Moderators;
|
||||
std::list<std::string> Invitees;
|
||||
std::list<std::string> Voiced;
|
||||
|
||||
};
|
||||
|
||||
class ChatChannelList {
|
||||
|
||||
public:
|
||||
ChatChannel* CreateChannel(string Name, string Owner, string Passwordi, bool Permanent, int MinimumStatus = 0);
|
||||
ChatChannel* FindChannel(string Name);
|
||||
ChatChannel* AddClientToChannel(string Channel, Client *c);
|
||||
ChatChannel* RemoveClientFromChannel(string Channel, Client *c);
|
||||
ChatChannel* CreateChannel(std::string Name, std::string Owner, std::string Passwordi, bool Permanent, int MinimumStatus = 0);
|
||||
ChatChannel* FindChannel(std::string Name);
|
||||
ChatChannel* AddClientToChannel(std::string Channel, Client *c);
|
||||
ChatChannel* RemoveClientFromChannel(std::string Channel, Client *c);
|
||||
void RemoveClientFromAllChannels(Client *c);
|
||||
void RemoveChannel(ChatChannel *Channel);
|
||||
void RemoveAllChannels();
|
||||
@@ -87,6 +85,6 @@ private:
|
||||
|
||||
};
|
||||
|
||||
string CapitaliseName(string inString);
|
||||
std::string CapitaliseName(std::string inString);
|
||||
|
||||
#endif
|
||||
|
||||
+169
-171
@@ -33,11 +33,9 @@
|
||||
#include <cstdlib>
|
||||
#include <algorithm>
|
||||
|
||||
using namespace std;
|
||||
|
||||
extern Database database;
|
||||
extern string WorldShortName;
|
||||
extern string GetMailPrefix();
|
||||
extern std::string WorldShortName;
|
||||
extern std::string GetMailPrefix();
|
||||
extern ChatChannelList *ChannelList;
|
||||
extern Clientlist *CL;
|
||||
extern uint32 ChatMessagesSent;
|
||||
@@ -77,7 +75,7 @@ void Client::SendUptime() {
|
||||
safe_delete_array(Buffer);
|
||||
}
|
||||
|
||||
vector<string> ParseRecipients(string RecipientString) {
|
||||
std::vector<std::string> ParseRecipients(std::string RecipientString) {
|
||||
|
||||
// This method parses the Recipient List in the mailto command, which can look like this example:
|
||||
//
|
||||
@@ -111,19 +109,19 @@ vector<string> ParseRecipients(string RecipientString) {
|
||||
//
|
||||
// The '-' prefix indicates 'Secret To' (like BCC:)
|
||||
//
|
||||
vector<string> RecipientList;
|
||||
std::vector<std::string> RecipientList;
|
||||
|
||||
string Secret;
|
||||
std::string Secret;
|
||||
|
||||
string::size_type CurrentPos, Comma, FirstLT, LastGT, Space, LastPeriod;
|
||||
std::string::size_type CurrentPos, Comma, FirstLT, LastGT, Space, LastPeriod;
|
||||
|
||||
CurrentPos = 0;
|
||||
|
||||
while(CurrentPos != string::npos) {
|
||||
while(CurrentPos != std::string::npos) {
|
||||
|
||||
Comma = RecipientString.find_first_of(",", CurrentPos);
|
||||
|
||||
if(Comma == string::npos) {
|
||||
if(Comma == std::string::npos) {
|
||||
|
||||
RecipientList.push_back(RecipientString.substr(CurrentPos));
|
||||
|
||||
@@ -134,7 +132,7 @@ vector<string> ParseRecipients(string RecipientString) {
|
||||
CurrentPos = Comma + 2;
|
||||
}
|
||||
|
||||
vector<string>::iterator Iterator;
|
||||
std::vector<std::string>::iterator Iterator;
|
||||
|
||||
Iterator = RecipientList.begin();
|
||||
|
||||
@@ -152,27 +150,27 @@ vector<string> ParseRecipients(string RecipientString) {
|
||||
|
||||
FirstLT = (*Iterator).find_first_of("<");
|
||||
|
||||
if(FirstLT != string::npos) {
|
||||
if(FirstLT != std::string::npos) {
|
||||
|
||||
LastGT = (*Iterator).find_last_of(">");
|
||||
|
||||
if(LastGT != string::npos) {
|
||||
if(LastGT != std::string::npos) {
|
||||
|
||||
(*Iterator) = (*Iterator).substr(FirstLT + 1, LastGT - FirstLT - 1);
|
||||
|
||||
if((*Iterator).find_first_of(" ") != string::npos) {
|
||||
if((*Iterator).find_first_of(" ") != std::string::npos) {
|
||||
|
||||
string Recips = (*Iterator);
|
||||
std::string Recips = (*Iterator);
|
||||
|
||||
RecipientList.erase(Iterator);
|
||||
|
||||
CurrentPos = 0;
|
||||
|
||||
while(CurrentPos != string::npos) {
|
||||
while(CurrentPos != std::string::npos) {
|
||||
|
||||
Space = Recips.find_first_of(" ", CurrentPos);
|
||||
|
||||
if(Space == string::npos) {
|
||||
if(Space == std::string::npos) {
|
||||
|
||||
RecipientList.push_back(Secret + Recips.substr(CurrentPos));
|
||||
|
||||
@@ -207,7 +205,7 @@ vector<string> ParseRecipients(string RecipientString) {
|
||||
|
||||
LastPeriod = (*Iterator).find_last_of(".");
|
||||
|
||||
if(LastPeriod != string::npos) {
|
||||
if(LastPeriod != std::string::npos) {
|
||||
|
||||
(*Iterator) = (*Iterator).substr(LastPeriod + 1);
|
||||
|
||||
@@ -227,7 +225,7 @@ vector<string> ParseRecipients(string RecipientString) {
|
||||
|
||||
sort(RecipientList.begin(), RecipientList.end());
|
||||
|
||||
vector<string>::iterator new_end_pos = unique(RecipientList.begin(), RecipientList.end());
|
||||
std::vector<std::string>::iterator new_end_pos = unique(RecipientList.begin(), RecipientList.end());
|
||||
|
||||
RecipientList.erase(new_end_pos, RecipientList.end());
|
||||
|
||||
@@ -235,27 +233,27 @@ vector<string> ParseRecipients(string RecipientString) {
|
||||
|
||||
}
|
||||
|
||||
static void ProcessMailTo(Client *c, string MailMessage) {
|
||||
static void ProcessMailTo(Client *c, std::string MailMessage) {
|
||||
|
||||
_log(UCS__TRACE, "MAILTO: From %s, %s", c->MailBoxName().c_str(), MailMessage.c_str());
|
||||
|
||||
vector<string> Recipients;
|
||||
std::vector<std::string> Recipients;
|
||||
|
||||
string::size_type FirstQuote = MailMessage.find_first_of("\"", 0);
|
||||
std::string::size_type FirstQuote = MailMessage.find_first_of("\"", 0);
|
||||
|
||||
string::size_type NextQuote = MailMessage.find_first_of("\"", FirstQuote + 1);
|
||||
std::string::size_type NextQuote = MailMessage.find_first_of("\"", FirstQuote + 1);
|
||||
|
||||
string RecipientsString = MailMessage.substr(FirstQuote+1, NextQuote-FirstQuote - 1);
|
||||
std::string RecipientsString = MailMessage.substr(FirstQuote+1, NextQuote-FirstQuote - 1);
|
||||
|
||||
Recipients = ParseRecipients(RecipientsString);
|
||||
|
||||
// Now extract the subject field. This is in quotes if it is more than one word
|
||||
//
|
||||
string Subject;
|
||||
std::string Subject;
|
||||
|
||||
string::size_type SubjectStart = NextQuote + 2;
|
||||
std::string::size_type SubjectStart = NextQuote + 2;
|
||||
|
||||
string::size_type SubjectEnd;
|
||||
std::string::size_type SubjectEnd;
|
||||
|
||||
if(MailMessage.substr(SubjectStart, 1) == "\"") {
|
||||
|
||||
@@ -274,7 +272,7 @@ static void ProcessMailTo(Client *c, string MailMessage) {
|
||||
SubjectEnd++;
|
||||
|
||||
}
|
||||
string Body = MailMessage.substr(SubjectEnd);
|
||||
std::string Body = MailMessage.substr(SubjectEnd);
|
||||
|
||||
bool Success = true;
|
||||
|
||||
@@ -353,10 +351,10 @@ static void ProcessMailTo(Client *c, string MailMessage) {
|
||||
}
|
||||
}
|
||||
|
||||
static void ProcessMailTo(Client *c, string from, string subject, string message) {
|
||||
static void ProcessMailTo(Client *c, std::string from, std::string subject, std::string message) {
|
||||
}
|
||||
|
||||
static void ProcessSetMessageStatus(string SetMessageCommand) {
|
||||
static void ProcessSetMessageStatus(std::string SetMessageCommand) {
|
||||
|
||||
int MessageNumber;
|
||||
|
||||
@@ -376,13 +374,13 @@ static void ProcessSetMessageStatus(string SetMessageCommand) {
|
||||
Status = 0;
|
||||
|
||||
}
|
||||
string::size_type NumStart = SetMessageCommand.find_first_of("123456789");
|
||||
std::string::size_type NumStart = SetMessageCommand.find_first_of("123456789");
|
||||
|
||||
while(NumStart != string::npos) {
|
||||
while(NumStart != std::string::npos) {
|
||||
|
||||
string::size_type NumEnd = SetMessageCommand.find_first_of(" ", NumStart);
|
||||
std::string::size_type NumEnd = SetMessageCommand.find_first_of(" ", NumStart);
|
||||
|
||||
if(NumEnd == string::npos) {
|
||||
if(NumEnd == std::string::npos) {
|
||||
|
||||
MessageNumber = atoi(SetMessageCommand.substr(NumStart).c_str());
|
||||
|
||||
@@ -399,7 +397,7 @@ static void ProcessSetMessageStatus(string SetMessageCommand) {
|
||||
}
|
||||
}
|
||||
|
||||
static void ProcessCommandBuddy(Client *c, string Buddy) {
|
||||
static void ProcessCommandBuddy(Client *c, std::string Buddy) {
|
||||
|
||||
_log(UCS__TRACE, "Received buddy command with parameters %s", Buddy.c_str());
|
||||
c->GeneralChannelMessage("Buddy list modified");
|
||||
@@ -429,7 +427,7 @@ static void ProcessCommandBuddy(Client *c, string Buddy) {
|
||||
|
||||
}
|
||||
|
||||
static void ProcessCommandIgnore(Client *c, string Ignoree) {
|
||||
static void ProcessCommandIgnore(Client *c, std::string Ignoree) {
|
||||
|
||||
_log(UCS__TRACE, "Received ignore command with parameters %s", Ignoree.c_str());
|
||||
c->GeneralChannelMessage("Ignore list modified");
|
||||
@@ -442,11 +440,11 @@ static void ProcessCommandIgnore(Client *c, string Ignoree) {
|
||||
|
||||
// Strip off the SOE.EQ.<shortname>.
|
||||
//
|
||||
string CharacterName;
|
||||
std::string CharacterName;
|
||||
|
||||
string::size_type LastPeriod = Ignoree.find_last_of(".");
|
||||
std::string::size_type LastPeriod = Ignoree.find_last_of(".");
|
||||
|
||||
if(LastPeriod == string::npos)
|
||||
if(LastPeriod == std::string::npos)
|
||||
CharacterName = Ignoree;
|
||||
else
|
||||
CharacterName = Ignoree.substr(LastPeriod + 1);
|
||||
@@ -554,7 +552,7 @@ void Clientlist::CheckForStaleConnections(Client *c) {
|
||||
|
||||
if(!c) return;
|
||||
|
||||
list<Client*>::iterator Iterator;
|
||||
std::list<Client*>::iterator Iterator;
|
||||
|
||||
for(Iterator = ClientChatConnections.begin(); Iterator != ClientChatConnections.end(); Iterator++) {
|
||||
|
||||
@@ -596,7 +594,7 @@ void Clientlist::Process() {
|
||||
ClientChatConnections.push_back(c);
|
||||
}
|
||||
|
||||
list<Client*>::iterator Iterator;
|
||||
std::list<Client*>::iterator Iterator;
|
||||
|
||||
for(Iterator = ClientChatConnections.begin(); Iterator != ClientChatConnections.end(); Iterator++) {
|
||||
|
||||
@@ -657,13 +655,13 @@ void Clientlist::Process() {
|
||||
|
||||
VARSTRUCT_DECODE_STRING(Key, PacketBuffer);
|
||||
|
||||
string MailBoxString = MailBox, CharacterName;
|
||||
std::string MailBoxString = MailBox, CharacterName;
|
||||
|
||||
// Strip off the SOE.EQ.<shortname>.
|
||||
//
|
||||
string::size_type LastPeriod = MailBoxString.find_last_of(".");
|
||||
std::string::size_type LastPeriod = MailBoxString.find_last_of(".");
|
||||
|
||||
if(LastPeriod == string::npos)
|
||||
if(LastPeriod == std::string::npos)
|
||||
CharacterName = MailBoxString;
|
||||
else
|
||||
CharacterName = MailBoxString.substr(LastPeriod + 1);
|
||||
@@ -695,7 +693,7 @@ void Clientlist::Process() {
|
||||
|
||||
case OP_Mail: {
|
||||
|
||||
string CommandString = (const char*)app->pBuffer;
|
||||
std::string CommandString = (const char*)app->pBuffer;
|
||||
|
||||
ProcessOPMailCommand((*Iterator), CommandString);
|
||||
|
||||
@@ -735,7 +733,7 @@ void Clientlist::Process() {
|
||||
|
||||
}
|
||||
|
||||
void Clientlist::ProcessOPMailCommand(Client *c, string CommandString)
|
||||
void Clientlist::ProcessOPMailCommand(Client *c, std::string CommandString)
|
||||
{
|
||||
|
||||
if(CommandString.length() == 0)
|
||||
@@ -756,17 +754,17 @@ void Clientlist::ProcessOPMailCommand(Client *c, string CommandString)
|
||||
return;
|
||||
}
|
||||
|
||||
string Command, Parameters;
|
||||
std::string Command, Parameters;
|
||||
|
||||
string::size_type Space = CommandString.find_first_of(" ");
|
||||
std::string::size_type Space = CommandString.find_first_of(" ");
|
||||
|
||||
if(Space != string::npos) {
|
||||
if(Space != std::string::npos) {
|
||||
|
||||
Command = CommandString.substr(0, Space);
|
||||
|
||||
string::size_type ParametersStart = CommandString.find_first_not_of(" ", Space);
|
||||
std::string::size_type ParametersStart = CommandString.find_first_not_of(" ", Space);
|
||||
|
||||
if(ParametersStart != string::npos)
|
||||
if(ParametersStart != std::string::npos)
|
||||
Parameters = CommandString.substr(ParametersStart);
|
||||
}
|
||||
else
|
||||
@@ -867,7 +865,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, string CommandString)
|
||||
|
||||
case CommandSelectMailBox:
|
||||
{
|
||||
string::size_type NumStart = Parameters.find_first_of("0123456789");
|
||||
std::string::size_type NumStart = Parameters.find_first_of("0123456789");
|
||||
c->ChangeMailBox(atoi(Parameters.substr(NumStart).c_str()));
|
||||
break;
|
||||
}
|
||||
@@ -893,7 +891,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, string CommandString)
|
||||
void Clientlist::CloseAllConnections() {
|
||||
|
||||
|
||||
list<Client*>::iterator Iterator;
|
||||
std::list<Client*>::iterator Iterator;
|
||||
|
||||
for(Iterator = ClientChatConnections.begin(); Iterator != ClientChatConnections.end(); Iterator++) {
|
||||
|
||||
@@ -921,7 +919,7 @@ void Client::SendMailBoxes() {
|
||||
|
||||
int PacketLength = 10;
|
||||
|
||||
string s;
|
||||
std::string s;
|
||||
|
||||
for(int i = 0; i < Count; i++) {
|
||||
|
||||
@@ -951,9 +949,9 @@ void Client::SendMailBoxes() {
|
||||
safe_delete(outapp);
|
||||
}
|
||||
|
||||
Client *Clientlist::FindCharacter(string CharacterName) {
|
||||
Client *Clientlist::FindCharacter(std::string CharacterName) {
|
||||
|
||||
list<Client*>::iterator Iterator;
|
||||
std::list<Client*>::iterator Iterator;
|
||||
|
||||
for(Iterator = ClientChatConnections.begin(); Iterator != ClientChatConnections.end(); Iterator++) {
|
||||
|
||||
@@ -1005,7 +1003,7 @@ int Client::ChannelCount() {
|
||||
|
||||
}
|
||||
|
||||
void Client::JoinChannels(string ChannelNameList) {
|
||||
void Client::JoinChannels(std::string ChannelNameList) {
|
||||
|
||||
for(int x = 0; x < ChannelNameList.size(); ++x)
|
||||
{
|
||||
@@ -1019,9 +1017,9 @@ void Client::JoinChannels(string ChannelNameList) {
|
||||
|
||||
int NumberOfChannels = ChannelCount();
|
||||
|
||||
string::size_type CurrentPos = ChannelNameList.find_first_not_of(" ");
|
||||
std::string::size_type CurrentPos = ChannelNameList.find_first_not_of(" ");
|
||||
|
||||
while(CurrentPos != string::npos) {
|
||||
while(CurrentPos != std::string::npos) {
|
||||
|
||||
if(NumberOfChannels == MAX_JOINED_CHANNELS) {
|
||||
|
||||
@@ -1030,9 +1028,9 @@ void Client::JoinChannels(string ChannelNameList) {
|
||||
break;
|
||||
}
|
||||
|
||||
string::size_type Comma = ChannelNameList.find_first_of(", ", CurrentPos);
|
||||
std::string::size_type Comma = ChannelNameList.find_first_of(", ", CurrentPos);
|
||||
|
||||
if(Comma == string::npos) {
|
||||
if(Comma == std::string::npos) {
|
||||
|
||||
ChatChannel* JoinedChannel = ChannelList->AddClientToChannel(ChannelNameList.substr(CurrentPos), this);
|
||||
|
||||
@@ -1054,7 +1052,7 @@ void Client::JoinChannels(string ChannelNameList) {
|
||||
CurrentPos = ChannelNameList.find_first_not_of(", ", Comma);
|
||||
}
|
||||
|
||||
string JoinedChannelsList, ChannelMessage;
|
||||
std::string JoinedChannelsList, ChannelMessage;
|
||||
|
||||
ChannelMessage = "Channels: ";
|
||||
|
||||
@@ -1115,17 +1113,17 @@ void Client::JoinChannels(string ChannelNameList) {
|
||||
safe_delete(outapp);
|
||||
}
|
||||
|
||||
void Client::LeaveChannels(string ChannelNameList) {
|
||||
void Client::LeaveChannels(std::string ChannelNameList) {
|
||||
|
||||
_log(UCS__TRACE, "Client: %s leaving channels %s", GetName().c_str(), ChannelNameList.c_str());
|
||||
|
||||
string::size_type CurrentPos = 0;
|
||||
std::string::size_type CurrentPos = 0;
|
||||
|
||||
while(CurrentPos != string::npos) {
|
||||
while(CurrentPos != std::string::npos) {
|
||||
|
||||
string::size_type Comma = ChannelNameList.find_first_of(", ", CurrentPos);
|
||||
std::string::size_type Comma = ChannelNameList.find_first_of(", ", CurrentPos);
|
||||
|
||||
if(Comma == string::npos) {
|
||||
if(Comma == std::string::npos) {
|
||||
|
||||
ChatChannel* JoinedChannel = ChannelList->RemoveClientFromChannel(ChannelNameList.substr(CurrentPos), this);
|
||||
|
||||
@@ -1143,7 +1141,7 @@ void Client::LeaveChannels(string ChannelNameList) {
|
||||
CurrentPos = ChannelNameList.find_first_not_of(", ", Comma);
|
||||
}
|
||||
|
||||
string JoinedChannelsList, ChannelMessage;
|
||||
std::string JoinedChannelsList, ChannelMessage;
|
||||
|
||||
ChannelMessage = "Channels: ";
|
||||
|
||||
@@ -1220,7 +1218,7 @@ void Client::LeaveAllChannels(bool SendUpdatedChannelList) {
|
||||
}
|
||||
|
||||
|
||||
void Client::ProcessChannelList(string Input) {
|
||||
void Client::ProcessChannelList(std::string Input) {
|
||||
|
||||
if(Input.length() == 0) {
|
||||
|
||||
@@ -1229,7 +1227,7 @@ void Client::ProcessChannelList(string Input) {
|
||||
return;
|
||||
}
|
||||
|
||||
string ChannelName = Input;
|
||||
std::string ChannelName = Input;
|
||||
|
||||
if(isdigit(ChannelName[0]))
|
||||
ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
|
||||
@@ -1246,7 +1244,7 @@ void Client::ProcessChannelList(string Input) {
|
||||
|
||||
void Client::SendChannelList() {
|
||||
|
||||
string ChannelMessage;
|
||||
std::string ChannelMessage;
|
||||
|
||||
ChannelMessage = "Channels: ";
|
||||
|
||||
@@ -1287,15 +1285,15 @@ void Client::SendChannelList() {
|
||||
safe_delete(outapp);
|
||||
}
|
||||
|
||||
void Client::SendChannelMessage(string Message)
|
||||
void Client::SendChannelMessage(std::string Message)
|
||||
{
|
||||
|
||||
string::size_type MessageStart = Message.find_first_of(" ");
|
||||
std::string::size_type MessageStart = Message.find_first_of(" ");
|
||||
|
||||
if(MessageStart == string::npos)
|
||||
if(MessageStart == std::string::npos)
|
||||
return;
|
||||
|
||||
string ChannelName = Message.substr(1, MessageStart-1);
|
||||
std::string ChannelName = Message.substr(1, MessageStart-1);
|
||||
|
||||
_log(UCS__TRACE, "%s tells %s, [%s]", GetName().c_str(), ChannelName.c_str(), Message.substr(MessageStart + 1).c_str());
|
||||
|
||||
@@ -1389,11 +1387,11 @@ void Client::SendChannelMessage(string Message)
|
||||
|
||||
}
|
||||
|
||||
void Client::SendChannelMessageByNumber(string Message) {
|
||||
void Client::SendChannelMessageByNumber(std::string Message) {
|
||||
|
||||
string::size_type MessageStart = Message.find_first_of(" ");
|
||||
std::string::size_type MessageStart = Message.find_first_of(" ");
|
||||
|
||||
if(MessageStart == string::npos)
|
||||
if(MessageStart == std::string::npos)
|
||||
return;
|
||||
|
||||
int ChannelNumber = atoi(Message.substr(0, MessageStart).c_str());
|
||||
@@ -1503,11 +1501,11 @@ void Client::SendChannelMessageByNumber(string Message) {
|
||||
|
||||
}
|
||||
|
||||
void Client::SendChannelMessage(string ChannelName, string Message, Client *Sender) {
|
||||
void Client::SendChannelMessage(std::string ChannelName, std::string Message, Client *Sender) {
|
||||
|
||||
if(!Sender) return;
|
||||
|
||||
string FQSenderName = WorldShortName + "." + Sender->GetName();
|
||||
std::string FQSenderName = WorldShortName + "." + Sender->GetName();
|
||||
|
||||
int PacketLength = ChannelName.length() + Message.length() + FQSenderName.length() + 3;
|
||||
|
||||
@@ -1531,7 +1529,7 @@ void Client::SendChannelMessage(string ChannelName, string Message, Client *Send
|
||||
safe_delete(outapp);
|
||||
}
|
||||
|
||||
void Client::ToggleAnnounce(string State)
|
||||
void Client::ToggleAnnounce(std::string State)
|
||||
{
|
||||
if(State == "")
|
||||
Announce = !Announce;
|
||||
@@ -1540,7 +1538,7 @@ void Client::ToggleAnnounce(string State)
|
||||
else
|
||||
Announce = false;
|
||||
|
||||
string Message = "Announcing now ";
|
||||
std::string Message = "Announcing now ";
|
||||
|
||||
if(Announce)
|
||||
Message += "on";
|
||||
@@ -1594,13 +1592,13 @@ void Client::GeneralChannelMessage(const char *Characters) {
|
||||
|
||||
if(!Characters) return;
|
||||
|
||||
string Message = Characters;
|
||||
std::string Message = Characters;
|
||||
|
||||
GeneralChannelMessage(Message);
|
||||
|
||||
}
|
||||
|
||||
void Client::GeneralChannelMessage(string Message) {
|
||||
void Client::GeneralChannelMessage(std::string Message) {
|
||||
|
||||
EQApplicationPacket *outapp = new EQApplicationPacket(OP_ChannelMessage, Message.length() + 3);
|
||||
char *PacketBuffer = (char *)outapp->pBuffer;
|
||||
@@ -1614,40 +1612,40 @@ void Client::GeneralChannelMessage(string Message) {
|
||||
safe_delete(outapp);
|
||||
}
|
||||
|
||||
void Client::SetChannelPassword(string ChannelPassword) {
|
||||
void Client::SetChannelPassword(std::string ChannelPassword) {
|
||||
|
||||
string::size_type PasswordStart = ChannelPassword.find_first_not_of(" ");
|
||||
std::string::size_type PasswordStart = ChannelPassword.find_first_not_of(" ");
|
||||
|
||||
if(PasswordStart == string::npos) {
|
||||
string Message = "Incorrect syntax: /chat password <new password> <channel name>";
|
||||
if(PasswordStart == std::string::npos) {
|
||||
std::string Message = "Incorrect syntax: /chat password <new password> <channel name>";
|
||||
GeneralChannelMessage(Message);
|
||||
return;
|
||||
}
|
||||
|
||||
string::size_type Space = ChannelPassword.find_first_of(" ", PasswordStart);
|
||||
std::string::size_type Space = ChannelPassword.find_first_of(" ", PasswordStart);
|
||||
|
||||
if(Space == string::npos) {
|
||||
string Message = "Incorrect syntax: /chat password <new password> <channel name>";
|
||||
if(Space == std::string::npos) {
|
||||
std::string Message = "Incorrect syntax: /chat password <new password> <channel name>";
|
||||
GeneralChannelMessage(Message);
|
||||
return;
|
||||
}
|
||||
|
||||
string Password = ChannelPassword.substr(PasswordStart, Space - PasswordStart);
|
||||
std::string Password = ChannelPassword.substr(PasswordStart, Space - PasswordStart);
|
||||
|
||||
string::size_type ChannelStart = ChannelPassword.find_first_not_of(" ", Space);
|
||||
std::string::size_type ChannelStart = ChannelPassword.find_first_not_of(" ", Space);
|
||||
|
||||
if(ChannelStart == string::npos) {
|
||||
string Message = "Incorrect syntax: /chat password <new password> <channel name>";
|
||||
if(ChannelStart == std::string::npos) {
|
||||
std::string Message = "Incorrect syntax: /chat password <new password> <channel name>";
|
||||
GeneralChannelMessage(Message);
|
||||
return;
|
||||
}
|
||||
|
||||
string ChannelName = ChannelPassword.substr(ChannelStart);
|
||||
std::string ChannelName = ChannelPassword.substr(ChannelStart);
|
||||
|
||||
if((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||
ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
|
||||
|
||||
string Message;
|
||||
std::string Message;
|
||||
|
||||
if(!strcasecmp(Password.c_str(), "remove")) {
|
||||
Password.clear();
|
||||
@@ -1661,13 +1659,13 @@ void Client::SetChannelPassword(string ChannelPassword) {
|
||||
ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName);
|
||||
|
||||
if(!RequiredChannel) {
|
||||
string Message = "Channel not found.";
|
||||
std::string Message = "Channel not found.";
|
||||
GeneralChannelMessage(Message);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!RequiredChannel->IsOwner(GetName()) && !RequiredChannel->IsModerator(GetName()) && !IsChannelAdmin()) {
|
||||
string Message = "You do not own or have moderator rights on channel " + ChannelName;
|
||||
std::string Message = "You do not own or have moderator rights on channel " + ChannelName;
|
||||
GeneralChannelMessage(Message);
|
||||
return;
|
||||
}
|
||||
@@ -1678,35 +1676,35 @@ void Client::SetChannelPassword(string ChannelPassword) {
|
||||
|
||||
}
|
||||
|
||||
void Client::SetChannelOwner(string CommandString) {
|
||||
void Client::SetChannelOwner(std::string CommandString) {
|
||||
|
||||
string::size_type PlayerStart = CommandString.find_first_not_of(" ");
|
||||
std::string::size_type PlayerStart = CommandString.find_first_not_of(" ");
|
||||
|
||||
if(PlayerStart == string::npos) {
|
||||
string Message = "Incorrect syntax: /chat setowner <player> <channel>";
|
||||
if(PlayerStart == std::string::npos) {
|
||||
std::string Message = "Incorrect syntax: /chat setowner <player> <channel>";
|
||||
GeneralChannelMessage(Message);
|
||||
return;
|
||||
}
|
||||
|
||||
string::size_type Space = CommandString.find_first_of(" ", PlayerStart);
|
||||
std::string::size_type Space = CommandString.find_first_of(" ", PlayerStart);
|
||||
|
||||
if(Space == string::npos) {
|
||||
string Message = "Incorrect syntax: /chat setowner <player> <channel>";
|
||||
if(Space == std::string::npos) {
|
||||
std::string Message = "Incorrect syntax: /chat setowner <player> <channel>";
|
||||
GeneralChannelMessage(Message);
|
||||
return;
|
||||
}
|
||||
|
||||
string NewOwner = CapitaliseName(CommandString.substr(PlayerStart, Space - PlayerStart));
|
||||
std::string NewOwner = CapitaliseName(CommandString.substr(PlayerStart, Space - PlayerStart));
|
||||
|
||||
string::size_type ChannelStart = CommandString.find_first_not_of(" ", Space);
|
||||
std::string::size_type ChannelStart = CommandString.find_first_not_of(" ", Space);
|
||||
|
||||
if(ChannelStart == string::npos) {
|
||||
string Message = "Incorrect syntax: /chat setowner <player> <channel>";
|
||||
if(ChannelStart == std::string::npos) {
|
||||
std::string Message = "Incorrect syntax: /chat setowner <player> <channel>";
|
||||
GeneralChannelMessage(Message);
|
||||
return;
|
||||
}
|
||||
|
||||
string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
||||
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
||||
|
||||
if((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||
ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
|
||||
@@ -1721,7 +1719,7 @@ void Client::SetChannelOwner(string CommandString) {
|
||||
}
|
||||
|
||||
if(!RequiredChannel->IsOwner(GetName()) && !IsChannelAdmin()) {
|
||||
string Message = "You do not own channel " + ChannelName;
|
||||
std::string Message = "You do not own channel " + ChannelName;
|
||||
GeneralChannelMessage(Message);
|
||||
return;
|
||||
}
|
||||
@@ -1741,17 +1739,17 @@ void Client::SetChannelOwner(string CommandString) {
|
||||
|
||||
}
|
||||
|
||||
void Client::OPList(string CommandString) {
|
||||
void Client::OPList(std::string CommandString) {
|
||||
|
||||
string::size_type ChannelStart = CommandString.find_first_not_of(" ");
|
||||
std::string::size_type ChannelStart = CommandString.find_first_not_of(" ");
|
||||
|
||||
if(ChannelStart == string::npos) {
|
||||
string Message = "Incorrect syntax: /chat oplist <channel>";
|
||||
if(ChannelStart == std::string::npos) {
|
||||
std::string Message = "Incorrect syntax: /chat oplist <channel>";
|
||||
GeneralChannelMessage(Message);
|
||||
return;
|
||||
}
|
||||
|
||||
string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
||||
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
||||
|
||||
if((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||
ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
|
||||
@@ -1766,35 +1764,35 @@ void Client::OPList(string CommandString) {
|
||||
RequiredChannel->SendOPList(this);
|
||||
}
|
||||
|
||||
void Client::ChannelInvite(string CommandString) {
|
||||
void Client::ChannelInvite(std::string CommandString) {
|
||||
|
||||
string::size_type PlayerStart = CommandString.find_first_not_of(" ");
|
||||
std::string::size_type PlayerStart = CommandString.find_first_not_of(" ");
|
||||
|
||||
if(PlayerStart == string::npos) {
|
||||
string Message = "Incorrect syntax: /chat invite <player> <channel>";
|
||||
if(PlayerStart == std::string::npos) {
|
||||
std::string Message = "Incorrect syntax: /chat invite <player> <channel>";
|
||||
GeneralChannelMessage(Message);
|
||||
return;
|
||||
}
|
||||
|
||||
string::size_type Space = CommandString.find_first_of(" ", PlayerStart);
|
||||
std::string::size_type Space = CommandString.find_first_of(" ", PlayerStart);
|
||||
|
||||
if(Space == string::npos) {
|
||||
string Message = "Incorrect syntax: /chat invite <player> <channel>";
|
||||
if(Space == std::string::npos) {
|
||||
std::string Message = "Incorrect syntax: /chat invite <player> <channel>";
|
||||
GeneralChannelMessage(Message);
|
||||
return;
|
||||
}
|
||||
|
||||
string Invitee = CapitaliseName(CommandString.substr(PlayerStart, Space - PlayerStart));
|
||||
std::string Invitee = CapitaliseName(CommandString.substr(PlayerStart, Space - PlayerStart));
|
||||
|
||||
string::size_type ChannelStart = CommandString.find_first_not_of(" ", Space);
|
||||
std::string::size_type ChannelStart = CommandString.find_first_not_of(" ", Space);
|
||||
|
||||
if(ChannelStart == string::npos) {
|
||||
string Message = "Incorrect syntax: /chat invite <player> <channel>";
|
||||
if(ChannelStart == std::string::npos) {
|
||||
std::string Message = "Incorrect syntax: /chat invite <player> <channel>";
|
||||
GeneralChannelMessage(Message);
|
||||
return;
|
||||
}
|
||||
|
||||
string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
||||
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
||||
|
||||
if((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||
ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
|
||||
@@ -1831,7 +1829,7 @@ void Client::ChannelInvite(string CommandString) {
|
||||
|
||||
if(!RequiredChannel->IsOwner(GetName()) && !RequiredChannel->IsModerator(GetName())) {
|
||||
|
||||
string Message = "You do not own or have moderator rights to channel " + ChannelName;
|
||||
std::string Message = "You do not own or have moderator rights to channel " + ChannelName;
|
||||
|
||||
GeneralChannelMessage(Message);
|
||||
return;
|
||||
@@ -1852,19 +1850,19 @@ void Client::ChannelInvite(string CommandString) {
|
||||
|
||||
}
|
||||
|
||||
void Client::ChannelModerate(string CommandString) {
|
||||
void Client::ChannelModerate(std::string CommandString) {
|
||||
|
||||
string::size_type ChannelStart = CommandString.find_first_not_of(" ");
|
||||
std::string::size_type ChannelStart = CommandString.find_first_not_of(" ");
|
||||
|
||||
if(ChannelStart == string::npos) {
|
||||
if(ChannelStart == std::string::npos) {
|
||||
|
||||
string Message = "Incorrect syntax: /chat moderate <channel>";
|
||||
std::string Message = "Incorrect syntax: /chat moderate <channel>";
|
||||
|
||||
GeneralChannelMessage(Message);
|
||||
return;
|
||||
}
|
||||
|
||||
string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
||||
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
||||
|
||||
if((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||
ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
|
||||
@@ -1893,35 +1891,35 @@ void Client::ChannelModerate(string CommandString) {
|
||||
|
||||
}
|
||||
|
||||
void Client::ChannelGrantModerator(string CommandString) {
|
||||
void Client::ChannelGrantModerator(std::string CommandString) {
|
||||
|
||||
string::size_type PlayerStart = CommandString.find_first_not_of(" ");
|
||||
std::string::size_type PlayerStart = CommandString.find_first_not_of(" ");
|
||||
|
||||
if(PlayerStart == string::npos) {
|
||||
if(PlayerStart == std::string::npos) {
|
||||
|
||||
GeneralChannelMessage("Incorrect syntax: /chat grant <player> <channel>");
|
||||
return;
|
||||
}
|
||||
|
||||
string::size_type Space = CommandString.find_first_of(" ", PlayerStart);
|
||||
std::string::size_type Space = CommandString.find_first_of(" ", PlayerStart);
|
||||
|
||||
if(Space == string::npos) {
|
||||
if(Space == std::string::npos) {
|
||||
|
||||
GeneralChannelMessage("Incorrect syntax: /chat grant <player> <channel>");
|
||||
return;
|
||||
}
|
||||
|
||||
string Moderator = CapitaliseName(CommandString.substr(PlayerStart, Space - PlayerStart));
|
||||
std::string Moderator = CapitaliseName(CommandString.substr(PlayerStart, Space - PlayerStart));
|
||||
|
||||
string::size_type ChannelStart = CommandString.find_first_not_of(" ", Space);
|
||||
std::string::size_type ChannelStart = CommandString.find_first_not_of(" ", Space);
|
||||
|
||||
if(ChannelStart == string::npos) {
|
||||
if(ChannelStart == std::string::npos) {
|
||||
|
||||
GeneralChannelMessage("Incorrect syntax: /chat grant <player> <channel>");
|
||||
return;
|
||||
}
|
||||
|
||||
string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
||||
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
||||
|
||||
if((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||
ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
|
||||
@@ -1976,33 +1974,33 @@ void Client::ChannelGrantModerator(string CommandString) {
|
||||
|
||||
}
|
||||
|
||||
void Client::ChannelGrantVoice(string CommandString) {
|
||||
void Client::ChannelGrantVoice(std::string CommandString) {
|
||||
|
||||
string::size_type PlayerStart = CommandString.find_first_not_of(" ");
|
||||
std::string::size_type PlayerStart = CommandString.find_first_not_of(" ");
|
||||
|
||||
if(PlayerStart == string::npos) {
|
||||
if(PlayerStart == std::string::npos) {
|
||||
|
||||
GeneralChannelMessage("Incorrect syntax: /chat voice <player> <channel>");
|
||||
return;
|
||||
}
|
||||
|
||||
string::size_type Space = CommandString.find_first_of(" ", PlayerStart);
|
||||
std::string::size_type Space = CommandString.find_first_of(" ", PlayerStart);
|
||||
|
||||
if(Space == string::npos) {
|
||||
if(Space == std::string::npos) {
|
||||
GeneralChannelMessage("Incorrect syntax: /chat voice <player> <channel>");
|
||||
return;
|
||||
}
|
||||
|
||||
string Voicee = CapitaliseName(CommandString.substr(PlayerStart, Space - PlayerStart));
|
||||
std::string Voicee = CapitaliseName(CommandString.substr(PlayerStart, Space - PlayerStart));
|
||||
|
||||
string::size_type ChannelStart = CommandString.find_first_not_of(" ", Space);
|
||||
std::string::size_type ChannelStart = CommandString.find_first_not_of(" ", Space);
|
||||
|
||||
if(ChannelStart == string::npos) {
|
||||
if(ChannelStart == std::string::npos) {
|
||||
GeneralChannelMessage("Incorrect syntax: /chat voice <player> <channel>");
|
||||
return;
|
||||
}
|
||||
|
||||
string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
||||
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
||||
|
||||
if((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||
ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
|
||||
@@ -2063,34 +2061,34 @@ void Client::ChannelGrantVoice(string CommandString) {
|
||||
|
||||
}
|
||||
|
||||
void Client::ChannelKick(string CommandString) {
|
||||
void Client::ChannelKick(std::string CommandString) {
|
||||
|
||||
string::size_type PlayerStart = CommandString.find_first_not_of(" ");
|
||||
std::string::size_type PlayerStart = CommandString.find_first_not_of(" ");
|
||||
|
||||
if(PlayerStart == string::npos) {
|
||||
if(PlayerStart == std::string::npos) {
|
||||
|
||||
GeneralChannelMessage("Incorrect syntax: /chat kick <player> <channel>");
|
||||
return;
|
||||
}
|
||||
|
||||
string::size_type Space = CommandString.find_first_of(" ", PlayerStart);
|
||||
std::string::size_type Space = CommandString.find_first_of(" ", PlayerStart);
|
||||
|
||||
if(Space == string::npos) {
|
||||
if(Space == std::string::npos) {
|
||||
|
||||
GeneralChannelMessage("Incorrect syntax: /chat kick <player> <channel>");
|
||||
return;
|
||||
}
|
||||
|
||||
string Kickee = CapitaliseName(CommandString.substr(PlayerStart, Space - PlayerStart));
|
||||
std::string Kickee = CapitaliseName(CommandString.substr(PlayerStart, Space - PlayerStart));
|
||||
|
||||
string::size_type ChannelStart = CommandString.find_first_not_of(" ", Space);
|
||||
std::string::size_type ChannelStart = CommandString.find_first_not_of(" ", Space);
|
||||
|
||||
if(ChannelStart == string::npos) {
|
||||
if(ChannelStart == std::string::npos) {
|
||||
|
||||
GeneralChannelMessage("Incorrect syntax: /chat kick <player> <channel>");
|
||||
return;
|
||||
}
|
||||
string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
||||
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
||||
|
||||
if((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||
ChannelName = ChannelSlotName(atoi(ChannelName.c_str()));
|
||||
@@ -2164,7 +2162,7 @@ void Client::ToggleInvites() {
|
||||
|
||||
}
|
||||
|
||||
string Client::ChannelSlotName(int SlotNumber) {
|
||||
std::string Client::ChannelSlotName(int SlotNumber) {
|
||||
|
||||
if((SlotNumber < 1 ) || (SlotNumber > MAX_JOINED_CHANNELS))
|
||||
return "";
|
||||
@@ -2234,7 +2232,7 @@ void Client::SetConnectionType(char c) {
|
||||
}
|
||||
}
|
||||
|
||||
Client *Clientlist::IsCharacterOnline(string CharacterName) {
|
||||
Client *Clientlist::IsCharacterOnline(std::string CharacterName) {
|
||||
|
||||
// This method is used to determine if the character we are a sending an email to is connected to the mailserver,
|
||||
// so we can send them a new email notification.
|
||||
@@ -2243,7 +2241,7 @@ Client *Clientlist::IsCharacterOnline(string CharacterName) {
|
||||
// i.e. for the character they are logged in as, or for the character whose mailbox they have selected in the
|
||||
// mail window.
|
||||
//
|
||||
list<Client*>::iterator Iterator;
|
||||
std::list<Client*>::iterator Iterator;
|
||||
|
||||
for(Iterator = ClientChatConnections.begin(); Iterator != ClientChatConnections.end(); Iterator++) {
|
||||
|
||||
@@ -2262,7 +2260,7 @@ Client *Clientlist::IsCharacterOnline(string CharacterName) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int Client::GetMailBoxNumber(string CharacterName) {
|
||||
int Client::GetMailBoxNumber(std::string CharacterName) {
|
||||
|
||||
for(unsigned int i = 0; i < Characters.size(); i++)
|
||||
if(Characters[i].Name == CharacterName)
|
||||
@@ -2271,7 +2269,7 @@ int Client::GetMailBoxNumber(string CharacterName) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
void Client::SendNotification(int MailBoxNumber, string Subject, string From, int MessageID) {
|
||||
void Client::SendNotification(int MailBoxNumber, std::string Subject, std::string From, int MessageID) {
|
||||
|
||||
char TimeStamp[100];
|
||||
|
||||
@@ -2328,13 +2326,13 @@ void Client::ChangeMailBox(int NewMailBox) {
|
||||
|
||||
void Client::SendFriends() {
|
||||
|
||||
vector<string> Friends, Ignorees;
|
||||
std::vector<std::string> Friends, Ignorees;
|
||||
|
||||
database.GetFriendsAndIgnore(GetCharID(), Friends, Ignorees);
|
||||
|
||||
EQApplicationPacket *outapp;
|
||||
|
||||
vector<string>::iterator Iterator;
|
||||
std::vector<std::string>::iterator Iterator;
|
||||
|
||||
Iterator = Friends.begin();
|
||||
|
||||
@@ -2361,7 +2359,7 @@ void Client::SendFriends() {
|
||||
|
||||
while(Iterator != Ignorees.end()) {
|
||||
|
||||
string Ignoree = "SOE.EQ." + WorldShortName + "." + (*Iterator);
|
||||
std::string Ignoree = "SOE.EQ." + WorldShortName + "." + (*Iterator);
|
||||
|
||||
outapp = new EQApplicationPacket(OP_Ignore, Ignoree.length() + 2);
|
||||
|
||||
@@ -2381,7 +2379,7 @@ void Client::SendFriends() {
|
||||
}
|
||||
}
|
||||
|
||||
string Client::MailBoxName() {
|
||||
std::string Client::MailBoxName() {
|
||||
|
||||
if((Characters.size() == 0) || (CurrentMailBox > (Characters.size() - 1)))
|
||||
{
|
||||
|
||||
+27
-27
@@ -78,7 +78,7 @@ static const CommandEntry Commands[] = {
|
||||
struct CharacterEntry {
|
||||
int CharID;
|
||||
int Level;
|
||||
string Name;
|
||||
std::string Name;
|
||||
};
|
||||
|
||||
class Client {
|
||||
@@ -92,25 +92,25 @@ public:
|
||||
void ClearCharacters() { Characters.clear(); }
|
||||
void SendMailBoxes();
|
||||
inline void QueuePacket(const EQApplicationPacket *p, bool ack_req=true) { ClientStream->QueuePacket(p, ack_req); }
|
||||
string GetName() { if(Characters.size()) return Characters[0].Name; else return ""; }
|
||||
void JoinChannels(string ChannelList);
|
||||
void LeaveChannels(string ChannelList);
|
||||
std::string GetName() { if(Characters.size()) return Characters[0].Name; else return ""; }
|
||||
void JoinChannels(std::string ChannelList);
|
||||
void LeaveChannels(std::string ChannelList);
|
||||
void LeaveAllChannels(bool SendUpdatedChannelList = true);
|
||||
void AddToChannelList(ChatChannel *JoinedChannel);
|
||||
void RemoveFromChannelList(ChatChannel *JoinedChannel);
|
||||
void SendChannelMessage(string Message);
|
||||
void SendChannelMessage(string ChannelName, string Message, Client *Sender);
|
||||
void SendChannelMessageByNumber(string Message);
|
||||
void SendChannelMessage(std::string Message);
|
||||
void SendChannelMessage(std::string ChannelName, std::string Message, Client *Sender);
|
||||
void SendChannelMessageByNumber(std::string Message);
|
||||
void SendChannelList();
|
||||
void CloseConnection();
|
||||
void ToggleAnnounce(string State);
|
||||
void ToggleAnnounce(std::string State);
|
||||
bool IsAnnounceOn() { return (Announce == true); }
|
||||
void AnnounceJoin(ChatChannel *Channel, Client *c);
|
||||
void AnnounceLeave(ChatChannel *Channel, Client *c);
|
||||
void GeneralChannelMessage(string Message);
|
||||
void GeneralChannelMessage(std::string Message);
|
||||
void GeneralChannelMessage(const char *Characters);
|
||||
void SetChannelPassword(string ChannelPassword);
|
||||
void ProcessChannelList(string CommandString);
|
||||
void SetChannelPassword(std::string ChannelPassword);
|
||||
void ProcessChannelList(std::string CommandString);
|
||||
void AccountUpdate();
|
||||
int ChannelCount();
|
||||
inline void SetAccountID(int inAccountID) { AccountID = inAccountID; }
|
||||
@@ -121,14 +121,14 @@ public:
|
||||
inline int GetAccountStatus() { return Status; }
|
||||
inline bool GetHideMe() { return HideMe; }
|
||||
inline uint32 GetKarma() { return TotalKarma; }
|
||||
void SetChannelOwner(string CommandString);
|
||||
void OPList(string CommandString);
|
||||
void ChannelInvite(string CommandString);
|
||||
void ChannelGrantModerator(string CommandString);
|
||||
void ChannelGrantVoice(string CommandString);
|
||||
void ChannelKick(string CommandString);
|
||||
void ChannelModerate(string CommandString);
|
||||
string ChannelSlotName(int ChannelNumber);
|
||||
void SetChannelOwner(std::string CommandString);
|
||||
void OPList(std::string CommandString);
|
||||
void ChannelInvite(std::string CommandString);
|
||||
void ChannelGrantModerator(std::string CommandString);
|
||||
void ChannelGrantVoice(std::string CommandString);
|
||||
void ChannelKick(std::string CommandString);
|
||||
void ChannelModerate(std::string CommandString);
|
||||
std::string ChannelSlotName(int ChannelNumber);
|
||||
void ToggleInvites();
|
||||
bool InvitesAllowed() { return AllowInvites; }
|
||||
bool IsRevoked() { return Revoked; }
|
||||
@@ -137,13 +137,13 @@ public:
|
||||
inline bool CanListAllChannels() { return (Status >= RuleI(Channels, RequiredStatusListAll)); }
|
||||
void SendHelp();
|
||||
inline bool GetForceDisconnect() { return ForceDisconnect; }
|
||||
string MailBoxName();
|
||||
std::string MailBoxName();
|
||||
int GetMailBoxNumber() { return CurrentMailBox; }
|
||||
int GetMailBoxNumber(string CharacterName);
|
||||
int GetMailBoxNumber(std::string CharacterName);
|
||||
void SetConnectionType(char c);
|
||||
ConnectionType GetConnectionType() { return TypeOfConnection; }
|
||||
inline bool IsMailConnection() { return (TypeOfConnection == ConnectionTypeMail) || (TypeOfConnection == ConnectionTypeCombined); }
|
||||
void SendNotification(int MailBoxNumber, string From, string Subject, int MessageID);
|
||||
void SendNotification(int MailBoxNumber, std::string From, std::string Subject, int MessageID);
|
||||
void ChangeMailBox(int NewMailBox);
|
||||
inline void SetMailBox(int NewMailBox) { CurrentMailBox = NewMailBox; }
|
||||
void SendFriends();
|
||||
@@ -152,7 +152,7 @@ public:
|
||||
|
||||
private:
|
||||
unsigned int CurrentMailBox;
|
||||
vector<CharacterEntry> Characters;
|
||||
std::vector<CharacterEntry> Characters;
|
||||
ChatChannel *JoinedChannels[MAX_JOINED_CHANNELS];
|
||||
bool Announce;
|
||||
int AccountID;
|
||||
@@ -178,16 +178,16 @@ public:
|
||||
Clientlist(int MailPort);
|
||||
void Process();
|
||||
void CloseAllConnections();
|
||||
Client *FindCharacter(string CharacterName);
|
||||
Client *FindCharacter(std::string CharacterName);
|
||||
void CheckForStaleConnections(Client *c);
|
||||
Client *IsCharacterOnline(string CharacterName);
|
||||
void ProcessOPMailCommand(Client *c, string CommandString);
|
||||
Client *IsCharacterOnline(std::string CharacterName);
|
||||
void ProcessOPMailCommand(Client *c, std::string CommandString);
|
||||
|
||||
private:
|
||||
|
||||
EQStreamFactory *chatsf;
|
||||
|
||||
list<Client*> ClientChatConnections;
|
||||
std::list<Client*> ClientChatConnections;
|
||||
|
||||
OpcodeManager *ChatOpMgr;
|
||||
};
|
||||
|
||||
+16
-17
@@ -20,7 +20,6 @@
|
||||
|
||||
#include "../common/debug.h"
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -49,7 +48,7 @@ using namespace std;
|
||||
#include "chatchannel.h"
|
||||
|
||||
extern Clientlist *CL;
|
||||
extern string GetMailPrefix();
|
||||
extern std::string GetMailPrefix();
|
||||
extern ChatChannelList *ChannelList;
|
||||
extern uint32 MailMessagesSent;
|
||||
|
||||
@@ -191,7 +190,7 @@ int Database::FindAccount(const char *CharacterName, Client *c) {
|
||||
return AccountID;
|
||||
}
|
||||
|
||||
bool Database::VerifyMailKey(string CharacterName, int IPAddress, string MailKey) {
|
||||
bool Database::VerifyMailKey(std::string CharacterName, int IPAddress, std::string MailKey) {
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char* query = 0;
|
||||
@@ -329,9 +328,9 @@ bool Database::LoadChatChannels() {
|
||||
|
||||
while((row = mysql_fetch_row(result))) {
|
||||
|
||||
string ChannelName = row[0];
|
||||
string ChannelOwner = row[1];
|
||||
string ChannelPassword = row[2];
|
||||
std::string ChannelName = row[0];
|
||||
std::string ChannelOwner = row[1];
|
||||
std::string ChannelPassword = row[2];
|
||||
|
||||
ChannelList->CreateChannel(ChannelName, ChannelOwner, ChannelPassword, true, atoi(row[3]));
|
||||
}
|
||||
@@ -341,7 +340,7 @@ bool Database::LoadChatChannels() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void Database::SetChannelPassword(string ChannelName, string Password) {
|
||||
void Database::SetChannelPassword(std::string ChannelName, std::string Password) {
|
||||
|
||||
_log(UCS__TRACE, "Database::SetChannelPassword(%s, %s)", ChannelName.c_str(), Password.c_str());
|
||||
|
||||
@@ -358,7 +357,7 @@ void Database::SetChannelPassword(string ChannelName, string Password) {
|
||||
safe_delete_array(query);
|
||||
}
|
||||
|
||||
void Database::SetChannelOwner(string ChannelName, string Owner) {
|
||||
void Database::SetChannelOwner(std::string ChannelName, std::string Owner) {
|
||||
|
||||
_log(UCS__TRACE, "Database::SetChannelOwner(%s, %s)", ChannelName.c_str(), Owner.c_str());
|
||||
|
||||
@@ -542,17 +541,17 @@ void Database::SendBody(Client *c, int MessageNumber) {
|
||||
|
||||
}
|
||||
|
||||
bool Database::SendMail(string Recipient, string From, string Subject, string Body, string RecipientsString) {
|
||||
bool Database::SendMail(std::string Recipient, std::string From, std::string Subject, std::string Body, std::string RecipientsString) {
|
||||
|
||||
int CharacterID;
|
||||
|
||||
string CharacterName;
|
||||
std::string CharacterName;
|
||||
|
||||
//printf("Database::SendMail(%s, %s, %s)\n", Recipient.c_str(), From.c_str(), Subject.c_str());
|
||||
|
||||
string::size_type LastPeriod = Recipient.find_last_of(".");
|
||||
std::string::size_type LastPeriod = Recipient.find_last_of(".");
|
||||
|
||||
if(LastPeriod == string::npos)
|
||||
if(LastPeriod == std::string::npos)
|
||||
CharacterName = Recipient;
|
||||
else
|
||||
CharacterName = Recipient.substr(LastPeriod+1);
|
||||
@@ -605,7 +604,7 @@ bool Database::SendMail(string Recipient, string From, string Subject, string Bo
|
||||
Client *c = CL->IsCharacterOnline(CharacterName);
|
||||
|
||||
if(c) {
|
||||
string FQN = GetMailPrefix() + From;
|
||||
std::string FQN = GetMailPrefix() + From;
|
||||
|
||||
c->SendNotification(c->GetMailBoxNumber(CharacterName), Subject, FQN, LastMsgID);
|
||||
}
|
||||
@@ -692,7 +691,7 @@ void Database::ExpireMail() {
|
||||
}
|
||||
}
|
||||
|
||||
void Database::AddFriendOrIgnore(int CharID, int Type, string Name) {
|
||||
void Database::AddFriendOrIgnore(int CharID, int Type, std::string Name) {
|
||||
|
||||
const char *FriendsQuery="INSERT INTO `friends` (`charid`, `type`, `name`) VALUES ('%i', %i, '%s')";
|
||||
|
||||
@@ -710,7 +709,7 @@ void Database::AddFriendOrIgnore(int CharID, int Type, string Name) {
|
||||
safe_delete_array(query);
|
||||
}
|
||||
|
||||
void Database::RemoveFriendOrIgnore(int CharID, int Type, string Name) {
|
||||
void Database::RemoveFriendOrIgnore(int CharID, int Type, std::string Name) {
|
||||
|
||||
const char *FriendsQuery="DELETE FROM `friends` WHERE `charid`=%i AND `type`=%i and `name`='%s'";
|
||||
|
||||
@@ -727,7 +726,7 @@ void Database::RemoveFriendOrIgnore(int CharID, int Type, string Name) {
|
||||
safe_delete_array(query);
|
||||
}
|
||||
|
||||
void Database::GetFriendsAndIgnore(int CharID, vector<string> &Friends, vector<string> &Ignorees) {
|
||||
void Database::GetFriendsAndIgnore(int CharID, std::vector<std::string> &Friends, std::vector<std::string> &Ignorees) {
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char* query = 0;
|
||||
@@ -749,7 +748,7 @@ void Database::GetFriendsAndIgnore(int CharID, vector<string> &Friends, vector<s
|
||||
|
||||
while((row = mysql_fetch_row(result))) {
|
||||
|
||||
string Name = row[1];
|
||||
std::string Name = row[1];
|
||||
|
||||
if(atoi(row[0]) == 0)
|
||||
{
|
||||
|
||||
+7
-8
@@ -31,7 +31,6 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
using namespace std;
|
||||
|
||||
//atoi is not uint32 or uint32 safe!!!!
|
||||
#define atoul(str) strtoul(str, nullptr, 10)
|
||||
@@ -45,20 +44,20 @@ public:
|
||||
|
||||
int FindAccount(const char *CharacterName, Client *c);
|
||||
int FindCharacter(const char *CharacterName);
|
||||
bool VerifyMailKey(string CharacterName, int IPAddress, string MailKey);
|
||||
bool VerifyMailKey(std::string CharacterName, int IPAddress, std::string MailKey);
|
||||
bool GetVariable(const char* varname, char* varvalue, uint16 varvalue_len);
|
||||
bool LoadChatChannels();
|
||||
void GetAccountStatus(Client *c);
|
||||
void SetChannelPassword(string ChannelName, string Password);
|
||||
void SetChannelOwner(string ChannelName, string Owner);
|
||||
void SetChannelPassword(std::string ChannelName, std::string Password);
|
||||
void SetChannelOwner(std::string ChannelName, std::string Owner);
|
||||
void SendHeaders(Client *c);
|
||||
void SendBody(Client *c, int MessageNumber);
|
||||
bool SendMail(string Recipient, string From, string Subject, string Body, string RecipientsString);
|
||||
bool SendMail(std::string Recipient, std::string From, std::string Subject, std::string Body, std::string RecipientsString);
|
||||
void SetMessageStatus(int MessageNumber, int Status);
|
||||
void ExpireMail();
|
||||
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);
|
||||
void AddFriendOrIgnore(int CharID, int Type, std::string Name);
|
||||
void RemoveFriendOrIgnore(int CharID, int Type, std::string Name);
|
||||
void GetFriendsAndIgnore(int CharID, std::vector<std::string> &Friends, std::vector<std::string> &Ignorees);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
+2
-2
@@ -45,7 +45,7 @@ ChatChannelList *ChannelList;
|
||||
|
||||
Database database;
|
||||
|
||||
string WorldShortName;
|
||||
std::string WorldShortName;
|
||||
|
||||
const ucsconfig *Config;
|
||||
|
||||
@@ -60,7 +60,7 @@ void CatchSignal(int sig_num) {
|
||||
worldserver->Disconnect();
|
||||
}
|
||||
|
||||
string GetMailPrefix() {
|
||||
std::string GetMailPrefix() {
|
||||
|
||||
return "SOE.EQ." + WorldShortName + ".";
|
||||
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@
|
||||
|
||||
ucsconfig *ucsconfig::_chat_config = nullptr;
|
||||
|
||||
string ucsconfig::GetByName(const string &var_name) const {
|
||||
std::string ucsconfig::GetByName(const std::string &var_name) const {
|
||||
return(EQEmuConfig::GetByName(var_name));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
|
||||
class ucsconfig : public EQEmuConfig {
|
||||
public:
|
||||
virtual string GetByName(const string &var_name) const;
|
||||
virtual std::string GetByName(const std::string &var_name) const;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
+7
-8
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
#include "../common/debug.h"
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <iomanip>
|
||||
@@ -38,7 +37,7 @@ extern Clientlist *CL;
|
||||
extern const ucsconfig *Config;
|
||||
extern Database database;
|
||||
|
||||
void ProcessMailTo(Client *c, string from, string subject, string message);
|
||||
void ProcessMailTo(Client *c, std::string from, std::string subject, std::string message);
|
||||
|
||||
WorldServer::WorldServer()
|
||||
: WorldConnection(EmuTCPConnection::packetModeUCS, Config->SharedKey.c_str())
|
||||
@@ -86,7 +85,7 @@ void WorldServer::Process()
|
||||
|
||||
VARSTRUCT_DECODE_STRING(From, Buffer);
|
||||
|
||||
string Message = Buffer;
|
||||
std::string Message = Buffer;
|
||||
|
||||
_log(UCS__TRACE, "Player: %s, Sent Message: %s", From, Message.c_str());
|
||||
|
||||
@@ -105,11 +104,11 @@ void WorldServer::Process()
|
||||
|
||||
if(Message[0] == ';')
|
||||
{
|
||||
c->SendChannelMessageByNumber(Message.substr(1, string::npos));
|
||||
c->SendChannelMessageByNumber(Message.substr(1, std::string::npos));
|
||||
}
|
||||
else if(Message[0] == '[')
|
||||
{
|
||||
CL->ProcessOPMailCommand(c, Message.substr(1, string::npos));
|
||||
CL->ProcessOPMailCommand(c, Message.substr(1, std::string::npos));
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -118,11 +117,11 @@ 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),
|
||||
database.SendMail(std::string("SOE.EQ.") + Config->ShortName + std::string(".") + std::string(mail->to),
|
||||
std::string(mail->from),
|
||||
mail->subject,
|
||||
mail->message,
|
||||
string());
|
||||
std::string());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user