diff options
author | Sergey Bolhovskoy <elzorfox@ya.ru> | 2014-09-04 10:31:44 +0000 |
---|---|---|
committer | Sergey Bolhovskoy <elzorfox@ya.ru> | 2014-09-04 10:31:44 +0000 |
commit | 737038f45d00ebe16f57d7fb38e4ffa8793b3fde (patch) | |
tree | e39c8dfa16016b57d06a1eb58073958910dd9825 /protocols/VKontakte/src | |
parent | 12227286ce79b9283daced6d1b8b6e1a5f285d55 (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
Diffstat (limited to 'protocols/VKontakte/src')
-rw-r--r-- | protocols/VKontakte/src/resource.h | 6 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_options.cpp | 13 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.cpp | 16 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.h | 7 |
4 files changed, 36 insertions, 6 deletions
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;
|