void CreateAuthString(char *auth, MCONTACT hContact, HWND hwndDlg) { DBVARIANT dbv; char *user = NULL, *pass = NULL; TCHAR *tlogin = NULL, *tpass = NULL, buf[MAX_PATH] = {0}; if (hContact && db_get_b(hContact, MODULE, "UseAuth", 0)) { if (!db_get_ts(hContact, MODULE, "Login", &dbv)) { tlogin = mir_tstrdup(dbv.ptszVal); db_free(&dbv); } tpass = db_get_tsa(hContact, MODULE, "Password"); } else if (hwndDlg && IsDlgButtonChecked(hwndDlg, IDC_USEAUTH)) { GetDlgItemText(hwndDlg, IDC_LOGIN, buf, SIZEOF(buf)); tlogin = mir_tstrdup(buf); GetDlgItemText(hwndDlg, IDC_PASSWORD, buf, SIZEOF(buf)); tpass = mir_tstrdup(buf); } user = mir_t2a(tlogin); pass = mir_t2a(tpass); char str[MAX_PATH]; int len = mir_snprintf(str, SIZEOF(str), "%s:%s", user, pass); mir_free(user); mir_free(pass); mir_free(tlogin); mir_free(tpass); mir_snprintf(auth, 250, "Basic %s", ptrA(mir_base64_encode((PBYTE)str, len))); }
char* GetFileNameA(TCHAR* pszPath) { TCHAR* slash=_tcsrchr(pszPath,_T('\\')); if(!slash) slash=_tcsrchr(pszPath,_T('/')); if(slash) return mir_t2a(slash+1); else return mir_t2a(pszPath); }
/** * name: DisplayNameToFileName * desc: convert contact's display name to valid filename * param: hContact - handle of contact to create the filename for * pszFileName - buffer, retrieving the converted filename * cchFileName - number of maximum characters the filename can be * return: nothing **/ static void DisplayNameToFileName(lpExImParam ExImContact, LPSTR pszFileName, WORD cchFileName) { LPCSTR disp = 0; LPSTR temp = 0; cchFileName--; pszFileName[0] = 0; switch (ExImContact->Typ) { case EXIM_ALL: case EXIM_GROUP: mir_strncpy(pszFileName, Translate("all Contacts"), cchFileName); return; case EXIM_CONTACT: if (ExImContact->hContact == NULL) { mir_strncpy(pszFileName, Translate("Owner"), cchFileName); return; } disp = temp = mir_t2a(pcli->pfnGetContactDisplayName(ExImContact->hContact, NULL)); break; case EXIM_SUBGROUP: temp = mir_t2a(ExImContact->ptszName); disp = temp; break; case EXIM_ACCOUNT: PROTOACCOUNT* acc = Proto_GetAccount(ExImContact->pszName); disp = temp = mir_t2a(acc->tszAccountName); break; } // replace unwanted characters while (*disp != 0 && cchFileName > 1) { switch (*disp) { case '?': case '*': case ':': case '\\': case '|': case '/': case '<': case '>': case '"': *(pszFileName++) = '_'; break; default: *(pszFileName++) = *disp; break; } disp++; cchFileName--; } mir_free(temp); pszFileName[0] = 0; }
HANDLE __cdecl SearchByName(const PROTOCHAR* nick, const PROTOCHAR* firstName, const PROTOCHAR* lastName) { PROTOSEARCHBYNAME psn; psn.pszNick = (PROTOCHAR*)mir_t2a(nick); psn.pszFirstName = (PROTOCHAR*)mir_t2a(firstName); psn.pszLastName = (PROTOCHAR*)mir_t2a(lastName); HANDLE res = (HANDLE)ProtoCallService(m_szModuleName, PS_SEARCHBYNAME, 0, (LPARAM)&psn); mir_free(psn.pszNick); mir_free(psn.pszFirstName); mir_free(psn.pszLastName); return res; }
/** * name: DisplayNameToFileName * desc: convert contact's display name to valid filename * param: hContact - handle of contact to create the filename for * pszFileName - buffer, retrieving the converted filename * cchFileName - number of maximum characters the filename can be * return: nothing **/ static void DisplayNameToFileName(lpExImParam ExImContact, LPSTR pszFileName, WORD cchFileName) { LPCSTR disp = 0; LPSTR temp = 0; cchFileName--; ZeroMemory(pszFileName, cchFileName); switch (ExImContact->Typ) { case EXIM_ALL: case EXIM_GROUP: mir_strncpy(pszFileName, Translate("all Contacts"), cchFileName); return; case EXIM_CONTACT: if (ExImContact->hContact == NULL) { mir_strncpy(pszFileName, Translate("Owner"), cchFileName); return; } else { disp = (LPCSTR)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ExImContact->hContact, NULL); } break; case EXIM_SUBGROUP: temp = mir_t2a(ExImContact->ptszName); disp = temp; break; case EXIM_ACCOUNT: PROTOACCOUNT* acc = ProtoGetAccount(ExImContact->pszName); temp = mir_t2a(acc->tszAccountName); disp = temp; break; } // replace unwanted characters while (*disp != 0 && cchFileName > 1) { switch (*disp) { case '?': case '*': case ':': case '\\': case '|': case '/': case '<': case '>': case '"': *(pszFileName++) = '_'; break; default: *(pszFileName++) = *disp; break; } disp++; cchFileName--; } mir_free(temp); }
void CSend::svcSendFileExit() { //szMessage should be encoded as the File followed by the description, the //separator being a single nul (\0). If there is no description, do not forget //to end the File with two nuls. if (m_bSilent) { Exit(ACKRESULT_SUCCESS); return; } if (!m_hContact) { Error(LPGENT("%s requires a valid contact!"), m_pszSendTyp); Exit(ACKRESULT_FAILED); return; } mir_freeAndNil(m_szEventMsg); char* szFile = mir_t2a(m_pszFile); m_cbEventMsg = (DWORD)mir_strlen(szFile) + 2; m_szEventMsg = (char*)mir_realloc(m_szEventMsg, (sizeof(char) * m_cbEventMsg)); memset(m_szEventMsg, 0, (sizeof(char) * m_cbEventMsg)); mir_strcpy(m_szEventMsg, szFile); if (m_pszFileDesc && m_pszFileDesc[0] != NULL) { char* temp = mir_t2a(m_pszFileDesc); m_cbEventMsg += (DWORD)mir_strlen(temp); m_szEventMsg = (char*)mir_realloc(m_szEventMsg, sizeof(char)*m_cbEventMsg); mir_strcpy(m_szEventMsg + mir_strlen(szFile) + 1, temp); m_szEventMsg[m_cbEventMsg - 1] = 0; mir_free(temp); } mir_free(szFile); //create a HookEventObj on ME_PROTO_ACK if (!m_hOnSend) { m_hOnSend = HookEventObj(ME_PROTO_ACK, OnSend, this); } // Start miranda PSS_FILE based on mir ver (T) TCHAR* ppFile[2] = { 0, 0 }; TCHAR* pDesc = mir_tstrdup(m_pszFileDesc); ppFile[0] = mir_tstrdup(m_pszFile); ppFile[1] = NULL; m_hSend = (HANDLE)CallContactService(m_hContact, PSS_FILE, (WPARAM)pDesc, (LPARAM)ppFile); mir_free(pDesc); mir_free(ppFile[0]); // check we actually got an ft handle back from the protocol if (!m_hSend) { Unhook(); Error(SS_ERR_INIT, m_pszSendTyp); Exit(ACKRESULT_FAILED); return; } }
static char *getDisplayName(TlenProtocol *proto, const char *id) { char jid[256]; MCONTACT hContact; DBVARIANT dbv; if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) { mir_snprintf(jid, SIZEOF(jid), "%s@%s", id, dbv.pszVal); db_free(&dbv); if (((hContact=TlenHContactFromJID(proto, jid)) != NULL) || !strcmp(id, proto->threadData->username)) { CONTACTINFO ci = { sizeof(ci) }; ci.hContact = hContact; ci.szProto = (char *)proto->m_szModuleName; ci.dwFlag = CNF_DISPLAY; if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) { if (ci.type == CNFT_ASCIIZ) { if (ci.pszVal) { char* str = mir_t2a(ci.pszVal); mir_free(ci.pszVal); return str; } } } } } return mir_strdup(id); }
static INT_PTR sttGetAwayMessage(WPARAM wParam, LPARAM lParam) { TCHAR* msg = GetAwayMessage((int)wParam, (char*)lParam); char* res = mir_t2a(msg); mir_free(msg); return (INT_PTR)res; }
TCHAR *parseFromRegister(ARGUMENTSINFO *ai) { if (ai == NULL || ai->argc == 0 || ai->targv[0] == NULL) return NULL; INT_PTR callRes = 0; TCHAR *temp = NULL, *res = NULL; mir_cslock lck(csRegister); /* note the following limitation: you cannot add/remove tokens during a call from a different thread */ TOKENREGISTEREX *thisVr = searchRegister(ai->targv[0], 0); if (thisVr == NULL) return NULL; TOKENREGISTEREX trCopy = *thisVr; // ai contains WCHARs, convert to chars because the tr doesn't support WCHARs if (!(thisVr->flags & TRF_TCHAR)) { // unicode variables calls a non-unicode plugin ARGUMENTSINFO cAi; memcpy(&cAi, ai, sizeof(ARGUMENTSINFO)); cAi.argv = (char**)mir_alloc(ai->argc*sizeof(char *)); for (unsigned j = 0; j < ai->argc; j++) cAi.argv[j] = mir_t2a(ai->targv[j]); if (thisVr->flags & TRF_PARSEFUNC) callRes = (INT_PTR)thisVr->parseFunction(&cAi); else if (thisVr->szService != NULL) callRes = CallService(thisVr->szService, 0, (LPARAM)&cAi); for (unsigned j = 0; j < cAi.argc; j++) mir_free(cAi.argv[j]); if ((char *)callRes != NULL) res = mir_a2t((char*)callRes); } else { // unicode variables calls unicode plugin if (thisVr->flags & TRF_PARSEFUNC) callRes = (INT_PTR)thisVr->parseFunctionT(ai); else if (thisVr->szService != NULL) callRes = CallService(thisVr->szService, 0, (LPARAM)ai); if ((TCHAR*)callRes != NULL) res = mir_tstrdup((TCHAR*)callRes); } if (callRes != NULL) { if (trCopy.flags & TRF_CLEANUP) { if (trCopy.flags & TRF_CLEANUPFUNC) trCopy.cleanupFunctionT((TCHAR*)callRes); else if (trCopy.szCleanupService != NULL) CallService(trCopy.szCleanupService, 0, (LPARAM)callRes); } if ((trCopy.flags & TRF_FREEMEM) && trCopy.memType == TR_MEM_MIRANDA) mir_free((void*)callRes); } return res; }
int TwitterProto::OnChatOutgoing(WPARAM, LPARAM lParam) { GCHOOK *hook = reinterpret_cast<GCHOOK*>(lParam); if (mir_strcmp(hook->pDest->pszModule, m_szModuleName)) return 0; switch (hook->pDest->iType) { case GC_USER_MESSAGE: debugLog(_T("**Chat - Outgoing message: %s"), hook->ptszText); { T2Utf text(hook->ptszText); std::string tweet(text); replaceAll(tweet, "%%", "%"); // the chat plugin will turn "%" into "%%", so we have to change it back :/ char *varTweet = mir_strdup(tweet.c_str()); ForkThread(&TwitterProto::SendTweetWorker, varTweet); } break; case GC_USER_PRIVMESS: { ptrA text(mir_t2a(hook->ptszUID)); CallService(MS_MSG_SENDMESSAGE, WPARAM(UsernameToHContact(text)), 0); } break; } return 0; }
int CSteamProto::OnOptionsInit(void *obj, WPARAM wParam, LPARAM lParam) { CSteamProto *instance = (CSteamProto*)obj; char *title = mir_t2a(instance->m_tszUserName); OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = g_hInstance; odp.pszTitle = title; odp.dwInitParam = LPARAM(obj); odp.flags = ODPF_BOLDGROUPS; odp.pszGroup = LPGEN("Network"); odp.pszTab = LPGEN("Account"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MAIN); odp.pfnDlgProc = MainOptionsProc; Options_AddPage(wParam, &odp); odp.pszTab = LPGEN("Blocked contacts"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_BLOCK_LIST); odp.pfnDlgProc = BlockListOptionsProc; Options_AddPage(wParam, &odp); mir_free(title); return 0; }
int __cdecl AuthRequest( HANDLE hContact, const TCHAR* szMessage ) { CCSDATA ccs = { hContact, PSS_AUTHREQUEST, 0, (LPARAM)szMessage }; ccs.lParam = ( LPARAM )mir_t2a( szMessage ); int res = ( int )MyCallProtoService( m_szModuleName, PSS_AUTHREQUEST, 0, (LPARAM)&ccs ); mir_free(( char* )ccs.lParam ); return res; }
BOOL IsPluginDisabled(TCHAR* filename) { char* fname = mir_t2a(filename); int res = db_get_b(NULL, "PluginDisable", fname, 0); mir_free(fname); return res; }
static TCHAR *parseUrlDec(ARGUMENTSINFO *ai) { if (ai->argc != 2) return NULL; char *res = mir_t2a(ai->targv[1]); if (res == NULL) return NULL; unsigned int cur = 0; while (cur < mir_strlen(res)) { if ((*(res + cur) == '%') && (mir_strlen(res + cur) >= 3)) { char hex[8]; memset(hex, '\0', sizeof(hex)); strncpy(hex, res + cur + 1, 2); *(res + cur) = (char)strtol(hex, NULL, 16); memmove(res + cur + 1, res + cur + 3, mir_strlen(res + cur + 3) + 1); } cur++; } res = (char*)mir_realloc(res, mir_strlen(res) + 1); TCHAR *tres = mir_a2t(res); mir_free(res); return tres; }
static TCHAR *parseUrlEnc(ARGUMENTSINFO *ai) { if (ai->argc != 2) return NULL; char *res = mir_t2a(ai->targv[1]); if (res == NULL) return NULL; size_t cur = 0; while (cur < mir_strlen(res)) { if (((*(res + cur) >= '0') && (*(res + cur) <= '9')) || ((*(res + cur) >= 'a') && (*(res + cur) <= 'z')) || ((*(res + cur) >= 'A') && (*(res + cur) <= 'Z'))) { cur++; continue; } res = (char*)mir_realloc(res, mir_strlen(res) + 4); if (res == NULL) return NULL; char hex[8]; memmove(res + cur + 3, res + cur + 1, mir_strlen(res + cur + 1) + 1); mir_snprintf(hex, _countof(hex), "%%%x", *(res + cur)); strncpy(res + cur, hex, mir_strlen(hex)); cur += mir_strlen(hex); } TCHAR *tres = mir_a2t(res); mir_free(res); return tres; }
static __forceinline char *GetContactIDX(const char*, MCONTACT hContact) { TCHAR *id = GetContactID(hContact); char* res = mir_t2a(id); mir_free(id); return res; }
static INT_PTR AddMainMenuItem(WPARAM, LPARAM lParam) { TMO_MenuItem tmi; CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam; if (!cli.pfnConvertMenu(mi, &tmi)) return 0; MainMenuExecParam *mmep = (MainMenuExecParam*)mir_alloc(sizeof(MainMenuExecParam)); if (mmep == NULL) return 0; //we need just one parametr. mmep->szServiceName = mir_strdup(mi->pszService); mmep->Param1 = mi->popupPosition; mmep->szMenuName = tmi.ptszName; tmi.ownerdata = mmep; PMO_IntMenuItem pimi = MO_AddNewMenuItem(hMainMenuObject, &tmi); char* name; bool needFree = false; if (mi->pszService) name = mi->pszService; else if (mi->flags & CMIF_UNICODE) { name = mir_t2a(mi->ptszName); needFree = true; } else name = mi->pszName; MO_SetOptionsMenuItem(pimi, OPT_MENUITEMSETUNIQNAME, (INT_PTR)name); if (needFree) mir_free(name); return (INT_PTR)pimi; }
INT_PTR CToxProto::ParseToxUri(WPARAM, LPARAM lParam) { TCHAR *uri = (TCHAR*)lParam; if (mir_tstrlen(uri) <= 4) return 1; if (Accounts.getCount() == 0) return 1; CToxProto *proto = NULL; for (int i = 0; i < Accounts.getCount(); i++) { if (Accounts[i]->IsOnline()) { proto = Accounts[i]; break; } } if (proto == NULL) return 1; if (_tcschr(uri, _T('@')) != NULL) return 1; PROTOSEARCHRESULT psr = { sizeof(psr) }; psr.flags = PSR_UTF8; psr.id.a = mir_t2a(&uri[4]); ADDCONTACTSTRUCT acs = { HANDLE_SEARCHRESULT }; acs.szProto = proto->m_szModuleName; acs.psr = &psr; CallService(MS_ADDCONTACT_SHOW, 0, (LPARAM)&acs); return 0; }
int AddDebugLogMessage(const TCHAR* fmt, ...) { int res; TCHAR tszText[MAX_DEBUG], tszFinal[MAX_DEBUG]; char *szFinal; va_list va; va_start(va, fmt); mir_vsntprintf(tszText, _countof(tszText), fmt, va); va_end(va); #ifdef MODULENAME mir_sntprintf(tszFinal, _countof(tszFinal), _T("%s: %s"), MODULENAME, tszText); #else _tcsncpy(tszFinal, tszText, _countof(tszFinal)); #endif szFinal = mir_t2a(tszFinal); res = WriteToDebugLogA(szFinal); mir_free(szFinal); return res; }
//--------------------------------------------------------------------------- int CSendHost_Imgur::Send() { if (!g_hNetlibUser) { /// check Netlib Error(SS_ERR_INIT, m_pszSendTyp); Exit(ACKRESULT_FAILED); return !m_bAsync; } memset(&m_nlhr, 0, sizeof(m_nlhr)); char* tmp; tmp = mir_t2a(m_pszFile); HTTPFormData frm[] = { { "Authorization", HTTPFORM_HEADER("Client-ID 2a7303d78abe041") }, { "image", HTTPFORM_FILE(tmp) }, // {"name",""},// filename (detected if multipart / form-data) // {"title",""}, // {"description",""}, }; int error = HTTPFormCreate(&m_nlhr, REQUEST_POST, "https://api.imgur.com/3/image", frm, sizeof(frm) / sizeof(HTTPFormData)); mir_free(tmp); if (error) return !m_bAsync; /// start upload thread if (m_bAsync) { mir_forkthread(&CSendHost_Imgur::SendThread, this); return 0; } SendThread(this); return 1; }
BOOL CJabberProto::OnMessageError(HXML node, ThreadData*, CJabberMessageInfo* pInfo) { // we check if is message delivery failure int id = JabberGetPacketID(node); JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, pInfo->GetFrom()); if (item == NULL) item = ListGetItemPtr(LIST_CHATROOM, pInfo->GetFrom()); if (item != NULL) { // yes, it is TCHAR *szErrText = JabberErrorMsg(pInfo->GetChildNode()); if (id != -1) { char *errText = mir_t2a(szErrText); ProtoBroadcastAck(pInfo->GetHContact(), ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)id, (LPARAM)errText); mir_free(errText); } else { TCHAR buf[512]; HXML bodyNode = xmlGetChild(node, "body"); if (bodyNode) mir_sntprintf(buf, SIZEOF(buf), _T("%s:\n%s\n%s"), pInfo->GetFrom(), xmlGetText(bodyNode), szErrText); else mir_sntprintf(buf, SIZEOF(buf), _T("%s:\n%s"), pInfo->GetFrom(), szErrText); MsgPopup(NULL, buf, TranslateT("Jabber Error")); } mir_free(szErrText); } return TRUE; }
char* GetFileExtA(const TCHAR* pszPath) { const TCHAR* slash = _tcsrchr(pszPath, _T('.')); if (slash) return mir_t2a(slash); return NULL; }
INT_PTR __cdecl CJabberProto::GetMyAwayMsg(WPARAM wParam, LPARAM lParam) { TCHAR *szStatus = NULL; mir_cslock lck(m_csModeMsgMutex); switch (wParam ? (int)wParam : m_iStatus) { case ID_STATUS_ONLINE: szStatus = m_modeMsgs.szOnline; break; case ID_STATUS_AWAY: case ID_STATUS_ONTHEPHONE: case ID_STATUS_OUTTOLUNCH: szStatus = m_modeMsgs.szAway; break; case ID_STATUS_NA: szStatus = m_modeMsgs.szNa; break; case ID_STATUS_DND: case ID_STATUS_OCCUPIED: szStatus = m_modeMsgs.szDnd; break; case ID_STATUS_FREECHAT: szStatus = m_modeMsgs.szFreechat; break; default: // Should not reach here break; } if (szStatus) return (lParam & SGMA_UNICODE) ? (INT_PTR)mir_t2u(szStatus) : (INT_PTR)mir_t2a(szStatus); return 0; }
static void ChatInviteSend(HANDLE hItem, HWND hwndList, STRLIST &str, CMsnProto *ppro) { if (hItem == NULL) hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0); while (hItem) { if (IsHContactGroup(hItem)) { HANDLE hItemT = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem); if (hItemT) ChatInviteSend(hItemT, hwndList, str, ppro); } else { int chk = SendMessage(hwndList, CLM_GETCHECKMARK, (WPARAM)hItem, 0); if (chk) { if (IsHContactInfo(hItem)) { TCHAR buf[128] = _T(""); SendMessage(hwndList, CLM_GETITEMTEXT, (WPARAM)hItem, (LPARAM)buf); if (buf[0]) str.insert(mir_t2a(buf)); } else { MsnContact *msc = ppro->Lists_Get((UINT_PTR)hItem); if (msc) { char szContact[MSN_MAX_EMAIL_LEN]; sprintf(szContact, "%d:%s", msc->netId, msc->email); str.insertn(szContact); } } } } hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem); } }
void getDnsName(TCHAR *strIp, TCHAR *strHostName, size_t len) { in_addr iaHost; iaHost.s_addr = inet_addr(mir_t2a(strIp)); hostent *h = gethostbyaddr((char *)&iaHost, sizeof(struct in_addr), AF_INET); _tcsncpy_s(strHostName, len, (h == NULL) ? strIp : _A2T(h->h_name), _TRUNCATE); }
INT_PTR FacebookProto::GetMyAwayMsg(WPARAM, LPARAM lParam) { ptrT statusMsg(getTStringA("StatusMsg")); if (statusMsg == NULL || statusMsg[0] == '\0') return 0; return (lParam & SGMA_UNICODE) ? (INT_PTR)mir_t2u(statusMsg) : (INT_PTR)mir_t2a(statusMsg); }
void CVkProto::OnReceivePollingInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) { debugLogA("CVkProto::OnReceivePollingInfo %d", reply->resultCode); if (reply->resultCode != 200) return; JSONROOT pRoot; JSONNODE *pResponse = CheckJsonResponse(pReq, reply, pRoot); if (pResponse == NULL) return; m_pollingTs = mir_t2a(ptrT(json_as_string(json_get(pResponse, "ts")))); m_pollingKey = mir_t2a(ptrT(json_as_string(json_get(pResponse, "key")))); m_pollingServer = mir_t2a(ptrT(json_as_string(json_get(pResponse, "server")))); if (!m_hPollingThread && m_pollingTs != NULL && m_pollingKey != NULL && m_pollingServer != NULL) m_hPollingThread = ForkThreadEx(&CVkProto::PollingThread, NULL, NULL); }
int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szReason) { CCSDATA ccs = { hContact, PSS_FILEDENY, (WPARAM)hTransfer, (LPARAM)szReason }; ccs.lParam = (LPARAM)mir_t2a(szReason); int res = (int)ProtoCallService(m_szModuleName, PSS_FILEDENY, 0, (LPARAM)&ccs); mir_free((char*)ccs.lParam); return res; }
HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szPath) { CCSDATA ccs = { hContact, PSS_FILEALLOW, (WPARAM)hTransfer, (LPARAM)szPath }; ccs.lParam = (LPARAM)mir_t2a(szPath); HANDLE res = (HANDLE)ProtoCallService(m_szModuleName, PSS_FILEALLOW, 0, (LPARAM)&ccs); mir_free((char*)ccs.lParam); return res; }
// update avatars pos int AniAva_SetAvatarPos(HANDLE hContact, RECT * rc, int overlayIdx, BYTE bAlpha) { aacheck 0; aalock; if (AniAva.CS.LockCount>0) { aaunlock; return 0; } { ANIAVA_OBJECT * pai=FindAvatarByContact( hContact ); if ( pai ) { ANIAVA_POSINFO * api=(ANIAVA_POSINFO *)malloc(sizeof(ANIAVA_POSINFO)); if (!pai->hWindow) { HWND hwnd; HWND parent; ANIAVATARIMAGEINFO avii={0}; //not found -> create window char szName[150] = "AniAvaWnd_"; TCHAR * tszName; _itoa((int)hContact,szName+10,16); #ifdef _DEBUG { char *temp; PDNCE pdnce=(PDNCE)pcli->pfnGetCacheEntry(hContact); if ( pdnce && pdnce->m_cache_tcsName ) { temp=mir_t2a(pdnce->m_cache_tcsName); strcat(szName,"_"); strcat(szName,temp); mir_free(temp); } } #endif tszName = mir_a2t( szName ); hwnd=_AniAva_CreateAvatarWindowSync(tszName); mir_free( tszName ); parent=fnGetAncestor(pcli->hwndContactList,GA_PARENT); pai->hWindow=hwnd; SendMessage(hwnd,AAM_SETPARENT,(WPARAM)parent,0); if (_AniAva_GetAvatarImageInfo(pai->dwAvatarUniqId,&avii)) SendMessage(pai->hWindow, AAM_SETAVATAR, (WPARAM)&avii, (LPARAM) 0); } api->bAlpha=bAlpha; api->idxOverlay=overlayIdx; api->rcPos=*rc; SendNotifyMessage(pai->hWindow, AAM_SETPOSITION, (WPARAM)0, (LPARAM) api); // the AAM_SETPOSITION is responsible to destroy memory under api pai->bInvalidPos=FALSE; pai->bToBeDeleted=FALSE; } } aaunlock; return 1; }