Changeset 4175 for trunk/console

Show
Ignore:
Timestamp:
07/23/05 10:10:15 (3 years ago)
Author:
emostar
Message:

Modified patch by Philip Nelson to compile one again.
Modified by me to actually receive files in the console plugin finally!

Location:
trunk/console/src
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/console/src/console.cpp

    r4143 r4175  
    354354        if (FD_ISSET((*iter)->Pipe(), &fdSet)) 
    355355        { 
    356           ProcessFile(iter); 
     356          if (!ProcessFile(*iter)) 
     357          { 
     358            delete *iter; 
     359#undef erase 
     360            m_lFileStat.erase(iter); 
     361          } 
     362 
    357363          break; 
    358364        } 
     
    644650 * CLicqConsole::ProcessFile 
    645651 *-------------------------------------------------------------------------*/ 
    646 void CLicqConsole::ProcessFile(list<CFileTransferManager *>::iterator iter) 
     652bool CLicqConsole::ProcessFile(CFileTransferManager *ftman) 
    647653{ 
    648654  char buf[32]; 
    649655  bool bCloseFT = false; 
    650   read((*iter)->Pipe(), buf, 32); 
     656  read(ftman->Pipe(), buf, 32); 
    651657 
    652658  CFileTransferEvent *e = NULL; 
    653659 
    654   while ((e = (*iter)->PopFileTransferEvent()) != NULL) 
     660  while ((e = ftman->PopFileTransferEvent()) != NULL) 
    655661  { 
    656662    switch(e->Command()) 
     
    703709      bCloseFT = true; 
    704710      break; 
     711 
     712    case FT_CONFIRMxFILE: 
     713      ftman->StartReceivingFile(const_cast<char *>(ftman->FileName())); 
     714      break; 
    705715    } 
    706716 
    707717    if (bCloseFT) 
    708718    { 
    709       (*iter)->CloseFileTransfer(); 
    710       delete *iter; 
    711 #undef erase 
    712       m_lFileStat.erase(iter); 
     719      ftman->CloseFileTransfer(); 
    713720      delete e; 
    714       return; 
     721      return false; 
    715722    } 
    716723 
    717724    delete e; 
    718725  } 
     726 
     727  return true; 
    719728} 
    720729 
     
    15961605    // Do we want to accept the file transfer? 
    15971606    if (e->SubCommand() == ICQ_CMDxSUB_FILE) 
    1598       //FIXME 
    1599       //FileChatOffer(e->Sequence(), u->Uin()); 
     1607      FileChatOffer(e, szId, nPPID); 
    16001608 
    16011609    delete e; 
     
    30403048 * CLicqConsole::FileChatOffer 
    30413049 *-------------------------------------------------------------------------*/ 
    3042 void CLicqConsole::FileChatOffer(unsigned long _nSequence, const char *_szId, unsigned long _nPPID) 
    3043 { 
     3050void CLicqConsole::FileChatOffer(CUserEvent *e, const char *_szId, unsigned long _nPPID) 
     3051{ 
     3052  CEventFile *f = (CEventFile *)e; 
    30443053  // Get y or n 
    30453054  winMain->fProcessInput = &CLicqConsole::InputFileChatOffer; 
    30463055  winMain->state = STATE_QUERY; 
    3047   winMain->data = new DataFileChatOffer(_nSequence, _szId, _nPPID); 
     3056  winMain->data = new DataFileChatOffer(f, _szId, _nPPID); 
    30483057  winMain->wprintf("%C%ADo you wish to accept this request? (y/N) %C%Z", 
    30493058                   m_cColorQuery->nColor, m_cColorQuery->nAttr, 8, A_BOLD); 
     
    30603069  DataFileChatOffer *data = (DataFileChatOffer *)winMain->data; 
    30613070  char *sz; 
     3071  CEventFile *f = data->f; 
    30623072 
    30633073  switch(winMain->state) 
     
    30773087          m_lFileStat.push_back(ftman); 
    30783088 
     3089          // Now watch the file pipe 
     3090          FD_SET(ftman->Pipe(), &fdSet); 
     3091 
     3092 
    30793093          // Accept the file 
    30803094          const char *home = getenv("HOME"); 
    30813095          ftman->ReceiveFiles(home); 
    3082           // XXX hack 
    3083           unsigned long dummy[2] = { 0, 0}; 
    30843096          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()); 
    30863099          winMain->fProcessInput = &CLicqConsole::InputCommand; 
    30873100 
     
    31153128      unsigned long dummy[2] = { 0, 0 }; 
    31163129      licqDaemon->icqFileTransferRefuse(strtoul(data->szId, (char **)NULL, 10), data->szReason, 
    3117                                         data->nSequence, dummy, true); 
     3130                                        f->Sequence(), dummy, true); 
    31183131 
    31193132      // We are done now 
  • trunk/console/src/console.h

    r4143 r4175  
    109109  void ProcessStdin(); 
    110110  void ProcessLog(); 
    111   void ProcessFile(list<CFileTransferManager *>::iterator iter); 
     111  bool ProcessFile(CFileTransferManager *); 
    112112  char *CurrentGroupName(); 
    113113  void SwitchToCon(unsigned short nCon); 
     
    202202 
    203203  void Beep() { printf("\a"); fflush(stdout); } 
    204   void FileChatOffer(unsigned long, const char *, unsigned long); 
     204  void FileChatOffer(CUserEvent *, const char *, unsigned long); 
    205205  void RegistrationWizard(); 
    206206  void InputRegistrationWizard(int cIn); 
  • trunk/console/src/event_data.h

    r3768 r4175  
    115115{ 
    116116public: 
    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; 
    119120  char szReason[256]; 
    120   unsigned long nSequence; 
    121121}; 
    122122