diff options
Diffstat (limited to 'protocols/VKontakte/src')
-rw-r--r-- | protocols/VKontakte/src/misc.cpp | 23 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk.h | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_avatars.cpp | 4 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_captcha.cpp | 6 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_chats.cpp | 12 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_feed.cpp | 70 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_files.cpp | 11 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_history.cpp | 13 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_messages.cpp | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_options.cpp | 30 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.cpp | 66 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.h | 25 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_queue.cpp | 6 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_search.cpp | 11 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_thread.cpp | 34 |
15 files changed, 154 insertions, 161 deletions
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 51e5bdd360..3d77b0b0a4 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -126,7 +126,7 @@ char* ExpUrlEncode(const char *szUrl, bool strict) *d++ = szHexDigits[*s >> 4];
*d++ = szHexDigits[*s & 0xF];
}
-
+
*d = '\0';
return szOutput;
}
@@ -149,7 +149,7 @@ void CVkProto::SetAllContactStatuses(int iStatus) SetChatStatus(hContact, iStatus);
else if (getWord(hContact, "Status") != iStatus)
setWord(hContact, "Status", iStatus);
-
+
if (iStatus == ID_STATUS_OFFLINE) {
SetMirVer(hContact, -1);
db_unset(hContact, m_szModuleName, "ListeningTo");
@@ -342,7 +342,7 @@ static CMStringA getAttr(char *szSrc, LPCSTR szAttrName) *pEnd = '>';
if (p2 == NULL)
return "";
-
+
return CMStringA(p1, (int)(p2-p1));
}
@@ -490,11 +490,11 @@ void __cdecl CVkProto::DBAddAuthRequestThread(void *p) void CVkProto::DBAddAuthRequest(const MCONTACT hContact)
{
debugLogA("CVkProto::DBAddAuthRequest");
-
+
T2Utf szNick(ptrT(db_get_tsa(hContact, m_szModuleName, "Nick")));
T2Utf szFirstName(ptrT(db_get_tsa(hContact, m_szModuleName, "FirstName")));
T2Utf szLastName(ptrT(db_get_tsa(hContact, m_szModuleName, "LastName")));
-
+
//blob is: uin(DWORD), hContact(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ)
//blob is: 0(DWORD), hContact(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), ""(ASCIIZ), ""(ASCIIZ)
DBEVENTINFO dbei = { sizeof(DBEVENTINFO) };
@@ -503,7 +503,7 @@ void CVkProto::DBAddAuthRequest(const MCONTACT hContact) dbei.flags = DBEF_UTF;
dbei.eventType = EVENTTYPE_AUTHREQUEST;
dbei.cbBlob = (DWORD)(sizeof(DWORD) * 2 + mir_strlen(szNick) + mir_strlen(szFirstName) + mir_strlen(szLastName) + 5);
-
+
PBYTE pCurBlob = dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob);
*((PDWORD)pCurBlob) = 0;
@@ -623,7 +623,7 @@ void CVkProto::ContactTypingThread(void *p) CallService(MS_PROTO_CONTACTISTYPING, hContact, 5);
Sleep(5500);
CallService(MS_PROTO_CONTACTISTYPING, hContact);
-
+
if (!ServiceExists(MS_MESSAGESTATE_UPDATE)) {
Sleep(1500);
SetSrmmReadStatus(hContact);
@@ -685,7 +685,7 @@ char* CVkProto::GetStickerId(const char* Msg, int &stickerid) {
stickerid = 0;
char* retMsg = NULL;
-
+
int iRes = 0;
char HeadMsg[32] = { 0 };
const char * tmpMsg = strstr(Msg, "[sticker:");
@@ -712,7 +712,7 @@ int CVkProto::OnDbSettingChanged(WPARAM hContact, LPARAM lParam) if (strcmp(cws->szModule, "ListeningTo"))
return 0;
-
+
CMStringA szListeningTo(m_szModuleName);
szListeningTo += "Enabled";
if (!strcmp(cws->szSetting, szListeningTo)) {
@@ -725,7 +725,7 @@ int CVkProto::OnDbSettingChanged(WPARAM hContact, LPARAM lParam) m_iMusicSendMetod = cws->value.bVal == 0 ? sendNone : iOldMusicSendMetod;
setByte("MusicSendMetod", m_iMusicSendMetod);
- }
+ }
return 0;
}
@@ -1058,7 +1058,7 @@ CMString CVkProto::GetFwdMessages(const JSONNode &jnMessages, const JSONNode &jn debugLogA("CVkProto::GetFwdMessages pMessages == NULL");
return res;
}
-
+
OBJLIST<CVkUserInfo> vkUsers(2, NumericKeySortT);
for (auto it = jnFUsers.begin(); it != jnFUsers.end(); ++it) {
@@ -1227,5 +1227,4 @@ CMString CVkProto::RemoveBBC(CMString& tszSrc) }
return tszRes;
-
}
\ No newline at end of file diff --git a/protocols/VKontakte/src/vk.h b/protocols/VKontakte/src/vk.h index f1a5f902fd..866d655bca 100644 --- a/protocols/VKontakte/src/vk.h +++ b/protocols/VKontakte/src/vk.h @@ -104,4 +104,4 @@ HANDLE GetIconHandle(int iCommand); char* ExpUrlEncode(const char *szUrl, bool strict = false);
bool IsEmpty(LPCTSTR str);
-bool IsEmpty(LPCSTR str);
+bool IsEmpty(LPCSTR str);
\ No newline at end of file diff --git a/protocols/VKontakte/src/vk_avatars.cpp b/protocols/VKontakte/src/vk_avatars.cpp index 11386736ce..6f9529830b 100644 --- a/protocols/VKontakte/src/vk_avatars.cpp +++ b/protocols/VKontakte/src/vk_avatars.cpp @@ -118,10 +118,10 @@ INT_PTR CVkProto::SvcGetMyAvatar(WPARAM wParam, LPARAM lParam) PROTO_AVATAR_INFORMATION ai = { 0 };
if (SvcGetAvatarInfo(0, (LPARAM)&ai) != GAIR_SUCCESS)
return 1;
-
+
TCHAR* buf = (TCHAR*)wParam;
int size = (int)lParam;
-
+
_tcsncpy(buf, ai.filename, size);
buf[size - 1] = 0;
diff --git a/protocols/VKontakte/src/vk_captcha.cpp b/protocols/VKontakte/src/vk_captcha.cpp index 4067a4e392..9798000c66 100644 --- a/protocols/VKontakte/src/vk_captcha.cpp +++ b/protocols/VKontakte/src/vk_captcha.cpp @@ -124,7 +124,7 @@ bool CVkProto::RunCaptchaForm(LPCSTR szUrl, CMStringA &result) memio.pBuf = reply->pData;
memio.fif = FIF_UNKNOWN; /* detect */
param.bmp = (HBITMAP)CallService(MS_IMG_LOADFROMMEM, (WPARAM)&memio);
-
+
BITMAP bmp = {0};
GetObject(param.bmp, sizeof(bmp), &bmp);
param.w = bmp.bmWidth;
@@ -132,7 +132,7 @@ bool CVkProto::RunCaptchaForm(LPCSTR szUrl, CMStringA &result) int res = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_CAPTCHAFORM), NULL, CaptchaFormDlgProc, (LPARAM)¶m);
if (res == 0)
return false;
-
+
debugLogA("CVkProto::RunCaptchaForm: user entered text %s", param.Result);
result = param.Result;
return true;
@@ -146,7 +146,7 @@ bool CVkProto::ApplyCaptcha(AsyncHttpRequest *pReq, const JSONNode &jnErrorNode) debugLogA("CVkProto::ApplyCaptcha");
if (!IsOnline())
return false;
-
+
CMStringA szUrl(jnErrorNode["captcha_img"].as_mstring());
CMStringA szSid(jnErrorNode["captcha_sid"].as_mstring());
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index 98274d0f95..7a08fbeca9 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -367,7 +367,7 @@ void CVkProto::AppendChatMessage(int id, const JSONNode &jnMsg, const JSONNode & }
else
tszBody = TranslateT("invite user");
- }
+ }
}
}
else if (tszAction == _T("chat_title_update")) {
@@ -576,7 +576,7 @@ static INT_PTR CALLBACK InviteDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA else
EndDialog(hwndDlg, 0);
return TRUE;
- }
+ }
}
return 0;
@@ -720,7 +720,7 @@ void CVkProto::KickFromChat(int chat_id, int user_id, const JSONNode &jnMsg, con if (user_id == m_myUserId)
LeaveChat(chat_id);
-
+
CVkChatInfo *cc = (CVkChatInfo*)m_chats.find((CVkChatInfo*)&chat_id);
if (cc == NULL)
return;
@@ -747,7 +747,7 @@ void CVkProto::OnChatLeave(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) debugLogA("CVkProto::OnChatLeave %d", reply->resultCode);
if (reply->resultCode != 200)
return;
-
+
CVkChatInfo *cc = (CVkChatInfo*)pReq->pUserInfo;
LeaveChat(cc->m_chatid);
}
@@ -764,7 +764,7 @@ INT_PTR __cdecl CVkProto::SvcDestroyKickChat(WPARAM hContact, LPARAM) int chat_id = getDword(hContact, "vk_chat_id", -1);
if (chat_id == -1)
return 1;
-
+
CMStringA code;
code.Format("var Hist = API.messages.getHistory({\"chat_id\":%d, \"count\":200});"
"var countMsg = Hist.count;var itemsMsg = Hist.items@.id; "
@@ -822,7 +822,7 @@ void CVkProto::NickMenuHook(CVkChatInfo *cc, GCHOOK *gch) else
SvcVisitProfile(hContact, 0);
break;
-
+
case IDM_KICK:
if (!IsOnline())
return;
diff --git a/protocols/VKontakte/src/vk_feed.cpp b/protocols/VKontakte/src/vk_feed.cpp index 7e13131cb0..ab650d932e 100644 --- a/protocols/VKontakte/src/vk_feed.cpp +++ b/protocols/VKontakte/src/vk_feed.cpp @@ -20,14 +20,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. void CVkProto::AddFeedSpecialUser()
{
bool bSpecialContact = m_bNewsEnabled || m_bNotificationsEnabled || m_bSpecialContactAlwaysEnabled;
-
+
MCONTACT hContact = FindUser(VK_FEED_USER);
if (!bSpecialContact) {
if (hContact)
CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact);
return;
}
-
+
if (!hContact) {
hContact = FindUser(VK_FEED_USER, true);
@@ -39,7 +39,7 @@ void CVkProto::AddFeedSpecialUser() setTString(hContact, "domain", _T("feed"));
setTString(hContact, "Homepage", _T("https://vk.com/feed"));
}
-
+
if (getWord(hContact, "Status") != ID_STATUS_ONLINE)
setWord(hContact, "Status", ID_STATUS_ONLINE);
SetMirVer(hContact, 7);
@@ -71,8 +71,12 @@ void CVkProto::AddFeedEvent(CVKNewsItem& vkNewsItem) void CVkProto::AddCListEvent(bool bNews)
{
+ SkinPlaySound("VKNewsFeed");
+
+ if (!m_bUseNonStandardNotifications)
+ return;
+
MCONTACT hContact = FindUser(VK_FEED_USER, true);
-
CLISTEVENT cle = { sizeof(cle) };
cle.hIcon = IcoLib_GetIconByHandle(GetIconHandle(IDI_NOTIFICATION));
cle.pszService = "SRMsg/ReadMessage";
@@ -84,7 +88,6 @@ void CVkProto::AddCListEvent(bool bNews) cle.ptszTooltip = toolTip;
CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
- SkinPlaySound("VKNewsFeed");
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -117,9 +120,9 @@ void CVkProto::CreateVkUserInfoList(OBJLIST<CVkUserInfo> &vkUsers, const JSONNod debugLogA("CVkProto::CreateVkUserInfoList");
if (!jnResponse)
return;
-
+
const JSONNode &jnProfiles = jnResponse["profiles"];
-
+
if (jnProfiles)
for (auto it = jnProfiles.begin(); it != jnProfiles.end(); ++it) {
const JSONNode &jnProfile = (*it);
@@ -138,7 +141,7 @@ void CVkProto::CreateVkUserInfoList(OBJLIST<CVkUserInfo> &vkUsers, const JSONNod CVkUserInfo * vkUser = new CVkUserInfo(UserId, false, tszNick, tszLink, FindUser(UserId));
vkUsers.insert(vkUser);
}
-
+
const JSONNode &jnGroups = jnResponse["groups"];
if (jnGroups)
for (auto it = jnGroups.begin(); it != jnGroups.end(); ++it) {
@@ -254,7 +257,7 @@ CVKNewsItem* CVkProto::GetVkNewsItem(const JSONNode &jnItem, OBJLIST<CVkUserInfo tszTitleFormat = Translate("Repost from %s");
bPostLink = false;
}
-
+
vkNewsItem->tszText.AppendFormat(tszResFormat,
SetBBCString(vkNewsItem->vkUser->m_tszUserNick, m_iBBCForNews, vkbbcUrl,
vkNewsItem->vkUser->m_tszLink), tszText);
@@ -330,7 +333,7 @@ CVKNewsItem* CVkProto::GetVkParent(const JSONNode &jnParent, VKObjType vkParentT return NULL;
CVKNewsItem * vkNotificationItem = new CVKNewsItem();
-
+
if (vkParentType == vkPhoto) {
CMString tszPhoto = GetVkPhotoItem(jnParent, m_iBBCForNews);
LONG iOwnerId = jnParent["owner_id"].as_int();
@@ -338,12 +341,12 @@ CVKNewsItem* CVkProto::GetVkParent(const JSONNode &jnParent, VKObjType vkParentT vkNotificationItem->tszId.AppendFormat(_T("%d_%d"), iOwnerId, iId);
vkNotificationItem->tszLink.AppendFormat(_T("https://vk.com/photo%s"), vkNotificationItem->tszId);
vkNotificationItem->tszText.AppendFormat(_T("\n%s"), tszPhoto);
-
+
if (ptszReplyText) {
vkNotificationItem->tszText.AppendFormat(_T("\n>> %s"), SetBBCString(ptszReplyText, m_iBBCForNews, vkbbcI));
vkNotificationItem->tszPopupText.AppendFormat(_T(">> %s"), ptszReplyText);
}
-
+
vkNotificationItem->tszText.AppendFormat(_T("\n%s"), SetBBCString(TranslateT("Link"), m_iBBCForNews, vkbbcUrl, vkNotificationItem->tszLink));
}
else if (vkParentType == vkVideo) {
@@ -352,10 +355,10 @@ CVKNewsItem* CVkProto::GetVkParent(const JSONNode &jnParent, VKObjType vkParentT CMString tszTitle(jnParent["title"].as_mstring());
vkNotificationItem->tszId.AppendFormat(_T("%d_%d"), iOwnerId, iId);
vkNotificationItem->tszLink.AppendFormat(_T("https://vk.com/video%s"), vkNotificationItem->tszId);
-
+
CMString tszText(jnParent["text"].as_mstring());
ClearFormatNick(tszText);
-
+
if (!tszText.IsEmpty())
vkNotificationItem->tszText.AppendFormat(_T("\n%s: %s"), SetBBCString(TranslateT("Video description:"), m_iBBCForNews, vkbbcB), SetBBCString(tszText, m_iBBCForNews, vkbbcI));
@@ -363,7 +366,7 @@ CVKNewsItem* CVkProto::GetVkParent(const JSONNode &jnParent, VKObjType vkParentT vkNotificationItem->tszText.AppendFormat(_T("\n>> %s"), SetBBCString(ptszReplyText, m_iBBCForNews, vkbbcI));
vkNotificationItem->tszPopupText.AppendFormat(_T(">> %s"), ptszReplyText);
}
-
+
vkNotificationItem->tszText.AppendFormat(_T("\n%s"), SetBBCString(tszTitle, m_iBBCForNews, vkbbcUrl, vkNotificationItem->tszLink));
}
else if (vkParentType == vkPost) {
@@ -371,10 +374,10 @@ CVKNewsItem* CVkProto::GetVkParent(const JSONNode &jnParent, VKObjType vkParentT LONG iId = jnParent["id"].as_int();
vkNotificationItem->tszId.AppendFormat(_T("%d_%d"), iToId, iId);
vkNotificationItem->tszLink.AppendFormat(_T("https://vk.com/wall%s%s"), vkNotificationItem->tszId, ptszReplyLink ? ptszReplyLink : _T(""));
-
+
CMString tszText(jnParent["text"].as_mstring());
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->tszPopupText.AppendFormat(_T("%s: %s"), TranslateT("Post text:"), tszText);
@@ -396,10 +399,10 @@ CVKNewsItem* CVkProto::GetVkParent(const JSONNode &jnParent, VKObjType vkParentT vkNotificationItem->tszId.AppendFormat(_T("%d_%d"), iOwnerId, iId);
vkNotificationItem->tszLink.AppendFormat(_T("https://vk.com/topic%s%s"),
vkNotificationItem->tszId, ptszReplyLink ? ptszReplyLink : _T(""));
-
+
CMString tszText(jnParent["text"].as_mstring());
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->tszPopupText.AppendFormat(_T("%s %s"), TranslateT("Topic text:"), tszText);
@@ -411,7 +414,7 @@ CVKNewsItem* CVkProto::GetVkParent(const JSONNode &jnParent, VKObjType vkParentT vkNotificationItem->tszPopupText += _T("\n");
vkNotificationItem->tszPopupText.AppendFormat(_T(">> %s"), ptszReplyText);
}
-
+
vkNotificationItem->tszText.AppendFormat(_T("\n%s"), SetBBCString(tszTitle, m_iBBCForNews, vkbbcUrl, vkNotificationItem->tszLink));
}
else if (vkParentType == vkComment) {
@@ -459,10 +462,10 @@ CVKNewsItem* CVkProto::GetVkNotificationsItem(const JSONNode &jnItem, OBJLIST<CV CMString tszType(jnItem["type"].as_mstring());
VKObjType vkFeedbackType = vkNull, vkParentType = vkNull;
CMString tszNotificationTranslate = SpanVKNotificationType(tszType, vkFeedbackType, vkParentType);
-
+
const JSONNode &jnFeedback = jnItem["feedback"];
const JSONNode &jnParent = jnItem["parent"];
-
+
if (!jnFeedback || !jnParent)
return NULL;
@@ -472,7 +475,7 @@ CVKNewsItem* CVkProto::GetVkNotificationsItem(const JSONNode &jnItem, OBJLIST<CV if (!vkNotification)
return NULL;
-
+
if (vkNotification && !tszFeedback.IsEmpty()) {
CMString tszNotificaton;
tszNotificaton.AppendFormat(tszFeedback, tszNotificationTranslate, vkNotification->tszText);
@@ -480,14 +483,14 @@ CVKNewsItem* CVkProto::GetVkNotificationsItem(const JSONNode &jnItem, OBJLIST<CV tszFeedback = RemoveBBC(tszFeedback);
int idx = tszFeedback.Find(_T(" %s %s"));
-
+
vkNotification->tszPopupTitle.AppendFormat(_T("%s %s"), tszFeedback.Mid(0, idx), tszNotificationTranslate);
if (tszFeedback.GetLength() > idx + 7) {
if (!vkNotification->tszPopupText.IsEmpty())
vkNotification->tszPopupText += _T("\n>> ");
vkNotification->tszPopupText += tszFeedback.Mid(idx + 7, tszFeedback.GetLength() - idx - 7);
}
-
+
vkNotification->tszType = tszType;
vkNotification->tDate = jnItem["date"].as_int();
vkNotification->vkFeedbackType = vkFeedbackType;
@@ -495,7 +498,7 @@ CVKNewsItem* CVkProto::GetVkNotificationsItem(const JSONNode &jnItem, OBJLIST<CV vkNotification->vkUser = vkUser;
return vkNotification;
}
-
+
delete vkNotification;
return NULL;
}
@@ -509,7 +512,7 @@ CVKNewsItem* CVkProto::GetVkGroupInvates(const JSONNode &jnItem, OBJLIST<CVkUser CMString tszType(jnItem["type"].as_mstring());
VKObjType vkFeedbackType = vkNull, vkParentType = vkNull;
CMString tszNotificationTranslate = SpanVKNotificationType(tszType, vkFeedbackType, vkParentType);
-
+
if (!jnItem["id"])
return NULL;
@@ -538,7 +541,7 @@ CVKNewsItem* CVkProto::GetVkGroupInvates(const JSONNode &jnItem, OBJLIST<CVkUser 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);
-
+
tszIds += tszId;
setTString("InviteGroupIds", tszIds);
@@ -556,7 +559,7 @@ void CVkProto::RetrieveUnreadNews(time_t tLastNewsTime) time_t tLastNewsReqTime = getDword("LastNewsReqTime", time(NULL) - 24 * 60 * 60);
if (time(NULL) - tLastNewsReqTime < 3 * 60)
return;
-
+
CMStringA szFilter;
szFilter = m_bNewsFilterPosts ? "post" : "";
@@ -590,7 +593,7 @@ void CVkProto::RetrieveUnreadNews(time_t tLastNewsTime) debugLogA("CVkProto::RetrieveUnreadNews szSource empty");
return;
}
-
+
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)
@@ -761,7 +764,6 @@ void CVkProto::OnReceiveUnreadNotifications(NETLIBHTTPREQUEST *reply, AsyncHttpR else
delete vkNotificationItem;
}
-
}
if (jnGroupInvates) {
@@ -769,15 +771,15 @@ void CVkProto::OnReceiveUnreadNotifications(NETLIBHTTPREQUEST *reply, AsyncHttpR if (jnItems)
for (auto it = jnItems.begin(); it != jnItems.end(); ++it) {
- CVKNewsItem *vkNotificationItem = GetVkGroupInvates((*it), vkUsers);
+ CVKNewsItem *vkNotificationItem = GetVkGroupInvates((*it), vkUsers);
if (!vkNotificationItem)
continue;
- if (vkNotification.find(vkNotificationItem) == NULL)
+ if (vkNotification.find(vkNotificationItem) == NULL)
vkNotification.insert(vkNotificationItem);
else
delete vkNotificationItem;
}
- }
+ }
bool bNotificationCommentAdded = false;
bool bNotificationComment = false;
diff --git a/protocols/VKontakte/src/vk_files.cpp b/protocols/VKontakte/src/vk_files.cpp index ca9822b47a..bcfd1e8635 100644 --- a/protocols/VKontakte/src/vk_files.cpp +++ b/protocols/VKontakte/src/vk_files.cpp @@ -60,7 +60,7 @@ void CVkProto::SendFileFiled(CVkFileUploadParam *fup, int ErrorCode) break;
case VKERR_INVALID_PARAMETERS:
tszError = TranslateT("One of the parameters specified was missing or invalid");
- break;
+ break;
case VKERR_COULD_NOT_SAVE_FILE:
tszError = TranslateT("Couldn't save file");
break;
@@ -181,7 +181,6 @@ void CVkProto::OnReciveUploadServer(NETLIBHTTPREQUEST *reply, AsyncHttpRequest * CMStringA boundary, header;
CMStringA NamePart = fup->atrName();
CMStringA FNamePart = fup->fileName();
-
// Boundary
int iboundary;
Utils_GetRandom(&iboundary, sizeof(iboundary));
@@ -304,7 +303,7 @@ void CVkProto::OnReciveUpload(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) SendFileFiled(fup, VKERR_FTYPE_NOT_SUPPORTED);
return;
}
-
+
pUploadReq->pUserInfo = pReq->pUserInfo;
Push(pUploadReq);
}
@@ -336,7 +335,7 @@ void CVkProto::OnReciveUploadFile(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pR SendFileFiled(fup, VKERR_INVALID_PARAMETERS);
return;
}
-
+
CMString Attachment;
switch (fup->GetType()) {
@@ -355,7 +354,7 @@ void CVkProto::OnReciveUploadFile(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pR }
AsyncHttpRequest *pMsgReq;
-
+
if (isChatRoom(fup->hContact)) {
ptrT tszChatID(getTStringA(fup->hContact, "ChatRoomID"));
@@ -390,6 +389,6 @@ void CVkProto::OnReciveUploadFile(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pR pMsgReq << TCHAR_PARAM("message", fup->Desc) << TCHAR_PARAM("attachment", Attachment) << VER_API;
pMsgReq->AddHeader("Content-Type", "application/x-www-form-urlencoded");
-
+
Push(pMsgReq);
}
\ No newline at end of file diff --git a/protocols/VKontakte/src/vk_history.cpp b/protocols/VKontakte/src/vk_history.cpp index 1e6e1736ad..de7d440583 100644 --- a/protocols/VKontakte/src/vk_history.cpp +++ b/protocols/VKontakte/src/vk_history.cpp @@ -101,7 +101,7 @@ void CVkProto::GetServerHistoryLastNDay(MCONTACT hContact, int NDay) debugLogA("CVkProto::SvcGetServerHistoryLastNDay %d", NDay);
time_t tTime = time(NULL) - 60 * 60 * 24 * NDay;
-
+
MEVENT hDBEvent = db_event_first(hContact);
while (hDBEvent) {
MEVENT hDBEventNext = db_event_next(hContact, hDBEvent);
@@ -111,7 +111,7 @@ void CVkProto::GetServerHistoryLastNDay(MCONTACT hContact, int NDay) db_event_delete(hContact, hDBEvent);
hDBEvent = hDBEventNext;
}
-
+
db_unset(hContact, m_szModuleName, "lastmsgid");
GetServerHistory(hContact, 0, MAXHISTORYMIDSPERONE, tTime, 0);
}
@@ -121,7 +121,7 @@ void CVkProto::GetServerHistory(MCONTACT hContact, int iOffset, int iCount, int debugLogA("CVkProto::GetServerHistory %d %d %d %d %d", iOffset, iCount, iTime, iLastMsgId, (int)once);
if (!IsOnline())
return;
-
+
LONG userID = getDword(hContact, "ID", -1);
if (-1 == userID || userID == VK_FEED_USER)
return;
@@ -163,7 +163,6 @@ void CVkProto::GetHistoryDlg(MCONTACT hContact, int iLastMsg) GetServerHistoryLastNDay(hContact, 3);
break;
}
-
}
void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq)
@@ -182,7 +181,7 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque }
return;
}
-
+
int iTime = jnResponse["datetime"].as_int();
const JSONNode &jnMsgs = jnResponse["items"];
const JSONNode &jnFUsers = jnResponse["fwd_users"];
@@ -206,7 +205,7 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque int isOut = jnMsg["out"].as_int();
int isRead = jnMsg["read_state"].as_int();
int uid = jnMsg["user_id"].as_int();
-
+
const JSONNode &jnFwdMessages = jnMsg["fwd_messages"];
if (jnFwdMessages) {
CMString tszFwdMessages = GetFwdMessages(jnFwdMessages, jnFUsers, m_iBBCForAttachments);
@@ -214,7 +213,7 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque tszFwdMessages = _T("\n") + tszFwdMessages;
tszBody += tszFwdMessages;
}
-
+
const JSONNode &jnAttachments = jnMsg["attachments"];
if (jnAttachments) {
CMString tszAttachmentDescr = GetAttachmentDescr(jnAttachments, m_iBBCForAttachments);
diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp index ae096560d0..cca8ad02d1 100644 --- a/protocols/VKontakte/src/vk_messages.cpp +++ b/protocols/VKontakte/src/vk_messages.cpp @@ -320,7 +320,7 @@ void CVkProto::OnReceiveDlgs(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) const JSONNode &jnResponse = CheckJsonResponse(pReq, reply, jnRoot);
if (!jnResponse)
return;
-
+
const JSONNode &jnDlgs = jnResponse["items"];
if (!jnDlgs)
return;
diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp index 2e753c4e07..86470e1295 100644 --- a/protocols/VKontakte/src/vk_options.cpp +++ b/protocols/VKontakte/src/vk_options.cpp @@ -122,17 +122,17 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L 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:
@@ -151,12 +151,12 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L 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:
@@ -178,7 +178,7 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L ppro->setGroup(str);
ppro->setTString("ProtoGroup", str);
}
-
+
GetDlgItemText(hwndDlg, IDC_PASSWORD, str, _countof(str));
T2Utf szRawPasswd(str);
if (szRawPasswd != NULL)
@@ -186,7 +186,7 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L 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;
@@ -256,7 +256,7 @@ INT_PTR CALLBACK CVkProto::OptionsAdvProc(HWND hwndDlg, UINT uMsg, WPARAM wParam 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);
@@ -275,7 +275,7 @@ INT_PTR CALLBACK CVkProto::OptionsAdvProc(HWND hwndDlg, UINT uMsg, WPARAM wParam 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);
@@ -358,7 +358,7 @@ INT_PTR CALLBACK CVkProto::OptionsAdvProc(HWND hwndDlg, UINT uMsg, WPARAM wParam 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);
@@ -407,7 +407,7 @@ INT_PTR CALLBACK CVkProto::OptionsFeedsProc(HWND hwndDlg, UINT uMsg, WPARAM wPar 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);
@@ -426,7 +426,7 @@ INT_PTR CALLBACK CVkProto::OptionsFeedsProc(HWND hwndDlg, UINT uMsg, WPARAM wPar 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:
@@ -436,7 +436,7 @@ INT_PTR CALLBACK CVkProto::OptionsFeedsProc(HWND hwndDlg, UINT uMsg, WPARAM wPar 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:
@@ -534,7 +534,7 @@ INT_PTR CALLBACK CVkProto::OptionsFeedsProc(HWND hwndDlg, UINT uMsg, WPARAM wPar GetDlgItemText(hwndDlg, IDC_ED_INT_NOTIF, buffer, _countof(buffer));
ppro->setDword("NotificationsInterval", ppro->m_iNotificationsInterval = _ttoi(buffer));
-
+
}
break;
@@ -666,7 +666,7 @@ int CVkProto::OnOptionsInit(WPARAM wParam, LPARAM) odp.dwInitParam = LPARAM(this);
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE;
odp.ptszGroup = LPGENT("Network");
-
+
odp.ptszTab = LPGENT("Account");
odp.position = 1;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MAIN);
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index 0d213c09cc..7f61927ca8 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -114,7 +114,7 @@ CVkProto::CVkProto(const char *szModuleName, const TCHAR *ptszUserName) : 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);
@@ -126,7 +126,7 @@ CVkProto::CVkProto(const char *szModuleName, const TCHAR *ptszUserName) : m_bSyncReadMessageStatusFromServer = getBool("SyncReadMessageStatusFromServer", false);
m_bLoadFullCList = getBool("LoadFullCList", false);
-
+
m_bSetBroadcast = false;
m_bNeedSendOnline = false;
delSetting("InviteGroupIds");
@@ -210,7 +210,7 @@ void CVkProto::InitMenus() CreateProtoService(PS_LOADVKNEWS, &CVkProto::SvcLoadVKNews);
CreateProtoService(PS_SETSTATUSMSG, &CVkProto::SvcSetStatusMsg);
CreateProtoService(PS_WALLPOST, &CVkProto::SvcWallPost);
-
+
CMenuItem mi;
mi.root = Menu_GetProtocolRoot(this);
@@ -242,7 +242,7 @@ void CVkProto::InitMenus() 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);
-
+
mi.pszService = PS_VISITPROFILE;
mi.position = 10009 + PMI_VISITPROFILE;
mi.hIcolibItem = IcoLib_GetIconByHandle(GetIconHandle(IDI_VISITPROFILE));
@@ -323,7 +323,7 @@ void CVkProto::InitMenus() 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);
-
+
mi.root = g_hContactMenuItems[CMI_GETSERVERHISTORY];
mi.pszService = PS_GETSERVERHISTORYLAST1DAY;
@@ -394,7 +394,7 @@ void CVkProto::UnInitMenus() debugLogA("CVkProto::UnInitMenus");
for (int i = 0; i < PMI_COUNT; i++)
Menu_RemoveItem(g_hProtoMenuItems[i]);
-
+
for (int i = 0; i < CHMI_COUNT; i++)
Menu_RemoveItem(g_hContactHistoryMenuItems[i]);
@@ -405,29 +405,29 @@ void CVkProto::UnInitMenus() /////////////////////////////////////////////////////////////////////////////////////////
// PopUp support
-LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch (message) { - case WM_COMMAND: - case WM_CONTEXTMENU: - { - CVkSendMsgParam *pd = (CVkSendMsgParam *)PUGetPluginData(hwnd); - if (pd != NULL && pd->hContact != NULL) - CallServiceSync(MS_MSG_SENDMESSAGE, (WPARAM)pd->hContact, 0); - PUDeletePopup(hwnd); - } - break; - case UM_FREEPLUGINDATA: - { - CVkSendMsgParam *pd = (CVkSendMsgParam *)PUGetPluginData(hwnd); - delete pd; - } - return FALSE; - default: - break; - } - - return DefWindowProc(hwnd, message, wParam, lParam); +LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ switch (message) {
+ case WM_COMMAND:
+ case WM_CONTEXTMENU:
+ {
+ CVkSendMsgParam *pd = (CVkSendMsgParam *)PUGetPluginData(hwnd);
+ if (pd != NULL && pd->hContact != NULL)
+ CallServiceSync(MS_MSG_SENDMESSAGE, (WPARAM)pd->hContact, 0);
+ PUDeletePopup(hwnd);
+ }
+ break;
+ case UM_FREEPLUGINDATA:
+ {
+ CVkSendMsgParam *pd = (CVkSendMsgParam *)PUGetPluginData(hwnd);
+ delete pd;
+ }
+ return FALSE;
+ default:
+ break;
+ }
+
+ return DefWindowProc(hwnd, message, wParam, lParam);
}
void CVkProto::InitPopups(void)
@@ -436,7 +436,7 @@ void CVkProto::InitPopups(void) char name[256];
POPUPCLASS ppc = { sizeof(ppc) };
ppc.flags = PCF_TCHAR;
- ppc.PluginWindowProc = PopupDlgProc; + ppc.PluginWindowProc = PopupDlgProc;
ppc.lParam = APF_RETURN_HWND;
mir_sntprintf(desc, _T("%s %s"), m_tszUserName, TranslateT("Errors"));
@@ -486,7 +486,7 @@ void CVkProto::MsgPopup(MCONTACT hContact, const TCHAR *szMsg, const TCHAR *szTi int CVkProto::OnPreShutdown(WPARAM, LPARAM)
{
debugLogA("CVkProto::OnPreShutdown");
-
+
m_bTerminated = true;
SetEvent(m_evRequestsQueue);
return 0;
@@ -627,7 +627,7 @@ int CVkProto::Authorize(MEVENT hDbEvent) MCONTACT hContact = MContactFromDbEvent(hDbEvent);
if (hContact == INVALID_CONTACT_ID)
return 1;
-
+
return AuthRequest(hContact, NULL);
}
@@ -650,7 +650,7 @@ int CVkProto::UserIsTyping(MCONTACT hContact, int type) LONG userID = getDword(hContact, "ID", -1);
if (userID == -1 || !IsOnline() || userID == VK_FEED_USER)
return 1;
-
+
if (m_iMarkMessageReadOn == markOnTyping)
MarkMessagesRead(hContact);
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index d6a7902d6d..3422e066f6 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -81,7 +81,7 @@ struct CVkProto : public PROTO<CVkProto> void OnOAuthAuthorize(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
void OnReceiveAvatar(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
-
+
//==== Services ======================================================================
INT_PTR __cdecl SvcCreateAccMgrUI(WPARAM, LPARAM);
@@ -141,26 +141,26 @@ struct CVkProto : public PROTO<CVkProto> void OnReciveUploadServer(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
void OnReciveUpload(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
void OnReciveUploadFile(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
-
+
//==== 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);
void NotificationMarkAsViewed();
@@ -174,7 +174,7 @@ struct CVkProto : public PROTO<CVkProto> TCHAR* GetUserStoredPassword(void);
void SetAllContactStatuses(int status);
-
+
MCONTACT FindUser(LONG userid, bool bCreate = false);
MCONTACT FindChat(LONG dwUserid);
@@ -328,7 +328,7 @@ private: };
OBJLIST<Cookie> m_cookies;
-
+
void InitQueue();
void UninitQueue();
void ExecuteRequest(AsyncHttpRequest*);
@@ -351,7 +351,6 @@ private: void __cdecl SendMsgAck(void *param);
//============== Options =============================================================
-
bool m_prevError,
m_bOnline,
@@ -403,10 +402,10 @@ private: 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;
@@ -431,9 +430,9 @@ private: m_hPollingThread,
m_hPopupClassError,
m_hPopupClassNotification;
-
+
ULONG m_msgId;
-
+
LIST<void> m_sendIds;
LIST<void> m_incIds;
diff --git a/protocols/VKontakte/src/vk_queue.cpp b/protocols/VKontakte/src/vk_queue.cpp index e553905e45..0a5ae06552 100644 --- a/protocols/VKontakte/src/vk_queue.cpp +++ b/protocols/VKontakte/src/vk_queue.cpp @@ -144,11 +144,11 @@ void CVkProto::WorkerThread(void*) if (m_bTerminated)
break;
ExecuteRequest(pReq);
- if (need_sleep) { // There can be maximum 3 requests to API methods per second from a client
+ if (need_sleep) { // There can be maximum 3 requests to API methods per second from a client
Sleep(330); // (c) https://vk.com/dev/api_requests
debugLogA("CVkProto::WorkerThread: need sleep");
- }
- }
+ }
+ }
}
m_hWorkerThread = 0;
diff --git a/protocols/VKontakte/src/vk_search.cpp b/protocols/VKontakte/src/vk_search.cpp index 9180ca6c1c..cdc80f8196 100644 --- a/protocols/VKontakte/src/vk_search.cpp +++ b/protocols/VKontakte/src/vk_search.cpp @@ -69,7 +69,7 @@ void CVkProto::SearchByMailThread(void* email) void __cdecl CVkProto::SearchThread(void* p)
{
PROTOSEARCHBYNAME *pParam = (PROTOSEARCHBYNAME *)p;
-
+
TCHAR arg[200];
mir_sntprintf(arg, _T("%s %s %s"), pParam->pszFirstName, pParam->pszNick, pParam->pszLastName);
debugLog(_T("CVkProto::SearchThread %s"), arg);
@@ -119,7 +119,7 @@ void CVkProto::OnSearch(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) const JSONNode &jnRecord = (*it);
if (!jnRecord)
break;
-
+
PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_TCHAR;
@@ -133,7 +133,7 @@ void CVkProto::OnSearch(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) psr.firstName.t = mir_tstrdup(FirstName);
psr.lastName.t = mir_tstrdup(LastName);
psr.nick.t = Nick.IsEmpty() ? mir_tstrdup(Domain) : mir_tstrdup(Nick);
-
+
bool filter = true;
if (pParam) {
if (psr.firstName.t && pParam->pszFirstName)
@@ -172,7 +172,7 @@ void CVkProto::OnSearchByMail(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1);
return;
}
-
+
for (auto it = jnItems.begin(); it != jnItems.end(); ++it) {
const JSONNode &jnRecord = (*it);
if (!jnRecord)
@@ -187,13 +187,12 @@ void CVkProto::OnSearchByMail(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) CMString Nick(jnRecord["nickname"].as_mstring());
CMString Email(jnRecord["contact"].as_mstring());
-
psr.id.t = mir_tstrdup(Id);
psr.firstName.t = mir_tstrdup(FirstName);
psr.lastName.t = mir_tstrdup(LastName);
psr.nick.t = Nick.IsEmpty() ? mir_tstrdup(Email) : mir_tstrdup(Nick);
psr.email.t = mir_tstrdup(Email);
-
+
ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr);
}
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 7a1e6e9a54..f6a02cbfa4 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -178,7 +178,7 @@ void CVkProto::OnOAuthAuthorize(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq ConnectionFailed(LOGINERR_WRONGPASSWORD);
return;
}
-
+
CMStringA szAction, szBody;
bool bSuccess = AutoFillForm(reply->pData, szAction, szBody);
if (!bSuccess || szAction.IsEmpty() || szBody.IsEmpty()) {
@@ -227,9 +227,8 @@ void CVkProto::OnReceiveMyInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) const JSONNode &jnResponse = CheckJsonResponse(pReq, reply, jnRoot);
if (!jnResponse)
return;
-
- const JSONNode &jnUser = *(jnResponse.begin());
+ const JSONNode &jnUser = *(jnResponse.begin());
m_myUserId = jnUser["id"].as_int();
setDword("ID", m_myUserId);
@@ -254,7 +253,7 @@ MCONTACT CVkProto::SetContactInfo(const JSONNode &jnItem, bool flag, bool self) return NULL;
MCONTACT hContact = FindUser(userid, flag);
-
+
if (userid == m_myUserId) {
if (hContact != NULL)
if (self)
@@ -264,7 +263,7 @@ MCONTACT CVkProto::SetContactInfo(const JSONNode &jnItem, bool flag, bool self) }
else if (hContact == NULL)
return NULL;
-
+
CMString tszNick, tszValue;
int iValue;
@@ -323,14 +322,14 @@ MCONTACT CVkProto::SetContactInfo(const JSONNode &jnItem, bool flag, bool self) }
else
SetMirVer(hContact, -1); // unset MinVer
-
+
if ((iValue = jnItem["timezone"].as_int()) != 0)
setByte(hContact, "Timezone", iValue * -2);
tszValue = jnItem["mobile_phone"].as_mstring();
if (!tszValue.IsEmpty())
setTString(hContact, "Cellular", tszValue);
-
+
tszValue = jnItem["home_phone"].as_mstring();
if (!tszValue.IsEmpty())
setTString(hContact, "Phone", tszValue);
@@ -358,7 +357,6 @@ MCONTACT CVkProto::SetContactInfo(const JSONNode &jnItem, bool flag, bool self) db_unset(hContact, m_szModuleName, "AudioUrl");
}
-
tszValue = jnItem["about"].as_mstring();
if (!tszValue.IsEmpty())
setTString(hContact, "About", tszValue);
@@ -379,7 +377,7 @@ void CVkProto::RetrieveUserInfo(LONG userID) debugLogA("CVkProto::RetrieveUserInfo (%d)", userID);
if (userID == VK_FEED_USER || !IsOnline())
return;
-
+
CMString code(FORMAT, _T("var userIDs=\"%i\";var res=API.users.get({\"user_ids\":userIDs,\"fields\":\"%s\",\"name_case\":\"nom\"});return{\"freeoffline\":0,\"norepeat\":1,\"usercount\":res.length,\"users\":res};"),
userID, CMString(fieldsName));
Push(new AsyncHttpRequest(this, REQUEST_POST, "/method/execute.json", true, &CVkProto::OnReceiveUserInfo)
@@ -407,7 +405,7 @@ void CVkProto::RetrieveUsersInfo(bool bFreeOffline, bool bRepeat) if (m_bNeedSendOnline)
codeformat += _T("API.account.setOnline();");
-
+
if (bFreeOffline && !m_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\"});"
@@ -431,7 +429,7 @@ void CVkProto::OnReceiveUserInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe if (reply->resultCode != 200 || !IsOnline())
return;
-
+
JSONNode jnRoot;
const JSONNode &jnResponse = CheckJsonResponse(pReq, reply, jnRoot);
if (!jnResponse)
@@ -448,7 +446,7 @@ void CVkProto::OnReceiveUserInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe MCONTACT hContact;
LIST<void> arContacts(10, PtrKeySortT);
-
+
for (hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName))
if (!isChatRoom(hContact))
arContacts.insert((HANDLE)hContact);
@@ -482,7 +480,7 @@ void CVkProto::OnReceiveUserInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe const JSONNode &jnRequests = jnResponse["requests"];
if (!jnRequests)
return;
-
+
int iCount = jnRequests["count"].as_int();
const JSONNode &jnItems = jnRequests["items"];
if (!iCount || !jnItems)
@@ -536,7 +534,6 @@ void CVkProto::OnReceiveFriends(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq arContacts.insert((HANDLE)hContact);
}
-
const JSONNode &jnItems = jnResponse["items"];
if (jnItems)
@@ -580,8 +577,7 @@ INT_PTR __cdecl CVkProto::SvcDeleteFriend(WPARAM hContact, LPARAM flag) LONG userID = getDword(hContact, "ID", -1);
if (!IsOnline() || userID == -1 || userID == VK_FEED_USER)
return 1;
-
-
+
ptrT ptszNick(db_get_tsa(hContact, m_szModuleName, "Nick"));
CMString ptszMsg;
if (flag == 0) {
@@ -618,7 +614,7 @@ void CVkProto::OnReceiveDeleteFriend(NETLIBHTTPREQUEST* reply, AsyncHttpRequest* msgformat = TranslateT("Friend request from the user %s declined");
else if (jnResponse["suggestion_deleted"].as_bool())
msgformat = TranslateT("Friend request suggestion for the user %s deleted");
-
+
msg.AppendFormat(msgformat, tszNick);
MsgPopup(param->hContact, msg, tszNick);
setByte(param->hContact, "Auth", 1);
@@ -626,7 +622,7 @@ void CVkProto::OnReceiveDeleteFriend(NETLIBHTTPREQUEST* reply, AsyncHttpRequest* else {
msg = TranslateT("User or request was not deleted");
MsgPopup(param->hContact, msg, tszNick);
- }
+ }
}
}
@@ -722,7 +718,7 @@ INT_PTR __cdecl CVkProto::SvcOpenBroadcast(WPARAM hContact, LPARAM) CMString tszAudio(ptrT(db_get_tsa(hContact, m_szModuleName, "AudioUrl")));
if (!tszAudio.IsEmpty())
Utils_OpenUrlT(tszAudio);
-
+
return 0;
}
|