diff options
Diffstat (limited to 'protocols/FacebookRM/src/process.cpp')
-rw-r--r-- | protocols/FacebookRM/src/process.cpp | 67 |
1 files changed, 63 insertions, 4 deletions
diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp index 7cdec9f7fa..8780dd262e 100644 --- a/protocols/FacebookRM/src/process.cpp +++ b/protocols/FacebookRM/src/process.cpp @@ -676,11 +676,18 @@ void parseFeeds(const std::string &text, std::vector<facebook_newsfeed *> &news, last_post_time = new_time; } -void FacebookProto::ProcessMemories(void*) +void FacebookProto::ProcessMemories(void *p) { if (isOffline()) return; + bool manuallyTriggered = (p == MANUALLY_TRIGGERED); + if (manuallyTriggered) { + facy.info_notify(TranslateT("Loading memories...")); + } + + int numMemories = 0; + facy.handle_entry(__FUNCTION__); HttpRequest *request = new MemoriesRequest(&facy); @@ -706,6 +713,8 @@ void FacebookProto::ProcessMemories(void*) SkinPlaySound("Memories"); } + numMemories = news.size(); + for (std::vector<facebook_newsfeed*>::size_type i = 0; i < news.size(); i++) { ptrW tszTitle(mir_utf8decodeW(news[i]->title.c_str())); @@ -718,6 +727,11 @@ void FacebookProto::ProcessMemories(void*) } } + if (manuallyTriggered) { + CMStringW text(FORMAT, TranslateT("Found %d memories."), numMemories); + facy.info_notify(text.GetBuffer()); + } + facy.handle_success(__FUNCTION__); } @@ -1009,11 +1023,16 @@ void FacebookProto::ShowNotifications() { } } -void FacebookProto::ProcessNotifications(void*) +void FacebookProto::ProcessNotifications(void *p) { if (isOffline()) return; + bool manuallyTriggered = (p == MANUALLY_TRIGGERED); + if (manuallyTriggered) { + facy.info_notify(TranslateT("Loading notifications...")); + } + facy.handle_entry("notifications"); // Get notifications @@ -1029,10 +1048,18 @@ void FacebookProto::ProcessNotifications(void*) debugLogA("*** Starting processing notifications"); try { + int numNotifications = facy.notifications.size(); + facebook_json_parser* p = new facebook_json_parser(this); p->parse_notifications(&(resp.data), &facy.notifications); delete p; + if (manuallyTriggered) { + numNotifications = facy.notifications.size() - numNotifications; + CMStringW text(FORMAT, TranslateT("Found %d notifications."), numNotifications); + facy.info_notify(text.GetBuffer()); + } + ShowNotifications(); debugLogA("*** Notifications processed"); @@ -1042,11 +1069,16 @@ void FacebookProto::ProcessNotifications(void*) } } -void FacebookProto::ProcessFriendRequests(void*) +void FacebookProto::ProcessFriendRequests(void *p) { if (isOffline()) return; + bool manuallyTriggered = (p == MANUALLY_TRIGGERED); + if (manuallyTriggered) { + facy.info_notify(TranslateT("Loading friendship requests...")); + } + facy.handle_entry("friendRequests"); // Get load friendships @@ -1064,6 +1096,9 @@ void FacebookProto::ProcessFriendRequests(void*) return; } + int numRequestsNew = 0; + int numRequestsOld = 0; + // Parse it std::string reqs = utils::text::source_get_value(&resp.data, 3, "id=\"friends_center_main\"", "</h3>", "/friends/center/suggestions/"); @@ -1113,18 +1148,37 @@ void FacebookProto::ProcessFriendRequests(void*) db_event_add(0, &dbei); } debugLogA(" < (%s) Friendship request [%s]", (isNew ? "New" : "Old"), time.c_str()); + + if (isNew) + numRequestsNew++; + else + numRequestsOld++; } else debugLogA("!!! Wrong friendship request:\n%s", req.c_str()); } + if (manuallyTriggered) { + CMStringW text; + if (numRequestsOld > 0) + text.AppendFormat(TranslateT("Found %d friendship requests (%d seen)."), numRequestsNew, numRequestsOld); + else + text.AppendFormat(TranslateT("Found %d friendship requests."), numRequestsNew); + facy.info_notify(text.GetBuffer()); + } + facy.handle_success("friendRequests"); } -void FacebookProto::ProcessFeeds(void*) +void FacebookProto::ProcessFeeds(void *p) { if (!isOnline()) return; + bool manuallyTriggered = (p == MANUALLY_TRIGGERED); + if (manuallyTriggered) { + facy.info_notify(TranslateT("Loading wall posts...")); + } + facy.handle_entry("feeds"); // Get feeds @@ -1146,6 +1200,11 @@ void FacebookProto::ProcessFeeds(void*) SkinPlaySound("NewsFeed"); } + if (manuallyTriggered) { + CMStringW text(FORMAT, TranslateT("Found %d wall posts."), news.size()); + facy.info_notify(text.GetBuffer()); + } + for (std::vector<facebook_newsfeed*>::size_type i = 0; i < news.size(); i++) { ptrW tszTitle(mir_utf8decodeW(news[i]->title.c_str())); |