Logo Search packages:      
Sourcecode: nateon version File versions  Download package

void KNateon::slotREQCNEW ( ChatView *  pChat,
SendFileInfo pSendFileInfo 
) [private, slot]

파일을 받을때. Receive CTOC 0 xxx@nate.com N 45 REQC NEW 59.8.174.176:5004 10003209611:7652

파일 정보를 P2P 서버에 등록 시킨다.

local IP 얻는 방법

ex> CTOC 446 (Your id) N 57 REQC NEW (My IP):5004 (My CMN):7579

이유는 모르나, CTOC의 TID값을 0으로 보내야 끊기지 않습니다.

QString sCommand = "ring0320@nate.com N 48\r\nREQC NEW 124.136.183.198:5004 10014827278:5514\r\n";

파일 전송창

Definition at line 2569 of file knateon.cpp.

References FileTransfer::addListView(), P2PConnection::addSendFileInfo(), SQLiteDB::execOne(), nmconfig::filedownloadpath, BuddyList::getBuddyByID(), CurrentAccount::getBuddyList(), SendFileInfo::getFileName(), SendFileInfo::getFileSize(), NateonConnection::getLocalIP(), CurrentAccount::getMyCMN(), CurrentAccount::getMyID(), BuddyBase::getName(), BuddyBase::getNick(), SendFileInfo::getSSCookie(), SendFileInfo::getYourID(), m_pFileTransfer, m_pP2PServer, NateonDPConnection::messageSent(), nmconfig::p2pdbfilepath, nmconfig::p2pport, nmconfig::p2pserverip, and pSQLiteDB.

Referenced by createChat().

{
    /*! 파일 정보를 P2P 서버에 등록 시킨다. */
    m_pP2PServer->addSendFileInfo( pSendFileInfo );
    
    //! local IP 얻는 방법
    stConfig.p2pserverip = m_pDPcon->getLocalIP();
    
    /*!
      ex>
      CTOC 446 (Your id) N 57
      REQC NEW (My IP):5004 (My CMN):7579
    */
    QString sBody;
    sBody = "REQC";
    sBody += " ";
    sBody += "NEW";
    sBody += " ";
    sBody += stConfig.p2pserverip;
    sBody += ":";
    sBody += QString::number( stConfig.p2pport );
      sBody += " ";
    QString sP2PCookie( m_pCurrentAccount->getMyCMN() + ":" + QString::number(nREQC++) );
    sBody += sP2PCookie + "\r\n";

    /*!
      이유는 모르나,
      CTOC의 TID값을 0으로 보내야 끊기지 않습니다.
    */
    QString sCommand;
    sCommand = pSendFileInfo->getYourID();
    sCommand += " ";
    sCommand += "N";
    sCommand += " ";
    sCommand += QString::number( sBody.length() );
    sCommand += "\r\n";
    sCommand += sBody;
    /// QString sCommand = "ring0320@nate.com N 48\r\nREQC NEW 124.136.183.198:5004 10014827278:5514\r\n";

    m_pDPcon->messageSent( sCommand );

    QString sQuery;
    sQuery = "INSERT INTO tb_p2p ('File_Cookie', \
'P2P_Cookie',                                                      \
'Source_ID',                                                     \
'Destination_ID',                                                \
'File_Local_Path',                                               \
'P2P_Type',                                                      \
'Destination_P2P_IP',                                            \
'File_Name',                                                     \
'File_Size'                                                      \
) VALUES('";
    sQuery += pSendFileInfo->getSSCookie();
    sQuery += "', '";
    sQuery += sP2PCookie;
    sQuery += "', '";
    sQuery += pSendFileInfo->getYourID();
    sQuery += "', '";
    sQuery += m_pCurrentAccount->getMyID();
    sQuery += "', '";
    sQuery += stConfig.filedownloadpath;
    sQuery += "', '";
    sQuery += "R";
    sQuery += "', '";
    sQuery += stConfig.p2pserverip;
    sQuery += "', '";
    sQuery += ( pSendFileInfo->getFileName() ).utf8();
    sQuery += "', '";
    sQuery += QString::number( pSendFileInfo->getFileSize() );
    sQuery += "')";
    
    pSQLiteDB->execOne( stConfig.p2pdbfilepath, sQuery );

    /*! 파일 전송창 */
      if (! m_pFileTransfer ) {
            m_pFileTransfer = new FileTransfer();
        connect( m_pFileTransfer, SIGNAL( cancelFileTransfer( const QString & )), SLOT( slotMyTransferCancel( const QString & ) ) );
        if ( ! m_pFileTransfer->isShown() )
            m_pFileTransfer->show();
    }
    
    m_pBuddyList = m_pCurrentAccount->getBuddyList();
    Buddy* pBuddy = m_pBuddyList->getBuddyByID( pSendFileInfo->getYourID() );

    QString sReceiver;
    if ( pBuddy ) {
        sReceiver = pBuddy->getName();
        sReceiver += "(";
        sReceiver += pBuddy->getNick();
        sReceiver += ")";
    } else {
        sReceiver = pSendFileInfo->getYourID();
    }

    m_pFileTransfer->addListView(pSendFileInfo->getSSCookie(), sReceiver, pSendFileInfo->getFileName(),  pSendFileInfo->getFileSize(), false );
}


Generated by  Doxygen 1.6.0   Back to index