mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2025-01-22 08:30:06 +00:00
Name request monitor events
This commit is contained in:
parent
b483bf7190
commit
e84f6505b8
@ -1,4 +1,5 @@
|
|||||||
#include "servers/CNLoginServer.hpp"
|
#include "servers/CNLoginServer.hpp"
|
||||||
|
#include "servers/Monitor.hpp"
|
||||||
|
|
||||||
#include "core/CNShared.hpp"
|
#include "core/CNShared.hpp"
|
||||||
#include "db/Database.hpp"
|
#include "db/Database.hpp"
|
||||||
@ -312,6 +313,16 @@ void CNLoginServer::nameSave(CNSocket* sock, CNPacketData* data) {
|
|||||||
std::cout << "[WARN] Login Server: Database failed to create new character!" << std::endl;
|
std::cout << "[WARN] Login Server: Database failed to create new character!" << std::endl;
|
||||||
return invalidCharacter(sock);
|
return invalidCharacter(sock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Player plr;
|
||||||
|
Database::getPlayer(&plr, (int)resp.iPC_UID);
|
||||||
|
|
||||||
|
// fire name check event if needed
|
||||||
|
if (plr.PCStyle.iNameCheck == 0) {
|
||||||
|
std::string namereq = std::to_string(resp.iPC_UID) + " " + AUTOU16TOU8(save->szFirstName) + " " + AUTOU16TOU8(save->szLastName);
|
||||||
|
Monitor::namereqs.push_back(namereq);
|
||||||
|
}
|
||||||
|
|
||||||
resp.iSlotNum = save->iSlotNum;
|
resp.iSlotNum = save->iSlotNum;
|
||||||
resp.iGender = save->iGender;
|
resp.iGender = save->iGender;
|
||||||
|
|
||||||
@ -327,7 +338,9 @@ void CNLoginServer::nameSave(CNSocket* sock, CNPacketData* data) {
|
|||||||
DEBUGLOG(
|
DEBUGLOG(
|
||||||
std::cout << "Login Server: new character created" << std::endl;
|
std::cout << "Login Server: new character created" << std::endl;
|
||||||
std::cout << "\tSlot: " << (int)save->iSlotNum << std::endl;
|
std::cout << "\tSlot: " << (int)save->iSlotNum << std::endl;
|
||||||
std::cout << "\tName: " << AUTOU16TOU8(save->szFirstName) << " " << AUTOU16TOU8(save->szLastName) << std::endl;
|
std::cout << "\tName: " << AUTOU16TOU8(save->szFirstName) << " " << AUTOU16TOU8(save->szLastName);
|
||||||
|
if (plr.PCStyle.iNameCheck == 0) std::cout << " (pending approval)";
|
||||||
|
std::cout << std::endl;
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ static sockaddr_in address;
|
|||||||
std::vector<std::string> Monitor::chats;
|
std::vector<std::string> Monitor::chats;
|
||||||
std::vector<std::string> Monitor::bcasts;
|
std::vector<std::string> Monitor::bcasts;
|
||||||
std::vector<std::string> Monitor::emails;
|
std::vector<std::string> Monitor::emails;
|
||||||
|
std::vector<std::string> Monitor::namereqs;
|
||||||
|
|
||||||
using namespace Monitor;
|
using namespace Monitor;
|
||||||
|
|
||||||
@ -131,6 +132,14 @@ outer:
|
|||||||
goto outer;
|
goto outer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// name requests
|
||||||
|
for (auto& str : namereqs) {
|
||||||
|
n = std::snprintf(buff, sizeof(buff), "namereq %s\n", str.c_str());
|
||||||
|
|
||||||
|
if (!transmit(it, buff, n))
|
||||||
|
goto outer;
|
||||||
|
}
|
||||||
|
|
||||||
if (!transmit(it, (char*)"end\n", 4))
|
if (!transmit(it, (char*)"end\n", 4))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -140,6 +149,7 @@ outer:
|
|||||||
chats.clear();
|
chats.clear();
|
||||||
bcasts.clear();
|
bcasts.clear();
|
||||||
emails.clear();
|
emails.clear();
|
||||||
|
namereqs.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Monitor::acceptConnection(SOCKET fd, uint16_t revents) {
|
bool Monitor::acceptConnection(SOCKET fd, uint16_t revents) {
|
||||||
|
@ -6,6 +6,7 @@ namespace Monitor {
|
|||||||
extern std::vector<std::string> chats;
|
extern std::vector<std::string> chats;
|
||||||
extern std::vector<std::string> bcasts;
|
extern std::vector<std::string> bcasts;
|
||||||
extern std::vector<std::string> emails;
|
extern std::vector<std::string> emails;
|
||||||
|
extern std::vector<std::string> namereqs;
|
||||||
|
|
||||||
SOCKET init();
|
SOCKET init();
|
||||||
bool acceptConnection(SOCKET, uint16_t);
|
bool acceptConnection(SOCKET, uint16_t);
|
||||||
|
Loading…
Reference in New Issue
Block a user