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 | |
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
-rw-r--r-- | protocols/VKontakte/res/resource.rc | 51 | ||||
-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 |
9 files changed, 54 insertions, 29 deletions
diff --git a/protocols/VKontakte/res/resource.rc b/protocols/VKontakte/res/resource.rc index 4b63787c43..8e39824aaa 100644 --- a/protocols/VKontakte/res/resource.rc +++ b/protocols/VKontakte/res/resource.rc @@ -95,7 +95,7 @@ BEGIN LEFTMARGIN, 4
RIGHTMARGIN, 297
TOPMARGIN, 7
- BOTTOMMARGIN, 226
+ BOTTOMMARGIN, 227
END
IDD_OPT_MAIN, DIALOG
@@ -248,41 +248,42 @@ BEGIN CONTROL "Open VKontakte site",IDC_URL,"Hyperlink",WS_TABSTOP,0,49,174,12
END
-IDD_OPT_ADV DIALOGEX 0, 0, 304, 236
+IDD_OPT_ADV DIALOGEX 0, 0, 304, 233
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- GROUPBOX "Advanced",IDC_STATIC,4,8,293,94
- CONTROL "Hide chats on startup",IDC_HIDECHATS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,19,278,10
+ GROUPBOX "Advanced",IDC_STATIC,4,8,293,101
+ CONTROL "Hide chats on startup",IDC_HIDECHATS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,17,278,10
CONTROL "Sync read message status from server",IDC_SYNC_MSG_STATUS,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,30,268,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,28,268,10
CONTROL "Always notify as unread for all incoming message",IDC_MESASUREAD,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,41,278,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,39,278,10
CONTROL "Force invisible status upon user activity",IDC_FORCE_ONLINE_ON_ACT,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,52,278,10
- LTEXT "Invisible interval timeout (min):",IDC_STATIC,16,67,184,8
- EDITTEXT IDC_ED_INT_INVIS,204,63,40,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
- CONTROL "",IDC_SPIN_INT_INVIS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,244,63,14,14
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,50,278,10
+ LTEXT "Invisible interval timeout (min):",IDC_STATIC,16,63,184,8
+ EDITTEXT IDC_ED_INT_INVIS,204,60,40,13,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
+ CONTROL "",IDC_SPIN_INT_INVIS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,244,60,14,13
CONTROL "Use non-standard urlEncode for sent messages (less traffic)",IDC_USENOSTDURLENCODE,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,78,278,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,74,278,10
CONTROL "Send VK-objects links as attachments",IDC_SENDVKURLSASATTACH,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,89,278,10
- GROUPBOX "When I ban user...",IDC_STATIC,4,102,293,33
- CONTROL "Report abuse",IDC_REPORT_ABUSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,112,129,10
- CONTROL "Clear server history",IDC_CLEAR_SERVER_HISTORY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,123,129,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,85,278,10
+ CONTROL "and load sent attachments",IDC_LOADSENTATTACH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,21,96,269,10
+ GROUPBOX "When I ban user...",IDC_STATIC,4,108,293,33
+ CONTROL "Report abuse",IDC_REPORT_ABUSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,118,129,10
+ CONTROL "Clear server history",IDC_CLEAR_SERVER_HISTORY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,129,129,10
CONTROL "Remove from friend list",IDC_REMOVE_FROM_FRENDLIST,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,148,112,141,10
- CONTROL "Remove from contact list",IDC_REMOVE_FROM_CLIST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,148,123,141,10
- GROUPBOX "Broadcast music...",IDC_STATIC_SEND_MUSIC_METOD,4,138,293,58,WS_GROUP
- CONTROL "off",IDC_SEND_MUSIC_NONE,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,149,278,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,148,118,141,10
+ CONTROL "Remove from contact list",IDC_REMOVE_FROM_CLIST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,148,129,141,10
+ GROUPBOX "Broadcast music...",IDC_STATIC_SEND_MUSIC_METOD,4,142,293,58,WS_GROUP
+ CONTROL "off",IDC_SEND_MUSIC_NONE,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,153,278,10
CONTROL "as regular status for unknown music and audio status otherwise",IDC_SEND_MUSIC_BROADCAST_AND_STATUS,
- "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,160,278,10
- CONTROL "as audio status only",IDC_SEND_MUSIC_BROADCAST,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,171,278,10
- CONTROL "as regular status only",IDC_SEND_MUSIC_STATUS,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,182,278,10
- GROUPBOX "Group chats",IDC_STATIC_CHATS,4,195,293,27,WS_GROUP
- LTEXT "Message for return to group chat:",IDC_STATIC,12,206,120,8
- EDITTEXT IDC_RET_CHAT_MES,134,204,157,12,ES_AUTOHSCROLL
+ "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,164,278,10
+ CONTROL "as audio status only",IDC_SEND_MUSIC_BROADCAST,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,175,278,10
+ CONTROL "as regular status only",IDC_SEND_MUSIC_STATUS,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,186,278,10
+ GROUPBOX "Group chats",IDC_STATIC_CHATS,4,199,293,27,WS_GROUP
+ LTEXT "Message for return to group chat:",IDC_STATIC,12,210,120,8
+ EDITTEXT IDC_RET_CHAT_MES,134,208,157,12,ES_AUTOHSCROLL
END
IDD_OPT_MAIN DIALOGEX 0, 0, 304, 182
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;
|