summaryrefslogtreecommitdiff
path: root/protocols/Twitter
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/Twitter
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/Twitter')
-rw-r--r--protocols/Twitter/src/http.cpp2
-rw-r--r--protocols/Twitter/src/proto.cpp15
2 files changed, 12 insertions, 5 deletions
diff --git a/protocols/Twitter/src/http.cpp b/protocols/Twitter/src/http.cpp
index 912219dfaf..71069d08a4 100644
--- a/protocols/Twitter/src/http.cpp
+++ b/protocols/Twitter/src/http.cpp
@@ -23,5 +23,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
std::string http::url_encode(const std::string &s)
{
- return mir_ptr<char>( mir_urlEncode( s.c_str()));
+ return (char*)mir_ptr<char>( mir_urlEncode( s.c_str()));
}
diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp
index 03b2538910..5a1aa801f6 100644
--- a/protocols/Twitter/src/proto.cpp
+++ b/protocols/Twitter/src/proto.cpp
@@ -29,6 +29,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <ctime>
#include <direct.h>
+static volatile LONG g_msgid = 1;
+
TwitterProto::TwitterProto(const char *proto_name,const TCHAR *username)
{
ProtoConstructor(this, proto_name, username);
@@ -129,9 +131,13 @@ int TwitterProto::RecvMsg(HANDLE hContact,PROTORECVEVENT *pre)
struct send_direct
{
- send_direct(HANDLE hContact,const std::string &msg) : hContact(hContact),msg(msg) {}
+ __inline send_direct(HANDLE _hContact, const std::string &_msg, int _msgid) :
+ hContact(_hContact), msg(_msg), msgid(_msgid)
+ {}
+
HANDLE hContact;
std::string msg;
+ int msgid;
};
void TwitterProto::SendSuccess(void *p)
@@ -146,7 +152,7 @@ void TwitterProto::SendSuccess(void *p)
ScopedLock s(twitter_lock_);
twit_.send_direct(dbv.pszVal,data->msg);
- ProtoBroadcastAck(m_szModuleName,data->hContact,ACKTYPE_MESSAGE,ACKRESULT_SUCCESS,(HANDLE)1,0);
+ ProtoBroadcastAck(m_szModuleName,data->hContact,ACKTYPE_MESSAGE,ACKRESULT_SUCCESS,(HANDLE)data->msgid,0);
db_free(&dbv);
}
@@ -166,8 +172,9 @@ int TwitterProto::SendMsg(HANDLE hContact,int flags,const char *msg)
else
tszMsg = mir_a2t( msg );
- ForkThread(&TwitterProto::SendSuccess, this,new send_direct(hContact,msg));
- return 1;
+ int seq = InterlockedIncrement(&g_msgid);
+ ForkThread(&TwitterProto::SendSuccess, this,new send_direct(hContact, msg, seq));
+ return seq;
}
// *************************