diff options
Diffstat (limited to 'protocols')
| -rw-r--r-- | protocols/VKontakte/res/resource.rc | 17 | ||||
| -rw-r--r-- | protocols/VKontakte/src/misc.cpp | 64 | ||||
| -rw-r--r-- | protocols/VKontakte/src/resource.h | 6 | ||||
| -rw-r--r-- | protocols/VKontakte/src/version.h | 2 | ||||
| -rw-r--r-- | protocols/VKontakte/src/vk_feed.cpp | 39 | ||||
| -rw-r--r-- | protocols/VKontakte/src/vk_history.cpp | 2 | ||||
| -rw-r--r-- | protocols/VKontakte/src/vk_options.cpp | 21 | ||||
| -rw-r--r-- | protocols/VKontakte/src/vk_proto.cpp | 4 | ||||
| -rw-r--r-- | protocols/VKontakte/src/vk_proto.h | 19 | ||||
| -rw-r--r-- | protocols/VKontakte/src/vk_thread.cpp | 2 | 
10 files changed, 118 insertions, 58 deletions
diff --git a/protocols/VKontakte/res/resource.rc b/protocols/VKontakte/res/resource.rc index de05fdf1b4..d1d900a362 100644 --- a/protocols/VKontakte/res/resource.rc +++ b/protocols/VKontakte/res/resource.rc @@ -49,7 +49,7 @@ BEGIN          LEFTMARGIN, 4
          RIGHTMARGIN, 298
          TOPMARGIN, 7
 -        BOTTOMMARGIN, 124
 +        BOTTOMMARGIN, 166
      END
      IDD_OPT_FEEDS, DIALOG
 @@ -112,7 +112,7 @@ END  // Dialog
  //
 -IDD_OPT_VIEW DIALOGEX 0, 0, 304, 131
 +IDD_OPT_VIEW DIALOGEX 0, 0, 304, 173
  STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
  EXSTYLE WS_EX_CONTROLPARENT
  FONT 8, "MS Shell Dlg", 0, 0, 0x1
 @@ -122,14 +122,21 @@ BEGIN      CONTROL         "for original size images",IDC_IMG_FULLSIZE,"Button",BS_AUTORADIOBUTTON,12,30,129,10
      CONTROL         "for preview max 130px*130px",IDC_IMG_130,"Button",BS_AUTORADIOBUTTON,154,19,129,10
      CONTROL         "for preview max 604px*604px",IDC_IMG_604,"Button",BS_AUTORADIOBUTTON,154,30,129,10
 -    GROUPBOX        "BBCode support on news and event notifications",IDC_STATIC,4,50,294,38,WS_GROUP
 +    GROUPBOX        "BBCode support on news and event notifications",IDC_STATIC,4,50,294,48,WS_GROUP
      CONTROL         "off",IDC_NEWSBBC_OFF,"Button",BS_AUTORADIOBUTTON,12,61,129,10
      CONTROL         "basic ([b], [i], [u], [s])",IDC_NEWSBBC_BASIC,"Button",BS_AUTORADIOBUTTON,12,72,129,10
      CONTROL         "advanced (+[url], [size], [color])",IDC_NEWSBBC_ADV,
                      "Button",BS_AUTORADIOBUTTON,154,61,129,10
 -    GROUPBOX        "Other",IDC_STATIC,4,90,293,26
 +    CONTROL         "Use this setting also for attachments on news and notifications",IDC_BBC_ATT_NEWS,
 +                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,83,278,10
 +    GROUPBOX        "Other",IDC_STATIC,4,138,293,26
 +    GROUPBOX        "BBCode support on attachments",IDC_STATIC,4,99,294,38,WS_GROUP
 +    CONTROL         "off",IDC_ATTBBC_OFF,"Button",BS_AUTORADIOBUTTON,12,110,129,10
 +    CONTROL         "basic ([b], [i], [u], [s])",IDC_ATTBBC_BASIC,"Button",BS_AUTORADIOBUTTON,12,121,129,10
 +    CONTROL         "advanced (+[url], [size], [color])",IDC_ATTBBC_ADV,
 +                    "Button",BS_AUTORADIOBUTTON,154,110,129,10
      CONTROL         "Process stickers as smileys",IDC_STICKERS_AS_SMYLES,
 -                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,101,278,10
 +                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,149,278,10
  END
  IDD_OPT_FEEDS DIALOGEX 0, 0, 304, 230
 diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 4bf8dfaf83..9ce568f154 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -707,7 +707,7 @@ CMString CVkProto::SpanVKNotificationType(CMString& tszType, VKObjType& vkFeedba  	return tszRes;
  }
 -CMString CVkProto::GetVkPhotoItem(JSONNODE *pPhoto)
 +CMString CVkProto::GetVkPhotoItem(JSONNODE *pPhoto, BBCSupport iBBC)
  {
  	CMString tszRes;
 @@ -739,7 +739,7 @@ CMString CVkProto::GetVkPhotoItem(JSONNODE *pPhoto)  	int iWidth = json_as_int(json_get(pPhoto, "width"));
  	int iHeight = json_as_int(json_get(pPhoto, "height"));
 -	tszRes.AppendFormat(_T("%s: %s (%dx%d)"), TranslateT("Photo"), ptszLink ? ptszLink : _T(""), iWidth, iHeight);
 +	tszRes.AppendFormat(_T("%s (%dx%d)"), SetBBCString(TranslateT("Photo"), iBBC, vkbbcUrl, ptszLink).GetBuffer(), iWidth, iHeight);
  	if (m_iIMGBBCSupport)
  		tszRes.AppendFormat(_T("\n\t[img]%s[/img]"), ptszPreviewLink ? ptszPreviewLink : (ptszLink ? ptszLink : _T("")));
  	CMString tszText = json_as_string(json_get(pPhoto, "text"));
 @@ -749,7 +749,7 @@ CMString CVkProto::GetVkPhotoItem(JSONNODE *pPhoto)  	return tszRes;
  }
 -CMString CVkProto::SetBBCString(TCHAR *tszString, VKBBCType bbcType, TCHAR *tszAddString)
 +CMString CVkProto::SetBBCString(TCHAR *ptszString, BBCSupport iBBC, VKBBCType bbcType, TCHAR *tszAddString)
  {
  	CVKBBCItem bbcItem[] = {
  		{ vkbbcB, bbcNo, _T("%s") },
 @@ -765,7 +765,7 @@ CMString CVkProto::SetBBCString(TCHAR *tszString, VKBBCType bbcType, TCHAR *tszA  		{ vkbbcU, bbcBasic, _T("[u]%s[/u]") },
  		{ vkbbcU, bbcAdvanced, _T("[u]%s[/u]") },
  		{ vkbbcUrl, bbcNo, _T("%s (%s)") },
 -		{ vkbbcUrl, bbcBasic, _T("[b]%s[/b] (%s)") },
 +		{ vkbbcUrl, bbcBasic, _T("[i]%s[/i] (%s)") },
  		{ vkbbcUrl, bbcAdvanced, _T("[url=%s]%s[/url]") },
  		{ vkbbcSize, bbcNo, _T("%s") },
  		{ vkbbcSize, bbcBasic, _T("%s") },
 @@ -775,23 +775,29 @@ CMString CVkProto::SetBBCString(TCHAR *tszString, VKBBCType bbcType, TCHAR *tszA  		{ vkbbcColor, bbcAdvanced, _T("[color=%s]%s[/color]") },
  	};
 +	if (ptszString == NULL)
 +		return CMString();
 +
 +	if (ptszString[0] == '\0')
 +		return CMString();
 +
  	TCHAR *ptszFormat = NULL;
  	for (int i = 0; i < SIZEOF(bbcItem); i++)
 -		if (bbcItem[i].vkBBCType == bbcType && bbcItem[i].vkBBCSettings == m_iBBCForNews) {
 +		if (bbcItem[i].vkBBCType == bbcType && bbcItem[i].vkBBCSettings == iBBC) {
  			ptszFormat = bbcItem[i].ptszTempate;
  			break;
  		}
  	CMString res;
  	if (ptszFormat == NULL)
 -		return CMString(tszString);
 +		return CMString(ptszString);
 -	if (bbcType == vkbbcUrl && m_iBBCForNews != bbcAdvanced)
 -		res.AppendFormat(ptszFormat, tszString ? tszString : _T(""), tszAddString ? tszAddString : _T(""));
 -	else if (m_iBBCForNews == bbcAdvanced && bbcType >= vkbbcUrl)
 -		res.AppendFormat(ptszFormat, tszAddString ? tszAddString : _T(""), tszString ? tszString : _T(""));
 +	if (bbcType == vkbbcUrl && iBBC != bbcAdvanced)
 +		res.AppendFormat(ptszFormat, ptszString, tszAddString ? tszAddString : _T(""));
 +	else if (iBBC == bbcAdvanced && bbcType >= vkbbcUrl)
 +		res.AppendFormat(ptszFormat, tszAddString ? tszAddString : _T(""), ptszString);
  	else
 -		res.AppendFormat(ptszFormat, tszString ? tszString : _T(""));
 +		res.AppendFormat(ptszFormat, ptszString);
  	return res;
  }
 @@ -811,12 +817,12 @@ CMString& CVkProto::ClearFormatNick(CMString& tszText)  /////////////////////////////////////////////////////////////////////////////////////////
 -CMString CVkProto::GetAttachmentDescr(JSONNODE *pAttachments)
 +CMString CVkProto::GetAttachmentDescr(JSONNODE *pAttachments, BBCSupport iBBC)
  {
  	debugLogA("CVkProto::GetAttachmentDescr");
  	CMString res;
  	res.AppendChar('\n');
 -	res += TranslateT("Attachments:");
 +	res += SetBBCString(TranslateT("Attachments:"), iBBC, vkbbcB);
  	res.AppendChar('\n');
  	JSONNODE *pAttach;
  	for (int k = 0; (pAttach = json_at(pAttachments, k)) != NULL; k++) {
 @@ -827,7 +833,7 @@ CMString CVkProto::GetAttachmentDescr(JSONNODE *pAttachments)  			if (pPhoto == NULL)
  				continue;
 -			res += GetVkPhotoItem(pPhoto);
 +			res += GetVkPhotoItem(pPhoto, iBBC);
  		}
  		else if (!mir_tstrcmp(ptszType, _T("audio"))) {
  			JSONNODE *pAudio = json_get(pAttach, "audio");
 @@ -837,8 +843,12 @@ CMString CVkProto::GetAttachmentDescr(JSONNODE *pAttachments)  			ptrT ptszArtist(json_as_string(json_get(pAudio, "artist")));
  			ptrT ptszTitle(json_as_string(json_get(pAudio, "title")));
  			ptrT ptszUrl(json_as_string(json_get(pAudio, "url")));
 -			res.AppendFormat(_T("%s: (%s - %s) - %s"),
 -				TranslateT("Audio"), ptszArtist, ptszTitle, ptszUrl);
 +			CMString tszAudio;
 +			tszAudio.AppendFormat(_T("%s - %s"), ptszArtist, ptszTitle);
 +
 +			res.AppendFormat(_T("%s: %s"),
 +				SetBBCString(TranslateT("Audio"), iBBC, vkbbcB).GetBuffer(), 
 +				SetBBCString(tszAudio.GetBuffer(), iBBC, vkbbcUrl, ptszUrl).GetBuffer());
  		}
  		else if (!mir_tstrcmp(ptszType, _T("video"))) {
  			JSONNODE *pVideo = json_get(pAttach, "video");
 @@ -848,7 +858,11 @@ CMString CVkProto::GetAttachmentDescr(JSONNODE *pAttachments)  			ptrT ptszTitle(json_as_string(json_get(pVideo, "title")));
  			int vid = json_as_int(json_get(pVideo, "id"));
  			int ownerID = json_as_int(json_get(pVideo, "owner_id"));
 -			res.AppendFormat(_T("%s: %s - http://vk.com/video%d_%d"), TranslateT("Video"), ptszTitle, ownerID, vid);
 +			CMString tszUrl;
 +			tszUrl.AppendFormat(_T("http://vk.com/video%d_%d"), ownerID, vid);
 +			res.AppendFormat(_T("%s: %s"), 
 +				SetBBCString(TranslateT("Video"), iBBC, vkbbcB).GetBuffer(), 
 +				SetBBCString(ptszTitle, iBBC, vkbbcUrl, tszUrl.GetBuffer()).GetBuffer());
  		}
  		else if (!mir_tstrcmp(ptszType, _T("doc"))) {
  			JSONNODE *pDoc = json_get(pAttach, "doc");
 @@ -857,7 +871,9 @@ CMString CVkProto::GetAttachmentDescr(JSONNODE *pAttachments)  			ptrT ptszTitle(json_as_string(json_get(pDoc, "title")));
  			ptrT ptszUrl(json_as_string(json_get(pDoc, "url")));
 -			res.AppendFormat(_T("%s: (%s) - %s"), TranslateT("Document"), ptszTitle, ptszUrl);
 +			res.AppendFormat(_T("%s: %s"), 
 +				SetBBCString(TranslateT("Document"), iBBC, vkbbcB).GetBuffer(), 
 +				SetBBCString(ptszTitle, iBBC, vkbbcUrl, ptszUrl).GetBuffer());
  		}
  		else if (!mir_tstrcmp(ptszType, _T("wall"))) {
  			JSONNODE *pWall = json_get(pAttach, "wall");
 @@ -867,7 +883,11 @@ CMString CVkProto::GetAttachmentDescr(JSONNODE *pAttachments)  			ptrT ptszText(json_as_string(json_get(pWall, "text")));
  			int id = json_as_int(json_get(pWall, "id"));
  			int fromID = json_as_int(json_get(pWall, "from_id"));
 -			res.AppendFormat(_T("%s: %s - http://vk.com/wall%d_%d"), TranslateT("Wall post"), ptszText ? ptszText : _T(" "), fromID, id);
 +			CMString tszUrl;
 +			tszUrl.AppendFormat(_T("http://vk.com/wall%d_%d"), fromID, id);
 +			res.AppendFormat(_T("%s: %s"), 
 +				SetBBCString(TranslateT("Wall post"), iBBC, vkbbcUrl, tszUrl.GetBuffer()).GetBuffer(), 
 +				ptszText ? ptszText : _T(" "));
  		}
  		else if (!mir_tstrcmp(ptszType, _T("sticker"))) {
  			JSONNODE *pSticker = json_get(pAttach, "sticker");
 @@ -904,7 +924,9 @@ CMString CVkProto::GetAttachmentDescr(JSONNODE *pAttachments)  			ptrT ptszDescription(json_as_string(json_get(pLink, "description")));
  			CMString tszImage(json_as_string(json_get(pLink, "image_src")));
 -			res.AppendFormat(_T("%s: %s (%s)"), TranslateT("Link"), ptszTitle ? ptszTitle : _T(""), ptszUrl ? ptszUrl : _T(""));
 +			res.AppendFormat(_T("%s: %s"), 
 +				SetBBCString(TranslateT("Link"), iBBC, vkbbcB).GetBuffer(), 
 +				SetBBCString(ptszTitle, iBBC, vkbbcUrl, ptszUrl).GetBuffer());
  			if (!tszImage.IsEmpty())
  				if (m_iIMGBBCSupport)
  					res.AppendFormat(_T("\n\t%s: [img]%s[/img]"), TranslateT("Image"), tszImage.GetBuffer());
 @@ -914,7 +936,7 @@ CMString CVkProto::GetAttachmentDescr(JSONNODE *pAttachments)  			if (ptszDescription)
  				res.AppendFormat(_T("\n\t%s"), ptszDescription);
  		}
 -		else res.AppendFormat(TranslateT("Unsupported or unknown attachment type: %s"), ptszType);
 +		else res.AppendFormat(TranslateT("Unsupported or unknown attachment type: %s"), SetBBCString(ptszType, iBBC, vkbbcB).GetBuffer());
  		res.AppendChar('\n');
  	}
 diff --git a/protocols/VKontakte/src/resource.h b/protocols/VKontakte/src/resource.h index a86f9fc703..3beec16457 100644 --- a/protocols/VKontakte/src/resource.h +++ b/protocols/VKontakte/src/resource.h @@ -89,6 +89,10 @@  #define IDC_N_LIKES                     1081
  #define IDC_N_REPOSTS                   1082
  #define IDC_N_MENTIONS                  1083
 +#define IDC_ATTBBC_OFF                  1084
 +#define IDC_ATTBBC_BASIC                1085
 +#define IDC_ATTBBC_ADV                  1086
 +#define IDC_BBC_ATT_NEWS                1087
  // Next default values for new objects
  // 
 @@ -97,7 +101,7 @@  #define _APS_NO_MFC                     1
  #define _APS_NEXT_RESOURCE_VALUE        119
  #define _APS_NEXT_COMMAND_VALUE         40001
 -#define _APS_NEXT_CONTROL_VALUE         1071
 +#define _APS_NEXT_CONTROL_VALUE         1088
  #define _APS_NEXT_SYMED_VALUE           101
  #endif
  #endif
 diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h index 30ec6234b9..7fa4bd836a 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              38
 +#define __BUILD_NUM              39
  #include <stdver.h>
 diff --git a/protocols/VKontakte/src/vk_feed.cpp b/protocols/VKontakte/src/vk_feed.cpp index 40e8f34106..16740d9efc 100644 --- a/protocols/VKontakte/src/vk_feed.cpp +++ b/protocols/VKontakte/src/vk_feed.cpp @@ -165,7 +165,7 @@ CVKNewsItem* CVkProto::GetVkNewsItem(JSONNODE *pItem, OBJLIST<CVkUserInfo> &vkUs  				JSONNODE *pPhotoItem;
  				tszText = TranslateT("User was tagged in these photos:");
  				for (size_t i = 0; (pPhotoItem = json_at(pPhotoItems, i)) != NULL; i++)
 -					tszText += _T("\n") + GetVkPhotoItem(pPhotoItem);
 +					tszText += _T("\n") + GetVkPhotoItem(pPhotoItem, m_iBBCForNews);
  			}
  		}
  	}
 @@ -176,7 +176,7 @@ CVKNewsItem* CVkProto::GetVkNewsItem(JSONNODE *pItem, OBJLIST<CVkUserInfo> &vkUs  			JSONNODE *pPhotoItems = json_get(pPhotos, "items"), *pPhotoItem;
  			if (pPhotoItems)		
  				for (size_t i = 0; (pPhotoItem = json_at(pPhotoItems, i)) != NULL; i++) {					
 -					tszText += GetVkPhotoItem(pPhotoItem) + _T("\n");
 +					tszText += GetVkPhotoItem(pPhotoItem, m_iBBCForNews) + _T("\n");
  					if (i == 0 && vkNewsItem->tszType == _T("wall_photo")) {
  						LONG iPhotoPostId = json_as_int(json_get(pPhotoItem, "post_id"));
  						if (iPhotoPostId) {
 @@ -202,7 +202,7 @@ CVKNewsItem* CVkProto::GetVkNewsItem(JSONNODE *pItem, OBJLIST<CVkUserInfo> &vkUs  		JSONNODE *pAttachments = json_get(pItem, "attachments");
  		if (pAttachments)
 -			tszText += GetAttachmentDescr(pAttachments);
 +			tszText += GetAttachmentDescr(pAttachments, m_bUseBBCOnAttacmentsAsNews ? m_iBBCForNews : m_iBBCForAttachments);
  	}
  	CMString tszResFormat;	
 @@ -214,14 +214,15 @@ CVKNewsItem* CVkProto::GetVkNewsItem(JSONNODE *pItem, OBJLIST<CVkUserInfo> &vkUs  		bPostLink = false;
  	}
 -	vkNewsItem->tszText.AppendFormat(tszResFormat, SetBBCString(vkNewsItem->vkUser->m_tszUserNick.GetBuffer(), vkbbcUrl, 
 +	vkNewsItem->tszText.AppendFormat(tszResFormat, 
 +		SetBBCString(vkNewsItem->vkUser->m_tszUserNick.GetBuffer(), m_iBBCForNews, vkbbcUrl, 
  		vkNewsItem->vkUser->m_tszLink.GetBuffer()), tszText.GetBuffer());
  	vkNewsItem->tszId.AppendFormat(_T("%d_%d"), vkNewsItem->vkUser->m_UserId, iPostId);
  	if (bPostLink) {
  		vkNewsItem->tszLink = CMString(_T("https://vk.com/wall")) + vkNewsItem->tszId;
  		vkNewsItem->tszText.AppendChar(_T('\n'));
 -		vkNewsItem->tszText += SetBBCString(TranslateT("Link"), vkbbcUrl, vkNewsItem->tszLink.GetBuffer());
 +		vkNewsItem->tszText += SetBBCString(TranslateT("Link"), m_iBBCForNews, vkbbcUrl, vkNewsItem->tszLink.GetBuffer());
  	}
  	debugLog(_T("CVkProto::GetVkNewsItem %d %d <%s> <%s>"), iSourceId, iPostId, vkNewsItem->tszText.GetBuffer(), tszText.GetBuffer());
 @@ -260,7 +261,7 @@ CMString CVkProto::GetVkFeedback(JSONNODE *pFeedback, VKObjType vkFeedbackType,  			vkUser = GetVkUserInfo(iUserId, vkUsers);
  			if (!tszUsers.IsEmpty())
  				tszUsers += _T(", ");
 -			tszUsers += SetBBCString(vkUser->m_tszUserNick.GetBuffer(), vkbbcUrl, vkUser->m_tszLink.GetBuffer());
 +			tszUsers += SetBBCString(vkUser->m_tszUserNick.GetBuffer(), m_iBBCForNews, vkbbcUrl, vkUser->m_tszLink.GetBuffer());
  		}
  		tszRes.AppendFormat(_T("%s %%s %%s"), tszUsers.GetBuffer());
  		vkUser = NULL;
 @@ -270,7 +271,7 @@ CMString CVkProto::GetVkFeedback(JSONNODE *pFeedback, VKObjType vkFeedbackType,  	if (iUserId) {
  		vkUser = GetVkUserInfo(iUserId, vkUsers);
  		CMString tszText = json_as_string(json_get(pFeedback, "text"));	
 -		tszRes.AppendFormat(tszFormat, SetBBCString(vkUser->m_tszUserNick.GetBuffer(), vkbbcUrl, vkUser->m_tszLink.GetBuffer()), ClearFormatNick(tszText).GetBuffer());
 +		tszRes.AppendFormat(tszFormat, SetBBCString(vkUser->m_tszUserNick.GetBuffer(), m_iBBCForNews, vkbbcUrl, vkUser->m_tszLink.GetBuffer()), ClearFormatNick(tszText).GetBuffer());
  	}
  	return tszRes;
 @@ -286,7 +287,7 @@ CVKNewsItem* CVkProto::GetVkParent(JSONNODE *pParent, VKObjType vkParentType, TC  	CVKNewsItem * vkNotificationItem = new CVKNewsItem();
  	if (vkParentType == vkPhoto) {
 -		CMString tszPhoto = GetVkPhotoItem(pParent);
 +		CMString tszPhoto = GetVkPhotoItem(pParent, m_iBBCForNews);
  		LONG iOwnerId = json_as_int(json_get(pParent, "owner_id"));
  		LONG iId = json_as_int(json_get(pParent, "id"));
  		vkNotificationItem->tszId.AppendFormat(_T("%d_%d"), iOwnerId, iId);
 @@ -294,9 +295,9 @@ CVKNewsItem* CVkProto::GetVkParent(JSONNODE *pParent, VKObjType vkParentType, TC  		vkNotificationItem->tszText.AppendFormat(_T("\n%s"), tszPhoto.GetBuffer());
  		if (ptszReplyText)
 -			vkNotificationItem->tszText.AppendFormat(_T("\n>> %s"), SetBBCString(ptszReplyText, vkbbcI).GetBuffer());
 +			vkNotificationItem->tszText.AppendFormat(_T("\n>> %s"), SetBBCString(ptszReplyText, m_iBBCForNews, vkbbcI).GetBuffer());
 -		vkNotificationItem->tszText.AppendFormat(_T("\n%s"), SetBBCString(TranslateT("Link"), vkbbcUrl, vkNotificationItem->tszLink.GetBuffer()).GetBuffer());
 +		vkNotificationItem->tszText.AppendFormat(_T("\n%s"), SetBBCString(TranslateT("Link"), m_iBBCForNews, vkbbcUrl, vkNotificationItem->tszLink.GetBuffer()).GetBuffer());
  	}
  	else if (vkParentType == vkVideo) {
  		LONG iOwnerId = json_as_int(json_get(pParent, "owner_id"));
 @@ -309,12 +310,12 @@ CVKNewsItem* CVkProto::GetVkParent(JSONNODE *pParent, VKObjType vkParentType, TC  		ClearFormatNick(tszText);
  		if (!tszText.IsEmpty())
 -			vkNotificationItem->tszText.AppendFormat(_T("\n%s: %s"), SetBBCString(TranslateT("Video description:"), vkbbcB), SetBBCString(tszText.GetBuffer(), vkbbcI).GetBuffer());
 +			vkNotificationItem->tszText.AppendFormat(_T("\n%s: %s"), SetBBCString(TranslateT("Video description:"), m_iBBCForNews, vkbbcB), SetBBCString(tszText.GetBuffer(), m_iBBCForNews, vkbbcI).GetBuffer());
  		if (ptszReplyText)
 -			vkNotificationItem->tszText.AppendFormat(_T("\n>> %s"), SetBBCString(ptszReplyText, vkbbcI).GetBuffer());
 +			vkNotificationItem->tszText.AppendFormat(_T("\n>> %s"), SetBBCString(ptszReplyText, m_iBBCForNews, vkbbcI).GetBuffer());
 -		vkNotificationItem->tszText.AppendFormat(_T("\n%s"), SetBBCString(tszTitle.GetBuffer(), vkbbcUrl, vkNotificationItem->tszLink.GetBuffer()).GetBuffer());
 +		vkNotificationItem->tszText.AppendFormat(_T("\n%s"), SetBBCString(tszTitle.GetBuffer(), m_iBBCForNews, vkbbcUrl, vkNotificationItem->tszLink.GetBuffer()).GetBuffer());
  	}
  	else if (vkParentType == vkPost) {
  		LONG iOwnerId = json_as_int(json_get(pParent, "from_id"));
 @@ -326,12 +327,12 @@ CVKNewsItem* CVkProto::GetVkParent(JSONNODE *pParent, VKObjType vkParentType, TC  		ClearFormatNick(tszText);
  		if (!tszText.IsEmpty())
 -			vkNotificationItem->tszText.AppendFormat(_T("\n%s: %s"), SetBBCString(TranslateT("Post text:"), vkbbcB), SetBBCString(tszText.GetBuffer(), vkbbcI).GetBuffer());
 +			vkNotificationItem->tszText.AppendFormat(_T("\n%s: %s"), SetBBCString(TranslateT("Post text:"), m_iBBCForNews, vkbbcB), SetBBCString(tszText.GetBuffer(), m_iBBCForNews, vkbbcI).GetBuffer());
  		if (ptszReplyText)
 -			vkNotificationItem->tszText.AppendFormat(_T("\n>> %s"), SetBBCString(ptszReplyText, vkbbcI).GetBuffer());
 +			vkNotificationItem->tszText.AppendFormat(_T("\n>> %s"), SetBBCString(ptszReplyText, m_iBBCForNews, vkbbcI).GetBuffer());
 -		vkNotificationItem->tszText.AppendFormat(_T("\n%s"), SetBBCString(TranslateT("Link"), vkbbcUrl, vkNotificationItem->tszLink.GetBuffer()).GetBuffer());
 +		vkNotificationItem->tszText.AppendFormat(_T("\n%s"), SetBBCString(TranslateT("Link"), m_iBBCForNews, vkbbcUrl, vkNotificationItem->tszLink.GetBuffer()).GetBuffer());
  	}
  	else if (vkParentType == vkTopic) {
  		LONG iOwnerId = json_as_int(json_get(pParent, "owner_id"));
 @@ -345,12 +346,12 @@ CVKNewsItem* CVkProto::GetVkParent(JSONNODE *pParent, VKObjType vkParentType, TC  		ClearFormatNick(tszText);
  		if (!tszText.IsEmpty())
 -			vkNotificationItem->tszText.AppendFormat(_T("\n%s: %s"), SetBBCString(TranslateT("Topic text:"), vkbbcB), SetBBCString(tszText.GetBuffer(), vkbbcI).GetBuffer());
 +			vkNotificationItem->tszText.AppendFormat(_T("\n%s: %s"), SetBBCString(TranslateT("Topic text:"), m_iBBCForNews, vkbbcB), SetBBCString(tszText.GetBuffer(), m_iBBCForNews, vkbbcI).GetBuffer());
  		if (ptszReplyText)
 -			vkNotificationItem->tszText.AppendFormat(_T("\n>> %s"),	 SetBBCString(ptszReplyText, vkbbcI).GetBuffer());
 +			vkNotificationItem->tszText.AppendFormat(_T("\n>> %s"), SetBBCString(ptszReplyText, m_iBBCForNews, vkbbcI).GetBuffer());
 -		vkNotificationItem->tszText.AppendFormat(_T("\n%s"), SetBBCString(tszTitle.GetBuffer(), vkbbcUrl, vkNotificationItem->tszLink.GetBuffer()).GetBuffer());	
 +		vkNotificationItem->tszText.AppendFormat(_T("\n%s"), SetBBCString(tszTitle.GetBuffer(), m_iBBCForNews, vkbbcUrl, vkNotificationItem->tszLink.GetBuffer()).GetBuffer());
  	}
  	else if (vkParentType == vkComment) {
  		CMString tszText = json_as_string(json_get(pParent, "text"));
 diff --git a/protocols/VKontakte/src/vk_history.cpp b/protocols/VKontakte/src/vk_history.cpp index 5a7a1ece6b..70eacb89fd 100644 --- a/protocols/VKontakte/src/vk_history.cpp +++ b/protocols/VKontakte/src/vk_history.cpp @@ -201,7 +201,7 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque  		JSONNODE *pAttachments = json_get(pMsg, "attachments");
  		if (pAttachments != NULL)
 -			ptszBody = mir_tstrdup(CMString(ptszBody) + GetAttachmentDescr(pAttachments));
 +			ptszBody = mir_tstrdup(CMString(ptszBody) + GetAttachmentDescr(pAttachments, m_iBBCForAttachments));
  		MCONTACT hContact = FindUser(uid, true);
  		PROTORECVEVENT recv = { 0 };
 diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp index d6feff9be9..50e6010447 100644 --- a/protocols/VKontakte/src/vk_options.cpp +++ b/protocols/VKontakte/src/vk_options.cpp @@ -512,6 +512,12 @@ INT_PTR CALLBACK CVkProto::OptionsViewProc(HWND hwndDlg, UINT uMsg, WPARAM wPara  		CheckDlgButton(hwndDlg, IDC_NEWSBBC_BASIC, (ppro->m_iBBCForNews == bbcBasic) ? BST_CHECKED : BST_UNCHECKED);
  		CheckDlgButton(hwndDlg, IDC_NEWSBBC_ADV, (ppro->m_iBBCForNews == bbcAdvanced) ? BST_CHECKED : BST_UNCHECKED);
 +		CheckDlgButton(hwndDlg, IDC_BBC_ATT_NEWS, ppro->m_bUseBBCOnAttacmentsAsNews ? BST_CHECKED : BST_UNCHECKED);
 +
 +		CheckDlgButton(hwndDlg, IDC_ATTBBC_OFF, (ppro->m_iBBCForAttachments == bbcNo) ? BST_CHECKED : BST_UNCHECKED);
 +		CheckDlgButton(hwndDlg, IDC_ATTBBC_BASIC, (ppro->m_iBBCForAttachments == bbcBasic) ? BST_CHECKED : BST_UNCHECKED);
 +		CheckDlgButton(hwndDlg, IDC_ATTBBC_ADV, (ppro->m_iBBCForAttachments == bbcAdvanced) ? BST_CHECKED : BST_UNCHECKED);
 +
  		CheckDlgButton(hwndDlg, IDC_STICKERS_AS_SMYLES, ppro->m_bStikersAsSmyles ? BST_CHECKED : BST_UNCHECKED);
  		return TRUE;
 @@ -525,6 +531,10 @@ INT_PTR CALLBACK CVkProto::OptionsViewProc(HWND hwndDlg, UINT uMsg, WPARAM wPara  		case IDC_NEWSBBC_OFF:
  		case IDC_NEWSBBC_BASIC:
  		case IDC_NEWSBBC_ADV:
 +		case IDC_BBC_ATT_NEWS:
 +		case IDC_ATTBBC_OFF:
 +		case IDC_ATTBBC_BASIC:
 +		case IDC_ATTBBC_ADV:
  		case IDC_STICKERS_AS_SMYLES:
  			if (HIWORD(wParam) == BN_CLICKED && (HWND)lParam == GetFocus())
  				SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
 @@ -552,6 +562,17 @@ INT_PTR CALLBACK CVkProto::OptionsViewProc(HWND hwndDlg, UINT uMsg, WPARAM wPara  				ppro->m_iBBCForNews = bbcAdvanced;	
  			ppro->setByte("BBCForNews", ppro->m_iBBCForNews);
 +			ppro->m_bUseBBCOnAttacmentsAsNews = IsDlgButtonChecked(hwndDlg, IDC_BBC_ATT_NEWS) == BST_CHECKED;
 +			ppro->setByte("UseBBCOnAttacmentsAsNews", ppro->m_bStikersAsSmyles);
 +
 +			if (IsDlgButtonChecked(hwndDlg, IDC_ATTBBC_OFF) == BST_CHECKED)
 +				ppro->m_iBBCForAttachments = bbcNo;
 +			if (IsDlgButtonChecked(hwndDlg, IDC_ATTBBC_BASIC) == BST_CHECKED)
 +				ppro->m_iBBCForAttachments = bbcBasic;
 +			if (IsDlgButtonChecked(hwndDlg, IDC_ATTBBC_ADV) == BST_CHECKED)
 +				ppro->m_iBBCForAttachments = bbcAdvanced;
 +			ppro->setByte("BBCForAttachments", ppro->m_iBBCForAttachments);
 +
  			ppro->m_bStikersAsSmyles = IsDlgButtonChecked(hwndDlg, IDC_STICKERS_AS_SMYLES) == BST_CHECKED;
  			ppro->setByte("StikersAsSmyles", ppro->m_bStikersAsSmyles);
  		}
 diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index ec8fd83a32..c2a266eac5 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -83,7 +83,9 @@ CVkProto::CVkProto(const char *szModuleName, const TCHAR *ptszUserName) :  	m_iNewsInterval = getDword("NewsInterval", 15);
  	m_iNotificationsInterval = getDword("NotificationsInterval", 1);
  	m_iIMGBBCSupport = getByte("IMGBBCSupport", 0);
 -	m_iBBCForNews = getByte("BBCForNews", 0);
 +	m_iBBCForNews = (BBCSupport)getByte("BBCForNews", 1);
 +	m_iBBCForAttachments = (BBCSupport)getByte("BBCForAttachments", 1);
 +	m_bUseBBCOnAttacmentsAsNews = getBool("UseBBCOnAttacmentsAsNews", true);
  	m_bNewsAutoClearHistory = getBool("NewsAutoClearHistory", false);
  	m_iNewsAutoClearHistoryInterval = getDword("NewsAutoClearHistoryInterval", 60*60*24*3);
 diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index 4bbec6bd26..cd3bf38d10 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -209,11 +209,11 @@ struct CVKNewsItem : public MZeroedObject {  };
  enum VKBBCType { vkbbcB, vkbbcI, vkbbcS, vkbbcU, vkbbcUrl, vkbbcSize, vkbbcColor };
 -enum BBCForNewsSupport { bbcNo, bbcBasic, bbcAdvanced };
 +enum BBCSupport { bbcNo, bbcBasic, bbcAdvanced };
  struct CVKBBCItem {
  	VKBBCType vkBBCType;
 -	BBCForNewsSupport vkBBCSettings;
 +	BBCSupport vkBBCSettings;
  	TCHAR *ptszTempate;
  };
 @@ -354,8 +354,7 @@ struct CVkProto : public PROTO<CVkProto>  	CVkUserInfo* GetVkUserInfo(LONG iUserId, OBJLIST<CVkUserInfo> &vkUsers);
  	void CreateVkUserInfoList(OBJLIST<CVkUserInfo> &vkUsers, JSONNODE *pResponse);	
 -	CMString GetVkPhotoItem(JSONNODE *pPhotoItem);
 -	
 +		
  	CVKNewsItem* GetVkNewsItem(JSONNODE *pItem, OBJLIST<CVkUserInfo> &vkUsers, bool isRepost = false);
  	CVKNewsItem* GetVkNotificationsItem(JSONNODE *pItem, OBJLIST<CVkUserInfo> &vkUsers);
 @@ -403,10 +402,11 @@ struct CVkProto : public PROTO<CVkProto>  	char* GetStickerId(const char* Msg, int& stickerid);
  	CMString SpanVKNotificationType(CMString& tszType, VKObjType& vkFeedback, VKObjType& vkParent);
 -	CMString SetBBCString(TCHAR *tszString, VKBBCType, TCHAR *tszAddString = NULL);
 +	CMString GetVkPhotoItem(JSONNODE *pPhotoItem, BBCSupport iBBC);
 +	CMString SetBBCString(TCHAR *tszString, BBCSupport iBBC, VKBBCType bbcType, TCHAR *tszAddString = NULL);
  	CMString& ClearFormatNick(CMString& tszText);
 -	CMString GetAttachmentDescr(JSONNODE*);
 +	CMString GetAttachmentDescr(JSONNODE*, BBCSupport iBBC = bbcNo);
  	//====================================================================================
 @@ -570,7 +570,9 @@ private:  		m_bNotificationFilterComments,
  		m_bNotificationFilterLikes,
  		m_bNotificationFilterReposts,
 -		m_bNotificationFilterMentions;
 +		m_bNotificationFilterMentions,
 +		m_bUseBBCOnAttacmentsAsNews;
 +	
  	int m_iNewsInterval, m_iNotificationsInterval, m_iNewsAutoClearHistoryInterval;
 @@ -585,7 +587,8 @@ private:  	enum IMGBBCSypport { imgNo, imgFullSize, imgPreview130, imgPreview604 };
  	int	m_iIMGBBCSupport;
 -	int m_iBBCForNews;
 +	BBCSupport m_iBBCForNews;
 +	BBCSupport m_iBBCForAttachments;
  	LONG	m_myUserId;
  	ptrT	m_defaultGroup;
 diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index ca1a45255b..b7d144459e 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -634,7 +634,7 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe  		JSONNODE *pAttachments = json_get(pMsg, "attachments");
  		if (pAttachments != NULL)
 -			ptszBody = mir_tstrdup(CMString(ptszBody) + GetAttachmentDescr(pAttachments));
 +			ptszBody = mir_tstrdup(CMString(ptszBody) + GetAttachmentDescr(pAttachments, m_iBBCForAttachments));
  		MCONTACT hContact = NULL;
  		int chat_id = json_as_int(json_get(pMsg, "chat_id"));
  | 
