diff options
Diffstat (limited to 'protocols/Tlen')
-rw-r--r-- | protocols/Tlen/src/tlen_avatar.cpp | 163 | ||||
-rw-r--r-- | protocols/Tlen/src/tlen_file.cpp | 4 | ||||
-rw-r--r-- | protocols/Tlen/src/tlen_p2p_new.cpp | 6 | ||||
-rw-r--r-- | protocols/Tlen/src/tlen_p2p_old.cpp | 4 | ||||
-rw-r--r-- | protocols/Tlen/src/tlen_picture.cpp | 4 | ||||
-rw-r--r-- | protocols/Tlen/src/tlen_svc.cpp | 12 | ||||
-rw-r--r-- | protocols/Tlen/src/tlen_thread.cpp | 4 | ||||
-rw-r--r-- | protocols/Tlen/src/tlen_voice.cpp | 8 |
8 files changed, 110 insertions, 95 deletions
diff --git a/protocols/Tlen/src/tlen_avatar.cpp b/protocols/Tlen/src/tlen_avatar.cpp index baa05c1f2f..15c352612f 100644 --- a/protocols/Tlen/src/tlen_avatar.cpp +++ b/protocols/Tlen/src/tlen_avatar.cpp @@ -33,8 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void TlenGetAvatarFileName(TlenProtocol *proto, TLEN_LIST_ITEM *item, TCHAR* ptszDest, int cbLen) { - - int tPathLen = mir_sntprintf(ptszDest, cbLen, TEXT("%s\\%S"), VARST( TEXT("%miranda_avatarcache%")), proto->m_szModuleName); + int tPathLen = mir_sntprintf(ptszDest, cbLen, TEXT("%s\\%S"), VARST(TEXT("%miranda_avatarcache%")), proto->m_szModuleName); if (_taccess(ptszDest, 0)) { int ret = CreateDirectoryTreeT(ptszDest); if (ret == 0) @@ -49,7 +48,7 @@ void TlenGetAvatarFileName(TlenProtocol *proto, TLEN_LIST_ITEM *item, TCHAR* pts int format = PA_FORMAT_PNG; - ptszDest[ tPathLen++ ] = '\\'; + ptszDest[tPathLen++] = '\\'; if (item != NULL) format = item->avatarFormat; else if (proto->threadData != NULL) @@ -58,18 +57,19 @@ void TlenGetAvatarFileName(TlenProtocol *proto, TLEN_LIST_ITEM *item, TCHAR* pts format = db_get_dw(NULL, proto->m_szModuleName, "AvatarFormat", PA_FORMAT_UNKNOWN); const TCHAR *tszFileType = ProtoGetAvatarExtension(format); - if ( item != NULL ) - mir_sntprintf(ptszDest + tPathLen, MAX_PATH - tPathLen, TEXT("%S%s"), ptrA( TlenSha1(item->jid)), tszFileType); + if (item != NULL) + mir_sntprintf(ptszDest + tPathLen, MAX_PATH - tPathLen, TEXT("%S%s"), ptrA(TlenSha1(item->jid)), tszFileType); else mir_sntprintf(ptszDest + tPathLen, MAX_PATH - tPathLen, TEXT("%S_avatar%s"), proto->m_szModuleName, tszFileType); } -static void RemoveAvatar(TlenProtocol *proto, MCONTACT hContact) { - TCHAR tFileName[ MAX_PATH ]; - if (hContact == NULL) { +static void RemoveAvatar(TlenProtocol *proto, MCONTACT hContact) +{ + TCHAR tFileName[MAX_PATH]; + if (hContact == NULL) proto->threadData->avatarHash[0] = '\0'; - } - TlenGetAvatarFileName( proto, NULL, tFileName, _countof(tFileName)-1); + + TlenGetAvatarFileName(proto, NULL, tFileName, _countof(tFileName) - 1); DeleteFile(tFileName); db_unset(hContact, "ContactPhoto", "File"); db_unset(hContact, proto->m_szModuleName, "AvatarHash"); @@ -77,7 +77,8 @@ static void RemoveAvatar(TlenProtocol *proto, MCONTACT hContact) { ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0); } -static void SetAvatar(TlenProtocol *proto, MCONTACT hContact, TLEN_LIST_ITEM *item, char *data, int len, DWORD format) { +static void SetAvatar(TlenProtocol *proto, MCONTACT hContact, TLEN_LIST_ITEM *item, char *data, int len, DWORD format) +{ TCHAR filename[MAX_PATH]; char md5[33]; mir_md5_state_t ctx; @@ -86,52 +87,56 @@ static void SetAvatar(TlenProtocol *proto, MCONTACT hContact, TLEN_LIST_ITEM *it if (format == PA_FORMAT_UNKNOWN && len > 4) format = ProtoGetBufferFormat(data); - mir_md5_init( &ctx ); - mir_md5_append( &ctx, ( BYTE* )data, len); - mir_md5_finish( &ctx, ( BYTE* )digest ); + mir_md5_init(&ctx); + mir_md5_append(&ctx, (BYTE*)data, len); + mir_md5_finish(&ctx, (BYTE*)digest); - sprintf( md5, "%08x%08x%08x%08x", (int)htonl(digest[0]), (int)htonl(digest[1]), (int)htonl(digest[2]), (int)htonl(digest[3])); //!!!!!!!!!!!!!! + sprintf(md5, "%08x%08x%08x%08x", (int)htonl(digest[0]), (int)htonl(digest[1]), (int)htonl(digest[2]), (int)htonl(digest[3])); //!!!!!!!!!!!!!! if (item != NULL) { char *hash = item->avatarHash; item->avatarFormat = format; item->avatarHash = mir_strdup(md5); mir_free(hash); - } else { + } + else { proto->threadData->avatarFormat = format; mir_strcpy(proto->threadData->avatarHash, md5); } - TlenGetAvatarFileName(proto, item, filename, _countof(filename)-1); + TlenGetAvatarFileName(proto, item, filename, _countof(filename) - 1); DeleteFile(filename); - FILE *out = _tfopen(filename, TEXT("wb") ); + FILE *out = _tfopen(filename, TEXT("wb")); if (out != NULL) { fwrite(data, len, 1, out); fclose(out); - db_set_ts(hContact, "ContactPhoto", "File", filename ); - db_set_s(hContact, proto->m_szModuleName, "AvatarHash", md5); - db_set_dw(hContact, proto->m_szModuleName, "AvatarFormat", format); - } else { + db_set_ts(hContact, "ContactPhoto", "File", filename); + db_set_s(hContact, proto->m_szModuleName, "AvatarHash", md5); + db_set_dw(hContact, proto->m_szModuleName, "AvatarFormat", format); + } + else { TCHAR buffer[128]; mir_sntprintf(buffer, TranslateT("Cannot save new avatar file \"%s\" Error:\n\t%s (Error: %d)"), filename, _tcserror(errno), errno); PUShowMessageT(buffer, SM_WARNING); proto->debugLog(buffer); return; } - ProtoBroadcastAck( proto->m_szModuleName, hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL , 0); + ProtoBroadcastAck(proto->m_szModuleName, hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0); } -int TlenProcessAvatarNode(TlenProtocol *proto, XmlNode *avatarNode, TLEN_LIST_ITEM *item) { +int TlenProcessAvatarNode(TlenProtocol *proto, XmlNode *avatarNode, TLEN_LIST_ITEM *item) +{ XmlNode *aNode; char *oldHash = NULL; char *md5 = NULL, *type = NULL; MCONTACT hContact = NULL; - if (item != NULL) { - if ((hContact=TlenHContactFromJID(proto, item->jid)) == NULL) return 0; - } - if (item == NULL) { + if (item != NULL) + if ((hContact = TlenHContactFromJID(proto, item->jid)) == NULL) + return 0; + + if (item == NULL) oldHash = proto->threadData->avatarHash; - } else { + else oldHash = item->avatarHash; - } + if (avatarNode != NULL) { aNode = TlenXmlGetChild(avatarNode, "a"); if (aNode != NULL) { @@ -139,6 +144,7 @@ int TlenProcessAvatarNode(TlenProtocol *proto, XmlNode *avatarNode, TLEN_LIST_IT md5 = TlenXmlGetAttrValue(aNode, "md5"); } } + if (md5 != NULL) { /* check contact's avatar hash - md5 */ if (oldHash == NULL || mir_strcmp(oldHash, md5)) { @@ -148,7 +154,8 @@ int TlenProcessAvatarNode(TlenProtocol *proto, XmlNode *avatarNode, TLEN_LIST_IT TlenGetAvatar(proto, hContact); return 1; } - } else { + } + else { /* remove avatar */ if (oldHash != NULL) { if (item != NULL) { @@ -163,14 +170,15 @@ int TlenProcessAvatarNode(TlenProtocol *proto, XmlNode *avatarNode, TLEN_LIST_IT return 0; } -void TlenProcessPresenceAvatar(TlenProtocol *proto, XmlNode *node, TLEN_LIST_ITEM *item) { +void TlenProcessPresenceAvatar(TlenProtocol *proto, XmlNode *node, TLEN_LIST_ITEM *item) +{ MCONTACT hContact=TlenHContactFromJID(proto, item->jid); if (hContact != NULL) TlenProcessAvatarNode(proto, TlenXmlGetChild(node, "avatar"), item); } - -static char *replaceTokens(const char *base, const char *uri, const char *login, const char* token, int type, int access) { +static char *replaceTokens(const char *base, const char *uri, const char *login, const char* token, int type, int access) +{ char *result; int i, l, size; l = (int)mir_strlen(uri); @@ -219,16 +227,16 @@ static char *replaceTokens(const char *base, const char *uri, const char *login, return result; } - static int getAvatarMutex = 0; -typedef struct { +struct TLENGETAVATARTHREADDATA +{ TlenProtocol *proto; MCONTACT hContact; -} TLENGETAVATARTHREADDATA; - -static void TlenGetAvatarThread(void *ptr) { +}; +static void TlenGetAvatarThread(void *ptr) +{ TLEN_LIST_ITEM *item = NULL; TLENGETAVATARTHREADDATA *data = (TLENGETAVATARTHREADDATA *)ptr; MCONTACT hContact = data->hContact; @@ -238,15 +246,17 @@ static void TlenGetAvatarThread(void *ptr) { login = TlenNickFromJID(jid); item = TlenListGetItemPtr(data->proto, LIST_ROSTER, jid); mir_free(jid); - } else { + } + else { if (data->proto->threadData != NULL) login = mir_strdup(data->proto->threadData->username); } + if ((data->proto->threadData != NULL && hContact == NULL) || item != NULL) { DWORD format = PA_FORMAT_UNKNOWN; - if (item != NULL) { + if (item != NULL) item->newAvatarDownloading = TRUE; - } + char *request = replaceTokens(data->proto->threadData->tlenConfig.mailBase, data->proto->threadData->tlenConfig.avatarGet, login, data->proto->threadData->avatarToken, 0, 0); NETLIBHTTPREQUEST req; memset(&req, 0, sizeof(req)); @@ -258,9 +268,9 @@ static void TlenGetAvatarThread(void *ptr) { req.dataLength = 0; req.szUrl = request; NETLIBHTTPREQUEST *resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)data->proto->m_hNetlibUser, (LPARAM)&req); - if (item != NULL) { + if (item != NULL) item->newAvatarDownloading = FALSE; - } + if (resp != NULL) { if (resp->resultCode/100 == 2) { if (resp->dataLength > 0) { @@ -284,41 +294,42 @@ static void TlenGetAvatarThread(void *ptr) { } } SetAvatar(data->proto, hContact, item, resp->pData, resp->dataLength, format); - } else { - RemoveAvatar(data->proto, hContact); } + else RemoveAvatar(data->proto, hContact); } CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp); } mir_free(request); mir_free(login); } - if (hContact == NULL) { + + if (hContact == NULL) getAvatarMutex = 0; - } + mir_free(login); mir_free(data); } -void TlenGetAvatar(TlenProtocol *proto, MCONTACT hContact) { +void TlenGetAvatar(TlenProtocol *proto, MCONTACT hContact) +{ if (hContact == NULL) { - if (getAvatarMutex != 0) { + if (getAvatarMutex != 0) return; - } + getAvatarMutex = 1; } - { - TLENGETAVATARTHREADDATA *data = (TLENGETAVATARTHREADDATA *)mir_alloc(sizeof(TLENGETAVATARTHREADDATA)); - data->proto = proto; - data->hContact = hContact; - forkthread(TlenGetAvatarThread, 0, data); - } + + TLENGETAVATARTHREADDATA *data = (TLENGETAVATARTHREADDATA *)mir_alloc(sizeof(TLENGETAVATARTHREADDATA)); + data->proto = proto; + data->hContact = hContact; + mir_forkthread(TlenGetAvatarThread, data); } -typedef struct { +struct TLENREMOVEAVATARTHREADDATA +{ TlenProtocol *proto; NETLIBHTTPREQUEST *req; -} TLENREMOVEAVATARTHREADDATA; +}; static void TlenRemoveAvatarRequestThread(void *ptr) { TLENREMOVEAVATARTHREADDATA *data = (TLENREMOVEAVATARTHREADDATA*)ptr; @@ -336,15 +347,17 @@ static void TlenRemoveAvatarRequestThread(void *ptr) { } -typedef struct { +struct TLENUPLOADAVATARTHREADDATA +{ TlenProtocol *proto; NETLIBHTTPREQUEST *req; char *data; int length; -} TLENUPLOADAVATARTHREADDATA; +}; -boolean checkUploadAvatarResponse(TlenProtocol *proto, NETLIBHTTPREQUEST *resp){ - if (resp == NULL){ +boolean checkUploadAvatarResponse(TlenProtocol *proto, NETLIBHTTPREQUEST *resp) +{ + if (resp == NULL) { proto->debugLogA("Error while setting avatar on Tlen account (no response)"); PUShowMessageT(TranslateT("Error while setting avatar on Tlen account (no response)"), SM_WARNING); return false; @@ -354,7 +367,7 @@ boolean checkUploadAvatarResponse(TlenProtocol *proto, NETLIBHTTPREQUEST *resp){ PUShowMessageT(TranslateT("Error while setting avatar on Tlen account (invalid response)"), SM_WARNING); return false; } - if (strncmp(resp->pData, "<ok", 3)){ + if (strncmp(resp->pData, "<ok", 3)) { proto->debugLogA("Error while setting avatar on Tlen account: %s", resp->pData); PUShowMessageT(TranslateT("Error while setting avatar on Tlen account"), SM_WARNING); return false; @@ -362,7 +375,8 @@ boolean checkUploadAvatarResponse(TlenProtocol *proto, NETLIBHTTPREQUEST *resp){ return true; } -static void TlenUploadAvatarRequestThread(void *ptr) { +static void TlenUploadAvatarRequestThread(void *ptr) +{ TLENUPLOADAVATARTHREADDATA *data = (TLENUPLOADAVATARTHREADDATA *) ptr; NETLIBHTTPREQUEST *req = data->req; NETLIBHTTPREQUEST *resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)data->proto->m_hNetlibUser, (LPARAM)req); @@ -378,28 +392,29 @@ static void TlenUploadAvatarRequestThread(void *ptr) { mir_free(data); } -void TlenRemoveAvatar(TlenProtocol *proto) { +void TlenRemoveAvatar(TlenProtocol *proto) +{ if (proto->threadData != NULL) { TLENREMOVEAVATARTHREADDATA *data = (TLENREMOVEAVATARTHREADDATA *)mir_alloc(sizeof(TLENREMOVEAVATARTHREADDATA)); NETLIBHTTPREQUEST *req = (NETLIBHTTPREQUEST *)mir_alloc(sizeof(NETLIBHTTPREQUEST)); - data->proto =proto; + data->proto = proto; data->req = req; char *request = replaceTokens(proto->threadData->tlenConfig.mailBase, proto->threadData->tlenConfig.avatarRemove, "", proto->threadData->avatarToken, 0, 0); memset(req, 0, sizeof(NETLIBHTTPREQUEST)); req->cbSize = sizeof(NETLIBHTTPREQUEST); req->requestType = proto->threadData->tlenConfig.avatarGetMthd; req->szUrl = request; - forkthread(TlenRemoveAvatarRequestThread, 0, data); + mir_forkthread(TlenRemoveAvatarRequestThread, data); } } - -void TlenUploadAvatar(TlenProtocol *proto, unsigned char *data, int dataLen, int access) { +void TlenUploadAvatar(TlenProtocol *proto, unsigned char *data, int dataLen, int access) +{ NETLIBHTTPHEADER *headers; unsigned char *buffer; if (proto->threadData != NULL && dataLen > 0 && data != NULL) { - char *mpartHead = "--AaB03x\r\nContent-Disposition: form-data; name=\"filename\"; filename=\"plik.png\"\r\nContent-Type: image/png\r\n\r\n"; - char *mpartTail = "\r\n--AaB03x--\r\n"; + char *mpartHead = "--AaB03x\r\nContent-Disposition: form-data; name=\"filename\"; filename=\"plik.png\"\r\nContent-Type: image/png\r\n\r\n"; + char *mpartTail = "\r\n--AaB03x--\r\n"; int size, sizeHead = (int)mir_strlen(mpartHead), sizeTail = (int)mir_strlen(mpartTail); char *request = replaceTokens(proto->threadData->tlenConfig.mailBase, proto->threadData->tlenConfig.avatarUpload, "", proto->threadData->avatarToken, 0, access); TLENUPLOADAVATARTHREADDATA *threadData = (TLENUPLOADAVATARTHREADDATA *)mir_alloc(sizeof(TLENUPLOADAVATARTHREADDATA)); @@ -423,10 +438,10 @@ void TlenUploadAvatar(TlenProtocol *proto, unsigned char *data, int dataLen, int req->dataLength = size; req->pData = (char*)buffer; threadData->req = req; - threadData->data = (char *) mir_alloc(dataLen); + threadData->data = (char*)mir_alloc(dataLen); memcpy(threadData->data, data, dataLen); threadData->length = dataLen; - forkthread(TlenUploadAvatarRequestThread, 0, threadData); + mir_forkthread(TlenUploadAvatarRequestThread, threadData); } } diff --git a/protocols/Tlen/src/tlen_file.cpp b/protocols/Tlen/src/tlen_file.cpp index f97f47efae..49f62d50e9 100644 --- a/protocols/Tlen/src/tlen_file.cpp +++ b/protocols/Tlen/src/tlen_file.cpp @@ -630,7 +630,7 @@ void TlenProcessF(XmlNode *node, ThreadData *info) if ((p = TlenXmlGetAttrValue(node, "i")) != NULL)
if ((item = TlenListGetItemPtr(info->proto, LIST_FILE, p)) != NULL)
if (!mir_strcmp(item->ft->jid, jid))
- forkthread((void(__cdecl *)(void*))TlenFileSendingThread, 0, item->ft);
+ mir_forkthread((pThreadFunc)TlenFileSendingThread, item->ft);
}
else if (!mir_strcmp(e, "6")) {
// FILE_RECV : e='6' : IP and port information to connect to get file
@@ -640,7 +640,7 @@ void TlenProcessF(XmlNode *node, ThreadData *info) item->ft->hostName = mir_strdup(p);
if ((p = TlenXmlGetAttrValue(node, "p")) != NULL) {
item->ft->wPort = atoi(p);
- forkthread((void(__cdecl *)(void*))TlenFileReceiveThread, 0, item->ft);
+ mir_forkthread((pThreadFunc)TlenFileReceiveThread, item->ft);
}
}
}
diff --git a/protocols/Tlen/src/tlen_p2p_new.cpp b/protocols/Tlen/src/tlen_p2p_new.cpp index a2155c16e5..6afb490b0d 100644 --- a/protocols/Tlen/src/tlen_p2p_new.cpp +++ b/protocols/Tlen/src/tlen_p2p_new.cpp @@ -319,8 +319,8 @@ void __cdecl TlenProcessP2P(XmlNode *node, ThreadData *info) { TlenBindUDPSocket(item->ft);
TlenSend(info->proto, "<iq to='%s'><query xmlns='p2p'><dcng la='%s' lp='%d' pa='%s' pp='%d' i='%s' k='5' s='4'/></query></iq>",
item->ft->jid, item->ft->localName, item->ft->wLocalPort, item->ft->localName, item->ft->wLocalPort, item->ft->id2);
- forkthread((void (__cdecl *)(void*))TlenNewFileReceiveThread, 0, item->ft);
- forkthread((void (__cdecl *)(void*))TlenNewFileSendThread, 0, item->ft);
+ mir_forkthread((pThreadFunc)TlenNewFileReceiveThread, item->ft);
+ mir_forkthread((pThreadFunc)TlenNewFileSendThread, item->ft);
}
} else if (!mir_strcmp(s, "4")) {
/* IP and port */
@@ -328,7 +328,7 @@ void __cdecl TlenProcessP2P(XmlNode *node, ThreadData *info) { info->proto->debugLogA("step = 4");
item->ft->hostName = mir_strdup(TlenXmlGetAttrValue(dcng, "pa"));
item->ft->wPort = atoi(TlenXmlGetAttrValue(dcng, "pp"));
- forkthread((void (__cdecl *)(void*))TlenNewFileReceiveThread, 0, item->ft);
+ mir_forkthread((pThreadFunc)TlenNewFileReceiveThread, item->ft);
}
}
diff --git a/protocols/Tlen/src/tlen_p2p_old.cpp b/protocols/Tlen/src/tlen_p2p_old.cpp index 267748a5f1..a2265f6e8a 100644 --- a/protocols/Tlen/src/tlen_p2p_old.cpp +++ b/protocols/Tlen/src/tlen_p2p_old.cpp @@ -339,7 +339,7 @@ static HANDLE TlenP2PBindSocks4(SOCKSBIND * sb, TLEN_FILE_TRANSFER *ft) strncpy(sb->szHost, inet_ntoa(in), sizeof(sb->szHost)-1);
sb->wPort = htons(*(PWORD)(buf+2));
ft->s = s;
- forkthread((void (__cdecl *)(void*))TlenFileBindSocks4Thread, 0, ft);
+ mir_forkthread(pThreadFunc(TlenFileBindSocks4Thread), ft);
return s;
}
@@ -436,7 +436,7 @@ static HANDLE TlenP2PBindSocks5(SOCKSBIND * sb, TLEN_FILE_TRANSFER *ft) sb->wPort = htons(*(PWORD)(buf+len));
ft->s = s;
- forkthread((void (__cdecl *)(void*))TlenFileBindSocks5Thread, 0, ft);
+ mir_forkthread(pThreadFunc(TlenFileBindSocks5Thread), ft);
return s;
}
diff --git a/protocols/Tlen/src/tlen_picture.cpp b/protocols/Tlen/src/tlen_picture.cpp index 7279e831d2..765792a643 100644 --- a/protocols/Tlen/src/tlen_picture.cpp +++ b/protocols/Tlen/src/tlen_picture.cpp @@ -89,7 +89,7 @@ static void TlenPsPost(TlenProtocol *proto, TLEN_LIST_ITEM *item) { TLENPSREQUESTTHREADDATA *threadData = (TLENPSREQUESTTHREADDATA *)mir_alloc(sizeof(TLENPSREQUESTTHREADDATA));
threadData->proto = proto;
threadData->item = item;
- forkthread(TlenPsPostThread, 0, threadData);
+ mir_forkthread(TlenPsPostThread, threadData);
}
static void TlenPsGetThread(void *ptr) {
@@ -162,7 +162,7 @@ static void TlenPsGet(TlenProtocol *proto, TLEN_LIST_ITEM *item) { TLENPSREQUESTTHREADDATA *threadData = (TLENPSREQUESTTHREADDATA *)mir_alloc(sizeof(TLENPSREQUESTTHREADDATA));
threadData->proto = proto;
threadData->item = item;
- forkthread(TlenPsGetThread, 0, threadData);
+ mir_forkthread(TlenPsGetThread, threadData);
}
void TlenProcessPic(XmlNode *node, TlenProtocol *proto) {
diff --git a/protocols/Tlen/src/tlen_svc.cpp b/protocols/Tlen/src/tlen_svc.cpp index 5c8fa5d869..5a367388f1 100644 --- a/protocols/Tlen/src/tlen_svc.cpp +++ b/protocols/Tlen/src/tlen_svc.cpp @@ -355,7 +355,7 @@ static void TlenConnect(TlenProtocol *proto, int initialStatus) int oldStatus = proto->m_iStatus;
proto->m_iStatus = ID_STATUS_CONNECTING;
ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, proto->m_iStatus);
- thread->hThread = (HANDLE)forkthread((void(__cdecl *)(void*))TlenServerThread, 0, thread);
+ thread->hThread = mir_forkthread((pThreadFunc)TlenServerThread, thread);
}
}
@@ -611,7 +611,7 @@ int TlenProtocol::SendMsg(MCONTACT hContact, int, const char* msgRAW) {
DBVARIANT dbv;
if (!isOnline || db_get(hContact, m_szModuleName, "jid", &dbv)) {
- forkthread(TlenSendMessageFailedThread, 0, new SENDACKTHREADDATA(this, hContact, 2));
+ mir_forkthread(TlenSendMessageFailedThread, new SENDACKTHREADDATA(this, hContact, 2));
return 2;
}
@@ -623,11 +623,11 @@ int TlenProtocol::SendMsg(MCONTACT hContact, int, const char* msgRAW) if (!mir_strcmp(msg, "<alert>")) {
TlenSend(this, "<m tp='a' to='%s'/>", dbv.pszVal);
- forkthread(TlenSendMessageAckThread, 0, new SENDACKTHREADDATA(this, hContact, id));
+ mir_forkthread(TlenSendMessageAckThread, new SENDACKTHREADDATA(this, hContact, id));
}
else if (!mir_strcmp(msg, "<image>")) {
TlenSend(this, "<message to='%s' type='%s' crc='%x' idt='%d'/>", dbv.pszVal, "pic", 0x757f044, id);
- forkthread(TlenSendMessageAckThread, 0, new SENDACKTHREADDATA(this, hContact, id));
+ mir_forkthread(TlenSendMessageAckThread, new SENDACKTHREADDATA(this, hContact, id));
}
else {
char *msgEnc = TlenTextEncode(msg);
@@ -647,7 +647,7 @@ int TlenProtocol::SendMsg(MCONTACT hContact, int, const char* msgRAW) else
TlenSend(this, "<message to='%s' type='%s' id='" TLEN_IQID "%d'><body>%s</body><x xmlns='jabber:x:event'><composing/></x></message>", dbv.pszVal, msgType, id, msgEnc);
- forkthread(TlenSendMessageAckThread, 0, new SENDACKTHREADDATA(this, hContact, id));
+ mir_forkthread(TlenSendMessageAckThread, new SENDACKTHREADDATA(this, hContact, id));
}
else {
if ((item = TlenListGetItemPtr(this, LIST_ROSTER, dbv.pszVal)) != NULL)
@@ -707,7 +707,7 @@ INT_PTR TlenProtocol::GetAvatarInfo(WPARAM wParam, LPARAM lParam) HANDLE TlenProtocol::GetAwayMsg(MCONTACT hContact)
{
SENDACKTHREADDATA *tdata = new SENDACKTHREADDATA(this, hContact, 0);
- forkthread((void(__cdecl *)(void*))TlenGetAwayMsgThread, 0, (void*)tdata);
+ mir_forkthread((pThreadFunc)TlenGetAwayMsgThread, tdata);
return (HANDLE)1;
}
diff --git a/protocols/Tlen/src/tlen_thread.cpp b/protocols/Tlen/src/tlen_thread.cpp index 3567701282..99a27ba533 100644 --- a/protocols/Tlen/src/tlen_thread.cpp +++ b/protocols/Tlen/src/tlen_thread.cpp @@ -280,7 +280,7 @@ void __cdecl TlenServerThread(ThreadData *info) if (info->proto->m_iDesiredStatus != ID_STATUS_OFFLINE) {
info->proto->isConnected = TRUE;
- forkthread(TlenKeepAliveThread, 0, info->proto);
+ mir_forkthread(TlenKeepAliveThread, info->proto);
TlenXmlInitState(&xmlState);
TlenXmlSetCallback(&xmlState, 1, ELEM_OPEN, (void (__cdecl *)(XmlNode *,void *))TlenProcessStreamOpening, info);
@@ -1266,7 +1266,7 @@ static void TlenProcessV(XmlNode *node, ThreadData *info) if ((p=TlenXmlGetAttrValue(node, "p")) != NULL) {
item->ft->wPort = atoi(p);
TlenVoiceStart(item->ft, 0);
- //forkthread((void (__cdecl *)(void*))TlenVoiceReceiveThread, 0, item->ft);
+ //forkthread((pThreadFunc)TlenVoiceReceiveThread, 0, item->ft);
}
}
}
diff --git a/protocols/Tlen/src/tlen_voice.cpp b/protocols/Tlen/src/tlen_voice.cpp index 00d0afacb8..f35a51d4fa 100644 --- a/protocols/Tlen/src/tlen_voice.cpp +++ b/protocols/Tlen/src/tlen_voice.cpp @@ -914,13 +914,13 @@ int TlenVoiceStart(TLEN_FILE_TRANSFER *ft, int mode) ft->proto->debugLogA("starting voice %d", mode);
if (mode == 0) {
- forkthread((void(__cdecl *)(void*))TlenVoiceReceiveThread, 0, ft);
+ mir_forkthread((pThreadFunc)TlenVoiceReceiveThread, ft);
}
else if (mode == 1) {
- forkthread((void(__cdecl *)(void*))TlenVoiceSendingThread, 0, ft);
+ mir_forkthread((pThreadFunc)TlenVoiceSendingThread, ft);
}
else {
- forkthread((void(__cdecl *)(void*))TlenVoiceDlgThread, 0, ft);
+ mir_forkthread((pThreadFunc)TlenVoiceDlgThread, ft);
}
return 0;
}
@@ -1050,7 +1050,7 @@ int TlenVoiceAccept(TlenProtocol *proto, const char *id, const char *from) ACCEPTDIALOGDATA *data = (ACCEPTDIALOGDATA *)mir_alloc(sizeof(ACCEPTDIALOGDATA));
data->proto = proto;
data->item = item;
- forkthread((void(__cdecl *)(void*))TlenVoiceAcceptDlgThread, 0, data);
+ mir_forkthread((pThreadFunc)TlenVoiceAcceptDlgThread, data);
}
else if (proto->isOnline) {
item->ft = TlenFileCreateFT(proto, from);
|