diff options
author | George Hazan <george.hazan@gmail.com> | 2024-06-10 13:43:58 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-06-10 13:43:58 +0300 |
commit | 4f795835fc380a439649751a6c6710841df135c9 (patch) | |
tree | ed7da65a3cfd18bd072d10d7980469af9ee75dd4 /protocols | |
parent | a7d5e440c2116f84d9f189a82a5d989ab4b7a5b7 (diff) |
Utils_GenerateUUID - a helper for UUID generation
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/Facebook/src/main.cpp | 2 | ||||
-rw-r--r-- | protocols/Facebook/src/proto.cpp | 7 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/http.cpp | 10 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/server.cpp | 11 |
4 files changed, 5 insertions, 25 deletions
diff --git a/protocols/Facebook/src/main.cpp b/protocols/Facebook/src/main.cpp index 9692c7b828..7d87990901 100644 --- a/protocols/Facebook/src/main.cpp +++ b/protocols/Facebook/src/main.cpp @@ -20,8 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-#pragma comment(lib, "Rpcrt4.lib")
-
CMPlugin g_plugin;
bool g_bMessageState;
diff --git a/protocols/Facebook/src/proto.cpp b/protocols/Facebook/src/proto.cpp index 19c2f03a30..ef8fdbbaa3 100644 --- a/protocols/Facebook/src/proto.cpp +++ b/protocols/Facebook/src/proto.cpp @@ -57,13 +57,8 @@ FacebookProto::FacebookProto(const char *proto_name, const wchar_t *username) : m_szDeviceID = getMStringA(DBKEY_DEVICE_ID);
if (m_szDeviceID.IsEmpty()) {
- UUID deviceId;
- UuidCreate(&deviceId);
- RPC_CSTR szId;
- UuidToStringA(&deviceId, &szId);
- m_szDeviceID = szId;
+ m_szDeviceID = Utils_GenerateUUID();
setString(DBKEY_DEVICE_ID, m_szDeviceID);
- RpcStringFreeA(&szId);
}
m_szClientID = getMStringA(DBKEY_CLIENT_ID);
diff --git a/protocols/ICQ-WIM/src/http.cpp b/protocols/ICQ-WIM/src/http.cpp index c5fbdbc836..1bb6c21ffc 100644 --- a/protocols/ICQ-WIM/src/http.cpp +++ b/protocols/ICQ-WIM/src/http.cpp @@ -20,8 +20,6 @@ #include "stdafx.h"
-#pragma comment(lib, "Rpcrt4.lib")
-
void CIcqProto::DropQueue()
{
mir_cslock lck(m_csHttpQueue);
@@ -142,13 +140,7 @@ AsyncHttpRequest::AsyncHttpRequest(IcqConnection conn, int iType, const char *sz else if (*szUrl == '/')
m_szUrl.Insert(0, "https://u.icq.net/wim");
- GUID packetId;
- UuidCreate(&packetId);
-
- RPC_CSTR szId;
- UuidToStringA(&packetId, &szId);
- strncpy_s(m_reqId, (char*)szId, _TRUNCATE);
- RpcStringFreeA(&szId);
+ strncpy_s(m_reqId, Utils_GenerateUUID(), _TRUNCATE);
if (iType == REQUEST_POST)
AddHeader("Content-Type", "application/x-www-form-urlencoded");
diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp index 1135542926..2e31427eab 100644 --- a/protocols/ICQ-WIM/src/server.cpp +++ b/protocols/ICQ-WIM/src/server.cpp @@ -1062,15 +1062,10 @@ void CIcqProto::ShutdownSession() void CIcqProto::StartSession()
{
- ptrA szDeviceId(getStringA("DeviceId"));
- if (szDeviceId == nullptr) {
- UUID deviceId;
- UuidCreate(&deviceId);
- RPC_CSTR szId;
- UuidToStringA(&deviceId, &szId);
- szDeviceId = mir_strdup((char*)szId);
+ CMStringA szDeviceId(getMStringA("DeviceId"));
+ if (szDeviceId.IsEmpty()) {
+ szDeviceId = Utils_GenerateUUID();
setString("DeviceId", szDeviceId);
- RpcStringFreeA(&szId);
}
int ts = TS();
|