diff options
Diffstat (limited to 'protocols/IcqOscarJ')
-rwxr-xr-x | protocols/IcqOscarJ/icq_proto.cpp | 57 | ||||
-rw-r--r-- | protocols/IcqOscarJ/utilities.cpp | 8 |
2 files changed, 30 insertions, 35 deletions
diff --git a/protocols/IcqOscarJ/icq_proto.cpp b/protocols/IcqOscarJ/icq_proto.cpp index 7df3c037d3..017bfe5482 100755 --- a/protocols/IcqOscarJ/icq_proto.cpp +++ b/protocols/IcqOscarJ/icq_proto.cpp @@ -439,38 +439,37 @@ HANDLE __cdecl CIcqProto::AddToListByEvent( int flags, int iContact, HANDLE hDbE if (strcmpnull(dbei.szModule, m_szModuleName))
return 0; // this event is not ours
- if (dbei.eventType == EVENTTYPE_CONTACTS)
- {
- int i;
- char *pbOffset, *pbEnd;
-
- for (i = 0, pbOffset = (char*)dbei.pBlob, pbEnd = pbOffset + dbei.cbBlob; i <= iContact; i++)
+ switch(dbei.eventType) {
+ case EVENTTYPE_CONTACTS:
{
- pbOffset += strlennull(pbOffset) + 1; // Nick
- if (pbOffset >= pbEnd) break;
- if (i == iContact)
- { // we found the contact, get uid
- if (IsStringUIN((char*)pbOffset))
- uin = atoi((char*)pbOffset);
- else
- {
- uin = 0;
- strcpy(uid, (char*)pbOffset);
+ char *pbOffset = (char*)dbei.pBlob;
+ char *pbEnd = pbOffset + dbei.cbBlob;
+ for (int i = 0; i <= iContact; i++) {
+ pbOffset += strlennull(pbOffset) + 1; // Nick
+ if (pbOffset >= pbEnd) break;
+ if (i == iContact)
+ { // we found the contact, get uid
+ if (IsStringUIN((char*)pbOffset))
+ uin = atoi((char*)pbOffset);
+ else
+ {
+ uin = 0;
+ strcpy(uid, (char*)pbOffset);
+ }
}
+ pbOffset += strlennull(pbOffset) + 1; // Uin
+ if (pbOffset >= pbEnd) break;
}
- pbOffset += strlennull(pbOffset) + 1; // Uin
- if (pbOffset >= pbEnd) break;
}
- }
- else if (dbei.eventType != EVENTTYPE_AUTHREQUEST && dbei.eventType != EVENTTYPE_ADDED)
- {
- return 0;
- }
- else // auth req or added event
- {
- HANDLE hContact = *(HANDLE*)(dbei.pBlob + sizeof(DWORD)); // this sucks - awaiting new auth system
- if (getContactUid(hContact, &uin, &uid))
+ break;
+
+ case EVENTTYPE_AUTHREQUEST:
+ case EVENTTYPE_ADDED:
+ if ( getContactUid( DbGetAuthEventContact(&dbei), &uin, &uid))
return 0;
+
+ default:
+ return 0;
}
if (uin != 0)
@@ -549,7 +548,6 @@ int __cdecl CIcqProto::AuthRecv( HANDLE hContact, PROTORECVEVENT* pre ) return 0;
}
-
////////////////////////////////////////////////////////////////////////////////////////
// PSS_AUTHREQUEST
@@ -1111,8 +1109,7 @@ int __cdecl CIcqProto::RecvContacts( HANDLE hContact, PROTORECVEVENT* pre ) int __cdecl CIcqProto::RecvFile( HANDLE hContact, PROTORECVFILET* evt )
{
- CCSDATA ccs = { hContact, PSR_FILE, 0, ( LPARAM )evt };
- return CallService( MS_PROTO_RECVFILE, 0, ( LPARAM )&ccs );
+ return Proto_RecvFile(hContact, evt);
}
diff --git a/protocols/IcqOscarJ/utilities.cpp b/protocols/IcqOscarJ/utilities.cpp index 4f68ecb535..70f7547108 100644 --- a/protocols/IcqOscarJ/utilities.cpp +++ b/protocols/IcqOscarJ/utilities.cpp @@ -593,12 +593,10 @@ HANDLE CIcqProto::HContactFromUID(DWORD dwUin, const char *szUid, int *Added) HANDLE CIcqProto::HContactFromAuthEvent(HANDLE hEvent)
{
- DBEVENTINFO dbei;
+ DBEVENTINFO dbei = { sizeof(dbei) };
DWORD body[3];
- ZeroMemory(&dbei, sizeof(dbei));
- dbei.cbSize = sizeof(dbei);
- dbei.cbBlob = sizeof(DWORD) + sizeof(HANDLE);
+ dbei.cbBlob = sizeof(DWORD)*2;
dbei.pBlob = (PBYTE)&body;
if (CallService(MS_DB_EVENT_GET, (WPARAM)hEvent, (LPARAM)&dbei))
@@ -610,7 +608,7 @@ HANDLE CIcqProto::HContactFromAuthEvent(HANDLE hEvent) if (strcmpnull(dbei.szModule, m_szModuleName))
return INVALID_HANDLE_VALUE;
- return *(HANDLE*)&body[1]; // this is bad - needs new auth system
+ return DbGetAuthEventContact(&dbei);
}
char *NickFromHandle(HANDLE hContact)
|