diff options
author | George Hazan <george.hazan@gmail.com> | 2012-10-01 14:03:20 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-10-01 14:03:20 +0000 |
commit | eac530cf8f1c8b79e7225f4b541a25ec8a3eb215 (patch) | |
tree | ecd9165a9823a0ac8133b57ea4fef032ada5cb07 /protocols/Twitter | |
parent | 0edc1a2efbe7d5dfdc97b5c5015e3844273df649 (diff) |
fix for message encoding
git-svn-id: http://svn.miranda-ng.org/main/trunk@1745 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Twitter')
-rw-r--r-- | protocols/Twitter/chat.cpp | 36 | ||||
-rw-r--r-- | protocols/Twitter/proto.cpp | 2 |
2 files changed, 17 insertions, 21 deletions
diff --git a/protocols/Twitter/chat.cpp b/protocols/Twitter/chat.cpp index 5c247f6bdb..f73b885034 100644 --- a/protocols/Twitter/chat.cpp +++ b/protocols/Twitter/chat.cpp @@ -62,32 +62,28 @@ void TwitterProto::UpdateChat(const twitter_user &update) int TwitterProto::OnChatOutgoing(WPARAM wParam,LPARAM lParam)
{
GCHOOK *hook = reinterpret_cast<GCHOOK*>(lParam);
- char *text;
-
- if(strcmp(hook->pDest->pszModule,m_szModuleName))
+ if ( strcmp(hook->pDest->pszModule, m_szModuleName))
return 0;
- switch(hook->pDest->iType)
- {
- case GC_USER_MESSAGE: {
- text = mir_t2a_cp(hook->ptszText,CP_UTF8);
- LOG (_T("**Chat - Outgoing message: %s"), hook->ptszText);
-
- std::string tweet(text);
- replaceAll(tweet, "%%", "%"); // the chat plugin will turn "%" into "%%", so we have to change it back :/
+ switch(hook->pDest->iType) {
+ case GC_USER_MESSAGE:
+ LOG ( _T("**Chat - Outgoing message: %s"), hook->ptszText);
+ {
+ mir_ptr<char> text( mir_utf8encodeT(hook->ptszText));
- char *varTweet;
- varTweet = mir_utf8encode(tweet.c_str());
- //strncpy(varTweet, tweet.c_str(), tweet.length()+1);
+ std::string tweet(text);
+ replaceAll(tweet, "%%", "%"); // the chat plugin will turn "%" into "%%", so we have to change it back :/
- ForkThread(&TwitterProto::SendTweetWorker, this,varTweet);
+ char *varTweet = mir_strdup( tweet.c_str());
+ ForkThread(&TwitterProto::SendTweetWorker, this, varTweet);
+ }
break;
- }
+
case GC_USER_PRIVMESS:
- text = mir_t2a(hook->ptszUID);
- CallService(MS_MSG_SENDMESSAGE,reinterpret_cast<WPARAM>(
- UsernameToHContact(text)),0);
- mir_free(text);
+ {
+ mir_ptr<char> text( mir_t2a(hook->ptszUID));
+ CallService(MS_MSG_SENDMESSAGE, WPARAM(UsernameToHContact(text)), 0);
+ }
break;
}
diff --git a/protocols/Twitter/proto.cpp b/protocols/Twitter/proto.cpp index 40f0e30ec4..f5b0698867 100644 --- a/protocols/Twitter/proto.cpp +++ b/protocols/Twitter/proto.cpp @@ -527,7 +527,7 @@ void TwitterProto::LOG(TCHAR *fmt,...) // be in MessageLoop
void TwitterProto::SendTweetWorker(void *p)
{
- if(p == 0)
+ if (p == 0)
return;
char *text = static_cast<char*>(p);
|