diff options
author | George Hazan <ghazan@miranda.im> | 2017-01-16 18:20:37 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-01-16 18:20:37 +0300 |
commit | 6163df27ad6fd2a5da5d9bbb48bb457d8a07a2b6 (patch) | |
tree | d0523b56e1b987789c6622916a31e8f356076d23 | |
parent | e021b02022a37bd23b599801026d631f5fd9f48c (diff) |
DB_AUTH_BLOB: handy piece of code moved into the core
30 files changed, 340 insertions, 441 deletions
diff --git a/bin10/lib/mir_app.lib b/bin10/lib/mir_app.lib Binary files differindex 96e2c0ec66..bc514b0f6a 100644 --- a/bin10/lib/mir_app.lib +++ b/bin10/lib/mir_app.lib diff --git a/bin10/lib/mir_app64.lib b/bin10/lib/mir_app64.lib Binary files differindex 154026dc47..99ab49648b 100644 --- a/bin10/lib/mir_app64.lib +++ b/bin10/lib/mir_app64.lib diff --git a/bin12/lib/mir_app.lib b/bin12/lib/mir_app.lib Binary files differindex 96e2c0ec66..bc514b0f6a 100644 --- a/bin12/lib/mir_app.lib +++ b/bin12/lib/mir_app.lib diff --git a/bin12/lib/mir_app64.lib b/bin12/lib/mir_app64.lib Binary files differindex 154026dc47..99ab49648b 100644 --- a/bin12/lib/mir_app64.lib +++ b/bin12/lib/mir_app64.lib diff --git a/bin14/lib/mir_app.lib b/bin14/lib/mir_app.lib Binary files differindex 96e2c0ec66..bc514b0f6a 100644 --- a/bin14/lib/mir_app.lib +++ b/bin14/lib/mir_app.lib diff --git a/bin14/lib/mir_app64.lib b/bin14/lib/mir_app64.lib Binary files differindex 154026dc47..99ab49648b 100644 --- a/bin14/lib/mir_app64.lib +++ b/bin14/lib/mir_app64.lib diff --git a/include/m_database.h b/include/m_database.h index 0c07c7417f..8dcf896036 100644 --- a/include/m_database.h +++ b/include/m_database.h @@ -188,6 +188,12 @@ typedef struct {
return (flags & (DBEF_SENT | DBEF_READ)) != 0;
}
+
+ wchar_t* getString(const char *str) const
+ {
+ return (flags & DBEF_UTF) ? Utf8DecodeW(str) : mir_a2u(str);
+ }
+
#endif
} DBEVENTINFO;
@@ -644,4 +650,39 @@ __inline DWORD DBGetContactSettingRangedDword(MCONTACT hContact, const char *szM #endif
+/////////////////////////////////////////////////////////////////////////////////////////
+// Helper to process the auth req body
+
+/* blob is: 0(DWORD), hContact(DWORD), nick(UTF8), firstName(UTF8), lastName(UTF8), email(UTF8), reason(UTF8) */
+
+#pragma warning(disable : 4251)
+
+class MIR_APP_EXPORT DB_AUTH_BLOB
+{
+ MCONTACT m_hContact;
+ DWORD m_dwUin;
+ ptrA m_szNick, m_szFirstName, m_szLastName, m_szEmail, m_szReason;
+ DWORD m_size;
+
+ PBYTE makeBlob();
+
+public:
+ explicit DB_AUTH_BLOB(MCONTACT hContact, LPCSTR nick, LPCSTR fname, LPCSTR lname, LPCSTR id, LPCSTR reason);
+ explicit DB_AUTH_BLOB(PBYTE blob);
+ ~DB_AUTH_BLOB();
+
+ __forceinline operator char*() { return (char*)makeBlob(); }
+ __forceinline operator BYTE*() { return makeBlob(); }
+
+ __forceinline DWORD size() const { return m_size; }
+
+ __forceinline MCONTACT get_contact() const { return m_hContact; }
+ __forceinline const char* get_nick() const { return m_szNick; }
+ __forceinline const char* get_firstName() const { return m_szFirstName; }
+ __forceinline const char* get_lastName() const { return m_szLastName; }
+ __forceinline const char* get_email() const { return m_szEmail; }
+ __forceinline const char* get_reason() const { return m_szReason; }
+ __forceinline DWORD get_uin() const { return m_dwUin; }
+};
+
#endif // M_DATABASE_H__
diff --git a/plugins/NewEventNotify/src/popup.cpp b/plugins/NewEventNotify/src/popup.cpp index 466cbf0661..4edd1c8bad 100644 --- a/plugins/NewEventNotify/src/popup.cpp +++ b/plugins/NewEventNotify/src/popup.cpp @@ -282,36 +282,20 @@ static wchar_t* GetEventPreview(DBEVENTINFO *dbei) case EVENTTYPE_AUTHREQUEST:
if (dbei->pBlob) {
- char szUin[16];
- wchar_t szBuf[2048];
- wchar_t* szNick = NULL;
- char *pszNick = (char *)dbei->pBlob + 8;
- char *pszFirst = pszNick + mir_strlen(pszNick) + 1;
- char *pszLast = pszFirst + mir_strlen(pszFirst) + 1;
- char *pszEmail = pszLast + mir_strlen(pszLast) + 1;
-
- mir_snprintf(szUin, "%d", *((DWORD*)dbei->pBlob));
- if (mir_strlen(pszNick) > 0) {
- if (dbei->flags & DBEF_UTF)
- szNick = mir_utf8decodeW(pszNick);
- else
- szNick = mir_a2u(pszNick);
+ DB_AUTH_BLOB blob(dbei->pBlob);
+
+ wchar_t *szNick = NULL;
+ if (blob.get_nick())
+ szNick = dbei->getString(blob.get_nick());
+ else if (blob.get_email())
+ szNick = dbei->getString(blob.get_email());
+ else if (blob.get_uin()) {
+ char szUin[16];
+ szNick = mir_a2u(itoa(blob.get_uin(), szUin, 10));
}
- else if (mir_strlen(pszEmail) > 0) {
- if (dbei->flags & DBEF_UTF)
- szNick = mir_utf8decodeW(pszEmail);
- else
- szNick = mir_a2u(pszEmail);
- }
- else if (*((DWORD*)dbei->pBlob) > 0)
- szNick = mir_a2u(szUin);
- if (szNick) {
- mir_wstrcpy(szBuf, szNick);
- mir_wstrcat(szBuf, TranslateT(" requested authorization"));
- mir_free(szNick);
- comment1 = mir_wstrdup(szBuf);
- }
+ if (szNick)
+ comment1 = CMStringW(FORMAT, L"%s%s", szNick, TranslateT(" requested authorization")).Detach();
}
commentFix = POPUP_COMMENT_AUTH;
break;
diff --git a/plugins/Spamotron/src/spamotron.cpp b/plugins/Spamotron/src/spamotron.cpp index 2ae09ab0b1..fe48153a0e 100644 --- a/plugins/Spamotron/src/spamotron.cpp +++ b/plugins/Spamotron/src/spamotron.cpp @@ -117,7 +117,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) msgblob = (char *)dbei->pBlob;
}
else if (dbei->eventType == EVENTTYPE_AUTHREQUEST) {
- msgblob = (char *)(dbei->pBlob + sizeof(DWORD) + sizeof(HANDLE));
+ msgblob = (char *)(dbei->pBlob + sizeof(DWORD) + sizeof(DWORD));
for(a = 4; a > 0; a--)
msgblob += mir_strlen(msgblob)+1;
}
@@ -336,16 +336,16 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) }
// Accept if event is EVENTTYPE_AUTHREQUEST and ReplyOnAuth is NOT set
- if (dbei->eventType == EVENTTYPE_AUTHREQUEST && !_getOptB("ReplyOnAuth", defaultReplyOnAuth))
- return 0;
+ if (dbei->eventType == EVENTTYPE_AUTHREQUEST && !_getOptB("ReplyOnAuth", defaultReplyOnAuth))
+ return 0;
// Accept if event is EVENTTYPE_MESSAGE and ReplyOnMsg is NOT set
- if (dbei->eventType == EVENTTYPE_MESSAGE && !_getOptB("ReplyOnMsg", defaultReplyOnMsg))
- return 0;
-
+ if (dbei->eventType == EVENTTYPE_MESSAGE && !_getOptB("ReplyOnMsg", defaultReplyOnMsg))
+ return 0;
+
/*** Send Challenge ***/
- challengeW = (wchar_t *)malloc(maxmsglen*sizeof(wchar_t));
- tmpW = (wchar_t *)malloc(maxmsglen*sizeof(wchar_t));
+ challengeW = (wchar_t *)malloc(maxmsglen * sizeof(wchar_t));
+ tmpW = (wchar_t *)malloc(maxmsglen * sizeof(wchar_t));
switch (_getOptB("Mode", defaultMode)) {
case SPAMOTRON_MODE_PLAIN:
if (dbei->eventType == EVENTTYPE_AUTHREQUEST)
@@ -356,14 +356,14 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) ProtoChainSend(hContact, PSS_MESSAGE, 0, T2Utf(challengeW));
_notify(hContact, POPUP_CHALLENGE, TranslateT("Sending plain challenge to %s."), message);
break;
-
+
case SPAMOTRON_MODE_ROTATE:
if (dbei->eventType == EVENTTYPE_AUTHREQUEST)
_getOptS(challengeW, maxmsglen, "AuthChallenge", defaultAuthChallenge);
else
_getOptS(challengeW, maxmsglen, "Challenge", defaultChallenge);
_getOptS(buf, buflen, "Response", defaultResponse);
- if (_getCOptD(hContact, "ResponseNum", 0) >= (unsigned int)(get_response_num(buf)-1))
+ if (_getCOptD(hContact, "ResponseNum", 0) >= (unsigned int)(get_response_num(buf) - 1))
_setCOptD(hContact, "ResponseNum", -1);
_setCOptD(hContact, "ResponseNum", _getCOptD(hContact, "ResponseNum", -1) + 1);
@@ -415,17 +415,17 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) /*** Do any post-send procedures we need to do ***/
// Increment MsgSent if it was sent the same day. Otherwise set it to 1.
- if (isOneDay(dbei->timestamp, _getCOptD(hContact, "MsgSentTime",0)))
- _setCOptD(hContact, "MsgSent", _getCOptD(hContact, "MsgSent", 0)+1);
- else
+ if (isOneDay(dbei->timestamp, _getCOptD(hContact, "MsgSentTime", 0)))
+ _setCOptD(hContact, "MsgSent", _getCOptD(hContact, "MsgSent", 0) + 1);
+ else
_setCOptD(hContact, "MsgSent", 1);
_setCOptD(hContact, "MsgSentTime", dbei->timestamp);
// Save Last Msg and update SameMsgCount
if (message != NULL) {
if (mir_wstrcmp(_getCOptS(buf, buflen, hContact, "LastInMsg", L""), message) == 0)
- _setCOptD(hContact, "SameMsgCount", 1+_getCOptD(hContact, "SameMsgCount", 0));
- else
+ _setCOptD(hContact, "SameMsgCount", 1 + _getCOptD(hContact, "SameMsgCount", 0));
+ else
_setCOptD(hContact, "SameMsgCount", 1);
_setCOptTS(hContact, "LastInMsg", message);
}
@@ -446,10 +446,11 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) _setCOptB(hContact, "AuthEventPending", TRUE);
free(eventdata);
}
- } else {
+ }
+ else {
if (_getOptB("MarkMsgUnreadOnApproval", defaultMarkMsgUnreadOnApproval)) {
DBVARIANT _dbv;
- DWORD dbei_size = 3*sizeof(DWORD) + sizeof(WORD) + dbei->cbBlob + (DWORD)mir_strlen(dbei->szModule)+1;
+ DWORD dbei_size = 3 * sizeof(DWORD) + sizeof(WORD) + dbei->cbBlob + (DWORD)mir_strlen(dbei->szModule) + 1;
PBYTE eventdata = (PBYTE)malloc(dbei_size);
PBYTE pos = eventdata;
if (eventdata != NULL && dbei->cbBlob > 0) {
@@ -461,16 +462,17 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) db_free(&_dbv);
}
memcpy(pos, &dbei->eventType, sizeof(WORD));
- memcpy(pos+sizeof(WORD), &dbei->flags, sizeof(DWORD));
- memcpy(pos+sizeof(WORD)+sizeof(DWORD), &dbei->timestamp, sizeof(DWORD));
- memcpy(pos+sizeof(WORD)+sizeof(DWORD)*2, dbei->szModule, mir_strlen(dbei->szModule)+1);
- memcpy(pos+sizeof(WORD)+sizeof(DWORD)*2+mir_strlen(dbei->szModule)+1, &dbei->cbBlob, sizeof(DWORD));
- memcpy(pos+sizeof(WORD)+sizeof(DWORD)*3+mir_strlen(dbei->szModule)+1, dbei->pBlob, dbei->cbBlob);
+ memcpy(pos + sizeof(WORD), &dbei->flags, sizeof(DWORD));
+ memcpy(pos + sizeof(WORD) + sizeof(DWORD), &dbei->timestamp, sizeof(DWORD));
+ memcpy(pos + sizeof(WORD) + sizeof(DWORD) * 2, dbei->szModule, mir_strlen(dbei->szModule) + 1);
+ memcpy(pos + sizeof(WORD) + sizeof(DWORD) * 2 + mir_strlen(dbei->szModule) + 1, &dbei->cbBlob, sizeof(DWORD));
+ memcpy(pos + sizeof(WORD) + sizeof(DWORD) * 3 + mir_strlen(dbei->szModule) + 1, dbei->pBlob, dbei->cbBlob);
db_set_blob(hContact, PLUGIN_NAME, "LastMsgEvents", eventdata, (pos - eventdata) + dbei_size);
free(eventdata);
}
-
- } else {
+
+ }
+ else {
dbei->flags |= DBEF_READ;
db_event_add(hContact, dbei);
}
@@ -483,7 +485,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) void RemoveNotOnListSettings()
{
DBVARIANT dbv;
- char protoName[256] = {0};
+ char protoName[256] = { 0 };
MCONTACT hContact = db_find_first();
mir_strcpy(protoName, "proto_");
while (hContact != NULL) {
@@ -537,4 +539,4 @@ extern "C" _declspec(dllexport) int Unload(void) UnhookEvent(hDBEventAdded);
UnhookEvent(hDBEventFilterAdd);
return 0;
-}
\ No newline at end of file +}
diff --git a/protocols/Discord/src/server.cpp b/protocols/Discord/src/server.cpp index 858be58c55..0b7c59fa9a 100644 --- a/protocols/Discord/src/server.cpp +++ b/protocols/Discord/src/server.cpp @@ -116,10 +116,21 @@ void CDiscordProto::OnReceiveUserInfo(NETLIBHTTPREQUEST *pReply, AsyncHttpReques setId(hContact, DB_KEY_ID, m_ownId); setByte(hContact, DB_KEY_MFA, root["mfa_enabled"].as_bool()); - setDword(hContact, DB_KEY_DISCR, root["discriminator"].as_int()); + setDword(hContact, DB_KEY_DISCR, _wtoi(root["discriminator"].as_mstring())); setWString(hContact, DB_KEY_NICK, root["username"].as_mstring()); setWString(hContact, DB_KEY_EMAIL, root["email"].as_mstring()); + switch (root["type"].as_int()) { + case 1: // confirmed + db_unset(hContact, "CList", "NotOnList"); + break; + + case 3: // expecting autorization + db_set_b(hContact, "CList", "NotOnList", 1); + break; + } + + CMStringW wszNewAvatar(root["avatar"].as_mstring()); setWString(hContact, DB_KEY_AVHASH, wszNewAvatar); diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp index 91124a04ab..e9aded49e9 100644 --- a/protocols/FacebookRM/src/process.cpp +++ b/protocols/FacebookRM/src/process.cpp @@ -1099,31 +1099,21 @@ void FacebookProto::ProcessFriendRequests(void*) isNew = true; setString(hContact, "RequestTime", time.c_str()); - //blob is: uin(DWORD), hContact(HANDLE), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ) - //blob is: 0(DWORD), hContact(HANDLE), nick(ASCIIZ), ""(ASCIIZ), ""(ASCIIZ), email(ASCIIZ), reason(ASCIIZ) + DB_AUTH_BLOB blob(hContact, fbu.real_name.c_str(), 0, 0, fbu.user_id.c_str(), reason.c_str()); + DBEVENTINFO dbei = { 0 }; dbei.cbSize = sizeof(DBEVENTINFO); dbei.szModule = m_szModuleName; dbei.timestamp = ::time(NULL); dbei.flags = DBEF_UTF; dbei.eventType = EVENTTYPE_AUTHREQUEST; - dbei.cbBlob = (DWORD)(sizeof(DWORD) * 2 + fbu.real_name.length() + fbu.user_id.length() + reason.length() + 5); - - PBYTE pCurBlob = dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob); - *(PDWORD)pCurBlob = 0; pCurBlob += sizeof(DWORD); // UID - *(PDWORD)pCurBlob = (DWORD)hContact; pCurBlob += sizeof(DWORD); // Contact Handle - mir_strcpy((char*)pCurBlob, fbu.real_name.data()); pCurBlob += fbu.real_name.length() + 1; // Nickname - *pCurBlob = '\0'; pCurBlob++; // First Name - *pCurBlob = '\0'; pCurBlob++; // Last Name - mir_strcpy((char*)pCurBlob, fbu.user_id.data()); pCurBlob += fbu.user_id.length() + 1; // E-mail (we use it for string ID) - mir_strcpy((char*)pCurBlob, reason.data()); pCurBlob += reason.length() + 1; // Reason (we use it for info about common friends) - + dbei.cbBlob = blob.size(); + dbei.pBlob = blob; db_event_add(0, &dbei); } debugLogA(" < (%s) Friendship request [%s]", (isNew ? "New" : "Old"), time.c_str()); - } else { - debugLogA("!!! Wrong friendship request:\n%s", req.c_str()); } + else debugLogA("!!! Wrong friendship request:\n%s", req.c_str()); } facy.handle_success("friendRequests"); diff --git a/protocols/IcqOscarJ/src/fam_04message.cpp b/protocols/IcqOscarJ/src/fam_04message.cpp index 1d2b182bd9..ff2438da29 100644 --- a/protocols/IcqOscarJ/src/fam_04message.cpp +++ b/protocols/IcqOscarJ/src/fam_04message.cpp @@ -1627,20 +1627,13 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp, break;
}
{
+ DB_AUTH_BLOB blob(hContact, pszMsgField[0], pszMsgField[1], pszMsgField[2], pszMsgField[3], pszMsgField[5]);
+ *(PBYTE)blob = dwUin;
+
PROTORECVEVENT pre = { 0 };
pre.timestamp = dwTimestamp;
- pre.lParam = sizeof(DWORD) * 2 + mir_strlen(pszMsgField[0]) + mir_strlen(pszMsgField[1]) + mir_strlen(pszMsgField[2]) + mir_strlen(pszMsgField[3]) + mir_strlen(pszMsgField[5]) + 5;
-
- // blob is: uin(DWORD), hcontact(HANDLE), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ)
- char *szBlob, *pCurBlob = szBlob = (char *)_alloca(pre.lParam);
- *(DWORD*)pCurBlob = dwUin; pCurBlob += sizeof(DWORD);
- *(DWORD*)pCurBlob = DWORD(hContact); pCurBlob += sizeof(DWORD);
- mir_strcpy((char*)pCurBlob, pszMsgField[0]); pCurBlob += mir_strlen((char*)pCurBlob) + 1;
- mir_strcpy((char*)pCurBlob, pszMsgField[1]); pCurBlob += mir_strlen((char*)pCurBlob) + 1;
- mir_strcpy((char*)pCurBlob, pszMsgField[2]); pCurBlob += mir_strlen((char*)pCurBlob) + 1;
- mir_strcpy((char*)pCurBlob, pszMsgField[3]); pCurBlob += mir_strlen((char*)pCurBlob) + 1;
- mir_strcpy((char*)pCurBlob, pszMsgField[5]);
- pre.szMessage = (char *)szBlob;
+ pre.lParam = blob.size();
+ pre.szMessage = blob;
ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&pre);
}
break;
diff --git a/protocols/IcqOscarJ/src/fam_13servclist.cpp b/protocols/IcqOscarJ/src/fam_13servclist.cpp index 3c11e20a7f..3e7b1004db 100644 --- a/protocols/IcqOscarJ/src/fam_13servclist.cpp +++ b/protocols/IcqOscarJ/src/fam_13servclist.cpp @@ -1377,53 +1377,30 @@ void CIcqProto::handleRecvAuthRequest(unsigned char *buf, size_t wLen) int bAdded; MCONTACT hContact = HContactFromUID(dwUin, szUid, &bAdded); - PROTORECVEVENT pre = { 0 }; - pre.timestamp = time(NULL); - pre.lParam = sizeof(DWORD) * 2 + 5; // Prepare reason char *szReason = (char*)SAFE_MALLOC(wReasonLen + 1); - int nReasonLen = 0; if (szReason) { memcpy(szReason, buf, wReasonLen); szReason[wReasonLen] = '\0'; - nReasonLen = (int)mir_strlen(szReason); } // Read nick name from DB - char *szNick = NULL; + char *szNick; if (dwUin) szNick = getSettingStringUtf(hContact, "Nick", NULL); else szNick = null_strdup(szUid); - size_t nNickLen = mir_strlen(szNick); - - pre.lParam += nNickLen + nReasonLen; + DB_AUTH_BLOB blob(hContact, szNick, 0, 0, 0, szReason); + *(DWORD*)(PBYTE)blob = dwUin; setByte(hContact, "Grant", 1); - /*blob is: uin(DWORD), hcontact(HANDLE), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ)*/ - char *szBlob = (char *)_alloca(pre.lParam); - char *pCurBlob = szBlob; - *(DWORD*)pCurBlob = dwUin; pCurBlob += sizeof(DWORD); - *(DWORD*)pCurBlob = DWORD(hContact); pCurBlob += sizeof(DWORD); - - if (nNickLen) { // if we have nick we add it, otherwise keep trailing zero - memcpy(pCurBlob, szNick, nNickLen); - pCurBlob += nNickLen; - } - *pCurBlob = 0; pCurBlob++; // Nick - *pCurBlob = 0; pCurBlob++; // FirstName - *pCurBlob = 0; pCurBlob++; // LastName - *pCurBlob = 0; pCurBlob++; // email - if (nReasonLen) { - memcpy(pCurBlob, szReason, nReasonLen); - pCurBlob += nReasonLen; - } - *pCurBlob = 0; // Reason - pre.szMessage = szBlob; - // TODO: Change for new auth system, include all known informations + PROTORECVEVENT pre = { 0 }; + pre.timestamp = time(NULL); + pre.lParam = blob.size(); + pre.szMessage = blob; ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&pre); SAFE_FREE(&szNick); diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index 6b6d6b9c0c..ed0320d301 100644 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -48,28 +48,17 @@ void CJabberProto::DBAddAuthRequest(const wchar_t *jid, const wchar_t *nick) MCONTACT hContact = DBCreateContact(jid, nick, true, true);
delSetting(hContact, "Hidden");
- T2Utf szJid(jid);
- T2Utf szNick(nick);
+ DB_AUTH_BLOB blob(hContact, T2Utf(nick), NULL, NULL, T2Utf(jid), NULL);
- // blob is: uin(DWORD), hContact(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ)
- // blob is: 0(DWORD), hContact(DWORD), nick(ASCIIZ), ""(ASCIIZ), ""(ASCIIZ), email(ASCIIZ), ""(ASCIIZ)
DBEVENTINFO dbei = { sizeof(DBEVENTINFO) };
dbei.szModule = m_szModuleName;
dbei.timestamp = (DWORD)time(NULL);
dbei.flags = DBEF_UTF;
dbei.eventType = EVENTTYPE_AUTHREQUEST;
- dbei.cbBlob = (DWORD)(sizeof(DWORD) * 2 + mir_strlen(szNick) + mir_strlen(szJid) + 5);
- PBYTE pCurBlob = dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob);
- *((PDWORD)pCurBlob) = 0; pCurBlob += sizeof(DWORD);
- *((PDWORD)pCurBlob) = (DWORD)hContact; pCurBlob += sizeof(DWORD);
- mir_strcpy((char*)pCurBlob, szNick); pCurBlob += mir_strlen(szNick) + 1;
- *pCurBlob = '\0'; pCurBlob++; //firstName
- *pCurBlob = '\0'; pCurBlob++; //lastName
- mir_strcpy((char*)pCurBlob, szJid); pCurBlob += mir_strlen(szJid) + 1;
- *pCurBlob = '\0'; //reason
-
+ dbei.cbBlob = blob.size();
+ dbei.pBlob = blob;
db_event_add(NULL, &dbei);
- debugLogA("Setup DBAUTHREQUEST with nick='%s' jid='%s'", szNick, szJid);
+ debugLogA("Setup DBAUTHREQUEST with nick='%s' jid='%s'", blob.get_nick(), blob.get_email());
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 9da06d589e..075f2defea 100755 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -340,23 +340,11 @@ MCONTACT __cdecl CJabberProto::AddToListByEvent(int flags, int /*iContact*/, MEV return NULL;
if (mir_strcmp(dbei.szModule, m_szModuleName))
return NULL;
-
- // EVENTTYPE_CONTACTS is when adding from when we receive contact list (not used in Jabber)
- // EVENTTYPE_ADDED is when adding from when we receive "You are added" (also not used in Jabber)
- // Jabber will only handle the case of EVENTTYPE_AUTHREQUEST
- // EVENTTYPE_AUTHREQUEST is when adding from the authorization request dialog
if (dbei.eventType != EVENTTYPE_AUTHREQUEST)
return NULL;
- char *nick = (char*)(dbei.pBlob + sizeof(DWORD)*2);
- char *firstName = nick + mir_strlen(nick) + 1;
- char *lastName = firstName + mir_strlen(firstName) + 1;
- char *jid = lastName + mir_strlen(lastName) + 1;
-
- wchar_t *newJid = (dbei.flags & DBEF_UTF) ? mir_utf8decodeW(jid) : mir_a2u(jid);
- MCONTACT hContact = (MCONTACT)AddToListByJID(newJid, flags);
- mir_free(newJid);
- return hContact;
+ DB_AUTH_BLOB blob(dbei.pBlob);
+ return AddToListByJID(ptrW(dbei.getString(blob.get_email())), flags);
}
////////////////////////////////////////////////////////////////////////////////////////
@@ -379,23 +367,18 @@ int CJabberProto::Authorize(MEVENT hDbEvent) if (mir_strcmp(dbei.szModule, m_szModuleName))
return 1;
- char *nick = (char*)(dbei.pBlob + sizeof(DWORD)*2);
- char *firstName = nick + mir_strlen(nick) + 1;
- char *lastName = firstName + mir_strlen(firstName) + 1;
- char *jid = lastName + mir_strlen(lastName) + 1;
-
- debugLogW(L"Send 'authorization allowed' to %s", jid);
+ DB_AUTH_BLOB blob(dbei.pBlob);
+ debugLogW(L"Send 'authorization allowed' to %s", blob.get_email());
- wchar_t *newJid = (dbei.flags & DBEF_UTF) ? mir_utf8decodeW(jid) : mir_a2u(jid);
+ ptrW newJid(dbei.getString(blob.get_email()));
m_ThreadInfo->send(XmlNode(L"presence") << XATTR(L"to", newJid) << XATTR(L"type", L"subscribed"));
// Automatically add this user to my roster if option is enabled
if (m_options.AutoAdd == TRUE) {
- JABBER_LIST_ITEM *item;
-
- if ((item = ListGetItemPtr(LIST_ROSTER, newJid)) == NULL || (item->subscription != SUB_BOTH && item->subscription != SUB_TO)) {
- debugLogW(L"Try adding contact automatically jid = %s", jid);
+ JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, newJid);
+ if (item == NULL || (item->subscription != SUB_BOTH && item->subscription != SUB_TO)) {
+ debugLogW(L"Try adding contact automatically jid = %s", blob.get_email());
if (MCONTACT hContact = AddToListByJID(newJid, 0)) {
// Trigger actual add by removing the "NotOnList" added by AddToListByJID()
// See AddToListByJID() and JabberDbSettingChanged().
diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp index 71b3f23c66..20ac13f3b8 100644 --- a/protocols/MRA/src/MraProto.cpp +++ b/protocols/MRA/src/MraProto.cpp @@ -168,11 +168,8 @@ MCONTACT CMraProto::AddToListByEvent(int, int, MEVENT hDbEvent) !mir_strcmp(dbei.szModule, m_szModuleName) &&
(dbei.eventType == EVENTTYPE_AUTHREQUEST || dbei.eventType == EVENTTYPE_CONTACTS))
{
- char *nick = (char*)(dbei.pBlob + sizeof(DWORD) * 2);
- char *firstName = nick + mir_strlen(nick) + 1;
- char *lastName = firstName + mir_strlen(firstName) + 1;
- char *email = lastName + mir_strlen(lastName) + 1;
- return AddToListByEmail(ptrW(mir_utf8decodeW(email)), ptrW(mir_utf8decodeW(nick)), ptrW(mir_utf8decodeW(firstName)), ptrW(mir_utf8decodeW(lastName)), 0);
+ DB_AUTH_BLOB blob(dbei.pBlob);
+ return AddToListByEmail(dbei.getString(blob.get_email()), dbei.getString(blob.get_nick()), dbei.getString(blob.get_firstName()), dbei.getString(blob.get_lastName()), 0);
}
}
return 0;
@@ -189,14 +186,12 @@ int CMraProto::Authorize(MEVENT hDBEvent) return 1;
dbei.pBlob = (PBYTE)alloca(dbei.cbBlob);
- if (db_event_get(hDBEvent, &dbei)) return 1;
- if (dbei.eventType != EVENTTYPE_AUTHREQUEST) return 1;
- if (mir_strcmp(dbei.szModule, m_szModuleName)) return 1;
-
- LPSTR lpszNick = (LPSTR)(dbei.pBlob + sizeof(DWORD) * 2);
- LPSTR lpszFirstName = lpszNick + mir_strlen(lpszNick) + 1;
- LPSTR lpszLastName = lpszFirstName + mir_strlen(lpszFirstName) + 1;
- MraAuthorize(CMStringA(lpszLastName + mir_strlen(lpszLastName) + 1));
+ if (db_event_get(hDBEvent, &dbei)) return 1;
+ if (dbei.eventType != EVENTTYPE_AUTHREQUEST) return 1;
+ if (mir_strcmp(dbei.szModule, m_szModuleName)) return 1;
+
+ DB_AUTH_BLOB blob(dbei.pBlob);
+ MraAuthorize(blob.get_email());
return 0;
}
@@ -209,16 +204,12 @@ int CMraProto::AuthDeny(MEVENT hDBEvent, const wchar_t* szReason) return 1;
dbei.pBlob = (PBYTE)alloca(dbei.cbBlob);
- if (db_event_get(hDBEvent, &dbei)) return 1;
- if (dbei.eventType != EVENTTYPE_AUTHREQUEST) return 1;
- if (mir_strcmp(dbei.szModule, m_szModuleName)) return 1;
-
- LPSTR lpszNick = (LPSTR)(dbei.pBlob + sizeof(DWORD) * 2);
- LPSTR lpszFirstName = lpszNick + mir_strlen(lpszNick) + 1;
- LPSTR lpszLastName = lpszFirstName + mir_strlen(lpszFirstName) + 1;
- LPSTR szEmail = lpszLastName + mir_strlen(lpszLastName) + 1;
+ if (db_event_get(hDBEvent, &dbei)) return 1;
+ if (dbei.eventType != EVENTTYPE_AUTHREQUEST) return 1;
+ if (mir_strcmp(dbei.szModule, m_szModuleName)) return 1;
- MraMessage(FALSE, NULL, 0, 0, szEmail, szReason, NULL, 0);
+ DB_AUTH_BLOB blob(dbei.pBlob);
+ MraMessage(FALSE, NULL, 0, 0, blob.get_email(), szReason, NULL, 0);
return 0;
}
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index cc620c1dc1..d4e873b20f 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -81,33 +81,14 @@ char** CMsnProto::GetStatusMsgLoc(int status) // MSN_AddAuthRequest - adds the authorization event to the database
void CMsnProto::MSN_AddAuthRequest(const char *email, const char *nick, const char *reason)
{
- //blob is: UIN=0(DWORD), hContact(DWORD), nick(ASCIIZ), ""(ASCIIZ), ""(ASCIIZ), email(ASCIIZ), ""(ASCIIZ)
-
MCONTACT hContact = MSN_HContactFromEmail(email, nick, true, true);
- int emaillen = (int)mir_strlen(email);
-
- if (nick == NULL) nick = "";
- int nicklen = (int)mir_strlen(nick);
-
- if (reason == NULL) reason = "";
- int reasonlen = (int)mir_strlen(reason);
+ DB_AUTH_BLOB blob(hContact, nick, 0, 0, email, reason);
PROTORECVEVENT pre = { 0 };
pre.timestamp = (DWORD)time(NULL);
- pre.lParam = sizeof(DWORD) + sizeof(HANDLE) + nicklen + emaillen + 5 + reasonlen;
-
- char* pCurBlob = (char*)alloca(pre.lParam);
- pre.szMessage = pCurBlob;
-
- *(PDWORD)pCurBlob = 0; pCurBlob += sizeof(DWORD); // UID
- *(PDWORD)pCurBlob = (DWORD)hContact; pCurBlob += sizeof(DWORD); // Contact Handle
- mir_strcpy(pCurBlob, nick); pCurBlob += nicklen + 1; // Nickname
- *pCurBlob = '\0'; pCurBlob++; // First Name
- *pCurBlob = '\0'; pCurBlob++; // Last Name
- mir_strcpy(pCurBlob, email); pCurBlob += emaillen + 1; // E-mail
- mir_strcpy(pCurBlob, reason); // Reason
-
+ pre.lParam = blob.size();
+ pre.szMessage = blob;
ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&pre);
}
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index b93d1a1903..208320aa45 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -276,12 +276,8 @@ MCONTACT __cdecl CMsnProto::AddToListByEvent(int flags, int, MEVENT hDbEvent) if (mir_strcmp(dbei.szModule, m_szModuleName)) return NULL;
if (dbei.eventType != EVENTTYPE_AUTHREQUEST) return NULL;
- char* nick = (char *)(dbei.pBlob + sizeof(DWORD) * 2);
- char* firstName = nick + mir_strlen(nick) + 1;
- char* lastName = firstName + mir_strlen(firstName) + 1;
- char* email = lastName + mir_strlen(lastName) + 1;
-
- return AddToListByEmail(email, nick, flags);
+ DB_AUTH_BLOB blob(dbei.pBlob);
+ return AddToListByEmail(blob.get_email(), blob.get_nick(), flags);
}
int CMsnProto::AuthRecv(MCONTACT, PROTORECVEVENT* pre)
@@ -333,19 +329,16 @@ int CMsnProto::Authorize(MEVENT hDbEvent) if (mir_strcmp(dbei.szModule, m_szModuleName))
return 1;
- char *nick = (char*)(dbei.pBlob + sizeof(DWORD) * 2);
- char *firstName = nick + mir_strlen(nick) + 1;
- char *lastName = firstName + mir_strlen(firstName) + 1;
- char *email = lastName + mir_strlen(lastName) + 1;
+ DB_AUTH_BLOB blob(dbei.pBlob);
- MCONTACT hContact = MSN_HContactFromEmail(email, nick, true, 0);
- int netId = Lists_GetNetId(email);
+ MCONTACT hContact = MSN_HContactFromEmail(blob.get_email(), blob.get_nick(), true, 0);
+ int netId = Lists_GetNetId(blob.get_email());
- MSN_AddUser(hContact, email, netId, LIST_AL);
- MSN_AddUser(hContact, email, netId, LIST_BL + LIST_REMOVE);
- MSN_AddUser(hContact, email, netId, LIST_PL + LIST_REMOVE);
+ MSN_AddUser(hContact, blob.get_email(), netId, LIST_AL);
+ MSN_AddUser(hContact, blob.get_email(), netId, LIST_BL + LIST_REMOVE);
+ MSN_AddUser(hContact, blob.get_email(), netId, LIST_PL + LIST_REMOVE);
- MSN_SetContactDb(hContact, email);
+ MSN_SetContactDb(hContact, blob.get_email());
return 0;
}
@@ -369,22 +362,19 @@ int CMsnProto::AuthDeny(MEVENT hDbEvent, const wchar_t*) if (mir_strcmp(dbei.szModule, m_szModuleName))
return 1;
- char* nick = (char*)(dbei.pBlob + sizeof(DWORD) * 2);
- char* firstName = nick + mir_strlen(nick) + 1;
- char* lastName = firstName + mir_strlen(firstName) + 1;
- char* email = lastName + mir_strlen(lastName) + 1;
+ DB_AUTH_BLOB blob(dbei.pBlob);
- MsnContact* msc = Lists_Get(email);
+ MsnContact* msc = Lists_Get(blob.get_email());
if (msc == NULL) return 0;
- MSN_AddUser(NULL, email, msc->netId, LIST_PL + LIST_REMOVE);
- MSN_AddUser(NULL, email, msc->netId, LIST_BL);
- MSN_AddUser(NULL, email, msc->netId, LIST_RL);
+ MSN_AddUser(NULL, blob.get_email(), msc->netId, LIST_PL + LIST_REMOVE);
+ MSN_AddUser(NULL, blob.get_email(), msc->netId, LIST_BL);
+ MSN_AddUser(NULL, blob.get_email(), msc->netId, LIST_RL);
if (!(msc->list & (LIST_FL | LIST_LL))) {
if (msc->hContact) db_delete_contact(msc->hContact);
msc->hContact = NULL;
- MCONTACT hContact = MSN_HContactFromEmail(email);
+ MCONTACT hContact = MSN_HContactFromEmail(blob.get_email());
if (hContact) db_delete_contact(hContact);
}
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index feaee28f15..275d8b0e2a 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -175,7 +175,7 @@ MCONTACT CSkypeProto::AddToListByEvent(int, int, MEVENT hDbEvent) DB_AUTH_BLOB blob(dbei.pBlob); - MCONTACT hContact = AddContact(ptrA(blob.get_id())); + MCONTACT hContact = AddContact(blob.get_email()); return hContact; } diff --git a/protocols/SkypeWeb/src/skype_utils.h b/protocols/SkypeWeb/src/skype_utils.h index b6d847e677..ec5e386af8 100644 --- a/protocols/SkypeWeb/src/skype_utils.h +++ b/protocols/SkypeWeb/src/skype_utils.h @@ -18,64 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef _UTILS_H_
#define _UTILS_H_
-class DB_AUTH_BLOB
-{
- MCONTACT hContact;
- ptrA szNick, szFirstName, szLastName, szId, szReason;
-
- PBYTE makeBlob()
- {
- size_t size = this->size();
-
- /*blob is: 0(DWORD), hContact(DWORD), nick(ASCIIZ), firstName(ASCIIZ), lastName(ASCIIZ), id(ASCIIZ), reason(ASCIIZ)*/
- PBYTE pBlob, pCurBlob;
- pCurBlob = pBlob = (PBYTE)mir_calloc(size);
-
- *((PDWORD)pCurBlob) = 0;
- pCurBlob += sizeof(DWORD);
- *((PDWORD)pCurBlob) = (DWORD)hContact;
- pCurBlob += sizeof(DWORD);
-
- if (szNick) { mir_strcpy((char*)pCurBlob, szNick ); pCurBlob += mir_strlen(szNick ); } pCurBlob++;
- if (szFirstName){ mir_strcpy((char*)pCurBlob, szFirstName); pCurBlob += mir_strlen(szFirstName); } pCurBlob++;
- if (szLastName) { mir_strcpy((char*)pCurBlob, szLastName ); pCurBlob += mir_strlen(szLastName ); } pCurBlob++;
- if (szId) { mir_strcpy((char*)pCurBlob, szId ); pCurBlob += mir_strlen(szId ); } pCurBlob++;
- if (szReason) { mir_strcpy((char*)pCurBlob, szReason ); pCurBlob += mir_strlen(szReason ); } pCurBlob++;
-
- return pBlob;
- }
-
-public:
- __inline explicit
- DB_AUTH_BLOB(MCONTACT _hContact, LPCSTR nick, LPCSTR fname, LPCSTR lname, LPCSTR id, LPCSTR reason)
- : hContact(_hContact), szNick(mir_strdup(nick)), szFirstName(mir_strdup(fname)), szLastName(mir_strdup(lname)), szId(mir_strdup(id)), szReason(mir_strdup(reason)) {}
-
- __inline explicit DB_AUTH_BLOB(PBYTE blob)
- {
- PBYTE pCurBlob = blob;
- pCurBlob += sizeof(DWORD);
- hContact = *(PDWORD)pCurBlob;
- pCurBlob += sizeof(DWORD);
- szNick = mir_strdup((char*)pCurBlob); pCurBlob += mir_strlen((char*)pCurBlob) + 1;
- szFirstName = mir_strdup((char*)pCurBlob); pCurBlob += mir_strlen((char*)pCurBlob) + 1;
- szLastName = mir_strdup((char*)pCurBlob); pCurBlob += mir_strlen((char*)pCurBlob) + 1;
- szId = mir_strdup((char*)pCurBlob); pCurBlob += mir_strlen((char*)pCurBlob) + 1;
- szReason = mir_strdup((char*)pCurBlob);
- }
-
- __inline size_t size(){ return ((sizeof(DWORD) * 2) + (mir_strlen(szNick) + 1) + (mir_strlen(szFirstName) + 1) + (mir_strlen(szLastName) + 1) + (mir_strlen(szId) + 1) + (mir_strlen(szReason) + 1)); }
-
- __inline operator char*(){ return (char*)makeBlob(); };
- __inline operator BYTE*(){ return makeBlob(); };
-
- __inline MCONTACT get_hcontact() { return hContact; }
- __inline char *get_nick() { return mir_strdup(szNick); }
- __inline char *get_firstname() { return mir_strdup(szFirstName); }
- __inline char *get_lastname() { return mir_strdup(szLastName); }
- __inline char *get_id() { return mir_strdup(szId); }
- __inline char *get_reason() { return mir_strdup(szReason); }
-};
-
class EventHandle
{
HANDLE _hEvent;
diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp index 92a0bb5c63..efb76d7142 100644 --- a/protocols/Steam/src/steam_contacts.cpp +++ b/protocols/Steam/src/steam_contacts.cpp @@ -332,30 +332,12 @@ void CSteamProto::ContactIsAskingAuth(MCONTACT hContact) char reason[MAX_PATH]; mir_snprintf(reason, Translate("%s has added you to his or her Friend List"), nickName); - // blob is: 0(DWORD), hContact(DWORD), nick(ASCIIZ), firstName(ASCIIZ), lastName(ASCIIZ), sid(ASCIIZ), reason(ASCIIZ) - DWORD cbBlob = (DWORD)(sizeof(DWORD)* 2 + mir_strlen(nickName) + mir_strlen(firstName) + mir_strlen(lastName) + mir_strlen(steamId) + mir_strlen(reason) + 5); - - PBYTE pBlob, pCurBlob; - pCurBlob = pBlob = (PBYTE)mir_alloc(cbBlob); - - *((PDWORD)pCurBlob) = 0; - pCurBlob += sizeof(DWORD); - *((PDWORD)pCurBlob) = (DWORD)hContact; - pCurBlob += sizeof(DWORD); - mir_strcpy((char*)pCurBlob, nickName); - pCurBlob += mir_strlen(nickName) + 1; - mir_strcpy((char*)pCurBlob, firstName); - pCurBlob += mir_strlen(firstName) + 1; - mir_strcpy((char*)pCurBlob, lastName); - pCurBlob += mir_strlen(lastName) + 1; - mir_strcpy((char*)pCurBlob, steamId); - pCurBlob += mir_strlen(steamId) + 1; - mir_strcpy((char*)pCurBlob, reason); + DB_AUTH_BLOB blob(hContact, nickName, firstName, lastName, steamId, reason); PROTORECVEVENT recv = { 0 }; recv.timestamp = time(NULL); - recv.szMessage = (char*)pBlob; - recv.lParam = cbBlob; + recv.szMessage = blob; + recv.lParam = blob.size(); ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&recv); // remember to not create this event again, unless authorization status changes again diff --git a/protocols/Tlen/src/tlen_misc.cpp b/protocols/Tlen/src/tlen_misc.cpp index 48f2bf617a..edf15ab1c6 100644 --- a/protocols/Tlen/src/tlen_misc.cpp +++ b/protocols/Tlen/src/tlen_misc.cpp @@ -38,38 +38,23 @@ void TlenDBAddEvent(TlenProtocol *proto, MCONTACT hContact, int eventType, DWORD void TlenDBAddAuthRequest(TlenProtocol *proto, char *jid, char *nick)
{
- char *s;
- PBYTE pCurBlob;
- PBYTE pBlob;
- DWORD cbBlob;
- MCONTACT hContact;
-
- if ((hContact=TlenHContactFromJID(proto, jid)) == NULL) {
+ MCONTACT hContact = TlenHContactFromJID(proto, jid);
+ if (hContact == NULL) {
hContact = db_add_contact();
Proto_AddToContact(hContact, proto->m_szModuleName);
// strip resource if present
- s = TlenLoginFromJID(jid);
+ char *s = TlenLoginFromJID(jid);
_strlwr(s);
db_set_s(hContact, proto->m_szModuleName, "jid", s);
mir_free(s);
}
- else {
- db_unset(hContact, proto->m_szModuleName, "Hidden");
- }
+ else db_unset(hContact, proto->m_szModuleName, "Hidden");
+
db_set_s(hContact, proto->m_szModuleName, "Nick", nick);
+
proto->debugLogA("auth request: %s, %s", jid, nick);
- //blob is: uin(DWORD), hContact(HANDLE), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ)
- //blob is: 0(DWORD), hContact(HANDLE), nick(ASCIIZ), ""(ASCIIZ), ""(ASCIIZ), email(ASCIIZ), ""(ASCIIZ)
- cbBlob = sizeof(DWORD) + sizeof(HANDLE) + (int)mir_strlen(nick) + (int)mir_strlen(jid) + 5;
- pBlob = pCurBlob = (PBYTE) mir_alloc(cbBlob);
- *((PDWORD)pCurBlob) = 0; pCurBlob += sizeof(DWORD);
- *((PDWORD)pCurBlob) = (DWORD)hContact; pCurBlob += sizeof(DWORD);
- mir_strcpy((char *) pCurBlob, nick); pCurBlob += mir_strlen(nick)+1;
- *pCurBlob = '\0'; pCurBlob++; //firstName
- *pCurBlob = '\0'; pCurBlob++; //lastName
- mir_strcpy((char *) pCurBlob, jid); pCurBlob += mir_strlen(jid)+1;
- *pCurBlob = '\0'; //reason
- TlenDBAddEvent(proto, NULL, EVENTTYPE_AUTHREQUEST, 0, pBlob, cbBlob);
+ DB_AUTH_BLOB blob(hContact, nick, 0, 0, jid, 0);
+ TlenDBAddEvent(proto, NULL, EVENTTYPE_AUTHREQUEST, 0, blob, blob.size());
}
char *TlenJIDFromHContact(TlenProtocol *proto, MCONTACT hContact)
diff --git a/protocols/Tlen/src/tlen_svc.cpp b/protocols/Tlen/src/tlen_svc.cpp index 25442c0dba..2ec63b93f3 100644 --- a/protocols/Tlen/src/tlen_svc.cpp +++ b/protocols/Tlen/src/tlen_svc.cpp @@ -251,12 +251,8 @@ MCONTACT TlenProtocol::AddToListByEvent(int flags, int, MEVENT hDbEvent) return NULL;
}
- char *nick = (char *)dbei.pBlob + sizeof(DWORD) * 2;
- char *firstName = nick + mir_strlen(nick) + 1;
- char *lastName = firstName + mir_strlen(firstName) + 1;
- char *jid = lastName + mir_strlen(lastName) + 1;
-
- MCONTACT hContact = (MCONTACT)AddToListByJID(this, jid, flags);
+ DB_AUTH_BLOB blob(dbei.pBlob);
+ MCONTACT hContact = (MCONTACT)AddToListByJID(this, blob.get_email(), flags);
mir_free(dbei.pBlob);
return hContact;
}
@@ -284,21 +280,17 @@ int TlenProtocol::Authorize(MEVENT hDbEvent) return 1;
}
- char *nick = (char *)dbei.pBlob + sizeof(DWORD) * 2;
- char *firstName = nick + mir_strlen(nick) + 1;
- char *lastName = firstName + mir_strlen(firstName) + 1;
- char *jid = lastName + mir_strlen(lastName) + 1;
-
- TlenSend(this, "<presence to='%s' type='subscribed'/>", jid);
+ DB_AUTH_BLOB blob(dbei.pBlob);
+ TlenSend(this, "<presence to='%s' type='subscribed'/>", blob.get_email());
// Automatically add this user to my roster if option is enabled
if (db_get_b(NULL, m_szModuleName, "AutoAdd", TRUE) == TRUE) {
MCONTACT hContact;
- TLEN_LIST_ITEM *item = TlenListGetItemPtr(this, LIST_ROSTER, jid);
+ TLEN_LIST_ITEM *item = TlenListGetItemPtr(this, LIST_ROSTER, blob.get_email());
if (item == NULL || (item->subscription != SUB_BOTH && item->subscription != SUB_TO)) {
- debugLogA("Try adding contact automatically jid=%s", jid);
- if ((hContact = AddToListByJID(this, jid, 0)) != NULL) {
+ debugLogA("Try adding contact automatically jid=%s", blob.get_email());
+ if ((hContact = AddToListByJID(this, blob.get_email(), 0)) != NULL) {
// Trigger actual add by removing the "NotOnList" added by AddToListByJID()
// See AddToListByJID() and TlenDbSettingChanged().
db_unset(hContact, "CList", "NotOnList");
@@ -333,13 +325,9 @@ int TlenProtocol::AuthDeny(MEVENT hDbEvent, const wchar_t*) return 1;
}
- char *nick = (char *)dbei.pBlob + sizeof(DWORD) * 2;
- char *firstName = nick + mir_strlen(nick) + 1;
- char *lastName = firstName + mir_strlen(firstName) + 1;
- char *jid = lastName + mir_strlen(lastName) + 1;
-
- TlenSend(this, "<presence to='%s' type='unsubscribed'/>", jid);
- TlenSend(this, "<iq type='set'><query xmlns='jabber:iq:roster'><item jid='%s' subscription='remove'/></query></iq>", jid);
+ DB_AUTH_BLOB blob(dbei.pBlob);
+ TlenSend(this, "<presence to='%s' type='unsubscribed'/>", blob.get_email());
+ TlenSend(this, "<iq type='set'><query xmlns='jabber:iq:roster'><item jid='%s' subscription='remove'/></query></iq>", blob.get_email());
mir_free(dbei.pBlob);
return 0;
}
diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp index 4c2f582e41..9cfbd81b00 100644 --- a/protocols/Tox/src/tox_contacts.cpp +++ b/protocols/Tox/src/tox_contacts.cpp @@ -260,24 +260,12 @@ void CToxProto::OnFriendRequest(Tox*, const uint8_t *pubKey, const uint8_t *mess proto->delSetting(hContact, "Auth");
+ DB_AUTH_BLOB blob(hContact, 0, 0, 0, (LPCSTR)address, (LPCSTR)message);
+
PROTORECVEVENT pre = { 0 };
pre.timestamp = time(NULL);
- pre.lParam = (DWORD)(sizeof(DWORD) * 2 + address.GetLength() + length + 5);
-
- /*blob is: 0(DWORD), hContact(DWORD), nick(ASCIIZ), firstName(ASCIIZ), lastName(ASCIIZ), id(ASCIIZ), reason(ASCIIZ)*/
- PBYTE pBlob, pCurBlob;
- pCurBlob = pBlob = (PBYTE)mir_calloc(pre.lParam);
-
- *((PDWORD)pCurBlob) = 0;
- pCurBlob += sizeof(DWORD);
- *((PDWORD)pCurBlob) = (DWORD)hContact;
- pCurBlob += sizeof(DWORD);
- pCurBlob += 3;
- mir_strcpy((char *)pCurBlob, address);
- pCurBlob += address.GetLength() + 1;
- mir_strcpy((char *)pCurBlob, (char*)message);
- pre.szMessage = (char*)pBlob;
-
+ pre.lParam = blob.size();
+ pre.szMessage = blob;
ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&pre);
}
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index f8f3bec513..1b01726814 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -551,42 +551,20 @@ void CVkProto::DBAddAuthRequest(const MCONTACT hContact, bool added) {
debugLogA("CVkProto::DBAddAuthRequest");
- T2Utf szNick(ptrW(db_get_wsa(hContact, m_szModuleName, "Nick")));
- T2Utf szFirstName(ptrW(db_get_wsa(hContact, m_szModuleName, "FirstName")));
- T2Utf szLastName(ptrW(db_get_wsa(hContact, m_szModuleName, "LastName")));
+ DB_AUTH_BLOB blob(hContact,
+ T2Utf(ptrW(db_get_wsa(hContact, m_szModuleName, "Nick"))),
+ T2Utf(ptrW(db_get_wsa(hContact, m_szModuleName, "FirstName"))),
+ T2Utf(ptrW(db_get_wsa(hContact, m_szModuleName, "LastName"))), NULL, NULL);
- //blob is: uin(DWORD), hContact(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ)
- //blob is: 0(DWORD), hContact(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), ""(ASCIIZ), ""(ASCIIZ)
DBEVENTINFO dbei = { sizeof(DBEVENTINFO) };
dbei.szModule = m_szModuleName;
dbei.timestamp = (DWORD)time(NULL);
dbei.flags = DBEF_UTF;
dbei.eventType = added ? EVENTTYPE_ADDED : EVENTTYPE_AUTHREQUEST;
- dbei.cbBlob = (DWORD)(sizeof(DWORD) * 2 + mir_strlen(szNick) + mir_strlen(szFirstName) + mir_strlen(szLastName) + 5);
-
- PBYTE pCurBlob = dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob);
-
- *((PDWORD)pCurBlob) = 0;
- pCurBlob += sizeof(DWORD); // uin(DWORD) = 0 (DWORD)
-
- *((PDWORD)pCurBlob) = (DWORD)hContact;
- pCurBlob += sizeof(DWORD); // hContact(DWORD)
-
- mir_strcpy((char*)pCurBlob, szNick);
- pCurBlob += mir_strlen(szNick) + 1;
-
- mir_strcpy((char*)pCurBlob, szFirstName);
- pCurBlob += mir_strlen(szFirstName) + 1;
-
- mir_strcpy((char*)pCurBlob, szLastName);
- pCurBlob += mir_strlen(szLastName) + 1;
-
- *pCurBlob = '\0'; //email
- pCurBlob++;
- *pCurBlob = '\0'; //reason
-
+ dbei.cbBlob = blob.size();
+ dbei.pBlob = blob;
db_event_add(NULL, &dbei);
- debugLogA("CVkProto::DBAddAuthRequest %s", szNick ? szNick : "<null>");
+ debugLogA("CVkProto::DBAddAuthRequest %s", blob.get_nick() ? blob.get_nick() : "<null>");
}
MCONTACT CVkProto::MContactFromDbEvent(MEVENT hDbEvent)
@@ -1478,7 +1456,7 @@ void CVkProto::AddVkDeactivateEvent(MCONTACT hContact, CMStringW& wszType) dbei.szModule = m_szModuleName;
dbei.timestamp = time(NULL);
dbei.eventType = VK_USER_DEACTIVATE_ACTION;
- dbei.cbBlob = mir_strlen(vkDeactivateEvent[iDEIdx].szDescription) + 1;
+ dbei.cbBlob = (DWORD)mir_strlen(vkDeactivateEvent[iDEIdx].szDescription) + 1;
dbei.pBlob = (PBYTE)mir_strdup(vkDeactivateEvent[iDEIdx].szDescription);
dbei.flags = DBEF_UTF | (m_vkOptions.bShowVkDeactivateEvents ? 0 : DBEF_READ);
db_event_add(hContact, &dbei);
diff --git a/src/mir_app/src/db_events.cpp b/src/mir_app/src/db_events.cpp index 9bafc0930e..df027c4616 100644 --- a/src/mir_app/src/db_events.cpp +++ b/src/mir_app/src/db_events.cpp @@ -97,7 +97,7 @@ static wchar_t* getEventString(DBEVENTINFO *dbei, LPSTR &buf) {
LPSTR in = buf;
buf += mir_strlen(buf) + 1;
- return (dbei->flags & DBEF_UTF) ? Utf8DecodeT(in) : mir_a2u(in);
+ return (dbei->flags & DBEF_UTF) ? Utf8DecodeW(in) : mir_a2u(in);
}
static INT_PTR DbEventGetTextWorker(DBEVENTINFO *dbei, int codepage, int datatype)
@@ -113,15 +113,12 @@ static INT_PTR DbEventGetTextWorker(DBEVENTINFO *dbei, int codepage, int datatyp return 0;
if (dbei->eventType == EVENTTYPE_AUTHREQUEST || dbei->eventType == EVENTTYPE_ADDED) {
- // EVENTTYPE_AUTHREQUEST: uin(DWORD), hContact(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ)
- // EVENTTYPE_ADDED: uin(DWORD), hContact(HANDLE), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ)
- DWORD uin = *(DWORD*)dbei->pBlob;
- MCONTACT hContact = (MCONTACT)*(DWORD*)(dbei->pBlob + sizeof(DWORD));
- char *buf = LPSTR(dbei->pBlob) + sizeof(DWORD)*2;
- ptrW tszNick(getEventString(dbei, buf));
- ptrW tszFirst(getEventString(dbei, buf));
- ptrW tszLast(getEventString(dbei, buf));
- ptrW tszEmail(getEventString(dbei, buf));
+ DB_AUTH_BLOB blob(dbei->pBlob);
+
+ ptrW tszNick(dbei->getString(blob.get_nick()));
+ ptrW tszFirst(dbei->getString(blob.get_firstName()));
+ ptrW tszLast(dbei->getString(blob.get_lastName()));
+ ptrW tszEmail(dbei->getString(blob.get_email()));
CMStringW nick, text;
if (tszFirst || tszLast) {
@@ -133,21 +130,21 @@ static INT_PTR DbEventGetTextWorker(DBEVENTINFO *dbei, int codepage, int datatyp nick.Append(L", ");
nick.Append(tszEmail);
}
- if (uin != 0) {
+ if (blob.get_uin() != 0) {
if (!nick.IsEmpty())
nick.Append(L", ");
- nick.AppendFormat(L"%d", uin);
+ nick.AppendFormat(L"%d", blob.get_uin());
}
if (!nick.IsEmpty())
nick = L"(" + nick + L")";
if (dbei->eventType == EVENTTYPE_AUTHREQUEST) {
- ptrW tszReason(getEventString(dbei, buf));
+ ptrW tszReason(dbei->getString(blob.get_reason()));
text.Format(TranslateT("Authorization request from %s%s: %s"),
- (tszNick == NULL) ? cli.pfnGetContactDisplayName(hContact, 0) : tszNick, nick, tszReason);
+ (tszNick == NULL) ? cli.pfnGetContactDisplayName(blob.get_contact(), 0) : tszNick, nick, tszReason);
}
else text.Format(TranslateT("You were added by %s%s"),
- (tszNick == NULL) ? cli.pfnGetContactDisplayName(hContact, 0) : tszNick, nick);
+ (tszNick == NULL) ? cli.pfnGetContactDisplayName(blob.get_contact(), 0) : tszNick, nick);
return (datatype == DBVT_WCHAR) ? (INT_PTR)mir_wstrdup(text) : (INT_PTR)mir_u2a(text);
}
@@ -267,48 +264,52 @@ MIR_APP_DLL(wchar_t*) DbEvent_GetString(DBEVENTINFO *dbei, const char *str) /////////////////////////////////////////////////////////////////////////////////////////
-MIR_APP_DLL(int) Profile_GetPathA(size_t cbLen, char *pszDest)
+DB_AUTH_BLOB::DB_AUTH_BLOB(MCONTACT hContact, LPCSTR nick, LPCSTR fname, LPCSTR lname, LPCSTR email, LPCSTR reason) :
+ m_hContact(hContact),
+ m_szNick(mir_strdup(nick)),
+ m_szFirstName(mir_strdup(fname)),
+ m_szLastName(mir_strdup(lname)),
+ m_szEmail(mir_strdup(email)),
+ m_szReason(mir_strdup(reason))
{
- if (!pszDest || !cbLen)
- return 1;
-
- strncpy_s(pszDest, cbLen, _T2A(g_profileDir), _TRUNCATE);
- return 0;
+ m_size = DWORD(sizeof(DWORD) * 2 + 5 + mir_strlen(m_szNick) + mir_strlen(m_szFirstName) + mir_strlen(m_szLastName) + mir_strlen(m_szEmail) + mir_strlen(m_szReason));
}
-MIR_APP_DLL(int) Profile_GetPathW(size_t cbLen, wchar_t *pwszDest)
+DB_AUTH_BLOB::DB_AUTH_BLOB(PBYTE blob)
{
- if (!pwszDest || !cbLen)
- return 1;
-
- wcsncpy_s(pwszDest, cbLen, g_profileDir, _TRUNCATE);
- return 0;
+ PBYTE pCurBlob = blob;
+ pCurBlob += sizeof(DWORD);
+ m_hContact = *(PDWORD)pCurBlob;
+ pCurBlob += sizeof(DWORD);
+ m_szNick = mir_strdup((char*)pCurBlob); pCurBlob += mir_strlen((char*)pCurBlob) + 1;
+ m_szFirstName = mir_strdup((char*)pCurBlob); pCurBlob += mir_strlen((char*)pCurBlob) + 1;
+ m_szLastName = mir_strdup((char*)pCurBlob); pCurBlob += mir_strlen((char*)pCurBlob) + 1;
+ m_szEmail = mir_strdup((char*)pCurBlob); pCurBlob += mir_strlen((char*)pCurBlob) + 1;
+ m_szReason = mir_strdup((char*)pCurBlob); pCurBlob += mir_strlen((char*)pCurBlob) + 1;
+ m_size = DWORD(pCurBlob - blob);
}
-/////////////////////////////////////////////////////////////////////////////////////////
-
-MIR_APP_DLL(int) Profile_GetNameA(size_t cbLen, char *pszDest)
+DB_AUTH_BLOB::~DB_AUTH_BLOB()
{
- if (!cbLen || !pszDest)
- return 1;
-
- strncpy_s(pszDest, cbLen, ptrA(makeFileName(g_profileName)), _TRUNCATE);
- return 0;
}
-MIR_APP_DLL(int) Profile_GetNameW(size_t cbLen, wchar_t *pwszDest)
+PBYTE DB_AUTH_BLOB::makeBlob()
{
- if (!cbLen || !pwszDest)
- return 1;
-
- wcsncpy_s(pwszDest, cbLen, g_profileName, _TRUNCATE);
- return 0;
+ PBYTE pBlob, pCurBlob;
+ pCurBlob = pBlob = (PBYTE)mir_alloc(m_size + 1);
+
+ *((PDWORD)pCurBlob) = 0;
+ pCurBlob += sizeof(DWORD);
+ *((PDWORD)pCurBlob) = (DWORD)m_hContact;
+ pCurBlob += sizeof(DWORD);
+
+ mir_snprintf((char*)pCurBlob, m_size - 8, "%s%c%s%c%s%c%s%c%s%c",
+ (m_szNick) ? m_szNick : "", 0,
+ (m_szFirstName) ? m_szFirstName : "", 0,
+ (m_szLastName) ? m_szLastName : "", 0,
+ (m_szEmail) ? m_szEmail : "", 0,
+ (m_szReason) ? m_szReason : 0);
+
+ return pBlob;
}
-/////////////////////////////////////////////////////////////////////////////////////////
-
-MIR_APP_DLL(void) Profile_SetDefault(const wchar_t *pwszPath)
-{
- extern wchar_t* g_defaultProfile;
- replaceStrW(g_defaultProfile, pwszPath);
-}
diff --git a/src/mir_app/src/db_util.cpp b/src/mir_app/src/db_util.cpp new file mode 100644 index 0000000000..d9eb2736f5 --- /dev/null +++ b/src/mir_app/src/db_util.cpp @@ -0,0 +1,73 @@ +/* + +Miranda NG: the free IM client for Microsoft* Windows* + +Copyright (C) 2012-17 Miranda NG project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +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; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; 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. +*/ + +#include "stdafx.h" +#include "profilemanager.h" + +///////////////////////////////////////////////////////////////////////////////////////// + +MIR_APP_DLL(int) Profile_GetPathA(size_t cbLen, char *pszDest) +{ + if (!pszDest || !cbLen) + return 1; + + strncpy_s(pszDest, cbLen, _T2A(g_profileDir), _TRUNCATE); + return 0; +} + +MIR_APP_DLL(int) Profile_GetPathW(size_t cbLen, wchar_t *pwszDest) +{ + if (!pwszDest || !cbLen) + return 1; + + wcsncpy_s(pwszDest, cbLen, g_profileDir, _TRUNCATE); + return 0; +} + +///////////////////////////////////////////////////////////////////////////////////////// + +MIR_APP_DLL(int) Profile_GetNameA(size_t cbLen, char *pszDest) +{ + if (!cbLen || !pszDest) + return 1; + + strncpy_s(pszDest, cbLen, ptrA(makeFileName(g_profileName)), _TRUNCATE); + return 0; +} + +MIR_APP_DLL(int) Profile_GetNameW(size_t cbLen, wchar_t *pwszDest) +{ + if (!cbLen || !pwszDest) + return 1; + + wcsncpy_s(pwszDest, cbLen, g_profileName, _TRUNCATE); + return 0; +} + +///////////////////////////////////////////////////////////////////////////////////////// + +MIR_APP_DLL(void) Profile_SetDefault(const wchar_t *pwszPath) +{ + extern wchar_t* g_defaultProfile; + replaceStrW(g_defaultProfile, pwszPath); +} diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index cf2ce8a022..5fb730b3d6 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -380,3 +380,18 @@ Netlib_SetHttpProxyInfo @380 Netlib_DestroySecurityProvider @381
Netlib_InitSecurityProvider @382
Netlib_NtlmCreateResponse @383
+??0DB_AUTH_BLOB@@QAE@IPBD0000@Z @384 NONAME
+??0DB_AUTH_BLOB@@QAE@PAE@Z @385 NONAME
+??1DB_AUTH_BLOB@@QAE@XZ @386 NONAME
+??4DB_AUTH_BLOB@@QAEAAV0@ABV0@@Z @387 NONAME
+??BDB_AUTH_BLOB@@QAEPADXZ @388 NONAME
+??BDB_AUTH_BLOB@@QAEPAEXZ @389 NONAME
+?get_contact@DB_AUTH_BLOB@@QBEIXZ @390 NONAME
+?get_email@DB_AUTH_BLOB@@QBEPBDXZ @391 NONAME
+?get_firstName@DB_AUTH_BLOB@@QBEPBDXZ @392 NONAME
+?get_lastName@DB_AUTH_BLOB@@QBEPBDXZ @393 NONAME
+?get_nick@DB_AUTH_BLOB@@QBEPBDXZ @394 NONAME
+?get_reason@DB_AUTH_BLOB@@QBEPBDXZ @395 NONAME
+?get_uin@DB_AUTH_BLOB@@QBEKXZ @396 NONAME
+?makeBlob@DB_AUTH_BLOB@@AAEPAEXZ @397 NONAME
+?size@DB_AUTH_BLOB@@QBEKXZ @398 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index ba931ff6bc..c239ba0fec 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -380,3 +380,18 @@ Netlib_SetHttpProxyInfo @380 Netlib_DestroySecurityProvider @381
Netlib_InitSecurityProvider @382
Netlib_NtlmCreateResponse @383
+??0DB_AUTH_BLOB@@QEAA@IPEBD0000@Z @384 NONAME
+??0DB_AUTH_BLOB@@QEAA@PEAE@Z @385 NONAME
+??1DB_AUTH_BLOB@@QEAA@XZ @386 NONAME
+??4DB_AUTH_BLOB@@QEAAAEAV0@AEBV0@@Z @387 NONAME
+??BDB_AUTH_BLOB@@QEAAPEADXZ @388 NONAME
+??BDB_AUTH_BLOB@@QEAAPEAEXZ @389 NONAME
+?get_contact@DB_AUTH_BLOB@@QEBAIXZ @390 NONAME
+?get_email@DB_AUTH_BLOB@@QEBAPEBDXZ @391 NONAME
+?get_firstName@DB_AUTH_BLOB@@QEBAPEBDXZ @392 NONAME
+?get_lastName@DB_AUTH_BLOB@@QEBAPEBDXZ @393 NONAME
+?get_nick@DB_AUTH_BLOB@@QEBAPEBDXZ @394 NONAME
+?get_reason@DB_AUTH_BLOB@@QEBAPEBDXZ @395 NONAME
+?get_uin@DB_AUTH_BLOB@@QEBAKXZ @396 NONAME
+?makeBlob@DB_AUTH_BLOB@@AEAAPEAEXZ @397 NONAME
+?size@DB_AUTH_BLOB@@QEBAKXZ @398 NONAME
diff --git a/src/mir_app/src/netlib.cpp b/src/mir_app/src/netlib.cpp index 4405f265e5..d9531f8156 100644 --- a/src/mir_app/src/netlib.cpp +++ b/src/mir_app/src/netlib.cpp @@ -316,7 +316,7 @@ MIR_APP_DLL(int) Netlib_CloseHandle(HANDLE hNetlib) /////////////////////////////////////////////////////////////////////////////////////////
-MIR_APP_DLL(UINT_PTR) Netlib_GetSocket(HANDLE hConnection)
+MIR_APP_DLL(UINT_PTR) Netlib_GetSocket(HNETLIBCONN hConnection)
{
SOCKET s;
if (hConnection == 0) {
|