diff options
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/Discord/src/proto.cpp | 8 | ||||
-rw-r--r-- | protocols/Facebook/src/proto.cpp | 6 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/gg_proto.cpp | 6 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/server.cpp | 2 | ||||
-rw-r--r-- | protocols/IRCG/src/ircproto.cpp | 4 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_proto.cpp | 16 | ||||
-rw-r--r-- | protocols/Sametime/src/sametime_proto.cpp | 4 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_db.cpp | 2 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_history_sync.cpp | 2 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_messages.cpp | 17 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.cpp | 5 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.h | 3 | ||||
-rw-r--r-- | protocols/Steam/src/steam_proto.cpp | 6 | ||||
-rw-r--r-- | protocols/Telegram/src/proto.h | 9 | ||||
-rw-r--r-- | protocols/Telegram/src/server.cpp | 20 | ||||
-rw-r--r-- | protocols/Tox/src/tox_messages.cpp | 6 | ||||
-rw-r--r-- | protocols/Twitter/src/proto.cpp | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_messages.cpp | 6 | ||||
-rw-r--r-- | protocols/WhatsApp/src/proto.cpp | 8 |
19 files changed, 55 insertions, 77 deletions
diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp index de9619dda3..ed5b6e365b 100644 --- a/protocols/Discord/src/proto.cpp +++ b/protocols/Discord/src/proto.cpp @@ -480,12 +480,10 @@ void CDiscordProto::OnSendMsg(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pReq) }
}
-int CDiscordProto::SendMsg(MCONTACT hContact, int /*flags*/, const char *pszSrc)
+int CDiscordProto::SendMsg(MCONTACT hContact, int, const char *pszSrc)
{
- if (!m_bOnline) {
- ProtoBroadcastAsync(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)1, (LPARAM)TranslateT("Protocol is offline or user isn't authorized yet"));
- return 1;
- }
+ if (!m_bOnline)
+ return -1;
ptrW wszText(mir_utf8decodeW(pszSrc));
if (wszText == nullptr)
diff --git a/protocols/Facebook/src/proto.cpp b/protocols/Facebook/src/proto.cpp index 6a12db2c4d..82b45478ad 100644 --- a/protocols/Facebook/src/proto.cpp +++ b/protocols/Facebook/src/proto.cpp @@ -217,10 +217,8 @@ INT_PTR FacebookProto::GetCaps(int type, MCONTACT) int FacebookProto::SendMsg(MCONTACT hContact, int, const char *pszSrc)
{
- if (!m_bOnline) {
- ProtoBroadcastAsync(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)1, (LPARAM)TranslateT("Protocol is offline or user isn't authorized yet"));
- return 1;
- }
+ if (!m_bOnline)
+ return -1;
CMStringA userId(getMStringA(hContact, DBKEY_ID));
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index e407fa0672..ea05b30e3c 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -509,10 +509,10 @@ HWND GaduProto::CreateExtendedSearchUI(HWND owner) int GaduProto::SendMsg(MCONTACT hContact, int, const char *msg)
{
uin_t uin = (uin_t)getDword(hContact, GG_KEY_UIN, 0);
- if (!isonline() || !uin)
- return 0;
+ if (!isonline())
+ return -1;
- if (!msg)
+ if (!uin || !msg)
return 0;
gg_EnterCriticalSection(&sess_mutex, "SendMsg", 53, "sess_mutex", 1);
diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp index 9fea03f48e..74c5265389 100644 --- a/protocols/ICQ-WIM/src/server.cpp +++ b/protocols/ICQ-WIM/src/server.cpp @@ -1168,7 +1168,7 @@ void CIcqProto::OnSendMessage(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pReq) JsonReply root(pReply);
if (root.error() != 200) {
- ProtoBroadcastAck(ownMsg->m_hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)ownMsg->m_msgid, 0);
+ ProtoBroadcastAck(ownMsg->m_hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)ownMsg->m_msgid);
mir_cslock lck(m_csOwnIds);
m_arOwnIds.remove(ownMsg);
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index 3b807fea9d..0e4af4c31f 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -586,12 +586,12 @@ int CIrcProto::SendMsg(MCONTACT hContact, int, const char* pszSrc) uint8_t bDcc = getByte(hContact, "DCC", 0);
uint16_t wStatus = getWord(hContact, "Status", ID_STATUS_OFFLINE);
if (bDcc && wStatus != ID_STATUS_ONLINE) {
- ProtoBroadcastAsync(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, nullptr, (LPARAM)TranslateT("The dcc chat connection is not active"));
+ ProtoBroadcastAsync(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, 0, (LPARAM)TranslateT("The dcc chat connection is not active"));
return 0;
}
if (!bDcc && (m_iStatus == ID_STATUS_OFFLINE || m_iStatus == ID_STATUS_CONNECTING)) {
- ProtoBroadcastAsync(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, nullptr, (LPARAM)TranslateT("The protocol is not online"));
+ ProtoBroadcastAsync(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, 0, (LPARAM)TranslateT("The protocol is not online"));
return 0;
}
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index af2ccc5e94..bc038bb3fc 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -893,11 +893,12 @@ int CJabberProto::SendMsg(MCONTACT hContact, int /*flags*/, const char *pszSrc) int CJabberProto::SendMsgEx(MCONTACT hContact, const char *pszSrc, XmlNode &m)
{
- char szClientJid[JABBER_MAX_JID_LEN];
- if (!m_bJabberOnline || !GetClientJID(hContact, szClientJid, _countof(szClientJid))) {
- ProtoBroadcastAsync(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, 0, (LPARAM)TranslateT("Protocol is offline or no JID"));
+ if (!m_bJabberOnline)
return -1;
- }
+
+ char szClientJid[JABBER_MAX_JID_LEN];
+ if (!GetClientJID(hContact, szClientJid, _countof(szClientJid)))
+ return 0;
if (OmemoIsEnabled(hContact)) {
if (!OmemoCheckSession(hContact, true)) {
@@ -909,16 +910,16 @@ int CJabberProto::SendMsgEx(MCONTACT hContact, const char *pszSrc, XmlNode &m) }
CMStringA szBody;
- int isEncrypted, id = SerialNext();
+ bool isEncrypted;
if (!strncmp(pszSrc, PGP_PROLOG, mir_strlen(PGP_PROLOG))) {
const char *szEnd = strstr(pszSrc, PGP_EPILOG);
size_t nStrippedLength = mir_strlen(pszSrc) - mir_strlen(PGP_PROLOG) - (szEnd ? mir_strlen(szEnd) : 0) + 1;
szBody.Append(pszSrc + mir_strlen(PGP_PROLOG), (int)nStrippedLength);
szBody.Replace("\r\n", "");
pszSrc = szBody;
- isEncrypted = 1;
+ isEncrypted = true;
}
- else isEncrypted = 0;
+ else isEncrypted = false;
char *msgType;
if (ListGetItemPtr(LIST_CHATROOM, szClientJid) && strchr(szClientJid, '/') == nullptr)
@@ -959,6 +960,7 @@ int CJabberProto::SendMsgEx(MCONTACT hContact, const char *pszSrc, XmlNode &m) m << XCHILDNS("markable", JABBER_FEAT_CHAT_MARKERS);
}
+ int id = SerialNext();
if (
// if message delivery check disabled by entity caps manager
(jcb & JABBER_CAPS_MESSAGE_EVENTS_NO_DELIVERY) ||
diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp index 179f01999d..adb4f67ce0 100644 --- a/protocols/Sametime/src/sametime_proto.cpp +++ b/protocols/Sametime/src/sametime_proto.cpp @@ -201,7 +201,7 @@ int CSametimeProto::SendMsg(MCONTACT hContact, int, const char* msg) char *proto = Proto_GetBaseAccountName(hContact);
if (!proto || mir_strcmp(proto, m_szModuleName) != 0 || db_get_w(hContact, m_szModuleName, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) {
- ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, 0);
+ ProtoBroadcastAsync(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, 0);
return 0;
}
@@ -209,7 +209,7 @@ int CSametimeProto::SendMsg(MCONTACT hContact, int, const char* msg) return 0;
int ret = (INT_PTR)SendMessageToUser(hContact, msg);
- ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)ret);
+ ProtoBroadcastAsync(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)ret);
return ret;
}
diff --git a/protocols/SkypeWeb/src/skype_db.cpp b/protocols/SkypeWeb/src/skype_db.cpp index af8abcda5a..89235f6e4b 100644 --- a/protocols/SkypeWeb/src/skype_db.cpp +++ b/protocols/SkypeWeb/src/skype_db.cpp @@ -55,7 +55,7 @@ MEVENT CSkypeProto::AddDbEvent(uint16_t type, MCONTACT hContact, uint32_t timest return db_event_add(hContact, &dbei);
}
-void CSkypeProto::EditEvent(MCONTACT hContact, MEVENT hEvent, const CMStringW &szContent, time_t edit_time)
+void CSkypeProto::EditEvent(MEVENT hEvent, const CMStringW &szContent, time_t edit_time)
{
mir_cslock lck(m_AppendMessageLock);
diff --git a/protocols/SkypeWeb/src/skype_history_sync.cpp b/protocols/SkypeWeb/src/skype_history_sync.cpp index 0b2a060d03..b10897b0d3 100644 --- a/protocols/SkypeWeb/src/skype_history_sync.cpp +++ b/protocols/SkypeWeb/src/skype_history_sync.cpp @@ -77,7 +77,7 @@ void CSkypeProto::OnGetServerHistory(NETLIBHTTPREQUEST *response, AsyncHttpReque CMStringW szMessage(messageType == "RichText" ? RemoveHtml(wszContent) : wszContent);
MEVENT dbevent = GetMessageFromDb(szMessageId);
if (isEdited && dbevent != NULL)
- EditEvent(hContact, dbevent, szMessage, timestamp);
+ EditEvent(dbevent, szMessage, timestamp);
else
AddDbEvent(emoteOffset == 0 ? EVENTTYPE_MESSAGE : SKYPE_DB_EVENT_TYPE_ACTION, hContact, timestamp, iFlags, szMessage.c_str()+emoteOffset, szMessageId);
}
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index 59980fe873..25e15e73b1 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -20,12 +20,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. /* MESSAGE SENDING */
// outcoming message flow
-int CSkypeProto::OnSendMessage(MCONTACT hContact, int, const char *szMessage)
+int CSkypeProto::SendMsg(MCONTACT hContact, int, const char *szMessage)
{
- if (!IsOnline()) {
- ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, NULL, (LPARAM)TranslateT("You cannot send when you are offline."));
- return 0;
- }
+ if (!IsOnline())
+ return -1;
SendMessageParam *param = new SendMessageParam();
param->hContact = hContact;
@@ -41,10 +39,9 @@ int CSkypeProto::OnSendMessage(MCONTACT hContact, int, const char *szMessage) pReq = new SendMessageRequest(id, param->hMessage, szMessage);
pReq->pUserInfo = param;
PushRequest(pReq);
- {
- mir_cslock lck(m_lckOutMessagesList);
- m_OutMessages.insert((void*)param->hMessage);
- }
+
+ mir_cslock lck(m_lckOutMessagesList);
+ m_OutMessages.insert((void*)param->hMessage);
return param->hMessage;
}
@@ -134,7 +131,7 @@ void CSkypeProto::OnPrivateMessageEvent(const JSONNode &node) MEVENT hDbEvent = GetMessageFromDb(szMessageId);
if (bEdited && hDbEvent != NULL)
- EditEvent(hContact, hDbEvent, wszContent, timestamp);
+ EditEvent(hDbEvent, wszContent, timestamp);
else {
T2Utf szMsg(wszContent);
PROTORECVEVENT recv = {};
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index b365b6a1ef..35b500a0a7 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -224,11 +224,6 @@ int CSkypeProto::GetInfo(MCONTACT hContact, int) return 0;
}
-int CSkypeProto::SendMsg(MCONTACT hContact, int flags, const char *msg)
-{
- return OnSendMessage(hContact, flags, msg);
-}
-
int CSkypeProto::SetStatus(int iNewStatus)
{
if (iNewStatus == m_iDesiredStatus)
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 3bc4a5a6c2..9236c905c5 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -265,9 +265,8 @@ private: MEVENT GetMessageFromDb(const char *messageId);
MEVENT AddDbEvent(uint16_t type, MCONTACT hContact, uint32_t timestamp, uint32_t flags, const CMStringW &content, const CMStringA &msgId);
- void EditEvent(MCONTACT hContact, MEVENT hEvent, const CMStringW &content, time_t edit_time);
+ void EditEvent(MEVENT hEvent, const CMStringW &content, time_t edit_time);
- int OnSendMessage(MCONTACT hContact, int flags, const char *message);
int __cdecl OnPreCreateMessage(WPARAM, LPARAM lParam);
void MarkMessagesRead(MCONTACT hContact, MEVENT hDbEvent);
diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp index 5475a4368e..a37c9521e0 100644 --- a/protocols/Steam/src/steam_proto.cpp +++ b/protocols/Steam/src/steam_proto.cpp @@ -245,10 +245,8 @@ HANDLE CSteamProto::SearchByName(const wchar_t *nick, const wchar_t *firstName, int CSteamProto::SendMsg(MCONTACT hContact, int, const char *message)
{
- if (!IsOnline()) {
- ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, nullptr, (LPARAM)TranslateT("You cannot send messages when you are offline."));
- return 0;
- }
+ if (!IsOnline())
+ return -1;
return OnSendMessage(hContact, message);
}
diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h index ad11cce7bf..c3d0252a06 100644 --- a/protocols/Telegram/src/proto.h +++ b/protocols/Telegram/src/proto.h @@ -194,8 +194,7 @@ class CTelegramProto : public PROTO<CTelegramProto> TD::array<TD::int53> m_deleteIds; bool m_bAuthorized, m_bTerminated, m_bUnregister = false, m_bSmileyAdd = false; - int32_t m_iClientId, m_iMsgId; - int64_t m_iQueryId; + int32_t m_iClientId, m_iQueryId; OBJLIST<TG_OWN_MESSAGE> m_arOwnMsg; OBJLIST<TG_REQUEST_BASE> m_arRequests; @@ -217,7 +216,7 @@ class CTelegramProto : public PROTO<CTelegramProto> void OnGetFileInfo(td::ClientManager::Response &response, void *pUserInfo); void OnGetHistory(td::ClientManager::Response &response, void *pUserInfo); void OnSendFile(td::ClientManager::Response &response, void *pUserInfo); - void OnSendMessage(td::ClientManager::Response &response, void *pUserInfo); + void OnSendMessage(td::ClientManager::Response &response); void OnUpdateAuth(td::ClientManager::Response &response); void LogOut(void); @@ -227,8 +226,8 @@ class CTelegramProto : public PROTO<CTelegramProto> void SendKeepAlive(void); void SendDeleteMsg(void); void SendMarkRead(void); - void SendQuery(TD::Function *pFunc, TG_QUERY_HANDLER pHandler = nullptr); - void SendQuery(TD::Function *pFunc, TG_QUERY_HANDLER_FULL pHandler, void *pUserInfo); + int SendQuery(TD::Function *pFunc, TG_QUERY_HANDLER pHandler = nullptr); + int SendQuery(TD::Function *pFunc, TG_QUERY_HANDLER_FULL pHandler, void *pUserInfo); int SendTextMessage(int64_t chatId, const char *pszMessage); void ProcessAuth(TD::updateAuthorizationState *pObj); diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp index 878a24d61e..3eb42bd103 100644 --- a/protocols/Telegram/src/server.cpp +++ b/protocols/Telegram/src/server.cpp @@ -240,7 +240,7 @@ void CTelegramProto::ProcessResponse(td::ClientManager::Response response) /////////////////////////////////////////////////////////////////////////////////////////
-void CTelegramProto::OnSendMessage(td::ClientManager::Response &response, void *pUserInfo)
+void CTelegramProto::OnSendMessage(td::ClientManager::Response &response)
{
if (!response.object)
return;
@@ -253,13 +253,11 @@ void CTelegramProto::OnSendMessage(td::ClientManager::Response &response, void * auto *pMessage = ((TD::message *)response.object.get());
auto *pUser = FindChat(pMessage->chat_id_);
if (pUser)
- m_arOwnMsg.insert(new TG_OWN_MESSAGE(pUser->hContact, pUserInfo, pMessage->id_));
+ m_arOwnMsg.insert(new TG_OWN_MESSAGE(pUser->hContact, (HANDLE)response.request_id, pMessage->id_));
}
int CTelegramProto::SendTextMessage(int64_t chatId, const char *pszMessage)
{
- int ret = ++m_iMsgId;
-
auto pContent = TD::make_object<TD::inputMessageText>();
pContent->text_ = TD::make_object<TD::formattedText>();
pContent->text_->text_ = std::move(pszMessage);
@@ -267,15 +265,13 @@ int CTelegramProto::SendTextMessage(int64_t chatId, const char *pszMessage) auto *pMessage = new TD::sendMessage();
pMessage->chat_id_ = chatId;
pMessage->input_message_content_ = std::move(pContent);
- SendQuery(pMessage, &CTelegramProto::OnSendMessage, (void *)ret);
-
- return ret;
+ return SendQuery(pMessage, &CTelegramProto::OnSendMessage);
}
-void CTelegramProto::SendQuery(TD::Function *pFunc, TG_QUERY_HANDLER pHandler)
+int CTelegramProto::SendQuery(TD::Function *pFunc, TG_QUERY_HANDLER pHandler)
{
if (!m_pClientManager)
- return;
+ return -1;
int queryId = ++m_iQueryId;
@@ -286,12 +282,13 @@ void CTelegramProto::SendQuery(TD::Function *pFunc, TG_QUERY_HANDLER pHandler) if (pHandler)
m_arRequests.insert(new TG_REQUEST(queryId, pHandler));
+ return queryId;
}
-void CTelegramProto::SendQuery(TD::Function *pFunc, TG_QUERY_HANDLER_FULL pHandler, void *pUserInfo)
+int CTelegramProto::SendQuery(TD::Function *pFunc, TG_QUERY_HANDLER_FULL pHandler, void *pUserInfo)
{
if (!m_pClientManager)
- return;
+ return -1;
int queryId = ++m_iQueryId;
@@ -302,6 +299,7 @@ void CTelegramProto::SendQuery(TD::Function *pFunc, TG_QUERY_HANDLER_FULL pHandl if (pHandler)
m_arRequests.insert(new TG_REQUEST_FULL(queryId, pHandler, pUserInfo));
+ return queryId;
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/Tox/src/tox_messages.cpp b/protocols/Tox/src/tox_messages.cpp index 306fbf9312..264385db69 100644 --- a/protocols/Tox/src/tox_messages.cpp +++ b/protocols/Tox/src/tox_messages.cpp @@ -110,10 +110,8 @@ void CToxProto::SendMessageAsync(void *arg) int CToxProto::OnSendMessage(MCONTACT hContact, const char *szMessage)
{
- if (!IsOnline()) {
- ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, nullptr, (LPARAM)TranslateT("You cannot send when you are offline."));
- return 0;
- }
+ if (!IsOnline())
+ return -1;
UINT hMessage = InterlockedIncrement(&hMessageProcess);
diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index 4dd61c6c53..05cefe2748 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -123,7 +123,7 @@ INT_PTR CTwitterProto::GetCaps(int type, MCONTACT) int CTwitterProto::SendMsg(MCONTACT hContact, int, const char *msg)
{
if (m_iStatus != ID_STATUS_ONLINE)
- return 0;
+ return -1;
CMStringA id(getMStringA(hContact, TWITTER_KEY_ID));
if (id.IsEmpty())
diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp index a5f95dfdf5..f45233e7a0 100644 --- a/protocols/VKontakte/src/vk_messages.cpp +++ b/protocols/VKontakte/src/vk_messages.cpp @@ -22,10 +22,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. int CVkProto::SendMsg(MCONTACT hContact, int, const char *szMsg)
{
debugLogA("CVkProto::SendMsg");
- if (!IsOnline()) {
- ProtoBroadcastAsync(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, 0);
- return 0;
- }
+ if (!IsOnline())
+ return -1;
bool bIsChat = isChatRoom(hContact);
diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp index be3526d996..917ca012aa 100644 --- a/protocols/WhatsApp/src/proto.cpp +++ b/protocols/WhatsApp/src/proto.cpp @@ -245,15 +245,13 @@ int WhatsAppProto::SetStatus(int iNewStatus) int WhatsAppProto::SendMsg(MCONTACT hContact, int, const char *pszMsg)
{
+ if (!isOnline())
+ return -1;
+
ptrA jid(getStringA(hContact, DBKEY_ID));
if (jid == nullptr || pszMsg == nullptr)
return 0;
- if (!isOnline()) {
- debugLogA("No connection");
- return 0;
- }
-
return SendTextMessage(jid, pszMsg);
}
|