summaryrefslogtreecommitdiff
path: root/protocols/Facebook/src/proto.h
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Facebook/src/proto.h')
-rw-r--r--protocols/Facebook/src/proto.h58
1 files changed, 56 insertions, 2 deletions
diff --git a/protocols/Facebook/src/proto.h b/protocols/Facebook/src/proto.h
index ed4342b773..aa8a9e60ab 100644
--- a/protocols/Facebook/src/proto.h
+++ b/protocols/Facebook/src/proto.h
@@ -20,20 +20,70 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
+#define FB_HOST_BAPI "https://b-api.facebook.com"
+
+#define FACEBOOK_MESSAGE_LIMIT 100000
+
#include "../../../miranda-private-keys/Facebook/app_secret.h"
class FacebookProto;
struct AsyncHttpRequest : public MTHttpRequest<FacebookProto>
{
+ struct Param
+ {
+ Param(const char *p1, const char *p2) :
+ key(p1), val(p2)
+ {}
+
+ CMStringA key, val;
+ };
+ OBJLIST<Param> params;
+
+ AsyncHttpRequest();
+
void CalcSig();
};
+AsyncHttpRequest *operator<<(AsyncHttpRequest *, const CHAR_PARAM &);
+AsyncHttpRequest *operator<<(AsyncHttpRequest *, const INT_PARAM &);
+
+class JsonReply
+{
+ JSONNode *m_root = nullptr;
+ int m_errorCode = 0;
+ JSONNode *m_data = nullptr;
+
+public:
+ JsonReply(NETLIBHTTPREQUEST *);
+ ~JsonReply();
+
+ __forceinline JSONNode &data() const { return *m_data; }
+ __forceinline int error() const { return m_errorCode; }
+};
+
class FacebookProto : public PROTO<FacebookProto>
{
- AsyncHttpRequest* CreateGraphql(const char *szName, const char *szMethod);
+ AsyncHttpRequest* CreateRequest(const char *szName, const char *szMethod);
+ NETLIBHTTPREQUEST* ExecuteRequest(AsyncHttpRequest *pReq);
+
+ // MQTT functions
+ void MqttOpen();
+
+ // internal data
+ CMStringA m_szDeviceID; // stored, GUID that identifies this miranda's account
+ CMStringA m_szClientID; // stored, random alphanumeric string of 20 chars
+ __int64 m_uid; // stored, Facebook user id
+ __int64 m_iMqttId;
+
+ bool m_invisible;
+ bool m_bOnline;
- CMStringA szDeviceID;
+ CMStringA m_szAuthToken; // calculated
+
+ void OnLoggedOut();
+
+ void __cdecl ServerThread(void *);
public:
FacebookProto(const char *proto_name, const wchar_t *username);
@@ -43,6 +93,10 @@ public:
// PROTO_INTERFACE
void OnModulesLoaded() override;
+
+ INT_PTR GetCaps(int type, MCONTACT hContact) override;
+
+ int SetStatus(int iNewStatus) override;
};
struct CMPlugin : public ACCPROTOPLUGIN<FacebookProto>