diff options
Diffstat (limited to 'protocols/Twitter/src')
-rw-r--r-- | protocols/Twitter/src/http.cpp | 2 | ||||
-rw-r--r-- | protocols/Twitter/src/proto.cpp | 15 |
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;
}
// *************************
|