summaryrefslogtreecommitdiff
path: root/protocols/VKontakte/src/vk_chats.cpp
diff options
context:
space:
mode:
authorSergey Bolhovskoy <elzorfox@ya.ru>2015-06-26 07:37:59 +0000
committerSergey Bolhovskoy <elzorfox@ya.ru>2015-06-26 07:37:59 +0000
commitdeb05176bf259030db8d5f8ff7c68b5feb325770 (patch)
treed00388dd336d7ee56e3d60e45dcc218de489299e /protocols/VKontakte/src/vk_chats.cpp
parent3a548ab7449b7c6f444eb7e626636914926380fa (diff)
VKontakte: code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@14391 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src/vk_chats.cpp')
-rw-r--r--protocols/VKontakte/src/vk_chats.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp
index e7d94e6a75..fbc2bd10c5 100644
--- a/protocols/VKontakte/src/vk_chats.cpp
+++ b/protocols/VKontakte/src/vk_chats.cpp
@@ -35,9 +35,8 @@ CVkChatInfo* CVkProto::AppendChat(int id, const JSONNode &jnDlg)
return NULL;
MCONTACT chatContact = FindChat(id);
- if (chatContact)
- if (getBool(chatContact, "kicked"))
- return NULL;
+ if (chatContact && getBool(chatContact, "kicked"))
+ return NULL;
CVkChatInfo *c = m_chats.find((CVkChatInfo*)&id);
if (c != NULL)
@@ -81,7 +80,7 @@ CVkChatInfo* CVkProto::AppendChat(int id, const JSONNode &jnDlg)
setDword(gci.hContact, "vk_chat_id", id);
db_unset(gci.hContact, m_szModuleName, "off");
- if (jnDlg["left"].as_int() == 1) {
+ if (jnDlg["left"].as_bool()) {
setByte(gci.hContact, "off", 1);
m_chats.remove(c);
return NULL;
@@ -145,7 +144,7 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe
if (!jnInfo["title"].isnull())
SetChatTitle(cc, jnInfo["title"].as_mstring());
- if (jnInfo["left"].as_int() == 1 || jnInfo["kicked"].as_int() == 1) {
+ if (jnInfo["left"].as_bool() || jnInfo["kicked"].as_bool()) {
setByte(cc->m_hContact, "kicked", (int)true);
LeaveChat(cc->m_chatid);
return;
@@ -295,7 +294,7 @@ void CVkProto::AppendChatMessage(int id, const JSONNode &jnMsg, bool bIsHistory)
CMString tszBody(jnMsg["body"].as_mstring());
const JSONNode &jnFwdMessages = jnMsg["fwd_messages"];
- if (!jnFwdMessages.isnull()){
+ if (!jnFwdMessages.isnull()) {
CMString tszFwdMessages = GetFwdMessages(jnFwdMessages, bbcNo);
if (!tszBody.IsEmpty())
tszFwdMessages = _T("\n") + tszFwdMessages;
@@ -303,14 +302,14 @@ void CVkProto::AppendChatMessage(int id, const JSONNode &jnMsg, bool bIsHistory)
}
const JSONNode &jnAttachments = jnMsg["attachments"];
- if (!jnAttachments.isnull()){
+ if (!jnAttachments.isnull()) {
CMString tszAttachmentDescr = GetAttachmentDescr(jnAttachments, bbcNo);
if (!tszBody.IsEmpty())
tszAttachmentDescr = _T("\n") + tszAttachmentDescr;
tszBody += tszAttachmentDescr;
}
- if (tszBody.IsEmpty() && !jnMsg["action"].isnull()){
+ if (tszBody.IsEmpty() && !jnMsg["action"].isnull()) {
bIsAction = true;
CMString tszAction = jnMsg["action"].as_mstring();
@@ -702,9 +701,8 @@ void CVkProto::KickFromChat(int chat_id, int user_id, const JSONNode &jnMsg)
debugLogA("CVkProto::KickFromChat (%d)", user_id);
MCONTACT chatContact = FindChat(chat_id);
- if (chatContact)
- if (getBool(chatContact, "off"))
- return;
+ if (chatContact && getBool(chatContact, "off"))
+ return;
if (user_id == m_myUserId)
LeaveChat(chat_id);