summaryrefslogtreecommitdiff
path: root/protocols/Facebook/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Facebook/src')
-rw-r--r--protocols/Facebook/src/avatars.cpp2
-rw-r--r--protocols/Facebook/src/db.h12
-rw-r--r--protocols/Facebook/src/dialogs.cpp2
-rw-r--r--protocols/Facebook/src/dialogs.h2
-rw-r--r--protocols/Facebook/src/groupchats.cpp8
-rw-r--r--protocols/Facebook/src/http.cpp29
-rw-r--r--protocols/Facebook/src/main.cpp2
-rw-r--r--protocols/Facebook/src/mqtt.cpp2
-rw-r--r--protocols/Facebook/src/mqtt.h2
-rw-r--r--protocols/Facebook/src/options.cpp2
-rw-r--r--protocols/Facebook/src/proto.cpp2
-rw-r--r--protocols/Facebook/src/proto.h15
-rw-r--r--protocols/Facebook/src/server.cpp22
-rw-r--r--protocols/Facebook/src/stdafx.cxx2
-rw-r--r--protocols/Facebook/src/stdafx.h2
-rw-r--r--protocols/Facebook/src/thrift.cpp2
-rw-r--r--protocols/Facebook/src/version.h4
17 files changed, 41 insertions, 71 deletions
diff --git a/protocols/Facebook/src/avatars.cpp b/protocols/Facebook/src/avatars.cpp
index 453c78f0f8..fb3619f4a1 100644
--- a/protocols/Facebook/src/avatars.cpp
+++ b/protocols/Facebook/src/avatars.cpp
@@ -1,7 +1,7 @@
/*
Facebook plugin for Miranda NG
-Copyright © 2019-24 Miranda NG team
+Copyright © 2019-25 Miranda NG team
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
diff --git a/protocols/Facebook/src/db.h b/protocols/Facebook/src/db.h
index c7c8b9bf43..3d75fae2fb 100644
--- a/protocols/Facebook/src/db.h
+++ b/protocols/Facebook/src/db.h
@@ -3,7 +3,7 @@
Facebook plugin for Miranda Instant Messenger
_____________________________________________
-Copyright © 2009-11 Michal Zelinka, 2011-17 Robert Pösel, 2017-24 Miranda NG team
+Copyright © 2009-11 Michal Zelinka, 2011-17 Robert Pösel, 2017-25 Miranda NG team
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
@@ -42,3 +42,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Hidden account DB keys (can't be changed through GUI)
#define DBKEY_LOCALE "Locale" // [HIDDEN] - (string) en_US, cs_CZ, etc. (requires restart to apply)
+
+struct FbReply : public JsonReply
+{
+ FbReply(MHttpResponse *response) :
+ JsonReply(response)
+ {
+ if (m_root)
+ m_errorCode = (*m_root)["error_code"].as_int();
+ }
+};
diff --git a/protocols/Facebook/src/dialogs.cpp b/protocols/Facebook/src/dialogs.cpp
index 607346db41..f040d7d251 100644
--- a/protocols/Facebook/src/dialogs.cpp
+++ b/protocols/Facebook/src/dialogs.cpp
@@ -3,7 +3,7 @@
Facebook plugin for Miranda Instant Messenger
_____________________________________________
-Copyright © 2009-11 Michal Zelinka, 2011-17 Robert Pösel, 2017-24 Miranda NG team
+Copyright © 2009-11 Michal Zelinka, 2011-17 Robert Pösel, 2017-25 Miranda NG team
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
diff --git a/protocols/Facebook/src/dialogs.h b/protocols/Facebook/src/dialogs.h
index 7497f81587..aae5119b74 100644
--- a/protocols/Facebook/src/dialogs.h
+++ b/protocols/Facebook/src/dialogs.h
@@ -3,7 +3,7 @@
Facebook plugin for Miranda Instant Messenger
_____________________________________________
-Copyright © 2009-11 Michal Zelinka, 2011-17 Robert Pösel, 2017-24 Miranda NG team
+Copyright © 2009-11 Michal Zelinka, 2011-17 Robert Pösel, 2017-25 Miranda NG team
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
diff --git a/protocols/Facebook/src/groupchats.cpp b/protocols/Facebook/src/groupchats.cpp
index b185026215..cc20fceb4e 100644
--- a/protocols/Facebook/src/groupchats.cpp
+++ b/protocols/Facebook/src/groupchats.cpp
@@ -1,7 +1,7 @@
/*
Facebook plugin for Miranda NG
-Copyright © 2019-24 Miranda NG team
+Copyright © 2019-25 Miranda NG team
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
@@ -42,7 +42,7 @@ class CGroupchatInviteDlg : public CFBDlgBase
{
m_clc.SetHideEmptyGroups(1);
m_clc.SetHideOfflineRoot(1);
- m_clc.SetOfflineModes(PF2_NONE);
+ m_clc.SetOfflineModes(PF2_FREECHAT);
}
public:
@@ -87,7 +87,7 @@ public:
pReq << CHAR_PARAM("to", list.write().c_str()) << WCHAR_PARAM("id", CMStringW(FORMAT, L"t_%s", m_si->ptszID));
pReq->CalcSig();
- JsonReply reply(m_proto->ExecuteRequest(pReq));
+ FbReply reply(m_proto->ExecuteRequest(pReq));
return true;
}
};
@@ -233,7 +233,7 @@ int FacebookProto::Chat_KickUser(SESSION_INFO *si, const wchar_t *pwszUid)
}
pReq->CalcSig();
- JsonReply reply(ExecuteRequest(pReq));
+ FbReply reply(ExecuteRequest(pReq));
return reply.error();
}
diff --git a/protocols/Facebook/src/http.cpp b/protocols/Facebook/src/http.cpp
index e5ffa5d99e..033fc47b80 100644
--- a/protocols/Facebook/src/http.cpp
+++ b/protocols/Facebook/src/http.cpp
@@ -1,7 +1,7 @@
/*
Facebook plugin for Miranda NG
-Copyright © 2019-24 Miranda NG team
+Copyright © 2019-25 Miranda NG team
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
@@ -69,33 +69,6 @@ AsyncHttpRequest* operator<<(AsyncHttpRequest *pReq, const INT_PARAM &param)
/////////////////////////////////////////////////////////////////////////////////////////
-JsonReply::JsonReply(MHttpResponse *pReply)
-{
- if (pReply == nullptr) {
- m_errorCode = 500;
- return;
- }
-
- m_errorCode = pReply->resultCode;
- if (m_errorCode != 200)
- return;
-
- m_root = json_parse(pReply->body);
- if (m_root == nullptr) {
- m_errorCode = 500;
- return;
- }
-
- m_errorCode = (*m_root)["error_code"].as_int();
-}
-
-JsonReply::~JsonReply()
-{
- json_delete(m_root);
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
AsyncHttpRequest* FacebookProto::CreateRequest(const char *url, const char *szName, const char *szMethod)
{
AsyncHttpRequest *pReq = new AsyncHttpRequest();
diff --git a/protocols/Facebook/src/main.cpp b/protocols/Facebook/src/main.cpp
index d256d752d9..eca2f249c6 100644
--- a/protocols/Facebook/src/main.cpp
+++ b/protocols/Facebook/src/main.cpp
@@ -1,7 +1,7 @@
/*
Facebook plugin for Miranda NG
-Copyright © 2019-24 Miranda NG team
+Copyright © 2019-25 Miranda NG team
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
diff --git a/protocols/Facebook/src/mqtt.cpp b/protocols/Facebook/src/mqtt.cpp
index 08c92161ef..c635f95b8a 100644
--- a/protocols/Facebook/src/mqtt.cpp
+++ b/protocols/Facebook/src/mqtt.cpp
@@ -1,7 +1,7 @@
/*
Facebook plugin for Miranda NG
-Copyright © 2019-24 Miranda NG team
+Copyright © 2019-25 Miranda NG team
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
diff --git a/protocols/Facebook/src/mqtt.h b/protocols/Facebook/src/mqtt.h
index 191026e172..0aaf606837 100644
--- a/protocols/Facebook/src/mqtt.h
+++ b/protocols/Facebook/src/mqtt.h
@@ -1,7 +1,7 @@
/*
Facebook plugin for Miranda NG
-Copyright © 2019-24 Miranda NG team
+Copyright © 2019-25 Miranda NG team
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
diff --git a/protocols/Facebook/src/options.cpp b/protocols/Facebook/src/options.cpp
index 149f26a5c7..71e0c0942e 100644
--- a/protocols/Facebook/src/options.cpp
+++ b/protocols/Facebook/src/options.cpp
@@ -1,7 +1,7 @@
/*
Facebook plugin for Miranda NG
-Copyright © 2019-24 Miranda NG team
+Copyright © 2019-25 Miranda NG team
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
diff --git a/protocols/Facebook/src/proto.cpp b/protocols/Facebook/src/proto.cpp
index 68b408d64b..7bd124cbb8 100644
--- a/protocols/Facebook/src/proto.cpp
+++ b/protocols/Facebook/src/proto.cpp
@@ -1,7 +1,7 @@
/*
Facebook plugin for Miranda NG
-Copyright © 2019-24 Miranda NG team
+Copyright © 2019-25 Miranda NG team
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
diff --git a/protocols/Facebook/src/proto.h b/protocols/Facebook/src/proto.h
index d82cc80335..87e31351f7 100644
--- a/protocols/Facebook/src/proto.h
+++ b/protocols/Facebook/src/proto.h
@@ -1,7 +1,7 @@
/*
Facebook plugin for Miranda NG
-Copyright © 2019-24 Miranda NG team
+Copyright © 2019-25 Miranda NG team
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
@@ -326,19 +326,6 @@ struct AsyncHttpRequest : public MTHttpRequest<FacebookProto>
AsyncHttpRequest *operator<<(AsyncHttpRequest *, const CHAR_PARAM &);
AsyncHttpRequest *operator<<(AsyncHttpRequest *, const INT_PARAM &);
-class JsonReply
-{
- JSONNode *m_root = nullptr;
- int m_errorCode = 0;
-
-public:
- JsonReply(MHttpResponse *);
- ~JsonReply();
-
- __forceinline JSONNode &data() const { return *m_root; }
- __forceinline int error() const { return m_errorCode; }
-};
-
/////////////////////////////////////////////////////////////////////////////////////////
struct FacebookUser
diff --git a/protocols/Facebook/src/server.cpp b/protocols/Facebook/src/server.cpp
index 4a22f18132..6eebad7ec8 100644
--- a/protocols/Facebook/src/server.cpp
+++ b/protocols/Facebook/src/server.cpp
@@ -1,7 +1,7 @@
/*
Facebook plugin for Miranda NG
-Copyright © 2019-24 Miranda NG team
+Copyright © 2019-25 Miranda NG team
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
@@ -157,7 +157,7 @@ int FacebookProto::RefreshContacts()
pReq->flags |= NLHRF_NODUMPSEND;
pReq->CalcSig();
- JsonReply reply(ExecuteRequest(pReq));
+ FbReply reply(ExecuteRequest(pReq));
if (int iErrorCode = reply.error())
return iErrorCode; // unknown error
@@ -238,7 +238,7 @@ bool FacebookProto::RefreshSid()
pReq << CHAR_PARAM("query_params", root.write().c_str());
pReq->CalcSig();
- JsonReply reply(ExecuteRequest(pReq));
+ FbReply reply(ExecuteRequest(pReq));
if (reply.error())
return false;
@@ -320,7 +320,7 @@ FacebookUser* FacebookProto::RefreshThread(CMStringW &wszId)
pReq << WCHAR_PARAM("query_params", CMStringW(FORMAT, L"{\"0\":[\"%s\"], \"12\":0, \"13\":\"false\"}", wszId.c_str()));
pReq->CalcSig();
- JsonReply reply(ExecuteRequest(pReq));
+ FbReply reply(ExecuteRequest(pReq));
if (!reply.error()) {
auto &root = reply.data();
for (auto &n : root)
@@ -339,7 +339,7 @@ void FacebookProto::RefreshThreads()
pReq << CHAR_PARAM("query_params", json.write().c_str());
pReq->CalcSig();
- JsonReply reply(ExecuteRequest(pReq));
+ FbReply reply(ExecuteRequest(pReq));
if (!reply.error()) {
auto &root = reply.data()["viewer"]["message_threads"];
@@ -361,7 +361,7 @@ int FacebookProto::RefreshToken()
pReq << CHAR_PARAM("password", getMStringA(DBKEY_PASS));
pReq->CalcSig();
- JsonReply reply(ExecuteRequest(pReq));
+ FbReply reply(ExecuteRequest(pReq));
if (reply.error())
return reply.error();
@@ -659,7 +659,7 @@ void FacebookProto::FetchAttach(const CMStringA &mid, __int64 fbid, CMStringA &s
pReq << CHAR_PARAM("mid", mid) << INT64_PARAM("aid", fbid);
pReq->CalcSig();
- JsonReply reply(ExecuteRequest(pReq));
+ FbReply reply(ExecuteRequest(pReq));
switch (reply.error()) {
case 0:
{
@@ -751,7 +751,7 @@ void FacebookProto::OnPublishPrivateMessage(const JSONNode &root)
pReq << CHAR_PARAM("query_params", CMStringA(FORMAT, "{\"0\":[\"%s\"]}", stickerId.c_str()));
pReq->CalcSig();
- JsonReply reply(ExecuteRequest(pReq));
+ FbReply reply(ExecuteRequest(pReq));
if (!reply.error()) {
for (auto &sticker : reply.data()) {
std::string szUrl = sticker["thread_image"]["uri"].as_string();
@@ -845,7 +845,7 @@ void FacebookProto::OnPublishPrivateMessage(const JSONNode &root)
auto szActorFbId(metadata["actorFbId"].as_string());
DB::EventInfo dbei;
- dbei.timestamp = uint32_t(_wtoi64(metadata["timestamp"].as_mstring()) / 1000);
+ dbei.iTimestamp = uint32_t(_wtoi64(metadata["timestamp"].as_mstring()) / 1000);
dbei.pBlob = (char *)szBody.c_str();
dbei.szId = (char *)szId.c_str();
if (m_uid == _atoi64(szActorFbId.c_str()))
@@ -952,10 +952,10 @@ void FacebookProto::OnPublishReadReceipt(const JSONNode &root)
if (!dbei)
continue;
- if (dbei.timestamp > timestamp)
+ if (dbei.getUnixtime() > timestamp)
break;
- if (dbei.flags & DBEF_SENT)
+ if (dbei.bSent)
dbei.wipeNotify();
}
}
diff --git a/protocols/Facebook/src/stdafx.cxx b/protocols/Facebook/src/stdafx.cxx
index 87b7477097..72e87c2758 100644
--- a/protocols/Facebook/src/stdafx.cxx
+++ b/protocols/Facebook/src/stdafx.cxx
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org)
+Copyright (C) 2012-25 Miranda NG team (https://miranda-ng.org)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
diff --git a/protocols/Facebook/src/stdafx.h b/protocols/Facebook/src/stdafx.h
index cf5179dc2a..a00232e766 100644
--- a/protocols/Facebook/src/stdafx.h
+++ b/protocols/Facebook/src/stdafx.h
@@ -1,7 +1,7 @@
/*
Facebook plugin for Miranda NG
-Copyright © 2019-24 Miranda NG team
+Copyright © 2019-25 Miranda NG team
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
diff --git a/protocols/Facebook/src/thrift.cpp b/protocols/Facebook/src/thrift.cpp
index 7e18c1403a..94ecb644f0 100644
--- a/protocols/Facebook/src/thrift.cpp
+++ b/protocols/Facebook/src/thrift.cpp
@@ -1,7 +1,7 @@
/*
Facebook plugin for Miranda NG
-Copyright © 2019-24 Miranda NG team
+Copyright © 2019-25 Miranda NG team
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
diff --git a/protocols/Facebook/src/version.h b/protocols/Facebook/src/version.h
index b659e86039..7a0b334add 100644
--- a/protocols/Facebook/src/version.h
+++ b/protocols/Facebook/src/version.h
@@ -7,7 +7,7 @@
#define __PLUGIN_NAME "Facebook"
#define __FILENAME "Facebook.dll"
-#define __DESCRIPTION "Facebook protocol support for Miranda NG."
+#define __DESCRIPTION "Facebook Messenger protocol support for Miranda NG."
#define __AUTHOR "Miranda NG Team"
#define __AUTHORWEB "https://miranda-ng.org/p/Facebook"
-#define __COPYRIGHT "© 2019-24 Miranda NG team"
+#define __COPYRIGHT "© 2019-25 Miranda NG team"