diff options
author | Sergey Bolhovskoy <elzorfox@ya.ru> | 2016-07-15 08:38:42 +0000 |
---|---|---|
committer | Sergey Bolhovskoy <elzorfox@ya.ru> | 2016-07-15 08:38:42 +0000 |
commit | 894863f12475eccf99c943aa96d9c27e9a8b6303 (patch) | |
tree | eef96092e56f9b001ddf3dd015d0d318c62edb75 /protocols/VKontakte/src | |
parent | 9fa7784dc51d3f1bee7a7370450efaeebc5b5d31 (diff) |
VKontakte:
add option for loading sent attachments
version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@17094 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src')
-rw-r--r-- | protocols/VKontakte/src/resource.h | 1 | ||||
-rw-r--r-- | protocols/VKontakte/src/version.h | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_messages.cpp | 11 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_options.cpp | 12 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_options.h | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_pollserver.cpp | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_struct.cpp | 1 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_struct.h | 1 |
8 files changed, 28 insertions, 4 deletions
diff --git a/protocols/VKontakte/src/resource.h b/protocols/VKontakte/src/resource.h index a54c792242..0fa7af88fc 100644 --- a/protocols/VKontakte/src/resource.h +++ b/protocols/VKontakte/src/resource.h @@ -125,6 +125,7 @@ #define IDC_COMBO_SYNCHISTORY 1109
#define IDC_N_FRIENDACCEPTED 1110
#define IDC_SENDVKURLSASATTACH 1111
+#define IDC_LOADSENTATTACH 1112
// Next default values for new objects
//
diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h index dfccb9463b..42de045b32 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 2
-#define __BUILD_NUM 2
+#define __BUILD_NUM 3
#include <stdver.h>
diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp index 02c84f8e78..a9a7f222e4 100644 --- a/protocols/VKontakte/src/vk_messages.cpp +++ b/protocols/VKontakte/src/vk_messages.cpp @@ -256,11 +256,12 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe tszBody += tszFwdMessages;
}
+ CMString tszAttachmentDescr;
const JSONNode &jnAttachments = jnMsg["attachments"];
if (jnAttachments) {
- CMString tszAttachmentDescr = GetAttachmentDescr(jnAttachments, m_vkOptions.BBCForAttachments());
+ tszAttachmentDescr = GetAttachmentDescr(jnAttachments, m_vkOptions.BBCForAttachments());
if (!tszBody.IsEmpty())
- tszAttachmentDescr = _T("\n") + tszAttachmentDescr;
+ tszBody += _T("\n");
tszBody += tszAttachmentDescr;
}
@@ -319,6 +320,12 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe if (!isOut)
m_incIds.insert((HANDLE)mid);
}
+ else if (m_vkOptions.bLoadSentAttachments && !tszAttachmentDescr.IsEmpty() && !isOut) {
+ T2Utf pszAttach(tszAttachmentDescr);
+ recv.timestamp = time(NULL); // only local time
+ recv.szMessage = pszAttach;
+ ProtoChainRecvMsg(hContact, &recv);
+ }
}
if (!mids.IsEmpty())
diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp index 67a2bc45f2..631fe55d41 100644 --- a/protocols/VKontakte/src/vk_options.cpp +++ b/protocols/VKontakte/src/vk_options.cpp @@ -227,6 +227,7 @@ CVkOptionAdvancedForm::CVkOptionAdvancedForm(CVkProto *proto): m_edtInvInterval(this, IDC_ED_INT_INVIS),
m_spInvInterval(this, IDC_SPIN_INT_INVIS),
m_cbSendVKLinksAsAttachments(this, IDC_SENDVKURLSASATTACH),
+ m_cbLoadSentAttachments(this, IDC_LOADSENTATTACH),
m_cbUseNonStandardUrlEncode(this, IDC_USENOSTDURLENCODE),
m_cbReportAbuse(this, IDC_REPORT_ABUSE),
m_cbClearServerHistory(this, IDC_CLEAR_SERVER_HISTORY),
@@ -244,6 +245,7 @@ CVkOptionAdvancedForm::CVkOptionAdvancedForm(CVkProto *proto): CreateLink(m_cbForceInvisibleStatus, m_proto->m_vkOptions.bUserForceInvisibleOnActivity);
CreateLink(m_edtInvInterval, m_proto->m_vkOptions.iInvisibleInterval);
CreateLink(m_cbSendVKLinksAsAttachments, m_proto->m_vkOptions.bSendVKLinksAsAttachments);
+ CreateLink(m_cbLoadSentAttachments, m_proto->m_vkOptions.bLoadSentAttachments);
CreateLink(m_cbUseNonStandardUrlEncode, m_proto->m_vkOptions.bUseNonStandardUrlEncode);
CreateLink(m_cbReportAbuse, m_proto->m_vkOptions.bReportAbuse);
CreateLink(m_cbClearServerHistory, m_proto->m_vkOptions.bClearServerHistory);
@@ -252,6 +254,7 @@ CVkOptionAdvancedForm::CVkOptionAdvancedForm(CVkProto *proto): CreateLink(m_edtReturnChatMessage, m_proto->m_vkOptions.ptszReturnChatMessage);
m_cbForceInvisibleStatus.OnChange = Callback(this, &CVkOptionAdvancedForm::On_cbForceInvisibleStatusChange);
+ m_cbSendVKLinksAsAttachments.OnChange = Callback(this, &CVkOptionAdvancedForm::On_cbSendVKLinksAsAttachmentsChange);
}
void CVkOptionAdvancedForm::OnInitDialog()
@@ -265,6 +268,7 @@ void CVkOptionAdvancedForm::OnInitDialog() m_spInvInterval.SendMsg(UDM_SETPOS, 0, m_proto->m_vkOptions.iInvisibleInterval);
On_cbForceInvisibleStatusChange(&m_cbForceInvisibleStatus);
+ On_cbSendVKLinksAsAttachmentsChange(&m_cbSendVKLinksAsAttachments);
}
void CVkOptionAdvancedForm::OnApply()
@@ -277,6 +281,9 @@ void CVkOptionAdvancedForm::OnApply() m_proto->m_vkOptions.iMusicSendMetod = MusicSendMetod::sendBroadcastOnly;
if (m_cbMusicSendStatus.GetState())
m_proto->m_vkOptions.iMusicSendMetod = MusicSendMetod::sendStatusOnly;
+
+ if (m_cbSendVKLinksAsAttachments.GetState() == 0)
+ m_proto->m_vkOptions.bLoadSentAttachments = false;
}
void CVkOptionAdvancedForm::On_cbForceInvisibleStatusChange(CCtrlCheck *)
@@ -287,6 +294,11 @@ void CVkOptionAdvancedForm::On_cbForceInvisibleStatusChange(CCtrlCheck *) m_spInvInterval.Enable(bEnable);
}
+void CVkOptionAdvancedForm::On_cbSendVKLinksAsAttachmentsChange(CCtrlCheck *)
+{
+ m_cbLoadSentAttachments.Enable(m_cbSendVKLinksAsAttachments.GetState());
+}
+
////////////////////// News and notifications ////////////////////////////////
CVkOptionFeedsForm::CVkOptionFeedsForm(CVkProto *proto):
diff --git a/protocols/VKontakte/src/vk_options.h b/protocols/VKontakte/src/vk_options.h index 2db33a8bbf..ed5e35bc15 100644 --- a/protocols/VKontakte/src/vk_options.h +++ b/protocols/VKontakte/src/vk_options.h @@ -78,6 +78,7 @@ class CVkOptionAdvancedForm : public CVkDlgBase CCtrlCheck m_cbUseNonStandardUrlEncode;
CCtrlCheck m_cbSendVKLinksAsAttachments;
+ CCtrlCheck m_cbLoadSentAttachments;
CCtrlCheck m_cbReportAbuse;
CCtrlCheck m_cbClearServerHistory;
@@ -96,6 +97,7 @@ public: void OnInitDialog();
void OnApply();
void On_cbForceInvisibleStatusChange(CCtrlCheck*);
+ void On_cbSendVKLinksAsAttachmentsChange(CCtrlCheck*);
};
////////////////////// News and notifications ////////////////////////////////
diff --git a/protocols/VKontakte/src/vk_pollserver.cpp b/protocols/VKontakte/src/vk_pollserver.cpp index 545b740322..a18754ce83 100644 --- a/protocols/VKontakte/src/vk_pollserver.cpp +++ b/protocols/VKontakte/src/vk_pollserver.cpp @@ -104,7 +104,7 @@ void CVkProto::PollUpdates(const JSONNode &jnUpdates) // skip outgoing messages sent from a client
flags = jnChild[2].as_int();
- if (flags & VKFLAG_MSGOUTBOX && !(flags & VKFLAG_MSGCHAT) && CheckMid(m_sendIds, msgid))
+ if (flags & VKFLAG_MSGOUTBOX && !(flags & VKFLAG_MSGCHAT) && !m_vkOptions.bSendVKLinksAsAttachments && CheckMid(m_sendIds, msgid))
break;
if (!mids.IsEmpty())
diff --git a/protocols/VKontakte/src/vk_struct.cpp b/protocols/VKontakte/src/vk_struct.cpp index a5a158ac28..eff1800b1a 100644 --- a/protocols/VKontakte/src/vk_struct.cpp +++ b/protocols/VKontakte/src/vk_struct.cpp @@ -205,6 +205,7 @@ CVKOptions::CVKOptions(PROTO_INTERFACE *proto) : bNotificationFilterAcceptedFriends(proto, "NotificationFilterAcceptedFriends", true),
bSendVKLinksAsAttachments(proto, "SendVKLinksAsAttachments", true),
+ bLoadSentAttachments(proto, "LoadSentAttachments", bSendVKLinksAsAttachments),
bUseNonStandardNotifications(proto, "UseNonStandardNotifications", false),
bUseNonStandardUrlEncode(proto, "UseNonStandardUrlEncode", true),
bShortenLinksForAudio(proto, "ShortenLinksForAudio", true),
diff --git a/protocols/VKontakte/src/vk_struct.h b/protocols/VKontakte/src/vk_struct.h index b7c7f3c9be..5d084189e6 100644 --- a/protocols/VKontakte/src/vk_struct.h +++ b/protocols/VKontakte/src/vk_struct.h @@ -335,6 +335,7 @@ struct CVKOptions { CMOption<BYTE> bSyncReadMessageStatusFromServer;
CMOption<BYTE> bLoadFullCList;
CMOption<BYTE> bSendVKLinksAsAttachments;
+ CMOption<BYTE> bLoadSentAttachments;
CMOption<BYTE> bShowProtoMenuItem0;
CMOption<BYTE> bShowProtoMenuItem1;
|