2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

moved MTProtoSession and MTProtoConnection to MTP::internal:: namespace

This commit is contained in:
John Preston
2016-03-24 11:57:11 +03:00
parent 26e2918841
commit d9ef8217e5
15 changed files with 1247 additions and 1180 deletions

View File

@@ -24,15 +24,22 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "mtproto/dcenter.h"
#include "mtproto/rpc_sender.h"
class MTProtoSession;
namespace MTP {
namespace internal {
class MTPSessionData {
class Session;
class SessionData {
public:
MTPSessionData(MTProtoSession *creator)
: _session(0), _salt(0)
, _messagesSent(0), _fakeRequestId(-2000000000)
, _owner(creator), _keyChecked(false), _layerInited(false) {
SessionData(Session *creator)
: _session(0)
, _salt(0)
, _messagesSent(0)
, _fakeRequestId(-2000000000)
, _owner(creator)
, _keyChecked(false)
, _layerInited(false) {
}
void setSession(uint64 session) {
@@ -170,10 +177,10 @@ public:
return _fakeRequestId;
}
MTProtoSession *owner() {
Session *owner() {
return _owner;
}
const MTProtoSession *owner() const {
const Session *owner() const {
return _owner;
}
@@ -192,7 +199,7 @@ private:
uint32 _messagesSent;
mtpRequestId _fakeRequestId;
MTProtoSession *_owner;
Session *_owner;
mtpAuthKeyPtr _authKey;
bool _keyChecked, _layerInited;
@@ -217,12 +224,12 @@ private:
};
class MTProtoSession : public QObject {
class Session : public QObject {
Q_OBJECT
public:
MTProtoSession(int32 dcenter);
Session(int32 dcenter);
void restart();
void stop();
@@ -231,7 +238,7 @@ public:
void unpaused();
int32 getDcWithShift() const;
~MTProtoSession();
~Session();
QReadWriteLock *keyMutex() const;
void notifyKeyCreated(const mtpAuthKeyPtr &key);
@@ -278,12 +285,12 @@ public slots:
private:
MTProtoConnection *_connection;
Connection *_connection;
bool _killed;
bool _needToReceive;
MTPSessionData data;
SessionData data;
int32 dcWithShift;
MTProtoDCPtr dc;
@@ -297,8 +304,11 @@ private:
};
inline QReadWriteLock *MTPSessionData::keyMutex() const {
inline QReadWriteLock *SessionData::keyMutex() const {
return _owner->keyMutex();
}
MTPrpcError rpcClientError(const QString &type, const QString &description = QString());
} // namespace internal
} // namespace MTP