Skip to content
Snippets Groups Projects
Select Git revision
  • 0bb2fe44517b74b09929ee9cc1b62806ce585506
  • master default protected
  • release/202005
  • release/202001
  • release/201912
  • release/201911
  • release/releaseWindowsTestOne
  • release/releaseTest
  • release/releaseWindowsTest
  • release/windowsReleaseTest
  • 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
  • 1.0.0
  • 0.3.0
  • 0.2.1
  • 0.2.0
  • 0.1.0
26 results

account_p.h

Blame
  • user avatar
    Emmanuel Lepage Vallee authored
    It was previously hardcoded and useless. It still is, but now use
    the real Certificate objects with real data. The algoritm as is
    cannot work with the new data sources. It will be upgraded in
    further commits. This one only make it work again.
    
    Refs #66528
    0bb2fe44
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    account_p.h 4.85 KiB
    /****************************************************************************
     *   Copyright (C) 2015 by Savoir-Faire Linux                               *
     *   Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
     *                                                                          *
     *   This library is free software; you can redistribute it and/or          *
     *   modify it under the terms of the GNU Lesser General Public             *
     *   License as published by the Free Software Foundation; either           *
     *   version 2.1 of the License, or (at your option) any later version.     *
     *                                                                          *
     *   This library 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      *
     *   Lesser General Public License for more details.                        *
     *                                                                          *
     *   You should have received a copy of the GNU General Public License      *
     *   along with this program.  If not, see <http://www.gnu.org/licenses/>.  *
     ***************************************************************************/
    #ifndef ACCOUNTPRIVATE_H
    #define ACCOUNTPRIVATE_H
    
    #include <QtCore/QObject>
    #include <QtCore/QHash>
    #include <account.h>
    
    class AccountPrivate;
    class ContactMethod;
    class CipherModel;
    class AccountStatusModel;
    class TlsMethodModel;
    class ProtocolModel;
    class BootstrapModel;
    
    typedef void (AccountPrivate::*account_function)();
    
    class AccountPrivate : public QObject
    {
    public:
       Q_OBJECT
       Q_DECLARE_PUBLIC(Account)
    
       class RegistrationEnabled {
          public:
             constexpr static const char* YES  = "true";
             constexpr static const char* NO   = "false";
       };
    
       friend class AccountPlaceHolder;
       friend class AccountModel;
       friend class AccountModelPrivate;
       friend class CipherModelPrivate;
       friend class CipherModel;
       friend class AccountStatusModelPrivate;
       friend class AccountStatusModel;
       friend class TlsMethodModelPrivate;
       friend class TlsMethodModel;
       friend class BootstrapModelPrivate;
    
       //Constructor
       explicit AccountPrivate(Account* acc);
    
       //Attributes
       QByteArray                 m_AccountId                ;
       QHash<QString,QString>     m_hAccountDetails          ;
       ContactMethod*             m_pAccountNumber           ;
       Account*                   q_ptr                      ;
       bool                       m_isLoaded                 ;
       int                        m_LastTransportCode        ;
       QString                    m_LastTransportMessage     ;
       Account::RegistrationState m_RegistrationState        ;
       QString                    m_LastSipRegistrationStatus;
       unsigned short             m_UseDefaultPort           ;
    
       //Setters
       void setAccountProperties(const QHash<QString,QString>& m          );
       bool setAccountProperty  (const QString& param, const QString& val );
    
       //Getters
       const QString accountDetail(const QString& param) const;
    
       //Mutator
       bool merge(Account* account);
       //Constructors
       static Account* buildExistingAccountFromId(const QByteArray& _accountId);
       static Account* buildNewAccountFromAlias  (Account::Protocol proto, const QString& alias);
    
       //Helpers
       inline void changeState(Account::EditState state);
       bool updateState();
       void regenSecurityValidation();
    
       //State actions
       void performAction(Account::EditAction action);
       void nothing();
       void edit   ();
       void modify ();
       void remove ();
       void cancel ();
       void outdate();
       void reload ();
       void save   ();
       void reloadMod() {reload();modify();};
    
       CredentialModel*          m_pCredentials     ;
       CodecModel*               m_pCodecModel      ;
       RingToneModel*            m_pRingToneModel   ;
       KeyExchangeModel*         m_pKeyExchangeModel;
       CipherModel*              m_pCipherModel     ;
       AccountStatusModel*       m_pStatusModel     ;
       SecurityValidationModel*  m_pSecurityValidationModel;
       TlsMethodModel*           m_pTlsMethodModel  ;
       ProtocolModel*            m_pProtocolModel   ;
       BootstrapModel*           m_pBootstrapModel  ;
       Account::EditState m_CurrentState;
    
       // State machines
       static const account_function stateMachineActionsOnState[6][7];
    
       //Cached account details (as they are called too often for the hash)
       mutable QString      m_HostName;
       mutable QString      m_LastErrorMessage;
       mutable int          m_LastErrorCode;
       mutable int          m_VoiceMailCount;
       mutable Certificate* m_pCaCert;
       mutable Certificate* m_pTlsCert;
       mutable Certificate* m_pPrivateKey;
    
    public Q_SLOTS:
          void slotPresentChanged        (bool  present  );
          void slotPresenceMessageChanged(const QString& );
          void slotUpdateCertificate     (               );
    };
    
    #endif