diff options
-rw-r--r-- | protocols/FacebookRM/docs/facebook - readme.txt | 11 | ||||
-rw-r--r-- | protocols/FacebookRM/src/avatars.cpp | 4 | ||||
-rw-r--r-- | protocols/FacebookRM/src/communication.cpp | 21 | ||||
-rw-r--r-- | protocols/FacebookRM/src/json.cpp | 10 | ||||
-rw-r--r-- | protocols/FacebookRM/src/messages.cpp | 14 | ||||
-rw-r--r-- | protocols/FacebookRM/src/process.cpp | 1 | ||||
-rw-r--r-- | protocols/FacebookRM/src/proto.cpp | 2 | ||||
-rw-r--r-- | protocols/FacebookRM/src/version.h | 2 |
8 files changed, 42 insertions, 23 deletions
diff --git a/protocols/FacebookRM/docs/facebook - readme.txt b/protocols/FacebookRM/docs/facebook - readme.txt index a9127a3250..ed66af39ea 100644 --- a/protocols/FacebookRM/docs/facebook - readme.txt +++ b/protocols/FacebookRM/docs/facebook - readme.txt @@ -1,7 +1,7 @@ --------------------------------
-| Facebook Protocol RM 0.2.2.0 |
+| Facebook Protocol RM 0.2.2.1 |
| for Miranda NG |
-| (19.11.2013) |
+| (27.11.2013) |
--------------------------------
Autor: Robyer
@@ -34,6 +34,13 @@ Info: --------------------------------
Version history
--------------------------------
+0.2.2.1 - 27.11.2013
+ ! Fixed marking messages of some multichats as read
+ ! Fixed downloading avatars of some contacts (and repeated downloading of them again and again...)
+ + Load messages marked as abusive/spam
+
+ x Getting sent messages from other browser/mobile instances still doesn't work
+
0.2.2.0 - 19.11.2013
+ Correctly load contacts on mobile phone that are online right now (also removed old related option)
+ Added hidden option to keep messages unread to disable marking messages as read on server
diff --git a/protocols/FacebookRM/src/avatars.cpp b/protocols/FacebookRM/src/avatars.cpp index 73170da803..48bfd898ba 100644 --- a/protocols/FacebookRM/src/avatars.cpp +++ b/protocols/FacebookRM/src/avatars.cpp @@ -36,8 +36,8 @@ bool FacebookProto::GetDbAvatarInfo(PROTO_AVATAR_INFORMATIONT &ai, std::string * *url = new_url;
if (!getTString(ai.hContact, FACEBOOK_KEY_ID, &dbv)) {
- std::string ext = new_url.substr(new_url.rfind('.'));
- std::tstring filename = GetAvatarFolder() + L'\\' + dbv.ptszVal + (TCHAR*)_A2T(ext.c_str());
+ std::string ext = new_url.substr(new_url.rfind('.'), 4);
+ std::tstring filename = GetAvatarFolder() + L'\\' + dbv.ptszVal + (TCHAR*)_A2T(ext.c_str());
db_free(&dbv);
ai.hContact = ai.hContact;
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index 7bbac28fab..a0770b1783 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -1373,25 +1373,30 @@ bool facebook_client::save_url(const std::string &url,const std::tstring &filena resp = reinterpret_cast<NETLIBHTTPREQUEST*>(CallService(MS_NETLIB_HTTPTRANSACTION,
reinterpret_cast<WPARAM>(this->parent->m_hNetlibUser), reinterpret_cast<LPARAM>(&req)));
- if (resp)
- {
+ bool ret = false;
+
+ if (resp) {
nlc = resp->nlc;
parent->debugLogA("@@@@@ Saving avatar URL %s to path %s", url.c_str(), _T2A(filename.c_str()));
// Create folder if necessary
std::tstring dir = filename.substr(0,filename.rfind('\\'));
- if(_taccess(dir.c_str(),0))
+ if (_taccess(dir.c_str(), 0))
CreateDirectoryTreeT(dir.c_str());
// Write to file
FILE *f = _tfopen(filename.c_str(), _T("wb"));
- fwrite(resp->pData,1,resp->dataLength,f);
- fclose(f);
+ if (f != NULL) {
+ fwrite(resp->pData,1,resp->dataLength,f);
+ fclose(f);
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT,0,(LPARAM)resp);
- return true;
+ ret = _taccess(filename.c_str(), 0) == 0;
+ }
+
+ CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp);
} else {
nlc = NULL;
- return false;
}
+
+ return ret;
}
diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp index 84e7b46abf..cbb18c66e1 100644 --- a/protocols/FacebookRM/src/json.cpp +++ b/protocols/FacebookRM/src/json.cpp @@ -458,6 +458,7 @@ int facebook_json_parser::parse_messages(void* data, std::vector< facebook_messa JSONNODE *tid = json_get(msg, "tid");
JSONNODE *mid = json_get(msg, "mid");
JSONNODE *timestamp = json_get(msg, "timestamp");
+ JSONNODE *filtered = json_get(it, "is_filtered_content");
if (sender_fbid == NULL || sender_name == NULL || body == NULL || mid == NULL || timestamp == NULL)
continue;
@@ -477,6 +478,9 @@ int facebook_json_parser::parse_messages(void* data, std::vector< facebook_messa if (body == NULL || ignore_duplicits(proto, message_id, message_text))
continue;
+ if (json_as_bool(filtered) && message_text.empty())
+ message_text = Translate("This message is no longer available, because it was marked as abusive or spam.");
+
message_text = utils::text::trim(utils::text::special_expressions_decode(utils::text::slashu_to_utf8(message_text)), true);
if (message_text.empty())
continue;
@@ -835,9 +839,10 @@ int facebook_json_parser::parse_thread_messages(void* data, std::vector< faceboo JSONNODE *tid = json_get(it, "thread_id");
JSONNODE *mid = json_get(it, "message_id");
JSONNODE *timestamp = json_get(it, "timestamp");
+ JSONNODE *filtered = json_get(it, "is_filtered_content");
if (author == NULL || body == NULL || mid == NULL || tid == NULL || timestamp == NULL)
- continue;
+ continue;
std::string thread_id = json_as_pstring(tid);
std::string message_id = json_as_pstring(mid);
@@ -850,6 +855,9 @@ int facebook_json_parser::parse_thread_messages(void* data, std::vector< faceboo // Process attachements and stickers
parseAttachments(proto, &message_text, it);
+ if (json_as_bool(filtered) && message_text.empty())
+ message_text = Translate("This message is no longer available, because it was marked as abusive or spam.");
+
message_text = utils::text::trim(utils::text::special_expressions_decode(utils::text::slashu_to_utf8(message_text)), true);
if (message_text.empty())
continue;
diff --git a/protocols/FacebookRM/src/messages.cpp b/protocols/FacebookRM/src/messages.cpp index e9c1cd4c0e..667692a4c9 100644 --- a/protocols/FacebookRM/src/messages.cpp +++ b/protocols/FacebookRM/src/messages.cpp @@ -84,7 +84,7 @@ void FacebookProto::SendChatMsgWorker(void *p) tid = dbv.pszVal;
db_free(&dbv);
} else {
- std::string post_data = "threads[group_ids][0]=" + data->chat_id;
+ std::string post_data = "threads[group_ids][0]=" + utils::url::encode(data->chat_id);
post_data += "&fb_dtsg=" + (facy.dtsg_.length() ? facy.dtsg_ : "0");
post_data += "&__user=" + facy.self_.user_id;
post_data += "&phstamp=0";
@@ -148,18 +148,16 @@ void FacebookProto::SendTypingWorker(void *p) delete typing;
return;
}
-
- DBVARIANT dbv;
- if (!getString(typing->hContact, FACEBOOK_KEY_ID, &dbv)) {
+
+ ptrA id( getStringA(typing->hContact, FACEBOOK_KEY_ID));
+ if (id != NULL) {
std::string data = "&source=mercury-chat";
data += (typing->status == PROTOTYPE_SELFTYPING_ON ? "&typ=1" : "&typ=0"); // PROTOTYPE_SELFTYPING_OFF
- data += "&to=" + std::string(dbv.pszVal);
+ data += "&to=" + utils::url::encode(std::string(id));
data += "&fb_dtsg=" + (facy.dtsg_.length() ? facy.dtsg_ : "0");
data += "&lsd=&phstamp=0&__user=" + facy.self_.user_id;
http::response resp = facy.flap(REQUEST_TYPING_SEND, &data);
-
- db_free(&dbv);
}
delete typing;
@@ -180,7 +178,7 @@ void FacebookProto::ReadMessageWorker(void *p) if (mid == NULL)
return;
- std::string data = "ids[" + std::string(mid) + "]=true";
+ std::string data = "ids[" + utils::url::encode(std::string(mid)) + "]=true";
data += "&fb_dtsg=" + (facy.dtsg_.length() ? facy.dtsg_ : "0");
data += "&__user=" + facy.self_.user_id;
data += "&__a=1&__dyn=&__req=&ttstamp=0";
diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp index d6ecad05b1..584d1bebcb 100644 --- a/protocols/FacebookRM/src/process.cpp +++ b/protocols/FacebookRM/src/process.cpp @@ -443,6 +443,7 @@ void FacebookProto::ProcessUnreadMessage(void *p) }
}
+// TODO: combine processmessages and processunreadmessages? (behavior of showing messages to user should be the same)
void FacebookProto::ProcessMessages(void* data)
{
if (data == NULL)
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index 981fc37484..17332e3f63 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -697,7 +697,7 @@ void FacebookProto::ReadNotificationWorker(void *p) std::string *id = static_cast<std::string*>(p);
- std::string data = "seen=0&asyncSignal=&__dyn=&__req=a&alert_ids%5B0%5D=" + *id;
+ std::string data = "seen=0&asyncSignal=&__dyn=&__req=a&alert_ids%5B0%5D=" + utils::url::encode(*id);
data += "&fb_dtsg=" + (facy.dtsg_.length() ? facy.dtsg_ : "0");
data += "&__user=" + facy.self_.user_id;
diff --git a/protocols/FacebookRM/src/version.h b/protocols/FacebookRM/src/version.h index 8535414969..b3c70da666 100644 --- a/protocols/FacebookRM/src/version.h +++ b/protocols/FacebookRM/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0
#define __MINOR_VERSION 2
#define __RELEASE_NUM 2
-#define __BUILD_NUM 0
+#define __BUILD_NUM 1
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
#define __FILEVERSION_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM
|