summaryrefslogtreecommitdiff
path: root/protocols/IcqOscarJ/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-06-29 12:24:18 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-06-29 12:24:18 +0000
commit4530fb627722a4c2018184dcdaea7fa9f44c10d7 (patch)
tree3ae98b2130d2f77bbb7fc3840a67b8bae6a6fb39 /protocols/IcqOscarJ/src
parent9a1218da04b7887c4d7f6e88e0a33aea76b12f57 (diff)
- fixes #646 (Database Encryption mode, ICQ and email contacts);
- code cleaning; git-svn-id: http://svn.miranda-ng.org/main/trunk@9614 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/IcqOscarJ/src')
-rw-r--r--protocols/IcqOscarJ/src/capabilities.cpp96
-rw-r--r--protocols/IcqOscarJ/src/cookies.cpp87
-rw-r--r--protocols/IcqOscarJ/src/fam_03buddy.cpp182
-rw-r--r--protocols/IcqOscarJ/src/icq_db.cpp31
-rw-r--r--protocols/IcqOscarJ/src/icq_server.cpp48
5 files changed, 175 insertions, 269 deletions
diff --git a/protocols/IcqOscarJ/src/capabilities.cpp b/protocols/IcqOscarJ/src/capabilities.cpp
index 8a61dc9f44..00b6250a9a 100644
--- a/protocols/IcqOscarJ/src/capabilities.cpp
+++ b/protocols/IcqOscarJ/src/capabilities.cpp
@@ -34,7 +34,6 @@
// -----------------------------------------------------------------------------
#include "icqoscar.h"
-
struct icq_capability
{
DWORD capID; // A bitmask, we use it in order to save database space
@@ -43,14 +42,14 @@ struct icq_capability
static const icq_capability CapabilityRecord[] =
{
- {CAPF_SRV_RELAY, {CAP_SRV_RELAY }},
- {CAPF_UTF, {CAP_UTF }},
- {CAPF_RTF, {CAP_RTF }},
- {CAPF_CONTACTS, {CAP_CONTACTS }},
- {CAPF_TYPING, {CAP_TYPING }},
- {CAPF_ICQDIRECT, {CAP_ICQDIRECT }},
- {CAPF_XTRAZ, {CAP_XTRAZ }},
- {CAPF_OSCAR_FILE,{CAP_OSCAR_FILE}}
+ { CAPF_SRV_RELAY, { CAP_SRV_RELAY }},
+ { CAPF_UTF, { CAP_UTF }},
+ { CAPF_RTF, { CAP_RTF }},
+ { CAPF_CONTACTS, { CAP_CONTACTS }},
+ { CAPF_TYPING, { CAP_TYPING }},
+ { CAPF_ICQDIRECT, { CAP_ICQDIRECT }},
+ { CAPF_XTRAZ, { CAP_XTRAZ }},
+ { CAPF_OSCAR_FILE, { CAP_OSCAR_FILE }}
};
// Mask of all handled capabilities' flags
@@ -66,17 +65,17 @@ struct icq_capability_name
static const icq_capability_name CapabilityNames[] =
{
- {CAPF_SRV_RELAY, "ServerRelay"},
- {CAPF_UTF, "UTF8 Messages"},
- {CAPF_RTF, "RTF Messages"},
- {CAPF_CONTACTS, "Contact Transfer"},
- {CAPF_TYPING, "Typing Notifications"},
- {CAPF_ICQDIRECT, "Direct Connections"},
- {CAPF_XTRAZ, "Xtraz"},
- {CAPF_OSCAR_FILE, "File Transfers"},
- {CAPF_STATUS_MESSAGES,"Individual Status Messages"},
- {CAPF_STATUS_MOOD, "Mood"},
- {CAPF_XSTATUS, "Custom Status"}
+ { CAPF_SRV_RELAY, "ServerRelay"},
+ { CAPF_UTF, "UTF8 Messages"},
+ { CAPF_RTF, "RTF Messages"},
+ { CAPF_CONTACTS, "Contact Transfer"},
+ { CAPF_TYPING, "Typing Notifications"},
+ { CAPF_ICQDIRECT, "Direct Connections"},
+ { CAPF_XTRAZ, "Xtraz"},
+ { CAPF_OSCAR_FILE, "File Transfers"},
+ { CAPF_STATUS_MESSAGES,"Individual Status Messages"},
+ { CAPF_STATUS_MOOD, "Mood"},
+ { CAPF_XSTATUS, "Custom Status"}
};
void NetLog_CapabilityChange(CIcqProto *ppro, const char *szChange, DWORD fdwCapabilities)
@@ -85,11 +84,9 @@ void NetLog_CapabilityChange(CIcqProto *ppro, const char *szChange, DWORD fdwCap
if (!fdwCapabilities) return;
- for (int nIndex = 0; nIndex < SIZEOF(CapabilityNames); nIndex++)
- {
+ for (int nIndex = 0; nIndex < SIZEOF(CapabilityNames); nIndex++) {
// Check if the current capability is present
- if ((fdwCapabilities & CapabilityNames[nIndex].capID) == CapabilityNames[nIndex].capID)
- {
+ if ((fdwCapabilities & CapabilityNames[nIndex].capID) == CapabilityNames[nIndex].capID) {
if (strlennull(szBuffer))
strcat(szBuffer, ", ");
strcat(szBuffer, CapabilityNames[nIndex].capName);
@@ -100,22 +97,18 @@ void NetLog_CapabilityChange(CIcqProto *ppro, const char *szChange, DWORD fdwCap
}
#endif
-
// Deletes all oscar capabilities for a given contact
void CIcqProto::ClearAllContactCapabilities(MCONTACT hContact)
{
setDword(hContact, DBSETTING_CAPABILITIES, 0);
}
-
// Deletes one or many oscar capabilities for a given contact
void CIcqProto::ClearContactCapabilities(MCONTACT hContact, DWORD fdwCapabilities)
{
// Get current capability flags
- DWORD fdwContactCaps = getDword(hContact, DBSETTING_CAPABILITIES, 0);
-
- if (fdwContactCaps != (fdwContactCaps & ~fdwCapabilities))
- {
+ DWORD fdwContactCaps = getDword(hContact, DBSETTING_CAPABILITIES, 0);
+ if (fdwContactCaps != (fdwContactCaps & ~fdwCapabilities)) {
#ifdef _DEBUG
NetLog_CapabilityChange(this, "Removed", fdwCapabilities & fdwContactCaps);
#endif
@@ -127,15 +120,12 @@ void CIcqProto::ClearContactCapabilities(MCONTACT hContact, DWORD fdwCapabilitie
}
}
-
// Sets one or many oscar capabilities for a given contact
void CIcqProto::SetContactCapabilities(MCONTACT hContact, DWORD fdwCapabilities)
{
// Get current capability flags
- DWORD fdwContactCaps = getDword(hContact, DBSETTING_CAPABILITIES, 0);
-
- if (fdwContactCaps != (fdwContactCaps | fdwCapabilities))
- {
+ DWORD fdwContactCaps = getDword(hContact, DBSETTING_CAPABILITIES, 0);
+ if (fdwContactCaps != (fdwContactCaps | fdwCapabilities)) {
#ifdef _DEBUG
NetLog_CapabilityChange(this, "Added", fdwCapabilities & ~fdwContactCaps);
#endif
@@ -147,7 +137,6 @@ void CIcqProto::SetContactCapabilities(MCONTACT hContact, DWORD fdwCapabilities)
}
}
-
// Returns true if the given contact supports the requested capabilites
BOOL CIcqProto::CheckContactCapabilities(MCONTACT hContact, DWORD fdwCapabilities)
{
@@ -165,17 +154,12 @@ BOOL CIcqProto::CheckContactCapabilities(MCONTACT hContact, DWORD fdwCapabilitie
// Scan capability against the capability buffer
capstr* MatchCapability(BYTE *buf, int bufsize, const capstr *cap, int capsize)
{
- while (bufsize >= BINARY_CAP_SIZE) // search the buffer for a capability
- {
+ while (bufsize >= BINARY_CAP_SIZE) { // search the buffer for a capability
if (!memcmp(buf, cap, capsize))
- {
return (capstr*)buf; // give found capability for version info
- }
- else
- {
- buf += BINARY_CAP_SIZE;
- bufsize -= BINARY_CAP_SIZE;
- }
+
+ buf += BINARY_CAP_SIZE;
+ bufsize -= BINARY_CAP_SIZE;
}
return 0;
}
@@ -185,7 +169,6 @@ capstr* MatchCapability(BYTE *buf, int bufsize, const capstr *cap, int capsize)
capstr* MatchShortCapability(BYTE *buf, int bufsize, const shortcapstr *cap)
{
capstr fullCap;
-
memcpy(fullCap, capShortCaps, BINARY_CAP_SIZE);
fullCap[2] = (*cap)[0];
fullCap[3] = (*cap)[1];
@@ -193,7 +176,6 @@ capstr* MatchShortCapability(BYTE *buf, int bufsize, const shortcapstr *cap)
return MatchCapability(buf, bufsize, &fullCap, BINARY_CAP_SIZE);
}
-
// Scans a binary buffer for OSCAR capabilities.
DWORD GetCapabilitiesFromBuffer(BYTE *pBuffer, int nLength)
{
@@ -204,18 +186,15 @@ DWORD GetCapabilitiesFromBuffer(BYTE *pBuffer, int nLength)
// Loop over all capabilities in the buffer and
// compare them to our own record of capabilities
- for (int nIndex = 0; nIndex < nRecordSize; nIndex++)
- {
+ for (int nIndex = 0; nIndex < nRecordSize; nIndex++) {
+ // Match, add capability flag
if (MatchCapability(pBuffer, nLength, &CapabilityRecord[nIndex].capCLSID, BINARY_CAP_SIZE))
- { // Match, add capability flag
fdwCaps |= CapabilityRecord[nIndex].capID;
- }
}
return fdwCaps;
}
-
// Scans a binary buffer for oscar capabilities and adds them to the contact.
// You probably want to call ClearAllContactCapabilities() first.
void CIcqProto::AddCapabilitiesFromBuffer(MCONTACT hContact, BYTE *pBuffer, int nLength)
@@ -225,8 +204,7 @@ void CIcqProto::AddCapabilitiesFromBuffer(MCONTACT hContact, BYTE *pBuffer, int
// Get capability flags from buffer
DWORD fdwCapabilities = GetCapabilitiesFromBuffer(pBuffer, nLength);
- if (fdwContactCaps != (fdwContactCaps | fdwCapabilities))
- {
+ if (fdwContactCaps != (fdwContactCaps | fdwCapabilities)) {
#ifdef _DEBUG
NetLog_CapabilityChange(this, "Added", fdwCapabilities & ~fdwContactCaps);
#endif
@@ -238,7 +216,6 @@ void CIcqProto::AddCapabilitiesFromBuffer(MCONTACT hContact, BYTE *pBuffer, int
}
}
-
// Scans a binary buffer for oscar capabilities and adds them to the contact.
// You probably want to call ClearAllContactCapabilities() first.
void CIcqProto::SetCapabilitiesFromBuffer(MCONTACT hContact, BYTE *pBuffer, int nLength, BOOL bReset)
@@ -251,15 +228,14 @@ void CIcqProto::SetCapabilitiesFromBuffer(MCONTACT hContact, BYTE *pBuffer, int
#ifdef _DEBUG
if (bReset)
NetLog_CapabilityChange(this, "Set", fdwCapabilities);
- else
- {
+ else {
NetLog_CapabilityChange(this, "Removed", fdwContactCaps & ~fdwCapabilities & CapabilityFlagsMask);
- NetLog_CapabilityChange(this, "Added", fdwCapabilities & ~fdwContactCaps);
+ NetLog_CapabilityChange(this, "Added", fdwCapabilities & ~fdwContactCaps);
}
#endif
- if (fdwCapabilities != (fdwContactCaps & ~CapabilityFlagsMask))
- { // Get current unmanaged capability flags
+ if (fdwCapabilities != (fdwContactCaps & ~CapabilityFlagsMask)) {
+ // Get current unmanaged capability flags
fdwContactCaps &= ~CapabilityFlagsMask;
// Add capability flags from buffer
diff --git a/protocols/IcqOscarJ/src/cookies.cpp b/protocols/IcqOscarJ/src/cookies.cpp
index 7ede14d96f..750b6280c5 100644
--- a/protocols/IcqOscarJ/src/cookies.cpp
+++ b/protocols/IcqOscarJ/src/cookies.cpp
@@ -27,8 +27,8 @@
// Handles packet & message cookies
//
// -----------------------------------------------------------------------------
-#include "icqoscar.h"
+#include "icqoscar.h"
#define INVALID_COOKIE_INDEX -1
@@ -36,19 +36,15 @@ void CIcqProto::RemoveExpiredCookies()
{
time_t tNow = time(NULL);
- for (int i = cookies.getCount()-1; i >= 0; i--)
- {
+ for (int i = cookies.getCount() - 1; i >= 0; i--) {
icq_cookie_info *cookie = cookies[i];
-
- if ((cookie->dwTime + COOKIE_TIMEOUT) < tNow)
- {
+ if ((cookie->dwTime + COOKIE_TIMEOUT) < tNow) {
cookies.remove(i);
SAFE_FREE((void**)&cookie);
}
}
}
-
// Generate and allocate cookie
DWORD CIcqProto::AllocateCookie(BYTE bType, WORD wIdent, MCONTACT hContact, void *pvExtra)
{
@@ -56,11 +52,10 @@ DWORD CIcqProto::AllocateCookie(BYTE bType, WORD wIdent, MCONTACT hContact, void
DWORD dwThisSeq = wCookieSeq++;
dwThisSeq &= 0x7FFF;
- dwThisSeq |= wIdent<<0x10;
+ dwThisSeq |= wIdent << 0x10;
icq_cookie_info* p = (icq_cookie_info*)SAFE_MALLOC(sizeof(icq_cookie_info));
- if (p)
- {
+ if (p) {
p->bType = bType;
p->dwCookie = dwThisSeq;
p->hContact = hContact;
@@ -71,31 +66,27 @@ DWORD CIcqProto::AllocateCookie(BYTE bType, WORD wIdent, MCONTACT hContact, void
return dwThisSeq;
}
-
DWORD CIcqProto::GenerateCookie(WORD wIdent)
{
icq_lock l(cookieMutex);
DWORD dwThisSeq = wCookieSeq++;
dwThisSeq &= 0x7FFF;
- dwThisSeq |= wIdent<<0x10;
-
+ dwThisSeq |= wIdent << 0x10;
return dwThisSeq;
}
-
int CIcqProto::GetCookieType(DWORD dwCookie)
{
icq_lock l(cookieMutex);
- int i = cookies.getIndex(( icq_cookie_info* )&dwCookie );
- if ( i != INVALID_COOKIE_INDEX )
+ int i = cookies.getIndex((icq_cookie_info*)&dwCookie);
+ if (i != INVALID_COOKIE_INDEX)
i = cookies[i]->bType;
return i;
}
-
int CIcqProto::FindCookie(DWORD dwCookie, MCONTACT *phContact, void **ppvExtra)
{
icq_lock l(cookieMutex);
@@ -114,15 +105,12 @@ int CIcqProto::FindCookie(DWORD dwCookie, MCONTACT *phContact, void **ppvExtra)
return 0;
}
-
int CIcqProto::FindCookieByData(void *pvExtra, DWORD *pdwCookie, MCONTACT *phContact)
{
icq_lock l(cookieMutex);
- for (int i = 0; i < cookies.getCount(); i++)
- {
- if (pvExtra == cookies[i]->pvExtra)
- {
+ for (int i = 0; i < cookies.getCount(); i++) {
+ if (pvExtra == cookies[i]->pvExtra) {
if (phContact)
*phContact = cookies[i]->hContact;
if (pdwCookie)
@@ -136,15 +124,12 @@ int CIcqProto::FindCookieByData(void *pvExtra, DWORD *pdwCookie, MCONTACT *phCon
return 0;
}
-
int CIcqProto::FindCookieByType(BYTE bType, DWORD *pdwCookie, MCONTACT *phContact, void** ppvExtra)
{
icq_lock l(cookieMutex);
- for (int i = 0; i < cookies.getCount(); i++)
- {
- if (bType == cookies[i]->bType)
- {
+ for (int i = 0; i < cookies.getCount(); i++) {
+ if (bType == cookies[i]->bType) {
if (pdwCookie)
*pdwCookie = cookies[i]->dwCookie;
if (phContact)
@@ -160,19 +145,16 @@ int CIcqProto::FindCookieByType(BYTE bType, DWORD *pdwCookie, MCONTACT *phContac
return 0;
}
-
int CIcqProto::FindMessageCookie(DWORD dwMsgID1, DWORD dwMsgID2, DWORD *pdwCookie, MCONTACT *phContact, cookie_message_data **ppvExtra)
{
icq_lock l(cookieMutex);
- for (int i = 0; i < cookies.getCount(); i++)
- {
- if (cookies[i]->bType == CKT_MESSAGE || cookies[i]->bType == CKT_FILE || cookies[i]->bType == CKT_REVERSEDIRECT)
- { // message cookie found
+ for (int i = 0; i < cookies.getCount(); i++) {
+ if (cookies[i]->bType == CKT_MESSAGE || cookies[i]->bType == CKT_FILE || cookies[i]->bType == CKT_REVERSEDIRECT) {
+ // message cookie found
cookie_message_data *pCookie = (cookie_message_data*)cookies[i]->pvExtra;
- if (pCookie->dwMsgID1 == dwMsgID1 && pCookie->dwMsgID2 == dwMsgID2)
- {
+ if (pCookie->dwMsgID1 == dwMsgID1 && pCookie->dwMsgID2 == dwMsgID2) {
if (phContact)
*phContact = cookies[i]->hContact;
if (pdwCookie)
@@ -189,14 +171,13 @@ int CIcqProto::FindMessageCookie(DWORD dwMsgID1, DWORD dwMsgID2, DWORD *pdwCooki
return 0;
}
-
void CIcqProto::FreeCookie(DWORD dwCookie)
{
icq_lock l(cookieMutex);
int i = cookies.getIndex((icq_cookie_info*)&dwCookie);
- if (i != INVALID_COOKIE_INDEX)
- { // Cookie found, remove from list
+ if (i != INVALID_COOKIE_INDEX) {
+ // Cookie found, remove from list
icq_cookie_info *cookie = cookies[i];
cookies.remove(i);
@@ -206,17 +187,14 @@ void CIcqProto::FreeCookie(DWORD dwCookie)
RemoveExpiredCookies();
}
-
void CIcqProto::FreeCookieByData(BYTE bType, void *pvExtra)
{
icq_lock l(cookieMutex);
- for (int i = 0; i < cookies.getCount(); i++)
- {
+ for (int i = 0; i < cookies.getCount(); i++) {
icq_cookie_info *cookie = cookies[i];
-
- if (bType == cookie->bType && pvExtra == cookie->pvExtra)
- { // Cookie found, remove from list
+ if (bType == cookie->bType && pvExtra == cookie->pvExtra) {
+ // Cookie found, remove from list
cookies.remove(i);
SAFE_FREE((void**)&cookie);
break;
@@ -226,14 +204,13 @@ void CIcqProto::FreeCookieByData(BYTE bType, void *pvExtra)
RemoveExpiredCookies();
}
-
void CIcqProto::ReleaseCookie(DWORD dwCookie)
{
icq_lock l(cookieMutex);
int i = cookies.getIndex(( icq_cookie_info* )&dwCookie );
- if (i != INVALID_COOKIE_INDEX)
- { // Cookie found, remove from list
+ if (i != INVALID_COOKIE_INDEX) {
+ // Cookie found, remove from list
icq_cookie_info *cookie = cookies[i];
cookies.remove(i);
@@ -243,31 +220,28 @@ void CIcqProto::ReleaseCookie(DWORD dwCookie)
RemoveExpiredCookies();
}
-
void CIcqProto::InitMessageCookie(cookie_message_data *pCookie)
{
DWORD dwMsgID1;
DWORD dwMsgID2;
- do
- { // ensure that message ids are unique
+ do {
+ // ensure that message ids are unique
dwMsgID1 = time(NULL);
dwMsgID2 = RandRange(0, 0x0FFFF);
- } while (FindMessageCookie(dwMsgID1, dwMsgID2, NULL, NULL, NULL));
+ }
+ while (FindMessageCookie(dwMsgID1, dwMsgID2, NULL, NULL, NULL));
- if (pCookie)
- {
+ if (pCookie) {
pCookie->dwMsgID1 = dwMsgID1;
pCookie->dwMsgID2 = dwMsgID2;
}
}
-
cookie_message_data* CIcqProto::CreateMessageCookie(WORD bMsgType, BYTE bAckType)
{
cookie_message_data *pCookie = (cookie_message_data*)SAFE_MALLOC(sizeof(cookie_message_data));
- if (pCookie)
- {
+ if (pCookie) {
pCookie->bMessageType = bMsgType;
pCookie->nAckType = bAckType;
@@ -276,7 +250,6 @@ cookie_message_data* CIcqProto::CreateMessageCookie(WORD bMsgType, BYTE bAckType
return pCookie;
}
-
cookie_message_data* CIcqProto::CreateMessageCookieData(BYTE bMsgType, MCONTACT hContact, DWORD dwUin, int bUseSrvRelay)
{
BYTE bAckType;
@@ -292,7 +265,7 @@ cookie_message_data* CIcqProto::CreateMessageCookieData(BYTE bMsgType, MCONTACT
cookie_message_data* pCookieData = CreateMessageCookie(bMsgType, bAckType);
// set flag for offline messages - to allow proper error handling
- if (wStatus == ID_STATUS_OFFLINE || wStatus == ID_STATUS_INVISIBLE)
+ if (wStatus == ID_STATUS_OFFLINE || wStatus == ID_STATUS_INVISIBLE)
pCookieData->isOffline = TRUE;
return pCookieData;
diff --git a/protocols/IcqOscarJ/src/fam_03buddy.cpp b/protocols/IcqOscarJ/src/fam_03buddy.cpp
index bf1a5ff66e..06783be2df 100644
--- a/protocols/IcqOscarJ/src/fam_03buddy.cpp
+++ b/protocols/IcqOscarJ/src/fam_03buddy.cpp
@@ -34,8 +34,7 @@ extern const char* cliSpamBot;
void CIcqProto::handleBuddyFam(BYTE *pBuffer, WORD wBufferLength, snac_header *pSnacHeader, serverthread_info *info)
{
- switch (pSnacHeader->wSubtype)
- {
+ switch (pSnacHeader->wSubtype) {
case ICQ_USER_ONLINE:
handleUserOnline(pBuffer, wBufferLength, info);
break;
@@ -58,12 +57,12 @@ void CIcqProto::handleBuddyFam(BYTE *pBuffer, WORD wBufferLength, snac_header *p
if (wBufferLength >= 2)
unpackWord(&pBuffer, &wError);
- else
+ else
wError = 0;
LogFamilyError(ICQ_BUDDY_FAMILY, wError);
- break;
}
+ break;
default:
debugLogA("Warning: Ignoring SNAC(x%02x,x%02x) - Unknown SNAC (Flags: %u, Ref: %u)", ICQ_BUDDY_FAMILY, pSnacHeader->wSubtype, pSnacHeader->wFlags, pSnacHeader->dwRef);
@@ -75,9 +74,7 @@ void CIcqProto::handleBuddyFam(BYTE *pBuffer, WORD wBufferLength, snac_header *p
void CIcqProto::handleReplyBuddy(BYTE *buf, WORD wPackLen)
{
oscar_tlv_chain *pChain = readIntoTLVChain(&buf, wPackLen, 0);
-
- if (pChain)
- {
+ if (pChain) {
DWORD wMaxUins = pChain->getWord(1, 1);
DWORD wMaxWatchers = pChain->getWord(2, 1);
DWORD wMaxTemporary = pChain->getWord(4, 1);
@@ -88,30 +85,25 @@ void CIcqProto::handleReplyBuddy(BYTE *buf, WORD wPackLen)
disposeChain(&pChain);
}
- else
- {
- debugLogA("Error: Malformed BuddyReply");
- }
+ else debugLogA("Error: Malformed BuddyReply");
}
int unpackSessionDataItem(oscar_tlv_chain *pChain, WORD wItemType, BYTE **ppItemData, WORD *pwItemSize, BYTE *pbItemFlags)
{
- oscar_tlv *tlv = pChain->getTLV(0x1D, 1);
int len = 0;
BYTE *data;
- if (tlv)
- {
+ oscar_tlv *tlv = pChain->getTLV(0x1D, 1);
+ if (tlv) {
len = tlv->wLen;
data = tlv->pData;
}
- while (len >= 4)
- { // parse session data items one by one
+ while (len >= 4) {
+ // parse session data items one by one
WORD itemType;
- BYTE itemFlags;
- BYTE itemLen;
+ BYTE itemFlags, itemLen;
unpackWord(&data, &itemType);
unpackByte(&data, &itemFlags);
@@ -122,8 +114,8 @@ int unpackSessionDataItem(oscar_tlv_chain *pChain, WORD wItemType, BYTE **ppItem
if (itemLen > len)
itemLen = len;
- if (itemType == wItemType)
- { // found the requested item
+ if (itemType == wItemType) {
+ // found the requested item
if (ppItemData)
*ppItemData = data;
if (pwItemSize)
@@ -181,7 +173,8 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info)
char szStrBuf[MAX_PATH];
// Unpack the sender's user ID
- if (!unpackUID(&buf, &wLen, &dwUIN, &szUID)) return;
+ if (!unpackUID(&buf, &wLen, &dwUIN, &szUID))
+ return;
// Syntax check
if (wLen < 4)
@@ -197,8 +190,7 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info)
// Ignore status notification if the user is not already on our list
MCONTACT hContact = HContactFromUID(dwUIN, szUID, NULL);
- if (hContact == INVALID_CONTACT_ID)
- {
+ if (hContact == INVALID_CONTACT_ID) {
#ifdef _DEBUG
debugLogA("Ignoring user online (%s)", strUID(dwUIN, szUID));
#endif
@@ -221,12 +213,10 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info)
WORD wClass = pChain->getWord(0x01, 1);
int nIsICQ = wClass & CLASS_ICQ;
- if (dwUIN)
- {
+ if (dwUIN) {
// Get DC info TLV
pTLV = pChain->getTLV(0x0C, 1);
- if (pTLV && (pTLV->wLen >= 15))
- {
+ if (pTLV && (pTLV->wLen >= 15)) {
BYTE *pBuffer = pTLV->pData;
nIsICQ = TRUE;
@@ -240,29 +230,21 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info)
pBuffer += 4; // Client features
// Get faked time signatures, used to identify clients
- if (pTLV->wLen >= 0x23)
- {
+ if (pTLV->wLen >= 0x23) {
unpackDWord(&pBuffer, &dwFT1);
unpackDWord(&pBuffer, &dwFT2);
unpackDWord(&pBuffer, &dwFT3);
}
}
- else
- {
- // This client doesnt want DCs
- }
// Get Status info TLV
pTLV = pChain->getTLV(0x06, 1);
- if (pTLV && (pTLV->wLen >= 4))
- {
+ if (pTLV && (pTLV->wLen >= 4)) {
BYTE *pBuffer = pTLV->pData;
-
unpackWord(&pBuffer, &wStatusFlags);
unpackWord(&pBuffer, &wStatus);
}
- else if (!nIsICQ)
- {
+ else if (!nIsICQ) {
// Connected thru AIM client, guess by user class
if (wClass & CLASS_AWAY)
wStatus = ID_STATUS_AWAY;
@@ -273,15 +255,13 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info)
wStatusFlags = 0;
}
- else
- {
+ else {
// Huh? No status TLV? Lets guess then...
wStatusFlags = 0;
wStatus = ICQ_STATUS_ONLINE;
}
}
- else
- {
+ else {
nIsICQ = FALSE;
if (wClass & CLASS_AWAY)
@@ -314,11 +294,10 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info)
// Get Idle timer TLV
WORD wIdleTimer = pChain->getWord(0x04, 1);
time_t tIdleTS = 0;
- if (wIdleTimer)
- {
+ if (wIdleTimer) {
time(&tIdleTS);
tIdleTS -= (wIdleTimer*60);
- };
+ }
#ifdef _DEBUG
if (wIdleTimer)
@@ -329,8 +308,7 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info)
#endif
// Check client capabilities
- if (hContact != NULL)
- {
+ if (hContact != NULL) {
wOldStatus = getContactStatus(hContact);
// Collect all Capability info from TLV chain
@@ -349,21 +327,20 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info)
capBuf = (BYTE*)_alloca(capLen + BINARY_CAP_SIZE);
- if (capLen)
- {
+ if (capLen) {
BYTE *pCapability = capBuf;
capLen = 0; // we need to recount that
- if (pFullTLV && (pFullTLV->wLen >= BINARY_CAP_SIZE))
- { // copy classic Capabilities
+ if (pFullTLV && (pFullTLV->wLen >= BINARY_CAP_SIZE)) {
+ // copy classic Capabilities
BYTE *cData = pFullTLV->pData;
int cLen = pFullTLV->wLen;
- while (cLen)
- { // be impervious to duplicates (AOL sends them sometimes)
- if (!capLen || !MatchCapability(capBuf, capLen, (capstr*)cData, BINARY_CAP_SIZE))
- { // not present, add
+ while (cLen) {
+ // be impervious to duplicates (AOL sends them sometimes)
+ if (!capLen || !MatchCapability(capBuf, capLen, (capstr*)cData, BINARY_CAP_SIZE)) {
+ // not present, add
memcpy(pCapability, cData, BINARY_CAP_SIZE);
capLen += BINARY_CAP_SIZE;
pCapability += BINARY_CAP_SIZE;
@@ -373,20 +350,20 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info)
}
}
- if (pShortTLV && (pShortTLV->wLen >= 2))
- { // copy short Capabilities
+ if (pShortTLV && (pShortTLV->wLen >= 2)) {
+ // copy short Capabilities
capstr tmp;
BYTE *cData = pShortTLV->pData;
int cLen = pShortTLV->wLen;
memcpy(tmp, capShortCaps, BINARY_CAP_SIZE);
- while (cLen)
- { // be impervious to duplicates (AOL sends them sometimes)
+ while (cLen) {
+ // be impervious to duplicates (AOL sends them sometimes)
tmp[2] = cData[0];
tmp[3] = cData[1];
- if (!capLen || !MatchCapability(capBuf, capLen, &tmp, BINARY_CAP_SIZE))
- { // not present, add
+ if (!capLen || !MatchCapability(capBuf, capLen, &tmp, BINARY_CAP_SIZE)) {
+ // not present, add
memcpy(pCapability, tmp, BINARY_CAP_SIZE);
capLen += BINARY_CAP_SIZE;
pCapability += BINARY_CAP_SIZE;
@@ -480,25 +457,25 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info)
// Save contacts details in database
if (hContact != NULL) {
- setDword(hContact, "LogonTS", dwOnlineSince);
- setDword(hContact, "AwayTS", dwAwaySince);
- setDword(hContact, "IdleTS", tIdleTS);
+ setDword(hContact, "LogonTS", dwOnlineSince);
+ setDword(hContact, "AwayTS", dwAwaySince);
+ setDword(hContact, "IdleTS", tIdleTS);
if (dwMemberSince)
- setDword(hContact, "MemberTS", dwMemberSince);
+ setDword(hContact, "MemberTS", dwMemberSince);
if (nIsICQ) {
// on AIM these are not used
setDword(hContact, "DirectCookie", dwDirectConnCookie);
- setByte(hContact, "DCType", (BYTE)nTCPFlag);
- setWord(hContact, "UserPort", (WORD)(dwPort & 0xffff));
- setWord(hContact, "Version", wVersion);
+ setByte(hContact, "DCType", (BYTE)nTCPFlag);
+ setWord(hContact, "UserPort", (WORD)(dwPort & 0xffff));
+ setWord(hContact, "Version", wVersion);
}
else {
- delSetting(hContact, "DirectCookie");
- delSetting(hContact, "DCType");
- delSetting(hContact, "UserPort");
- delSetting(hContact, "Version");
+ delSetting(hContact, "DirectCookie");
+ delSetting(hContact, "DCType");
+ delSetting(hContact, "UserPort");
+ delSetting(hContact, "Version");
}
// if no detection, set uknown
@@ -507,19 +484,19 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info)
if (szClient != (char*)-1) {
db_set_utf(hContact, m_szModuleName, "MirVer", szClient);
- setByte(hContact, "ClientID", bClientId);
+ setByte(hContact, "ClientID", bClientId);
}
if (wOldStatus == ID_STATUS_OFFLINE) {
- setDword(hContact, "IP", dwIP);
- setDword(hContact, "RealIP", dwRealIP);
+ setDword(hContact, "IP", dwIP);
+ setDword(hContact, "RealIP", dwRealIP);
}
else {
// if not first notification only write significant information
if (dwIP)
- setDword(hContact, "IP", dwIP);
+ setDword(hContact, "IP", dwIP);
if (dwRealIP)
- setDword(hContact, "RealIP", dwRealIP);
+ setDword(hContact, "RealIP", dwRealIP);
}
setWord(hContact, "Status", (WORD)IcqStatusToMiranda(wStatus));
@@ -584,8 +561,7 @@ void CIcqProto::handleUserOffline(BYTE *buf, WORD wLen)
wLen -= 4;
// Skip the TLV chain
- while (wTLVCount && wLen >= 4)
- {
+ while (wTLVCount && wLen >= 4) {
WORD wTLVType;
WORD wTLVLen;
@@ -594,20 +570,19 @@ void CIcqProto::handleUserOffline(BYTE *buf, WORD wLen)
wLen -= 4;
// stop parsing overflowed packet
- if (wTLVLen > wLen)
- {
+ if (wTLVLen > wLen) {
disposeChain(&pChain);
return;
}
- if (wTLVType == 0x1D)
- { // read only TLV with Session data into chain
+ if (wTLVType == 0x1D) {
+ // read only TLV with Session data into chain
BYTE *pTLV = buf - 4;
disposeChain(&pChain);
pChain = readIntoTLVChain(&pTLV, wLen + 4, 1);
}
- else if (wTLVType == 0x29 && wTLVLen == sizeof(DWORD))
- { // get Away Since value
+ else if (wTLVType == 0x29 && wTLVLen == sizeof(DWORD)) {
+ // get Away Since value
BYTE *pData = buf;
unpackDWord(&pData, &dwAwaySince);
}
@@ -621,8 +596,7 @@ void CIcqProto::handleUserOffline(BYTE *buf, WORD wLen)
MCONTACT hContact = HContactFromUID(dwUIN, szUID, NULL);
// Skip contacts that are not already on our list or are already offline
- if (hContact != INVALID_CONTACT_ID)
- {
+ if (hContact != INVALID_CONTACT_ID) {
WORD wOldStatus = getContactStatus(hContact);
// Process Avatar Hash
@@ -643,8 +617,7 @@ void CIcqProto::handleUserOffline(BYTE *buf, WORD wLen)
char tmp = NULL;
handleXStatusCaps(dwUIN, szUID, hContact, (BYTE*)&tmp, 0, &tmp, 0);
- if (wOldStatus != ID_STATUS_OFFLINE)
- {
+ if (wOldStatus != ID_STATUS_OFFLINE) {
debugLogA("%s went offline.", strUID(dwUIN, szUID));
setWord(hContact, "Status", ID_STATUS_OFFLINE);
@@ -677,12 +650,10 @@ void CIcqProto::parseStatusNote(DWORD dwUin, char *szUid, MCONTACT hContact, osc
unpackDWord(&pStatusNoteTS, &dwStatusNoteTS);
// Get Status Note session item
- if (unpackSessionDataItem(pChain, 0x02, &pStatusNote, &wStatusNoteLen, &bStatusNoteFlags))
- {
+ if (unpackSessionDataItem(pChain, 0x02, &pStatusNote, &wStatusNoteLen, &bStatusNoteFlags)) {
char *szStatusNote = NULL;
- if ((bStatusNoteFlags & 4) == 4 && wStatusNoteLen >= 4)
- {
+ if ((bStatusNoteFlags & 4) == 4 && wStatusNoteLen >= 4) {
BYTE *buf = pStatusNote;
WORD buflen = wStatusNoteLen - 2;
WORD wTextLen;
@@ -691,8 +662,7 @@ void CIcqProto::parseStatusNote(DWORD dwUin, char *szUid, MCONTACT hContact, osc
if (wTextLen > buflen)
wTextLen = buflen;
- if (wTextLen > 0)
- {
+ if (wTextLen > 0) {
szStatusNote = (char*)_alloca(wStatusNoteLen + 1);
unpackString(&buf, szStatusNote, wTextLen);
szStatusNote[wTextLen] = '\0';
@@ -704,8 +674,8 @@ void CIcqProto::parseStatusNote(DWORD dwUin, char *szUid, MCONTACT hContact, osc
if (buflen >= 2)
unpackWord(&buf, &wEncodingType);
- if (wEncodingType == 1 && buflen > 6)
- { // Encoding specified
+ if (wEncodingType == 1 && buflen > 6) {
+ // Encoding specified
buf += 2;
buflen -= 2;
unpackWord(&buf, &wTextLen);
@@ -722,8 +692,7 @@ void CIcqProto::parseStatusNote(DWORD dwUin, char *szUid, MCONTACT hContact, osc
}
}
// Check if the status note was changed
- if (dwStatusNoteTS > getDword(hContact, DBSETTING_STATUS_NOTE_TIME, 0))
- {
+ if (dwStatusNoteTS > getDword(hContact, DBSETTING_STATUS_NOTE_TIME, 0)) {
DBVARIANT dbv = {DBVT_DELETED};
if (strlennull(szStatusNote) || (!getString(hContact, DBSETTING_STATUS_NOTE, &dbv) && (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_UTF8) && strlennull(dbv.pszVal)))
@@ -740,25 +709,20 @@ void CIcqProto::parseStatusNote(DWORD dwUin, char *szUid, MCONTACT hContact, osc
if (getContactXStatus(hContact) != 0 || !CheckContactCapabilities(hContact, CAPF_STATUS_MESSAGES)) {
setStatusMsgVar(hContact, szStatusNote, false);
- TCHAR* tszNote = mir_utf8decodeT(szStatusNote);
+ TCHAR *tszNote = mir_utf8decodeT(szStatusNote);
ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, NULL, (LPARAM)tszNote);
mir_free(tszNote);
}
}
SAFE_FREE(&szStatusNote);
}
- else
- {
- if (getContactStatus(hContact) == ID_STATUS_OFFLINE)
- {
- setStatusMsgVar(hContact, NULL, false);
- delSetting(hContact, DBSETTING_STATUS_NOTE);
- setDword(hContact, DBSETTING_STATUS_NOTE_TIME, dwStatusNoteTS);
- }
+ else if (getContactStatus(hContact) == ID_STATUS_OFFLINE) {
+ setStatusMsgVar(hContact, NULL, false);
+ delSetting(hContact, DBSETTING_STATUS_NOTE);
+ setDword(hContact, DBSETTING_STATUS_NOTE_TIME, dwStatusNoteTS);
}
}
-
void CIcqProto::handleNotifyRejected(BYTE *buf, WORD wPackLen)
{
DWORD dwUIN;
diff --git a/protocols/IcqOscarJ/src/icq_db.cpp b/protocols/IcqOscarJ/src/icq_db.cpp
index e99ffa649f..25250c66fb 100644
--- a/protocols/IcqOscarJ/src/icq_db.cpp
+++ b/protocols/IcqOscarJ/src/icq_db.cpp
@@ -36,7 +36,7 @@ int CIcqProto::getSetting(MCONTACT hContact, const char *szSetting, DBVARIANT *d
double CIcqProto::getSettingDouble(MCONTACT hContact, const char *szSetting, double dDef)
{
- DBVARIANT dbv = {DBVT_DELETED};
+ DBVARIANT dbv = { DBVT_DELETED };
double dRes;
if (getSetting(hContact, szSetting, &dbv))
@@ -58,24 +58,35 @@ DWORD CIcqProto::getContactUin(MCONTACT hContact)
int CIcqProto::getContactUid(MCONTACT hContact, DWORD *pdwUin, uid_str *ppszUid)
{
- DBVARIANT dbv = {DBVT_DELETED};
+ DBVARIANT dbv = { DBVT_DELETED };
int iRes = 1;
*pdwUin = 0;
if (ppszUid) *ppszUid[0] = '\0';
if (!getSetting(hContact, UNIQUEIDSETTING, &dbv)) {
- if (dbv.type == DBVT_DWORD) {
+ switch (dbv.type) {
+ case DBVT_DWORD:
*pdwUin = dbv.dVal;
iRes = 0;
- }
- else if (dbv.type == DBVT_ASCIIZ) {
+ break;
+
+ case DBVT_ASCIIZ:
+ if (ppszUid && m_bAimEnabled) {
+ strcpy(*ppszUid, dbv.pszVal);
+ iRes = 0;
+ }
+ else debugLogA("AOL screennames not accepted");
+ break;
+
+ case DBVT_UTF8:
if (ppszUid && m_bAimEnabled) {
strcpy(*ppszUid, dbv.pszVal);
+ mir_utf8decode(*ppszUid, NULL);
iRes = 0;
}
- else
- debugLogA("AOL screennames not accepted");
+ else debugLogA("AOL screennames not accepted");
+ break;
}
db_free(&dbv);
}
@@ -84,8 +95,8 @@ int CIcqProto::getContactUid(MCONTACT hContact, DWORD *pdwUin, uid_str *ppszUid)
char* CIcqProto::getSettingStringUtf(MCONTACT hContact, const char *szModule, const char *szSetting, char *szDef)
{
- DBVARIANT dbv = {DBVT_DELETED};
- if ( db_get_utf(hContact, szModule, szSetting, &dbv)) {
+ DBVARIANT dbv = { DBVT_DELETED };
+ if (db_get_utf(hContact, szModule, szSetting, &dbv)) {
db_free(&dbv); // for a setting with invalid contents/type
return null_strdup(szDef);
}
@@ -158,7 +169,7 @@ void CIcqProto::setStatusMsgVar(MCONTACT hContact, char* szStatusMsg, bool isAns
char *oldStatusMsg = NULL;
DBVARIANT dbv;
- if ( !db_get_ts(hContact, "CList", "StatusMsg", &dbv)) {
+ if (!db_get_ts(hContact, "CList", "StatusMsg", &dbv)) {
oldStatusMsg = make_utf8_string(dbv.ptszVal);
db_free(&dbv);
}
diff --git a/protocols/IcqOscarJ/src/icq_server.cpp b/protocols/IcqOscarJ/src/icq_server.cpp
index d32369a0c9..b82ebcfa1a 100644
--- a/protocols/IcqOscarJ/src/icq_server.cpp
+++ b/protocols/IcqOscarJ/src/icq_server.cpp
@@ -62,10 +62,8 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam)
SAFE_FREE((void**)&nloc.szHost);
SAFE_FREE((void**)&infoParam);
- if (hServerConn && m_bSecureConnection)
- {
- if (!CallService(MS_NETLIB_STARTSSL, (WPARAM)hServerConn, 0))
- {
+ if (hServerConn && m_bSecureConnection) {
+ if (!CallService(MS_NETLIB_STARTSSL, (WPARAM)hServerConn, 0)) {
icq_LogMessage(LOG_ERROR, LPGEN("Unable to connect to ICQ login server, SSL could not be negotiated"));
SetCurrentStatus(ID_STATUS_OFFLINE);
NetLib_CloseConnection(&hServerConn, TRUE);
@@ -75,8 +73,7 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam)
}
// Login error
- if (hServerConn == NULL)
- {
+ if (hServerConn == NULL) {
DWORD dwError = GetLastError();
SetCurrentStatus(ID_STATUS_OFFLINE);
@@ -91,8 +88,7 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam)
BYTE bConstInternalIP = getByte("ConstRealIP", 0);
info.hDirectBoundPort = NetLib_BindPort(icq_newConnectionReceived, this, &wListenPort, &dwInternalIP);
- if (!info.hDirectBoundPort)
- {
+ if (!info.hDirectBoundPort) {
icq_LogUsingErrorCode(LOG_WARNING, GetLastError(), LPGEN("Miranda was unable to allocate a port to listen for direct peer-to-peer connections between clients. You will be able to use most of the ICQ network without problems but you may be unable to send or receive files.\n\nIf you have a firewall this may be blocking Miranda, in which case you should configure your firewall to leave some ports open and tell Miranda which ports to use in M->Options->ICQ->Network."));
wListenPort = 0;
if (!bConstInternalIP) delSetting("RealIP");
@@ -102,9 +98,8 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam)
}
// Initialize rate limiting queues
- {
+ {
icq_lock l(m_ratesMutex);
-
m_ratesQueue_Request = new rates_queue(this, "request", RML_IDLE_30, RML_IDLE_50, 1);
m_ratesQueue_Response = new rates_queue(this, "response", RML_IDLE_10, RML_IDLE_30, -1);
}
@@ -112,15 +107,13 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam)
// This is the "infinite" loop that receives the packets from the ICQ server
{
int recvResult;
- NETLIBPACKETRECVER packetRecv = {0};
+ NETLIBPACKETRECVER packetRecv = { 0 };
info.hPacketRecver = (HANDLE)CallService(MS_NETLIB_CREATEPACKETRECVER, (WPARAM)hServerConn, 0x2400);
packetRecv.cbSize = sizeof(packetRecv);
packetRecv.dwTimeout = INFINITE;
- while (serverThreadHandle)
- {
- if (info.bReinitRecver)
- { // we reconnected, reinit struct
+ while (serverThreadHandle) {
+ if (info.bReinitRecver) { // we reconnected, reinit struct
info.bReinitRecver = 0;
ZeroMemory(&packetRecv, sizeof(packetRecv));
packetRecv.cbSize = sizeof(packetRecv);
@@ -129,20 +122,17 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam)
recvResult = CallService(MS_NETLIB_GETMOREPACKETS, (WPARAM)info.hPacketRecver, (LPARAM)&packetRecv);
- if (recvResult == 0)
- {
+ if (recvResult == 0) {
debugLogA("Clean closure of server socket");
break;
}
- if (recvResult == SOCKET_ERROR)
- {
+ if (recvResult == SOCKET_ERROR) {
debugLogA("Abortive closure of server socket, error: %d", GetLastError());
break;
}
- if (m_iDesiredStatus == ID_STATUS_OFFLINE)
- { // Disconnect requested, send disconnect packet
+ if (m_iDesiredStatus == ID_STATUS_OFFLINE) { // Disconnect requested, send disconnect packet
icq_sendCloseConnection();
// disconnected upon request
@@ -171,8 +161,7 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam)
// disable auto info-update thread
icq_EnableUserLookup(FALSE);
- if (m_iStatus != ID_STATUS_OFFLINE && m_iDesiredStatus != ID_STATUS_OFFLINE)
- {
+ if (m_iStatus != ID_STATUS_OFFLINE && m_iDesiredStatus != ID_STATUS_OFFLINE) {
if (!info.bLoggedIn)
icq_LogMessage(LOG_FATAL, LPGEN("Connection failed.\nLogin sequence failed for unknown reason.\nTry again later."));
@@ -192,16 +181,11 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam)
StopAvatarThread();
// Offline all contacts
- MCONTACT hContact = db_find_first(m_szModuleName);
- while (hContact)
- {
+ for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
DWORD dwUIN;
uid_str szUID;
-
- if (!getContactUid(hContact, &dwUIN, &szUID))
- {
- if (getContactStatus(hContact) != ID_STATUS_OFFLINE)
- {
+ if (!getContactUid(hContact, &dwUIN, &szUID)) {
+ if (getContactStatus(hContact) != ID_STATUS_OFFLINE) {
char tmp = 0;
setWord(hContact, "Status", ID_STATUS_OFFLINE);
@@ -209,8 +193,6 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam)
handleXStatusCaps(dwUIN, szUID, hContact, (BYTE*)&tmp, 0, &tmp, 0);
}
}
-
- hContact = db_find_next(hContact, m_szModuleName);
}
setDword("LogonTS", 0); // clear logon time