summaryrefslogtreecommitdiff
path: root/protocols/Gadu-Gadu/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-04-20 10:41:27 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-04-20 10:41:27 +0000
commit2ffa7047ec0475856481b9e813eecb99b268d2d0 (patch)
tree0fda1b8c11a018c049b07e20059e38e1c693e266 /protocols/Gadu-Gadu/src
parent5560fccb85a89bb668a79eed3d4cd0e668278331 (diff)
protocols must return unique ids on SendMsg
git-svn-id: http://svn.miranda-ng.org/main/trunk@4481 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Gadu-Gadu/src')
-rw-r--r--protocols/Gadu-Gadu/src/gg_proto.cpp38
1 files changed, 18 insertions, 20 deletions
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp
index f52f97b76c..50c1a59dee 100644
--- a/protocols/Gadu-Gadu/src/gg_proto.cpp
+++ b/protocols/Gadu-Gadu/src/gg_proto.cpp
@@ -606,9 +606,11 @@ void __cdecl GGPROTO::sendackthread(void *ack)
int GGPROTO::SendMsg(HANDLE hContact, int flags, const char *msg)
{
- uin_t uin;
- char* msg_utf8;
+ uin_t uin = (uin_t)db_get_dw(hContact, m_szModuleName, GG_KEY_UIN, 0);
+ if (!isonline() || !uin)
+ return 0;
+ char* msg_utf8;
if ( flags & PREF_TCHAR )
msg_utf8 = mir_utf8encodeT( ( wchar_t* )&msg[ strlen( msg )+1 ] );
else if ( flags & PREF_UTF )
@@ -616,32 +618,28 @@ int GGPROTO::SendMsg(HANDLE hContact, int flags, const char *msg)
else
msg_utf8 = mir_utf8encode(msg);
+ if (!msg_utf8)
+ return 0;
- if (msg_utf8 && isonline() && (uin = (uin_t)db_get_dw(hContact, m_szModuleName, GG_KEY_UIN, 0)))
+ gg_EnterCriticalSection(&sess_mutex, "SendMsg", 53, "sess_mutex", 1);
+ int seq = gg_send_message(sess, GG_CLASS_CHAT, uin, (BYTE*)msg_utf8);
+ gg_LeaveCriticalSection(&sess_mutex, "SendMsg", 53, 1, "sess_mutex", 1);
+ if (!db_get_b(NULL, m_szModuleName, GG_KEY_MSGACK, GG_KEYDEF_MSGACK))
{
- int seq;
- gg_EnterCriticalSection(&sess_mutex, "SendMsg", 53, "sess_mutex", 1);
- seq = gg_send_message(sess, GG_CLASS_CHAT, uin, (BYTE*)msg_utf8);
- gg_LeaveCriticalSection(&sess_mutex, "SendMsg", 53, 1, "sess_mutex", 1);
- if (!db_get_b(NULL, m_szModuleName, GG_KEY_MSGACK, GG_KEYDEF_MSGACK))
+ // Auto-ack message without waiting for server ack
+ GG_SEQ_ACK *ack = (GG_SEQ_ACK*)mir_alloc(sizeof(GG_SEQ_ACK));
+ if (ack)
{
- // Auto-ack message without waiting for server ack
- GG_SEQ_ACK *ack = (GG_SEQ_ACK*)mir_alloc(sizeof(GG_SEQ_ACK));
- if (ack)
- {
- ack->seq = seq;
- ack->hContact = hContact;
+ ack->seq = seq;
+ ack->hContact = hContact;
#ifdef DEBUGMODE
- netlog("SendMsg(): forkthread 16 GGPROTO::sendackthread");
+ netlog("SendMsg(): forkthread 16 GGPROTO::sendackthread");
#endif
- forkthread(&GGPROTO::sendackthread, ack);
- }
+ forkthread(&GGPROTO::sendackthread, ack);
}
- mir_free(msg_utf8);
- return seq;
}
mir_free(msg_utf8);
- return 0;
+ return seq;
}
//////////////////////////////////////////////////////////