Changeset 4175 for trunk/console
- Timestamp:
- 07/23/05 10:10:15 (3 years ago)
- Location:
- trunk/console/src
- Files:
-
- 3 modified
-
console.cpp (modified) (8 diffs)
-
console.h (modified) (2 diffs)
-
event_data.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/console/src/console.cpp
r4143 r4175 354 354 if (FD_ISSET((*iter)->Pipe(), &fdSet)) 355 355 { 356 ProcessFile(iter); 356 if (!ProcessFile(*iter)) 357 { 358 delete *iter; 359 #undef erase 360 m_lFileStat.erase(iter); 361 } 362 357 363 break; 358 364 } … … 644 650 * CLicqConsole::ProcessFile 645 651 *-------------------------------------------------------------------------*/ 646 void CLicqConsole::ProcessFile(list<CFileTransferManager *>::iterator iter)652 bool CLicqConsole::ProcessFile(CFileTransferManager *ftman) 647 653 { 648 654 char buf[32]; 649 655 bool bCloseFT = false; 650 read( (*iter)->Pipe(), buf, 32);656 read(ftman->Pipe(), buf, 32); 651 657 652 658 CFileTransferEvent *e = NULL; 653 659 654 while ((e = (*iter)->PopFileTransferEvent()) != NULL)660 while ((e = ftman->PopFileTransferEvent()) != NULL) 655 661 { 656 662 switch(e->Command()) … … 703 709 bCloseFT = true; 704 710 break; 711 712 case FT_CONFIRMxFILE: 713 ftman->StartReceivingFile(const_cast<char *>(ftman->FileName())); 714 break; 705 715 } 706 716 707 717 if (bCloseFT) 708 718 { 709 (*iter)->CloseFileTransfer(); 710 delete *iter; 711 #undef erase 712 m_lFileStat.erase(iter); 719 ftman->CloseFileTransfer(); 713 720 delete e; 714 return ;721 return false; 715 722 } 716 723 717 724 delete e; 718 725 } 726 727 return true; 719 728 } 720 729 … … 1596 1605 // Do we want to accept the file transfer? 1597 1606 if (e->SubCommand() == ICQ_CMDxSUB_FILE) 1598 //FIXME 1599 //FileChatOffer(e->Sequence(), u->Uin()); 1607 FileChatOffer(e, szId, nPPID); 1600 1608 1601 1609 delete e; … … 3040 3048 * CLicqConsole::FileChatOffer 3041 3049 *-------------------------------------------------------------------------*/ 3042 void CLicqConsole::FileChatOffer(unsigned long _nSequence, const char *_szId, unsigned long _nPPID) 3043 { 3050 void CLicqConsole::FileChatOffer(CUserEvent *e, const char *_szId, unsigned long _nPPID) 3051 { 3052 CEventFile *f = (CEventFile *)e; 3044 3053 // Get y or n 3045 3054 winMain->fProcessInput = &CLicqConsole::InputFileChatOffer; 3046 3055 winMain->state = STATE_QUERY; 3047 winMain->data = new DataFileChatOffer( _nSequence, _szId, _nPPID);3056 winMain->data = new DataFileChatOffer(f, _szId, _nPPID); 3048 3057 winMain->wprintf("%C%ADo you wish to accept this request? (y/N) %C%Z", 3049 3058 m_cColorQuery->nColor, m_cColorQuery->nAttr, 8, A_BOLD); … … 3060 3069 DataFileChatOffer *data = (DataFileChatOffer *)winMain->data; 3061 3070 char *sz; 3071 CEventFile *f = data->f; 3062 3072 3063 3073 switch(winMain->state) … … 3077 3087 m_lFileStat.push_back(ftman); 3078 3088 3089 // Now watch the file pipe 3090 FD_SET(ftman->Pipe(), &fdSet); 3091 3092 3079 3093 // Accept the file 3080 3094 const char *home = getenv("HOME"); 3081 3095 ftman->ReceiveFiles(home); 3082 // XXX hack3083 unsigned long dummy[2] = { 0, 0};3084 3096 licqDaemon->icqFileTransferAccept(strtoul(data->szId, (char **)NULL, 10), ftman->LocalPort(), 3085 data->nSequence, dummy, true); 3097 f->Sequence(), f->MessageID(), f->IsDirect(), 3098 f->FileDescription(), f->Filename(), f->FileSize()); 3086 3099 winMain->fProcessInput = &CLicqConsole::InputCommand; 3087 3100 … … 3115 3128 unsigned long dummy[2] = { 0, 0 }; 3116 3129 licqDaemon->icqFileTransferRefuse(strtoul(data->szId, (char **)NULL, 10), data->szReason, 3117 data->nSequence, dummy, true);3130 f->Sequence(), dummy, true); 3118 3131 3119 3132 // We are done now -
trunk/console/src/console.h
r4143 r4175 109 109 void ProcessStdin(); 110 110 void ProcessLog(); 111 void ProcessFile(list<CFileTransferManager *>::iterator iter);111 bool ProcessFile(CFileTransferManager *); 112 112 char *CurrentGroupName(); 113 113 void SwitchToCon(unsigned short nCon); … … 202 202 203 203 void Beep() { printf("\a"); fflush(stdout); } 204 void FileChatOffer( unsigned long, const char *, unsigned long);204 void FileChatOffer(CUserEvent *, const char *, unsigned long); 205 205 void RegistrationWizard(); 206 206 void InputRegistrationWizard(int cIn); -
trunk/console/src/event_data.h
r3768 r4175 115 115 { 116 116 public: 117 DataFileChatOffer(unsigned long _nSeq, const char *i, unsigned long n) : CData(i, n) 118 { szReason[0] = '\0'; nSequence = _nSeq; } 117 DataFileChatOffer(CEventFile *_f, const char *i, unsigned long n) : CData(i, n) 118 { szReason[0] = '\0'; f = _f; } 119 CEventFile *f; 119 120 char szReason[256]; 120 unsigned long nSequence;121 121 }; 122 122
