int main(int argc, char **argv, char **envp) { /* First check whether we're about to start a VM: */ bool fStartVM = false; /* In separate process: */ bool fSeparateProcess = false; for (int i = 1; i < argc && !(fStartVM && fSeparateProcess); ++i) { /* NOTE: the check here must match the corresponding check for the * options to start a VM in main.cpp and VBoxGlobal.cpp exactly, * otherwise there will be weird error messages. */ if ( !MyStrCmp(argv[i], "--startvm") || !MyStrCmp(argv[i], "-startvm")) { fStartVM = true; } else if ( !MyStrCmp(argv[i], "--separate") || !MyStrCmp(argv[i], "-separate")) { fSeparateProcess = true; } } uint32_t fFlags = (fStartVM && !fSeparateProcess) ? 0 : SUPSECMAIN_FLAGS_DONT_OPEN_DEV; #ifdef VIRTUALBOX_VM return SUPR3HardenedMain("VirtualBoxVM", fFlags | SUPSECMAIN_FLAGS_TRUSTED_ERROR | SUPSECMAIN_FLAGS_OSX_VM_APP, argc, argv, envp); #else return SUPR3HardenedMain("VirtualBox", fFlags | SUPSECMAIN_FLAGS_TRUSTED_ERROR, argc, argv, envp); #endif }
int GetProtoIndex(char * szName) { DWORD i; char buf[11]; char * name; DWORD pc; if (!szName) return -1; pc=DBGetContactSettingDword(NULL,"Protocols","ProtoCount",-1); for (i=0; i<pc; i++) { itoa(i,buf,10); name=DBGetString(NULL,"Protocols",buf); if (name) { if (!MyStrCmp(name,szName)) { mir_free(name); return i; } mir_free(name); } } return -1; }
////////// By FYR///////////// int ExtIconFromStatusMode(HANDLE hContact, const char *szProto,int status) { if (DBGetContactSettingByte(NULL,"CLC","Meta",0)==1) return IconFromStatusMode(szProto,status); if (szProto!=NULL) if (MyStrCmp(szProto,"MetaContacts")==0) { hContact=(HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(UINT)hContact,0); if (hContact!=0) { szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(UINT)hContact,0); status=DBGetContactSettingWord(hContact,szProto,"Status",ID_STATUS_OFFLINE); } } return IconFromStatusMode(szProto,status); }
int IconFromStatusMode(const char *szProto,int status) { int index,i; for(index=0;index<sizeof(statusModeList)/sizeof(statusModeList[0]);index++) if(status==statusModeList[index]) break; if(index==sizeof(statusModeList)/sizeof(statusModeList[0])) index=0; if(szProto==NULL) return index+1; for(i=0;i<protoIconIndexCount;i++) { if(MyStrCmp(szProto,protoIconIndex[i].szProto)) continue; return protoIconIndex[i].iIconBase+index; } return 1; }
// Test comparasion function void TestCmp(const char * str1, const char * str2) { const int strcmpValue = strcmp(str1, str2); // Yes, I use strcmp here, but just for checking my own function results int myValue = MyStrCmp(str1, str2); int testFailed = ((strcmpValue < 0) != (myValue < 0) || (strcmpValue > 0) != (myValue > 0)); const char * resStr = "="; if (myValue > 0) { resStr = ">"; } else if (myValue < 0) { resStr = "<"; } printf("[%s] %s [%s] %s\n", str1, resStr, str2, (testFailed ? "!!!" : "OK")); }
void FindString(char searchStr[], int flags, char termChar) { int curLineNdx = 0, length = 0, curChar = 0; char toPrint[LINELEN] = {0}; FILE *srtFile; if ((srtFile = fopen("sortedFile", "r")) == NULL) { printf("fopen sortedFile failed\n"); exit(1); } //Check for -t flag: check searchStr up to termChar if (flags & FLAG_T) { //If -f flag ignore case of termChar if (flags & FLAG_F) { while (curChar <= strlen(searchStr) && (tolower(searchStr[curChar]) != tolower(termChar))) { curChar++; } } else { while (curChar <= strlen(searchStr) && searchStr[curChar] != termChar) { curChar++; } } length = curChar + 1; } else { length = strlen(searchStr); } //Parse sortedFile and print out lines beginning with searchStr while (fgets(toPrint, LINELEN, srtFile) != NULL) { //Remove trailing return character if (toPrint[strlen(toPrint) - 1] == '\n') { toPrint[strlen(toPrint) - 1] = '\0'; } if (MyStrCmp(searchStr, toPrint, length, flags) == 0) { printf("%s\n", toPrint); } curLineNdx++; } }
static int ProtocolAck(WPARAM wParam,LPARAM lParam) { ACKDATA *ack=(ACKDATA*)lParam; /* if (ack->type==ACKTYPE_AWAYMSG && ack->lParam) { DBVARIANT dbv; if (!DBGetContactSetting(ack->hContact, "CList", "StatusMsg", &dbv)) { if (!MyStrCmp(dbv.pszVal, (char *)ack->lParam)) { DBFreeVariant(&dbv); return 0; } DBFreeVariant(&dbv); } DBWriteContactSettingString(ack->hContact, "CList", "StatusMsg", (char *)ack->lParam); return 0; } */ if(ack->type!=ACKTYPE_STATUS) return 0; CallService(MS_CLUI_PROTOCOLSTATUSCHANGED,ack->lParam,(LPARAM)ack->szModule); if((int)ack->hProcess<ID_STATUS_ONLINE && ack->lParam>=ID_STATUS_ONLINE) { DWORD caps; caps=(DWORD)CallProtoService(ack->szModule,PS_GETCAPS,PFLAGNUM_1,0); if(caps&PF1_SERVERCLIST) { HANDLE hContact; char *szProto; hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); while(hContact) { pdisplayNameCacheEntry cacheEntry; cacheEntry=GetContactFullCacheEntry(hContact); szProto=cacheEntry->szProto; if(szProto!=NULL && !MyStrCmp(szProto,ack->szModule)) if(DBGetContactSettingByte(hContact,"CList","Delete",0)) CallService(MS_DB_CONTACT_DELETE,(WPARAM)hContact,0); hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0); } } } TrayIconUpdateBase(ack->szModule); return 0; }
int DoTheJob(const char * str1, const char *str2) { const int r = MyStrCmp(str1, str2); if (r < 0) { char * swp1 = allocSwappedStr(str1); char * swp2 = allocSwappedStr(str2); printf("%s\n%s\n",swp1, swp2); free(swp1); free(swp2); } else if (r > 0) { char * swp1 = allocSwappedStr(str1); char * swp2 = allocSwappedStr(str2); char * mrg = allocMergedStr(swp2, swp1); printf("%s\n",mrg); free(mrg); free(swp1); free(swp2); } else { char * mrg = allocMergedStr(str1, str2); printf("%s\n",mrg); free(mrg); } return r; }
void SetAllExtraIcons(HWND hwndList,HANDLE hContact) { HANDLE hItem; boolean hcontgiven=FALSE; char *szProto; char *ImgIndex[64]; int maxpr,count,i; PROTOACCOUNT **accs; pdisplayNameCacheEntry pdnce; int em,pr,sms,a1,a2,w1,c1; int tick=0; BOOL hasExtraIconsService; hcontgiven=(hContact!=0); if (pcli->hwndContactTree==0){return;}; tick=GetTickCount(); if (ImageCreated==FALSE) ReloadExtraIcons(); SetNewExtraColumnCount(); hasExtraIconsService = HasExtraIconsService(); if (!hasExtraIconsService) { em=ExtraToColumnNum(EXTRA_ICON_EMAIL); pr=ExtraToColumnNum(EXTRA_ICON_PROTO); sms=ExtraToColumnNum(EXTRA_ICON_SMS); a1=ExtraToColumnNum(EXTRA_ICON_ADV1); a2=ExtraToColumnNum(EXTRA_ICON_ADV2); w1=ExtraToColumnNum(EXTRA_ICON_WEB); c1=ExtraToColumnNum(EXTRA_ICON_CLIENT); memset(ImgIndex,0,sizeof(ImgIndex)); ProtoEnumAccounts( &count, &accs ); maxpr=0; //calc only needed protocols for( i=0; i < count; i++ ) { if ( !IsAccountEnabled( accs[i] ) || CallProtoService( accs[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0 ) == 0 ) continue; ImgIndex[maxpr] = accs[i]->szModuleName; maxpr++; } } if ( hContact == NULL ) hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); do { szProto=NULL; hItem=hContact; if (hItem==0){continue;}; pdnce=(pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hItem); if (pdnce==NULL) {continue;}; // szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0); szProto=pdnce->szProto; if (!hasExtraIconsService) { if (ExtraToColumnNum(EXTRA_ICON_WEB)!=-1) { boolean showweb=FALSE; if (szProto != NULL) { char *homepage; homepage=DBGetStringA(pdnce->hContact,"UserInfo", "Homepage"); if (!homepage) homepage=DBGetStringA(pdnce->hContact,pdnce->szProto, "Homepage"); if (homepage!=NULL) { showweb=TRUE; mir_free(homepage); } } SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(ExtraToColumnNum(EXTRA_ICON_WEB),(showweb)?2:0xFF)); } if (ExtraToColumnNum(EXTRA_ICON_EMAIL)!=-1) { DBVARIANT dbv={0}; boolean showemail=TRUE; if (szProto == NULL || DBGetContactSettingString(hContact, szProto, "e-mail",&dbv)) { DBFreeVariant(&dbv); if (DBGetContactSettingString(hContact, "UserInfo", "Mye-mail0", &dbv)) showemail=FALSE; } DBFreeVariant(&dbv); SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(ExtraToColumnNum(EXTRA_ICON_EMAIL),(showemail)?0:0xFF)); } if (ExtraToColumnNum(EXTRA_ICON_SMS)!=-1) { DBVARIANT dbv={0}; boolean showsms=TRUE; if (szProto == NULL || DBGetContactSettingString(hContact, szProto, "Cellular",&dbv)) { DBFreeVariant(&dbv); if (DBGetContactSettingString(hContact, "UserInfo", "MyPhone0", &dbv)) showsms=FALSE; } SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(ExtraToColumnNum(EXTRA_ICON_SMS),(showsms)?1:0xFF)); DBFreeVariant(&dbv); } if(ExtraToColumnNum(EXTRA_ICON_PROTO)!=-1) { for (i=0;i<maxpr;i++) { if(!MyStrCmp(ImgIndex[i],szProto)) { SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(ExtraToColumnNum(EXTRA_ICON_PROTO),i+3)); break; } } } } NotifyEventHooks(hExtraImageApplying,(WPARAM)hContact,0); if (hcontgiven) break; Sleep(0); } while(hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0)); tick=GetTickCount()-tick; InvalidateRect(hwndList,NULL,FALSE); Sleep(0); }
int GetDropTargetInformation(HWND hwnd,struct ClcData *dat,POINT pt) { RECT clRect; int hit; struct ClcContact *contact,*movecontact; struct ClcGroup *group,*movegroup; DWORD hitFlags; GetClientRect(hwnd,&clRect); dat->selection=dat->iDragItem; dat->iInsertionMark=-1; if(!PtInRect(&clRect,pt)) return DROPTARGET_OUTSIDE; hit=HitTest(hwnd,dat,pt.x,pt.y,&contact,&group,&hitFlags); GetRowByIndex(dat,dat->iDragItem,&movecontact,&movegroup); if(hit==dat->iDragItem) return DROPTARGET_ONSELF; if(hit==-1 || hitFlags&CLCHT_ONITEMEXTRA) return DROPTARGET_ONNOTHING; if(movecontact->type==CLCIT_GROUP) { struct ClcContact *bottomcontact=NULL,*topcontact=NULL; struct ClcGroup *topgroup=NULL; int topItem=-1,bottomItem; int ok=0; if(pt.y+dat->yScroll<RowHeights_GetItemTopY(dat,hit)+dat->insertionMarkHitHeight) { //could be insertion mark (above) topItem=hit-1; bottomItem=hit; bottomcontact=contact; topItem=GetRowByIndex(dat,topItem,&topcontact,&topgroup); ok=1; } if(pt.y+dat->yScroll>=RowHeights_GetItemTopY(dat,hit+1)-dat->insertionMarkHitHeight) { //could be insertion mark (below) topItem=hit; bottomItem=hit+1; topcontact=contact; topgroup=group; bottomItem=GetRowByIndex(dat,bottomItem,&bottomcontact,NULL); ok=1; } if(ok) { ok=0; if(bottomItem==-1 || bottomcontact->type!=CLCIT_GROUP) { //need to special-case moving to end if(topItem!=dat->iDragItem) { for(;topgroup;topgroup=topgroup->parent) { if(topgroup==movecontact->group) break; if(topgroup==movecontact->group->parent) {ok=1; break;} } if(ok) bottomItem=topItem+1; } } else if(bottomItem!=dat->iDragItem && bottomcontact->type==CLCIT_GROUP && bottomcontact->group->parent==movecontact->group->parent) { if(bottomcontact!=movecontact+1) ok=1; } if(ok) { dat->iInsertionMark=bottomItem; dat->selection=-1; return DROPTARGET_INSERTION; } } } if(contact->type==CLCIT_GROUP) { if(dat->iInsertionMark==-1) { if(movecontact->type==CLCIT_GROUP) { //check not moving onto its own subgroup for(;group;group=group->parent) if(group==movecontact->group) return DROPTARGET_ONSELF; } dat->selection=hit; return DROPTARGET_ONGROUP; } } dat->selection=hit; if (!MyStrCmp(contact->proto,"MetaContacts")&& (ServiceExists(MS_MC_ADDTOMETA))) return DROPTARGET_ONMETACONTACT; if (contact->isSubcontact && (ServiceExists(MS_MC_ADDTOMETA))) return DROPTARGET_ONSUBCONTACT; return DROPTARGET_ONCONTACT; }
void RebuildEntireList(HWND hwnd,struct ClcData *dat) { // char *szProto; DWORD style=GetWindowLong(hwnd,GWL_STYLE); HANDLE hContact; struct ClcContact * cont; struct ClcGroup *group; //DBVARIANT dbv; int tick=GetTickCount(); KillTimer(hwnd,TIMERID_REBUILDAFTER); //EnterCriticalSection(&(dat->lockitemCS)); //ShowTracePopup("RebuildEntireList"); #ifdef _DEBUG { static int num_calls = 0; char tmp[128]; mir_snprintf(tmp, sizeof(tmp), "********************* RebuildEntireList (%d)\r\n", num_calls); num_calls++; TRACE(tmp); } #endif ClearRowByIndexCache(); ClearClcContactCache(dat,INVALID_HANDLE_VALUE); ImageArray_Clear(&dat->avatar_cache); RowHeights_Clear(dat); RowHeights_GetMaxRowHeight(dat, hwnd); dat->list.expanded=1; dat->list.hideOffline=DBGetContactSettingByte(NULL,"CLC","HideOfflineRoot",0); dat->list.contactCount=0; dat->list.totalMembers=0; dat->NeedResort=1; dat->selection=-1; dat->HiLightMode=DBGetContactSettingByte(NULL,"CLC","HiLightMode",0); { int i; TCHAR *szGroupName; DWORD groupFlags; for(i=1;;i++) { szGroupName=(TCHAR*)CallService(MS_CLIST_GROUPGETNAMET,i,(LPARAM)&groupFlags); //UNICODE if(szGroupName==NULL) break; AddGroup(hwnd,dat,szGroupName,groupFlags,i,0); } lastGroupId=i; } hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); while(hContact) { pdisplayNameCacheEntry cacheEntry; cont=NULL; cacheEntry=GetContactFullCacheEntry(hContact); //cacheEntry->ClcContact=NULL; ClearClcContactCache(dat,hContact); if((dat->IsMetaContactsEnabled||MyStrCmp(cacheEntry->szProto,"MetaContacts"))&&(style&CLS_SHOWHIDDEN || !cacheEntry->Hidden) && (!cacheEntry->HiddenSubcontact || !dat->IsMetaContactsEnabled )) { if(lstrlen(cacheEntry->szGroup)==0) group=&dat->list; else { group=AddGroup(hwnd,dat,cacheEntry->szGroup,(DWORD)-1,0,0); // if (!group) group=AddTempGroup(hwnd,dat,cacheEntry->szGroup,(DWORD)-1,0,0); //mir_free(dbv.pszVal); } if(group!=NULL) { if (cacheEntry->status==ID_STATUS_OFFLINE) if (DBGetContactSettingByte(NULL,"CList","PlaceOfflineToRoot",0)) group=&dat->list; group->totalMembers++; if(!(style&CLS_NOHIDEOFFLINE) && (style&CLS_HIDEOFFLINE || group->hideOffline)) { //szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0); if(cacheEntry->szProto==NULL) { if(!IsHiddenMode(dat,ID_STATUS_OFFLINE)||cacheEntry->noHiddenOffline) cont=AddContactToGroup(dat,group,cacheEntry); } else if(!IsHiddenMode(dat,cacheEntry->status)||cacheEntry->noHiddenOffline) cont=AddContactToGroup(dat,group,cacheEntry); } else cont=AddContactToGroup(dat,group,cacheEntry); } } if (cont) { cont->SubAllocated=0; if (cont->proto && strcmp(cont->proto,"MetaContacts")==0) AddSubcontacts(dat,cont); } hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0); } if(style&CLS_HIDEEMPTYGROUPS) { group=&dat->list; group->scanIndex=0; for(;;) { if(group->scanIndex==group->contactCount) { group=group->parent; if(group==NULL) break; } else if(group->contact[group->scanIndex].type==CLCIT_GROUP) { if(group->contact[group->scanIndex].group->contactCount==0) { group=RemoveItemFromGroup(hwnd,group,&group->contact[group->scanIndex],0); } else { group=group->contact[group->scanIndex].group; group->scanIndex=0; } continue; } group->scanIndex++; } } SortCLC(hwnd,dat,0); // LOCK_IMAGE_UPDATING=0; //LeaveCriticalSection(&(dat->lockitemCS)); #ifdef _DEBUG tick=GetTickCount()-tick; { char buf[255]; //sprintf(buf,"%s %s took %i ms",__FILE__,__LINE__,tick); sprintf(buf,"RebuildEntireList %d \r\n",tick); TRACE(buf); DBWriteContactSettingDword((HANDLE)0,"CLUI","PF:Last RebuildEntireList Time:",tick); } #endif }
void AddContactToTree(HWND hwnd,struct ClcData *dat,HANDLE hContact,int updateTotalCount,int checkHideOffline) { struct ClcGroup *group; struct ClcContact * cont; pdisplayNameCacheEntry cacheEntry; DWORD style=GetWindowLong(hwnd,GWL_STYLE); WORD status; char *szProto; if (FindItem(hwnd,dat,hContact,NULL,NULL,NULL,FALSE)==1){return;}; cacheEntry=GetContactFullCacheEntry(hContact); if (cacheEntry==NULL) return; if (dat->IsMetaContactsEnabled && cacheEntry->HiddenSubcontact) return; ///----- szProto=cacheEntry->szProto; //char *szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0); dat->NeedResort=1; ClearRowByIndexCache(); ClearClcContactCache(dat,hContact); if(style&CLS_NOHIDEOFFLINE) checkHideOffline=0; if(checkHideOffline) { if(szProto==NULL) status=ID_STATUS_OFFLINE; else status=cacheEntry->status; } if(lstrlen(cacheEntry->szGroup)==0) group=&dat->list; else { group=AddGroup(hwnd,dat,cacheEntry->szGroup,(DWORD)-1,0,0); if(group==NULL) { int i,len; DWORD groupFlags; TCHAR *szGroupName; if(!(style&CLS_HIDEEMPTYGROUPS)) { // /*mir_free(dbv.pszVal);*/AddTempGroup(hwnd,dat,cacheEntry->szGroup,(DWORD)-1,0,0); return; } if(checkHideOffline && IsHiddenMode(dat,status)) { for(i=1;;i++) { szGroupName=(TCHAR*)CallService(MS_CLIST_GROUPGETNAMET,i,(LPARAM)&groupFlags); //UNICODE if(szGroupName==NULL) {/*mir_free(dbv.pszVal);*/ return;} //never happens if(!lstrcmp(szGroupName,cacheEntry->szGroup)) break; } if(groupFlags&GROUPF_HIDEOFFLINE) {/*mir_free(dbv.pszVal);*/ return;} } for(i=1;;i++) { szGroupName=(TCHAR*)CallService(MS_CLIST_GROUPGETNAMET,i,(LPARAM)&groupFlags); //UNICODE if(szGroupName==NULL) {/*mir_free(dbv.pszVal);*/ return;} //never happens if(!lstrcmp(szGroupName,cacheEntry->szGroup)) break; len=lstrlen(szGroupName); if(!_tcsncmp(szGroupName,cacheEntry->szGroup,len) && cacheEntry->szGroup[len]=='\\') AddGroup(hwnd,dat,szGroupName,groupFlags,i,1); } group=AddGroup(hwnd,dat,cacheEntry->szGroup,groupFlags,i,1); } // mir_free(dbv.pszVal); } if (cacheEntry->status==ID_STATUS_OFFLINE) if (DBGetContactSettingByte(NULL,"CList","PlaceOfflineToRoot",0)) group=&dat->list; if(checkHideOffline) { if(IsHiddenMode(dat,status) && (style&CLS_HIDEOFFLINE || group->hideOffline)) { if(updateTotalCount) group->totalMembers++; return; } } if(dat->IsMetaContactsEnabled && cacheEntry->HiddenSubcontact) return; if(!dat->IsMetaContactsEnabled && !MyStrCmp(cacheEntry->szProto,"MetaContacts")) return; cont=AddContactToGroup(dat,group,cacheEntry); if (cont) if (cont->proto) { cont->SubAllocated=0; if (MyStrCmp(cont->proto,"MetaContacts")==0) AddSubcontacts(dat,cont); } if(updateTotalCount && group) group->totalMembers++; ClearRowByIndexCache(); }
void SetAllExtraIcons(HWND hwndList,HANDLE hContact) { HANDLE hItem; boolean hcontgiven=FALSE; char *szProto; char *(ImgIndex[64]); int maxpr,count,i; PROTOCOLDESCRIPTOR **protos; pdisplayNameCacheEntry pdnce; int em,pr,sms,a1,a2,w1,c1; int tick=0; int inphcont=(int)hContact; ON_SETALLEXTRAICON_CYCLE=1; hcontgiven=(hContact!=0); if (hwndContactTree==0){return;}; tick=GetTickCount(); if (ImageCreated==FALSE) ReloadExtraIcons(); SetNewExtraColumnCount(); { em=ExtraToColumnNum(EXTRA_ICON_EMAIL); pr=ExtraToColumnNum(EXTRA_ICON_PROTO); sms=ExtraToColumnNum(EXTRA_ICON_SMS); a1=ExtraToColumnNum(EXTRA_ICON_ADV1); a2=ExtraToColumnNum(EXTRA_ICON_ADV2); w1=ExtraToColumnNum(EXTRA_ICON_WEB); c1=ExtraToColumnNum(EXTRA_ICON_CLIENT); }; memset(&ImgIndex,0,sizeof(&ImgIndex)); CallService(MS_PROTO_ENUMPROTOCOLS,(WPARAM)&count,(LPARAM)&protos); maxpr=0; //calc only needed protocols for(i=0;i<count;i++) { if(protos[i]->type!=PROTOTYPE_PROTOCOL || CallProtoService(protos[i]->szName,PS_GETCAPS,PFLAGNUM_2,0)==0) continue; ImgIndex[maxpr]=protos[i]->szName; maxpr++; } if (hContact==NULL) { hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); } do { szProto=NULL; hItem=hContact; if (hItem==0){continue;}; pdnce=GetDisplayNameCacheEntry(hItem); if (pdnce==NULL) {continue;}; // szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0); szProto=pdnce->szProto; { DBVARIANT dbv={0}; boolean showweb; showweb=FALSE; if (ExtraToColumnNum(EXTRA_ICON_WEB)!=-1) { if (szProto != NULL) { char *homepage; homepage=DBGetStringA(pdnce->hContact,"UserInfo", "Homepage"); if (!homepage) homepage=DBGetStringA(pdnce->hContact,pdnce->szProto, "Homepage"); if (homepage!=NULL) { showweb=TRUE; mir_free(homepage); } } PostMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(ExtraToColumnNum(EXTRA_ICON_WEB),(showweb)?2:0xFF)); if (dbv.pszVal!=NULL) mir_free(dbv.pszVal); } } { DBVARIANT dbv={0}; boolean showemail; showemail=TRUE; if (ExtraToColumnNum(EXTRA_ICON_EMAIL)!=-1) { if (szProto == NULL || DBGetContactSetting(hContact, szProto, "e-mail",&dbv)) { if (dbv.pszVal) mir_free(dbv.pszVal); if (DBGetContactSetting(hContact, "UserInfo", "Mye-mail0", &dbv)) { showemail=FALSE; if (dbv.pszVal) mir_free(dbv.pszVal); DBFreeVariant(&dbv); } } SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(ExtraToColumnNum(EXTRA_ICON_EMAIL),(showemail)?0:0xFF)); if (dbv.pszVal!=NULL) mir_free(dbv.pszVal); DBFreeVariant(&dbv); } } { DBVARIANT dbv={0}; boolean showsms; showsms=TRUE; if (ExtraToColumnNum(EXTRA_ICON_SMS)!=-1) { if (szProto == NULL || DBGetContactSetting(hContact, szProto, "Cellular",&dbv)) { if (dbv.pszVal) mir_free(dbv.pszVal); if (DBGetContactSetting(hContact, "UserInfo", "MyPhone0", &dbv)) { showsms=FALSE; if (dbv.pszVal) mir_free(dbv.pszVal); DBFreeVariant(&dbv); } } SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(ExtraToColumnNum(EXTRA_ICON_SMS),(showsms)?1:0xFF)); if (dbv.pszVal!=NULL) mir_free(dbv.pszVal); DBFreeVariant(&dbv); } } if(ExtraToColumnNum(EXTRA_ICON_CLIENT)!=-1) { if(szProto==NULL) {continue;}; if (pdnce->ci.idxClientIcon!=0&&pdnce->ci.idxClientIcon!=-1) { SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(ExtraToColumnNum(EXTRA_ICON_CLIENT),pdnce->ci.idxClientIcon)); } if(ExtraToColumnNum(EXTRA_ICON_PROTO)!=-1) { for (i=0;i<maxpr;i++) { if(!MyStrCmp(ImgIndex[i],szProto)) { SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(ExtraToColumnNum(EXTRA_ICON_PROTO),i+3)); break; }; }; }; }; NotifyEventHooks(hExtraImageApplying,(WPARAM)hContact,0); if (hcontgiven) break; Sleep(0); } while(hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0)); tick=GetTickCount()-tick; if (tick>0) { char buf[256]; mir_snprintf(buf,sizeof(buf),"SetAllExtraIcons %d ms, for %x\r\n",tick,inphcont); TRACE(buf); DBWriteContactSettingDword((HANDLE)0,"CLUI","PF:Last SetAllExtraIcons Time:",tick); } ON_SETALLEXTRAICON_CYCLE=0; //InvalidateRectZ(hwndList,NULL,FALSE); Sleep(0); }