summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Common/ModuleManager.cpp2
-rw-r--r--src/Net/Packets/UserListPacket.cpp34
-rw-r--r--src/Net/Packets/UserListPacket.h2
-rw-r--r--src/modules/UserBackendMysql.cpp1
4 files changed, 20 insertions, 19 deletions
diff --git a/src/Common/ModuleManager.cpp b/src/Common/ModuleManager.cpp
index 0e892c5..03ed880 100644
--- a/src/Common/ModuleManager.cpp
+++ b/src/Common/ModuleManager.cpp
@@ -34,6 +34,8 @@ ModuleManager ModuleManager::moduleManager;
int ModuleManager::preopenCallback(lt_dlhandle handle) {
moduleManager.modules.insert(std::make_pair(lt_dlgetinfo(handle)->name, std::make_pair(handle, false)));
+
+ return 0;
}
void ModuleManager::doInit() {
diff --git a/src/Net/Packets/UserListPacket.cpp b/src/Net/Packets/UserListPacket.cpp
index d364522..d7415c3 100644
--- a/src/Net/Packets/UserListPacket.cpp
+++ b/src/Net/Packets/UserListPacket.cpp
@@ -31,19 +31,19 @@ void UserListPacket::assemblePacket() {
for(std::vector<Common::UserInfo>::iterator user = userList.begin(); user != userList.end(); ++user)
str += user->getUsername() + "\n" + user->getFullName() + "\n";
- setLength(sizeof(uint16_t) + sizeof(UserData)*userList.size() + str.length());
+ setLength(sizeof(uint32_t) + sizeof(UserData)*userList.size() + str.length());
- nUsers = (uint16_t*)rawData->data;
- userData = (UserData*)(rawData->data + sizeof(uint16_t));
- charData = (char*)(rawData->data + sizeof(uint16_t) + sizeof(UserData)*userList.size());
+ nUsers = (uint32_t*)rawData->data;
+ userData = (UserData*)(rawData->data + sizeof(uint32_t));
+ charData = (char*)(rawData->data + sizeof(uint32_t) + sizeof(UserData)*userList.size());
std::memcpy(charData, str.c_str(), str.length());
- *nUsers = htons(userList.size());
+ *nUsers = htonl(userList.size());
for(size_t i = 0; i < userList.size(); ++i) {
- userData[i].uid = htons((uint32_t)userList[i].getUid());
- userData[i].gid = htons((uint32_t)userList[i].getGid());
+ userData[i].uid = htonl((uint32_t)userList[i].getUid());
+ userData[i].gid = htonl((uint32_t)userList[i].getGid());
}
}
@@ -53,21 +53,21 @@ void UserListPacket::parsePacket() {
if(getLength() < sizeof(uint16_t))
return;
- nUsers = (uint16_t*)rawData->data;
- userList.resize(ntohs(*nUsers));
+ nUsers = (uint32_t*)rawData->data;
+ userList.resize(ntohl(*nUsers));
- if(getLength() < sizeof(uint16_t) + sizeof(UserData)*userList.size())
- setLength(sizeof(uint16_t) + sizeof(UserData)*userList.size());
+ if(getLength() < sizeof(uint32_t) + sizeof(UserData)*userList.size())
+ setLength(sizeof(uint32_t) + sizeof(UserData)*userList.size());
- nUsers = (uint16_t*)rawData->data;
- userData = (UserData*)(rawData->data + sizeof(uint16_t));
- charData = (char*)(rawData->data + sizeof(uint16_t) + sizeof(UserData)*userList.size());
+ nUsers = (uint32_t*)rawData->data;
+ userData = (UserData*)(rawData->data + sizeof(uint32_t));
+ charData = (char*)(rawData->data + sizeof(uint32_t) + sizeof(UserData)*userList.size());
- std::istringstream stream(std::string(charData, getLength() - (sizeof(uint16_t)+sizeof(UserData)*userList.size())));
+ std::istringstream stream(std::string(charData, getLength() - (sizeof(uint32_t)+sizeof(UserData)*userList.size())));
for(size_t i = 0; i < userList.size(); ++i) {
- userList[i].setUid(ntohs(userData[i].uid));
- userList[i].setGid(ntohs(userData[i].gid));
+ userList[i].setUid(ntohl(userData[i].uid));
+ userList[i].setGid(ntohl(userData[i].gid));
if(!stream.eof()) {
std::string str;
diff --git a/src/Net/Packets/UserListPacket.h b/src/Net/Packets/UserListPacket.h
index d099fab..364a36d 100644
--- a/src/Net/Packets/UserListPacket.h
+++ b/src/Net/Packets/UserListPacket.h
@@ -35,7 +35,7 @@ class UserListPacket : public Packet {
uint32_t gid;
};
- uint16_t *nUsers;
+ uint32_t *nUsers;
UserData *userData;
char *charData;
diff --git a/src/modules/UserBackendMysql.cpp b/src/modules/UserBackendMysql.cpp
index 886f345..0b028fb 100644
--- a/src/modules/UserBackendMysql.cpp
+++ b/src/modules/UserBackendMysql.cpp
@@ -142,7 +142,6 @@ bool UserBackendMysql::userList(const sigc::slot<void, const std::map<unsigned l
std::map<unsigned long, Common::UserInfo> users;
- MYSQL_ROW row;
while(MYSQL_ROW row = mysql_fetch_row(result)) {
Common::UserInfo user(std::strtoul(row[0], 0, 10), row[2]);