~ubuntu-branches/ubuntu/trusty/quassel/trusty-proposed

« back to all changes in this revision

Viewing changes to src/core/core.h

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman
  • Date: 2014-02-18 23:18:25 UTC
  • mto: This revision was merged to the branch mainline in revision 98.
  • Revision ID: package-import@ubuntu.com-20140218231825-hfgaeo3nmszt2pth
Tags: upstream-0.10~beta1
ImportĀ upstreamĀ versionĀ 0.10~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/***************************************************************************
2
 
 *   Copyright (C) 2005-2013 by the Quassel Project                        *
 
2
 *   Copyright (C) 2005-2014 by the Quassel Project                        *
3
3
 *   devel@quassel-irc.org                                                 *
4
4
 *                                                                         *
5
5
 *   This program is free software; you can redistribute it and/or modify  *
41
41
#include "storage.h"
42
42
#include "types.h"
43
43
 
 
44
class CoreAuthHandler;
44
45
class CoreSession;
45
 
class RemotePeer;
46
46
struct NetworkInfo;
47
47
class SessionThread;
48
48
class SignalProxy;
64
64
    /*** Storage access ***/
65
65
    // These methods are threadsafe.
66
66
 
 
67
    //! Validate user
 
68
    /**
 
69
     * \param userName The user's login name
 
70
     * \param password The user's uncrypted password
 
71
     * \return The user's ID if valid; 0 otherwise
 
72
     */
 
73
    static inline UserId validateUser(const QString &userName, const QString &password) {
 
74
        return instance()->_storage->validateUser(userName, password);
 
75
    }
 
76
 
67
77
    //! Store a user setting persistently
68
78
    /**
69
79
     * \param userId       The users Id
472
482
    }
473
483
 
474
484
 
475
 
    const QDateTime &startTime() const { return _startTime; }
 
485
    static inline QDateTime startTime() { return instance()->_startTime; }
 
486
    static inline bool isConfigured() { return instance()->_configured; }
 
487
    static bool sslSupported();
 
488
    static QVariantList backendInfo();
 
489
 
 
490
    static QString setup(const QString &adminUser, const QString &adminPassword, const QString &backend, const QVariantMap &setupData);
476
491
 
477
492
    static inline QTimer &syncTimer() { return instance()->_storageSyncTimer; }
478
493
 
486
501
     */
487
502
    void syncStorage();
488
503
    void setupInternalClientSession(InternalPeer *clientConnection);
 
504
    QString setupCore(const QString &adminUser, const QString &adminPassword, const QString &backend, const QVariantMap &setupData);
489
505
 
490
506
signals:
491
507
    //! Sent when a BufferInfo is updated in storage.
492
508
    void bufferInfoUpdated(UserId user, const BufferInfo &info);
493
509
 
494
 
    //! Relay From CoreSession::sessionState(const QVariant &). Used for internal connection only
495
 
    void sessionState(const QVariant &);
 
510
    //! Relay from CoreSession::sessionState(). Used for internal connection only
 
511
    void sessionState(const Protocol::SessionState &sessionState);
496
512
 
497
513
protected:
498
514
    virtual void customEvent(QEvent *event);
503
519
    void incomingConnection();
504
520
    void clientDisconnected();
505
521
 
506
 
    bool initStorage(const QString &backend, QVariantMap settings, bool setup = false);
507
 
    bool initStorage(QVariantMap dbSettings, bool setup = false);
508
 
 
509
 
#ifdef HAVE_SSL
510
 
    void sslErrors(const QList<QSslError> &errors);
511
 
#endif
512
 
    void socketError(QAbstractSocket::SocketError);
513
 
 
514
 
    void processClientMessage(const QVariant &data);
 
522
    bool initStorage(const QString &backend, const QVariantMap &settings, bool setup = false);
 
523
 
 
524
    void socketError(QAbstractSocket::SocketError err, const QString &errorString);
 
525
    void setupClientSession(RemotePeer *, UserId);
515
526
 
516
527
private:
517
528
    Core();
520
531
    static Core *instanceptr;
521
532
 
522
533
    SessionThread *createSession(UserId userId, bool restoreState = false);
523
 
    void setupClientSession(RemotePeer *peer, UserId uid);
524
534
    void addClientHelper(RemotePeer *peer, UserId uid);
525
535
    //void processCoreSetup(QTcpSocket *socket, QVariantMap &msg);
526
536
    QString setupCoreForInternalUsage();
527
 
    QString setupCore(QVariantMap setupData);
528
537
 
529
538
    void registerStorageBackends();
530
539
    bool registerStorageBackend(Storage *);
536
545
    void saveBackendSettings(const QString &backend, const QVariantMap &settings);
537
546
    QVariantMap promptForSettings(const Storage *storage);
538
547
 
 
548
private:
 
549
    QSet<CoreAuthHandler *> _connectingClients;
539
550
    QHash<UserId, SessionThread *> sessions;
540
551
    Storage *_storage;
541
552
    QTimer _storageSyncTimer;
548
559
 
549
560
    OidentdConfigGenerator *_oidentdConfigGenerator;
550
561
 
551
 
    QHash<RemotePeer *, QVariantMap> clientInfo;
552
 
 
553
562
    QHash<QString, Storage *> _storageBackends;
554
563
 
555
564
    QDateTime _startTime;