diff options
author | Sergey Bolhovskoy <elzorfox@ya.ru> | 2014-10-10 09:38:24 +0000 |
---|---|---|
committer | Sergey Bolhovskoy <elzorfox@ya.ru> | 2014-10-10 09:38:24 +0000 |
commit | 0bcce6b2b5fb7cd0962ce096e02f7881abba89ef (patch) | |
tree | e61968f83274f5cf0a6743298254b085a9609f0b /protocols | |
parent | 9c407ec4efd8d884d3258d93e885a292b7fad560 (diff) |
VKontakte:
Add sticker support
‘Add [img] for graphical attachments’ options
'Force online status upon user activity’ options
git-svn-id: http://svn.miranda-ng.org/main/trunk@10754 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/VKontakte/res/resource.rc | 70 | ||||
-rw-r--r-- | protocols/VKontakte/src/resource.h | 4 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_options.cpp | 11 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.cpp | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.h | 4 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_thread.cpp | 40 |
6 files changed, 80 insertions, 51 deletions
diff --git a/protocols/VKontakte/res/resource.rc b/protocols/VKontakte/res/resource.rc index 923580ded8..84ec292260 100644 --- a/protocols/VKontakte/res/resource.rc +++ b/protocols/VKontakte/res/resource.rc @@ -33,6 +33,7 @@ IDI_READMSG ICON "read.ico" IDI_ABUSE ICON "report.ico"
IDI_VISITPROFILE ICON "home.ico"
IDI_HISTORY ICON "history.ico"
+IDI_KEYS ICON "key.ico"
#endif // Ðóññêèé (Ðîññèÿ) resources
/////////////////////////////////////////////////////////////////////////////
@@ -46,15 +47,6 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US /////////////////////////////////////////////////////////////////////////////
//
-// Icon
-//
-
-// Icon with lowest ID value placed first to ensure application icon
-// remains consistent on all systems.
-IDI_KEYS ICON "key.ico"
-
-/////////////////////////////////////////////////////////////////////////////
-//
// Dialog
//
@@ -70,42 +62,46 @@ BEGIN CONTROL "Open VKontakte site",IDC_URL,"Hyperlink",WS_TABSTOP,0,49,174,12
END
-IDD_OPT_MAIN DIALOGEX 0, 0, 304, 255
+IDD_OPT_MAIN DIALOGEX 0, 0, 304, 261
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- GROUPBOX "Login settings",IDC_STATIC,4,7,293,55
- LTEXT "E-mail or phone number:",IDC_STATIC,51,17,95,12
- EDITTEXT IDC_LOGIN,147,17,89,12,ES_AUTOHSCROLL
- LTEXT "Password:",IDC_STATIC,51,31,94,12
- EDITTEXT IDC_PASSWORD,147,31,90,12,ES_PASSWORD | ES_AUTOHSCROLL
- CONTROL "Open VKontakte site",IDC_URL,"Hyperlink",WS_TABSTOP,59,45,174,12
- GROUPBOX "Local settings",IDC_STATIC,4,62,293,27
- LTEXT "Contact list group:",IDC_STATIC,12,74,146,8
- EDITTEXT IDC_GROUPNAME,167,72,121,12,ES_AUTOHSCROLL
- GROUPBOX "Advanced",IDC_STATIC,4,90,293,80
- CONTROL "Server-side delivery confirmation",IDC_DELIVERY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,101,278,10
- CONTROL "Hide chats on startup",IDC_HIDECHATS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,112,278,10
+ GROUPBOX "Login settings",IDC_STATIC,4,7,293,50
+ LTEXT "E-mail or phone number:",IDC_STATIC,51,15,95,12
+ EDITTEXT IDC_LOGIN,147,15,89,12,ES_AUTOHSCROLL
+ LTEXT "Password:",IDC_STATIC,51,28,94,12
+ EDITTEXT IDC_PASSWORD,147,28,90,12,ES_PASSWORD | ES_AUTOHSCROLL
+ CONTROL "Open VKontakte site",IDC_URL,"Hyperlink",WS_TABSTOP,59,42,174,12
+ GROUPBOX "Local settings",IDC_STATIC,4,57,293,27
+ LTEXT "Contact list group:",IDC_STATIC,12,69,146,8
+ EDITTEXT IDC_GROUPNAME,167,67,121,12,ES_AUTOHSCROLL
+ GROUPBOX "Advanced",IDC_STATIC,4,84,293,97
+ CONTROL "Server-side delivery confirmation",IDC_DELIVERY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,93,278,10
+ CONTROL "Hide chats on startup",IDC_HIDECHATS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,104,278,10
CONTROL "Automatically wipe local contacts missing in your friend list",IDC_AUTOCLEAN,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,123,278,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,115,278,10
CONTROL "Always notify as unread for all incoming message",IDC_MESASUREAD,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,134,278,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,126,278,10
CONTROL "Automatically sync last messages",IDC_SYNCHISTOTYONONLINE,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,145,278,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,137,278,10
CONTROL "Use local time for received messages",IDC_USE_LOCAL_TIME,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,156,278,10
- GROUPBOX "When I ban user...",IDC_STATIC,4,171,293,37
- CONTROL "Report abuse",IDC_REPORT_ABUSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,182,129,10
- CONTROL "Clear server history",IDC_CLEAR_SERVER_HISTORY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,193,129,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,148,278,10
+ CONTROL "Add [img] bbc for graphical attachments",IDC_ADD_IMG_BBC,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,159,278,10
+ CONTROL "Force online status upon user activity",IDC_FORCE_ONLINE_ON_ACT,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,170,278,10
+ GROUPBOX "When I ban user...",IDC_STATIC,4,182,293,33
+ CONTROL "Report abuse",IDC_REPORT_ABUSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,192,129,10
+ CONTROL "Clear server history",IDC_CLEAR_SERVER_HISTORY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,203,129,10
CONTROL "Remove from friend list",IDC_REMOVE_FROM_FRENDLIST,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,155,182,129,10
- CONTROL "Remove from contact list",IDC_REMOVE_FROM_CLIST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,155,193,129,10
- GROUPBOX "Mark message as read...",IDC_STATIC_MARK_AS_READ,4,209,293,33,WS_GROUP
- CONTROL "on read",IDC_ONREAD,"Button",BS_AUTORADIOBUTTON,12,219,129,10
- CONTROL "on receive",IDC_ONRECEIVE,"Button",BS_AUTORADIOBUTTON,12,231,129,10
- CONTROL "on reply",IDC_ONREPLY,"Button",BS_AUTORADIOBUTTON,155,218,129,10
- CONTROL "on typing",IDC_ONTYPING,"Button",BS_AUTORADIOBUTTON,155,231,129,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,155,192,129,10
+ CONTROL "Remove from contact list",IDC_REMOVE_FROM_CLIST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,155,203,129,10
+ GROUPBOX "Mark message as read...",IDC_STATIC_MARK_AS_READ,4,216,293,33,WS_GROUP
+ CONTROL "on read",IDC_ONREAD,"Button",BS_AUTORADIOBUTTON,12,226,129,10
+ CONTROL "on receive",IDC_ONRECEIVE,"Button",BS_AUTORADIOBUTTON,12,237,129,10
+ CONTROL "on reply",IDC_ONREPLY,"Button",BS_AUTORADIOBUTTON,155,226,129,10
+ CONTROL "on typing",IDC_ONTYPING,"Button",BS_AUTORADIOBUTTON,155,237,129,10
END
IDD_CAPTCHAFORM DIALOGEX 0, 0, 258, 224
@@ -168,7 +164,7 @@ BEGIN LEFTMARGIN, 4
RIGHTMARGIN, 297
TOPMARGIN, 7
- BOTTOMMARGIN, 247
+ BOTTOMMARGIN, 253
END
IDD_INVITE, DIALOG
diff --git a/protocols/VKontakte/src/resource.h b/protocols/VKontakte/src/resource.h index ac52b3e97f..27e79c4b4c 100644 --- a/protocols/VKontakte/src/resource.h +++ b/protocols/VKontakte/src/resource.h @@ -41,11 +41,11 @@ #define IDC_CLEAR_SERVER_HISTORY 1031
#define IDC_REMOVE_FROM_FRENDLIST 1032
#define IDC_REMOVE_FROM_CLIST 1033
+#define IDC_ADD_IMG_BBC 1034
+#define IDC_FORCE_ONLINE_ON_ACT 1035
#define IDC_ONREAD 1039
#define IDC_ONRECEIVE 1040
-#define IDC_REPLY 1041
#define IDC_ONREPLY 1041
-#define IDC_TYPING 1042
#define IDC_ONTYPING 1042
#define IDC_STATIC_MARK_AS_READ 1043
diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp index b4d1dbfd45..f415020918 100644 --- a/protocols/VKontakte/src/vk_options.cpp +++ b/protocols/VKontakte/src/vk_options.cpp @@ -124,11 +124,12 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L CheckDlgButton(hwndDlg, IDC_MESASUREAD, ppro->m_bMesAsUnread);
CheckDlgButton(hwndDlg, IDC_SYNCHISTOTYONONLINE, ppro->m_bAutoSyncHistory);
CheckDlgButton(hwndDlg, IDC_USE_LOCAL_TIME, ppro->m_bUseLocalTime);
+ CheckDlgButton(hwndDlg, IDC_ADD_IMG_BBC, ppro->m_bAddImgBbc);
+ CheckDlgButton(hwndDlg, IDC_FORCE_ONLINE_ON_ACT, ppro->m_bUserForceOnlineOnActivity);
CheckDlgButton(hwndDlg, IDC_REPORT_ABUSE, ppro->m_bReportAbuse);
CheckDlgButton(hwndDlg, IDC_CLEAR_SERVER_HISTORY, ppro->m_bClearServerHistory);
CheckDlgButton(hwndDlg, IDC_REMOVE_FROM_FRENDLIST, ppro->m_bRemoveFromFrendlist);
CheckDlgButton(hwndDlg, IDC_REMOVE_FROM_CLIST, ppro->m_bRemoveFromClist);
-
CheckDlgButton(hwndDlg, IDC_ONREAD, (ppro->m_iMarkMessageReadOn == markOnRead));
CheckDlgButton(hwndDlg, IDC_ONRECEIVE, (ppro->m_iMarkMessageReadOn == markOnReceive));
CheckDlgButton(hwndDlg, IDC_ONREPLY, (ppro->m_iMarkMessageReadOn == markOnReply));
@@ -154,6 +155,8 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L case IDC_MESASUREAD:
case IDC_SYNCHISTOTYONONLINE:
case IDC_USE_LOCAL_TIME:
+ case IDC_ADD_IMG_BBC:
+ case IDC_FORCE_ONLINE_ON_ACT:
case IDC_REPORT_ABUSE:
case IDC_CLEAR_SERVER_HISTORY:
case IDC_REMOVE_FROM_FRENDLIST:
@@ -202,6 +205,12 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L ppro->m_bUseLocalTime = IsDlgButtonChecked(hwndDlg, IDC_USE_LOCAL_TIME) == BST_CHECKED;
ppro->setByte("UseLocalTime", ppro->m_bUseLocalTime);
+ ppro->m_bAddImgBbc = IsDlgButtonChecked(hwndDlg, IDC_ADD_IMG_BBC) == BST_CHECKED;
+ ppro->setByte("AddImgBbc", ppro->m_bAddImgBbc);
+
+ ppro->m_bUserForceOnlineOnActivity = IsDlgButtonChecked(hwndDlg, IDC_FORCE_ONLINE_ON_ACT) == BST_CHECKED;
+ ppro->setByte("UserForceOnlineOnActivity", ppro->m_bUserForceOnlineOnActivity);
+
ppro->m_bReportAbuse = IsDlgButtonChecked(hwndDlg, IDC_REPORT_ABUSE) == BST_CHECKED;
ppro->setByte("ReportAbuseOnBanUser", ppro->m_bReportAbuse);
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index 1dfcddc7cc..910c79b0f4 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -73,6 +73,8 @@ CVkProto::CVkProto(const char *szModuleName, const TCHAR *ptszUserName) : m_bRemoveFromClist = getBool("RemoveFromClistOnBanUser", false);
m_bPopUpSyncHistory = getBool("PopUpSyncHistory", false);
m_iMarkMessageReadOn = getByte("MarkMessageReadOn", 0);
+ m_bAddImgBbc = getBool("AddImgBbc", false);
+ m_bUserForceOnlineOnActivity = getBool("UserForceOnlineOnActivity", false);
// Set all contacts offline -- in case we crashed
SetAllContactStatuses(ID_STATUS_OFFLINE);
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index 1c5453b463..2aabbe2abe 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -406,7 +406,9 @@ private: m_bClearServerHistory,
m_bRemoveFromFrendlist,
m_bRemoveFromClist,
- m_bPopUpSyncHistory;
+ m_bPopUpSyncHistory,
+ m_bAddImgBbc,
+ m_bUserForceOnlineOnActivity;
enum MarkMsgReadOn{ markOnRead, markOnReceive, markOnReply, markOnTyping };
int m_iMarkMessageReadOn;
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 232703f7ad..d68c299bf4 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -527,7 +527,7 @@ void CVkProto::RetrieveUnreadMessages() << VER_API);
}
-static char* szImageTypes[] = { "photo_2560", "photo_1280", "photo_807", "photo_604", "photo_130", "photo_75" };
+static char* szImageTypes[] = { "photo_2560", "photo_1280", "photo_807", "photo_604", "photo_256", "photo_130", "photo_128", "photo_75", "photo_64" };
void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq)
{
@@ -581,6 +581,8 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe recv.flags |= PREF_CREATEREAD;
if (isOut)
recv.flags |= PREF_SENT;
+ else if (m_bUserForceOnlineOnActivity)
+ setWord(hContact, "Status", ID_STATUS_ONLINE);
recv.timestamp = m_bUseLocalTime?time(NULL):datetime;
recv.tszMessage = ptszBody;
@@ -1060,11 +1062,17 @@ void CVkProto::PollUpdates(JSONNODE *pUpdates) case VKPOLL_MSG_DELFLAGS:
flags = json_as_int(json_at(pChild, 2));
uid = json_as_int(json_at(pChild, 3));
- if (((hContact = FindUser(uid)) != NULL) && (flags&VKFLAG_MSGUNREAD)){
- setDword(hContact, "LastMsgReadTime", time(NULL));
- SetSrmmReadStatus(hContact);
+ hContact = FindUser(uid);
+ if (hContact != NULL) {
+ if (flags&VKFLAG_MSGUNREAD){
+ setDword(hContact, "LastMsgReadTime", time(NULL));
+ SetSrmmReadStatus(hContact);
+ }
+ if (m_bUserForceOnlineOnActivity)
+ setWord(hContact, "Status", ID_STATUS_ONLINE);
}
break;
+
case VKPOLL_MSG_ADDED: // new message
msgid = json_as_int(json_at(pChild, 1));
@@ -1078,13 +1086,18 @@ void CVkProto::PollUpdates(JSONNODE *pUpdates) mids.AppendChar(',');
mids.AppendFormat("%d", msgid);
break;
+
case VKPOLL_READ_ALL_OUT:
uid = json_as_int(json_at(pChild, 1));
- if ((hContact = FindUser(uid)) != NULL){
+ hContact = FindUser(uid);
+ if (hContact != NULL){
setDword(hContact, "LastMsgReadTime", time(NULL));
SetSrmmReadStatus(hContact);
+ if (m_bUserForceOnlineOnActivity)
+ setWord(hContact, "Status", ID_STATUS_ONLINE);
}
break;
+
case VKPOLL_USR_ONLINE:
uid = -json_as_int(json_at(pChild, 1));
if ((hContact = FindUser(uid)) != NULL)
@@ -1101,8 +1114,12 @@ void CVkProto::PollUpdates(JSONNODE *pUpdates) case VKPOLL_USR_UTN:
uid = json_as_int(json_at(pChild, 1));
- if ((hContact = FindUser(uid)) != NULL)
- ForkThread(&CVkProto::ContactTypingThread, (void *)hContact);
+ hContact = FindUser(uid);
+ if (hContact != NULL){
+ ForkThread(&CVkProto::ContactTypingThread, (void *)hContact);
+ if (m_bUserForceOnlineOnActivity)
+ setWord(hContact, "Status", ID_STATUS_ONLINE);
+ }
break;
case VKPOLL_CHAT_CHANGED:
@@ -1183,8 +1200,8 @@ CMString CVkProto::GetAttachmentDescr(JSONNODE *pAttachments) for (int k = 0; (pAttach = json_at(pAttachments, k)) != NULL; k++) {
res.AppendChar('\t');
ptrT ptszType(json_as_string(json_get(pAttach, "type")));
- if (!lstrcmp(ptszType, _T("photo"))) {
- JSONNODE *pPhoto = json_get(pAttach, "photo");
+ if (!lstrcmp(ptszType, _T("photo")) || !lstrcmp(ptszType, _T("sticker"))) {
+ JSONNODE *pPhoto = json_get(pAttach, mir_t2a(ptszType));
if (pPhoto == NULL) continue;
ptrT ptszLink;
@@ -1198,7 +1215,10 @@ CMString CVkProto::GetAttachmentDescr(JSONNODE *pAttachments) int iWidth = json_as_int(json_get(pPhoto, "width"));
int iHeight = json_as_int(json_get(pPhoto, "height"));
- res.AppendFormat(_T("%s: %s (%dx%d)"), TranslateT("Photo"), ptszLink, iWidth, iHeight);
+ ptrT ptszTypeTranslate((lstrcmp(ptszType, _T("photo")) == 0) ? TranslateT("Photo") : TranslateT("Sticker"));
+ res.AppendFormat(_T("%s: %s (%dx%d)"), ptszTypeTranslate, ptszLink, iWidth, iHeight);
+ if (m_bAddImgBbc)
+ res.AppendFormat(L"\n\t[img]%s[/img]", ptszLink);
}
else if (!lstrcmp(ptszType, _T("audio"))) {
JSONNODE *pAudio = json_get(pAttach, "audio");
|