summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM/src/messages.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-12-28 21:15:52 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-12-28 21:15:52 +0300
commitf0075f2b956969f29acd3bc9289c8a5f78faddad (patch)
tree0dbed900b3d75abc11991f1be3709994d2fdfb20 /protocols/FacebookRM/src/messages.cpp
parent8ae09e329384682579d59fc92cd7ed5de37e1351 (diff)
code cleaning
Diffstat (limited to 'protocols/FacebookRM/src/messages.cpp')
-rw-r--r--protocols/FacebookRM/src/messages.cpp22
1 files changed, 8 insertions, 14 deletions
diff --git a/protocols/FacebookRM/src/messages.cpp b/protocols/FacebookRM/src/messages.cpp
index 941f7f0327..587c55803b 100644
--- a/protocols/FacebookRM/src/messages.cpp
+++ b/protocols/FacebookRM/src/messages.cpp
@@ -38,30 +38,26 @@ void FacebookProto::SendMsgWorker(void *p)
ptrA id(getStringA(data->hContact, FACEBOOK_KEY_ID));
- if (!isOnline()) {
+ if (!isOnline())
ProtoBroadcastAck(data->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)data->msgid, (LPARAM)Translate("You cannot send messages when you are offline."));
- }
- else if (id == NULL) {
+ else if (id == NULL)
ProtoBroadcastAck(data->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)data->msgid, 0);
- }
else {
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 && tries-- > 0) {
+ while (result == SEND_MESSAGE_ERROR && tries-- > 0)
result = facy.send_message(data->msgid, data->hContact, data->msg, &error_text);
- }
+
if (result == SEND_MESSAGE_OK) {
ProtoBroadcastAck(data->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)data->msgid, 0);
// Remove from "readers" list and clear statusbar
facy.erase_reader(data->hContact);
}
- else {
- ProtoBroadcastAck(data->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)data->msgid, (LPARAM)error_text.c_str());
- }
+ else ProtoBroadcastAck(data->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)data->msgid, (LPARAM)error_text.c_str());
}
delete data;
@@ -82,9 +78,8 @@ void FacebookProto::SendChatMsgWorker(void *p)
if (hContact) {
ptrA tid_(getStringA(hContact, FACEBOOK_KEY_TID));
std::string tid;
- if (tid_ != NULL && mir_strcmp(tid_, "null")) {
+ if (tid_ != NULL && mir_strcmp(tid_, "null"))
tid = tid_;
- }
else {
// request info about chat thread
HttpRequest *request = new ThreadInfoRequest(&facy, true, data->chat_id.c_str());
@@ -113,7 +108,7 @@ int FacebookProto::SendMsg(MCONTACT hContact, int, const char *msg)
{
std::string message = msg;
unsigned int msgId = InterlockedIncrement(&facy.msgid_);
-
+
ForkThread(&FacebookProto::SendMsgWorker, new send_direct(hContact, message, msgId));
return msgId;
}
@@ -187,7 +182,7 @@ void FacebookProto::ReadMessageWorker(void *p)
ids.insert(mir_strdup(id));
}
-
+
hContacts->clear();
delete hContacts;
@@ -225,6 +220,5 @@ void FacebookProto::StickerAsSmiley(std::string sticker, const std::string &url,
cont.hContact = hContact;
cont.type = 0;
cont.path = dir;
-
CallService(MS_SMILEYADD_LOADCONTACTSMILEYS, 0, (LPARAM)&cont);
}