summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-01-04 20:04:07 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-01-04 20:04:07 +0300
commita9617074481ebc9a35eb241d64997256931c1045 (patch)
treedae39ac4cdea5c627e8d7168417e8b11596ccb5b
parent3139376bfb6de1b2ab765613baeb1efa779c4310 (diff)
more accurate fix for FB Agent String
-rw-r--r--protocols/Facebook/src/http.cpp8
-rw-r--r--protocols/Facebook/src/mqtt.cpp5
-rw-r--r--protocols/Facebook/src/proto.h1
3 files changed, 9 insertions, 5 deletions
diff --git a/protocols/Facebook/src/http.cpp b/protocols/Facebook/src/http.cpp
index 6f520c0486..55e8ce5a5c 100644
--- a/protocols/Facebook/src/http.cpp
+++ b/protocols/Facebook/src/http.cpp
@@ -117,7 +117,7 @@ AsyncHttpRequest* FacebookProto::CreateRequest(const char *szUrl, const char *sz
pReq->AddHeader("Authorization", "OAuth " + m_szAuthToken);
}
- pReq->AddHeader("User-Agent", FB_API_AGENT);
+ pReq->AddHeader("User-Agent", GetAgentString());
pReq->AddHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
return pReq;
}
@@ -183,3 +183,9 @@ NETLIBHTTPREQUEST* FacebookProto::ExecuteRequest(AsyncHttpRequest *pReq)
delete pReq;
return reply;
}
+
+CMStringA FacebookProto::GetAgentString()
+{
+ // Hidden setting!! Agent = how Miranda would be visible in the session list
+ return getMStringA("Agent", FB_API_MQTT_AGENT);
+}
diff --git a/protocols/Facebook/src/mqtt.cpp b/protocols/Facebook/src/mqtt.cpp
index ff4f6eb21b..94a44a90c9 100644
--- a/protocols/Facebook/src/mqtt.cpp
+++ b/protocols/Facebook/src/mqtt.cpp
@@ -203,9 +203,6 @@ void FacebookProto::MqttSend(const MqttMessage &payload)
void FacebookProto::MqttLogin()
{
- // Hidden setting!! Agent = how Miranda would be visible in the session list
- ptrA pszAgent(getStringA("Agent", FB_API_MQTT_AGENT));
-
uint8_t zeroByte = 0;
Utils_GetRandom(&m_iMqttId, sizeof(m_iMqttId) / 2);
@@ -219,7 +216,7 @@ void FacebookProto::MqttLogin()
thrift.writeInt64(m_uid);
thrift.writeField(FB_THRIFT_TYPE_STRING); // User agent
- thrift << pszAgent;
+ thrift << GetAgentString();
thrift.writeField(FB_THRIFT_TYPE_I64);
thrift.writeInt64(23);
diff --git a/protocols/Facebook/src/proto.h b/protocols/Facebook/src/proto.h
index 7fbeebd2cb..efa5a008d9 100644
--- a/protocols/Facebook/src/proto.h
+++ b/protocols/Facebook/src/proto.h
@@ -412,6 +412,7 @@ class FacebookProto : public PROTO<FacebookProto>
AsyncHttpRequest *CreateRequest(const char *szUrl, const char *szName, const char *szMethod);
AsyncHttpRequest *CreateRequestGQL(int64_t id);
NETLIBHTTPREQUEST *ExecuteRequest(AsyncHttpRequest *pReq);
+ CMStringA GetAgentString();
// Avatars
void __cdecl AvatarsUpdate(void *);