summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Bolhovskoy <elzorfox@ya.ru>2014-09-04 10:31:44 +0000
committerSergey Bolhovskoy <elzorfox@ya.ru>2014-09-04 10:31:44 +0000
commit737038f45d00ebe16f57d7fb38e4ffa8793b3fde (patch)
treee39c8dfa16016b57d06a1eb58073958910dd9825
parent12227286ce79b9283daced6d1b8b6e1a5f285d55 (diff)
VKontakte:
Typing support Add mark read on typing option git-svn-id: http://svn.miranda-ng.org/main/trunk@10366 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--protocols/VKontakte/res/resource.rc15
-rw-r--r--protocols/VKontakte/src/resource.h6
-rw-r--r--protocols/VKontakte/src/vk_options.cpp13
-rw-r--r--protocols/VKontakte/src/vk_proto.cpp16
-rw-r--r--protocols/VKontakte/src/vk_proto.h7
5 files changed, 44 insertions, 13 deletions
diff --git a/protocols/VKontakte/res/resource.rc b/protocols/VKontakte/res/resource.rc
index f77f41352f..0b3ca95bac 100644
--- a/protocols/VKontakte/res/resource.rc
+++ b/protocols/VKontakte/res/resource.rc
@@ -12,7 +12,7 @@
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
-// English (United States) resources
+// Английский (США) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
@@ -51,14 +51,15 @@ BEGIN
EDITTEXT IDC_GROUPNAME,167,86,121,12,ES_AUTOHSCROLL
GROUPBOX "Advanced",IDC_STATIC,4,108,293,108
CONTROL "Server-side delivery confirmation",IDC_DELIVERY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,120,278,10
- CONTROL "Hide chats on startup",IDC_HIDECHATS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,134,278,10
+ CONTROL "Hide chats on startup",IDC_HIDECHATS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,133,278,10
CONTROL "Automatically wipe local contacts missing in your Friends list",IDC_AUTOCLEAN,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,148,278,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,146,278,10
CONTROL "Always notify as unread for all incoming message",IDC_MESASUREAD,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,162,278,10
- CONTROL "Mark read on reply",IDC_MARKREADONREPLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,176,278,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,159,278,10
+ CONTROL "Mark read on reply",IDC_MARKREADONREPLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,171,278,10
+ CONTROL "Mark read on typing",IDC_MARKREADONTYPING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,184,267,10
CONTROL "Automatically sync last messages",IDC_SYNCHISTOTYONONLINE,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,190,278,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,197,278,10
END
IDD_CAPTCHAFORM DIALOGEX 0, 0, 258, 224
@@ -177,7 +178,7 @@ END
#endif // APSTUDIO_INVOKED
-#endif // English (United States) resources
+#endif // Английский (США) resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/VKontakte/src/resource.h b/protocols/VKontakte/src/resource.h
index a05f84ae78..254b124515 100644
--- a/protocols/VKontakte/src/resource.h
+++ b/protocols/VKontakte/src/resource.h
@@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by d:\svn\protocols\VKontakte\res\resource.rc
+// Включаемый файл, созданный в Microsoft Visual C++.
+// Используется d:\svn\protocols\VKontakte\res\resource.rc
//
#define IDD_ACCMGRUI 101
#define IDD_CAPTCHAFORM 102
@@ -27,7 +27,7 @@
#define IDC_MESASUREAD 1025
#define IDC_MARKREADONREPLY 1026
#define IDC_SYNCHISTOTYONONLINE 1027
-
+#define IDC_MARKREADONTYPING 1028
// Next default values for new objects
//
diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp
index 46fc46a137..5ac052fcc1 100644
--- a/protocols/VKontakte/src/vk_options.cpp
+++ b/protocols/VKontakte/src/vk_options.cpp
@@ -123,6 +123,8 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
CheckDlgButton(hwndDlg, IDC_AUTOCLEAN, ppro->getByte("AutoClean", 0));
CheckDlgButton(hwndDlg, IDC_MESASUREAD, ppro->m_bMesAsUnread);
CheckDlgButton(hwndDlg, IDC_MARKREADONREPLY, ppro->m_bMarkReadOnReply);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_MARKREADONTYPING), ppro->m_bMarkReadOnReply);
+ CheckDlgButton(hwndDlg, IDC_MARKREADONTYPING, ppro->m_bMarkReadOnTyping);
CheckDlgButton(hwndDlg, IDC_SYNCHISTOTYONONLINE, ppro->m_bAutoSyncHistory);
return TRUE;
@@ -143,11 +145,17 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
case IDC_HIDECHATS:
case IDC_AUTOCLEAN:
case IDC_MESASUREAD:
- case IDC_MARKREADONREPLY:
+ case IDC_MARKREADONTYPING:
case IDC_SYNCHISTOTYONONLINE:
if (HIWORD(wParam) == BN_CLICKED && (HWND)lParam == GetFocus())
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
+ case IDC_MARKREADONREPLY:
+ if (HIWORD(wParam) == BN_CLICKED && (HWND)lParam == GetFocus()){
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_MARKREADONTYPING), (IsDlgButtonChecked(hwndDlg, IDC_MARKREADONREPLY) == BST_CHECKED));
+ }
+ break;
}
break;
@@ -182,6 +190,9 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
ppro->m_bMarkReadOnReply = IsDlgButtonChecked(hwndDlg, IDC_MARKREADONREPLY) == BST_CHECKED;
ppro->setByte("MarkReadOnReply", ppro->m_bMarkReadOnReply);
+ ppro->m_bMarkReadOnTyping = (IsDlgButtonChecked(hwndDlg, IDC_MARKREADONREPLY) == BST_CHECKED) && (IsDlgButtonChecked(hwndDlg, IDC_MARKREADONTYPING) == BST_CHECKED);
+ ppro->setByte("MarkReadOnTyping", ppro->m_bMarkReadOnTyping);
+
ppro->m_bAutoSyncHistory = IsDlgButtonChecked(hwndDlg, IDC_SYNCHISTOTYONONLINE) == BST_CHECKED;
ppro->setByte("AutoSyncHistory", ppro->m_bAutoSyncHistory);
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp
index f08e004b08..d2191bc4b2 100644
--- a/protocols/VKontakte/src/vk_proto.cpp
+++ b/protocols/VKontakte/src/vk_proto.cpp
@@ -56,6 +56,7 @@ CVkProto::CVkProto(const char *szModuleName, const TCHAR *ptszUserName) :
m_bHideChats = getBool("HideChats", true);
m_bMesAsUnread = getBool("MesAsUnread", false);
m_bMarkReadOnReply = getBool("MarkReadOnReply", false);
+ m_bMarkReadOnTyping = getBool("MarkReadOnTyping", false) && m_bMarkReadOnReply;
m_bAutoSyncHistory = getBool("AutoSyncHistory", true);
// Set all contacts offline -- in case we crashed
@@ -322,7 +323,20 @@ int CVkProto::AuthDeny(HANDLE hDbEvent, const PROTOCHAR *reason)
int CVkProto::UserIsTyping(MCONTACT hContact, int type)
{
- return 0;
+ if (PROTOTYPE_SELFTYPING_ON == type) {
+ LONG userID = getDword(hContact, "ID", -1);
+ if ((userID == -1)||(!IsOnline()))
+ return 1;
+
+ if (m_bMarkReadOnTyping)
+ MarkMessagesRead(hContact);
+
+ Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/messages.setActivity.json", true, &CVkProto::OnReceiveSmth)
+ << INT_PARAM("user_id", userID)
+ << CHAR_PARAM("type", "typing"));
+ return 0;
+ }
+ return 1;
}
MCONTACT CVkProto::AddToListByEvent(int flags,int iContact,HANDLE hDbEvent)
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h
index e0d0501f96..46c153491d 100644
--- a/protocols/VKontakte/src/vk_proto.h
+++ b/protocols/VKontakte/src/vk_proto.h
@@ -283,7 +283,12 @@ private:
void __cdecl SendMsgAck(void *param);
- bool m_bOnline, m_bHideChats, m_bMesAsUnread, m_bMarkReadOnReply, m_bAutoSyncHistory;
+ bool m_bOnline,
+ m_bHideChats,
+ m_bMesAsUnread,
+ m_bMarkReadOnReply,
+ m_bMarkReadOnTyping,
+ m_bAutoSyncHistory;
LONG m_myUserId;
ptrA m_szAccessToken;