Skip to content
Snippets Groups Projects
Select Git revision
  • master
  • release/202005
  • release/202001
  • release/201912
  • release/201911
  • release/releaseWindowsTestOne
  • release/windowsReleaseTest
  • release/releaseTest
  • release/releaseWindowsTest
  • release/201910
  • release/qt/201910
  • release/windows-test/201910
  • release/201908
  • release/201906
  • release/201905
  • release/201904
  • release/201903
  • release/201902
  • release/201901
  • release/201812
  • 4.0.0
  • 2.2.0
  • 2.1.0
  • 2.0.1
  • 2.0.0
  • 1.4.1
  • 1.4.0
  • 1.3.0
  • 1.2.0
  • 1.1.0
30 results

NEWS

Blame
    • ovari's avatar
      ad5b6cba
      misc: unify terminology · ad5b6cba
      ovari authored and ovari's avatar ovari committed
      8+3 filename → 8.3 filename
      be ware → beware
      {cannot, can not, cant, can't, could not, couldn't} → unable to
      conpleted → completed
      file name → filename
      imcomplete → incomplete
      informations → information
      trying to → attempting to
      wrong password → incorrect password
      
      GitLab: jami-client-qt#1730
      
      Change-Id: Ia7757efafd2c06af978db02c65b40b1b77c393f8
      ad5b6cba
      History
      misc: unify terminology
      ovari authored and ovari's avatar ovari committed
      8+3 filename → 8.3 filename
      be ware → beware
      {cannot, can not, cant, can't, could not, couldn't} → unable to
      conpleted → completed
      file name → filename
      imcomplete → incomplete
      informations → information
      trying to → attempting to
      wrong password → incorrect password
      
      GitLab: jami-client-qt#1730
      
      Change-Id: Ia7757efafd2c06af978db02c65b40b1b77c393f8
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    To find the state of this project's repository at the time of any of these versions, check out the tags.
    ftp_server.cpp 6.37 KiB
    /*
     *  Copyright (C) 2017-2019 Savoir-faire Linux Inc.
     *
     *  Author: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com>
     *
     *  This program is free software; you can redistribute it and/or modify
     *  it under the terms of the GNU General Public License as published by
     *  the Free Software Foundation; either version 3 of the License, or
     *  (at your option) any later version.
     *
     *  This program is distributed in the hope that it will be useful,
     *  but WITHOUT ANY WARRANTY; without even the implied warranty of
     *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     *  GNU General Public License for more details.
     *
     *  You should have received a copy of the GNU General Public License
     *  along with this program; if not, write to the Free Software
     *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
     */
    
    #include "ftp_server.h"
    
    #include "logger.h"
    #include "string_utils.h"
    #include "manager.h"
    
    #include <algorithm>
    #include <array>
    #include <stdexcept>
    #include <iterator>
    #include <cstdlib> // strtoull
    
    namespace jami {
    
    //==============================================================================
    
    FtpServer::FtpServer(const std::string& account_id,
                         const std::string& peer_uri)
        : Stream()
        , accountId_ {account_id}
        , peerUri_ {peer_uri}
    {}
    
    DRing::DataTransferId
    FtpServer::getId() const
    {
        // Because FtpServer is just the protocol on the top of a stream so the id
        // of the stream is the id of out_.
        return out_.id;
    }
    
    void
    FtpServer::close() noexcept
    {
        closeCurrentFile();
        JAMI_WARN() << "[FTP] server closed";
    }
    
    bool
    FtpServer::startNewFile()
    {
        // Request filename from client (WARNING: synchrone call!)
        DRing::DataTransferInfo info {};
        info.accountId = accountId_;
        info.peer = peerUri_;
        info.displayName = displayName_;
        info.totalSize = fileSize_;
        info.bytesProgress = 0;
        rx_ = 0;
        out_ = Manager::instance().dataTransfers->onIncomingFileRequest(info); // we block here until answer from client