diff options
author | ElzorFox <elzorfox@ya.ru> | 2017-04-14 09:41:48 +0500 |
---|---|---|
committer | ElzorFox <elzorfox@ya.ru> | 2017-04-14 09:41:48 +0500 |
commit | b177a65e73448e889ede1fb0e9ed2b0ce1be7d3d (patch) | |
tree | e2f9bb7122277299b7c503a536fd6d2651339547 /protocols/VKontakte | |
parent | 7b30de3fe30115c40ab2f2a0e720123a13d67305 (diff) |
VKontakte: code cleaning
Diffstat (limited to 'protocols/VKontakte')
-rw-r--r-- | protocols/VKontakte/src/misc.cpp | 16 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_captcha.cpp | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_chats.cpp | 57 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_feed.cpp | 34 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_files.cpp | 18 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_history.cpp | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_messages.cpp | 4 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_pollserver.cpp | 5 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.cpp | 52 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_queue.cpp | 4 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_search.cpp | 4 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_status.cpp | 5 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_struct.cpp | 2 |
13 files changed, 102 insertions, 103 deletions
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 6e59629fd9..e81995c79a 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -260,7 +260,7 @@ bool CVkProto::CheckJsonResult(AsyncHttpRequest *pReq, const JSONNode &jnNode) debugLogA("CVkProto::CheckJsonResult");
if (!jnNode) {
- if (pReq)
+ if (pReq)
pReq->m_iErrorCode = VKERR_NO_JSONNODE;
return false;
}
@@ -271,13 +271,13 @@ bool CVkProto::CheckJsonResult(AsyncHttpRequest *pReq, const JSONNode &jnNode) if (!jnError || !jnErrorCode)
return true;
-
+
int iErrorCode = jnErrorCode.as_int();
debugLogA("CVkProto::CheckJsonResult %d", iErrorCode);
if (!pReq)
return (iErrorCode == 0);
- pReq->m_iErrorCode = iErrorCode;
+ pReq->m_iErrorCode = iErrorCode;
switch (iErrorCode) {
case VKERR_AUTHORIZATION_FAILED:
ConnectionFailed(LOGINERR_WRONGPASSWORD);
@@ -317,7 +317,7 @@ bool CVkProto::CheckJsonResult(AsyncHttpRequest *pReq, const JSONNode &jnNode) case VKERR_INTERNAL_SERVER_ERR:
if (pReq->m_iRetry > 0) {
pReq->bNeedsRestart = true;
- Sleep(1000); //Pause for fix err
+ Sleep(1000); //Pause for fix err
debugLogA("CVkProto::CheckJsonResult Retry = %d", pReq->m_iRetry);
pReq->m_iRetry--;
}
@@ -345,7 +345,7 @@ bool CVkProto::CheckJsonResult(AsyncHttpRequest *pReq, const JSONNode &jnNode) case VKERR_HIMSELF_AS_FRIEND:
case VKERR_YOU_ON_BLACKLIST:
case VKERR_USER_ON_BLACKLIST:
- // See CVkProto::SendFileFiled
+ // See CVkProto::SendFileFiled
break;
}
@@ -685,18 +685,18 @@ int CVkProto::IsHystoryMessageExist(MCONTACT hContact) {
if (!hContact)
return 0;
-
+
MEVENT hDBEvent = db_event_first(hContact);
if (!hDBEvent)
return 0;
-
+
do {
DBEVENTINFO dbei = {};
db_event_get(hDBEvent, &dbei);
if (dbei.eventType != VK_USER_DEACTIVATE_ACTION)
return 1;
-
+
hDBEvent = db_event_next(hContact, hDBEvent);
} while (hDBEvent);
diff --git a/protocols/VKontakte/src/vk_captcha.cpp b/protocols/VKontakte/src/vk_captcha.cpp index 98fa443e86..933647b969 100644 --- a/protocols/VKontakte/src/vk_captcha.cpp +++ b/protocols/VKontakte/src/vk_captcha.cpp @@ -62,7 +62,7 @@ bool CVkProto::RunCaptchaForm(LPCSTR szUrl, CMStringA &result) CVkCaptchaForm dlg(this, ¶m);
if (!dlg.DoModal())
return false;
-
+
debugLogA("CVkProto::RunCaptchaForm: user entered text %s", param.Result);
result = param.Result;
return true;
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index 725e48d25f..03c2b416c2 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -33,7 +33,7 @@ CVkChatInfo* CVkProto::AppendChat(int id, const JSONNode &jnDlg) debugLogW(L"CVkProto::AppendChat");
if (id == 0)
return NULL;
-
+
if (jnDlg) {
CMStringW action_chat = jnDlg["action"].as_mstring();
int action_mid = _wtoi(jnDlg["action_mid"].as_mstring());
@@ -56,7 +56,7 @@ CVkChatInfo* CVkProto::AppendChat(int id, const JSONNode &jnDlg) c->m_wszTopic = mir_wstrdup(!wszTitle.IsEmpty() ? wszTitle : L"");
}
- CMStringW sid;
+ CMStringW sid;
sid.Format(L"%S_%d", m_szModuleName, id);
c->m_wszId = mir_wstrdup(sid);
@@ -73,7 +73,7 @@ CVkChatInfo* CVkProto::AppendChat(int id, const JSONNode &jnDlg) CMStringW wszHomepage(FORMAT, L"https://vk.com/im?sel=c%d", id);
setWString(si->hContact, "Homepage", wszHomepage);
-
+
db_unset(si->hContact, m_szModuleName, "off");
if (jnDlg && jnDlg["left"].as_bool()) {
@@ -149,7 +149,7 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe cc->m_users.insert(cu = new CVkChatUser(uid));
bNew = true;
}
- else
+ else
bNew = cu->m_bUnknown;
cu->m_bDel = false;
@@ -161,7 +161,7 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe }
cu->m_wszNick = mir_wstrdup(wszNick);
cu->m_bUnknown = false;
-
+
if (bNew) {
GCDEST gcd = { m_szModuleName, cc->m_wszId, GC_EVENT_JOIN };
GCEVENT gce = { &gcd };
@@ -201,7 +201,7 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe CVkChatUser *cu = cc->m_users.find((CVkChatUser*)&uid);
if (cu)
continue;
-
+
MCONTACT hContact = FindUser(uid);
if (hContact)
continue;
@@ -215,7 +215,6 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe const JSONNode &jnMsgs = jnResponse["msgs"];
const JSONNode &jnFUsers = jnResponse["fwd_users"];
if (jnMsgs) {
-
const JSONNode &jnItems = jnMsgs["items"];
if (jnItems) {
for (auto it = jnItems.begin(); it != jnItems.end(); ++it) {
@@ -294,7 +293,7 @@ void CVkProto::AppendChatMessage(int id, const JSONNode &jnMsg, const JSONNode & if (jnMsg["action"]) {
bIsAction = true;
CMStringW wszAction = jnMsg["action"].as_mstring();
-
+
if (wszAction == L"chat_create") {
CMStringW wszActionText = jnMsg["action_text"].as_mstring();
wszBody.AppendFormat(L"%s \"%s\"", TranslateT("create chat"), wszActionText.IsEmpty() ? L" " : wszActionText);
@@ -320,7 +319,7 @@ void CVkProto::AppendChatMessage(int id, const JSONNode &jnMsg, const JSONNode & else
wszBody.AppendFormat(L"%s %s (https://vk.com/id%d)", TranslateT("kick user"), cu->m_wszNick, a_uid);
}
- else
+ else
wszBody = TranslateT("kick user");
}
}
@@ -495,7 +494,7 @@ void CVkProto::OnSendChatMsg(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) }
if (!pReq->pUserInfo)
return;
-
+
CVkFileUploadParam *fup = (CVkFileUploadParam *)pReq->pUserInfo;
ProtoBroadcastAck(fup->hContact, ACKTYPE_FILE, iResult, (HANDLE)(fup));
if (!pReq->bNeedsRestart || m_bTerminated) {
@@ -526,7 +525,7 @@ void CVkProto::LogMenuHook(CVkChatInfo *cc, GCHOOK *gch) case IDM_TOPIC:
if (LPTSTR pwszNew = ChangeChatTopic(cc)) {
Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/messages.editChat.json", true, &CVkProto::OnReceiveSmth)
- << WCHAR_PARAM("title", pwszNew)
+ << WCHAR_PARAM("title", pwszNew)
<< INT_PARAM("chat_id", cc->m_chatid));
mir_free(pwszNew);
}
@@ -554,7 +553,7 @@ void CVkProto::LogMenuHook(CVkChatInfo *cc, GCHOOK *gch) << INT_PARAM("chatid", cc->m_chatid)
<< INT_PARAM("userid", m_myUserId)
)->pUserInfo = cc;
-
+
break;
}
}
@@ -567,12 +566,12 @@ INT_PTR __cdecl CVkProto::OnJoinChat(WPARAM hContact, LPARAM) if (getBool(hContact, "kicked"))
return 1;
-
+
if (!getBool(hContact, "off"))
return 1;
int chat_id = getDword(hContact, "vk_chat_id", VK_INVALID_USER);
-
+
if (chat_id == VK_INVALID_USER)
return 1;
@@ -598,7 +597,7 @@ INT_PTR __cdecl CVkProto::OnLeaveChat(WPARAM hContact, LPARAM) CVkChatInfo *cc = GetChatById(wszChatID);
if (cc == NULL)
return 1;
-
+
Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/messages.removeChatUser.json", true, &CVkProto::OnChatLeave)
<< INT_PARAM("chat_id", cc->m_chatid)
<< INT_PARAM("user_id", m_myUserId))->pUserInfo = cc;
@@ -617,7 +616,7 @@ void CVkProto::LeaveChat(int chat_id, bool close_window, bool delete_chat) Chat_Terminate(m_szModuleName, cc->m_wszId);
else
Chat_Control(m_szModuleName, cc->m_wszId, SESSION_OFFLINE);
-
+
if (delete_chat)
db_delete_contact(cc->m_hContact);
else
@@ -649,7 +648,7 @@ void CVkProto::KickFromChat(int chat_id, int user_id, const JSONNode &jnMsg, con else
msg += TranslateT("(Unknown contact)");
}
- else
+ else
AppendChatMessage(chat_id, jnMsg, jnFUsers, false);
MsgPopup(hContact, msg, TranslateT("Chat"));
@@ -675,7 +674,7 @@ INT_PTR __cdecl CVkProto::SvcDestroyKickChat(WPARAM hContact, LPARAM) if (!getBool(hContact, "off"))
return 1;
-
+
int chat_id = getDword(hContact, "vk_chat_id", VK_INVALID_USER);
if (chat_id == VK_INVALID_USER)
return 1;
@@ -728,7 +727,7 @@ void CVkProto::NickMenuHook(CVkChatInfo *cc, GCHOOK *gch) hContact = FindUser(cu->m_uid);
if (hContact == NULL)
Utils_OpenUrlW(CMStringW(FORMAT, L"https://vk.com/id%d", cu->m_uid));
- else
+ else
SvcVisitProfile(hContact, 0);
break;
@@ -752,7 +751,7 @@ void CVkProto::NickMenuHook(CVkChatInfo *cc, GCHOOK *gch) gce.time = time(NULL);
Chat_Event(&gce);
- cu->m_wszNick = mir_wstrdup(wszNewNick);
+ cu->m_wszNick = mir_wstrdup(wszNewNick);
setWString(cc->m_hContact, CMStringA(FORMAT, "nick%d", cu->m_uid), wszNewNick);
}
break;
@@ -762,7 +761,7 @@ void CVkProto::NickMenuHook(CVkChatInfo *cc, GCHOOK *gch) return;
Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/messages.removeChatUser.json", true, &CVkProto::OnReceiveSmth)
- << INT_PARAM("chat_id", cc->m_chatid)
+ << INT_PARAM("chat_id", cc->m_chatid)
<< INT_PARAM("user_id", cu->m_uid));
cu->m_bUnknown = true;
@@ -833,14 +832,14 @@ void CVkProto::ChatContactTypingThread(void *p) delete param;
return;
}
-
+
{
mir_cslock lck(m_csChatTyping);
CVKChatContactTypingParam *cp = (CVKChatContactTypingParam *)m_ChatsTyping.find((CVKChatContactTypingParam *)&iChatId);
if (cp != NULL)
- m_ChatsTyping.remove(cp);
+ m_ChatsTyping.remove(cp);
m_ChatsTyping.insert(param);
-
+
StatusTextData st = { 0 };
mir_snwprintf(st.tszText, TranslateT("%s is typing a message..."), cu->m_wszNick);
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact, (LPARAM)&st);
@@ -854,17 +853,17 @@ void CVkProto::StopChatContactTyping(int iChatId, int iUserId) {
debugLogA("CVkProto::StopChatContactTyping %d %d", iChatId, iUserId);
MCONTACT hChatContact = FindChat(iChatId);
- if (hChatContact && getBool(hChatContact, "off"))
+ if (hChatContact && getBool(hChatContact, "off"))
return;
-
+
CVkChatInfo *cc = (CVkChatInfo*)m_chats.find((CVkChatInfo*)&iChatId);
if (cc == NULL)
return;
-
+
CVkChatUser *cu = cc->GetUserById(iUserId);
if (cu == NULL)
return;
-
+
mir_cslock lck(m_csChatTyping);
CVKChatContactTypingParam *cp = (CVKChatContactTypingParam *)m_ChatsTyping.find((CVKChatContactTypingParam *)&iChatId);
@@ -874,7 +873,7 @@ void CVkProto::StopChatContactTyping(int iChatId, int iUserId) StatusTextData st = { 0 };
mir_snwprintf(st.tszText, L" ");
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact, (LPARAM)&st);
-
+
// After that I call standard cleaning procedure:
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact);
}
diff --git a/protocols/VKontakte/src/vk_feed.cpp b/protocols/VKontakte/src/vk_feed.cpp index 7ea9d7fa97..694d91b7ca 100644 --- a/protocols/VKontakte/src/vk_feed.cpp +++ b/protocols/VKontakte/src/vk_feed.cpp @@ -38,7 +38,7 @@ void CVkProto::AddFeedSpecialUser() setWString(hContact, "domain", L"feed");
setWString(hContact, "Homepage", L"https://vk.com/feed");
- }
+ }
if (getWord(hContact, "Status") != ID_STATUS_ONLINE)
setWord(hContact, "Status", ID_STATUS_ONLINE);
@@ -48,7 +48,7 @@ void CVkProto::AddFeedSpecialUser() void CVkProto::AddFeedEvent(CVKNewsItem& vkNewsItem)
{
- if (vkNewsItem.wszText.IsEmpty())
+ if (vkNewsItem.wszText.IsEmpty())
return;
MCONTACT hContact = FindUser(VK_FEED_USER, true);
@@ -143,7 +143,7 @@ void CVkProto::CreateVkUserInfoList(OBJLIST<CVkUserInfo> &vkUsers, const JSONNod }
const JSONNode &jnGroups = jnResponse["groups"];
- if (jnGroups)
+ if (jnGroups)
for (auto it = jnGroups.begin(); it != jnGroups.end(); ++it) {
const JSONNode &jnProfile = (*it);
if (!jnProfile["id"])
@@ -185,9 +185,9 @@ CVKNewsItem* CVkProto::GetVkNewsItem(const JSONNode &jnItem, OBJLIST<CVkUserInfo if (vkNewsItem->wszType == L"photo_tag") {
bPostLink = false;
const JSONNode &jnPhotos = jnItem["photo_tags"];
- if (jnPhotos) {
+ if (jnPhotos) {
const JSONNode &jnPhotoItems = jnPhotos["items"];
- if (jnPhotoItems) {
+ if (jnPhotoItems) {
wszText = TranslateT("User was tagged in these photos:");
wszPopupText = wszText + TranslateT("(photos)");
for (auto it = jnPhotoItems.begin(); it != jnPhotoItems.end(); ++it)
@@ -217,7 +217,7 @@ CVKNewsItem* CVkProto::GetVkNewsItem(const JSONNode &jnItem, OBJLIST<CVkUserInfo }
}
}
- }
+ }
else if (vkNewsItem->wszType == L"post" || vkNewsItem->wszType.IsEmpty()) {
bPostLink = true;
const JSONNode &jnRepost = jnItem["copy_history"];
@@ -258,8 +258,8 @@ CVKNewsItem* CVkProto::GetVkNewsItem(const JSONNode &jnItem, OBJLIST<CVkUserInfo bPostLink = false;
}
- vkNewsItem->wszText.AppendFormat(wszResFormat,
- SetBBCString(vkNewsItem->vkUser->m_wszUserNick, m_vkOptions.BBCForNews(), vkbbcUrl,
+ vkNewsItem->wszText.AppendFormat(wszResFormat,
+ SetBBCString(vkNewsItem->vkUser->m_wszUserNick, m_vkOptions.BBCForNews(), vkbbcUrl,
vkNewsItem->vkUser->m_wszLink).c_str(), wszText.c_str());
vkNewsItem->wszPopupTitle.AppendFormat(wszTitleFormat, vkNewsItem->vkUser->m_wszUserNick.c_str());
vkNewsItem->wszPopupText = wszPopupText;
@@ -298,7 +298,7 @@ CMStringW CVkProto::GetVkFeedback(const JSONNode &jnFeedback, VKObjType vkFeedba }
else if (vkFeedbackType == VKObjType::vkUsers || vkFeedbackType == vkCopy) {
const JSONNode &jnUsers = jnFeedback["items"];
-
+
CMStringW wszUsers;
for (auto it = jnUsers.begin(); it != jnUsers.end(); ++it) {
const JSONNode &jnUserItem = (*it);
@@ -520,7 +520,7 @@ void CVkProto::OnFriendAccepted(const JSONNode & jnFeedback) LONG iUserId = jnUserItem["from_id"].as_int();
MCONTACT hContact = FindUser(iUserId, true);
- RetrieveUserInfo(iUserId);
+ RetrieveUserInfo(iUserId);
CVkDBAddAuthRequestThreadParam *param = new CVkDBAddAuthRequestThreadParam(hContact, true);
ForkThread(&CVkProto::DBAddAuthRequestThread, (void *)param);
}
@@ -545,7 +545,7 @@ CVKNewsItem* CVkProto::GetVkGroupInvates(const JSONNode &jnItem, OBJLIST<CVkUser if (wszIds.Find(wszId, 0) != -1)
return NULL;
-
+
LONG iUserId = !jnItem["invited_by"] ? 0 : jnItem["invited_by"].as_int();
CVKNewsItem *vkNotification = new CVKNewsItem();
vkNotification->tDate = time(NULL);
@@ -633,7 +633,7 @@ static int sttCompareVKNewsItems(const CVKNewsItem *p1, const CVKNewsItem *p2) int compareId = p1->wszId.Compare(p2->wszId);
LONG compareUserId = p1->vkUser->m_UserId - p2->vkUser->m_UserId;
LONG compareDate = (LONG)p1->tDate - (LONG)p2->tDate;
-
+
return compareId ? (compareDate ? compareDate : compareUserId) : 0;
}
@@ -676,7 +676,7 @@ void CVkProto::OnReceiveUnreadNews(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *p vkNews.remove(vkNewsFoundItem);
vkNews.insert(vkNewsItem);
}
- else
+ else
delete vkNewsItem;
}
@@ -689,7 +689,7 @@ void CVkProto::OnReceiveUnreadNews(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *p if (bNewsAdded)
AddCListEvent(true);
-
+
setDword("LastNewsTime", time(NULL));
vkNews.destroy();
@@ -738,7 +738,7 @@ bool CVkProto::FilterNotification(CVKNewsItem* vkNotificationItem, bool& isComme result = (vkNotificationItem->vkParentType == vkInvite && m_vkOptions.bNotificationFilterInvites) || result;
isCommented = (vkNotificationItem->vkFeedbackType == vkComment);
-
+
return result;
}
@@ -768,10 +768,10 @@ void CVkProto::OnReceiveUnreadNotifications(NETLIBHTTPREQUEST *reply, AsyncHttpR OBJLIST<CVkUserInfo> vkUsers(5, NumericKeySortT);
OBJLIST<CVKNewsItem> vkNotification(5, sttCompareVKNotificationItems);
-
+
CreateVkUserInfoList(vkUsers, jnNotifications);
CreateVkUserInfoList(vkUsers, jnGroupInvates);
-
+
if (jnNotifications) {
const JSONNode &jnItems = jnNotifications["items"];
diff --git a/protocols/VKontakte/src/vk_files.cpp b/protocols/VKontakte/src/vk_files.cpp index 12cc1b73eb..d00b29ee36 100644 --- a/protocols/VKontakte/src/vk_files.cpp +++ b/protocols/VKontakte/src/vk_files.cpp @@ -26,13 +26,13 @@ HANDLE CVkProto::SendFile(MCONTACT hContact, const wchar_t *desc, wchar_t **file return (HANDLE)0;
CVkFileUploadParam *fup = new CVkFileUploadParam(hContact, desc, files);
-
+
ProtoBroadcastAck(fup->hContact, ACKTYPE_FILE, ACKRESULT_INITIALISING, (HANDLE)fup);
-
+
if (!fup->IsAccess()) {
SendFileFiled(fup, VKERR_FILE_NOT_EXIST);
return (HANDLE)0;
- }
+ }
AsyncHttpRequest *pReq;
switch (fup->GetType()) {
@@ -105,7 +105,7 @@ void CVkProto::SendFileFiled(CVkFileUploadParam *fup, int ErrorCode) wszError = TranslateT("Invalid audio");
break;
case VKERR_AUDIO_DEL_COPYRIGHT:
- wszError = TranslateT("The audio file was removed by the copyright holder and cannot be reuploaded");
+ wszError = TranslateT("The audio file was removed by the copyright holder and cannot be reuploaded");
break;
case VKERR_INVALID_FILENAME:
wszError = TranslateT("Invalid filename");
@@ -116,7 +116,7 @@ void CVkProto::SendFileFiled(CVkFileUploadParam *fup, int ErrorCode) default:
wszError = TranslateT("Unknown error occurred");
}
- ProtoBroadcastAck(fup->hContact, ACKTYPE_FILE, ErrorCode== VKERR_AUDIO_DEL_COPYRIGHT ? ACKRESULT_DENIED : ACKRESULT_FAILED, (HANDLE)fup);
+ ProtoBroadcastAck(fup->hContact, ACKTYPE_FILE, ErrorCode == VKERR_AUDIO_DEL_COPYRIGHT ? ACKRESULT_DENIED : ACKRESULT_FAILED, (HANDLE)fup);
debugLogW(L"CVkProto::SendFileFiled error code = %d (%s)", ErrorCode, wszError.c_str());
MsgPopup(NULL, wszError, TranslateT("File upload error"), true);
delete fup;
@@ -149,7 +149,7 @@ void CVkProto::OnReciveUploadServer(NETLIBHTTPREQUEST *reply, AsyncHttpRequest * SendFileFiled(fup, VKERR_INVALID_URL);
return;
}
-
+
FILE *pFile = _wfopen(fup->FileName, L"rb");
if (pFile == NULL) {
SendFileFiled(fup, VKERR_ERR_OPEN_FILE);
@@ -287,7 +287,7 @@ void CVkProto::OnReciveUpload(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) }
pUploadReq = new AsyncHttpRequest(this, REQUEST_GET, "/method/docs.save.json", true, &CVkProto::OnReciveUploadFile)
<< CHAR_PARAM("title", fup->fileName())
- << WCHAR_PARAM("file", upload) ;
+ << WCHAR_PARAM("file", upload);
break;
default:
SendFileFiled(fup, VKERR_FTYPE_NOT_SUPPORTED);
@@ -320,7 +320,7 @@ void CVkProto::OnReciveUploadFile(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pR }
int id = fup->GetType() == CVkFileUploadParam::typeAudio ? jnResponse["id"].as_int() : (*jnResponse.begin())["id"].as_int();
- int owner_id = fup->GetType() == CVkFileUploadParam::typeAudio ? jnResponse["owner_id"].as_int() : (*jnResponse.begin())["owner_id"].as_int();
+ int owner_id = fup->GetType() == CVkFileUploadParam::typeAudio ? jnResponse["owner_id"].as_int() : (*jnResponse.begin())["owner_id"].as_int();
if ((id == 0) || (owner_id == 0)) {
SendFileFiled(fup, VKERR_INVALID_PARAMETERS);
return;
@@ -374,7 +374,7 @@ void CVkProto::OnReciveUploadFile(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pR pMsgReq = new AsyncHttpRequest(this, REQUEST_POST, "/method/messages.send.json", true, &CVkProto::OnSendMessage, AsyncHttpRequest::rpHigh)
<< INT_PARAM("user_id", userID);
pMsgReq->pUserInfo = new CVkSendMsgParam(fup->hContact, fup);
-
+
}
pMsgReq << WCHAR_PARAM("message", fup->Desc) << WCHAR_PARAM("attachment", Attachment);
diff --git a/protocols/VKontakte/src/vk_history.cpp b/protocols/VKontakte/src/vk_history.cpp index 2383922618..163a06ddbc 100644 --- a/protocols/VKontakte/src/vk_history.cpp +++ b/protocols/VKontakte/src/vk_history.cpp @@ -213,7 +213,7 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque MsgPopup(NULL, TranslateT("Loading messages for all contacts is completed."), TranslateT("Loading history"));
m_bNotifyForEndLoadingHistoryAllContact = m_bNotifyForEndLoadingHistory = false;
}
-
+
delete param;
pReq->pUserInfo = NULL;
}
diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp index a54d8451aa..26fd4c2ad2 100644 --- a/protocols/VKontakte/src/vk_messages.cpp +++ b/protocols/VKontakte/src/vk_messages.cpp @@ -430,7 +430,7 @@ void CVkProto::OnReceiveDlgs(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) int mid = jnDlg["id"].as_int();
m_bNotifyForEndLoadingHistory = false;
- if (getDword(hContact, "lastmsgid", -1) == -1 && numUnread && !getBool(hContact, "ActiveHistoryTask")) {
+ if (getDword(hContact, "lastmsgid", -1) == -1 && numUnread && !getBool(hContact, "ActiveHistoryTask")) {
setByte(hContact, "ActiveHistoryTask", 1);
GetServerHistory(hContact, 0, numUnread, 0, 0, true);
}
@@ -441,7 +441,7 @@ void CVkProto::OnReceiveDlgs(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) MarkMessagesRead(hContact);
}
else if (numUnread && !getBool(hContact, "ActiveHistoryTask")) {
-
+
m_bNotifyForEndLoadingHistory = false;
setByte(hContact, "ActiveHistoryTask", 1);
GetServerHistory(hContact, 0, numUnread, 0, 0, true);
diff --git a/protocols/VKontakte/src/vk_pollserver.cpp b/protocols/VKontakte/src/vk_pollserver.cpp index adaaaaaf83..f3a28c6e21 100644 --- a/protocols/VKontakte/src/vk_pollserver.cpp +++ b/protocols/VKontakte/src/vk_pollserver.cpp @@ -78,7 +78,6 @@ void CVkProto::PollUpdates(const JSONNode &jnUpdates) int msgid, uid, flags, platform;
MCONTACT hContact;
-
for (auto it = jnUpdates.begin(); it != jnUpdates.end(); ++it) {
const JSONNode &jnChild = (*it).as_array();
switch (jnChild[json_index_t(0)].as_int()) {
@@ -96,7 +95,7 @@ void CVkProto::PollUpdates(const JSONNode &jnUpdates) MessageReadData data(time(NULL), MRD_TYPE_READTIME);
CallService(MS_MESSAGESTATE_UPDATE, hContact, (LPARAM)&data);
}
- else
+ else
SetSrmmReadStatus(hContact);
if (m_vkOptions.bUserForceInvisibleOnActivity)
SetInvisible(hContact);
@@ -267,7 +266,7 @@ void CVkProto::PollingThread(void*) m_pollingConn = NULL;
debugLogA("CVkProto::PollingThread: leaving");
-
+
if (m_hPollingThread) {
CloseHandle(m_hPollingThread);
m_hPollingThread = NULL;
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index f7438c450f..9399a9f97e 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -48,7 +48,7 @@ CVkProto::CVkProto(const char *szModuleName, const wchar_t *pwszUserName) : m_hAPIConnection(NULL),
m_pollingConn(NULL),
m_bSetBroadcast(false),
- m_bNeedSendOnline (false),
+ m_bNeedSendOnline(false),
m_vkOptions(this)
{
InitQueue();
@@ -89,7 +89,7 @@ CVkProto::CVkProto(const char *szModuleName, const wchar_t *pwszUserName) : CVkProto::~CVkProto()
{
debugLogA("CVkProto::~CVkProto");
- Netlib_CloseHandle(m_hNetlibUser);
+ Netlib_CloseHandle(m_hNetlibUser);
m_hNetlibUser = NULL;
UninitQueue();
UnInitMenus();
@@ -227,7 +227,7 @@ void CVkProto::InitMenus() SET_UID(mi, 0x9550515e, 0x2a45, 0x4913, 0x95, 0x1a, 0x1e, 0xfa, 0x7, 0xc6, 0x2d, 0x60);
m_hProtoMenuItems[PMI_VISITPROFILE] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
}
-
+
// Contact Menu Items
mi.root = NULL;
mi.flags = CMIF_UNICODE;
@@ -238,7 +238,7 @@ void CVkProto::InitMenus() mi.name.w = LPGENW("Visit profile");
SET_UID(mi, 0x828cc50e, 0x398d, 0x43a2, 0xbf, 0xd3, 0xa9, 0x96, 0x47, 0x9d, 0x52, 0xff);
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));
@@ -399,19 +399,19 @@ LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa 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;
+ {
+ 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;
+ {
+ CVkSendMsgParam *pd = (CVkSendMsgParam *)PUGetPluginData(hwnd);
+ delete pd;
+ }
+ return FALSE;
default:
break;
}
@@ -534,13 +534,13 @@ int CVkProto::OnEvent(PROTOEVENTTYPE event, WPARAM wParam, LPARAM lParam) {
switch (event) {
case EV_PROTO_ONLOAD:
- return OnModulesLoaded(wParam,lParam);
+ return OnModulesLoaded(wParam, lParam);
case EV_PROTO_ONEXIT:
- return OnPreShutdown(wParam,lParam);
+ return OnPreShutdown(wParam, lParam);
case EV_PROTO_ONOPTIONS:
- return OnOptionsInit(wParam,lParam);
+ return OnOptionsInit(wParam, lParam);
}
return 1;
@@ -570,8 +570,8 @@ int CVkProto::AuthRequest(MCONTACT hContact, const wchar_t *message) LONG userID = getDword(hContact, "ID", VK_INVALID_USER);
if (userID == VK_INVALID_USER || !hContact || userID == VK_FEED_USER)
return 1;
-
- wchar_t msg[501] = {0};
+
+ wchar_t msg[501] = { 0 };
if (message)
wcsncpy_s(msg, _countof(msg), message, _TRUNCATE);
@@ -593,14 +593,14 @@ void CVkProto::OnReceiveAuthRequest(NETLIBHTTPREQUEST *reply, AsyncHttpRequest * int iRet = jnResponse.as_int();
setByte(param->hContact, "Auth", 0);
if (iRet == 2) {
- CMStringW msg,
+ CMStringW msg,
wszNick(ptrW(db_get_wsa(param->hContact, m_szModuleName, "Nick")));
if (wszNick.IsEmpty())
wszNick = TranslateT("(Unknown contact)");
msg.AppendFormat(TranslateT("User %s added as friend"), wszNick.c_str());
MsgPopup(param->hContact, msg, wszNick);
}
- }
+ }
else {
switch (pReq->m_iErrorCode) {
case VKERR_HIMSELF_AS_FRIEND:
@@ -643,7 +643,7 @@ int CVkProto::AuthDeny(MEVENT hDbEvent, const wchar_t*) if (hContact == INVALID_CONTACT_ID)
return 1;
- return SvcDeleteFriend(hContact,(LPARAM)true);
+ return SvcDeleteFriend(hContact, (LPARAM)true);
}
int CVkProto::UserIsTyping(MCONTACT hContact, int type)
@@ -656,9 +656,9 @@ int CVkProto::UserIsTyping(MCONTACT hContact, int type) if (m_vkOptions.iMarkMessageReadOn == MarkMsgReadOn::markOnTyping)
MarkMessagesRead(hContact);
-
+
Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/messages.setActivity.json", true, &CVkProto::OnReceiveSmth, AsyncHttpRequest::rpLow)
- << INT_PARAM("user_id", userID)
+ << INT_PARAM("user_id", userID)
<< CHAR_PARAM("type", "typing"));
return 0;
}
diff --git a/protocols/VKontakte/src/vk_queue.cpp b/protocols/VKontakte/src/vk_queue.cpp index 1113a0850f..fb8a37d882 100644 --- a/protocols/VKontakte/src/vk_queue.cpp +++ b/protocols/VKontakte/src/vk_queue.cpp @@ -167,12 +167,12 @@ void CVkProto::WorkerThread(void*) lWaitingTime = (utime - uTime[0]) > 1000 ? 0 : 1100 - (utime - uTime[0]);
if (!(pReq->m_bApiReq) || lWaitingTime < 0)
- lWaitingTime = 0;
+ lWaitingTime = 0;
}
if (m_bTerminated)
break;
-
+
if (lWaitingTime) {
debugLogA("CVkProto::WorkerThread: need sleep %d msec", lWaitingTime);
Sleep(lWaitingTime);
diff --git a/protocols/VKontakte/src/vk_search.cpp b/protocols/VKontakte/src/vk_search.cpp index 54e7ded0c7..59acb81d46 100644 --- a/protocols/VKontakte/src/vk_search.cpp +++ b/protocols/VKontakte/src/vk_search.cpp @@ -86,7 +86,7 @@ void CVkProto::FreeProtoShearchStruct(PROTOSEARCHBYNAME *pParam) {
if (!pParam)
return;
-
+
mir_free(pParam->pszFirstName);
mir_free(pParam->pszLastName);
mir_free(pParam->pszNick);
@@ -177,7 +177,7 @@ void CVkProto::OnSearchByMail(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_UNICODE;
-
+
CMStringW Id(FORMAT, L"%d", jnRecord["id"].as_int());
CMStringW FirstName(jnRecord["first_name"].as_mstring());
CMStringW LastName(jnRecord["last_name"].as_mstring());
diff --git a/protocols/VKontakte/src/vk_status.cpp b/protocols/VKontakte/src/vk_status.cpp index c723fad766..4dcb8168ed 100644 --- a/protocols/VKontakte/src/vk_status.cpp +++ b/protocols/VKontakte/src/vk_status.cpp @@ -19,7 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. int CVkProto::SetStatus(int iNewStatus)
{
- debugLogA("CVkProto::SetStatus iNewStatus = %d, m_iStatus = %d, m_iDesiredStatus = %d m_hWorkerThread = %d", iNewStatus, m_iStatus, m_iDesiredStatus, m_hWorkerThread == NULL ? 0 : 1);
+ debugLogA("CVkProto::SetStatus iNewStatus = %d, m_iStatus = %d, m_iDesiredStatus = %d m_hWorkerThread = %d",
+ iNewStatus, m_iStatus, m_iDesiredStatus, m_hWorkerThread == NULL ? 0 : 1);
mir_cslock lck(m_csSetStatus);
@@ -180,7 +181,7 @@ void CVkProto::RetrieveStatusMusic(const CMStringW &StatusMsg) debugLogA("CVkProto::RetrieveStatusMusic");
if (!IsOnline() || m_iStatus == ID_STATUS_INVISIBLE || m_vkOptions.iMusicSendMetod == MusicSendMetod::sendNone)
return;
-
+
CMStringW wszOldStatusMsg(db_get_wsa(0, m_szModuleName, "OldStatusMsg"));
if (StatusMsg.IsEmpty()) {
CMStringW code;
diff --git a/protocols/VKontakte/src/vk_struct.cpp b/protocols/VKontakte/src/vk_struct.cpp index da8010e26c..260eb403ab 100644 --- a/protocols/VKontakte/src/vk_struct.cpp +++ b/protocols/VKontakte/src/vk_struct.cpp @@ -248,5 +248,5 @@ CVKOptions::CVKOptions(PROTO_INTERFACE *proto) : db_set_b(NULL, proto->m_szModuleName, "LoadOnlyFriends", bLoadOnlyFriends);
db_unset(NULL, proto->m_szModuleName, "AutoClean");
}
- // Note
+ // Note
}
|