summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorSergey Bolhovskoy <elzorfox@ya.ru>2014-11-26 05:03:20 +0000
committerSergey Bolhovskoy <elzorfox@ya.ru>2014-11-26 05:03:20 +0000
commit78ea011bd205b2b7f538950d32935f93debd6040 (patch)
tree6af575b89b9dcc2900a64283bb87083f09049536 /protocols
parentdb2ec6c60fc50ea7a66a9d782b1af1017df596ca (diff)
VKontakte:
more options for sync history on protocol online some code cleanup version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@11079 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/VKontakte/res/resource.rc25
-rw-r--r--protocols/VKontakte/src/resource.h10
-rw-r--r--protocols/VKontakte/src/version.h2
-rw-r--r--protocols/VKontakte/src/vk_history.cpp24
-rw-r--r--protocols/VKontakte/src/vk_options.cpp28
-rw-r--r--protocols/VKontakte/src/vk_proto.cpp3
-rw-r--r--protocols/VKontakte/src/vk_proto.h8
-rw-r--r--protocols/VKontakte/src/vk_thread.cpp7
8 files changed, 69 insertions, 38 deletions
diff --git a/protocols/VKontakte/res/resource.rc b/protocols/VKontakte/res/resource.rc
index f1d9f30f89..3375a0542a 100644
--- a/protocols/VKontakte/res/resource.rc
+++ b/protocols/VKontakte/res/resource.rc
@@ -79,7 +79,7 @@ BEGIN
VERTGUIDE, 167
VERTGUIDE, 288
TOPMARGIN, 7
- BOTTOMMARGIN, 177
+ BOTTOMMARGIN, 202
END
IDD_INVITE, DIALOG
@@ -147,7 +147,7 @@ BEGIN
CONTROL "as regular status only",IDC_SEND_MUSIC_STATUS,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,160,278,10
END
-IDD_OPT_MAIN DIALOGEX 0, 0, 304, 188
+IDD_OPT_MAIN DIALOGEX 0, 0, 304, 213
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
@@ -158,21 +158,24 @@ BEGIN
RTEXT "Password:",IDC_STATIC,12,28,150,10
EDITTEXT IDC_PASSWORD,167,28,121,12,ES_PASSWORD | ES_AUTOHSCROLL
CONTROL "Open VKontakte site",IDC_URL,"Hyperlink",WS_TABSTOP,59,43,174,11
- GROUPBOX "Local settings",IDC_STATIC,4,59,293,77
+ GROUPBOX "Local settings",IDC_STATIC,4,59,293,65
RTEXT "Contact list group:",IDC_STATIC,12,71,150,8
EDITTEXT IDC_GROUPNAME,167,69,121,12,ES_AUTOHSCROLL
CONTROL "Server-side delivery confirmation",IDC_DELIVERY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,88,278,10
CONTROL "Use local time for received messages",IDC_USE_LOCAL_TIME,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,99,278,10
- CONTROL "Automatically sync last messages",IDC_SYNCHISTOTYONONLINE,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,110,278,10
CONTROL "Automatically wipe local contacts missing in your friend list",IDC_AUTOCLEAN,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,121,278,10
- GROUPBOX "Mark message as read...",IDC_STATIC_MARK_AS_READ,4,140,293,33,WS_GROUP
- CONTROL "on read",IDC_ONREAD,"Button",BS_AUTORADIOBUTTON,12,151,138,10
- CONTROL "on receive",IDC_ONRECEIVE,"Button",BS_AUTORADIOBUTTON,12,161,138,10
- CONTROL "on reply",IDC_ONREPLY,"Button",BS_AUTORADIOBUTTON,155,151,133,10
- CONTROL "on typing",IDC_ONTYPING,"Button",BS_AUTORADIOBUTTON,155,161,133,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,110,278,10
+ GROUPBOX "Mark message as read...",IDC_STATIC_MARK_AS_READ,4,127,293,33,WS_GROUP
+ CONTROL "on read",IDC_ONREAD,"Button",BS_AUTORADIOBUTTON,12,138,138,10
+ CONTROL "on receive",IDC_ONRECEIVE,"Button",BS_AUTORADIOBUTTON,12,148,138,10
+ CONTROL "on reply",IDC_ONREPLY,"Button",BS_AUTORADIOBUTTON,155,138,133,10
+ CONTROL "on typing",IDC_ONTYPING,"Button",BS_AUTORADIOBUTTON,155,148,133,10
+ GROUPBOX "Sync history on protocol online...",IDC_STATIC_SYNC_HISTORY,4,163,293,36,WS_GROUP
+ CONTROL "off",IDC_SYNC_OFF,"Button",BS_AUTORADIOBUTTON,12,174,138,10
+ CONTROL "automatically",IDC_SYNC_AUTO,"Button",BS_AUTORADIOBUTTON,12,185,138,10
+ CONTROL "for last 1 day",IDC_SYNC_LAST1DAY,"Button",BS_AUTORADIOBUTTON,155,174,133,10
+ CONTROL "for last 3 days",IDC_SYNC_LAST3DAY,"Button",BS_AUTORADIOBUTTON,155,185,133,10
END
IDD_CAPTCHAFORM DIALOGEX 0, 0, 258, 224
diff --git a/protocols/VKontakte/src/resource.h b/protocols/VKontakte/src/resource.h
index 1a2e567e6c..f4532a417e 100644
--- a/protocols/VKontakte/src/resource.h
+++ b/protocols/VKontakte/src/resource.h
@@ -35,9 +35,6 @@
#define IDC_CONTACT 1015
#define IDC_AUTOCLEAN 1020
#define IDC_MESASUREAD 1025
-#define IDC_MARKREADONREPLY 1026
-#define IDC_SYNCHISTOTYONONLINE 1027
-#define IDC_MARKREADONTYPING 1028
#define IDC_USE_LOCAL_TIME 1029
#define IDC_REPORT_ABUSE 1030
#define IDC_CLEAR_SERVER_HISTORY 1031
@@ -56,6 +53,11 @@
#define IDC_SEND_MUSIC_STATUS 1046
#define IDC_SEND_MUSIC_BROADCAST 1047
#define IDC_SEND_MUSIC_BROADCAST_AND_STATUS 1048
+#define IDC_STATIC_SYNC_HISTORY 1049
+#define IDC_SYNC_OFF 1050
+#define IDC_SYNC_AUTO 1051
+#define IDC_SYNC_LAST1DAY 1052
+#define IDC_SYNC_LAST3DAY 1053
// Next default values for new objects
//
@@ -64,7 +66,7 @@
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 118
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1049
+#define _APS_NEXT_CONTROL_VALUE 1054
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h
index 64f4821f58..e15680d850 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 28
+#define __BUILD_NUM 29
#include <stdver.h>
diff --git a/protocols/VKontakte/src/vk_history.cpp b/protocols/VKontakte/src/vk_history.cpp
index 2c85626843..1d77774198 100644
--- a/protocols/VKontakte/src/vk_history.cpp
+++ b/protocols/VKontakte/src/vk_history.cpp
@@ -144,14 +144,24 @@ void CVkProto::GetServerHistory(MCONTACT hContact, int iOffset, int iCount, int
void CVkProto::GetHistoryDlg(MCONTACT hContact, int iLastMsg)
{
debugLogA("CVkProto::GetHistoryDlg %d", iLastMsg);
-
- int lastmsgid = getDword(hContact, "lastmsgid", -1);
- if (lastmsgid == -1 || !IsOnline()) {
- setDword(hContact, "lastmsgid", iLastMsg);
- return;
+ int lastmsgid = -1;
+ switch (m_iSyncHistoryMetod){
+ case syncAuto:
+ lastmsgid = getDword(hContact, "lastmsgid", -1);
+ if (lastmsgid == -1 || !IsOnline()) {
+ setDword(hContact, "lastmsgid", iLastMsg);
+ return;
+ }
+ GetServerHistory(hContact, 0, MAXHISTORYMIDSPERONE, 0, lastmsgid);
+ break;
+ case sync1Days:
+ GetServerHistoryLastNDay(hContact, 1);
+ break;
+ case sync3Days:
+ GetServerHistoryLastNDay(hContact, 3);
+ break;
}
-
- GetServerHistory(hContact, 0, MAXHISTORYMIDSPERONE, 0, lastmsgid);
+
}
void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq)
diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp
index bf1236564e..f1ea2388b2 100644
--- a/protocols/VKontakte/src/vk_options.cpp
+++ b/protocols/VKontakte/src/vk_options.cpp
@@ -121,13 +121,18 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
CheckDlgButton(hwndDlg, IDC_DELIVERY, ppro->m_bServerDelivery);
CheckDlgButton(hwndDlg, IDC_USE_LOCAL_TIME, ppro->m_bUseLocalTime);
- CheckDlgButton(hwndDlg, IDC_SYNCHISTOTYONONLINE, ppro->m_bAutoSyncHistory);
CheckDlgButton(hwndDlg, IDC_AUTOCLEAN, ppro->getByte("AutoClean", 0));
CheckDlgButton(hwndDlg, IDC_ONREAD, (ppro->m_iMarkMessageReadOn == markOnRead));
CheckDlgButton(hwndDlg, IDC_ONRECEIVE, (ppro->m_iMarkMessageReadOn == markOnReceive));
CheckDlgButton(hwndDlg, IDC_ONREPLY, (ppro->m_iMarkMessageReadOn == markOnReply));
CheckDlgButton(hwndDlg, IDC_ONTYPING, (ppro->m_iMarkMessageReadOn == markOnTyping));
+
+ CheckDlgButton(hwndDlg, IDC_SYNC_OFF, (ppro->m_iSyncHistoryMetod == syncOff));
+ CheckDlgButton(hwndDlg, IDC_SYNC_AUTO, (ppro->m_iSyncHistoryMetod == syncAuto));
+ CheckDlgButton(hwndDlg, IDC_SYNC_LAST1DAY, (ppro->m_iSyncHistoryMetod == sync1Days));
+ CheckDlgButton(hwndDlg, IDC_SYNC_LAST3DAY, (ppro->m_iSyncHistoryMetod == sync3Days));
+
return TRUE;
case WM_COMMAND:
@@ -145,12 +150,17 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
case IDC_DELIVERY:
case IDC_USE_LOCAL_TIME:
- case IDC_SYNCHISTOTYONONLINE:
case IDC_AUTOCLEAN:
+
case IDC_ONREAD:
case IDC_ONRECEIVE:
case IDC_ONREPLY:
case IDC_ONTYPING:
+
+ case IDC_SYNC_OFF:
+ case IDC_SYNC_AUTO:
+ case IDC_SYNC_LAST1DAY:
+ case IDC_SYNC_LAST3DAY:
if (HIWORD(wParam) == BN_CLICKED && (HWND)lParam == GetFocus())
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
@@ -179,9 +189,6 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
ppro->setByte("AutoClean", IsDlgButtonChecked(hwndDlg, IDC_AUTOCLEAN) == BST_CHECKED);
- ppro->m_bAutoSyncHistory = IsDlgButtonChecked(hwndDlg, IDC_SYNCHISTOTYONONLINE) == BST_CHECKED;
- ppro->setByte("AutoSyncHistory", ppro->m_bAutoSyncHistory);
-
ppro->m_bUseLocalTime = IsDlgButtonChecked(hwndDlg, IDC_USE_LOCAL_TIME) == BST_CHECKED;
ppro->setByte("UseLocalTime", ppro->m_bUseLocalTime);
@@ -194,6 +201,17 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
if (IsDlgButtonChecked(hwndDlg, IDC_ONTYPING) == BST_CHECKED)
ppro->m_iMarkMessageReadOn = markOnTyping;
ppro->setByte("MarkMessageReadOn", ppro->m_iMarkMessageReadOn);
+
+ if (IsDlgButtonChecked(hwndDlg, IDC_SYNC_OFF) == BST_CHECKED)
+ ppro->m_iSyncHistoryMetod = syncOff;
+ if (IsDlgButtonChecked(hwndDlg, IDC_SYNC_AUTO) == BST_CHECKED)
+ ppro->m_iSyncHistoryMetod = syncAuto;
+ if (IsDlgButtonChecked(hwndDlg, IDC_SYNC_LAST1DAY) == BST_CHECKED)
+ ppro->m_iSyncHistoryMetod = sync1Days;
+ if (IsDlgButtonChecked(hwndDlg, IDC_SYNC_LAST3DAY) == BST_CHECKED)
+ ppro->m_iSyncHistoryMetod = sync3Days;
+
+ ppro->setByte("SyncHistoryMetod", ppro->m_iSyncHistoryMetod);
}
break;
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp
index 27001486c7..8f2db393b7 100644
--- a/protocols/VKontakte/src/vk_proto.cpp
+++ b/protocols/VKontakte/src/vk_proto.cpp
@@ -64,7 +64,6 @@ CVkProto::CVkProto(const char *szModuleName, const TCHAR *ptszUserName) :
m_bServerDelivery = getBool("ServerDelivery", true);
m_bHideChats = getBool("HideChats", true);
m_bMesAsUnread = getBool("MesAsUnread", false);
- m_bAutoSyncHistory = getBool("AutoSyncHistory", true);
m_bUseLocalTime = getBool("UseLocalTime", false);
m_bReportAbuse = getBool("ReportAbuseOnBanUser", false);
m_bClearServerHistory = getBool("ClearServerHistoryOnBanUser", false);
@@ -75,8 +74,8 @@ CVkProto::CVkProto(const char *szModuleName, const TCHAR *ptszUserName) :
m_bAddImgBbc = getBool("AddImgBbc", false);
m_bStikersAsSmyles = getBool("StikersAsSmyles", false);
m_bUserForceOnlineOnActivity = getBool("UserForceOnlineOnActivity", false);
-
m_iMusicSendMetod = getByte("MusicSendMetod", sendBroadcastOnly);
+ m_iSyncHistoryMetod = getByte("SyncHistoryMetod", syncOff);
CMStringA szListeningTo(m_szModuleName);
szListeningTo += "Enabled";
db_set_b(NULL, "ListeningTo", szListeningTo.GetBuffer(), m_iMusicSendMetod == 0 ? 0 : 1);
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h
index e20d33cbf2..b20659a538 100644
--- a/protocols/VKontakte/src/vk_proto.h
+++ b/protocols/VKontakte/src/vk_proto.h
@@ -437,7 +437,6 @@ private:
m_bOnline,
m_bHideChats,
m_bMesAsUnread,
- m_bAutoSyncHistory,
m_bUseLocalTime,
m_bReportAbuse,
m_bClearServerHistory,
@@ -449,10 +448,13 @@ private:
m_bUserForceOnlineOnActivity;
enum MarkMsgReadOn{ markOnRead, markOnReceive, markOnReply, markOnTyping };
- int m_iMarkMessageReadOn;
+ int m_iMarkMessageReadOn;
+
+ enum SyncHistoryMetod{ syncOff, syncAuto, sync1Days, sync3Days };
+ int m_iSyncHistoryMetod;
enum MusicSendMetod{ sendNone, sendStatusOnly, sendBroadcastOnly, sendBroadcastAndStatus };
- int m_iMusicSendMetod;
+ int m_iMusicSendMetod;
LONG m_myUserId;
ptrT m_defaultGroup;
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp
index ae4d84fb9f..0e6e406191 100644
--- a/protocols/VKontakte/src/vk_thread.cpp
+++ b/protocols/VKontakte/src/vk_thread.cpp
@@ -662,8 +662,7 @@ void CVkProto::OnReceiveDlgs(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq)
if (pDlgs == NULL)
return;
- if (m_bAutoSyncHistory&&m_bPopUpSyncHistory)
- MsgPopup(NULL, TranslateT("Start sync history"), TranslateT("Sync history"));
+
for (int i = 0; i < numDlgs; i++) {
JSONNODE *pDlg = json_at(pDlgs, i);
if (pDlg == NULL)
@@ -681,7 +680,7 @@ void CVkProto::OnReceiveDlgs(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq)
if (m_chats.find((CVkChatInfo*)&chatid) == NULL)
AppendChat(chatid, pDlg);
}
- else if (m_bAutoSyncHistory) {
+ else if (m_iSyncHistoryMetod) {
int mid = json_as_int(json_get(pDlg, "id"));
int uid = json_as_int(json_get(pDlg, "user_id"));
MCONTACT hContact = FindUser(uid, true);
@@ -704,8 +703,6 @@ void CVkProto::OnReceiveDlgs(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq)
MarkMessagesRead(hContact);
}
}
- if (m_bAutoSyncHistory && m_bPopUpSyncHistory)
- MsgPopup(NULL, TranslateT("Sync history complete"), TranslateT("Sync history"));
RetrieveUsersInfo();
}