diff options
author | Sergey Bolhovskoy <elzorfox@ya.ru> | 2016-04-07 04:40:53 +0000 |
---|---|---|
committer | Sergey Bolhovskoy <elzorfox@ya.ru> | 2016-04-07 04:40:53 +0000 |
commit | 6298b38266b6744d83c1bfb1801cce1b0986a4cf (patch) | |
tree | a70fd6ef5bea116c24c96d81d34bec1a07b7b1c9 /protocols | |
parent | c48ee58a97b7d9548f94071fa9aa7d152e253cd6 (diff) |
VKontakte:
option flags move to separate class
account manager dialog -> core ui
option page dialogs -> core ui
move declarations to private section
remove unneeded (after rev. 16596) attention from option dialog
code cleanup
version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@16600 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
25 files changed, 1138 insertions, 1225 deletions
diff --git a/protocols/VKontakte/res/resource.rc b/protocols/VKontakte/res/resource.rc index e17f070264..8a3a99abc7 100644 --- a/protocols/VKontakte/res/resource.rc +++ b/protocols/VKontakte/res/resource.rc @@ -153,13 +153,13 @@ BEGIN CONTROL "advanced (+[url], [size], [color], [code])",IDC_NEWSBBC_ADV,
"Button",BS_AUTORADIOBUTTON,154,61,129,10
CONTROL "Use this setting also for attachments on news and notifications",IDC_BBC_ATT_NEWS,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,83,278,10
- GROUPBOX "Other",IDC_STATIC,4,138,293,36
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,83,278,10
GROUPBOX "BBCode support on attachments",IDC_STATIC,4,99,294,38,WS_GROUP
CONTROL "off",IDC_ATTBBC_OFF,"Button",BS_AUTORADIOBUTTON,12,110,129,10
CONTROL "basic ([b], [i], [u], [s])",IDC_ATTBBC_BASIC,"Button",BS_AUTORADIOBUTTON,12,121,129,10
CONTROL "advanced (+[url], [size], [color], [code])",IDC_ATTBBC_ADV,
"Button",BS_AUTORADIOBUTTON,154,110,129,10
+ GROUPBOX "Other",IDC_STATIC,4,138,293,36
CONTROL "Process stickers as smileys",IDC_STICKERS_AS_SMYLES,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,149,278,10
CONTROL "Shorten links for audio attachments",IDC_SHOTEN_LINKS_FOR_AUDIO,
@@ -270,7 +270,7 @@ BEGIN GROUPBOX "Local settings",IDC_STATIC,4,59,293,75
RTEXT "Contact list group:",IDC_STATIC,12,71,150,8
EDITTEXT IDC_GROUPNAME,167,69,121,12,ES_AUTOHSCROLL
- RTEXT "Language for names and titles (*):",IDC_STATIC,12,86,148,10
+ RTEXT "Language for names and titles:",IDC_STATIC,12,86,148,10
COMBOBOX IDC_COMBO_LANGUAGE,167,84,121,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
CONTROL "Server-side delivery confirmation",IDC_DELIVERY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,98,278,10
CONTROL "Use local time for received messages",IDC_USE_LOCAL_TIME,
@@ -287,7 +287,6 @@ BEGIN CONTROL "automatically",IDC_SYNC_AUTO,"Button",BS_AUTORADIOBUTTON,12,195,138,10
CONTROL "for last 1 day",IDC_SYNC_LAST1DAY,"Button",BS_AUTORADIOBUTTON,155,184,133,10
CONTROL "for last 3 days",IDC_SYNC_LAST3DAY,"Button",BS_AUTORADIOBUTTON,155,195,133,10
- CTEXT "* These changes will take effect the next time you connect to the VKontakte network.",IDC_STATIC,12,213,276,10
END
IDD_CAPTCHAFORM DIALOGEX 0, 0, 258, 224
diff --git a/protocols/VKontakte/src/main.cpp b/protocols/VKontakte/src/main.cpp index 058c65b8e4..5b1f032980 100644 --- a/protocols/VKontakte/src/main.cpp +++ b/protocols/VKontakte/src/main.cpp @@ -56,7 +56,7 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_PROTOCO /////////////////////////////////////////////////////////////////////////////////////////
// OnLoad - initialize the plugin instance
-static CVkProto* vkProtoInit(const char* pszProtoName, const TCHAR *tszUserName)
+static CVkProto* vkProtoInit(const char *pszProtoName, const TCHAR *tszUserName)
{
CVkProto *ppro = new CVkProto(pszProtoName, tszUserName);
return ppro;
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 5d9edd9364..37274b0e79 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -17,9 +17,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-static const char* szImageTypes[] = { "photo_2560", "photo_1280", "photo_807", "photo_604", "photo_256", "photo_130", "photo_128", "photo_75", "photo_64" , "preview"};
+static const char *szImageTypes[] = { "photo_2560", "photo_1280", "photo_807", "photo_604", "photo_256", "photo_130", "photo_128", "photo_75", "photo_64" , "preview"};
-static const char* szGiftTypes[] = { "thumb_256", "thumb_96", "thumb_48" };
+static const char *szGiftTypes[] = { "thumb_256", "thumb_96", "thumb_48" };
JSONNode nullNode(JSON_NULL);
@@ -42,7 +42,7 @@ LPCSTR findHeader(NETLIBHTTPREQUEST *pReq, LPCSTR szField) return NULL;
}
-bool tlstrstr(TCHAR* _s1, TCHAR* _s2)
+bool tlstrstr(TCHAR *_s1, TCHAR *_s2)
{
TCHAR s1[1024], s2[1024];
@@ -189,7 +189,7 @@ MCONTACT CVkProto::FindUser(LONG dwUserid, bool bCreate) MCONTACT hNewContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD);
Proto_AddToContact(hNewContact, m_szModuleName);
setDword(hNewContact, "ID", dwUserid);
- db_set_ts(hNewContact, "CList", "Group", m_defaultGroup);
+ db_set_ts(hNewContact, "CList", "Group", getGroup());
return hNewContact;
}
@@ -455,7 +455,7 @@ void CVkProto::GrabCookies(NETLIBHTTPREQUEST *nhr) }
}
if (k == m_cookies.getCount())
- m_cookies.insert(new Cookie(szCookieName, szCookieVal, szDomain));
+ m_cookies.insert(new CVkCookie(szCookieName, szCookieVal, szDomain));
}
}
}
@@ -697,14 +697,14 @@ void CVkProto::MarkDialogAsRead(MCONTACT hContact) }
}
-char* CVkProto::GetStickerId(const char* Msg, int &stickerid)
+char* CVkProto::GetStickerId(const char *Msg, int &stickerid)
{
stickerid = 0;
- char* retMsg = NULL;
+ char *retMsg = NULL;
int iRes = 0;
char HeadMsg[32] = { 0 };
- const char * tmpMsg = strstr(Msg, "[sticker:");
+ const char *tmpMsg = strstr(Msg, "[sticker:");
if (tmpMsg)
iRes = sscanf(tmpMsg, "[sticker:%d]", &stickerid);
if (iRes == 1) {
@@ -735,12 +735,12 @@ int CVkProto::OnDbSettingChanged(WPARAM hContact, LPARAM lParam) MusicSendMetod iOldMusicSendMetod = (MusicSendMetod)getByte("OldMusicSendMetod", sendBroadcastAndStatus);
if (cws->value.bVal == 0)
- setByte("OldMusicSendMetod", m_iMusicSendMetod);
+ setByte("OldMusicSendMetod", m_vkOptions.iMusicSendMetod);
else
db_unset(0, m_szModuleName, "OldMusicSendMetod");
- m_iMusicSendMetod = cws->value.bVal == 0 ? sendNone : iOldMusicSendMetod;
- setByte("MusicSendMetod", m_iMusicSendMetod);
+ m_vkOptions.iMusicSendMetod = cws->value.bVal == 0 ? sendNone : iOldMusicSendMetod;
+ setByte("MusicSendMetod", m_vkOptions.iMusicSendMetod);
}
return 0;
@@ -812,7 +812,7 @@ CMString CVkProto::GetVkPhotoItem(const JSONNode &jnPhoto, BBCSupport iBBC) }
}
- switch (m_iIMGBBCSupport) {
+ switch (m_vkOptions.iIMGBBCSupport) {
case imgNo:
tszPreviewLink = _T("");
break;
@@ -821,7 +821,7 @@ CMString CVkProto::GetVkPhotoItem(const JSONNode &jnPhoto, BBCSupport iBBC) break;
case imgPreview130:
case imgPreview604:
- tszPreviewLink = jnPhoto[ m_iIMGBBCSupport == imgPreview130 ? "photo_130" : "photo_604"].as_mstring();
+ tszPreviewLink = jnPhoto[m_vkOptions.iIMGBBCSupport == imgPreview130 ? "photo_130" : "photo_604"].as_mstring();
break;
}
@@ -829,7 +829,7 @@ CMString CVkProto::GetVkPhotoItem(const JSONNode &jnPhoto, BBCSupport iBBC) int iHeight = jnPhoto["height"].as_int();
tszRes.AppendFormat(_T("%s (%dx%d)"), SetBBCString(TranslateT("Photo"), iBBC, vkbbcUrl, tszLink), iWidth, iHeight);
- if (m_iIMGBBCSupport && iBBC != bbcNo)
+ if (m_vkOptions.iIMGBBCSupport && iBBC != bbcNo)
tszRes.AppendFormat(_T("\n\t%s"), SetBBCString(!tszPreviewLink.IsEmpty() ? tszPreviewLink : (!tszLink.IsEmpty() ? tszLink : _T("")), bbcBasic, vkbbcImg));
CMString tszText(jnPhoto["text"].as_mstring());
if (!tszText.IsEmpty())
@@ -944,7 +944,7 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport CMString tszAudio(FORMAT, _T("%s - %s"), tszArtist, tszTitle);
int iParamPos = tszUrl.Find(_T("?"));
- if (m_bShortenLinksForAudio && iParamPos != -1)
+ if (m_vkOptions.bShortenLinksForAudio && iParamPos != -1)
tszUrl = tszUrl.Left(iParamPos);
res.AppendFormat(_T("%s: %s"),
@@ -1024,7 +1024,7 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport continue;
res.Empty(); // sticker is not really an attachment, so we don't want all that heading info
- if (m_bStikersAsSmyles) {
+ if (m_vkOptions.bStikersAsSmyles) {
int id = jnSticker["id"].as_int();
res.AppendFormat(_T("[sticker:%d]"), id);
}
@@ -1039,7 +1039,7 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport }
res.AppendFormat(_T("%s"), tszLink);
- if (m_iIMGBBCSupport && iBBC != bbcNo)
+ if (m_vkOptions.iIMGBBCSupport && iBBC != bbcNo)
res += SetBBCString(tszLink, iBBC, vkbbcImg);
}
}
@@ -1083,7 +1083,7 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport continue;
res += SetBBCString(TranslateT("Gift"), iBBC, vkbbcUrl, tszLink);
- if (m_iIMGBBCSupport && iBBC != bbcNo)
+ if (m_vkOptions.iIMGBBCSupport && iBBC != bbcNo)
res.AppendFormat(_T("\n\t%s"), SetBBCString(tszLink, iBBC, vkbbcImg));
}
else
@@ -1113,7 +1113,7 @@ CMString CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jn CMString tszNick(FORMAT, _T("%s %s"), jnUser["first_name"].as_mstring(), jnUser["last_name"].as_mstring());
CMString tszLink(FORMAT, _T("https://vk.com/id%d"), iUserId);
- CVkUserInfo * vkUser = new CVkUserInfo(jnUser["id"].as_int(), false, tszNick, tszLink, FindUser(iUserId));
+ CVkUserInfo *vkUser = new CVkUserInfo(jnUser["id"].as_int(), false, tszNick, tszLink, FindUser(iUserId));
vkUsers.insert(vkUser);
}
@@ -1122,7 +1122,7 @@ CMString CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jn const JSONNode &jnMsg = (*it);
UINT uid = jnMsg["user_id"].as_int();
- CVkUserInfo * vkUser = vkUsers.find((CVkUserInfo *)&uid);
+ CVkUserInfo *vkUser = vkUsers.find((CVkUserInfo *)&uid);
CMString tszNick, tszUrl;
if (vkUser) {
@@ -1148,7 +1148,7 @@ CMString CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jn const JSONNode &jnFwdMessages = jnMsg["fwd_messages"];
if (jnFwdMessages) {
- CMString tszFwdMessages = GetFwdMessages(jnFwdMessages, jnFUsers, iBBC == bbcNo ? iBBC : m_iBBCForAttachments);
+ CMString tszFwdMessages = GetFwdMessages(jnFwdMessages, jnFUsers, iBBC == bbcNo ? iBBC : m_vkOptions.BBCForAttachments());
if (!tszBody.IsEmpty())
tszFwdMessages = _T("\n") + tszFwdMessages;
tszBody += tszFwdMessages;
@@ -1156,14 +1156,14 @@ CMString CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jn const JSONNode &jnAttachments = jnMsg["attachments"];
if (jnAttachments) {
- CMString tszAttachmentDescr = GetAttachmentDescr(jnAttachments, iBBC == bbcNo ? iBBC : m_iBBCForAttachments);
+ CMString tszAttachmentDescr = GetAttachmentDescr(jnAttachments, iBBC == bbcNo ? iBBC : m_vkOptions.BBCForAttachments());
if (!tszBody.IsEmpty())
tszAttachmentDescr = _T("\n") + tszAttachmentDescr;
tszBody += tszAttachmentDescr;
}
tszBody.Replace(_T("\n"), _T("\n\t"));
- TCHAR tcSplit = m_bSplitFormatFwdMsg ? '\n' : ' ';
+ TCHAR tcSplit = m_vkOptions.bSplitFormatFwdMsg ? '\n' : ' ';
CMString tszMes(FORMAT, _T("%s %s%c%s %s:\n\n%s\n"),
SetBBCString(TranslateT("Message from"), iBBC, vkbbcB),
SetBBCString(tszNick, iBBC, vkbbcUrl, tszUrl),
@@ -1199,14 +1199,14 @@ void CVkProto::SetInvisible(MCONTACT hContact) CMString CVkProto::RemoveBBC(CMString& tszSrc)
{
- static const TCHAR* tszSimpleBBCodes[][2] = {
+ static const TCHAR *tszSimpleBBCodes[][2] = {
{ _T("[b]"), _T("[/b]") },
{ _T("[u]"), _T("[/u]") },
{ _T("[i]"), _T("[/i]") },
{ _T("[s]"), _T("[/s]") },
};
- static const TCHAR* tszParamBBCodes[][2] = {
+ static const TCHAR *tszParamBBCodes[][2] = {
{ _T("[url="), _T("[/url]") },
{ _T("[img="), _T("[/img]") },
{ _T("[size="), _T("[/size]") },
diff --git a/protocols/VKontakte/src/stdafx.h b/protocols/VKontakte/src/stdafx.h index a0bf3c178d..a5e441027e 100644 --- a/protocols/VKontakte/src/stdafx.h +++ b/protocols/VKontakte/src/stdafx.h @@ -66,3 +66,4 @@ extern HINSTANCE hInst; #include "vk_struct.h"
#include "vk_proto.h"
#include "vk_dialogs.h"
+#include "vk_options.h"
diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h index 022a5fbe57..90d20a508a 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 1
-#define __BUILD_NUM 26
+#define __BUILD_NUM 27
#include <stdver.h>
diff --git a/protocols/VKontakte/src/vk.h b/protocols/VKontakte/src/vk.h index 59caa0dbf3..b3d7e3072d 100644 --- a/protocols/VKontakte/src/vk.h +++ b/protocols/VKontakte/src/vk.h @@ -97,7 +97,7 @@ extern mir_cs csInstances; extern HINSTANCE hInst;
LPCSTR findHeader(NETLIBHTTPREQUEST *hdr, LPCSTR szField);
-bool tlstrstr(TCHAR* _s1, TCHAR* _s2);
+bool tlstrstr(TCHAR *_s1, TCHAR *_s2);
void InitIcons(void);
HANDLE GetIconHandle(int iCommand);
diff --git a/protocols/VKontakte/src/vk_avatars.cpp b/protocols/VKontakte/src/vk_avatars.cpp index e1d378bd0e..be383afcc9 100644 --- a/protocols/VKontakte/src/vk_avatars.cpp +++ b/protocols/VKontakte/src/vk_avatars.cpp @@ -17,13 +17,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-void CVkProto::OnReceiveAvatar(NETLIBHTTPREQUEST *reply, AsyncHttpRequest* pReq)
+void CVkProto::OnReceiveAvatar(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq)
{
if (reply->resultCode != 200 || !pReq->pUserInfo)
return;
PROTO_AVATAR_INFORMATION ai = { 0 };
- CVkSendMsgParam * param = (CVkSendMsgParam *)pReq->pUserInfo;
+ CVkSendMsgParam *param = (CVkSendMsgParam *)pReq->pUserInfo;
GetAvatarFileName(param->hContact, ai.filename, _countof(ai.filename));
ai.format = ProtoGetBufferFormat(reply->pData);
@@ -79,7 +79,7 @@ void CVkProto::ReloadAvatarInfo(MCONTACT hContact) INT_PTR CVkProto::SvcGetAvatarInfo(WPARAM, LPARAM lParam)
{
- PROTO_AVATAR_INFORMATION* pai = (PROTO_AVATAR_INFORMATION*)lParam;
+ PROTO_AVATAR_INFORMATION *pai = (PROTO_AVATAR_INFORMATION *)lParam;
ptrA szUrl(getStringA(pai->hContact, "AvatarUrl"));
if (szUrl == NULL)
@@ -119,7 +119,7 @@ INT_PTR CVkProto::SvcGetMyAvatar(WPARAM wParam, LPARAM lParam) if (SvcGetAvatarInfo(0, (LPARAM)&ai) != GAIR_SUCCESS)
return 1;
- TCHAR* buf = (TCHAR*)wParam;
+ TCHAR *buf = (TCHAR*)wParam;
int size = (int)lParam;
_tcsncpy(buf, ai.filename, size);
@@ -128,7 +128,7 @@ INT_PTR CVkProto::SvcGetMyAvatar(WPARAM wParam, LPARAM lParam) return 0;
}
-void CVkProto::GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t cbLen)
+void CVkProto::GetAvatarFileName(MCONTACT hContact, TCHAR *pszDest, size_t cbLen)
{
int tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s\\%S"), VARST(_T("%miranda_avatarcache%")), m_szModuleName);
@@ -138,7 +138,7 @@ void CVkProto::GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t cbLen pszDest[tPathLen++] = '\\';
- const TCHAR* szFileType = _T(".jpg");
+ const TCHAR *szFileType = _T(".jpg");
ptrT szUrl(getTStringA(hContact, "AvatarUrl"));
if (szUrl) {
TCHAR *p = _tcsrchr(szUrl, '.');
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index f0440809d5..2957f8272c 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -91,7 +91,7 @@ CVkChatInfo* CVkProto::AppendChat(int id, const JSONNode &jnDlg) }
gcd.iType = GC_EVENT_CONTROL;
gce.ptszStatus = 0;
- CallServiceSync(MS_GC_EVENT, (m_bHideChats) ? WINDOW_HIDDEN : SESSION_INITDONE, (LPARAM)&gce);
+ CallServiceSync(MS_GC_EVENT, (m_vkOptions.bHideChats) ? WINDOW_HIDDEN : SESSION_INITDONE, (LPARAM)&gce);
CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce);
RetrieveChatInfo(c);
@@ -465,7 +465,7 @@ void CVkProto::SetChatStatus(MCONTACT hContact, int iStatus) /////////////////////////////////////////////////////////////////////////////////////////
-TCHAR* UnEscapeChatTags(TCHAR* str_in)
+TCHAR* UnEscapeChatTags(TCHAR *str_in)
{
TCHAR *s = str_in, *d = str_in;
while (*s) {
@@ -624,7 +624,7 @@ INT_PTR __cdecl CVkProto::OnJoinChat(WPARAM hContact, LPARAM) AsyncHttpRequest *pReq = new AsyncHttpRequest(this, REQUEST_POST, "/method/messages.send.json", true, &CVkProto::OnSendChatMsg, AsyncHttpRequest::rpHigh)
<< INT_PARAM("chat_id", chat_id)
- << TCHAR_PARAM("message", m_ReturnChatMessage);
+ << TCHAR_PARAM("message", m_vkOptions.ptszReturnChatMessage);
pReq->AddHeader("Content-Type", "application/x-www-form-urlencoded");
Push(pReq);
db_unset(hContact, m_szModuleName, "off");
@@ -754,7 +754,7 @@ void CVkProto::OnChatDestroy(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) void CVkProto::NickMenuHook(CVkChatInfo *cc, GCHOOK *gch)
{
- CVkChatUser* cu = cc->GetUserById(gch->ptszUID);
+ CVkChatUser *cu = cc->GetUserById(gch->ptszUID);
MCONTACT hContact;
if (cu == NULL)
return;
@@ -814,7 +814,7 @@ static gc_item sttListItems[] = int CVkProto::OnGcMenuHook(WPARAM, LPARAM lParam)
{
- GCMENUITEMS* gcmi = (GCMENUITEMS*)lParam;
+ GCMENUITEMS *gcmi = (GCMENUITEMS*)lParam;
if (gcmi == NULL)
return 0;
@@ -834,7 +834,7 @@ int CVkProto::OnGcMenuHook(WPARAM, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
-void CVkProto::ChatContactTypingThread(void * p)
+void CVkProto::ChatContactTypingThread(void *p)
{
CVKChatContactTypingParam *param = (CVKChatContactTypingParam *)p;
if (!p)
@@ -855,7 +855,7 @@ void CVkProto::ChatContactTypingThread(void * p) delete param;
return;
}
- CVkChatUser* cu = cc->GetUserById(iUserId);
+ CVkChatUser *cu = cc->GetUserById(iUserId);
if (cu == NULL) {
delete param;
return;
@@ -890,7 +890,7 @@ void CVkProto::StopChatContactTyping(int iChatId, int iUserId) if (cc == NULL)
return;
- CVkChatUser* cu = cc->GetUserById(iUserId);
+ CVkChatUser *cu = cc->GetUserById(iUserId);
if (cu == NULL)
return;
diff --git a/protocols/VKontakte/src/vk_dialogs.cpp b/protocols/VKontakte/src/vk_dialogs.cpp index 17a42b9cd4..fb637faa54 100644 --- a/protocols/VKontakte/src/vk_dialogs.cpp +++ b/protocols/VKontakte/src/vk_dialogs.cpp @@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. ////////////////////////////////// IDD_CAPTCHAFORM ////////////////////////////////////////
-CVkCaptchaForm::CVkCaptchaForm(CVkProto *proto, CAPTCHA_FORM_PARAMS* param) :
+CVkCaptchaForm::CVkCaptchaForm(CVkProto *proto, CAPTCHA_FORM_PARAMS *param) :
CVkDlgBase(proto, IDD_CAPTCHAFORM, false),
m_instruction(this, IDC_INSTRUCTION),
m_edtValue(this, IDC_VALUE),
@@ -105,7 +105,7 @@ void CVkCaptchaForm::On_edtValue_Change(CCtrlEdit*) ////////////////////////////////// IDD_WALLPOST ///////////////////////////////////////////
-CVkWallPostForm::CVkWallPostForm(CVkProto* proto, WALLPOST_FORM_PARAMS* param) :
+CVkWallPostForm::CVkWallPostForm(CVkProto *proto, WALLPOST_FORM_PARAMS *param) :
CVkDlgBase(proto, IDD_WALLPOST, false),
m_edtMsg(this, IDC_ED_MSG),
m_edtUrl(this, IDC_ED_URL),
@@ -151,7 +151,7 @@ void CVkWallPostForm::On_edtValue_Change(CCtrlEdit*) ////////////////////////////////// IDD_INVITE /////////////////////////////////////////////
-CVkInviteChatForm::CVkInviteChatForm(CVkProto* proto) :
+CVkInviteChatForm::CVkInviteChatForm(CVkProto *proto) :
CVkDlgBase(proto, IDD_INVITE, false),
m_btnOk(this, IDOK),
m_cbxCombo(this, IDC_CONTACT),
@@ -178,7 +178,7 @@ void CVkInviteChatForm::btnOk_OnOk(CCtrlButton*) ////////////////////////////////// IDD_GC_CREATE //////////////////////////////////////////
-CVkGCCreateForm::CVkGCCreateForm(CVkProto* proto) :
+CVkGCCreateForm::CVkGCCreateForm(CVkProto *proto) :
CVkDlgBase(proto, IDD_GC_CREATE, false),
m_btnOk(this, IDOK),
m_clCList(this, IDC_CLIST),
@@ -222,7 +222,7 @@ void CVkGCCreateForm::btnOk_OnOk(CCtrlButton*) EndDialog(m_hwnd, bRes);
}
-void CVkGCCreateForm::FilterList(CCtrlClc* clCList)
+void CVkGCCreateForm::FilterList(CCtrlClc *clCList)
{
if (!clCList)
return;
@@ -235,7 +235,7 @@ void CVkGCCreateForm::FilterList(CCtrlClc* clCList) }
}
-void CVkGCCreateForm::ResetListOptions(CCtrlClc* clCList)
+void CVkGCCreateForm::ResetListOptions(CCtrlClc *clCList)
{
if (!clCList)
return;
diff --git a/protocols/VKontakte/src/vk_dialogs.h b/protocols/VKontakte/src/vk_dialogs.h index 3de38eaa7b..45272b285c 100644 --- a/protocols/VKontakte/src/vk_dialogs.h +++ b/protocols/VKontakte/src/vk_dialogs.h @@ -35,10 +35,10 @@ class CVkCaptchaForm : public CVkDlgBase CCtrlEdit m_edtValue;
CCtrlButton m_btnOpenInBrowser;
CCtrlButton m_btnOk;
- CAPTCHA_FORM_PARAMS* m_param;
+ CAPTCHA_FORM_PARAMS *m_param;
public:
- CVkCaptchaForm(CVkProto* proto, CAPTCHA_FORM_PARAMS* param);
+ CVkCaptchaForm(CVkProto *proto, CAPTCHA_FORM_PARAMS *param);
void OnInitDialog();
INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam);
void OnDestroy();
@@ -52,12 +52,12 @@ public: struct WALLPOST_FORM_PARAMS
{
- TCHAR* ptszMsg;
- TCHAR* ptszUrl;
- TCHAR* ptszNick;
+ TCHAR *ptszMsg;
+ TCHAR *ptszUrl;
+ TCHAR *ptszNick;
bool bFriendsOnly;
- WALLPOST_FORM_PARAMS(TCHAR* nick) :
+ WALLPOST_FORM_PARAMS(TCHAR *nick) :
ptszNick(nick),
bFriendsOnly(false)
{
@@ -79,10 +79,10 @@ class CVkWallPostForm : public CVkDlgBase CCtrlCheck m_cbOnlyForFriends;
CCtrlButton m_btnShare;
- WALLPOST_FORM_PARAMS* m_param;
+ WALLPOST_FORM_PARAMS *m_param;
public:
- CVkWallPostForm(CVkProto* proto, WALLPOST_FORM_PARAMS* param);
+ CVkWallPostForm(CVkProto *proto, WALLPOST_FORM_PARAMS *param);
void OnInitDialog();
void OnDestroy();
void On_btnShare_Click(CCtrlButton*);
@@ -99,7 +99,7 @@ class CVkInviteChatForm : public CVkDlgBase public:
MCONTACT m_hContact;
- CVkInviteChatForm(CVkProto* proto);
+ CVkInviteChatForm(CVkProto *proto);
void OnInitDialog();
void btnOk_OnOk(CCtrlButton*);
};
@@ -113,7 +113,7 @@ class CVkGCCreateForm : public CVkDlgBase CCtrlEdit m_edtTitle;
public:
- CVkGCCreateForm(CVkProto* proto);
+ CVkGCCreateForm(CVkProto *proto);
void OnInitDialog();
void btnOk_OnOk(CCtrlButton*);
void FilterList(CCtrlClc*);
diff --git a/protocols/VKontakte/src/vk_feed.cpp b/protocols/VKontakte/src/vk_feed.cpp index 629c26eca9..4aac6e56ac 100644 --- a/protocols/VKontakte/src/vk_feed.cpp +++ b/protocols/VKontakte/src/vk_feed.cpp @@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. void CVkProto::AddFeedSpecialUser()
{
- bool bSpecialContact = m_bNewsEnabled || m_bNotificationsEnabled || m_bSpecialContactAlwaysEnabled;
+ bool bSpecialContact = m_vkOptions.bNewsEnabled || m_vkOptions.bNotificationsEnabled || m_vkOptions.bSpecialContactAlwaysEnabled;
MCONTACT hContact = FindUser(VK_FEED_USER);
if (!bSpecialContact) {
@@ -61,7 +61,7 @@ void CVkProto::AddFeedEvent(CVKNewsItem& vkNewsItem) recv.pCustomData = NULL;
recv.cbCustomDataSize = 0;
- if (m_bUseNonStandardNotifications) {
+ if (m_vkOptions.bUseNonStandardNotifications) {
recv.flags = PREF_CREATEREAD;
MsgPopup(hContact, vkNewsItem.tszPopupText, vkNewsItem.tszPopupTitle);
}
@@ -73,7 +73,7 @@ void CVkProto::AddCListEvent(bool bNews) {
SkinPlaySound("VKNewsFeed");
- if (!m_bUseNonStandardNotifications)
+ if (!m_vkOptions.bUseNonStandardNotifications)
return;
MCONTACT hContact = FindUser(VK_FEED_USER, true);
@@ -99,7 +99,7 @@ CVkUserInfo* CVkProto::GetVkUserInfo(LONG iUserId, OBJLIST<CVkUserInfo> &vkUsers return NULL;
bool bIsGroup = (iUserId < 0);
- CVkUserInfo * vkUser = vkUsers.find((CVkUserInfo *)&iUserId);
+ CVkUserInfo *vkUser = vkUsers.find((CVkUserInfo *)&iUserId);
if (vkUser == NULL) {
CMString tszNick = TranslateT("Unknown");
@@ -138,7 +138,7 @@ void CVkProto::CreateVkUserInfoList(OBJLIST<CVkUserInfo> &vkUsers, const JSONNod if (tszScreenName.IsEmpty())
tszScreenName.AppendFormat(_T("id%d"), UserId);
tszLink += tszScreenName;
- CVkUserInfo * vkUser = new CVkUserInfo(UserId, false, tszNick, tszLink, FindUser(UserId));
+ CVkUserInfo *vkUser = new CVkUserInfo(UserId, false, tszNick, tszLink, FindUser(UserId));
vkUsers.insert(vkUser);
}
@@ -153,7 +153,7 @@ void CVkProto::CreateVkUserInfoList(OBJLIST<CVkUserInfo> &vkUsers, const JSONNod CMString tszNick(jnProfile["name"].as_mstring());
CMString tszLink = _T("https://vk.com/");
tszLink += jnProfile["screen_name"].as_mstring();
- CVkUserInfo * vkUser = new CVkUserInfo(UserId, true, tszNick, tszLink);
+ CVkUserInfo *vkUser = new CVkUserInfo(UserId, true, tszNick, tszLink);
vkUsers.insert(vkUser);
}
}
@@ -191,7 +191,7 @@ CVKNewsItem* CVkProto::GetVkNewsItem(const JSONNode &jnItem, OBJLIST<CVkUserInfo tszText = TranslateT("User was tagged in these photos:");
tszPopupText = tszText + TranslateT("(photos)");
for (auto it = jnPhotoItems.begin(); it != jnPhotoItems.end(); ++it)
- tszText += _T("\n") + GetVkPhotoItem((*it), m_iBBCForNews);
+ tszText += _T("\n") + GetVkPhotoItem((*it), m_vkOptions.BBCForNews());
}
}
}
@@ -205,7 +205,7 @@ CVKNewsItem* CVkProto::GetVkNewsItem(const JSONNode &jnItem, OBJLIST<CVkUserInfo tszPopupText += TranslateT("(photos)");
for (auto it = jnPhotoItems.begin(); it != jnPhotoItems.end(); ++it) {
const JSONNode &jnPhotoItem = (*it);
- tszText += GetVkPhotoItem(jnPhotoItem, m_iBBCForNews) + _T("\n");
+ tszText += GetVkPhotoItem(jnPhotoItem, m_vkOptions.BBCForNews()) + _T("\n");
if (i == 0 && vkNewsItem->tszType == _T("wall_photo")) {
if (jnPhotoItem["post_id"]) {
bPostLink = true;
@@ -242,7 +242,7 @@ CVKNewsItem* CVkProto::GetVkNewsItem(const JSONNode &jnItem, OBJLIST<CVkUserInfo if (!tszPopupText.IsEmpty())
tszPopupText.AppendChar(_T('\n'));
tszPopupText += TranslateT("(attachments)");
- tszText += GetAttachmentDescr(jnAttachments, m_bUseBBCOnAttacmentsAsNews ? m_iBBCForNews : m_iBBCForAttachments);
+ tszText += GetAttachmentDescr(jnAttachments, m_vkOptions.bUseBBCOnAttacmentsAsNews ? m_vkOptions.BBCForNews() : m_vkOptions.BBCForAttachments());
}
}
@@ -259,7 +259,7 @@ CVKNewsItem* CVkProto::GetVkNewsItem(const JSONNode &jnItem, OBJLIST<CVkUserInfo }
vkNewsItem->tszText.AppendFormat(tszResFormat,
- SetBBCString(vkNewsItem->vkUser->m_tszUserNick, m_iBBCForNews, vkbbcUrl,
+ SetBBCString(vkNewsItem->vkUser->m_tszUserNick, m_vkOptions.BBCForNews(), vkbbcUrl,
vkNewsItem->vkUser->m_tszLink), tszText);
vkNewsItem->tszPopupTitle.AppendFormat(tszTitleFormat, vkNewsItem->vkUser->m_tszUserNick);
vkNewsItem->tszPopupText = tszPopupText;
@@ -268,7 +268,7 @@ CVKNewsItem* CVkProto::GetVkNewsItem(const JSONNode &jnItem, OBJLIST<CVkUserInfo if (bPostLink) {
vkNewsItem->tszLink = CMString(_T("https://vk.com/wall")) + vkNewsItem->tszId;
vkNewsItem->tszText.AppendChar(_T('\n'));
- vkNewsItem->tszText += SetBBCString(TranslateT("Link"), m_iBBCForNews, vkbbcUrl, vkNewsItem->tszLink);
+ vkNewsItem->tszText += SetBBCString(TranslateT("Link"), m_vkOptions.BBCForNews(), vkbbcUrl, vkNewsItem->tszLink);
}
debugLog(_T("CVkProto::GetVkNewsItem %d %d <\n%s\n>"), iSourceId, iPostId, vkNewsItem->tszText);
@@ -308,7 +308,7 @@ CMString CVkProto::GetVkFeedback(const JSONNode &jnFeedback, VKObjType vkFeedbac vkUser = GetVkUserInfo(iUserId, vkUsers);
if (!tszUsers.IsEmpty())
tszUsers += _T(", ");
- tszUsers += SetBBCString(vkUser->m_tszUserNick, m_iBBCForNews, vkbbcUrl, vkUser->m_tszLink);
+ tszUsers += SetBBCString(vkUser->m_tszUserNick, m_vkOptions.BBCForNews(), vkbbcUrl, vkUser->m_tszLink);
}
tszRes.AppendFormat(_T("%s %%s %%s"), tszUsers);
vkUser = NULL;
@@ -319,7 +319,7 @@ CMString CVkProto::GetVkFeedback(const JSONNode &jnFeedback, VKObjType vkFeedbac vkUser = GetVkUserInfo(iUserId, vkUsers);
CMString tszText(jnFeedback["text"].as_mstring());
tszText.Replace(_T("%"), _T("%%"));
- tszRes.AppendFormat(tszFormat, SetBBCString(vkUser->m_tszUserNick, m_iBBCForNews, vkbbcUrl, vkUser->m_tszLink), ClearFormatNick(tszText));
+ tszRes.AppendFormat(tszFormat, SetBBCString(vkUser->m_tszUserNick, m_vkOptions.BBCForNews(), vkbbcUrl, vkUser->m_tszLink), ClearFormatNick(tszText));
}
return tszRes;
@@ -332,10 +332,10 @@ CVKNewsItem* CVkProto::GetVkParent(const JSONNode &jnParent, VKObjType vkParentT if (!jnParent || !vkParentType)
return NULL;
- CVKNewsItem * vkNotificationItem = new CVKNewsItem();
+ CVKNewsItem *vkNotificationItem = new CVKNewsItem();
if (vkParentType == vkPhoto) {
- CMString tszPhoto = GetVkPhotoItem(jnParent, m_iBBCForNews);
+ CMString tszPhoto = GetVkPhotoItem(jnParent, m_vkOptions.BBCForNews());
LONG iOwnerId = jnParent["owner_id"].as_int();
LONG iId = jnParent["id"].as_int();
vkNotificationItem->tszId.AppendFormat(_T("%d_%d"), iOwnerId, iId);
@@ -343,11 +343,11 @@ CVKNewsItem* CVkProto::GetVkParent(const JSONNode &jnParent, VKObjType vkParentT vkNotificationItem->tszText.AppendFormat(_T("\n%s"), tszPhoto);
if (ptszReplyText) {
- vkNotificationItem->tszText.AppendFormat(_T("\n>> %s"), SetBBCString(ptszReplyText, m_iBBCForNews, vkbbcI));
+ vkNotificationItem->tszText.AppendFormat(_T("\n>> %s"), SetBBCString(ptszReplyText, m_vkOptions.BBCForNews(), vkbbcI));
vkNotificationItem->tszPopupText.AppendFormat(_T(">> %s"), ptszReplyText);
}
- vkNotificationItem->tszText.AppendFormat(_T("\n%s"), SetBBCString(TranslateT("Link"), m_iBBCForNews, vkbbcUrl, vkNotificationItem->tszLink));
+ vkNotificationItem->tszText.AppendFormat(_T("\n%s"), SetBBCString(TranslateT("Link"), m_vkOptions.BBCForNews(), vkbbcUrl, vkNotificationItem->tszLink));
}
else if (vkParentType == vkVideo) {
LONG iOwnerId = jnParent["owner_id"].as_int();
@@ -360,14 +360,14 @@ CVKNewsItem* CVkProto::GetVkParent(const JSONNode &jnParent, VKObjType vkParentT ClearFormatNick(tszText);
if (!tszText.IsEmpty())
- vkNotificationItem->tszText.AppendFormat(_T("\n%s: %s"), SetBBCString(TranslateT("Video description:"), m_iBBCForNews, vkbbcB), SetBBCString(tszText, m_iBBCForNews, vkbbcI));
+ vkNotificationItem->tszText.AppendFormat(_T("\n%s: %s"), SetBBCString(TranslateT("Video description:"), m_vkOptions.BBCForNews(), vkbbcB), SetBBCString(tszText, m_vkOptions.BBCForNews(), vkbbcI));
if (ptszReplyText) {
- vkNotificationItem->tszText.AppendFormat(_T("\n>> %s"), SetBBCString(ptszReplyText, m_iBBCForNews, vkbbcI));
+ vkNotificationItem->tszText.AppendFormat(_T("\n>> %s"), SetBBCString(ptszReplyText, m_vkOptions.BBCForNews(), vkbbcI));
vkNotificationItem->tszPopupText.AppendFormat(_T(">> %s"), ptszReplyText);
}
- vkNotificationItem->tszText.AppendFormat(_T("\n%s"), SetBBCString(tszTitle, m_iBBCForNews, vkbbcUrl, vkNotificationItem->tszLink));
+ vkNotificationItem->tszText.AppendFormat(_T("\n%s"), SetBBCString(tszTitle, m_vkOptions.BBCForNews(), vkbbcUrl, vkNotificationItem->tszLink));
}
else if (vkParentType == vkPost) {
LONG iToId = jnParent["to_id"].as_int();
@@ -379,18 +379,18 @@ CVKNewsItem* CVkProto::GetVkParent(const JSONNode &jnParent, VKObjType vkParentT ClearFormatNick(tszText);
if (!tszText.IsEmpty()) {
- vkNotificationItem->tszText.AppendFormat(_T("\n%s: %s"), SetBBCString(TranslateT("Post text:"), m_iBBCForNews, vkbbcB), SetBBCString(tszText, m_iBBCForNews, vkbbcI));
+ vkNotificationItem->tszText.AppendFormat(_T("\n%s: %s"), SetBBCString(TranslateT("Post text:"), m_vkOptions.BBCForNews(), vkbbcB), SetBBCString(tszText, m_vkOptions.BBCForNews(), vkbbcI));
vkNotificationItem->tszPopupText.AppendFormat(_T("%s: %s"), TranslateT("Post text:"), tszText);
}
if (ptszReplyText) {
- vkNotificationItem->tszText.AppendFormat(_T("\n>> %s"), SetBBCString(ptszReplyText, m_iBBCForNews, vkbbcI));
+ vkNotificationItem->tszText.AppendFormat(_T("\n>> %s"), SetBBCString(ptszReplyText, m_vkOptions.BBCForNews(), vkbbcI));
if (!vkNotificationItem->tszPopupText.IsEmpty())
vkNotificationItem->tszPopupText += _T("\n");
vkNotificationItem->tszPopupText.AppendFormat(_T(">> %s"), ptszReplyText);
}
- vkNotificationItem->tszText.AppendFormat(_T("\n%s"), SetBBCString(TranslateT("Link"), m_iBBCForNews, vkbbcUrl, vkNotificationItem->tszLink));
+ vkNotificationItem->tszText.AppendFormat(_T("\n%s"), SetBBCString(TranslateT("Link"), m_vkOptions.BBCForNews(), vkbbcUrl, vkNotificationItem->tszLink));
}
else if (vkParentType == vkTopic) {
LONG iOwnerId = jnParent["owner_id"].as_int();
@@ -404,18 +404,18 @@ CVKNewsItem* CVkProto::GetVkParent(const JSONNode &jnParent, VKObjType vkParentT ClearFormatNick(tszText);
if (!tszText.IsEmpty()) {
- vkNotificationItem->tszText.AppendFormat(_T("\n%s %s"), SetBBCString(TranslateT("Topic text:"), m_iBBCForNews, vkbbcB), SetBBCString(tszText, m_iBBCForNews, vkbbcI));
+ vkNotificationItem->tszText.AppendFormat(_T("\n%s %s"), SetBBCString(TranslateT("Topic text:"), m_vkOptions.BBCForNews(), vkbbcB), SetBBCString(tszText, m_vkOptions.BBCForNews(), vkbbcI));
vkNotificationItem->tszPopupText.AppendFormat(_T("%s %s"), TranslateT("Topic text:"), tszText);
}
if (ptszReplyText) {
- vkNotificationItem->tszText.AppendFormat(_T("\n>> %s"), SetBBCString(ptszReplyText, m_iBBCForNews, vkbbcI));
+ vkNotificationItem->tszText.AppendFormat(_T("\n>> %s"), SetBBCString(ptszReplyText, m_vkOptions.BBCForNews(), vkbbcI));
if (!vkNotificationItem->tszPopupText.IsEmpty())
vkNotificationItem->tszPopupText += _T("\n");
vkNotificationItem->tszPopupText.AppendFormat(_T(">> %s"), ptszReplyText);
}
- vkNotificationItem->tszText.AppendFormat(_T("\n%s"), SetBBCString(tszTitle, m_iBBCForNews, vkbbcUrl, vkNotificationItem->tszLink));
+ vkNotificationItem->tszText.AppendFormat(_T("\n%s"), SetBBCString(tszTitle, m_vkOptions.BBCForNews(), vkbbcUrl, vkNotificationItem->tszLink));
}
else if (vkParentType == vkComment) {
CMString tszText(jnParent["text"].as_mstring());
@@ -471,7 +471,7 @@ CVKNewsItem* CVkProto::GetVkNotificationsItem(const JSONNode &jnItem, OBJLIST<CV CVkUserInfo *vkUser = NULL;
CMString tszFeedback = GetVkFeedback(jnFeedback, vkFeedbackType, vkUsers, vkUser);
- CVKNewsItem* vkNotification = GetVkParent(jnParent, vkParentType);
+ CVKNewsItem *vkNotification = GetVkParent(jnParent, vkParentType);
if (!vkNotification)
return NULL;
@@ -535,9 +535,9 @@ CVKNewsItem* CVkProto::GetVkGroupInvates(const JSONNode &jnItem, OBJLIST<CVkUser CMString tszGroupName;
CMString tszGName = jnItem["name"].as_mstring();
CMString tszGLink(FORMAT, _T("https://vk.com/%s"), jnItem["screen_name"].as_mstring());
- tszGroupName = SetBBCString(tszGName, m_iBBCForNews, vkbbcUrl, tszGLink);
+ tszGroupName = SetBBCString(tszGName, m_vkOptions.BBCForNews(), vkbbcUrl, tszGLink);
- CMString tszUsers = SetBBCString(iUserId ? vkNotification->vkUser->m_tszUserNick : TranslateT("Unknown"), m_iBBCForNews, vkbbcUrl, iUserId ? vkNotification->vkUser->m_tszLink : _T("https://vk.com/"));
+ CMString tszUsers = SetBBCString(iUserId ? vkNotification->vkUser->m_tszUserNick : TranslateT("Unknown"), m_vkOptions.BBCForNews(), vkbbcUrl, iUserId ? vkNotification->vkUser->m_tszLink : _T("https://vk.com/"));
vkNotification->tszText.AppendFormat(_T("%s %s %s"), tszUsers, tszNotificationTranslate, tszGroupName);
vkNotification->tszPopupTitle.AppendFormat(_T("%s %s %s"), iUserId ? vkNotification->vkUser->m_tszUserNick : TranslateT("Unknown"), tszNotificationTranslate, tszGName);
@@ -561,16 +561,16 @@ void CVkProto::RetrieveUnreadNews(time_t tLastNewsTime) return;
CMStringA szFilter;
- szFilter = m_bNewsFilterPosts ? "post" : "";
+ szFilter = m_vkOptions.bNewsFilterPosts ? "post" : "";
szFilter += szFilter.IsEmpty() ? "" : ",";
- szFilter += m_bNewsFilterPhotos ? "photo" : "";
+ szFilter += m_vkOptions.bNewsFilterPhotos ? "photo" : "";
szFilter += szFilter.IsEmpty() ? "" : ",";
- szFilter += m_bNewsFilterTags ? "photo_tag" : "";
+ szFilter += m_vkOptions.bNewsFilterTags ? "photo_tag" : "";
szFilter += szFilter.IsEmpty() ? "" : ",";
- szFilter += m_bNewsFilterWallPhotos ? "wall_photo" : "";
+ szFilter += m_vkOptions.bNewsFilterWallPhotos ? "wall_photo" : "";
if (szFilter.IsEmpty()) {
debugLogA("CVkProto::RetrieveUnreadNews szFilter empty");
@@ -578,16 +578,16 @@ void CVkProto::RetrieveUnreadNews(time_t tLastNewsTime) }
CMStringA szSource;
- szSource = m_bNewsSourceFriends ? "friends" : "";
+ szSource = m_vkOptions.bNewsSourceFriends ? "friends" : "";
szSource += szSource.IsEmpty() ? "" : ",";
- szSource += m_bNewsSourceGroups ? "groups" : "";
+ szSource += m_vkOptions.bNewsSourceGroups ? "groups" : "";
szSource += szSource.IsEmpty() ? "" : ",";
- szSource += m_bNewsSourcePages ? "pages" : "";
+ szSource += m_vkOptions.bNewsSourcePages ? "pages" : "";
szSource += szSource.IsEmpty() ? "" : ",";
- szSource += m_bNewsSourceFollowing ? "following" : "";
+ szSource += m_vkOptions.bNewsSourceFollowing ? "following" : "";
if (szSource.IsEmpty()) {
debugLogA("CVkProto::RetrieveUnreadNews szSource empty");
@@ -596,8 +596,8 @@ void CVkProto::RetrieveUnreadNews(time_t tLastNewsTime) Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/newsfeed.get.json", true, &CVkProto::OnReceiveUnreadNews)
<< INT_PARAM("count", 100)
- << INT_PARAM("return_banned", m_bNewsSourceIncludeBanned ? 1 : 0)
- << INT_PARAM("max_photos", m_iMaxLoadNewsPhoto)
+ << INT_PARAM("return_banned", m_vkOptions.bNewsSourceIncludeBanned ? 1 : 0)
+ << INT_PARAM("max_photos", m_vkOptions.iMaxLoadNewsPhoto)
<< INT_PARAM("start_time", tLastNewsTime + 1)
<< CHAR_PARAM("filters", szFilter)
<< CHAR_PARAM("source_ids", szSource));
@@ -659,7 +659,7 @@ void CVkProto::OnReceiveUnreadNews(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *p bool bNewsAdded = false;
for (int i = 0; i < vkNews.getCount(); i++)
- if (!(m_bNewsSourceNoReposts && vkNews[i].bIsRepost)) {
+ if (!(m_vkOptions.bNewsSourceNoReposts && vkNews[i].bIsRepost)) {
AddFeedEvent(vkNews[i]);
bNewsAdded = true;
}
@@ -687,7 +687,7 @@ void CVkProto::RetrieveUnreadNotifications(time_t tLastNotificationsTime) CMString code(FORMAT, _T("return{\"notifications\":API.notifications.get({\"count\": 100, \"start_time\":%d})%s"),
(LONG)(tLastNotificationsTime + 1),
- m_bNotificationFilterInvites ? _T(",\"groupinvates\":API.groups.getInvites({\"extended\":1})};") : _T("};"));
+ m_vkOptions.bNotificationFilterInvites ? _T(",\"groupinvates\":API.groups.getInvites({\"extended\":1})};") : _T("};"));
Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/execute.json", true, &CVkProto::OnReceiveUnreadNotifications)
<< TCHAR_PARAM("code", code) );
@@ -705,13 +705,13 @@ bool CVkProto::FilterNotification(CVKNewsItem* vkNotificationItem, bool& isComme || vkNotificationItem->tszType == _T("mention_comment_photo")
|| vkNotificationItem->tszType == _T("mention_comment_video")) {
isCommented = true;
- return m_bNotificationFilterMentions;
+ return (m_vkOptions.bNotificationFilterMentions != 0);
}
- bool result = (vkNotificationItem->vkFeedbackType == vkUsers && m_bNotificationFilterLikes);
- result = (vkNotificationItem->vkFeedbackType == vkCopy && m_bNotificationFilterReposts) || result;
- result = (vkNotificationItem->vkFeedbackType == vkComment && m_bNotificationFilterComments) || result;
- result = (vkNotificationItem->vkParentType == vkInvite && m_bNotificationFilterInvites) || result;
+ bool result = (vkNotificationItem->vkFeedbackType == vkUsers && m_vkOptions.bNotificationFilterLikes);
+ result = (vkNotificationItem->vkFeedbackType == vkCopy && m_vkOptions.bNotificationFilterReposts) || result;
+ result = (vkNotificationItem->vkFeedbackType == vkComment && m_vkOptions.bNotificationFilterComments) || result;
+ result = (vkNotificationItem->vkParentType == vkInvite && m_vkOptions.bNotificationFilterInvites) || result;
isCommented = (vkNotificationItem->vkFeedbackType == vkComment);
@@ -792,7 +792,7 @@ void CVkProto::OnReceiveUnreadNotifications(NETLIBHTTPREQUEST *reply, AsyncHttpR AddCListEvent(false);
setDword("LastNotificationsTime", time(NULL));
- if (m_bNotificationsMarkAsViewed && bNotificationCommentAdded)
+ if (m_vkOptions.bNotificationsMarkAsViewed && bNotificationCommentAdded)
NotificationMarkAsViewed();
vkNotification.destroy();
@@ -802,15 +802,15 @@ void CVkProto::OnReceiveUnreadNotifications(NETLIBHTTPREQUEST *reply, AsyncHttpR void CVkProto::RetrieveUnreadEvents()
{
debugLogA("CVkProto::RetrieveUnreadEvents");
- if (!IsOnline() || (!m_bNotificationsEnabled && !m_bNewsEnabled))
+ if (!IsOnline() || (!m_vkOptions.bNotificationsEnabled && !m_vkOptions.bNewsEnabled))
return;
time_t tLastNotificationsTime = getDword("LastNotificationsTime", time(NULL) - 24 * 60 * 60);
- if (time(NULL) - tLastNotificationsTime - m_iNotificationsInterval * 60 >= -3 && m_bNotificationsEnabled)
+ if (time(NULL) - tLastNotificationsTime - m_vkOptions.iNotificationsInterval * 60 >= -3 && m_vkOptions.bNotificationsEnabled)
RetrieveUnreadNotifications(tLastNotificationsTime);
time_t tLastNewsTime = getDword("LastNewsTime", time(NULL) - 24 * 60 * 60);
- if (time(NULL) - tLastNewsTime - m_iNewsInterval * 60 >= -3 && m_bNewsEnabled)
+ if (time(NULL) - tLastNewsTime - m_vkOptions.iNewsInterval * 60 >= -3 && m_vkOptions.bNewsEnabled)
RetrieveUnreadNews(tLastNewsTime);
NewsClearHistory();
@@ -822,8 +822,8 @@ INT_PTR CVkProto::SvcLoadVKNews(WPARAM, LPARAM) if (!IsOnline())
return 1;
- if (!m_bNewsEnabled && !m_bNotificationsEnabled) {
- m_bSpecialContactAlwaysEnabled = true;
+ if (!m_vkOptions.bNewsEnabled && !m_vkOptions.bNotificationsEnabled) {
+ m_vkOptions.bSpecialContactAlwaysEnabled = true;
AddFeedSpecialUser();
}
@@ -837,10 +837,10 @@ void CVkProto::NewsClearHistory() {
debugLogA("CVkProto::NewsClearHistory");
MCONTACT hContact = FindUser(VK_FEED_USER);
- if (hContact == NULL || !m_bNewsAutoClearHistory)
+ if (hContact == NULL || !m_vkOptions.bNewsAutoClearHistory)
return;
- time_t tTime = time(NULL) - m_iNewsAutoClearHistoryInterval;
+ time_t tTime = time(NULL) - m_vkOptions.iNewsAutoClearHistoryInterval;
MEVENT hDBEvent = db_event_first(hContact);
while (hDBEvent) {
MEVENT hDBEventNext = db_event_next(hContact, hDBEvent);
diff --git a/protocols/VKontakte/src/vk_files.cpp b/protocols/VKontakte/src/vk_files.cpp index 655d7cc3bf..3e8d78ae2a 100644 --- a/protocols/VKontakte/src/vk_files.cpp +++ b/protocols/VKontakte/src/vk_files.cpp @@ -201,7 +201,7 @@ void CVkProto::OnReciveUploadServer(NETLIBHTTPREQUEST *reply, AsyncHttpRequest * // Body size
long dataLength = iFileLen + DataBegin.GetLength() + DataEnd.GetLength();
// Body {
- char* pData = (char *)mir_alloc(dataLength);
+ char *pData = (char *)mir_alloc(dataLength);
memcpy(pData, (void *)DataBegin.GetBuffer(), DataBegin.GetLength());
pUploadReq->pData = pData;
diff --git a/protocols/VKontakte/src/vk_history.cpp b/protocols/VKontakte/src/vk_history.cpp index 54ecb0e86b..2331176ab0 100644 --- a/protocols/VKontakte/src/vk_history.cpp +++ b/protocols/VKontakte/src/vk_history.cpp @@ -142,7 +142,7 @@ void CVkProto::GetHistoryDlg(MCONTACT hContact, int iLastMsg) {
debugLogA("CVkProto::GetHistoryDlg %d", iLastMsg);
int lastmsgid = -1;
- switch (m_iSyncHistoryMetod) {
+ switch (m_vkOptions.iSyncHistoryMetod) {
case syncAuto:
lastmsgid = getDword(hContact, "lastmsgid", -1);
if (lastmsgid == -1 || !IsOnline()) {
@@ -231,7 +231,7 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque const JSONNode &jnFwdMessages = jnMsg["fwd_messages"];
if (jnFwdMessages) {
- CMString tszFwdMessages = GetFwdMessages(jnFwdMessages, jnFUsers, m_iBBCForAttachments);
+ CMString tszFwdMessages = GetFwdMessages(jnFwdMessages, jnFUsers, m_vkOptions.BBCForAttachments());
if (!tszBody.IsEmpty())
tszFwdMessages = _T("\n") + tszFwdMessages;
tszBody += tszFwdMessages;
@@ -239,7 +239,7 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque const JSONNode &jnAttachments = jnMsg["attachments"];
if (jnAttachments) {
- CMString tszAttachmentDescr = GetAttachmentDescr(jnAttachments, m_iBBCForAttachments);
+ CMString tszAttachmentDescr = GetAttachmentDescr(jnAttachments, m_vkOptions.BBCForAttachments());
if (!tszBody.IsEmpty())
tszAttachmentDescr = _T("\n") + tszAttachmentDescr;
tszBody += tszAttachmentDescr;
diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp index 44efc6a53e..c45984ec03 100644 --- a/protocols/VKontakte/src/vk_messages.cpp +++ b/protocols/VKontakte/src/vk_messages.cpp @@ -105,7 +105,7 @@ void CVkProto::OnSendMessage(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) if (mid > getDword(param->hContact, "lastmsgid"))
setDword(param->hContact, "lastmsgid", mid);
- if (m_iMarkMessageReadOn >= markOnReply)
+ if (m_vkOptions.iMarkMessageReadOn >= MarkMsgReadOn::markOnReply)
MarkMessagesRead(param->hContact);
iResult = ACKRESULT_SUCCESS;
@@ -139,7 +139,7 @@ int CVkProto::OnDbEventRead(WPARAM, LPARAM hDbEvent) if (szProto.IsEmpty() || szProto != m_szModuleName)
return 0;
- if (m_iMarkMessageReadOn == markOnRead)
+ if (m_vkOptions.iMarkMessageReadOn == MarkMsgReadOn::markOnRead)
MarkMessagesRead(hContact);
return 0;
}
@@ -242,7 +242,7 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe const JSONNode &jnFwdMessages = jnMsg["fwd_messages"];
if (jnFwdMessages) {
- CMString tszFwdMessages = GetFwdMessages(jnFwdMessages, jnFUsers, m_iBBCForAttachments);
+ CMString tszFwdMessages = GetFwdMessages(jnFwdMessages, jnFUsers, m_vkOptions.BBCForAttachments());
if (!tszBody.IsEmpty())
tszFwdMessages = _T("\n") + tszFwdMessages;
tszBody += tszFwdMessages;
@@ -250,7 +250,7 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe const JSONNode &jnAttachments = jnMsg["attachments"];
if (jnAttachments) {
- CMString tszAttachmentDescr = GetAttachmentDescr(jnAttachments, m_iBBCForAttachments);
+ CMString tszAttachmentDescr = GetAttachmentDescr(jnAttachments, m_vkOptions.BBCForAttachments());
if (!tszBody.IsEmpty())
tszAttachmentDescr = _T("\n") + tszAttachmentDescr;
tszBody += tszAttachmentDescr;
@@ -263,7 +263,7 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe char szMid[40];
_itoa(mid, szMid, 10);
- if (m_iMarkMessageReadOn == markOnReceive || chat_id != 0) {
+ if (m_vkOptions.iMarkMessageReadOn == MarkMsgReadOn::markOnReceive || chat_id != 0) {
if (!mids.IsEmpty())
mids.AppendChar(',');
mids.Append(szMid);
@@ -285,16 +285,16 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe }
PROTORECVEVENT recv = { 0 };
- bool bUseServerReadFlag = m_bSyncReadMessageStatusFromServer ? true : !m_bMesAsUnread;
+ bool bUseServerReadFlag = m_vkOptions.bSyncReadMessageStatusFromServer ? true : !m_vkOptions.bMesAsUnread;
if (isRead && bUseServerReadFlag)
recv.flags |= PREF_CREATEREAD;
if (isOut)
recv.flags |= PREF_SENT;
- else if (m_bUserForceOnlineOnActivity)
+ else if (m_vkOptions.bUserForceOnlineOnActivity)
SetInvisible(hContact);
T2Utf pszBody(tszBody);
- recv.timestamp = m_bUseLocalTime ? time(NULL) : datetime;
+ recv.timestamp = m_vkOptions.bUseLocalTime ? time(NULL) : datetime;
recv.szMessage = pszBody;
recv.lParam = isOut;
recv.pCustomData = szMid;
@@ -366,7 +366,7 @@ void CVkProto::OnReceiveDlgs(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) if (m_chats.find((CVkChatInfo*)&chatid) == NULL)
AppendChat(chatid, jnDlg);
}
- else if (m_iSyncHistoryMetod) {
+ else if (m_vkOptions.iSyncHistoryMetod) {
int mid = jnDlg["id"].as_int();
m_bNotifyForEndLoadingHistory = false;
@@ -375,14 +375,14 @@ void CVkProto::OnReceiveDlgs(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) else
GetHistoryDlg(hContact, mid);
- if (m_iMarkMessageReadOn == markOnReceive && numUnread)
+ if (m_vkOptions.iMarkMessageReadOn == MarkMsgReadOn::markOnReceive && numUnread)
MarkMessagesRead(hContact);
}
else if (numUnread) {
m_bNotifyForEndLoadingHistory = false;
GetServerHistory(hContact, 0, numUnread, 0, 0, true);
- if (m_iMarkMessageReadOn == markOnReceive)
+ if (m_vkOptions.iMarkMessageReadOn == MarkMsgReadOn::markOnReceive)
MarkMessagesRead(hContact);
}
}
diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp index 223df9ce21..178a9e37c9 100644 --- a/protocols/VKontakte/src/vk_options.cpp +++ b/protocols/VKontakte/src/vk_options.cpp @@ -17,669 +17,61 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-
-
-//////////////////////////////////////////////////////////////////////////////
-// Account manager dialog
-
-INT_PTR CALLBACK VKAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- CVkProto *ppro = (CVkProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
-
- switch (uMsg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
-
- ppro = (CVkProto*)lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
-
- {
- ptrT ptszLogin(ppro->getTStringA("Login"));
- if (ptszLogin != NULL)
- SetDlgItemText(hwndDlg, IDC_LOGIN, ptszLogin);
-
- ptrT ptszPassw(ppro->GetUserStoredPassword());
- if (ptszPassw != NULL)
- SetDlgItemText(hwndDlg, IDC_PASSWORD, ptszPassw);
- }
- return TRUE;
-
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_URL:
- Utils_OpenUrl("http://vk.com");
- break;
-
- case IDC_LOGIN:
- case IDC_PASSWORD:
- if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus()) {
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- }
- }
- break;
-
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY:
- TCHAR str[1025];
- bool bNeedClearToken = false;
- GetDlgItemText(hwndDlg, IDC_LOGIN, str, _countof(str));
-
- CMString tszLogin(ptrT(ppro->getTStringA("Login")));
- if (tszLogin != str) {
- bNeedClearToken = true;
- ppro->setTString("Login", str);
- }
-
- GetDlgItemText(hwndDlg, IDC_PASSWORD, str, _countof(str));
- CMString tszPassw(ptrT(ppro->GetUserStoredPassword()));
-
- T2Utf szRawPasswd(str);
- if (szRawPasswd != NULL && tszPassw != str) {
- bNeedClearToken = true;
- ppro->setString("Password", szRawPasswd);
- }
-
- if (bNeedClearToken)
- ppro->ClearAccessToken();
-
- }
- break;
-
- case WM_CLOSE:
- EndDialog(hwndDlg, 0);
- break;
- }
-
- return FALSE;
-}
+////////////////////// Account manager dialog ////////////////////////////////
INT_PTR CVkProto::SvcCreateAccMgrUI(WPARAM, LPARAM lParam)
{
- return (INT_PTR)CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ACCMGRUI), (HWND)lParam, VKAccountProc, (LPARAM)this);
+ CVkAccMgrForm *dlg = new CVkAccMgrForm(this, (HWND)lParam);
+ dlg->Show();
+ return (INT_PTR)dlg->GetHwnd();
}
//////////////////////////////////////////////////////////////////////////////
-// Options
-
-INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- CVkProto *ppro = (CVkProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
-
- CVKLang vkLangCodes[] = {
- { NULL, LPGENT("Account language") },
- { _T("en"), LPGENT("English") },
- { _T("ru"), LPGENT("Russian") },
- { _T("be"), LPGENT("Belarusian") },
- { _T("ua"), LPGENT("Ukrainian") },
- { _T("es"), LPGENT("Spanish") },
- { _T("fi"), LPGENT("Finnish") },
- { _T("de"), LPGENT("German") },
- { _T("it"), LPGENT("Italian") },
- };
-
- HWND hWndCombo = GetDlgItem(hwndDlg, IDC_COMBO_LANGUAGE);
-
- switch (uMsg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
-
- ppro = (CVkProto*)lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
-
- {
- ptrT ptszLogin(ppro->getTStringA("Login"));
- if (ptszLogin != NULL)
- SetDlgItemText(hwndDlg, IDC_LOGIN, ptszLogin);
-
- ptrT ptszPassw(ppro->GetUserStoredPassword());
- if (ptszPassw != NULL)
- SetDlgItemText(hwndDlg, IDC_PASSWORD, ptszPassw);
- }
-
- SetDlgItemText(hwndDlg, IDC_GROUPNAME, ppro->getGroup());
-
- for (size_t i = 0; i < _countof(vkLangCodes); i++) {
- LRESULT iItem = SendMessage(hWndCombo, CB_ADDSTRING, 0, (LPARAM)TranslateTS(vkLangCodes[i].szDescription));
- SendMessage(hWndCombo, CB_SETITEMDATA, iItem, (LPARAM)vkLangCodes[i].szCode);
- if (!mir_tstrcmpi(vkLangCodes[i].szCode, ppro->m_VKLang))
- SendMessage(hWndCombo, CB_SETCURSEL, i, 0);
- }
-
- CheckDlgButton(hwndDlg, IDC_DELIVERY, ppro->m_bServerDelivery ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_USE_LOCAL_TIME, ppro->m_bUseLocalTime ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_AUTOCLEAN, ppro->getBool("AutoClean") ? BST_CHECKED : BST_UNCHECKED);
-
- CheckDlgButton(hwndDlg, IDC_ONREAD, (ppro->m_iMarkMessageReadOn == markOnRead) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ONRECEIVE, (ppro->m_iMarkMessageReadOn == markOnReceive) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ONREPLY, (ppro->m_iMarkMessageReadOn == markOnReply) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ONTYPING, (ppro->m_iMarkMessageReadOn == markOnTyping) ? BST_CHECKED : BST_UNCHECKED);
-
- CheckDlgButton(hwndDlg, IDC_SYNC_OFF, (ppro->m_iSyncHistoryMetod == syncOff) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SYNC_AUTO, (ppro->m_iSyncHistoryMetod == syncAuto) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SYNC_LAST1DAY, (ppro->m_iSyncHistoryMetod == sync1Days) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SYNC_LAST3DAY, (ppro->m_iSyncHistoryMetod == sync3Days) ? BST_CHECKED : BST_UNCHECKED);
-
- return TRUE;
-
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_URL:
- Utils_OpenUrl("http://vk.com");
- break;
-
- case IDC_LOGIN:
- case IDC_PASSWORD:
- case IDC_GROUPNAME:
- if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus())
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
-
- case IDC_COMBO_LANGUAGE:
- if (HIWORD(wParam) == CBN_SELCHANGE && (HWND)lParam == GetFocus())
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
-
- case IDC_DELIVERY:
- case IDC_USE_LOCAL_TIME:
- 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;
- }
- break;
-
- case WM_NOTIFY:
- if (((LPNMHDR)lParam)->code == PSN_APPLY) {
- TCHAR str[1025];
- bool bNeedClearToken = false;
- GetDlgItemText(hwndDlg, IDC_LOGIN, str, _countof(str));
-
- CMString tszLogin(ptrT(ppro->getTStringA("Login")));
- if (tszLogin != str) {
- bNeedClearToken = true;
- ppro->setTString("Login", str);
- }
-
- GetDlgItemText(hwndDlg, IDC_PASSWORD, str, _countof(str));
- CMString tszPassw(ptrT(ppro->GetUserStoredPassword()));
-
- T2Utf szRawPasswd(str);
- if (szRawPasswd != NULL && tszPassw != str) {
- bNeedClearToken = true;
- ppro->setString("Password", szRawPasswd);
- }
-
- GetDlgItemText(hwndDlg, IDC_GROUPNAME, str, _countof(str));
- if (mir_tstrcmp(ppro->getGroup(), str)) {
- ppro->setGroup(str);
- ppro->setTString("ProtoGroup", str);
- }
-
- ppro->m_VKLang = mir_tstrdup((TCHAR*)SendMessage(hWndCombo, CB_GETITEMDATA, SendMessage(hWndCombo, CB_GETCURSEL, 0, 0), 0));
- if (!IsEmpty(ppro->m_VKLang))
- ppro->setTString("VKLang", ppro->m_VKLang);
- else
- ppro->delSetting("VKLang");
-
- ppro->m_bServerDelivery = IsDlgButtonChecked(hwndDlg, IDC_DELIVERY) == BST_CHECKED;
- ppro->setByte("ServerDelivery", ppro->m_bServerDelivery);
-
- ppro->setByte("AutoClean", IsDlgButtonChecked(hwndDlg, IDC_AUTOCLEAN) == BST_CHECKED);
-
- ppro->m_bUseLocalTime = IsDlgButtonChecked(hwndDlg, IDC_USE_LOCAL_TIME) == BST_CHECKED;
- ppro->setByte("UseLocalTime", ppro->m_bUseLocalTime);
-
- if (IsDlgButtonChecked(hwndDlg, IDC_ONREAD) == BST_CHECKED)
- ppro->m_iMarkMessageReadOn = markOnRead;
- if (IsDlgButtonChecked(hwndDlg, IDC_ONRECEIVE) == BST_CHECKED)
- ppro->m_iMarkMessageReadOn = markOnReceive;
- if (IsDlgButtonChecked(hwndDlg, IDC_ONREPLY) == BST_CHECKED)
- ppro->m_iMarkMessageReadOn = markOnReply;
- 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);
-
- if (bNeedClearToken)
- ppro->ClearAccessToken();
- }
- break;
-
- case WM_CLOSE:
- EndDialog(hwndDlg, 0);
- break;
- }
- return FALSE;
-}
+CVkAccMgrForm::CVkAccMgrForm(CVkProto *proto, HWND hwndParent):
+ CVkDlgBase(proto, IDD_ACCMGRUI, false),
+ m_edtLogin(this, IDC_LOGIN),
+ m_edtPassword(this, IDC_PASSWORD),
+ m_hlLink(this, IDC_URL, "https://vk.com/"),
+ m_proto(proto)
-INT_PTR CALLBACK CVkProto::OptionsAdvProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- CVkProto *ppro = (CVkProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
-
- switch (uMsg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
-
- ppro = (CVkProto*)lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
-
- CheckDlgButton(hwndDlg, IDC_HIDECHATS, ppro->m_bHideChats ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SYNC_MSG_STATUS, ppro->m_bSyncReadMessageStatusFromServer ? BST_CHECKED : BST_UNCHECKED);
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_MESASUREAD), IsDlgButtonChecked(hwndDlg, IDC_SYNC_MSG_STATUS) == BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_MESASUREAD, ppro->m_bMesAsUnread ? BST_CHECKED : BST_UNCHECKED);
-
- CheckDlgButton(hwndDlg, IDC_FORCE_ONLINE_ON_ACT, ppro->m_bUserForceOnlineOnActivity ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_USENOSTDURLENCODE, ppro->m_bUseNonStandardUrlEncode ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_USENOSTDPOPUPS, ppro->m_bUseNonStandardNotifications ? BST_CHECKED : BST_UNCHECKED);
-
- CheckDlgButton(hwndDlg, IDC_REPORT_ABUSE, ppro->m_bReportAbuse ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CLEAR_SERVER_HISTORY, ppro->m_bClearServerHistory ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_REMOVE_FROM_FRENDLIST, ppro->m_bRemoveFromFrendlist ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_REMOVE_FROM_CLIST, ppro->m_bRemoveFromClist ? BST_CHECKED : BST_UNCHECKED);
-
- CheckDlgButton(hwndDlg, IDC_SEND_MUSIC_NONE, (ppro->m_iMusicSendMetod == sendNone) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SEND_MUSIC_BROADCAST, (ppro->m_iMusicSendMetod == sendBroadcastOnly) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SEND_MUSIC_STATUS, (ppro->m_iMusicSendMetod == sendStatusOnly) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SEND_MUSIC_BROADCAST_AND_STATUS, (ppro->m_iMusicSendMetod == sendBroadcastAndStatus) ? BST_CHECKED : BST_UNCHECKED);
-
- SendDlgItemMessage(hwndDlg, IDC_SPIN_INT_INVIS, UDM_SETRANGE, 0, MAKELONG(60, 0));
- SendDlgItemMessage(hwndDlg, IDC_SPIN_INT_INVIS, UDM_SETPOS, 0, ppro->m_iInvisibleInterval);
-
- SetDlgItemText(hwndDlg, IDC_RET_CHAT_MES, ppro->m_ReturnChatMessage);
-
- return TRUE;
-
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_ED_INT_INVIS:
- if ((HWND)lParam == GetFocus() && (HIWORD(wParam) == EN_CHANGE))
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
-
- case IDC_SYNC_MSG_STATUS:
- if (HIWORD(wParam) == BN_CLICKED && (HWND)lParam == GetFocus()) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_MESASUREAD), IsDlgButtonChecked(hwndDlg, IDC_SYNC_MSG_STATUS) == BST_UNCHECKED);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- break;
-
- case IDC_RET_CHAT_MES:
- if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus())
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
-
- case IDC_HIDECHATS:
- case IDC_MESASUREAD:
- case IDC_FORCE_ONLINE_ON_ACT:
- case IDC_USENOSTDURLENCODE:
- case IDC_USENOSTDPOPUPS:
- case IDC_REPORT_ABUSE:
- case IDC_CLEAR_SERVER_HISTORY:
- case IDC_REMOVE_FROM_FRENDLIST:
- case IDC_REMOVE_FROM_CLIST:
- case IDC_SEND_MUSIC_NONE:
- case IDC_SEND_MUSIC_BROADCAST:
- case IDC_SEND_MUSIC_STATUS:
- case IDC_SEND_MUSIC_BROADCAST_AND_STATUS:
- if (HIWORD(wParam) == BN_CLICKED && (HWND)lParam == GetFocus())
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- }
- break;
-
- case WM_NOTIFY:
- if (((LPNMHDR)lParam)->code == UDN_DELTAPOS)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
-
- if (((LPNMHDR)lParam)->code == PSN_APPLY) {
- ppro->m_bHideChats = IsDlgButtonChecked(hwndDlg, IDC_HIDECHATS) == BST_CHECKED;
- ppro->setByte("HideChats", ppro->m_bHideChats);
-
- ppro->m_bSyncReadMessageStatusFromServer = IsDlgButtonChecked(hwndDlg, IDC_SYNC_MSG_STATUS) == BST_CHECKED;
- ppro->setByte("SyncReadMessageStatusFromServer", ppro->m_bSyncReadMessageStatusFromServer);
-
- ppro->m_bMesAsUnread = IsDlgButtonChecked(hwndDlg, IDC_MESASUREAD) == BST_CHECKED;
- ppro->setByte("MesAsUnread", ppro->m_bMesAsUnread);
-
- ppro->m_bUserForceOnlineOnActivity = IsDlgButtonChecked(hwndDlg, IDC_FORCE_ONLINE_ON_ACT) == BST_CHECKED;
- ppro->setByte("UserForceOnlineOnActivity", ppro->m_bUserForceOnlineOnActivity);
-
- ppro->m_bUseNonStandardUrlEncode = IsDlgButtonChecked(hwndDlg, IDC_USENOSTDURLENCODE) == BST_CHECKED;
- ppro->setByte("UseNonStandardUrlEncode", ppro->m_bUseNonStandardUrlEncode);
-
- ppro->m_bUseNonStandardNotifications = IsDlgButtonChecked(hwndDlg, IDC_USENOSTDPOPUPS) == BST_CHECKED;
- ppro->setByte("UseNonStandardNotifications", ppro->m_bUseNonStandardNotifications);
-
- ppro->m_bReportAbuse = IsDlgButtonChecked(hwndDlg, IDC_REPORT_ABUSE) == BST_CHECKED;
- ppro->setByte("ReportAbuseOnBanUser", ppro->m_bReportAbuse);
-
- ppro->m_bClearServerHistory = IsDlgButtonChecked(hwndDlg, IDC_CLEAR_SERVER_HISTORY) == BST_CHECKED;
- ppro->setByte("ClearServerHistoryOnBanUser", ppro->m_bClearServerHistory);
-
- ppro->m_bRemoveFromFrendlist = IsDlgButtonChecked(hwndDlg, IDC_REMOVE_FROM_FRENDLIST) == BST_CHECKED;
- ppro->setByte("RemoveFromFrendlistOnBanUser", ppro->m_bRemoveFromFrendlist);
-
- ppro->m_bRemoveFromClist = IsDlgButtonChecked(hwndDlg, IDC_REMOVE_FROM_CLIST) == BST_CHECKED;
- ppro->setByte("RemoveFromClistOnBanUser", ppro->m_bRemoveFromClist);
-
- if (IsDlgButtonChecked(hwndDlg, IDC_SEND_MUSIC_NONE) == BST_CHECKED)
- ppro->m_iMusicSendMetod = sendNone;
- if (IsDlgButtonChecked(hwndDlg, IDC_SEND_MUSIC_BROADCAST) == BST_CHECKED)
- ppro->m_iMusicSendMetod = sendBroadcastOnly;
- if (IsDlgButtonChecked(hwndDlg, IDC_SEND_MUSIC_STATUS) == BST_CHECKED)
- ppro->m_iMusicSendMetod = sendStatusOnly;
- if (IsDlgButtonChecked(hwndDlg, IDC_SEND_MUSIC_BROADCAST_AND_STATUS) == BST_CHECKED)
- ppro->m_iMusicSendMetod = sendBroadcastAndStatus;
- ppro->setByte("MusicSendMetod", ppro->m_iMusicSendMetod);
- CMStringA szListeningTo(ppro->m_szModuleName);
- szListeningTo += "Enabled";
- db_set_b(NULL, "ListeningTo", szListeningTo, ppro->m_iMusicSendMetod == 0 ? 0 : 1);
-
- TCHAR buffer[5] = { 0 };
- GetDlgItemText(hwndDlg, IDC_ED_INT_INVIS, buffer, _countof(buffer));
- ppro->setDword("InvisibleInterval", ppro->m_iInvisibleInterval = _ttoi(buffer));
-
- TCHAR str[4096];
- GetDlgItemText(hwndDlg, IDC_RET_CHAT_MES, str, _countof(str));
- CMString tszReturnChatMessage(str);
- if (tszReturnChatMessage != ppro->m_ReturnChatMessage) {
- tszReturnChatMessage.Trim();
- ppro->m_ReturnChatMessage = mir_tstrdup(tszReturnChatMessage.IsEmpty() ? TranslateT("I'm back"): tszReturnChatMessage);
- ppro->setTString("ReturnChatMessage", ppro->m_ReturnChatMessage);
- }
- }
- break;
-
- case WM_CLOSE:
- EndDialog(hwndDlg, 0);
- break;
- }
+ SetParent(hwndParent);
- return FALSE;
+ CreateLink(m_edtLogin, "Login", _T(""));
}
-INT_PTR CALLBACK CVkProto::OptionsFeedsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+void CVkAccMgrForm::OnInitDialog()
{
- CVkProto *ppro = (CVkProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
-
- switch (uMsg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
-
- ppro = (CVkProto*)lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
-
- CheckDlgButton(hwndDlg, IDC_NEWS_ENBL, ppro->m_bNewsEnabled ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_NOTIF_ENBL, ppro->m_bNotificationsEnabled ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_NOTIF_MARK_VIEWED, ppro->m_bNotificationsMarkAsViewed ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SPEC_CONT_ENBL, ppro->m_bSpecialContactAlwaysEnabled ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_NEWSAUTOCLEAR, ppro->m_bNewsAutoClearHistory ? BST_CHECKED : BST_UNCHECKED);
-
- CheckDlgButton(hwndDlg, IDC_F_POSTS, ppro->m_bNewsFilterPosts ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_F_PHOTOS, ppro->m_bNewsFilterPhotos ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_F_TAGS, ppro->m_bNewsFilterTags ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_F_WALLPHOTOS, ppro->m_bNewsFilterWallPhotos ? BST_CHECKED : BST_UNCHECKED);
-
- CheckDlgButton(hwndDlg, IDC_S_FRIENDS, ppro->m_bNewsSourceFriends ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_S_GROUPS, ppro->m_bNewsSourceGroups ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_S_PAGES, ppro->m_bNewsSourcePages ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_S_FOLLOWING, ppro->m_bNewsSourceFollowing ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_S_BANNED, ppro->m_bNewsSourceIncludeBanned ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_S_NOREPOSTES, ppro->m_bNewsSourceNoReposts ? BST_CHECKED : BST_UNCHECKED);
-
- CheckDlgButton(hwndDlg, IDC_N_COMMENTS, ppro->m_bNotificationFilterComments ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_N_LIKES, ppro->m_bNotificationFilterLikes ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_N_REPOSTS, ppro->m_bNotificationFilterReposts ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_N_MENTIONS, ppro->m_bNotificationFilterMentions ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_N_INVITES, ppro->m_bNotificationFilterInvites ? BST_CHECKED : BST_UNCHECKED);
-
- SendDlgItemMessage(hwndDlg, IDC_SPIN_INT_NEWS, UDM_SETRANGE, 0, MAKELONG(60*24, 1));
- SendDlgItemMessage(hwndDlg, IDC_SPIN_INT_NEWS, UDM_SETPOS, 0, ppro->m_iNewsInterval);
-
- SendDlgItemMessage(hwndDlg, IDC_SPIN_INT_NOTIF, UDM_SETRANGE, 0, MAKELONG(60 * 24, 1));
- SendDlgItemMessage(hwndDlg, IDC_SPIN_INT_NOTIF, UDM_SETPOS, 0, ppro->m_iNotificationsInterval);
-
- return TRUE;
-
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_ED_INT_NEWS:
- case IDC_ED_INT_NOTIF:
- if ((HWND)lParam == GetFocus() && (HIWORD(wParam) == EN_CHANGE))
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
-
- case IDC_NEWS_ENBL:
- case IDC_NOTIF_ENBL:
- case IDC_NOTIF_MARK_VIEWED:
- case IDC_SPEC_CONT_ENBL:
- case IDC_NEWSAUTOCLEAR:
- case IDC_F_POSTS:
- case IDC_F_PHOTOS:
- case IDC_F_TAGS:
- case IDC_F_WALLPHOTOS:
- case IDC_S_FRIENDS:
- case IDC_S_GROUPS:
- case IDC_S_PAGES:
- case IDC_S_FOLLOWING:
- case IDC_S_BANNED:
- case IDC_S_NOREPOSTES:
- case IDC_N_COMMENTS:
- case IDC_N_LIKES:
- case IDC_N_REPOSTS:
- case IDC_N_MENTIONS:
- case IDC_N_INVITES:
- if (HIWORD(wParam) == BN_CLICKED && (HWND)lParam == GetFocus())
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- }
- break;
-
- case WM_NOTIFY:
- if (((LPNMHDR)lParam)->code == UDN_DELTAPOS)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
-
- if (((LPNMHDR)lParam)->code == PSN_APPLY) {
- ppro->m_bNewsEnabled = IsDlgButtonChecked(hwndDlg, IDC_NEWS_ENBL) == BST_CHECKED;
- ppro->setByte("NewsEnabled", ppro->m_bNewsEnabled);
-
- ppro->m_bNotificationsEnabled = IsDlgButtonChecked(hwndDlg, IDC_NOTIF_ENBL) == BST_CHECKED;
- ppro->setByte("NotificationsEnabled", ppro->m_bNotificationsEnabled);
-
- ppro->m_bNotificationsMarkAsViewed = IsDlgButtonChecked(hwndDlg, IDC_NOTIF_MARK_VIEWED) == BST_CHECKED;
- ppro->setByte("NotificationsMarkAsViewed", ppro->m_bNotificationsMarkAsViewed);
-
- ppro->m_bSpecialContactAlwaysEnabled = IsDlgButtonChecked(hwndDlg, IDC_SPEC_CONT_ENBL) == BST_CHECKED;
- ppro->setByte("SpecialContactAlwaysEnabled", ppro->m_bSpecialContactAlwaysEnabled);
-
- ppro->m_bNewsAutoClearHistory = IsDlgButtonChecked(hwndDlg, IDC_NEWSAUTOCLEAR) == BST_CHECKED;
- ppro->setByte("NewsAutoClearHistory", ppro->m_bNewsAutoClearHistory);
-
- ppro->m_bNewsFilterPosts = IsDlgButtonChecked(hwndDlg, IDC_F_POSTS) == BST_CHECKED;
- ppro->setByte("NewsFilterPosts", ppro->m_bNewsFilterPosts);
-
- ppro->m_bNewsFilterPhotos = IsDlgButtonChecked(hwndDlg, IDC_F_PHOTOS) == BST_CHECKED;
- ppro->setByte("NewsFilterPhotos", ppro->m_bNewsFilterPhotos);
-
- ppro->m_bNewsFilterTags = IsDlgButtonChecked(hwndDlg, IDC_F_TAGS) == BST_CHECKED;
- ppro->setByte("NewsFilterTags", ppro->m_bNewsFilterTags);
-
- ppro->m_bNewsFilterWallPhotos = IsDlgButtonChecked(hwndDlg, IDC_F_WALLPHOTOS) == BST_CHECKED;
- ppro->setByte("NewsFilterWallPhotos", ppro->m_bNewsFilterWallPhotos);
-
- ppro->m_bNewsSourceFriends = IsDlgButtonChecked(hwndDlg, IDC_S_FRIENDS) == BST_CHECKED;
- ppro->setByte("NewsSourceFriends", ppro->m_bNewsSourceFriends);
-
- ppro->m_bNewsSourceGroups = IsDlgButtonChecked(hwndDlg, IDC_S_GROUPS) == BST_CHECKED;
- ppro->setByte("NewsSourceGroups", ppro->m_bNewsSourceGroups);
-
- ppro->m_bNewsSourcePages = IsDlgButtonChecked(hwndDlg, IDC_S_PAGES) == BST_CHECKED;
- ppro->setByte("NewsSourcePages", ppro->m_bNewsSourcePages);
-
- ppro->m_bNewsSourceFollowing = IsDlgButtonChecked(hwndDlg, IDC_S_FOLLOWING) == BST_CHECKED;
- ppro->setByte("NewsSourceFollowing", ppro->m_bNewsSourceFollowing);
-
- ppro->m_bNewsSourceIncludeBanned = IsDlgButtonChecked(hwndDlg, IDC_S_BANNED) == BST_CHECKED;
- ppro->setByte("NewsSourceIncludeBanned", ppro->m_bNewsSourceIncludeBanned);
-
- ppro->m_bNewsSourceNoReposts = IsDlgButtonChecked(hwndDlg, IDC_S_NOREPOSTES) == BST_CHECKED;
- ppro->setByte("NewsSourceNoReposts", ppro->m_bNewsSourceNoReposts);
-
- ppro->m_bNotificationFilterComments = IsDlgButtonChecked(hwndDlg, IDC_N_COMMENTS) == BST_CHECKED;
- ppro->setByte("NotificationFilterComments", ppro->m_bNotificationFilterComments);
-
- ppro->m_bNotificationFilterLikes = IsDlgButtonChecked(hwndDlg, IDC_N_LIKES) == BST_CHECKED;
- ppro->setByte("NotificationFilterLikes", ppro->m_bNotificationFilterLikes);
+ CSuper::OnInitDialog();
- ppro->m_bNotificationFilterReposts = IsDlgButtonChecked(hwndDlg, IDC_N_REPOSTS) == BST_CHECKED;
- ppro->setByte("NotificationFilterReposts", ppro->m_bNotificationFilterReposts);
-
- ppro->m_bNotificationFilterMentions = IsDlgButtonChecked(hwndDlg, IDC_N_MENTIONS) == BST_CHECKED;
- ppro->setByte("NotificationFilterMentions", ppro->m_bNotificationFilterMentions);
-
- ppro->m_bNotificationFilterInvites = IsDlgButtonChecked(hwndDlg, IDC_N_INVITES) == BST_CHECKED;
- ppro->setByte("NotificationFilterInvites", ppro->m_bNotificationFilterInvites);
-
- TCHAR buffer[5] = { 0 };
- GetDlgItemText(hwndDlg, IDC_ED_INT_NEWS, buffer, _countof(buffer));
- ppro->setDword("NewsInterval", ppro->m_iNewsInterval = _ttoi(buffer));
-
- GetDlgItemText(hwndDlg, IDC_ED_INT_NOTIF, buffer, _countof(buffer));
- ppro->setDword("NotificationsInterval", ppro->m_iNotificationsInterval = _ttoi(buffer));
+ m_ptszOldLogin = m_edtLogin.GetText();
+ m_edtLogin.SendMsg(EM_LIMITTEXT, 1024, 0);
- }
- break;
-
- case WM_CLOSE:
- EndDialog(hwndDlg, 0);
- break;
- }
-
- return FALSE;
+ m_ptszOldPass = m_proto->GetUserStoredPassword();
+ m_edtPassword.SetText(m_ptszOldPass);
+ m_edtPassword.SendMsg(EM_LIMITTEXT, 1024, 0);
}
-INT_PTR CALLBACK CVkProto::OptionsViewProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+void CVkAccMgrForm::OnApply()
{
- CVkProto *ppro = (CVkProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
-
- switch (uMsg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
-
- ppro = (CVkProto*)lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
-
- CheckDlgButton(hwndDlg, IDC_IMG_OFF, (ppro->m_iIMGBBCSupport == imgNo) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_IMG_FULLSIZE, (ppro->m_iIMGBBCSupport == imgFullSize) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_IMG_130, (ppro->m_iIMGBBCSupport == imgPreview130) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_IMG_604, (ppro->m_iIMGBBCSupport == imgPreview604) ? BST_CHECKED : BST_UNCHECKED);
-
- CheckDlgButton(hwndDlg, IDC_NEWSBBC_OFF, (ppro->m_iBBCForNews == bbcNo) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_NEWSBBC_BASIC, (ppro->m_iBBCForNews == bbcBasic) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_NEWSBBC_ADV, (ppro->m_iBBCForNews == bbcAdvanced) ? BST_CHECKED : BST_UNCHECKED);
-
- CheckDlgButton(hwndDlg, IDC_BBC_ATT_NEWS, ppro->m_bUseBBCOnAttacmentsAsNews ? BST_CHECKED : BST_UNCHECKED);
-
- CheckDlgButton(hwndDlg, IDC_ATTBBC_OFF, (ppro->m_iBBCForAttachments == bbcNo) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ATTBBC_BASIC, (ppro->m_iBBCForAttachments == bbcBasic) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ATTBBC_ADV, (ppro->m_iBBCForAttachments == bbcAdvanced) ? BST_CHECKED : BST_UNCHECKED);
-
- CheckDlgButton(hwndDlg, IDC_STICKERS_AS_SMYLES, ppro->m_bStikersAsSmyles ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SHOTEN_LINKS_FOR_AUDIO, ppro->m_bShortenLinksForAudio ? BST_CHECKED : BST_UNCHECKED);
-
- return TRUE;
-
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_IMG_OFF:
- case IDC_IMG_FULLSIZE:
- case IDC_IMG_130:
- case IDC_IMG_604:
- case IDC_NEWSBBC_OFF:
- case IDC_NEWSBBC_BASIC:
- case IDC_NEWSBBC_ADV:
- case IDC_BBC_ATT_NEWS:
- case IDC_ATTBBC_OFF:
- case IDC_ATTBBC_BASIC:
- case IDC_ATTBBC_ADV:
- case IDC_STICKERS_AS_SMYLES:
- case IDC_SHOTEN_LINKS_FOR_AUDIO:
- if (HIWORD(wParam) == BN_CLICKED && (HWND)lParam == GetFocus())
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- }
- break;
-
- case WM_NOTIFY:
- if (((LPNMHDR)lParam)->code == PSN_APPLY) {
- if (IsDlgButtonChecked(hwndDlg, IDC_IMG_OFF) == BST_CHECKED)
- ppro->m_iIMGBBCSupport = imgNo;
- if (IsDlgButtonChecked(hwndDlg, IDC_IMG_FULLSIZE) == BST_CHECKED)
- ppro->m_iIMGBBCSupport = imgFullSize;
- if (IsDlgButtonChecked(hwndDlg, IDC_IMG_130) == BST_CHECKED)
- ppro->m_iIMGBBCSupport = imgPreview130;
- if (IsDlgButtonChecked(hwndDlg, IDC_IMG_604) == BST_CHECKED)
- ppro->m_iIMGBBCSupport = imgPreview604;
- ppro->setByte("IMGBBCSupport", ppro->m_iIMGBBCSupport);
-
- if (IsDlgButtonChecked(hwndDlg, IDC_NEWSBBC_OFF) == BST_CHECKED)
- ppro->m_iBBCForNews = bbcNo;
- if (IsDlgButtonChecked(hwndDlg, IDC_NEWSBBC_BASIC) == BST_CHECKED)
- ppro->m_iBBCForNews = bbcBasic;
- if (IsDlgButtonChecked(hwndDlg, IDC_NEWSBBC_ADV) == BST_CHECKED)
- ppro->m_iBBCForNews = bbcAdvanced;
- ppro->setByte("BBCForNews", ppro->m_iBBCForNews);
-
- ppro->m_bUseBBCOnAttacmentsAsNews = IsDlgButtonChecked(hwndDlg, IDC_BBC_ATT_NEWS) == BST_CHECKED;
- ppro->setByte("UseBBCOnAttacmentsAsNews", ppro->m_bStikersAsSmyles);
-
- if (IsDlgButtonChecked(hwndDlg, IDC_ATTBBC_OFF) == BST_CHECKED)
- ppro->m_iBBCForAttachments = bbcNo;
- if (IsDlgButtonChecked(hwndDlg, IDC_ATTBBC_BASIC) == BST_CHECKED)
- ppro->m_iBBCForAttachments = bbcBasic;
- if (IsDlgButtonChecked(hwndDlg, IDC_ATTBBC_ADV) == BST_CHECKED)
- ppro->m_iBBCForAttachments = bbcAdvanced;
- ppro->setByte("BBCForAttachments", ppro->m_iBBCForAttachments);
-
- ppro->m_bStikersAsSmyles = IsDlgButtonChecked(hwndDlg, IDC_STICKERS_AS_SMYLES) == BST_CHECKED;
- ppro->setByte("StikersAsSmyles", ppro->m_bStikersAsSmyles);
-
- ppro->m_bShortenLinksForAudio = IsDlgButtonChecked(hwndDlg, IDC_SHOTEN_LINKS_FOR_AUDIO) == BST_CHECKED;
- ppro->setByte("ShortenLinksForAudio", ppro->m_bShortenLinksForAudio);
- }
- break;
-
- case WM_CLOSE:
- EndDialog(hwndDlg, 0);
- break;
+ pass_ptrT ptszNewPass(m_edtPassword.GetText());
+ bool bPassChanged = mir_tstrcmp(m_ptszOldPass, ptszNewPass) != 0;
+ if (bPassChanged) {
+ T2Utf szRawPasswd(ptszNewPass);
+ m_proto->setString("Password", szRawPasswd);
+ pass_ptrA pszPass(szRawPasswd);
+ m_ptszOldPass = ptszNewPass;
}
- return FALSE;
+ ptrT ptszNewLogin(m_edtLogin.GetText());
+ if (bPassChanged || mir_tstrcmpi(m_ptszOldLogin, ptszNewLogin))
+ m_proto->ClearAccessToken();
+ m_ptszOldLogin = ptszNewLogin;
}
+////////////////////// Options ///////////////////////////////////////////////
+
int CVkProto::OnOptionsInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
@@ -691,26 +83,375 @@ int CVkProto::OnOptionsInit(WPARAM wParam, LPARAM) odp.ptszTab = LPGENT("Account");
odp.position = 1;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MAIN);
- odp.pfnDlgProc = &CVkProto::OptionsProc;
+ odp.pDialog = new CVkOptionAccountForm(this);
Options_AddPage(wParam, &odp);
odp.ptszTab = LPGENT("Advanced");
odp.position = 2;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_ADV);
- odp.pfnDlgProc = &CVkProto::OptionsAdvProc;
+ odp.pDialog = new CVkOptionAdvancedForm(this);
Options_AddPage(wParam, &odp);
odp.ptszTab = LPGENT("News and notifications");
odp.position = 3;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FEEDS);
- odp.pfnDlgProc = &CVkProto::OptionsFeedsProc;
+ odp.pDialog = new CVkOptionFeedsForm(this);
Options_AddPage(wParam, &odp);
odp.ptszTab = LPGENT("View");
odp.position = 4;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_VIEW);
- odp.pfnDlgProc = &CVkProto::OptionsViewProc;
+ odp.pDialog = new CVkOptionViewForm(this);
Options_AddPage(wParam, &odp);
+
return 0;
-}
\ No newline at end of file +}
+
+////////////////////// Account page //////////////////////////////////////////
+
+static CVKLang vkLangCodes[] = {
+ { NULL, LPGENT("Account language") },
+ { _T("en"), LPGENT("English") },
+ { _T("ru"), LPGENT("Russian") },
+ { _T("be"), LPGENT("Belarusian") },
+ { _T("ua"), LPGENT("Ukrainian") },
+ { _T("es"), LPGENT("Spanish") },
+ { _T("fi"), LPGENT("Finnish") },
+ { _T("de"), LPGENT("German") },
+ { _T("it"), LPGENT("Italian") },
+};
+
+CVkOptionAccountForm::CVkOptionAccountForm(CVkProto *proto):
+ CVkDlgBase(proto, IDD_OPT_MAIN, false),
+ m_edtLogin(this, IDC_LOGIN),
+ m_edtPassword(this, IDC_PASSWORD),
+ m_hlLink(this, IDC_URL, "https://vk.com/"),
+ m_edtGroupName(this, IDC_GROUPNAME),
+ m_cbxVKLang(this, IDC_COMBO_LANGUAGE),
+ m_cbDelivery(this, IDC_DELIVERY),
+ m_cbUseLocalTime(this, IDC_USE_LOCAL_TIME),
+ m_cbAutoClean(this, IDC_AUTOCLEAN),
+ m_cbMarkMessageOnRead(this, IDC_ONREAD),
+ m_cbMarkMessageOnReceive(this, IDC_ONRECEIVE),
+ m_cbMarkMessageOnReply(this, IDC_ONREPLY),
+ m_cbMarkMessageOnTyping(this, IDC_ONTYPING),
+ m_cbSyncHistoryOff(this, IDC_SYNC_OFF),
+ m_cbSyncHistoryAuto(this, IDC_SYNC_AUTO),
+ m_cbSyncHistoryForLast1Day(this, IDC_SYNC_LAST1DAY),
+ m_cbSyncHistoryForLast3Day(this, IDC_SYNC_LAST3DAY),
+ m_proto(proto)
+
+{
+ CreateLink(m_edtLogin, "Login", _T(""));
+ CreateLink(m_edtGroupName, "ProtoGroup", _T("VKontakte"));
+ CreateLink(m_cbDelivery, m_proto->m_vkOptions.bServerDelivery);
+ CreateLink(m_cbUseLocalTime, m_proto->m_vkOptions.bUseLocalTime);
+ CreateLink(m_cbAutoClean, m_proto->m_vkOptions.bAutoClean);
+
+}
+
+void CVkOptionAccountForm::OnInitDialog()
+{
+ m_ptszOldLogin = m_edtLogin.GetText();
+ m_edtLogin.SendMsg(EM_LIMITTEXT, 1024, 0);
+
+ m_ptszOldPass = m_proto->GetUserStoredPassword();
+ m_edtPassword.SetText(m_ptszOldPass);
+ m_edtPassword.SendMsg(EM_LIMITTEXT, 1024, 0);
+
+ m_ptszOldGroup = m_edtGroupName.GetText();
+
+ m_cbMarkMessageOnRead.SetState(m_proto->m_vkOptions.iMarkMessageReadOn == MarkMsgReadOn::markOnRead);
+ m_cbMarkMessageOnReceive.SetState(m_proto->m_vkOptions.iMarkMessageReadOn == MarkMsgReadOn::markOnReceive);
+ m_cbMarkMessageOnReply.SetState(m_proto->m_vkOptions.iMarkMessageReadOn == MarkMsgReadOn::markOnReply);
+ m_cbMarkMessageOnTyping.SetState(m_proto->m_vkOptions.iMarkMessageReadOn == MarkMsgReadOn::markOnTyping);
+
+ m_cbSyncHistoryOff.SetState(m_proto->m_vkOptions.iSyncHistoryMetod == SyncHistoryMetod::syncOff);
+ m_cbSyncHistoryAuto.SetState(m_proto->m_vkOptions.iSyncHistoryMetod == SyncHistoryMetod::syncAuto);
+ m_cbSyncHistoryForLast1Day.SetState(m_proto->m_vkOptions.iSyncHistoryMetod == SyncHistoryMetod::sync1Days);
+ m_cbSyncHistoryForLast3Day.SetState(m_proto->m_vkOptions.iSyncHistoryMetod == SyncHistoryMetod::sync3Days);
+
+ for (size_t i = 0; i < _countof(vkLangCodes); i++) {
+ m_cbxVKLang.AddString(TranslateTS(vkLangCodes[i].szDescription), (LPARAM)vkLangCodes[i].szCode);
+ if (!mir_tstrcmpi(vkLangCodes[i].szCode, m_proto->m_vkOptions.ptszVKLang))
+ m_cbxVKLang.SetCurSel(i);
+ }
+
+}
+
+void CVkOptionAccountForm::OnApply()
+{
+ if (m_cbSyncHistoryOff.GetState())
+ m_proto->m_vkOptions.iSyncHistoryMetod = SyncHistoryMetod::syncOff;
+ if (m_cbSyncHistoryAuto.GetState())
+ m_proto->m_vkOptions.iSyncHistoryMetod = SyncHistoryMetod::syncAuto;
+ if (m_cbSyncHistoryForLast1Day.GetState())
+ m_proto->m_vkOptions.iSyncHistoryMetod = SyncHistoryMetod::sync1Days;
+ if (m_cbSyncHistoryForLast3Day.GetState())
+ m_proto->m_vkOptions.iSyncHistoryMetod = SyncHistoryMetod::sync3Days;
+
+ if (m_cbMarkMessageOnRead.GetState())
+ m_proto->m_vkOptions.iMarkMessageReadOn = MarkMsgReadOn::markOnRead;
+ if (m_cbMarkMessageOnReceive.GetState())
+ m_proto->m_vkOptions.iMarkMessageReadOn = MarkMsgReadOn::markOnReceive;
+ if (m_cbMarkMessageOnReply.GetState())
+ m_proto->m_vkOptions.iMarkMessageReadOn = MarkMsgReadOn::markOnReply;
+ if (m_cbMarkMessageOnTyping.GetState())
+ m_proto->m_vkOptions.iMarkMessageReadOn = MarkMsgReadOn::markOnTyping;
+
+ m_proto->m_vkOptions.ptszVKLang = (TCHAR *)m_cbxVKLang.GetItemData(m_cbxVKLang.GetCurSel());
+ if (!IsEmpty(m_proto->m_vkOptions.ptszVKLang))
+ m_proto->setTString("VKLang", m_proto->m_vkOptions.ptszVKLang);
+ else
+ m_proto->delSetting("VKLang");
+
+ ptrT ptszGroupName(m_edtGroupName.GetText());
+ if (mir_tstrcmp(m_ptszOldGroup, ptszGroupName)) {
+ m_proto->setGroup(ptszGroupName);
+ m_ptszOldGroup = ptszGroupName;
+ }
+
+ pass_ptrT ptszNewPass(m_edtPassword.GetText());
+ bool bPassChanged = mir_tstrcmp(m_ptszOldPass, ptszNewPass) != 0;
+ if (bPassChanged) {
+ T2Utf szRawPasswd(ptszNewPass);
+ m_proto->setString("Password", szRawPasswd);
+ pass_ptrA pszPass(szRawPasswd);
+ m_ptszOldPass = ptszNewPass;
+ }
+
+ ptrT ptszNewLogin(m_edtLogin.GetText());
+ if (bPassChanged || mir_tstrcmpi(m_ptszOldLogin, ptszNewLogin))
+ m_proto->ClearAccessToken();
+ m_ptszOldLogin = ptszNewLogin;
+
+}
+
+////////////////////// Advanced page /////////////////////////////////////////
+
+CVkOptionAdvancedForm::CVkOptionAdvancedForm(CVkProto *proto):
+ CVkDlgBase(proto, IDD_OPT_ADV, false),
+ m_cbHideChats(this, IDC_HIDECHATS),
+ m_cbSyncReadMessageStatusFromServer(this, IDC_SYNC_MSG_STATUS),
+ m_cbMesAsUnread(this, IDC_MESASUREAD),
+ m_edtInvInterval(this, IDC_ED_INT_INVIS),
+ m_spInvInterval(this, IDC_SPIN_INT_INVIS),
+ m_cbUseNonStandardNotifications(this, IDC_USENOSTDURLENCODE),
+ m_cbUseNonStandardUrlEncode(this, IDC_USENOSTDURLENCODE),
+ m_cbReportAbuse(this, IDC_REPORT_ABUSE),
+ m_cbClearServerHistory(this, IDC_CLEAR_SERVER_HISTORY),
+ m_cbRemoveFromFrendlist(this, IDC_REMOVE_FROM_FRENDLIST),
+ m_cbRemoveFromCList(this, IDC_REMOVE_FROM_CLIST),
+ m_cbMusicSendOff(this, IDC_SEND_MUSIC_NONE),
+ m_cbMusicSendBroadcastAndStatus(this, IDC_SEND_MUSIC_BROADCAST_AND_STATUS),
+ m_cbSendMetodBroadcast(this, IDC_SEND_MUSIC_BROADCAST),
+ m_cbMusicSendStatus(this, IDC_SEND_MUSIC_STATUS),
+ m_edtReturnChatMessage(this, IDC_RET_CHAT_MES),
+ m_proto(proto)
+{
+ CreateLink(m_cbHideChats, m_proto->m_vkOptions.bHideChats);
+ CreateLink(m_cbSyncReadMessageStatusFromServer, m_proto->m_vkOptions.bSyncReadMessageStatusFromServer);
+ CreateLink(m_cbMesAsUnread, m_proto->m_vkOptions.bMesAsUnread);
+ CreateLink(m_edtInvInterval, m_proto->m_vkOptions.iInvisibleInterval);
+
+ CreateLink(m_cbUseNonStandardNotifications, m_proto->m_vkOptions.bUseNonStandardNotifications);
+ CreateLink(m_cbUseNonStandardUrlEncode, m_proto->m_vkOptions.bUseNonStandardUrlEncode);
+ CreateLink(m_cbReportAbuse, m_proto->m_vkOptions.bReportAbuse);
+ CreateLink(m_cbClearServerHistory, m_proto->m_vkOptions.bClearServerHistory);
+ CreateLink(m_cbRemoveFromFrendlist, m_proto->m_vkOptions.bRemoveFromFrendlist);
+ CreateLink(m_cbRemoveFromCList, m_proto->m_vkOptions.bRemoveFromCList);
+
+ CreateLink(m_edtReturnChatMessage, "ReturnChatMessage", TranslateT("I\'m back"));
+}
+
+void CVkOptionAdvancedForm::OnInitDialog()
+{
+
+ m_cbMusicSendOff.SetState(m_proto->m_vkOptions.iMusicSendMetod == MusicSendMetod::sendNone);
+ m_cbMusicSendBroadcastAndStatus.SetState(m_proto->m_vkOptions.iMusicSendMetod == MusicSendMetod::sendBroadcastAndStatus);
+ m_cbSendMetodBroadcast.SetState(m_proto->m_vkOptions.iMusicSendMetod == MusicSendMetod::sendBroadcastOnly);
+ m_cbMusicSendStatus.SetState(m_proto->m_vkOptions.iMusicSendMetod == MusicSendMetod::sendStatusOnly);
+
+ m_spInvInterval.SendMsg(UDM_SETRANGE, 0, MAKELONG(60, 0));
+ m_spInvInterval.SendMsg(UDM_SETPOS, 0, m_proto->m_vkOptions.iInvisibleInterval);
+}
+
+void CVkOptionAdvancedForm::OnApply()
+{
+ if (m_cbMusicSendOff.GetState())
+ m_proto->m_vkOptions.iMusicSendMetod = MusicSendMetod::sendNone;
+ if (m_cbMusicSendBroadcastAndStatus.GetState())
+ m_proto->m_vkOptions.iMusicSendMetod = MusicSendMetod::sendBroadcastAndStatus;
+ if (m_cbSendMetodBroadcast.GetState())
+ m_proto->m_vkOptions.iMusicSendMetod = MusicSendMetod::sendBroadcastOnly;
+ if (m_cbMusicSendStatus.GetState())
+ m_proto->m_vkOptions.iMusicSendMetod = MusicSendMetod::sendStatusOnly;
+
+ m_proto->m_vkOptions.ptszReturnChatMessage = m_edtReturnChatMessage.GetText();
+}
+
+////////////////////// News and notifications ////////////////////////////////
+
+CVkOptionFeedsForm::CVkOptionFeedsForm(CVkProto *proto):
+ CVkDlgBase(proto, IDD_OPT_FEEDS, false),
+ m_cbNewsEnabled(this, IDC_NEWS_ENBL),
+ m_edtNewsInterval(this, IDC_ED_INT_NEWS),
+ m_spNewsInterval(this, IDC_SPIN_INT_NEWS),
+ m_cbNotificationsEnabled(this, IDC_NOTIF_ENBL),
+ m_edtNotificationsInterval(this, IDC_ED_INT_NOTIF),
+ m_spNotificationsInterval(this, IDC_SPIN_INT_NOTIF),
+ m_cbNotificationsMarkAsViewed(this, IDC_NOTIF_MARK_VIEWED),
+ m_cbSpecialContactAlwaysEnabled(this, IDC_SPEC_CONT_ENBL),
+ m_cbNewsAutoClearHistory(this, IDC_NEWSAUTOCLEAR),
+ m_cbNewsFilterPosts(this, IDC_F_POSTS),
+ m_cbNewsFilterPhotos(this, IDC_F_PHOTOS),
+ m_cbNewsFilterTags(this, IDC_F_TAGS),
+ m_cbNewsFilterWallPhotos(this, IDC_F_WALLPHOTOS),
+ m_cbNewsSourceFriends(this, IDC_S_FRIENDS),
+ m_cbNewsSourceGroups(this, IDC_S_GROUPS),
+ m_cbNewsSourcePages(this, IDC_S_PAGES),
+ m_cbNewsSourceFollowing(this, IDC_S_FOLLOWING),
+ m_cbNewsSourceIncludeBanned(this, IDC_S_BANNED),
+ m_cbNewsSourceNoReposts(this, IDC_S_NOREPOSTES),
+ m_cbNotificationFilterComments(this, IDC_N_COMMENTS),
+ m_cbNotificationFilterLikes(this, IDC_N_LIKES),
+ m_cbNotificationFilterReposts(this, IDC_N_REPOSTS),
+ m_cbNotificationFilterMentions(this, IDC_N_MENTIONS),
+ m_cbNotificationFilterInvites(this, IDC_N_INVITES)
+{
+ CreateLink(m_cbNewsEnabled, m_proto->m_vkOptions.bNewsEnabled);
+ CreateLink(m_edtNewsInterval, m_proto->m_vkOptions.iNewsInterval);
+ CreateLink(m_cbNotificationsEnabled, m_proto->m_vkOptions.bNotificationsEnabled);
+ CreateLink(m_edtNotificationsInterval, m_proto->m_vkOptions.iNotificationsInterval);
+ CreateLink(m_cbNotificationsMarkAsViewed, m_proto->m_vkOptions.bNotificationsMarkAsViewed);
+ CreateLink(m_cbSpecialContactAlwaysEnabled, m_proto->m_vkOptions.bSpecialContactAlwaysEnabled);
+ CreateLink(m_cbNewsAutoClearHistory, m_proto->m_vkOptions.bNewsAutoClearHistory);
+ CreateLink(m_cbNewsFilterPosts, m_proto->m_vkOptions.bNewsFilterPosts);
+ CreateLink(m_cbNewsFilterPhotos, m_proto->m_vkOptions.bNewsFilterPhotos);
+ CreateLink(m_cbNewsFilterTags, m_proto->m_vkOptions.bNewsFilterTags);
+ CreateLink(m_cbNewsFilterWallPhotos, m_proto->m_vkOptions.bNewsFilterWallPhotos);
+ CreateLink(m_cbNewsSourceFriends, m_proto->m_vkOptions.bNewsSourceFriends);
+ CreateLink(m_cbNewsSourceGroups, m_proto->m_vkOptions.bNewsSourceGroups);
+ CreateLink(m_cbNewsSourcePages, m_proto->m_vkOptions.bNewsSourcePages);
+ CreateLink(m_cbNewsSourceFollowing, m_proto->m_vkOptions.bNewsSourceFollowing);
+ CreateLink(m_cbNewsSourceIncludeBanned, m_proto->m_vkOptions.bNewsSourceIncludeBanned);
+ CreateLink(m_cbNewsSourceNoReposts, m_proto->m_vkOptions.bNewsSourceNoReposts);
+ CreateLink(m_cbNotificationFilterComments, m_proto->m_vkOptions.bNotificationFilterComments);
+ CreateLink(m_cbNotificationFilterLikes, m_proto->m_vkOptions.bNotificationFilterLikes);
+ CreateLink(m_cbNotificationFilterReposts, m_proto->m_vkOptions.bNotificationFilterReposts);
+ CreateLink(m_cbNotificationFilterMentions, m_proto->m_vkOptions.bNotificationFilterMentions);
+ CreateLink(m_cbNotificationFilterInvites, m_proto->m_vkOptions.bNotificationFilterInvites);
+
+ m_cbNewsEnabled.OnChange = Callback(this, &CVkOptionFeedsForm::On_cbNewsEnabledChange);
+ m_cbNotificationsEnabled.OnChange = Callback(this, &CVkOptionFeedsForm::On_cbNotificationsEnabledChange);
+
+}
+
+void CVkOptionFeedsForm::OnInitDialog()
+{
+ m_spNewsInterval.SendMsg(UDM_SETRANGE, 0, MAKELONG(60 * 24, 1));
+ m_spNewsInterval.SendMsg(UDM_SETPOS, 0, m_proto->m_vkOptions.iNewsInterval);
+
+ m_spNotificationsInterval.SendMsg(UDM_SETRANGE, 0, MAKELONG(60 * 24, 1));
+ m_spNotificationsInterval.SendMsg(UDM_SETPOS, 0, m_proto->m_vkOptions.iNotificationsInterval);
+
+ On_cbNewsEnabledChange(&m_cbNewsEnabled);
+ On_cbNotificationsEnabledChange(&m_cbNotificationsEnabled);
+}
+
+void CVkOptionFeedsForm::On_cbNewsEnabledChange(CCtrlCheck*)
+{
+ bool bState = m_cbNewsEnabled.GetState() != 0;
+
+ m_edtNewsInterval.Enable(bState);
+ m_spNewsInterval.Enable(bState);
+ m_cbNewsFilterPosts.Enable(bState);
+ m_cbNewsFilterPhotos.Enable(bState);
+ m_cbNewsFilterTags.Enable(bState);
+ m_cbNewsFilterWallPhotos.Enable(bState);
+ m_cbNewsSourceFriends.Enable(bState);
+ m_cbNewsSourceGroups.Enable(bState);
+ m_cbNewsSourcePages.Enable(bState);
+ m_cbNewsSourceFollowing.Enable(bState);
+ m_cbNewsSourceIncludeBanned.Enable(bState);
+ m_cbNewsSourceNoReposts.Enable(bState);
+
+}
+
+void CVkOptionFeedsForm::On_cbNotificationsEnabledChange(CCtrlCheck*)
+{
+ bool bState = m_cbNotificationsEnabled.GetState() != 0;
+
+ m_cbNotificationsMarkAsViewed.Enable(bState);
+ m_edtNotificationsInterval.Enable(bState);
+ m_spNotificationsInterval.Enable(bState);
+ m_cbNotificationFilterComments.Enable(bState);
+ m_cbNotificationFilterLikes.Enable(bState);
+ m_cbNotificationFilterReposts.Enable(bState);
+ m_cbNotificationFilterMentions.Enable(bState);
+ m_cbNotificationFilterInvites.Enable(bState);
+}
+
+////////////////////// View page /////////////////////////////////////////////
+
+CVkOptionViewForm::CVkOptionViewForm(CVkProto *proto):
+ CVkDlgBase(proto, IDD_OPT_VIEW, false),
+ m_cbIMGBBCSupportOff(this, IDC_IMG_OFF),
+ m_cbIMGBBCSupportFullSize(this, IDC_IMG_FULLSIZE),
+ m_cbIMGBBCSupport130(this, IDC_IMG_130),
+ m_cbIMGBBCSupport604(this, IDC_IMG_604),
+ m_cbBBCForNewsOff(this, IDC_NEWSBBC_OFF),
+ m_cbBBCForNewsBasic(this, IDC_NEWSBBC_BASIC),
+ m_cbBBCForNewsAdvanced(this, IDC_NEWSBBC_ADV),
+ m_cbUseBBCOnAttacmentsAsNews(this, IDC_BBC_ATT_NEWS),
+ m_cbBBCForAttachmentsOff(this, IDC_ATTBBC_OFF),
+ m_cbBBCForAttachmentsBasic(this, IDC_ATTBBC_BASIC),
+ m_cbBBCForAttachmentsAdvanced(this, IDC_ATTBBC_ADV),
+ m_cbStikersAsSmyles(this, IDC_STICKERS_AS_SMYLES),
+ m_cbShortenLinksForAudio(this, IDC_SHOTEN_LINKS_FOR_AUDIO),
+ m_proto(proto)
+{
+ CreateLink(m_cbUseBBCOnAttacmentsAsNews, m_proto->m_vkOptions.bUseBBCOnAttacmentsAsNews);
+ CreateLink(m_cbStikersAsSmyles, m_proto->m_vkOptions.bStikersAsSmyles);
+ CreateLink(m_cbShortenLinksForAudio, m_proto->m_vkOptions.bShortenLinksForAudio);
+}
+
+void CVkOptionViewForm::OnInitDialog()
+{
+ m_cbIMGBBCSupportOff.SetState(m_proto->m_vkOptions.iIMGBBCSupport == IMGBBCSypport::imgNo);
+ m_cbIMGBBCSupportFullSize.SetState(m_proto->m_vkOptions.iIMGBBCSupport == IMGBBCSypport::imgFullSize);
+ m_cbIMGBBCSupport130.SetState(m_proto->m_vkOptions.iIMGBBCSupport == IMGBBCSypport::imgPreview130);
+ m_cbIMGBBCSupport604.SetState(m_proto->m_vkOptions.iIMGBBCSupport == IMGBBCSypport::imgPreview604);
+
+ m_cbBBCForNewsOff.SetState(m_proto->m_vkOptions.iBBCForNews == BBCSupport::bbcNo);
+ m_cbBBCForNewsBasic.SetState(m_proto->m_vkOptions.iBBCForNews == BBCSupport::bbcBasic);
+ m_cbBBCForNewsAdvanced.SetState(m_proto->m_vkOptions.iBBCForNews == BBCSupport::bbcAdvanced);
+
+ m_cbBBCForAttachmentsOff.SetState(m_proto->m_vkOptions.iBBCForAttachments == BBCSupport::bbcNo);
+ m_cbBBCForAttachmentsBasic.SetState(m_proto->m_vkOptions.iBBCForAttachments == BBCSupport::bbcBasic);
+ m_cbBBCForAttachmentsAdvanced.SetState(m_proto->m_vkOptions.iBBCForAttachments == BBCSupport::bbcAdvanced);
+}
+
+void CVkOptionViewForm::OnApply()
+{
+ if (m_cbIMGBBCSupportOff.GetState())
+ m_proto->m_vkOptions.iIMGBBCSupport = IMGBBCSypport::imgNo;
+ if (m_cbIMGBBCSupportFullSize.GetState())
+ m_proto->m_vkOptions.iIMGBBCSupport = IMGBBCSypport::imgFullSize;
+ if (m_cbIMGBBCSupport130.GetState())
+ m_proto->m_vkOptions.iIMGBBCSupport = IMGBBCSypport::imgPreview130;
+ if (m_cbIMGBBCSupport604.GetState())
+ m_proto->m_vkOptions.iIMGBBCSupport = IMGBBCSypport::imgPreview604;
+
+ if (m_cbBBCForNewsOff.GetState())
+ m_proto->m_vkOptions.iBBCForNews = BBCSupport::bbcNo;
+ if (m_cbBBCForNewsBasic.GetState())
+ m_proto->m_vkOptions.iBBCForNews = BBCSupport::bbcBasic;
+ if (m_cbBBCForNewsAdvanced.GetState())
+ m_proto->m_vkOptions.iBBCForNews = BBCSupport::bbcAdvanced;
+
+ if (m_cbBBCForAttachmentsOff.GetState())
+ m_proto->m_vkOptions.iBBCForAttachments = BBCSupport::bbcNo;
+ if (m_cbBBCForAttachmentsBasic.GetState())
+ m_proto->m_vkOptions.iBBCForAttachments = BBCSupport::bbcBasic;
+ if (m_cbBBCForAttachmentsAdvanced.GetState())
+ m_proto->m_vkOptions.iBBCForAttachments = BBCSupport::bbcAdvanced;
+}
+
diff --git a/protocols/VKontakte/src/vk_options.h b/protocols/VKontakte/src/vk_options.h new file mode 100644 index 0000000000..1d024b0137 --- /dev/null +++ b/protocols/VKontakte/src/vk_options.h @@ -0,0 +1,183 @@ +/*
+Copyright (c) 2013-16 Miranda NG project (http://miranda-ng.org)
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation version 2
+of the License.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "stdafx.h"
+#pragma once
+
+typedef CProtoDlgBase<CVkProto> CVkDlgBase;
+
+////////////////////// Account manager dialog ////////////////////////////////
+
+class CVkAccMgrForm : public CVkDlgBase
+{
+ typedef CVkDlgBase CSuper;
+
+ CCtrlEdit m_edtLogin;
+ CCtrlEdit m_edtPassword;
+ CCtrlHyperlink m_hlLink;
+
+ CVkProto *m_proto;
+
+ pass_ptrT m_ptszOldPass;
+ ptrT m_ptszOldLogin;
+
+public:
+ CVkAccMgrForm(CVkProto *proto, HWND hwndParent);
+ void OnInitDialog();
+ void OnApply();
+};
+
+////////////////////// Account page //////////////////////////////////////////
+
+class CVkOptionAccountForm : public CVkDlgBase
+{
+ CCtrlEdit m_edtLogin;
+ CCtrlEdit m_edtPassword;
+ CCtrlHyperlink m_hlLink;
+ CCtrlEdit m_edtGroupName;
+ CCtrlCombo m_cbxVKLang;
+ CCtrlCheck m_cbDelivery;
+ CCtrlCheck m_cbUseLocalTime;
+ CCtrlCheck m_cbAutoClean;
+ CCtrlCheck m_cbMarkMessageOnRead;
+ CCtrlCheck m_cbMarkMessageOnReceive;
+ CCtrlCheck m_cbMarkMessageOnReply;
+ CCtrlCheck m_cbMarkMessageOnTyping;
+ CCtrlCheck m_cbSyncHistoryOff;
+ CCtrlCheck m_cbSyncHistoryAuto;
+ CCtrlCheck m_cbSyncHistoryForLast1Day;
+ CCtrlCheck m_cbSyncHistoryForLast3Day;
+
+ CVkProto *m_proto;
+
+ pass_ptrT m_ptszOldPass;
+ ptrT m_ptszOldLogin;
+ ptrT m_ptszOldGroup;
+
+public:
+ CVkOptionAccountForm(CVkProto *proto);
+ void OnInitDialog();
+ void OnApply();
+};
+
+////////////////////// Advanced page /////////////////////////////////////////
+
+class CVkOptionAdvancedForm : public CVkDlgBase
+{
+ CCtrlCheck m_cbHideChats;
+ CCtrlCheck m_cbSyncReadMessageStatusFromServer;
+ CCtrlCheck m_cbMesAsUnread;
+
+ CCtrlEdit m_edtInvInterval;
+ CCtrlButton m_spInvInterval;
+
+ CCtrlCheck m_cbUseNonStandardNotifications;
+ CCtrlCheck m_cbUseNonStandardUrlEncode;
+
+ CCtrlCheck m_cbReportAbuse;
+ CCtrlCheck m_cbClearServerHistory;
+ CCtrlCheck m_cbRemoveFromFrendlist;
+ CCtrlCheck m_cbRemoveFromCList;
+
+ CCtrlCheck m_cbMusicSendOff;
+ CCtrlCheck m_cbMusicSendBroadcastAndStatus;
+ CCtrlCheck m_cbSendMetodBroadcast;
+ CCtrlCheck m_cbMusicSendStatus;
+
+ CCtrlEdit m_edtReturnChatMessage;
+
+ CVkProto *m_proto;
+
+public:
+ CVkOptionAdvancedForm(CVkProto *proto);
+ void OnInitDialog();
+ void OnApply();
+};
+
+////////////////////// News and notifications ////////////////////////////////
+
+class CVkOptionFeedsForm : public CVkDlgBase
+{
+ CCtrlCheck m_cbNewsEnabled;
+
+ CCtrlEdit m_edtNewsInterval;
+ CCtrlButton m_spNewsInterval;
+
+ CCtrlCheck m_cbNotificationsEnabled;
+
+ CCtrlEdit m_edtNotificationsInterval;
+ CCtrlButton m_spNotificationsInterval;
+
+ CCtrlCheck m_cbNotificationsMarkAsViewed;
+ CCtrlCheck m_cbSpecialContactAlwaysEnabled;
+ CCtrlCheck m_cbNewsAutoClearHistory;
+
+ CCtrlCheck m_cbNewsFilterPosts;
+ CCtrlCheck m_cbNewsFilterPhotos;
+ CCtrlCheck m_cbNewsFilterTags;
+ CCtrlCheck m_cbNewsFilterWallPhotos;
+
+ CCtrlCheck m_cbNewsSourceFriends;
+ CCtrlCheck m_cbNewsSourceGroups;
+ CCtrlCheck m_cbNewsSourcePages;
+ CCtrlCheck m_cbNewsSourceFollowing;
+ CCtrlCheck m_cbNewsSourceIncludeBanned;
+ CCtrlCheck m_cbNewsSourceNoReposts;
+
+ CCtrlCheck m_cbNotificationFilterComments;
+ CCtrlCheck m_cbNotificationFilterLikes;
+ CCtrlCheck m_cbNotificationFilterReposts;
+ CCtrlCheck m_cbNotificationFilterMentions;
+ CCtrlCheck m_cbNotificationFilterInvites;
+
+public:
+ CVkOptionFeedsForm(CVkProto *proto);
+ void OnInitDialog();
+
+ void On_cbNewsEnabledChange(CCtrlCheck*);
+ void On_cbNotificationsEnabledChange(CCtrlCheck*);
+};
+
+////////////////////// View page /////////////////////////////////////////////
+
+class CVkOptionViewForm : public CVkDlgBase
+{
+ CCtrlCheck m_cbIMGBBCSupportOff;
+ CCtrlCheck m_cbIMGBBCSupportFullSize;
+ CCtrlCheck m_cbIMGBBCSupport130;
+ CCtrlCheck m_cbIMGBBCSupport604;
+
+ CCtrlCheck m_cbBBCForNewsOff;
+ CCtrlCheck m_cbBBCForNewsBasic;
+ CCtrlCheck m_cbBBCForNewsAdvanced;
+
+ CCtrlCheck m_cbUseBBCOnAttacmentsAsNews;
+
+ CCtrlCheck m_cbBBCForAttachmentsOff;
+ CCtrlCheck m_cbBBCForAttachmentsBasic;
+ CCtrlCheck m_cbBBCForAttachmentsAdvanced;
+
+ CCtrlCheck m_cbStikersAsSmyles;
+ CCtrlCheck m_cbShortenLinksForAudio;
+
+ CVkProto *m_proto;
+
+public:
+ CVkOptionViewForm(CVkProto *proto);
+ void OnInitDialog();
+ void OnApply();
+};
\ No newline at end of file diff --git a/protocols/VKontakte/src/vk_pollserver.cpp b/protocols/VKontakte/src/vk_pollserver.cpp index 1c28865d9f..143b1e7191 100644 --- a/protocols/VKontakte/src/vk_pollserver.cpp +++ b/protocols/VKontakte/src/vk_pollserver.cpp @@ -92,9 +92,9 @@ void CVkProto::PollUpdates(const JSONNode &jnUpdates) }
else
SetSrmmReadStatus(hContact);
- if (m_bUserForceOnlineOnActivity)
+ if (m_vkOptions.bUserForceOnlineOnActivity)
SetInvisible(hContact);
- if (m_bSyncReadMessageStatusFromServer)
+ if (m_vkOptions.bSyncReadMessageStatusFromServer)
MarkDialogAsRead(hContact);
}
break;
@@ -123,14 +123,14 @@ void CVkProto::PollUpdates(const JSONNode &jnUpdates) }
else
SetSrmmReadStatus(hContact);
- if (m_bUserForceOnlineOnActivity)
+ if (m_vkOptions.bUserForceOnlineOnActivity)
SetInvisible(hContact);
}
break;
case VKPOLL_READ_ALL_IN:
uid = jnChild[1].as_int();
hContact = FindUser(uid);
- if (hContact != NULL && m_bSyncReadMessageStatusFromServer)
+ if (hContact != NULL && m_vkOptions.bSyncReadMessageStatusFromServer)
MarkDialogAsRead(hContact);
break;
@@ -157,7 +157,7 @@ void CVkProto::PollUpdates(const JSONNode &jnUpdates) hContact = FindUser(uid);
if (hContact != NULL) {
ForkThread(&CVkProto::ContactTypingThread, (void *)hContact);
- if (m_bUserForceOnlineOnActivity)
+ if (m_vkOptions.bUserForceOnlineOnActivity)
SetInvisible(hContact);
}
break;
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index 8382ce48e1..f4b87918d7 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -46,7 +46,10 @@ CVkProto::CVkProto(const char *szModuleName, const TCHAR *ptszUserName) : m_bNotifyForEndLoadingHistory(false),
m_bNotifyForEndLoadingHistoryAllContact(false),
m_hAPIConnection(NULL),
- m_pollingConn(NULL)
+ m_pollingConn(NULL),
+ m_bSetBroadcast(false),
+ m_bNeedSendOnline (false),
+ m_vkOptions(this)
{
InitQueue();
@@ -67,83 +70,12 @@ CVkProto::CVkProto(const char *szModuleName, const TCHAR *ptszUserName) : nlu.ptszDescriptiveName = descr;
m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
- m_defaultGroup = getTStringA("ProtoGroup");
- if (m_defaultGroup == NULL)
- m_defaultGroup = mir_tstrdup(_T("VKontakte"));
- Clist_CreateGroup(NULL, m_defaultGroup);
-
- m_bServerDelivery = getBool("ServerDelivery", true);
- m_bHideChats = getBool("HideChats", true);
- m_bMesAsUnread = getBool("MesAsUnread");
- m_bUseLocalTime = getBool("UseLocalTime");
- m_bReportAbuse = getBool("ReportAbuseOnBanUser");
- m_bClearServerHistory = getBool("ClearServerHistoryOnBanUser");
- m_bRemoveFromFrendlist = getBool("RemoveFromFrendlistOnBanUser");
- m_bRemoveFromClist = getBool("RemoveFromClistOnBanUser");
- m_bPopUpSyncHistory = getBool("PopUpSyncHistory");
- m_iMarkMessageReadOn = (MarkMsgReadOn)getByte("MarkMessageReadOn", markOnRead);
- m_bStikersAsSmyles = getBool("StikersAsSmyles");
- m_bUserForceOnlineOnActivity = getBool("UserForceOnlineOnActivity");
- m_iMusicSendMetod = (MusicSendMetod)getByte("MusicSendMetod", sendBroadcastOnly);
- m_iSyncHistoryMetod = (SyncHistoryMetod)getByte("SyncHistoryMetod", syncOff);
- CMStringA szListeningTo(m_szModuleName);
- szListeningTo += "Enabled";
- db_set_b(NULL, "ListeningTo", szListeningTo, m_iMusicSendMetod == 0 ? 0 : 1);
-
- m_bNewsEnabled = getBool("NewsEnabled");
- m_iMaxLoadNewsPhoto = getByte("MaxLoadNewsPhoto", 5);
- m_bNotificationsEnabled = getBool("NotificationsEnabled");
- m_bNotificationsMarkAsViewed = getBool("NotificationsMarkAsViewed", true);
- m_bSpecialContactAlwaysEnabled = getBool("SpecialContactAlwaysEnabled");
- m_iNewsInterval = getDword("NewsInterval", 15);
- m_iNotificationsInterval = getDword("NotificationsInterval", 1);
- m_iIMGBBCSupport = (IMGBBCSypport)getByte("IMGBBCSupport", imgNo);
- m_iBBCForNews = (BBCSupport)getByte("BBCForNews", bbcBasic);
- m_iBBCForAttachments = (BBCSupport)getByte("BBCForAttachments", bbcBasic);
- m_bUseBBCOnAttacmentsAsNews = getBool("UseBBCOnAttacmentsAsNews", true);
- m_bNewsAutoClearHistory = getBool("NewsAutoClearHistory");
- m_iNewsAutoClearHistoryInterval = getDword("NewsAutoClearHistoryInterval", 60*60*24*3);
-
- m_bNewsFilterPosts = getBool("NewsFilterPosts", true);
- m_bNewsFilterPhotos = getBool("NewsFilterPhotos", true);
- m_bNewsFilterTags = getBool("NewsFilterTags", true);
- m_bNewsFilterWallPhotos = getBool("NewsFilterWallPhotos", true);
- m_bNewsSourceFriends = getBool("NewsSourceFriends", true);
- m_bNewsSourceGroups = getBool("NewsSourceGroups", true);
- m_bNewsSourcePages = getBool("NewsSourcePages", true);
- m_bNewsSourceFollowing = getBool("NewsSourceFollowing", true);
- m_bNewsSourceIncludeBanned = getBool("NewsSourceIncludeBanned");
- m_bNewsSourceNoReposts = getBool("NewsSourceNoReposts");
-
- m_bNotificationFilterComments = getBool("NotificationFilterComments", true);
- m_bNotificationFilterLikes = getBool("NotificationFilterLikes", true);
- m_bNotificationFilterReposts = getBool("NotificationFilterReposts", true);
- m_bNotificationFilterMentions = getBool("NotificationFilterMentions", true);
- m_bNotificationFilterInvites = getBool("NotificationFilterInvites", true);
-
- m_bUseNonStandardNotifications = getBool("UseNonStandardNotifications", false);
-
- m_bUseNonStandardUrlEncode = getBool("UseNonStandardUrlEncode", true);
- m_iInvisibleInterval = getDword("InvisibleInterval", 10);
-
- m_bShortenLinksForAudio = getBool("ShortenLinksForAudio", true);
-
- m_bSplitFormatFwdMsg = getBool("SplitFormatFwdMsg", true);
-
- m_bSyncReadMessageStatusFromServer = getBool("SyncReadMessageStatusFromServer", false);
- m_bLoadFullCList = getBool("LoadFullCList", false);
-
- m_bSetBroadcast = false;
- m_bNeedSendOnline = false;
- delSetting("InviteGroupIds");
+ Clist_CreateGroup(NULL, m_vkOptions.ptszDefaultGroup);
- m_ReturnChatMessage = getTStringA("ReturnChatMessage");
- if (m_ReturnChatMessage == NULL)
- m_ReturnChatMessage = mir_tstrdup(TranslateT("I'm back"));
+ CMStringA szListeningTo(FORMAT, "%sEnabled", m_szModuleName);
+ db_set_b(NULL, "ListeningTo", szListeningTo, m_vkOptions.iMusicSendMetod == 0 ? 0 : 1);
- m_VKLang = getTStringA("VKLang");
-
- m_iMaxFriendsCount = getDword("MaxFriendsCount", 1000);
+ delSetting("InviteGroupIds");
// Set all contacts offline -- in case we crashed
SetAllContactStatuses(ID_STATUS_OFFLINE);
@@ -233,49 +165,49 @@ void CVkProto::InitMenus() mi.hIcolibItem = Skin_GetIconHandle(SKINICON_CHAT_JOIN);
mi.name.a = LPGEN("Create new chat");
SET_UID(mi, 0xc217748d, 0x7218, 0x4a62, 0xab, 0x37, 0x9, 0x58, 0x6a, 0x88, 0x71, 0x3e);
- g_hProtoMenuItems[PMI_CREATECHAT] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
+ m_hProtoMenuItems[PMI_CREATECHAT] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
mi.pszService = PS_SETSTATUSMSG;
mi.position = 10009 + PMI_SETSTATUSMSG;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_STATUS));
mi.name.a = LPGEN("Status message");
SET_UID(mi, 0x696bd932, 0xeee4, 0x4c4c, 0xa6, 0xf8, 0xb3, 0x72, 0xdf, 0xc6, 0xfa, 0xd1);
- g_hProtoMenuItems[PMI_SETSTATUSMSG] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
+ m_hProtoMenuItems[PMI_SETSTATUSMSG] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
mi.pszService = PS_WALLPOST;
mi.position = 10009 + PMI_WALLPOST;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_WALL));
mi.name.a = LPGEN("Send message to my wall");
SET_UID(mi, 0x50a80044, 0xdddd, 0x47e6, 0x9e, 0x90, 0x32, 0x7b, 0x88, 0x13, 0x21, 0x4e);
- g_hProtoMenuItems[PMI_WALLPOST] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
+ m_hProtoMenuItems[PMI_WALLPOST] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
mi.pszService = PS_LOADVKNEWS;
mi.position = 10009 + PMI_LOADVKNEWS;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_NOTIFICATION));
mi.name.a = LPGEN("Load news from VK");
SET_UID(mi, 0x7c449456, 0xb731, 0x48cc, 0x9c, 0x4e, 0x20, 0xe4, 0x66, 0x7a, 0x16, 0x23);
- g_hProtoMenuItems[PMI_LOADVKNEWS] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
+ m_hProtoMenuItems[PMI_LOADVKNEWS] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
mi.pszService = PS_GETALLSERVERHISTORY;
mi.position = 10009 + PMI_GETALLSERVERHISTORY;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_HISTORY));
mi.name.a = LPGEN("Load history for all contacts from VK");
SET_UID(mi, 0xe5028605, 0x92eb, 0x4956, 0xa0, 0xd0, 0x53, 0xb, 0x11, 0x44, 0x8f, 0x14);
- g_hProtoMenuItems[PMI_GETALLSERVERHISTORY] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
+ m_hProtoMenuItems[PMI_GETALLSERVERHISTORY] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
mi.pszService = PS_WIPENONFRIENDS;
mi.position = 10009 + PMI_WIPENONFRIENDS;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_FRIENDDEL));
mi.name.a = LPGEN("Wipe contacts missing in friend list");
SET_UID(mi, 0xcfe99159, 0xf237, 0x4546, 0x80, 0x3e, 0x51, 0x88, 0x26, 0x55, 0xdc, 0x5f);
- g_hProtoMenuItems[PMI_WIPENONFRIENDS] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
+ m_hProtoMenuItems[PMI_WIPENONFRIENDS] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
mi.pszService = PS_VISITPROFILE;
mi.position = 10009 + PMI_VISITPROFILE;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_VISITPROFILE));
mi.name.a = LPGEN("Visit profile");
SET_UID(mi, 0x9550515e, 0x2a45, 0x4913, 0x95, 0x1a, 0x1e, 0xfa, 0x7, 0xc6, 0x2d, 0x60);
- g_hProtoMenuItems[PMI_VISITPROFILE] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
+ m_hProtoMenuItems[PMI_VISITPROFILE] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
// Contact Menu Items
mi.root = NULL;
@@ -285,70 +217,70 @@ void CVkProto::InitMenus() mi.position = -200001000 + CMI_VISITPROFILE;
mi.name.t = LPGENT("Visit profile");
SET_UID(mi, 0x828cc50e, 0x398d, 0x43a2, 0xbf, 0xd3, 0xa9, 0x96, 0x47, 0x9d, 0x52, 0xff);
- g_hContactMenuItems[CMI_VISITPROFILE] = Menu_AddContactMenuItem(&mi, m_szModuleName);
+ m_hContactMenuItems[CMI_VISITPROFILE] = Menu_AddContactMenuItem(&mi, m_szModuleName);
mi.pszService = PS_MARKMESSAGESASREAD;
mi.position = -200001000 + CMI_MARKMESSAGESASREAD;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_MARKMESSAGESASREAD));
mi.name.t = LPGENT("Mark messages as read");
SET_UID(mi, 0x2587a649, 0xe5d5, 0x4e90, 0x8b, 0x35, 0x81, 0x4c, 0xb1, 0x5, 0x94, 0x7);
- g_hContactMenuItems[CMI_MARKMESSAGESASREAD] = Menu_AddContactMenuItem(&mi, m_szModuleName);
+ m_hContactMenuItems[CMI_MARKMESSAGESASREAD] = Menu_AddContactMenuItem(&mi, m_szModuleName);
mi.pszService = PS_WALLPOST;
mi.position = -200001000 + CMI_WALLPOST;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_WALL));
mi.name.t = LPGENT("Send message to user\'s wall");
SET_UID(mi, 0xd8841aaf, 0x15f6, 0x4be9, 0x9f, 0x4f, 0x16, 0xa9, 0x47, 0x6a, 0x19, 0x81);
- g_hContactMenuItems[CMI_WALLPOST] = Menu_AddContactMenuItem(&mi, m_szModuleName);
+ m_hContactMenuItems[CMI_WALLPOST] = Menu_AddContactMenuItem(&mi, m_szModuleName);
mi.pszService = PS_ADDASFRIEND;
mi.position = -200001000 + CMI_ADDASFRIEND;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_FRIENDADD));
mi.name.t = LPGENT("Add as friend");
SET_UID(mi, 0xf11b9a7f, 0x569, 0x4023, 0xb0, 0xd6, 0xa3, 0x16, 0xf6, 0xd4, 0xfb, 0xb5);
- g_hContactMenuItems[CMI_ADDASFRIEND] = Menu_AddContactMenuItem(&mi, m_szModuleName);
+ m_hContactMenuItems[CMI_ADDASFRIEND] = Menu_AddContactMenuItem(&mi, m_szModuleName);
mi.pszService = PS_DELETEFRIEND;
mi.position = -200001000 + CMI_DELETEFRIEND;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_FRIENDDEL));
mi.name.t = LPGENT("Delete from friend list");
SET_UID(mi, 0x1e26514, 0x854f, 0x4e60, 0x8c, 0xf8, 0xab, 0xaa, 0xe0, 0xc3, 0xa5, 0xa7);
- g_hContactMenuItems[CMI_DELETEFRIEND] = Menu_AddContactMenuItem(&mi, m_szModuleName);
+ m_hContactMenuItems[CMI_DELETEFRIEND] = Menu_AddContactMenuItem(&mi, m_szModuleName);
mi.pszService = PS_BANUSER;
mi.position = -200001000 + CMI_BANUSER;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_BAN));
mi.name.t = LPGENT("Ban user");
SET_UID(mi, 0x7ba06bab, 0xf770, 0x4938, 0x9c, 0x76, 0xef, 0x40, 0xbc, 0x55, 0x0, 0x9b);
- g_hContactMenuItems[CMI_BANUSER] = Menu_AddContactMenuItem(&mi, m_szModuleName);
+ m_hContactMenuItems[CMI_BANUSER] = Menu_AddContactMenuItem(&mi, m_szModuleName);
mi.pszService = PS_REPORTABUSE;
mi.position = -200001000 + CMI_REPORTABUSE;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_ABUSE));
mi.name.t = LPGENT("Report abuse");
SET_UID(mi, 0x56454cb9, 0xd80, 0x4050, 0xbe, 0xfc, 0x2c, 0xf6, 0x10, 0x2a, 0x7d, 0x19);
- g_hContactMenuItems[CMI_REPORTABUSE] = Menu_AddContactMenuItem(&mi, m_szModuleName);
+ m_hContactMenuItems[CMI_REPORTABUSE] = Menu_AddContactMenuItem(&mi, m_szModuleName);
mi.pszService = PS_DESTROYKICKCHAT;
mi.position = -200001000 + CMI_DESTROYKICKCHAT;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_FRIENDDEL));
mi.name.t = LPGENT("Destroy room");
SET_UID(mi, 0x4fa6e75a, 0x30cd, 0x4482, 0xae, 0x8f, 0x0, 0x38, 0xd0, 0x17, 0x33, 0xcd);
- g_hContactMenuItems[CMI_DESTROYKICKCHAT] = Menu_AddContactMenuItem(&mi, m_szModuleName);
+ m_hContactMenuItems[CMI_DESTROYKICKCHAT] = Menu_AddContactMenuItem(&mi, m_szModuleName);
mi.pszService = PS_OPENBROADCAST;
mi.position = -200001000 + CMI_OPENBROADCAST;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_BROADCAST));
mi.name.t = LPGENT("Open broadcast");
SET_UID(mi, 0x85251a06, 0xf734, 0x4985, 0x8c, 0x36, 0x6f, 0x66, 0x46, 0xf9, 0xa0, 0x10);
- g_hContactMenuItems[CMI_OPENBROADCAST] = Menu_AddContactMenuItem(&mi, m_szModuleName);
+ m_hContactMenuItems[CMI_OPENBROADCAST] = Menu_AddContactMenuItem(&mi, m_szModuleName);
mi.pszService = PS_LOADVKNEWS;
mi.position = -200001000 + CMI_LOADVKNEWS;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_NOTIFICATION));
mi.name.t = LPGENT("Load news from VK");
SET_UID(mi, 0xe1f6888b, 0x21ae, 0x409f, 0x82, 0xa2, 0x7b, 0x72, 0xef, 0x47, 0x9, 0xc0);
- g_hContactMenuItems[CMI_LOADVKNEWS] = Menu_AddContactMenuItem(&mi, m_szModuleName);
+ m_hContactMenuItems[CMI_LOADVKNEWS] = Menu_AddContactMenuItem(&mi, m_szModuleName);
// Sync history menu
mi.pszService = PS_GETSERVERHISTORY;
@@ -356,51 +288,51 @@ void CVkProto::InitMenus() mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_HISTORY));
mi.name.t = LPGENT("Reload messages from vk.com...");
SET_UID(mi, 0xc6b59e9f, 0x5250, 0x4146, 0xb6, 0xf3, 0x2d, 0xe1, 0x4, 0x3b, 0x95, 0xf5);
- g_hContactMenuItems[CMI_GETSERVERHISTORY] = Menu_AddContactMenuItem(&mi, m_szModuleName);
+ m_hContactMenuItems[CMI_GETSERVERHISTORY] = Menu_AddContactMenuItem(&mi, m_szModuleName);
- mi.root = g_hContactMenuItems[CMI_GETSERVERHISTORY];
+ mi.root = m_hContactMenuItems[CMI_GETSERVERHISTORY];
mi.pszService = PS_GETSERVERHISTORYLAST1DAY;
mi.position = -200001000 + CMI_GETSERVERHISTORY + 100 + CHMI_GETSERVERHISTORYLAST1DAY;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_HISTORY));
mi.name.t = LPGENT("for last 1 day");
SET_UID(mi, 0x508dce88, 0x1a9a, 0x4dd7, 0x90, 0xf4, 0x41, 0x35, 0x7b, 0xc3, 0x17, 0xed);
- g_hContactHistoryMenuItems[CHMI_GETSERVERHISTORYLAST1DAY] = Menu_AddContactMenuItem(&mi, m_szModuleName);
+ m_hContactHistoryMenuItems[CHMI_GETSERVERHISTORYLAST1DAY] = Menu_AddContactMenuItem(&mi, m_szModuleName);
mi.pszService = PS_GETSERVERHISTORYLAST3DAY;
mi.position = -200001000 + CMI_GETSERVERHISTORY + 100 + CHMI_GETSERVERHISTORYLAST3DAY;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_HISTORY));
mi.name.t = LPGENT("for last 3 days");
SET_UID(mi, 0x9a878764, 0x5bbf, 0x433a, 0xbd, 0x50, 0xa9, 0xb9, 0x16, 0x1f, 0x99, 0x29);
- g_hContactHistoryMenuItems[CHMI_GETSERVERHISTORYLAST3DAY] = Menu_AddContactMenuItem(&mi, m_szModuleName);
+ m_hContactHistoryMenuItems[CHMI_GETSERVERHISTORYLAST3DAY] = Menu_AddContactMenuItem(&mi, m_szModuleName);
mi.pszService = PS_GETSERVERHISTORYLAST7DAY;
mi.position = -200001000 + CMI_GETSERVERHISTORY + 100 + CHMI_GETSERVERHISTORYLAST7DAY;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_HISTORY));
mi.name.t = LPGENT("for last week");
SET_UID(mi, 0xc6482460, 0xd280, 0x4596, 0x97, 0x4b, 0xf7, 0xfa, 0x6d, 0xe, 0xd5, 0xda);
- g_hContactHistoryMenuItems[CHMI_GETSERVERHISTORYLAST7DAY] = Menu_AddContactMenuItem(&mi, m_szModuleName);
+ m_hContactHistoryMenuItems[CHMI_GETSERVERHISTORYLAST7DAY] = Menu_AddContactMenuItem(&mi, m_szModuleName);
mi.pszService = PS_GETSERVERHISTORYLAST30DAY;
mi.position = -200001000 + CMI_GETSERVERHISTORY + 100 + CHMI_GETSERVERHISTORYLAST30DAY;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_HISTORY));
mi.name.t = LPGENT("for last 30 days");
SET_UID(mi, 0xc48e8a9f, 0x2860, 0x4d5b, 0xa8, 0xdf, 0xb8, 0x3f, 0xdf, 0x7b, 0xa2, 0xba);
- g_hContactHistoryMenuItems[CHMI_GETSERVERHISTORYLAST30DAY] = Menu_AddContactMenuItem(&mi, m_szModuleName);
+ m_hContactHistoryMenuItems[CHMI_GETSERVERHISTORYLAST30DAY] = Menu_AddContactMenuItem(&mi, m_szModuleName);
mi.pszService = PS_GETSERVERHISTORYLAST90DAY;
mi.position = -200001000 + CMI_GETSERVERHISTORY + 100 + CHMI_GETSERVERHISTORYLAST90DAY;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_HISTORY));
mi.name.t = LPGENT("for last 90 days");
SET_UID(mi, 0xd8e30530, 0xa585, 0x4672, 0xa6, 0x39, 0x18, 0xc9, 0xc9, 0xcb, 0xc7, 0x7d);
- g_hContactHistoryMenuItems[CHMI_GETSERVERHISTORYLAST90DAY] = Menu_AddContactMenuItem(&mi, m_szModuleName);
+ m_hContactHistoryMenuItems[CHMI_GETSERVERHISTORYLAST90DAY] = Menu_AddContactMenuItem(&mi, m_szModuleName);
mi.pszService = PS_GETALLSERVERHISTORYFORCONTACT;
mi.position = -200001000 + CMI_GETSERVERHISTORY + 100 + CHMI_GETALLSERVERHISTORYFORCONTACT;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_HISTORY));
mi.name.t = LPGENT("for all time");
SET_UID(mi, 0xaee3d02b, 0x3667, 0x47c8, 0x9f, 0x43, 0x14, 0xb7, 0xab, 0x52, 0x14, 0x94);
- g_hContactHistoryMenuItems[CHMI_GETALLSERVERHISTORYFORCONTACT] = Menu_AddContactMenuItem(&mi, m_szModuleName);
+ m_hContactHistoryMenuItems[CHMI_GETALLSERVERHISTORYFORCONTACT] = Menu_AddContactMenuItem(&mi, m_szModuleName);
}
int CVkProto::OnPreBuildContactMenu(WPARAM hContact, LPARAM)
@@ -408,19 +340,19 @@ int CVkProto::OnPreBuildContactMenu(WPARAM hContact, LPARAM) LONG userID = getDword(hContact, "ID", -1);
bool bisFriend = (getBool(hContact, "Auth", true) == 0);
bool bisBroadcast = !(IsEmpty(ptrT(db_get_tsa(hContact, m_szModuleName, "AudioUrl"))));
- Menu_ShowItem(g_hContactMenuItems[CMI_VISITPROFILE], userID != VK_FEED_USER);
- Menu_ShowItem(g_hContactMenuItems[CMI_MARKMESSAGESASREAD], !isChatRoom(hContact) && userID != VK_FEED_USER);
- Menu_ShowItem(g_hContactMenuItems[CMI_WALLPOST], !isChatRoom(hContact));
- Menu_ShowItem(g_hContactMenuItems[CMI_ADDASFRIEND], !bisFriend && !isChatRoom(hContact) && userID != VK_FEED_USER);
- Menu_ShowItem(g_hContactMenuItems[CMI_DELETEFRIEND], bisFriend && userID != VK_FEED_USER);
- Menu_ShowItem(g_hContactMenuItems[CMI_BANUSER], !isChatRoom(hContact) && userID != VK_FEED_USER);
- Menu_ShowItem(g_hContactMenuItems[CMI_REPORTABUSE], !isChatRoom(hContact) && userID != VK_FEED_USER);
- Menu_ShowItem(g_hContactMenuItems[CMI_DESTROYKICKCHAT], isChatRoom(hContact) && getBool(hContact, "off"));
- Menu_ShowItem(g_hContactMenuItems[CMI_OPENBROADCAST], !isChatRoom(hContact) && bisBroadcast);
- Menu_ShowItem(g_hContactMenuItems[CMI_GETSERVERHISTORY], !isChatRoom(hContact) && userID != VK_FEED_USER);
- Menu_ShowItem(g_hContactMenuItems[CMI_LOADVKNEWS], userID == VK_FEED_USER);
+ Menu_ShowItem(m_hContactMenuItems[CMI_VISITPROFILE], userID != VK_FEED_USER);
+ Menu_ShowItem(m_hContactMenuItems[CMI_MARKMESSAGESASREAD], !isChatRoom(hContact) && userID != VK_FEED_USER);
+ Menu_ShowItem(m_hContactMenuItems[CMI_WALLPOST], !isChatRoom(hContact));
+ Menu_ShowItem(m_hContactMenuItems[CMI_ADDASFRIEND], !bisFriend && !isChatRoom(hContact) && userID != VK_FEED_USER);
+ Menu_ShowItem(m_hContactMenuItems[CMI_DELETEFRIEND], bisFriend && userID != VK_FEED_USER);
+ Menu_ShowItem(m_hContactMenuItems[CMI_BANUSER], !isChatRoom(hContact) && userID != VK_FEED_USER);
+ Menu_ShowItem(m_hContactMenuItems[CMI_REPORTABUSE], !isChatRoom(hContact) && userID != VK_FEED_USER);
+ Menu_ShowItem(m_hContactMenuItems[CMI_DESTROYKICKCHAT], isChatRoom(hContact) && getBool(hContact, "off"));
+ Menu_ShowItem(m_hContactMenuItems[CMI_OPENBROADCAST], !isChatRoom(hContact) && bisBroadcast);
+ Menu_ShowItem(m_hContactMenuItems[CMI_GETSERVERHISTORY], !isChatRoom(hContact) && userID != VK_FEED_USER);
+ Menu_ShowItem(m_hContactMenuItems[CMI_LOADVKNEWS], userID == VK_FEED_USER);
for (int i = 0; i < CHMI_COUNT; i++)
- Menu_ShowItem(g_hContactHistoryMenuItems[i], !isChatRoom(hContact) && userID != VK_FEED_USER);
+ Menu_ShowItem(m_hContactHistoryMenuItems[i], !isChatRoom(hContact) && userID != VK_FEED_USER);
return 0;
}
@@ -428,13 +360,13 @@ void CVkProto::UnInitMenus() {
debugLogA("CVkProto::UnInitMenus");
for (int i = 0; i < PMI_COUNT; i++)
- Menu_RemoveItem(g_hProtoMenuItems[i]);
+ Menu_RemoveItem(m_hProtoMenuItems[i]);
for (int i = 0; i < CHMI_COUNT; i++)
- Menu_RemoveItem(g_hContactHistoryMenuItems[i]);
+ Menu_RemoveItem(m_hContactHistoryMenuItems[i]);
for (int i = 0; i < CMI_COUNT; i++)
- Menu_RemoveItem(g_hContactMenuItems[i]);
+ Menu_RemoveItem(m_hContactMenuItems[i]);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -579,7 +511,7 @@ int CVkProto::OnEvent(PROTOEVENTTYPE event, WPARAM wParam, LPARAM lParam) //////////////////////////////////////////////////////////////////////////////
-MCONTACT CVkProto::AddToList(int, PROTOSEARCHRESULT* psr)
+MCONTACT CVkProto::AddToList(int, PROTOSEARCHRESULT *psr)
{
debugLogA("CVkProto::AddToList");
@@ -592,7 +524,7 @@ MCONTACT CVkProto::AddToList(int, PROTOSEARCHRESULT* psr) return hContact;
}
-int CVkProto::AuthRequest(MCONTACT hContact,const TCHAR* message)
+int CVkProto::AuthRequest(MCONTACT hContact, const TCHAR *message)
{
debugLogA("CVkProto::AuthRequest");
if (!IsOnline())
@@ -685,7 +617,7 @@ int CVkProto::UserIsTyping(MCONTACT hContact, int type) if (userID == -1 || !IsOnline() || userID == VK_FEED_USER)
return 1;
- if (m_iMarkMessageReadOn == markOnTyping)
+ if (m_vkOptions.iMarkMessageReadOn == MarkMsgReadOn::markOnTyping)
MarkMessagesRead(hContact);
Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/messages.setActivity.json", true, &CVkProto::OnReceiveSmth, AsyncHttpRequest::rpLow)
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index 388a4247b7..478c4a43e1 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -14,6 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
#pragma once
#define PS_CREATECHAT "/CreateNewChat"
@@ -37,54 +38,45 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define PS_SETSTATUSMSG "/SetStatusMsg"
#define PS_WALLPOST "/WallPost"
#define PS_MARKMESSAGESASREAD "/MarkMessagesAsRead"
+
#define MAXHISTORYMIDSPERONE 100
#define MAX_RETRIES 10
#define MAX_CONTACTS_PER_REQUEST 1000
-
struct CVkProto : public PROTO<CVkProto>
{
CVkProto(const char*, const TCHAR*);
~CVkProto();
- //====================================================================================
- // PROTO_INTERFACE
- //====================================================================================
-
- virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr);
+//====================================================================================
+// PROTO_INTERFACE
+//====================================================================================
+ virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT *psr);
virtual int __cdecl Authorize(MEVENT hDbEvent);
virtual int __cdecl AuthDeny(MEVENT hDbEvent, const TCHAR *szReason);
virtual int __cdecl AuthRequest(MCONTACT hContact, const TCHAR *szMessage);
-
virtual DWORD_PTR __cdecl GetCaps(int type, MCONTACT hContact = NULL);
virtual int __cdecl GetInfo(MCONTACT hContact, int infoType);
-
virtual HANDLE __cdecl SearchBasic(const TCHAR *id);
virtual HANDLE __cdecl SearchByEmail(const TCHAR *email);
virtual HANDLE __cdecl SearchByName(const TCHAR *nick, const TCHAR *firstName, const TCHAR *lastName);
-
virtual int __cdecl RecvMsg(MCONTACT hContact, PROTORECVEVENT*);
virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char *msg);
-
virtual HANDLE __cdecl SendFile(MCONTACT hContact, const TCHAR *szDescription, TCHAR **ppszFiles);
-
virtual int __cdecl SetStatus(int iNewStatus);
-
virtual int __cdecl UserIsTyping(MCONTACT hContact, int type);
-
virtual int __cdecl OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam);
- //==== Events ========================================================================
+//==== Events ========================================================================
int __cdecl OnModulesLoaded(WPARAM, LPARAM);
int __cdecl OnOptionsInit(WPARAM, LPARAM);
int __cdecl OnPreShutdown(WPARAM, LPARAM);
-
void OnOAuthAuthorize(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
void OnReceiveAvatar(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
- //==== Services ======================================================================
+//==== Services ======================================================================
INT_PTR __cdecl SvcCreateAccMgrUI(WPARAM, LPARAM);
INT_PTR __cdecl SvcGetAvatarInfo(WPARAM, LPARAM);
@@ -92,7 +84,7 @@ struct CVkProto : public PROTO<CVkProto> INT_PTR __cdecl SvcGetMyAvatar(WPARAM, LPARAM);
INT_PTR __cdecl SvcSetListeningTo(WPARAM, LPARAM);
- //==== Menus ==========================================================================
+//==== Menus ==========================================================================
INT_PTR __cdecl SvcVisitProfile(WPARAM hContact, LPARAM);
INT_PTR __cdecl SvcAddAsFriend(WPARAM hContact, LPARAM);
@@ -106,7 +98,7 @@ struct CVkProto : public PROTO<CVkProto> INT_PTR __cdecl SvcMarkMessagesAsRead(WPARAM hContact, LPARAM);
INT_PTR __cdecl SvcSetStatusMsg(WPARAM, LPARAM);
- //==== History Menus ==================================================================
+//==== History Menus ==================================================================
template <unsigned short Days>
INT_PTR __cdecl SvcGetServerHistoryLastNDay(WPARAM hContact, LPARAM)
@@ -120,32 +112,145 @@ struct CVkProto : public PROTO<CVkProto> INT_PTR __cdecl SvcGetAllServerHistoryForContact(WPARAM hContact, LPARAM);
INT_PTR __cdecl SvcGetAllServerHistory(WPARAM, LPARAM);
+//=====================================================================================
+
+ void CreateNewChat(LPCSTR uids, LPCTSTR ptrszTitle);
+ __forceinline bool IsOnline() const { return m_bOnline; }
+ __forceinline LPCTSTR getGroup() const { return m_vkOptions.ptszDefaultGroup; }
+ __forceinline void setGroup(LPCTSTR grp) { m_vkOptions.ptszDefaultGroup = mir_tstrdup(grp); }
+ void OnTimerTic();
+ void ClearAccessToken();
+ TCHAR* GetUserStoredPassword(void);
+ void ShowCaptchaInBrowser(HBITMAP hBitmap);
+
+ static mir_cs m_csTimer;
+ static UINT_PTR m_timer;
+ CVKOptions m_vkOptions;
+
+private:
+
+ friend struct AsyncHttpRequest;
+
+//==== Enums =========================================================================
+
+ enum CLMenuIndexes {
+ CMI_VISITPROFILE,
+ CMI_MARKMESSAGESASREAD,
+ CMI_WALLPOST,
+ CMI_ADDASFRIEND,
+ CMI_DELETEFRIEND,
+ CMI_BANUSER,
+ CMI_REPORTABUSE,
+ CMI_DESTROYKICKCHAT,
+ CMI_OPENBROADCAST,
+ CMI_LOADVKNEWS,
+ CMI_GETSERVERHISTORY,
+ CMI_COUNT
+ };
+
+ enum CLMenuHistoruIndexes {
+ CHMI_GETSERVERHISTORY,
+ CHMI_GETSERVERHISTORYLAST1DAY,
+ CHMI_GETSERVERHISTORYLAST3DAY,
+ CHMI_GETSERVERHISTORYLAST7DAY,
+ CHMI_GETSERVERHISTORYLAST30DAY,
+ CHMI_GETSERVERHISTORYLAST90DAY,
+ CHMI_GETALLSERVERHISTORYFORCONTACT,
+ CHMI_COUNT
+ };
+
+ enum ProtoMenuIndexes {
+ PMI_CREATECHAT,
+ PMI_SETSTATUSMSG,
+ PMI_WALLPOST,
+ PMI_LOADVKNEWS,
+ PMI_GETALLSERVERHISTORY,
+ PMI_WIPENONFRIENDS,
+ PMI_VISITPROFILE,
+ PMI_COUNT
+ };
+
+//====================================================================================
+
+ bool
+ m_prevError,
+ m_bOnline,
+ m_bNeedSendOnline,
+ m_bSetBroadcast,
+ m_bNotifyForEndLoadingHistory,
+ m_bNotifyForEndLoadingHistoryAllContact,
+ m_bTerminated,
+ m_bServerDelivery;
+
+ LONG m_myUserId;
+
+ ptrA
+ m_pollingServer,
+ m_pollingKey,
+ m_pollingTs,
+ m_szAccessToken;
+
+ HANDLE
+ m_pollingConn,
+ m_hPollingThread,
+ m_hAPIConnection,
+ m_hPopupClassError,
+ m_hPopupClassNotification,
+ m_evRequestsQueue,
+ m_hWorkerThread;
+
+ ULONG m_msgId;
+
+ mir_cs
+ m_csChatTyping,
+ m_csLoadHistoryTask,
+ m_csRequestsQueue;
+
+ int m_iLoadHistoryTask;
+
+ LIST<void>
+ m_sendIds,
+ m_incIds;
+
+ OBJLIST<CVkChatInfo> m_chats;
+ OBJLIST<CVKChatContactTypingParam> m_ChatsTyping;
+ OBJLIST<CVkCookie> m_cookies;
+ LIST<AsyncHttpRequest> m_arRequestsQueue;
+
+ CMStringA m_prevUrl;
+
+ HGENMENU
+ m_hContactMenuItems[CMI_COUNT],
+ m_hContactHistoryMenuItems[CHMI_COUNT],
+ m_hProtoMenuItems[PMI_COUNT];
+
+//==== Menus =========================================================================
void InitMenus();
void UnInitMenus();
int __cdecl OnPreBuildContactMenu(WPARAM hContact, LPARAM);
- //==== PopUps ========================================================================
+//==== PopUps ========================================================================
void InitPopups(void);
void MsgPopup(MCONTACT hContact, const TCHAR *szMsg, const TCHAR *szTitle, bool err = false);
- //==== Hooks =========================================================================
+//==== Hooks =========================================================================
int __cdecl OnProcessSrmmEvent(WPARAM, LPARAM);
int __cdecl OnDbEventRead(WPARAM, LPARAM);
int __cdecl OnDbSettingChanged(WPARAM, LPARAM);
- //==== Search ========================================================================
+//==== Search ========================================================================
- void __cdecl SearchBasicThread(void* id);
- void __cdecl SearchByMailThread(void* email);
- void __cdecl SearchThread(void* p);
+ void __cdecl SearchBasicThread(void *id);
+ void __cdecl SearchByMailThread(void *email);
+ void __cdecl SearchThread(void *p);
void FreeProtoShearchStruct(PROTOSEARCHBYNAME *pParam);
void OnSearch(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
- void OnSearchByMail(NETLIBHTTPREQUEST *, AsyncHttpRequest *);
+ void OnSearchByMail(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
- //==== Files Upload ==================================================================
+//==== Files Upload ==================================================================
void __cdecl SendFileThread(void *p);
void SendFileFiled(CVkFileUploadParam *fup, int ErrorCode);
@@ -153,328 +258,110 @@ struct CVkProto : public PROTO<CVkProto> void OnReciveUpload(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
void OnReciveUploadFile(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
- //==== Feed ==========================================================================
+//==== Feed ==========================================================================
void AddFeedSpecialUser();
void AddFeedEvent(CVKNewsItem& vkNewsItem);
void AddCListEvent(bool bNews);
-
CVkUserInfo* GetVkUserInfo(LONG iUserId, OBJLIST<CVkUserInfo> &vkUsers);
void CreateVkUserInfoList(OBJLIST<CVkUserInfo> &vkUsers, const JSONNode &jnResponse);
-
CVKNewsItem* GetVkNewsItem(const JSONNode &jnItem, OBJLIST<CVkUserInfo> &vkUsers, bool isRepost = false);
-
CVKNewsItem* GetVkGroupInvates(const JSONNode &jnItem, OBJLIST<CVkUserInfo> &vkUsers);
CVKNewsItem* GetVkNotificationsItem(const JSONNode &jnItem, OBJLIST<CVkUserInfo> &vkUsers);
CMString GetVkFeedback(const JSONNode &jnFeedback, VKObjType vkFeedbackType, OBJLIST<CVkUserInfo> &vkUsers, CVkUserInfo *vkUser);
CVKNewsItem* GetVkParent(const JSONNode &jnParent, VKObjType vkParentType, LPCTSTR ptszReplyText = NULL, LPCTSTR ptszReplyLink = NULL);
-
void RetrieveUnreadNews(time_t tLastNewsTime);
void OnReceiveUnreadNews(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
-
void RetrieveUnreadNotifications(time_t tLastNotificationsTime);
- bool FilterNotification(CVKNewsItem* vkNotificationItem, bool& isCommented);
+ bool FilterNotification(CVKNewsItem *vkNotificationItem, bool& isCommented);
void NotificationMarkAsViewed();
void OnReceiveUnreadNotifications(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
void RetrieveUnreadEvents();
void NewsClearHistory();
-
INT_PTR __cdecl SvcLoadVKNews(WPARAM, LPARAM);
- //==== Misc ==========================================================================
-
- TCHAR* GetUserStoredPassword(void);
- void SetAllContactStatuses(int status);
-
- MCONTACT FindUser(LONG userid, bool bCreate = false);
- MCONTACT FindChat(LONG dwUserid);
-
- bool CheckMid(LIST<void> &lList, int guid);
-
- JSONNode& CheckJsonResponse(AsyncHttpRequest *pReq, NETLIBHTTPREQUEST *reply, JSONNode &root);
- bool CheckJsonResult(AsyncHttpRequest *pReq, const JSONNode &Node);
-
- void OnReceiveSmth(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
-
- bool AutoFillForm(char*, CMStringA&, CMStringA&);
- CMString RunConfirmationCode();
-
- void GrabCookies(NETLIBHTTPREQUEST *nhr);
- void ApplyCookies(AsyncHttpRequest*);
-
- void __cdecl DBAddAuthRequestThread(void *p);
- void DBAddAuthRequest(const MCONTACT hContact);
- MCONTACT MContactFromDbEvent(MEVENT hDbEvent);
-
- void SetMirVer(MCONTACT hContact, int platform);
-
- void __cdecl ContactTypingThread(void *p);
-
- void SetSrmmReadStatus(MCONTACT hContact);
- void MarkDialogAsRead(MCONTACT hContact);
-
- char* GetStickerId(const char* Msg, int& stickerid);
-
- CMString SpanVKNotificationType(CMString& tszType, VKObjType& vkFeedback, VKObjType& vkParent);
- CMString GetVkPhotoItem(const JSONNode &jnPhoto, BBCSupport iBBC);
-
- CMString SetBBCString(LPCTSTR tszString, BBCSupport iBBC, VKBBCType bbcType, LPCTSTR tszAddString = NULL);
- CMString& ClearFormatNick(CMString& tszText);
-
- CMString GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport iBBC = bbcNo);
- CMString GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jnFUsers, BBCSupport iBBC = bbcNo);
-
- void SetInvisible(MCONTACT hContact);
- CMString RemoveBBC(CMString& tszSrc);
-
- void ShowCaptchaInBrowser(HBITMAP hBitmap);
-
- //====================================================================================
+//====================================================================================
+ void SetServerStatus(int);
+ void RetrieveUsersInfo(bool flag = false, bool bRepeat = false);
void RetrieveStatusMsg(const CMString &StatusMsg);
void RetrieveStatusMusic(const CMString &StatusMsg);
void OnReceiveStatus(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
void OnReceiveStatusMsg(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
-
MCONTACT SetContactInfo(const JSONNode &jnItem, bool flag = false, bool self = false);
void RetrieveMyInfo(void);
void OnReceiveMyInfo(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
void RetrieveUserInfo(LONG userId);
- void RetrieveUsersInfo(bool flag = false, bool bRepeat = false);
void OnReceiveUserInfo(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
void RetrieveFriends(bool bCleanNonFriendContacts = false);
void OnReceiveFriends(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
-
void MarkMessagesRead(const CMStringA &mids);
void MarkMessagesRead(const MCONTACT hContact);
-
void RetrieveMessagesByIds(const CMStringA &mids);
void RetrieveUnreadMessages();
void OnReceiveMessages(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
void OnReceiveDlgs(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
void OnSendMessage(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
-
void WallPost(MCONTACT hContact, TCHAR *ptszMsg, TCHAR *ptszUrl, bool bFriendsOnly);
-
void GetServerHistoryLastNDay(MCONTACT hContact, int NDay);
void GetServerHistory(MCONTACT hContact, int iOffset, int iCount, int iTime, int iLastMsgId, bool once = false);
void OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq);
void GetHistoryDlg(MCONTACT hContact, int iLastMsg);
-
void RetrievePollingInfo();
void OnReceivePollingInfo(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
void __cdecl PollingThread(void*);
int PollServer();
void PollUpdates(const JSONNode&);
- void OnReceivePolling(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
-
void OnReceiveAuthRequest(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
void OnReceiveDeleteFriend(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
- void SetServerStatus(int);
-
- void CreateNewChat(LPCSTR uids, LPCTSTR ptrszTitle);
- void OnCreateNewChat(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
-
- __forceinline bool IsOnline() const { return m_bOnline; }
-
- __forceinline LPCTSTR getGroup() const { return m_defaultGroup; }
- __forceinline void setGroup(LPCTSTR grp) { m_defaultGroup = mir_tstrdup(grp); }
-
- static mir_cs m_csTimer;
- static UINT_PTR m_timer;
-
- void ClearAccessToken();
-
- mir_cs m_csLoadHistoryTask;
- int m_iLoadHistoryTask;
- bool m_bNotifyForEndLoadingHistory;
- bool m_bNotifyForEndLoadingHistoryAllContact;
-
-private:
- friend struct AsyncHttpRequest;
-
- LIST<AsyncHttpRequest> m_arRequestsQueue;
- mir_cs m_csRequestsQueue;
- HANDLE m_evRequestsQueue;
- HANDLE m_hWorkerThread;
- bool m_bTerminated, m_bServerDelivery;
- CMStringA m_prevUrl;
-
- enum CLMenuIndexes {
- CMI_VISITPROFILE,
- CMI_MARKMESSAGESASREAD,
- CMI_WALLPOST,
- CMI_ADDASFRIEND,
- CMI_DELETEFRIEND,
- CMI_BANUSER,
- CMI_REPORTABUSE,
- CMI_DESTROYKICKCHAT,
- CMI_OPENBROADCAST,
- CMI_LOADVKNEWS,
- CMI_GETSERVERHISTORY,
- CMI_COUNT
- };
- enum CLMenuHistoruIndexes {
- CHMI_GETSERVERHISTORY,
- CHMI_GETSERVERHISTORYLAST1DAY,
- CHMI_GETSERVERHISTORYLAST3DAY,
- CHMI_GETSERVERHISTORYLAST7DAY,
- CHMI_GETSERVERHISTORYLAST30DAY,
- CHMI_GETSERVERHISTORYLAST90DAY,
- CHMI_GETALLSERVERHISTORYFORCONTACT,
- CHMI_COUNT
- };
- enum ProtoMenuIndexes {
- PMI_CREATECHAT,
- PMI_SETSTATUSMSG,
- PMI_WALLPOST,
- PMI_LOADVKNEWS,
- PMI_GETALLSERVERHISTORY,
- PMI_WIPENONFRIENDS,
- PMI_VISITPROFILE,
- PMI_COUNT
- };
-
- HGENMENU g_hContactMenuItems[CMI_COUNT];
- HGENMENU g_hContactHistoryMenuItems[CHMI_COUNT];
- HGENMENU g_hProtoMenuItems[PMI_COUNT];
-
- struct Cookie
- {
- Cookie(const CMStringA& name, const CMStringA& value, const CMStringA& domain) :
- m_name(name),
- m_value(value),
- m_domain(domain)
- {}
-
- CMStringA m_name, m_value, m_domain;
- };
-
- OBJLIST<Cookie> m_cookies;
+//==== Misc ==========================================================================
+ void SetAllContactStatuses(int status);
+ MCONTACT FindUser(LONG userid, bool bCreate = false);
+ MCONTACT FindChat(LONG dwUserid);
+ bool CheckMid(LIST<void> &lList, int guid);
+ JSONNode& CheckJsonResponse(AsyncHttpRequest *pReq, NETLIBHTTPREQUEST *reply, JSONNode &root);
+ bool CheckJsonResult(AsyncHttpRequest *pReq, const JSONNode &Node);
+ void OnReceiveSmth(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
+ bool AutoFillForm(char*, CMStringA&, CMStringA&);
+ CMString RunConfirmationCode();
+ void GrabCookies(NETLIBHTTPREQUEST *nhr);
+ void ApplyCookies(AsyncHttpRequest*);
+ void __cdecl DBAddAuthRequestThread(void *p);
+ void DBAddAuthRequest(const MCONTACT hContact);
+ MCONTACT MContactFromDbEvent(MEVENT hDbEvent);
+ void SetMirVer(MCONTACT hContact, int platform);
+ void __cdecl ContactTypingThread(void *p);
+ void SetSrmmReadStatus(MCONTACT hContact);
+ void MarkDialogAsRead(MCONTACT hContact);
+ char* GetStickerId(const char *Msg, int& stickerid);
+ CMString SpanVKNotificationType(CMString& tszType, VKObjType& vkFeedback, VKObjType& vkParent);
+ CMString GetVkPhotoItem(const JSONNode &jnPhoto, BBCSupport iBBC);
+ CMString SetBBCString(LPCTSTR tszString, BBCSupport iBBC, VKBBCType bbcType, LPCTSTR tszAddString = NULL);
+ CMString& ClearFormatNick(CMString& tszText);
+ CMString GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport iBBC = bbcNo);
+ CMString GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jnFUsers, BBCSupport iBBC = bbcNo);
+ void SetInvisible(MCONTACT hContact);
+ CMString RemoveBBC(CMString& tszSrc);
void InitQueue();
void UninitQueue();
void ExecuteRequest(AsyncHttpRequest*);
void __cdecl WorkerThread(void*);
-
- AsyncHttpRequest* Push(AsyncHttpRequest*, int iTimeout = 10000);
-
+ AsyncHttpRequest* Push(AsyncHttpRequest *pReq, int iTimeout = 10000);
bool RunCaptchaForm(LPCSTR szUrl, CMStringA&);
bool ApplyCaptcha(AsyncHttpRequest *pReq, const JSONNode&);
-
void ConnectionFailed(int iReason);
void OnLoggedIn();
void OnLoggedOut();
void ShutdownSession();
-
void SetAvatarUrl(MCONTACT hContact, CMString &tszUrl);
- void GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t cbLen);
+ void GetAvatarFileName(MCONTACT hContact, TCHAR *pszDest, size_t cbLen);
void ReloadAvatarInfo(MCONTACT hContact);
-
void __cdecl SendMsgAck(void *param);
-
- //============== Options =============================================================
-
- bool m_prevError,
- m_bOnline,
- m_bNeedSendOnline,
- m_bHideChats,
- m_bMesAsUnread,
- m_bUseLocalTime,
- m_bReportAbuse,
- m_bClearServerHistory,
- m_bRemoveFromFrendlist,
- m_bRemoveFromClist,
- m_bPopUpSyncHistory,
- m_bStikersAsSmyles,
- m_bUserForceOnlineOnActivity,
- m_bNewsEnabled,
- m_bNotificationsEnabled,
- m_bNotificationsMarkAsViewed,
- m_bSpecialContactAlwaysEnabled,
- m_bNewsAutoClearHistory,
- m_bNewsFilterPosts,
- m_bNewsFilterPhotos,
- m_bNewsFilterTags,
- m_bNewsFilterWallPhotos,
- m_bNewsSourceFriends,
- m_bNewsSourceGroups,
- m_bNewsSourcePages,
- m_bNewsSourceFollowing,
- m_bNewsSourceIncludeBanned,
- m_bNewsSourceNoReposts,
- m_bNotificationFilterComments,
- m_bNotificationFilterLikes,
- m_bNotificationFilterReposts,
- m_bNotificationFilterMentions,
- m_bNotificationFilterInvites,
- m_bUseBBCOnAttacmentsAsNews,
- m_bUseNonStandardUrlEncode,
- m_bSetBroadcast,
- m_bShortenLinksForAudio,
- m_bSplitFormatFwdMsg,
- m_bSyncReadMessageStatusFromServer,
- m_bLoadFullCList,
- m_bUseNonStandardNotifications;
-
- int m_iNewsInterval,
- m_iNotificationsInterval,
- m_iNewsAutoClearHistoryInterval,
- m_iMaxLoadNewsPhoto,
- m_iInvisibleInterval,
- m_iMaxFriendsCount;
-
- enum MarkMsgReadOn { markOnRead, markOnReceive, markOnReply, markOnTyping };
- MarkMsgReadOn m_iMarkMessageReadOn;
-
- enum SyncHistoryMetod { syncOff, syncAuto, sync1Days, sync3Days };
- SyncHistoryMetod m_iSyncHistoryMetod;
-
- enum MusicSendMetod { sendNone, sendStatusOnly, sendBroadcastOnly, sendBroadcastAndStatus };
- MusicSendMetod m_iMusicSendMetod;
-
- enum IMGBBCSypport { imgNo, imgFullSize, imgPreview130, imgPreview604 };
- IMGBBCSypport m_iIMGBBCSupport;
-
- BBCSupport m_iBBCForNews,
- m_iBBCForAttachments;
-
- LONG m_myUserId;
- ptrT m_defaultGroup;
- ptrT m_ReturnChatMessage;
- ptrT m_VKLang;
-
- ptrA
- m_pollingServer,
- m_pollingKey,
- m_pollingTs,
- m_szAccessToken;
-
- HANDLE
- m_pollingConn,
- m_hPollingThread,
- m_hAPIConnection,
- m_hPopupClassError,
- m_hPopupClassNotification;
-
- ULONG m_msgId;
-
- LIST<void> m_sendIds;
- LIST<void> m_incIds;
-
- static INT_PTR CALLBACK OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
- static INT_PTR CALLBACK OptionsAdvProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
- static INT_PTR CALLBACK OptionsFeedsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
- static INT_PTR CALLBACK OptionsViewProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
-
- OBJLIST<CVkChatInfo> m_chats;
-
- OBJLIST<CVKChatContactTypingParam> m_ChatsTyping;
- mir_cs m_csChatTyping;
void __cdecl ChatContactTypingThread(void *p);
void StopChatContactTyping(int iChatId, int iUserId);
-
+ void OnCreateNewChat(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
CVkChatInfo* AppendChat(int id, const JSONNode &jnNode);
void SetChatTitle(CVkChatInfo *cc, LPCTSTR tszTopic);
void AppendChatMessage(int id, const JSONNode &jnMsg, const JSONNode &jnFUsers, bool bIsHistory);
diff --git a/protocols/VKontakte/src/vk_queue.cpp b/protocols/VKontakte/src/vk_queue.cpp index a89f69ced3..78e70c0049 100644 --- a/protocols/VKontakte/src/vk_queue.cpp +++ b/protocols/VKontakte/src/vk_queue.cpp @@ -96,8 +96,8 @@ AsyncHttpRequest* CVkProto::Push(AsyncHttpRequest *pReq, int iTimeout) pReq->timeout = iTimeout;
if (pReq->m_bApiReq) {
pReq << VER_API;
- if (!IsEmpty(m_VKLang))
- pReq << TCHAR_PARAM("lang", m_VKLang);
+ if (!IsEmpty(m_vkOptions.ptszVKLang))
+ pReq << TCHAR_PARAM("lang", m_vkOptions.ptszVKLang);
}
{
diff --git a/protocols/VKontakte/src/vk_search.cpp b/protocols/VKontakte/src/vk_search.cpp index 4385b0ae3a..b016302971 100644 --- a/protocols/VKontakte/src/vk_search.cpp +++ b/protocols/VKontakte/src/vk_search.cpp @@ -17,21 +17,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-HANDLE CVkProto::SearchBasic(const TCHAR* id)
+HANDLE CVkProto::SearchBasic(const TCHAR *id)
{
ForkThread(&CVkProto::SearchBasicThread, (void *)id);
return (HANDLE)1;
}
-HANDLE CVkProto::SearchByEmail(const TCHAR* email)
+HANDLE CVkProto::SearchByEmail(const TCHAR *email)
{
ForkThread(&CVkProto::SearchByMailThread, (void *)email);
return (HANDLE)1;
}
-HANDLE CVkProto::SearchByName(const TCHAR* nick, const TCHAR* firstName, const TCHAR* lastName)
+HANDLE CVkProto::SearchByName(const TCHAR *nick, const TCHAR *firstName, const TCHAR *lastName)
{
- PROTOSEARCHBYNAME * psr = new (PROTOSEARCHBYNAME);
+ PROTOSEARCHBYNAME *psr = new (PROTOSEARCHBYNAME);
psr->pszFirstName = mir_tstrdup(firstName);
psr->pszLastName = mir_tstrdup(lastName);
@@ -41,7 +41,7 @@ HANDLE CVkProto::SearchByName(const TCHAR* nick, const TCHAR* firstName, const T return (HANDLE)1;
}
-void CVkProto::SearchBasicThread(void* id)
+void CVkProto::SearchBasicThread(void *id)
{
debugLogA("CVkProto::OnSearchBasicThread");
if (!IsOnline())
@@ -53,7 +53,7 @@ void CVkProto::SearchBasicThread(void* id) Push(pReq);
}
-void CVkProto::SearchByMailThread(void* email)
+void CVkProto::SearchByMailThread(void *email)
{
debugLogA("CVkProto::OnSearchBasicThread");
if (!IsOnline())
@@ -64,7 +64,7 @@ void CVkProto::SearchByMailThread(void* email) Push(pReq);
}
-void __cdecl CVkProto::SearchThread(void* p)
+void __cdecl CVkProto::SearchThread(void *p)
{
PROTOSEARCHBYNAME *pParam = (PROTOSEARCHBYNAME *)p;
diff --git a/protocols/VKontakte/src/vk_status.cpp b/protocols/VKontakte/src/vk_status.cpp index e6490fd60a..7932ca21d3 100644 --- a/protocols/VKontakte/src/vk_status.cpp +++ b/protocols/VKontakte/src/vk_status.cpp @@ -175,13 +175,13 @@ void CVkProto::RetrieveStatusMsg(const CMString &StatusMsg) void CVkProto::RetrieveStatusMusic(const CMString &StatusMsg)
{
debugLogA("CVkProto::RetrieveStatusMusic");
- if (!IsOnline() || m_iStatus == ID_STATUS_INVISIBLE || m_iMusicSendMetod == sendNone)
+ if (!IsOnline() || m_iStatus == ID_STATUS_INVISIBLE || m_vkOptions.iMusicSendMetod == MusicSendMetod::sendNone)
return;
CMString code;
CMString tszOldStatusMsg(db_get_tsa(0, m_szModuleName, "OldStatusMsg"));
if (StatusMsg.IsEmpty()) {
- if (m_iMusicSendMetod == sendBroadcastOnly)
+ if (m_vkOptions.iMusicSendMetod == MusicSendMetod::sendBroadcastOnly)
code = "API.audio.setBroadcast();return null;";
else {
CMString codeformat("API.status.set({text:\"%s\"});return null;");
@@ -190,7 +190,7 @@ void CVkProto::RetrieveStatusMusic(const CMString &StatusMsg) m_bSetBroadcast = false;
}
else {
- if (m_iMusicSendMetod == sendBroadcastOnly) {
+ if (m_vkOptions.iMusicSendMetod == MusicSendMetod::sendBroadcastOnly) {
CMString codeformat("var StatusMsg=\"%s\";var CntLmt=100;var OldMsg=API.status.get();"
"var Tracks=API.audio.search({\"q\":StatusMsg,\"count\":CntLmt,\"search_own\":1});"
"var Cnt=Tracks.count;if(Cnt>CntLmt){Cnt=CntLmt;}"
@@ -201,13 +201,13 @@ void CVkProto::RetrieveStatusMusic(const CMString &StatusMsg) "};return OldMsg;");
code.AppendFormat(codeformat, StatusMsg);
}
- else if (m_iMusicSendMetod == sendStatusOnly) {
+ else if (m_vkOptions.iMusicSendMetod == MusicSendMetod::sendStatusOnly) {
CMString codeformat("var StatusMsg=\"♫ %s\";var OldMsg=API.status.get();"
"API.status.set({\"text\":StatusMsg});"
"return OldMsg;");
code.AppendFormat(codeformat, StatusMsg);
}
- else if (m_iMusicSendMetod == sendBroadcastAndStatus) {
+ else if (m_vkOptions.iMusicSendMetod == MusicSendMetod::sendBroadcastAndStatus) {
CMString codeformat("var StatusMsg=\"%s\";var CntLmt=100;var Track=\" \";var OldMsg=API.status.get();"
"var Tracks=API.audio.search({\"q\":StatusMsg,\"count\":CntLmt,\"search_own\":1});"
"var Cnt=Tracks.count;if(Cnt>CntLmt){Cnt=CntLmt;}"
@@ -228,7 +228,7 @@ void CVkProto::RetrieveStatusMusic(const CMString &StatusMsg) INT_PTR __cdecl CVkProto::SvcSetListeningTo(WPARAM, LPARAM lParam)
{
debugLogA("CVkProto::SvcSetListeningTo");
- if (m_iMusicSendMetod == sendNone)
+ if (m_vkOptions.iMusicSendMetod == MusicSendMetod::sendNone)
return 1;
LISTENINGTOINFO *pliInfo = (LISTENINGTOINFO*)lParam;
diff --git a/protocols/VKontakte/src/vk_struct.cpp b/protocols/VKontakte/src/vk_struct.cpp index 3568d8515c..e01fb08b6a 100644 --- a/protocols/VKontakte/src/vk_struct.cpp +++ b/protocols/VKontakte/src/vk_struct.cpp @@ -42,7 +42,7 @@ AsyncHttpRequest::AsyncHttpRequest(CVkProto *ppro, int iRequestType, LPCSTR _url cbSize = sizeof(NETLIBHTTPREQUEST);
m_bApiReq = true;
bIsMainConn = false;
- bExpUrlEncode = ppro->m_bUseNonStandardUrlEncode;
+ bExpUrlEncode = ppro->m_vkOptions.bUseNonStandardUrlEncode != 0 ? true : false;
AddHeader("Connection", "keep-alive");
if (*_url == '/') { // relative url leads to a site
@@ -98,7 +98,7 @@ void AsyncHttpRequest::Redirect(NETLIBHTTPREQUEST *nhr) /////////////////////////////////////////////////////////////////////////////////////////
-CVkFileUploadParam::CVkFileUploadParam(MCONTACT _hContact, const TCHAR* _desc, TCHAR** _files) :
+CVkFileUploadParam::CVkFileUploadParam(MCONTACT _hContact, const TCHAR *_desc, TCHAR **_files) :
hContact(_hContact),
Desc(mir_tstrdup(_desc)),
FileName(mir_tstrdup(_files[0])),
@@ -164,4 +164,85 @@ CVkChatUser* CVkChatInfo::GetUserById(int user_id) return m_users.find((CVkChatUser*)&user_id);
}
-/////////////////////////////////////////////////////////////////////////////////////////
\ No newline at end of file +/////////////////////////////////////////////////////////////////////////////////////////
+
+CVKOptions::CVKOptions(PROTO_INTERFACE *proto) :
+ bAutoClean(proto, "AutoClean", false),
+ bServerDelivery(proto, "BsDirect", true),
+ bHideChats(proto, "HideChats", true),
+ bMesAsUnread(proto, "MesAsUnread", false),
+ bUseLocalTime(proto, "UseLocalTime", false),
+ bReportAbuse(proto, "ReportAbuseOnBanUser", false),
+ bClearServerHistory(proto, "ClearServerHistoryOnBanUser", false),
+ bRemoveFromFrendlist(proto, "RemoveFromFrendlistOnBanUser", false),
+ bRemoveFromCList(proto, "RemoveFromClistOnBanUser", false),
+ bPopUpSyncHistory(proto, "PopUpSyncHistory", false),
+ iMarkMessageReadOn(proto, "MarkMessageReadOn", MarkMsgReadOn::markOnRead),
+ bStikersAsSmyles(proto, "StikersAsSmyles", false),
+ bUserForceOnlineOnActivity(proto, "UserForceOnlineOnActivity", false),
+ bNewsEnabled(proto, "NewsEnabled", false),
+ iMaxLoadNewsPhoto(proto, "MaxLoadNewsPhoto", 5),
+ bNotificationsEnabled(proto, "NotificationsEnabled", false),
+ bNotificationsMarkAsViewed(proto, "NotificationsMarkAsViewed", true),
+ bSpecialContactAlwaysEnabled(proto, "SpecialContactAlwaysEnabled", false),
+ bUseBBCOnAttacmentsAsNews(proto, "UseBBCOnAttacmentsAsNews", true),
+ bNewsAutoClearHistory(proto, "NewsAutoClearHistory", false),
+ bNewsFilterPosts(proto, "NewsFilterPosts", true),
+ bNewsFilterPhotos(proto, "NewsFilterPhotos", true),
+ bNewsFilterTags(proto, "NewsFilterTags", true),
+ bNewsFilterWallPhotos(proto, "NewsFilterWallPhotos", true),
+ bNewsSourceFriends(proto, "NewsSourceFriends", true),
+ bNewsSourceGroups(proto, "NewsSourceGroups", true),
+ bNewsSourcePages(proto, "NewsSourcePages", true),
+ bNewsSourceFollowing(proto, "NewsSourceFollowing", true),
+ bNewsSourceIncludeBanned(proto, "NewsSourceIncludeBanned", false),
+ bNewsSourceNoReposts(proto, "NewsSourceNoReposts", false),
+ bNotificationFilterComments(proto, "NotificationFilterComments", true),
+ bNotificationFilterLikes(proto, "NotificationFilterLikes", true),
+ bNotificationFilterReposts(proto, "NotificationFilterReposts", true),
+ bNotificationFilterMentions(proto, "NotificationFilterMentions", true),
+ bNotificationFilterInvites(proto, "NotificationFilterInvites", true),
+ bUseNonStandardNotifications(proto, "UseNonStandardNotifications", false),
+ bUseNonStandardUrlEncode(proto, "UseNonStandardUrlEncode", true),
+ bShortenLinksForAudio(proto, "ShortenLinksForAudio", true),
+ bSplitFormatFwdMsg(proto, "SplitFormatFwdMsg", true),
+ bSyncReadMessageStatusFromServer(proto, "SyncReadMessageStatusFromServer", false),
+ bLoadFullCList(proto, "LoadFullCList", false),
+
+ iMusicSendMetod(proto, "MusicSendMetod", MusicSendMetod::sendBroadcastOnly),
+ iSyncHistoryMetod(proto, "SyncHistoryMetod", SyncHistoryMetod::syncOff),
+ iIMGBBCSupport(proto, "IMGBBCSupport", IMGBBCSypport::imgNo),
+ iBBCForNews(proto, "BBCForNews", BBCSupport::bbcBasic),
+ iBBCForAttachments(proto, "BBCForAttachments", BBCSupport::bbcBasic),
+
+ iNewsInterval(proto, "NewsInterval", 15),
+ iNotificationsInterval(proto, "NotificationsInterval", 1),
+ iNewsAutoClearHistoryInterval(proto, "NewsAutoClearHistoryInterval", 60 * 60 * 24 * 3),
+ iInvisibleInterval(proto, "InvisibleInterval", 10),
+ iMaxFriendsCount(proto, "MaxFriendsCount", 1000),
+
+ ptszDefaultGroup(NULL),
+ ptszReturnChatMessage(NULL),
+ ptszVKLang(NULL),
+
+ m_proto((CVkProto*)proto)
+
+{
+ ReloadStrings();
+}
+
+void CVKOptions::ReloadStrings()
+{
+ if (!m_proto)
+ return;
+
+ ptszDefaultGroup = m_proto->getTStringA("ProtoGroup");
+ ptszReturnChatMessage = m_proto->getTStringA("ReturnChatMessage");
+ ptszVKLang = m_proto->getTStringA("VKLang");
+
+ if (IsEmpty(ptszDefaultGroup))
+ ptszDefaultGroup = mir_tstrdup(_T("VKontakte"));
+
+ if (IsEmpty(ptszReturnChatMessage))
+ ptszReturnChatMessage = mir_tstrdup(TranslateT("I\'m back"));
+}
diff --git a/protocols/VKontakte/src/vk_struct.h b/protocols/VKontakte/src/vk_struct.h index c2fe4e50be..e3ce079250 100644 --- a/protocols/VKontakte/src/vk_struct.h +++ b/protocols/VKontakte/src/vk_struct.h @@ -81,14 +81,14 @@ AsyncHttpRequest* operator<<(AsyncHttpRequest*, const TCHAR_PARAM&); struct CVkFileUploadParam : public MZeroedObject {
enum VKFileType { typeInvalid, typeImg, typeAudio, typeDoc, typeNotSupported };
- TCHAR* FileName;
- TCHAR* Desc;
- char* atr;
- char* fname;
+ TCHAR *FileName;
+ TCHAR *Desc;
+ char *atr;
+ char *fname;
MCONTACT hContact;
VKFileType filetype;
- CVkFileUploadParam(MCONTACT _hContact, const TCHAR* _desc, TCHAR** _files);
+ CVkFileUploadParam(MCONTACT _hContact, const TCHAR *_desc, TCHAR **_files);
~CVkFileUploadParam();
VKFileType GetType();
__forceinline bool IsAccess() { return ::_taccess(FileName, 0) == 0; }
@@ -247,4 +247,88 @@ struct CVKInteres { struct CVKLang {
TCHAR *szCode;
TCHAR *szDescription;
-};
\ No newline at end of file +};
+
+enum MarkMsgReadOn { markOnRead, markOnReceive, markOnReply, markOnTyping };
+enum SyncHistoryMetod { syncOff, syncAuto, sync1Days, sync3Days };
+enum MusicSendMetod { sendNone, sendStatusOnly, sendBroadcastOnly, sendBroadcastAndStatus };
+enum IMGBBCSypport { imgNo, imgFullSize, imgPreview130, imgPreview604 };
+
+struct CVkCookie
+{
+ CVkCookie(const CMStringA& name, const CMStringA& value, const CMStringA& domain) :
+ m_name(name),
+ m_value(value),
+ m_domain(domain)
+ {}
+
+ CMStringA m_name, m_value, m_domain;
+};
+
+struct CVKOptions {
+ CMOption<BYTE> bAutoClean;
+ CMOption<BYTE> bServerDelivery;
+ CMOption<BYTE> bHideChats;
+ CMOption<BYTE> bMesAsUnread;
+ CMOption<BYTE> bUseLocalTime;
+ CMOption<BYTE> bReportAbuse;
+ CMOption<BYTE> bClearServerHistory;
+ CMOption<BYTE> bRemoveFromFrendlist;
+ CMOption<BYTE> bRemoveFromCList;
+ CMOption<BYTE> bPopUpSyncHistory;
+ CMOption<BYTE> iMarkMessageReadOn;
+ CMOption<BYTE> bStikersAsSmyles;
+ CMOption<BYTE> bUserForceOnlineOnActivity;
+ CMOption<BYTE> iMusicSendMetod;
+ CMOption<BYTE> iSyncHistoryMetod;
+ CMOption<BYTE> bNewsEnabled;
+ CMOption<BYTE> iMaxLoadNewsPhoto;
+ CMOption<BYTE> bNotificationsEnabled;
+ CMOption<BYTE> bNotificationsMarkAsViewed;
+ CMOption<BYTE> bSpecialContactAlwaysEnabled;
+ CMOption<BYTE> iIMGBBCSupport;
+ CMOption<BYTE> iBBCForNews;
+ CMOption<BYTE> iBBCForAttachments;
+ CMOption<BYTE> bUseBBCOnAttacmentsAsNews;
+ CMOption<BYTE> bNewsAutoClearHistory;
+ CMOption<BYTE> bNewsFilterPosts;
+ CMOption<BYTE> bNewsFilterPhotos;
+ CMOption<BYTE> bNewsFilterTags;
+ CMOption<BYTE> bNewsFilterWallPhotos;
+ CMOption<BYTE> bNewsSourceFriends;
+ CMOption<BYTE> bNewsSourceGroups;
+ CMOption<BYTE> bNewsSourcePages;
+ CMOption<BYTE> bNewsSourceFollowing;
+ CMOption<BYTE> bNewsSourceIncludeBanned;
+ CMOption<BYTE> bNewsSourceNoReposts;
+ CMOption<BYTE> bNotificationFilterComments;
+ CMOption<BYTE> bNotificationFilterLikes;
+ CMOption<BYTE> bNotificationFilterReposts;
+ CMOption<BYTE> bNotificationFilterMentions;
+ CMOption<BYTE> bNotificationFilterInvites;
+ CMOption<BYTE> bUseNonStandardNotifications;
+ CMOption<BYTE> bUseNonStandardUrlEncode;
+ CMOption<BYTE> bShortenLinksForAudio;
+ CMOption<BYTE> bSplitFormatFwdMsg;
+ CMOption<BYTE> bSyncReadMessageStatusFromServer;
+ CMOption<BYTE> bLoadFullCList;
+
+ CMOption<DWORD> iNewsInterval;
+ CMOption<DWORD> iNotificationsInterval;
+ CMOption<DWORD> iNewsAutoClearHistoryInterval;
+ CMOption<DWORD> iInvisibleInterval;
+ CMOption<DWORD> iMaxFriendsCount;
+
+ ptrT ptszDefaultGroup;
+ ptrT ptszReturnChatMessage;
+ ptrT ptszVKLang;
+
+ CVkProto *m_proto;
+
+ CVKOptions(PROTO_INTERFACE *proto);
+ void ReloadStrings();
+
+ __forceinline BBCSupport BBCForNews() { return (BBCSupport)(int)iBBCForNews; };
+ __forceinline BBCSupport BBCForAttachments() { return (BBCSupport)(int)iBBCForAttachments; };
+
+};
\ No newline at end of file diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 5f454cf5a2..4915f4a283 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -57,9 +57,7 @@ static VOID CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) for (int i = 0; i < vk_Instances.getCount(); i++)
if (vk_Instances[i]->IsOnline()) {
vk_Instances[i]->debugLogA("Tic timer for %i - %s", i, vk_Instances[i]->m_szModuleName);
- vk_Instances[i]->SetServerStatus(vk_Instances[i]->m_iDesiredStatus);
- vk_Instances[i]->RetrieveUsersInfo(true);
- vk_Instances[i]->RetrieveUnreadEvents();
+ vk_Instances[i]->OnTimerTic();
}
}
@@ -81,6 +79,13 @@ static void CALLBACK VKUnsetTimer(void*) /////////////////////////////////////////////////////////////////////////////////////////
+void CVkProto::OnTimerTic()
+{
+ SetServerStatus(m_iDesiredStatus);
+ RetrieveUsersInfo(true);
+ RetrieveUnreadEvents();
+}
+
void CVkProto::OnLoggedIn()
{
debugLogA("CVkProto::OnLoggedIn");
@@ -490,7 +495,7 @@ void CVkProto::RetrieveUsersInfo(bool bFreeOffline, bool bRepeat) if (m_bNeedSendOnline)
codeformat += _T("API.account.setOnline();");
- if (bFreeOffline && !m_bLoadFullCList)
+ if (bFreeOffline && !m_vkOptions.bLoadFullCList)
codeformat += CMString("var US=[];var res=[];var t=10;while(t>0){"
"US=API.users.get({\"user_ids\":userIDs,\"fields\":_fields,\"name_case\":\"nom\"});"
"var index=US.length;while(index>0){"
@@ -550,7 +555,7 @@ void CVkProto::OnReceiveUserInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe int iContactStatus = getWord(hContact, "Status", ID_STATUS_OFFLINE);
if ((iContactStatus == ID_STATUS_ONLINE)
- || (iContactStatus == ID_STATUS_INVISIBLE && time(NULL) - getDword(hContact, "InvisibleTS", 0) >= m_iInvisibleInterval * 60LL)) {
+ || (iContactStatus == ID_STATUS_INVISIBLE && time(NULL) - getDword(hContact, "InvisibleTS", 0) >= m_vkOptions.iInvisibleInterval * 60LL)) {
setWord(hContact, "Status", ID_STATUS_OFFLINE);
SetMirVer(hContact, -1);
db_unset(hContact, m_szModuleName, "ListeningTo");
@@ -589,7 +594,7 @@ void CVkProto::RetrieveFriends(bool bCleanNonFriendContacts) if (!IsOnline())
return;
Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/friends.get.json", true, &CVkProto::OnReceiveFriends)
- << INT_PARAM("count", m_iMaxFriendsCount > 5000 ? 1000 : m_iMaxFriendsCount)
+ << INT_PARAM("count", m_vkOptions.iMaxFriendsCount > 5000 ? 1000 : m_vkOptions.iMaxFriendsCount)
<< CHAR_PARAM("fields", fieldsName))->pUserInfo = new CVkSendMsgParam(NULL, bCleanNonFriendContacts ? 1 : 0);
}
@@ -687,7 +692,7 @@ INT_PTR __cdecl CVkProto::SvcDeleteFriend(WPARAM hContact, LPARAM flag) return 0;
}
-void CVkProto::OnReceiveDeleteFriend(NETLIBHTTPREQUEST* reply, AsyncHttpRequest* pReq)
+void CVkProto::OnReceiveDeleteFriend(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq)
{
debugLogA("CVkProto::OnReceiveDeleteFriend %d", reply->resultCode);
CVkSendMsgParam *param = (CVkSendMsgParam*)pReq->pUserInfo;
@@ -737,27 +742,27 @@ INT_PTR __cdecl CVkProto::SvcBanUser(WPARAM hContact, LPARAM) CMStringA code(FORMAT, "var userID=\"%d\";API.account.banUser({\"user_id\":userID});", userID);
CMString tszVarWarning;
- if (m_bReportAbuse) {
- debugLogA("CVkProto::SvcBanUser m_bReportAbuse = true");
+ if (m_vkOptions.bReportAbuse) {
+ debugLogA("CVkProto::SvcBanUser m_vkOptions.bReportAbuse = true");
code += "API.users.report({\"user_id\":userID,type:\"spam\"});";
tszVarWarning = TranslateT(" report abuse on him/her");
}
- if (m_bClearServerHistory) {
- debugLogA("CVkProto::SvcBanUser m_bClearServerHistory = true");
+ if (m_vkOptions.bClearServerHistory) {
+ debugLogA("CVkProto::SvcBanUser m_vkOptions.bClearServerHistory = true");
code += "API.messages.deleteDialog({\"user_id\":userID,count:10000});";
if (!tszVarWarning.IsEmpty())
tszVarWarning.AppendChar(L',');
tszVarWarning += TranslateT(" clear server history with him/her");
}
- if (m_bRemoveFromFrendlist) {
- debugLogA("CVkProto::SvcBanUser m_bRemoveFromFrendlist = true");
+ if (m_vkOptions.bRemoveFromFrendlist) {
+ debugLogA("CVkProto::SvcBanUser m_vkOptions.bRemoveFromFrendlist = true");
code += "API.friends.delete({\"user_id\":userID});";
if (!tszVarWarning.IsEmpty())
tszVarWarning.AppendChar(L',');
tszVarWarning += TranslateT(" remove him/her from your friend list");
}
- if (m_bRemoveFromClist) {
- debugLogA("CVkProto::SvcBanUser m_bRemoveFromClist = true");
+ if (m_vkOptions.bRemoveFromCList) {
+ debugLogA("CVkProto::SvcBanUser m_vkOptions.bRemoveFromClist = true");
if (!tszVarWarning.IsEmpty())
tszVarWarning.AppendChar(L',');
tszVarWarning += TranslateT(" remove him/her from your contact list");
@@ -779,7 +784,7 @@ INT_PTR __cdecl CVkProto::SvcBanUser(WPARAM hContact, LPARAM) Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/execute.json", true, &CVkProto::OnReceiveSmth)
<< CHAR_PARAM("code", code));
- if (m_bRemoveFromClist)
+ if (m_vkOptions.bRemoveFromCList)
CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact);
return 0;
|