diff options
Diffstat (limited to 'protocols/VKontakte')
-rw-r--r-- | protocols/VKontakte/src/version.h | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_feed.cpp | 23 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.h | 2 |
3 files changed, 17 insertions, 10 deletions
diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h index e416a29a63..906031dc49 100644 --- a/protocols/VKontakte/src/version.h +++ b/protocols/VKontakte/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0
#define __MINOR_VERSION 1
#define __RELEASE_NUM 0
-#define __BUILD_NUM 34
+#define __BUILD_NUM 35
#include <stdver.h>
diff --git a/protocols/VKontakte/src/vk_feed.cpp b/protocols/VKontakte/src/vk_feed.cpp index 2284d37ace..0c9e4b54f8 100644 --- a/protocols/VKontakte/src/vk_feed.cpp +++ b/protocols/VKontakte/src/vk_feed.cpp @@ -159,9 +159,9 @@ CMString CVkProto::GetVkPhotoItem(JSONNODE *pPhoto) //////////////////////////////////////////////////////////////////////////////////////////////////////////
-CVKNewsItem* CVkProto::GetVkNewsItem(JSONNODE *pItem, OBJLIST<CVkUserInfo> &vkUsers)
+CVKNewsItem* CVkProto::GetVkNewsItem(JSONNODE *pItem, OBJLIST<CVkUserInfo> &vkUsers, bool isRepost)
{
- debugLogA("CVkProto::GetVkNewsItem");
+ //debugLogA("CVkProto::GetVkNewsItem");
bool bPostLink = true;
CVKNewsItem *vkNewsItem = new CVKNewsItem();
if (pItem == NULL)
@@ -180,6 +180,8 @@ CVKNewsItem* CVkProto::GetVkNewsItem(JSONNODE *pItem, OBJLIST<CVkUserInfo> &vkUs if (!tszText.IsEmpty())
tszText += _T("\n");
+ debugLog(_T("CVkProto::GetVkNewsItem %d %d %s <%s>"), iSourceId, iPostId, vkNewsItem->tszType.GetBuffer(), tszText.GetBuffer());
+
if (vkNewsItem->tszType == _T("photo_tag")){
bPostLink = false;
JSONNODE *pPhotos = json_get(pItem, "photo_tags");
@@ -202,9 +204,12 @@ CVKNewsItem* CVkProto::GetVkNewsItem(JSONNODE *pItem, OBJLIST<CVkUserInfo> &vkUs for (size_t i = 0; (pPhotoItem = json_at(pPhotoItems, i)) != NULL; i++){
tszText += GetVkPhotoItem(pPhotoItem) + _T("\n");
if (i == 0 && vkNewsItem->tszType == _T("wall_photo")){
- iPostId = json_as_int(json_get(pPhotoItem, "post_id"));
- bPostLink = true;
- break; // Max 1 wall_photo
+ LONG iPhotoPostId = json_as_int(json_get(pPhotoItem, "post_id"));
+ if (iPhotoPostId){
+ bPostLink = true;
+ iPostId = iPhotoPostId;
+ break; // max 1 wall_photo when photo post_id !=0
+ }
}
}
}
@@ -213,7 +218,7 @@ CVKNewsItem* CVkProto::GetVkNewsItem(JSONNODE *pItem, OBJLIST<CVkUserInfo> &vkUs bPostLink = true;
JSONNODE * pRepost = json_get(pItem, "copy_history");
if (pRepost) {
- CVKNewsItem *vkRepost = GetVkNewsItem(json_at(pRepost, 0), vkUsers);
+ CVKNewsItem *vkRepost = GetVkNewsItem(json_at(pRepost, 0), vkUsers, true);
vkRepost->tszText.Replace(_T("\n"), _T("\n\t"));
tszText += vkRepost->tszText;
tszText += _T("\n");
@@ -230,7 +235,7 @@ CVKNewsItem* CVkProto::GetVkNewsItem(JSONNODE *pItem, OBJLIST<CVkUserInfo> &vkUs CMString tszBBCIn = m_bBBCOnNews ? _T("[b]") : _T("");
CMString tszBBCOut = m_bBBCOnNews ? _T("[/b]") : _T("");
- if (iPostId)
+ if (!isRepost)
tszResFormat = Translate("News from %s%s%s (%s)\n%s");
else {
tszResFormat = Translate("\tRepost from %s%s%s (%s)\n%s");
@@ -246,6 +251,8 @@ CVKNewsItem* CVkProto::GetVkNewsItem(JSONNODE *pItem, OBJLIST<CVkUserInfo> &vkUs vkNewsItem->tszText.AppendFormat(TranslateT("\nNews link: %s"), vkNewsItem->tszLink.GetBuffer());
}
+ debugLog(_T("CVkProto::GetVkNewsItem %d %d <%s> <%s>"), iSourceId, iPostId, vkNewsItem->tszText.GetBuffer(), tszText.GetBuffer());
+
return vkNewsItem;
}
@@ -415,7 +422,7 @@ void CVkProto::RetrieveUnreadNews(time_t tLastNewsTime) Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/newsfeed.get.json", true, &CVkProto::OnReceiveUnreadNews)
<< INT_PARAM("count", 100)
<< INT_PARAM("return_banned", 0)
- << INT_PARAM("max_photos", 100)
+ << INT_PARAM("max_photos", 5)
<< INT_PARAM("start_time", tLastNewsTime + 1)
<< CHAR_PARAM("filters", "post,photo,photo_tag,wall_photo")
<< VER_API);
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index 105e0115fe..757026b2b8 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -345,7 +345,7 @@ struct CVkProto : public PROTO<CVkProto> void CreateVkUserInfoList(OBJLIST<CVkUserInfo> &vkUsers, JSONNODE *pResponse);
CMString GetVkPhotoItem(JSONNODE *pPhotoItem);
- CVKNewsItem* GetVkNewsItem(JSONNODE *pItem, OBJLIST<CVkUserInfo> &vkUsers);
+ CVKNewsItem* GetVkNewsItem(JSONNODE *pItem, OBJLIST<CVkUserInfo> &vkUsers, bool isRepost = false);
CMString GetVkNotificationsItem(JSONNODE *pItem, OBJLIST<CVkUserInfo> &vkUsers, time_t &tDate);
CMString GetVkFeedback(JSONNODE *pFeedback, VKObjType vkFeedbackType, OBJLIST<CVkUserInfo> &vkUsers, CVkUserInfo *vkUser);
|