void CMMServer::ProcessPreviewRequest(CMMData* data, CMMSocket* sender){ uint8 byFileType = data->ReadByte(); uint8 byFileIndex = data->ReadByte(); uint16 nDisplayWidth = data->ReadShort(); uint8 nNumber = data->ReadByte(); CKnownFile* knownfile = NULL; bool bError = false; if (byFileType == MMT_PARTFILFE){ if (byFileIndex >= m_SentFileList.GetSize() || !theApp.downloadqueue->IsPartFile(m_SentFileList[byFileIndex])) { bError = true; } else knownfile = m_SentFileList[byFileIndex]; } else if (byFileType == MMT_FINISHEDFILE){ if (byFileIndex >= m_SentFinishedList.GetSize() || !theApp.knownfiles->IsKnownFile(m_SentFinishedList[byFileIndex])) { bError = true; } else knownfile = m_SentFinishedList[byFileIndex]; } if (!bError){ if (h_timer != 0) bError = true; else{ h_timer = SetTimer(0,0,20000,CommandTimer); if (!h_timer){ bError = true; } else{ if (nDisplayWidth > 140) nDisplayWidth = 140; m_byPendingCommand = MMT_PREVIEW; m_pPendingCommandSocket = sender; if (!knownfile->GrabImage(1,(nNumber+1)*50.0,true,nDisplayWidth,this)) PreviewFinished(NULL,0); } } } if (bError){ CMMPacket* packet = new CMMPacket(MMP_GENERALERROR); sender->SendPacket(packet); ASSERT ( false ); return; } }