summaryrefslogtreecommitdiff
path: root/protocols/VKontakte
diff options
context:
space:
mode:
authorElzorFox <elzorfox@ya.ru>2017-05-18 16:07:00 +0500
committerElzorFox <elzorfox@ya.ru>2017-05-18 16:07:00 +0500
commit184a5605996658f20c65d3b89f9c155b12e62585 (patch)
tree4dee1a6cb3d17efe721c87a99ef7c24c069e8010 /protocols/VKontakte
parentde4f7d73f68c0ae87180afa6e83649b2d1a41b17 (diff)
VKontakte:
fix random server delivery processing show error popups for sending messages errors
Diffstat (limited to 'protocols/VKontakte')
-rw-r--r--protocols/VKontakte/src/misc.cpp12
-rw-r--r--protocols/VKontakte/src/vk.h65
-rw-r--r--protocols/VKontakte/src/vk_messages.cpp5
-rw-r--r--protocols/VKontakte/src/vk_proto.h21
4 files changed, 58 insertions, 45 deletions
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp
index e81995c79a..16dd759805 100644
--- a/protocols/VKontakte/src/misc.cpp
+++ b/protocols/VKontakte/src/misc.cpp
@@ -334,6 +334,15 @@ bool CVkProto::CheckJsonResult(AsyncHttpRequest *pReq, const JSONNode &jnNode)
case VKERR_ACC_WALL_POST_DENIED:
MsgPopup(NULL, TranslateT("Access to adding post denied"), TranslateT("Error"), true);
break;
+ case VKERR_CANT_SEND_USER_ON_BLACKLIST:
+ MsgPopup(NULL, TranslateT("Can\'t send messages for users from blacklist"), TranslateT("Error"), true);
+ break;
+ case VKERR_CANT_SEND_USER_WITHOUT_DIALOGS:
+ MsgPopup(NULL, TranslateT("Can\'t send messages for users without dialogs"), TranslateT("Error"), true);
+ break;
+ case VKERR_CANT_SEND_YOU_ON_BLACKLIST:
+ MsgPopup(NULL, TranslateT("Can\'t send messages to this user due to their privacy settings"), TranslateT("Error"), true);
+ break;
case VKERR_COULD_NOT_SAVE_FILE:
case VKERR_INVALID_ALBUM_ID:
case VKERR_INVALID_SERVER:
@@ -345,7 +354,8 @@ 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 also CVkProto::SendFileFiled
break;
}
diff --git a/protocols/VKontakte/src/vk.h b/protocols/VKontakte/src/vk.h
index be73aaf2a9..e47393234b 100644
--- a/protocols/VKontakte/src/vk.h
+++ b/protocols/VKontakte/src/vk.h
@@ -47,38 +47,41 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define VKFLAG_MSGMEDIA 512 // сообщение содержит медиаконтент
// Errors
-#define VKERR_NO_JSONNODE -2 // No JSON Node in server reply
-#define VKERR_OFFLINE -1 // Proto is offline
-#define VKERR_NOERRORS 0 // No error
-#define VKERR_UNKNOWN 1 // Unknown error occurred
-#define VKERR_TOO_MANY_REQ_PER_SEC 6 // Too many requests per second
-#define VKERR_AUTHORIZATION_FAILED 5 // User authorization failed
-#define VKERR_FLOOD_CONTROL 9 // Flood control
-#define VKERR_INTERNAL_SERVER_ERR 10 // Internal server error
-#define VKERR_CAPTCHA_NEEDED 14 // Captcha needed
-#define VKERR_ACCESS_DENIED 15 // Access denied
-#define VKERR_VALIDATION_REQUIRED 17 // Validation Required
-#define VKERR_COULD_NOT_SAVE_FILE 105 // Couldn't save file
-#define VKERR_INVALID_ALBUM_ID 114 // Invalid album id
-#define VKERR_INVALID_SERVER 118 // Invalid server
-#define VKERR_INVALID_PARAMETERS 100 // One of the parameters specified was missing or invalid
-#define VKERR_INVALID_HASH 121 // Invalid hash
-#define VKERR_INVALID_AUDIO 123 // Invalid audio
-#define VKERR_HIMSELF_AS_FRIEND 174 // Cannot add user himself as friend
-#define VKERR_YOU_ON_BLACKLIST 175 // Cannot add this user to friends as they have put you on their blacklist
-#define VKERR_USER_ON_BLACKLIST 176 // Cannot add this user to friends as you put him on blacklist
-#define VKERR_ACC_WALL_POST_DENIED 214 // Access to adding post denied
-#define VKERR_AUDIO_DEL_COPYRIGHT 270 // The audio file was removed by the copyright holder and cannot be reuploaded.
-#define VKERR_INVALID_FILENAME 301 // Invalid filename
-#define VKERR_INVALID_FILESIZE 302 // Invalid filesize
+#define VKERR_NO_JSONNODE -2 // No JSON Node in server reply
+#define VKERR_OFFLINE -1 // Proto is offline
+#define VKERR_NOERRORS 0 // No error
+#define VKERR_UNKNOWN 1 // Unknown error occurred
+#define VKERR_TOO_MANY_REQ_PER_SEC 6 // Too many requests per second
+#define VKERR_AUTHORIZATION_FAILED 5 // User authorization failed
+#define VKERR_FLOOD_CONTROL 9 // Flood control
+#define VKERR_INTERNAL_SERVER_ERR 10 // Internal server error
+#define VKERR_CAPTCHA_NEEDED 14 // Captcha needed
+#define VKERR_ACCESS_DENIED 15 // Access denied
+#define VKERR_VALIDATION_REQUIRED 17 // Validation Required
+#define VKERR_COULD_NOT_SAVE_FILE 105 // Couldn't save file
+#define VKERR_INVALID_ALBUM_ID 114 // Invalid album id
+#define VKERR_INVALID_SERVER 118 // Invalid server
+#define VKERR_INVALID_PARAMETERS 100 // One of the parameters specified was missing or invalid
+#define VKERR_INVALID_HASH 121 // Invalid hash
+#define VKERR_INVALID_AUDIO 123 // Invalid audio
+#define VKERR_HIMSELF_AS_FRIEND 174 // Cannot add user himself as friend
+#define VKERR_YOU_ON_BLACKLIST 175 // Cannot add this user to friends as they have put you on their blacklist
+#define VKERR_USER_ON_BLACKLIST 176 // Cannot add this user to friends as you put him on blacklist
+#define VKERR_ACC_WALL_POST_DENIED 214 // Access to adding post denied
+#define VKERR_AUDIO_DEL_COPYRIGHT 270 // The audio file was removed by the copyright holder and cannot be reuploaded.
+#define VKERR_INVALID_FILENAME 301 // Invalid filename
+#define VKERR_INVALID_FILESIZE 302 // Invalid filesize
+#define VKERR_CANT_SEND_USER_ON_BLACKLIST 900 // Can't send messages for users from blacklist
+#define VKERR_CANT_SEND_USER_WITHOUT_DIALOGS 901 // Can't send messages for users without dialogs
+#define VKERR_CANT_SEND_YOU_ON_BLACKLIST 902 // Can't send messages to this user due to their privacy settings
// File upload custom error
-#define VKERR_FILE_NOT_EXIST 10100 // File does not exist
-#define VKERR_FTYPE_NOT_SUPPORTED 10101 // File type not supported
-#define VKERR_ERR_OPEN_FILE 10103 // Error open file
-#define VKERR_ERR_READ_FILE 10104 // Error read file
-#define VKERR_FILE_NOT_UPLOADED 10105 // File upload error
-#define VKERR_INVALID_URL 10106 // Upload server returned empty URL
-#define VKERR_INVALID_USER 10107 // Invalid or unknown recipient user ID
+#define VKERR_FILE_NOT_EXIST 10100 // File does not exist
+#define VKERR_FTYPE_NOT_SUPPORTED 10101 // File type not supported
+#define VKERR_ERR_OPEN_FILE 10103 // Error open file
+#define VKERR_ERR_READ_FILE 10104 // Error read file
+#define VKERR_FILE_NOT_UPLOADED 10105 // File upload error
+#define VKERR_INVALID_URL 10106 // Upload server returned empty URL
+#define VKERR_INVALID_USER 10107 // Invalid or unknown recipient user ID
#define VK_USER_DEACTIVATE_ACTION 9321
diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp
index f32d4b1f2a..f81c624f3d 100644
--- a/protocols/VKontakte/src/vk_messages.cpp
+++ b/protocols/VKontakte/src/vk_messages.cpp
@@ -78,7 +78,7 @@ int CVkProto::SendMsg(MCONTACT hContact, int, const char *szMsg)
Push(pReq);
- if (!m_bServerDelivery && !bIsChat)
+ if (!m_vkOptions.bServerDelivery && !bIsChat)
ForkThread(&CVkProto::SendMsgAck, new CVkSendMsgParam(hContact, uMsgId));
if (!IsEmpty(pszRetMsg))
@@ -103,6 +103,7 @@ void CVkProto::OnSendMessage(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq)
JSONNode jnRoot;
const JSONNode &jnResponse = CheckJsonResponse(pReq, reply, jnRoot);
if (jnResponse) {
+ debugLogA("CVkProto::OnSendMessage jnResponse %d", jnResponse.as_int());
UINT mid;
switch (jnResponse.type()) {
case JSON_NUMBER:
@@ -137,7 +138,7 @@ void CVkProto::OnSendMessage(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq)
if (!pReq->bNeedsRestart || m_bTerminated)
delete param->pFUP;
}
- else if (m_bServerDelivery)
+ else if (m_vkOptions.bServerDelivery)
ProtoBroadcastAck(param->hContact, ACKTYPE_MESSAGE, iResult, (HANDLE)(param->iMsgID));
if (!pReq->bNeedsRestart || m_bTerminated) {
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h
index 2a2ca47667..e4ae71d9d8 100644
--- a/protocols/VKontakte/src/vk_proto.h
+++ b/protocols/VKontakte/src/vk_proto.h
@@ -120,7 +120,7 @@ struct CVkProto : public PROTO<CVkProto>
void ClearAccessToken();
wchar_t* GetUserStoredPassword(void);
void ShowCaptchaInBrowser(HBITMAP hBitmap);
-
+
static mir_cs m_csTimer;
static UINT_PTR m_timer;
CVKOptions m_vkOptions;
@@ -168,21 +168,20 @@ private:
PMI_COUNT
};
-//====================================================================================
+//====================================================================================
- bool
+ bool
m_prevError,
m_bOnline,
m_bNeedSendOnline,
m_bSetBroadcast,
m_bNotifyForEndLoadingHistory,
- m_bNotifyForEndLoadingHistoryAllContact,
- m_bTerminated,
- m_bServerDelivery;
+ m_bNotifyForEndLoadingHistoryAllContact,
+ m_bTerminated;
LONG m_myUserId;
-
- ptrA
+
+ ptrA
m_pollingServer,
m_pollingKey,
m_pollingTs,
@@ -201,7 +200,7 @@ private:
ULONG m_msgId;
- mir_cs
+ mir_cs
m_csChatTyping,
m_csLoadHistoryTask,
m_csRequestsQueue,
@@ -209,7 +208,7 @@ private:
int m_iLoadHistoryTask;
- LIST<void>
+ LIST<void>
m_sendIds,
m_incIds;
@@ -220,7 +219,7 @@ private:
CMStringA m_prevUrl;
- HGENMENU
+ HGENMENU
m_hContactMenuItems[CMI_COUNT],
m_hContactHistoryMenuItems[CHMI_COUNT],
m_hProtoMenuItems[PMI_COUNT];