summaryrefslogtreecommitdiff
path: root/protocols/IcqOscarJ
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-09-16 11:50:15 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-09-16 11:50:15 +0000
commit5161fd3fe53b85f579cfece81e25b562f1fa56ae (patch)
tree3ac6979cd3774351cb68431da64ca014f1170e98 /protocols/IcqOscarJ
parentce6e5ab03d58151c4eda36d05a8436d337b2d3c0 (diff)
- event code standardization for protocols
- fix for EVENTTYPE_AUTHREQUEST processing - protocols' custom CallService core removed git-svn-id: http://svn.miranda-ng.org/main/trunk@1576 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/IcqOscarJ')
-rwxr-xr-xprotocols/IcqOscarJ/icq_proto.cpp57
-rw-r--r--protocols/IcqOscarJ/utilities.cpp8
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)