#include "commonheaders.h" pSupPro proto=NULL; pUinKey clist=NULL; int proto_cnt = 0; int clist_cnt = 0; int clist_inc = 100; void loadSupportedProtocols() { int numberOfProtocols; PROTOCOLDESCRIPTOR **protos; LPSTR szNames = myDBGetString(0,szModuleName,"protos"); if ( szNames && strchr(szNames,':') == NULL ) { LPSTR tmp = (LPSTR) mir_alloc(2048); int j=0; for(int i=0; szNames[i]; i++) { if ( szNames[i] == ';' ) { memcpy((PVOID)(tmp+j),(PVOID)":1:0:0",6); j+=6; } tmp[j++] = szNames[i]; } tmp[j] = '\0'; SAFE_FREE(szNames); szNames = tmp; DBWriteContactSettingString(0,szModuleName,"protos",szNames); } CallService(MS_PROTO_ENUMPROTOCOLS, (WPARAM)&numberOfProtocols, (LPARAM)&protos); for (int i=0;itype == PROTOTYPE_PROTOCOL && protos[i]->szName && (CallProtoService(protos[i]->szName,PS_GETCAPS,PFLAGNUM_2,0)||strcmp(protos[i]->szName,"MetaContacts")==0)) { if (protos[i]->type == PROTOTYPE_PROTOCOL && protos[i]->szName && CallProtoService(protos[i]->szName,PS_GETCAPS,PFLAGNUM_2,0)) { int j = proto_cnt; proto_cnt++; proto = (pSupPro) mir_realloc(proto,sizeof(SupPro)*proto_cnt); memset(&proto[j],0,sizeof(SupPro)); proto[j].name = mir_strdup(protos[i]->szName); if ( szNames ) { if ( proto[j].name ) { char tmp[128]; strcpy(tmp,proto[j].name); strcat(tmp,":"); LPSTR szName = strstr(szNames,tmp); if ( szName ) { szName = strchr(szName,':'); if ( szName ) { proto[j].inspecting = (*++szName == '1'); szName = strchr(szName,':'); if ( szName ) { proto[j].split_on = atoi(++szName); proto[j].tsplit_on = proto[j].split_on; szName = strchr(szName,':'); if ( szName ) { proto[j].split_off = atoi(++szName); proto[j].tsplit_off = proto[j].split_off; } } } } } } else { proto[j].inspecting = true; } } } SAFE_FREE(szNames); } void freeSupportedProtocols() { for (int j=0;jmsgQueue==NULL){ // create new ptr->msgQueue = (pWM) mir_alloc(sizeof(struct waitingMessage)); ptrMessage = ptr->msgQueue; } else { // add to list ptrMessage = ptr->msgQueue; while (ptrMessage->nextMessage) { ptrMessage = ptrMessage->nextMessage; } ptrMessage->nextMessage = (pWM) mir_alloc(sizeof(struct waitingMessage)); ptrMessage = ptrMessage->nextMessage; } ptrMessage->wParam = wParam; ptrMessage->nextMessage = NULL; if(wParam & PREF_UNICODE) { int slen = (int)strlen(szMsg)+1; int wlen = (int)wcslen((wchar_t *)(szMsg+slen))+1; ptrMessage->Message = (LPSTR) mir_alloc(slen+wlen*sizeof(WCHAR)); memcpy(ptrMessage->Message,szMsg,slen+wlen*sizeof(WCHAR)); } else{ ptrMessage->Message = mir_strdup(szMsg); } LeaveCriticalSection(&localQueueMutex); } void getContactNameA(HANDLE hContact, LPSTR szName) { strcpy(szName,(LPCSTR)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hContact,0)); } void getContactName(HANDLE hContact, LPSTR szName) { if ( bCoreUnicode ) wcscpy((LPWSTR)szName,(LPWSTR)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hContact,GSMDF_UNICODE)); else getContactNameA(hContact, szName); } void getContactUinA(HANDLE hContact, LPSTR szUIN) { *szUIN = 0; pSupPro ptr = getSupPro(hContact); if (!ptr) return; DBVARIANT dbv_uniqueid; LPSTR uID = (LPSTR) CallProtoService(ptr->name, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); if ( uID==(LPSTR)CALLSERVICE_NOTFOUND ) uID = 0; // Billy_Bons if ( uID && DBGetContactSetting(hContact, ptr->name, uID, &dbv_uniqueid)==0 ) { if (dbv_uniqueid.type == DBVT_WORD) sprintf(szUIN, "%u [%s]", dbv_uniqueid.wVal, ptr->name); else if (dbv_uniqueid.type == DBVT_DWORD) sprintf(szUIN, "%u [%s]", (UINT)dbv_uniqueid.dVal, ptr->name); else if (dbv_uniqueid.type == DBVT_BLOB) sprintf(szUIN, "%s [%s]", dbv_uniqueid.pbVal, ptr->name); else sprintf(szUIN, "%s [%s]", dbv_uniqueid.pszVal, ptr->name); } else { strcpy(szUIN, "=== unknown ==="); } DBFreeVariant(&dbv_uniqueid); } void getContactUin(HANDLE hContact, LPSTR szUIN) { getContactUinA(hContact, szUIN); if ( bCoreUnicode && *szUIN ) { LPWSTR tmp = mir_a2u(szUIN); wcscpy((LPWSTR)szUIN, tmp); mir_free(tmp); } } // EOF