summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2015-09-01 21:17:13 +0000
committerRobert Pösel <robyer@seznam.cz>2015-09-01 21:17:13 +0000
commit2d9f0998c93aaba8dc23a468a916316977582ae0 (patch)
treea79e92690e1782d490c888bb52344b394d0e031d
parentfd575b8d81b020cebcb03e5aedfe7c045be5a701 (diff)
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
-rw-r--r--protocols/FacebookRM/src/db.h1
-rw-r--r--protocols/FacebookRM/src/messages.cpp7
2 files changed, 5 insertions, 3 deletions
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 <http://www.gnu.org/licenses/>.
#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);