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 /protocols/SkypeWeb | |
parent | e021b02022a37bd23b599801026d631f5fd9f48c (diff) |
DB_AUTH_BLOB: handy piece of code moved into the core
Diffstat (limited to 'protocols/SkypeWeb')
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.cpp | 2 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_utils.h | 58 |
2 files changed, 1 insertions, 59 deletions
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;
|