From 2d9f0998c93aaba8dc23a468a916316977582ae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Tue, 1 Sep 2015 21:17:13 +0000 Subject: Facebook: Lower number of send message tries to 1 and provide hidden option for it Key "SendMessageTries" (byte), default=1, min=1, max=5 git-svn-id: http://svn.miranda-ng.org/main/trunk@15141 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/FacebookRM/src/db.h | 1 + protocols/FacebookRM/src/messages.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'protocols/FacebookRM') diff --git a/protocols/FacebookRM/src/db.h b/protocols/FacebookRM/src/db.h index 3e1a0ac804..4b9e119a48 100644 --- a/protocols/FacebookRM/src/db.h +++ b/protocols/FacebookRM/src/db.h @@ -85,3 +85,4 @@ along with this program. If not, see . #define FACEBOOK_KEY_NASEEMS_SPAM_MODE "NaseemsSpamMode" // [HIDDEN] - (byte) 1 = don't load messages sent from other instances (e.g., browser) - known as "Naseem's spam mode" #define FACEBOOK_KEY_NAME_AS_NICK "NameAsNick" // [HIDDEN] - (byte) 0 = don't use real name as nickname, use nickname if possible #define FACEBOOK_KEY_OPEN_URL_BROWSER "OpenUrlBrowser" // [HIDDEN] - (unicode) = absolute path to browser to open url links with +#define FACEBOOK_KEY_SEND_MESSAGE_TRIES "SendMessageTries" // [HIDDEN] - (byte) = number of tries to send message, default=1, min=1, max=5 diff --git a/protocols/FacebookRM/src/messages.cpp b/protocols/FacebookRM/src/messages.cpp index bb123962e7..6d89c31b98 100644 --- a/protocols/FacebookRM/src/messages.cpp +++ b/protocols/FacebookRM/src/messages.cpp @@ -48,12 +48,13 @@ void FacebookProto::SendMsgWorker(void *p) ProtoBroadcastAck(data->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)data->msgid, 0); } else { - int retries = 5; + int tries = getByte(FACEBOOK_KEY_SEND_MESSAGE_TRIES, 1); + tries = min(max(tries, 1), 5); + std::string error_text; int result = SEND_MESSAGE_ERROR; - while (result == SEND_MESSAGE_ERROR && retries > 0) { + while (result == SEND_MESSAGE_ERROR && tries-- > 0) { result = facy.send_message(data->msgid, data->hContact, data->msg, &error_text); - retries--; } if (result == SEND_MESSAGE_OK) { ProtoBroadcastAck(data->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)data->msgid, 0); -- cgit v1.2.3